useblocks 1.1.45 → 1.1.49

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.
Files changed (80) hide show
  1. package/iframe/js/amp.BP7EklKo.js +1 -0
  2. package/iframe/js/iframe-eblock.js +1 -1
  3. package/iframe/js/iframe.js +1 -1
  4. package/iframe/js/rules.4N5s3OV-.js +1 -1
  5. package/monacoeditorwork/css.worker.bundle.js +40524 -40442
  6. package/monacoeditorwork/editor.worker.bundle.js +9740 -9697
  7. package/monacoeditorwork/html.worker.bundle.js +50513 -50431
  8. package/monacoeditorwork/json.worker.bundle.js +14570 -14527
  9. package/monacoeditorwork/ts.worker.bundle.js +119593 -119455
  10. package/npm-publish.manifest.json +7 -7
  11. package/package.json +1 -1
  12. package/runtime/@ant-design/cssinjs/index.js +1 -1
  13. package/runtime/@ant-design/icons/index.js +2 -2
  14. package/runtime/README.md +1 -1
  15. package/runtime/THIRD_PARTY_LICENSES.txt +70 -42
  16. package/runtime/antd/index.js +1 -1
  17. package/runtime/react/index.js +3 -3
  18. package/runtime/react/jsx-runtime/index.js +1 -1
  19. package/runtime/react-dom/client/index.js +4 -4
  20. package/runtime/react-dom/index.js +3 -3
  21. package/runtime/react-router-dom/index.js +2 -2
  22. package/singlepage_headless_plugin.html +1 -1
  23. package/static/core/{cb72ea5e.js → 11296a18.js} +51 -51
  24. package/static/core/{7d884291.js → 13d197af.js} +20 -20
  25. package/static/core/13f581cc.js +924 -0
  26. package/static/core/{6450546e2.js → 1ca5f3772.js} +184 -155
  27. package/static/core/{af153381.js → 339377b8.js} +15657 -15202
  28. package/static/core/{94f2c0df.js → 386cf7b3.js} +9673 -9544
  29. package/static/core/{b7a9d262.js → 3b4845f7.js} +353 -334
  30. package/static/core/{d14cb6e2.js → 3dea3b87.js} +7 -7
  31. package/static/core/59023866.js +2090 -0
  32. package/static/core/{bc098620.js → 7a229b90.js} +3 -3
  33. package/static/core/{48b80eec.js → 8c81db36.js} +3 -3
  34. package/static/core/{8c84cc76.js → 8e110c69.js} +24 -24
  35. package/static/core/{2f2019c1.js → a11c28c2.js} +258 -240
  36. package/static/core/{fd4fa049.js → aacf134d.js} +745 -664
  37. package/static/core/{5e0828e3.js → acb049cb.js} +1349 -1297
  38. package/static/core/{bb774fb9.js → c59f9731.js} +7724 -6646
  39. package/static/core/{ed0ecf0a.js → de79e0c5.js} +3947 -3705
  40. package/static/core/e7c24fe9.js +649 -0
  41. package/static/esm/{dab4cdfd.js → 448d4bb0.js} +70 -70
  42. package/static/esm/{7c5227f0.js → d180c108.js} +50 -47
  43. package/static/runtime/{DownloadOutlined-CgJ8OpH_.js → DownloadOutlined-Dg_G2xO7.js} +4 -4
  44. package/static/runtime/client-CfXgU5Vo.js +7580 -0
  45. package/static/runtime/{defineProperty-B-FyVNQF.js → defineProperty-C_9hhJHt.js} +1 -1
  46. package/static/runtime/dom-export-CHgQ7Ws9.js +8069 -0
  47. package/static/runtime/{es-DnZp8dh1.js → es-BPfImJ0x.js} +5 -5
  48. package/static/runtime/{es-B2DS-PLP.js → es-DcH6fwd6.js} +2 -2
  49. package/static/runtime/{es-deqzngIL.js → es-_OY-D9g1.js} +2 -2
  50. package/static/runtime/{jsx-dev-runtime-Wj1_6O79.js → jsx-dev-runtime-DDukXY54.js} +2 -2
  51. package/static/runtime/jsx-runtime-BodCQYDg.js +22 -0
  52. package/static/runtime/react-BHNx_xzv.js +290 -0
  53. package/static/runtime/react-dom-CyByzibb.js +127 -0
  54. package/two_step_headless_plugin.html +1 -1
  55. package/{useblocks-core.ecd1a3b0.js → useblocks-core.15a9129c.js} +82 -76
  56. package/useblocks-esm.js +628 -3197
  57. package/useblocks.d.ts +190 -52
  58. package/useblocks.js +818 -12587
  59. package/vite/index.cjs +46 -21
  60. package/vite/index.d.ts +0 -1
  61. package/vite/index.js +46 -21
  62. package/vite/pluginDev/index.d.ts +0 -1
  63. package/webpack/index.cjs +46 -21
  64. package/webpack/index.d.ts +0 -1
  65. package/webpack/index.js +46 -21
  66. package/webpack/pluginDev/index.d.ts +0 -1
  67. package/iframe/js/amp.CVC2Iq48.js +0 -1
  68. package/static/core/632d894f.js +0 -869
  69. package/static/core/c28bc42e.js +0 -46
  70. package/static/core/ff830d19.js +0 -2046
  71. package/static/esm/2fb07398.js +0 -3480
  72. package/static/esm/352121c5.js +0 -55
  73. package/static/esm/64966e1c.js +0 -18
  74. package/static/runtime/client-CM3WFcip.js +0 -7
  75. package/static/runtime/dist-DUS42Hru.js +0 -3421
  76. package/static/runtime/jsx-runtime-DmPQfqtr.js +0 -28
  77. package/static/runtime/react-DIf5CLST.js +0 -258
  78. package/static/runtime/react-dom-Cc3IcUkg.js +0 -5604
  79. /package/iframe/{iframe-eblock.ecd1a3b0.html → iframe-eblock.15a9129c.html} +0 -0
  80. /package/iframe/{iframe.ecd1a3b0.html → iframe.15a9129c.html} +0 -0
@@ -0,0 +1,2090 @@
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/59023866.js", [
3
+ "require",
4
+ "exports",
5
+ "module",
6
+ "static/core/bd36b180.js",
7
+ "static/core/c59f9731.js",
8
+ "static/core/13f581cc.js",
9
+ "static/core/acb049cb.js",
10
+ "static/core/386cf7b3.js",
11
+ "static/core/1ca5f3772.js",
12
+ "static/core/3b4845f7.js",
13
+ "react",
14
+ "react-router-dom",
15
+ "react/jsx-runtime",
16
+ "prop-types"
17
+ ], function(le, vt, un) {
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");
19
+ let n = le("react");
20
+ n = Je.__toESM(n);
21
+ let Te = le("react-router-dom"), r = le("react/jsx-runtime"), Ne = le("prop-types");
22
+ Ne = Je.__toESM(Ne);
23
+ function bt(t, e) {
24
+ return { [t]: {
25
+ Filter: e("Filter"),
26
+ filter: e("filter"),
27
+ Resize: e("Resize"),
28
+ resize: e("resize"),
29
+ Crop: e("Crop"),
30
+ Width: e("Width"),
31
+ width: e("width"),
32
+ Height: e("Height"),
33
+ height: e("height"),
34
+ "Background color": e("Background color"),
35
+ Cancel: e("Cancel"),
36
+ Create: e("Create"),
37
+ Objects: e("Objects"),
38
+ Quality: e("Quality"),
39
+ Save: e("Save"),
40
+ "Loading Canvas": e("Loading Canvas"),
41
+ "Loading Image": e("Loading Image"),
42
+ "Loading State": e("Loading State"),
43
+ "Processing Image": e("Processing Image"),
44
+ Close: e("Close"),
45
+ Apply: e("Apply"),
46
+ Font: e("Font"),
47
+ Color: e("Color"),
48
+ Background: e("Background"),
49
+ Image: e("Image"),
50
+ Opacity: e("Opacity"),
51
+ Outline: e("Outline"),
52
+ Shadow: e("Shadow"),
53
+ Gradient: e("Gradient"),
54
+ Texture: e("Texture"),
55
+ "Replace Image": e("Replace Image"),
56
+ "Outline Color": e("Outline Color"),
57
+ "Shadow Color": e("Shadow Color"),
58
+ "Font Size": e("Font Size"),
59
+ Radius: e("Radius"),
60
+ "Brush Color": e("Brush Color"),
61
+ "Brush Type": e("Brush Type"),
62
+ "Brush Size": e("Brush Size"),
63
+ History: e("History"),
64
+ "Maintain aspect ratio": e("Maintain aspect ratio"),
65
+ "New Text": e("New Text"),
66
+ Size: e("Size"),
67
+ Draw: e("Draw"),
68
+ Text: e("Text"),
69
+ Stickers: e("Stickers"),
70
+ Frame: e("Frame"),
71
+ Shapes: e("Shapes"),
72
+ Corners: e("Corners"),
73
+ corners: e("corners"),
74
+ Done: e("Done"),
75
+ "Applied Filters": e("Applied Filters"),
76
+ "Resized Image": e("Resized Image"),
77
+ "Cropped Image": e("Cropped Image"),
78
+ "Added Drawing": e("Added Drawing"),
79
+ "Added Text": e("Added Text"),
80
+ "Added Shape": e("Added Shape"),
81
+ "Added Sticker": e("Added Sticker"),
82
+ "Added Frame": e("Added Frame"),
83
+ "Merged Objects": e("Merged Objects"),
84
+ "Rounded Corner": e("Rounded Corner"),
85
+ "Replaced Background Image": e("Replaced Background Image"),
86
+ "Added Image": e("Added Image"),
87
+ Initial: e("Initial"),
88
+ "Loaded State": e("Loaded State"),
89
+ "Changed Style": e("Changed Style"),
90
+ "Deleted object": e("Deleted object"),
91
+ Merge: e("Merge"),
92
+ Emoticons: e("Emoticons"),
93
+ Doodles: e("Doodles"),
94
+ Landmarks: e("Landmarks"),
95
+ Bubbles: e("Bubbles"),
96
+ Transportation: e("Transportation"),
97
+ Beach: e("Beach"),
98
+ PencilBrush: e("PencilBrush"),
99
+ SprayBrush: e("SprayBrush"),
100
+ CircleBrush: e("CircleBrush"),
101
+ DiamondBrush: e("DiamondBrush"),
102
+ VLineBrush: e("VLineBrush"),
103
+ HLineBrush: e("HLineBrush"),
104
+ SquareBrush: e("SquareBrush"),
105
+ Square: e("Square"),
106
+ square: e("square")
107
+ } };
108
+ }
109
+ function $e(t, e = "application/octet-stream") {
110
+ let o = t.trim(), a = e?.trim() || "application/octet-stream";
111
+ const i = o.indexOf(",");
112
+ if (o.startsWith("data:") && i >= 0) {
113
+ const m = o.slice(5, i).split(";")[0]?.trim();
114
+ m && (a = m), o = o.slice(i + 1);
115
+ }
116
+ const l = o.replace(/\s/g, ""), C = atob(l), g = new Uint8Array(C.length);
117
+ for (let m = 0; m < C.length; m++) g[m] = C.charCodeAt(m);
118
+ return new Blob([g], { type: a });
119
+ }
120
+ var wt = "static/media/image-editor", At = { text: {
121
+ replaceDefaultItems: !0,
122
+ defaultText: "Handwriting",
123
+ items: [
124
+ {
125
+ family: "Inter",
126
+ src: "fonts/inter-v20-cyrillic_latin-regular.woff2"
127
+ },
128
+ {
129
+ family: "Commissioner",
130
+ src: "fonts/commissioner-v24-cyrillic_latin-regular.woff2"
131
+ },
132
+ {
133
+ family: "Montserrat Light",
134
+ src: "fonts/Montserrat-Light.woff2"
135
+ },
136
+ {
137
+ family: "Montserrat Regular",
138
+ src: "fonts/Montserrat-Regular.woff2"
139
+ },
140
+ {
141
+ family: "Montserrat Bold",
142
+ src: "fonts/Montserrat-Bold.woff2"
143
+ },
144
+ {
145
+ family: "Montserrat Black",
146
+ src: "fonts/Montserrat-Black.woff2"
147
+ },
148
+ {
149
+ family: "Roboto Light",
150
+ src: "fonts/Roboto-Light.woff2"
151
+ },
152
+ {
153
+ family: "Roboto Regular",
154
+ src: "fonts/Roboto-Regular.woff2"
155
+ },
156
+ {
157
+ family: "Roboto Bold",
158
+ src: "fonts/Roboto-Bold.woff2"
159
+ },
160
+ {
161
+ family: "Roboto Black",
162
+ src: "fonts/Roboto-Black.woff2"
163
+ },
164
+ {
165
+ family: "Lato Light",
166
+ src: "fonts/Lato-Light.woff2"
167
+ },
168
+ {
169
+ family: "Lato Regular",
170
+ src: "fonts/Lato-Regular.woff2"
171
+ },
172
+ {
173
+ family: "Lato Bold",
174
+ src: "fonts/Lato-Bold.woff2"
175
+ },
176
+ {
177
+ family: "Lato Black",
178
+ src: "fonts/Lato-Black.woff2"
179
+ },
180
+ {
181
+ family: "Rubik Light",
182
+ src: "fonts/Rubik-Light.woff2"
183
+ },
184
+ {
185
+ family: "Rubik Regular",
186
+ src: "fonts/Rubik-Regular.woff2"
187
+ },
188
+ {
189
+ family: "Rubik Bold",
190
+ src: "fonts/Rubik-Bold.woff2"
191
+ },
192
+ {
193
+ family: "Rubik Black",
194
+ src: "fonts/Rubik-Black.woff2"
195
+ },
196
+ {
197
+ family: "Bebas Neue Light",
198
+ src: "fonts/BebasNeueLight.woff2"
199
+ },
200
+ {
201
+ family: "Bebas Neue Regular",
202
+ src: "fonts/BebasNeueRegular.woff2"
203
+ },
204
+ {
205
+ family: "Bebas Neue Book",
206
+ src: "fonts/BebasNeueBook.woff2"
207
+ },
208
+ {
209
+ family: "Bebas Neue Bold",
210
+ src: "fonts/BebasNeueBold.woff2"
211
+ },
212
+ {
213
+ family: "Fira Sans",
214
+ src: "fonts/fira-sans-v11-latin-ext_latin_cyrillic-regular.woff2"
215
+ },
216
+ {
217
+ family: "Lobster",
218
+ src: "fonts/Lobster.woff2"
219
+ },
220
+ {
221
+ family: "Pacifico",
222
+ src: "fonts/pacifico-v23-cyrillic_latin-regular.woff2"
223
+ },
224
+ {
225
+ family: "Playfair Display",
226
+ src: "fonts/playfair-display-v40-cyrillic_latin-regular.woff2"
227
+ },
228
+ {
229
+ family: "Oswald",
230
+ src: "fonts/oswald-v57-cyrillic_latin-regular.woff2"
231
+ },
232
+ {
233
+ family: "Caveat",
234
+ src: "fonts/caveat-v23-cyrillic_latin-regular.woff2"
235
+ }
236
+ ]
237
+ } };
238
+ function It(t, e) {
239
+ if (t === "json") return new Blob([e], { type: "application/json" });
240
+ if (t === "svg") return new Blob([e], { type: "image/svg+xml" });
241
+ const o = `image/${t}`;
242
+ return $e(e.replace(/data:image\/([a-z]*)?;base64,/, ""), o);
243
+ }
244
+ var xt = ({ currentImageLink: t, prefetchedBlob: e, onSave: o, uploadImageResultIsLoading: a }) => {
245
+ const i = re.useCookieManager(), [l, C] = (0, n.useState)(), [g, m] = (0, n.useState)(), { __: x } = f.useI18n();
246
+ let R = u.useDispatch();
247
+ const p = u.useStore(), b = u.useAppConfig(), j = u.useSelector(u.selectedCurrentUser), w = u.useSelector(Y.selectSecondModal), L = u.useSelector(u.selectProject), h = (0, n.useMemo)(() => {
248
+ if (!b?.icons) return;
249
+ const E = {};
250
+ for (const [P, O] of Object.entries(b.icons)) typeof O == "string" && (E[P] = T.sanitizeHtml(O));
251
+ return Object.keys(E).length > 0 ? E : void 0;
252
+ }, [b?.icons]), D = (0, n.useRef)(!1), [k, z] = (0, n.useState)(), V = u.useEventEmitter(u.events.FILE_PROXY_EVENT_ID);
253
+ (0, n.useEffect)(() => {
254
+ let E = !1;
255
+ return (async () => {
256
+ const O = t;
257
+ if (!O && !e) return;
258
+ let I = e;
259
+ if (!I && O) try {
260
+ I = await (await fetch(O)).blob();
261
+ } catch {
262
+ if (I = await V.fire({
263
+ url: O,
264
+ project: L
265
+ }).filter((A) => A instanceof Blob)[0], !I) {
266
+ const A = i.get(u.APP_COOKIES.em_token) || await u.di.getInstance(p, Y.TOKEN_ID);
267
+ I = await (await fetch(`https://app.useblocks.io/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(O)}`, { headers: { authorization: `Bearer ${A}` } })).blob();
268
+ }
269
+ }
270
+ if (E || !I) return;
271
+ const W = new FileReader();
272
+ W.onload = () => {
273
+ if (E) return;
274
+ const A = W.result;
275
+ typeof A == "string" && (C(A), m(I.type), k?.tools.import.openBackgroundImage(A));
276
+ }, W.onerror = () => {}, W.readAsDataURL(I);
277
+ })().catch((O) => {}), () => {
278
+ E = !0;
279
+ };
280
+ }, [
281
+ t,
282
+ e,
283
+ i,
284
+ k,
285
+ V,
286
+ L,
287
+ p
288
+ ]);
289
+ const U = (0, n.useCallback)(() => {
290
+ C(null), m(null), R(Y.closeSecondModal()), R(Y.closeModal(u.MODALS.UPLOAD_IMAGE_MODAL));
291
+ }, [R]), M = (0, n.useRef)();
292
+ M.current = async function(E, P, O) {
293
+ try {
294
+ const I = It(O, E);
295
+ o && await o(new File([I], P, {
296
+ lastModified: Date.now(),
297
+ type: I.type
298
+ }));
299
+ } catch (I) {
300
+ throw I;
301
+ }
302
+ };
303
+ const K = (0, n.useCallback)((E) => {
304
+ if (E && !(D.current && k)) {
305
+ D.current = !0;
306
+ const P = j.locale ? j.locale.replace("_", "-") : "en-US", O = j.theme === "system" ? matchMedia("(prefers-color-scheme: dark)").matches ? u.DARK : u.LIGHT : j.theme;
307
+ Ct.Tf.init({
308
+ selector: "#pixie-editor",
309
+ baseUrl: f.getBundledHostAssetUrl(wt),
310
+ image: l,
311
+ activeLanguage: P,
312
+ languages: bt(P, x),
313
+ tools: At,
314
+ ui: {
315
+ menubar: {
316
+ replaceDefaultItems: !0,
317
+ items: [
318
+ {
319
+ type: "undoWidget",
320
+ align: "left"
321
+ },
322
+ {
323
+ type: "zoomWidget",
324
+ align: "center",
325
+ desktopOnly: !0
326
+ },
327
+ {
328
+ type: "button",
329
+ icon: (0, r.jsx)(f.EmIcons, {
330
+ icon: "HistoryOutlined",
331
+ configIcons: h,
332
+ style: { fontSize: 20 }
333
+ }),
334
+ align: "right",
335
+ desktopOnly: !0,
336
+ action: (I) => {
337
+ I.togglePanel("history");
338
+ }
339
+ },
340
+ {
341
+ type: "button",
342
+ icon: (0, r.jsx)(f.EmIcons, {
343
+ icon: "CloseOutlined",
344
+ configIcons: h,
345
+ style: { fontSize: 20 }
346
+ }),
347
+ align: "right",
348
+ desktopOnly: !0,
349
+ action: () => U()
350
+ }
351
+ ]
352
+ },
353
+ nav: { position: "top" },
354
+ activeTheme: O,
355
+ mode: "inline",
356
+ forceOverlayModeOnMobile: !1
357
+ },
358
+ onSave: async function(I, W, A) {
359
+ try {
360
+ await M.current(I, W, A);
361
+ } catch {}
362
+ }
363
+ }).then((I) => {
364
+ z(I);
365
+ }).catch((I) => {});
366
+ }
367
+ }, [
368
+ j.theme,
369
+ l,
370
+ k,
371
+ z,
372
+ j.locale,
373
+ x,
374
+ U,
375
+ h
376
+ ]), ee = (0, n.useCallback)(() => {
377
+ k?.tools.export.save(t?.split("/").pop().split(".")[0], g?.split("/")[1]);
378
+ }, [
379
+ k,
380
+ t,
381
+ g
382
+ ]);
383
+ return (0, r.jsxs)(f.Modal, {
384
+ afterOpenChange: K,
385
+ width: "100%",
386
+ style: {
387
+ maxWidth: "100%",
388
+ minHeight: "100vh"
389
+ },
390
+ className: "image-editor-modal",
391
+ centered: !0,
392
+ closable: !1,
393
+ zIndex: 1100,
394
+ mask: !1,
395
+ open: w,
396
+ footer: [(0, r.jsx)(f.Button, {
397
+ className: "em-analytics__profile-cancel",
398
+ onClick: U,
399
+ children: x("Cancel")
400
+ }, "Cancel"), (0, r.jsx)(f.Button, {
401
+ className: "em-analytics__profile-updapixiete",
402
+ id: "save",
403
+ type: "primary",
404
+ onClick: ee,
405
+ children: x("Update")
406
+ }, "Ok")],
407
+ children: [a && (0, r.jsx)("div", {
408
+ style: {
409
+ position: "absolute",
410
+ height: "100%",
411
+ width: "100%",
412
+ display: "flex",
413
+ alignItems: "center",
414
+ justifyContent: "center",
415
+ background: "var(--colorBgLayout)",
416
+ zIndex: 10,
417
+ opacity: .7
418
+ },
419
+ children: (0, r.jsx)(f.Spin, { size: "large" })
420
+ }), (0, r.jsx)("div", { id: "pixie-editor" })]
421
+ });
422
+ }, St = ({ currentImageLink: t, newLink: e, previewDisplayUrl: o, resolvedPreviewObjectUrl: a, resolvedPreviewBlob: i, onSave: l, uploadImageResultIsLoading: C }) => {
423
+ const g = o || a;
424
+ return (0, r.jsxs)(r.Fragment, { children: [(0, r.jsx)("div", { children: (0, r.jsxs)("div", {
425
+ className: "image-preview",
426
+ children: [C && (0, r.jsx)("div", {
427
+ style: {
428
+ position: "absolute",
429
+ height: "100%",
430
+ width: "100%",
431
+ display: "flex",
432
+ alignItems: "center",
433
+ justifyContent: "center",
434
+ background: "var(--colorBgLayout)",
435
+ zIndex: 10,
436
+ opacity: .7
437
+ },
438
+ children: (0, r.jsx)(f.Spin, { size: "large" })
439
+ }), g && (0, r.jsx)("img", {
440
+ alt: "uploadedImage",
441
+ src: g
442
+ })]
443
+ }) }), (0, r.jsx)(xt, {
444
+ currentImageLink: t,
445
+ prefetchedBlob: i,
446
+ newLink: e,
447
+ onSave: l,
448
+ uploadImageResultIsLoading: C
449
+ })] });
450
+ }, xe = {
451
+ Pixel: "Pixel",
452
+ Percent: "Percent"
453
+ }, et = {
454
+ unit: xe.Percent,
455
+ value: 80
456
+ };
457
+ function Rt(t) {
458
+ return typeof t == "number" ? {
459
+ unit: xe.Percent,
460
+ value: t * 100
461
+ } : typeof t == "string" ? /^(\d*(\.\d+)?)px$/.exec(t) ? {
462
+ unit: xe.Pixel,
463
+ value: parseFloat(t)
464
+ } : /^(\d*(\.\d+)?)%$/.exec(t) ? {
465
+ unit: xe.Percent,
466
+ value: parseFloat(t)
467
+ } : et : et;
468
+ }
469
+ function jt(t, e) {
470
+ const o = Rt(t);
471
+ let a;
472
+ return o.unit === xe.Pixel ? a = `${o.value}px` : a = `${100 - o.value}%`, e ? `${a} 0px 0px 0px` : `0px 0px ${a} 0px`;
473
+ }
474
+ function tt({ next: t, hasMore: e, children: o, loader: a, scrollThreshold: i = .8, endMessage: l, style: C, height: g, scrollableTarget: m, hasChildren: x, inverse: R = !1, pullDownToRefresh: p = !1, pullDownToRefreshContent: b, releaseToRefreshContent: j, pullDownToRefreshThreshold: w = 100, refreshFunction: L, onScroll: h, dataLength: D, initialScrollY: k, className: z = "", role: V, tabIndex: U, id: M, ...K }) {
475
+ const [ee, E] = (0, n.useState)(!1), [P, O] = (0, n.useState)(!1), [I, W] = (0, n.useState)(0), A = (0, n.useRef)(null), Q = (0, n.useRef)(null), J = (0, n.useRef)(null), q = (0, n.useRef)(t);
476
+ q.current = t;
477
+ const s = (0, n.useRef)(L);
478
+ s.current = L;
479
+ const y = (0, n.useRef)(w);
480
+ y.current = w;
481
+ const F = (0, n.useRef)(!1), ce = (0, n.useRef)(!1), Z = (0, n.useRef)(0), $ = (0, n.useRef)(0), X = (0, n.useRef)(0), G = (0, n.useCallback)(() => m instanceof HTMLElement ? m : typeof m == "string" ? document.getElementById(m) : null, [m]);
482
+ (0, n.useEffect)(() => {
483
+ 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 L != "function") throw new Error(`Mandatory prop "refreshFunction" missing.
485
+ Pull Down To Refresh functionality will not work
486
+ as expected. Check README.md for usage'`);
487
+ if (typeof k == "number") {
488
+ const _ = g ? A.current : G();
489
+ _ && _.scrollHeight > k && _.scrollTo(0, k);
490
+ }
491
+ }, []), (0, n.useEffect)(() => {
492
+ F.current = !1, E(!1);
493
+ }, [D]), (0, n.useEffect)(() => {
494
+ if (!e || typeof IntersectionObserver > "u") return;
495
+ const _ = Q.current;
496
+ if (!_) return;
497
+ const se = g ? A.current : G(), B = new IntersectionObserver(([ae]) => {
498
+ !ae.isIntersecting || F.current || (F.current = !0, E(!0), q.current());
499
+ }, {
500
+ root: se,
501
+ rootMargin: jt(i, R),
502
+ threshold: 0
503
+ });
504
+ return B.observe(_), () => B.disconnect();
505
+ }, [
506
+ e,
507
+ i,
508
+ R,
509
+ g,
510
+ G
511
+ ]), (0, n.useEffect)(() => {
512
+ var _;
513
+ if (!h) return;
514
+ const se = (_ = g ? A.current : G()) !== null && _ !== void 0 ? _ : typeof window < "u" ? window : null;
515
+ if (!se) return;
516
+ const B = (ae) => {
517
+ setTimeout(() => h(ae), 0);
518
+ };
519
+ return se.addEventListener("scroll", B), () => se.removeEventListener("scroll", B);
520
+ }, [
521
+ h,
522
+ g,
523
+ G
524
+ ]), (0, n.useEffect)(() => {
525
+ var _, se;
526
+ if (!p) return;
527
+ const B = (_ = g ? A.current : G()) !== null && _ !== void 0 ? _ : typeof window < "u" ? window : null;
528
+ if (!B) return;
529
+ if (!((se = J.current) === null || se === void 0) && se.firstChild) {
530
+ const N = J.current.firstChild.getBoundingClientRect().height;
531
+ X.current = N, W(N);
532
+ }
533
+ const ae = (N) => {
534
+ (B instanceof HTMLElement ? B.scrollTop : document.documentElement.scrollTop) > 0 || (ce.current = !0, N instanceof MouseEvent ? Z.current = N.pageY : N instanceof TouchEvent && (Z.current = N.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)"));
535
+ }, v = (N) => {
536
+ if (!ce.current || (N instanceof MouseEvent ? $.current = N.pageY : N instanceof TouchEvent && ($.current = N.touches[0].pageY), $.current < Z.current)) return;
537
+ const fe = $.current - Z.current;
538
+ fe >= y.current && O(!0), !(fe > X.current * 1.5) && A.current && (A.current.style.overflow = "visible", A.current.style.transform = `translate3d(0px, ${fe}px, 0px)`);
539
+ }, te = () => {
540
+ Z.current = 0, $.current = 0, ce.current = !1, O((N) => {
541
+ var fe;
542
+ return N && ((fe = s.current) === null || fe === void 0 || fe.call(s)), !1;
543
+ }), requestAnimationFrame(() => {
544
+ A.current && (A.current.style.overflow = "auto", A.current.style.transform = "none", A.current.style.willChange = "unset");
545
+ });
546
+ };
547
+ return B.addEventListener("touchstart", ae), B.addEventListener("touchmove", v), B.addEventListener("touchend", te), B.addEventListener("mousedown", ae), B.addEventListener("mousemove", v), B.addEventListener("mouseup", te), () => {
548
+ B.removeEventListener("touchstart", ae), B.removeEventListener("touchmove", v), B.removeEventListener("touchend", te), B.removeEventListener("mousedown", ae), B.removeEventListener("mousemove", v), B.removeEventListener("mouseup", te);
549
+ };
550
+ }, [
551
+ p,
552
+ g,
553
+ G
554
+ ]);
555
+ const ie = {
556
+ height: g ?? "auto",
557
+ overflow: "auto",
558
+ WebkitOverflowScrolling: "touch",
559
+ ...C
560
+ }, he = x || !!(o && o instanceof Array && o.length), ye = p && g ? { overflow: "auto" } : {}, ue = e ? (0, r.jsx)("div", {
561
+ ref: Q,
562
+ style: { height: 1 }
563
+ }) : null;
564
+ return (0, r.jsx)("div", {
565
+ style: ye,
566
+ className: "infinite-scroll-component__outerdiv",
567
+ children: (0, r.jsxs)("div", {
568
+ ...K,
569
+ role: V,
570
+ tabIndex: U,
571
+ id: M,
572
+ className: ["infinite-scroll-component", z].filter(Boolean).join(" "),
573
+ ref: A,
574
+ style: ie,
575
+ children: [
576
+ p && (0, r.jsx)("div", {
577
+ style: { position: "relative" },
578
+ ref: J,
579
+ children: (0, r.jsx)("div", {
580
+ style: {
581
+ position: "absolute",
582
+ left: 0,
583
+ right: 0,
584
+ top: -1 * I
585
+ },
586
+ children: P ? j : b
587
+ })
588
+ }),
589
+ o,
590
+ !ee && !he && e && a,
591
+ ee && e && a,
592
+ ue,
593
+ !e && l
594
+ ]
595
+ })
596
+ });
597
+ }
598
+ function kt(t, e) {
599
+ if (t == null) return {};
600
+ var o = Et(t, e), a, i;
601
+ if (Object.getOwnPropertySymbols) {
602
+ var l = Object.getOwnPropertySymbols(t);
603
+ for (i = 0; i < l.length; i++) a = l[i], !(e.indexOf(a) >= 0) && Object.prototype.propertyIsEnumerable.call(t, a) && (o[a] = t[a]);
604
+ }
605
+ return o;
606
+ }
607
+ function Et(t, e) {
608
+ if (t == null) return {};
609
+ var o = {}, a = Object.keys(t), i, l;
610
+ for (l = 0; l < a.length; l++) i = a[l], !(e.indexOf(i) >= 0) && (o[i] = t[i]);
611
+ return o;
612
+ }
613
+ function De() {
614
+ return De = Object.assign || function(t) {
615
+ for (var e = 1; e < arguments.length; e++) {
616
+ var o = arguments[e];
617
+ for (var a in o) Object.prototype.hasOwnProperty.call(o, a) && (t[a] = o[a]);
618
+ }
619
+ return t;
620
+ }, De.apply(this, arguments);
621
+ }
622
+ function nt(t, e) {
623
+ var o = Object.keys(t);
624
+ if (Object.getOwnPropertySymbols) {
625
+ var a = Object.getOwnPropertySymbols(t);
626
+ e && (a = a.filter(function(i) {
627
+ return Object.getOwnPropertyDescriptor(t, i).enumerable;
628
+ })), o.push.apply(o, a);
629
+ }
630
+ return o;
631
+ }
632
+ function Se(t) {
633
+ for (var e = 1; e < arguments.length; e++) {
634
+ var o = arguments[e] != null ? arguments[e] : {};
635
+ e % 2 ? nt(Object(o), !0).forEach(function(a) {
636
+ Ot(t, a, o[a]);
637
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(o)) : nt(Object(o)).forEach(function(a) {
638
+ Object.defineProperty(t, a, Object.getOwnPropertyDescriptor(o, a));
639
+ });
640
+ }
641
+ return t;
642
+ }
643
+ function Ot(t, e, o) {
644
+ return e in t ? Object.defineProperty(t, e, {
645
+ value: o,
646
+ enumerable: !0,
647
+ configurable: !0,
648
+ writable: !0
649
+ }) : t[e] = o, t;
650
+ }
651
+ var Lt = {
652
+ breakpointCols: void 0,
653
+ className: void 0,
654
+ columnClassName: void 0,
655
+ children: void 0,
656
+ columnAttrs: void 0,
657
+ column: void 0
658
+ }, Fe = 2, Ge = class extends n.default.Component {
659
+ constructor(t) {
660
+ super(t), this.reCalculateColumnCount = this.reCalculateColumnCount.bind(this), this.reCalculateColumnCountDebounce = this.reCalculateColumnCountDebounce.bind(this);
661
+ let e;
662
+ this.props.breakpointCols && this.props.breakpointCols.default ? e = this.props.breakpointCols.default : e = parseInt(this.props.breakpointCols) || Fe, this.state = { columnCount: e };
663
+ }
664
+ componentDidMount() {
665
+ this.reCalculateColumnCount(), window && window.addEventListener("resize", this.reCalculateColumnCountDebounce);
666
+ }
667
+ componentDidUpdate() {
668
+ this.reCalculateColumnCount();
669
+ }
670
+ componentWillUnmount() {
671
+ window && window.removeEventListener("resize", this.reCalculateColumnCountDebounce);
672
+ }
673
+ reCalculateColumnCountDebounce() {
674
+ if (!window || !window.requestAnimationFrame) {
675
+ this.reCalculateColumnCount();
676
+ return;
677
+ }
678
+ window.cancelAnimationFrame && window.cancelAnimationFrame(this._lastRecalculateAnimationFrame), this._lastRecalculateAnimationFrame = window.requestAnimationFrame(() => {
679
+ this.reCalculateColumnCount();
680
+ });
681
+ }
682
+ reCalculateColumnCount() {
683
+ const t = window && window.innerWidth || Infinity;
684
+ let e = this.props.breakpointCols;
685
+ typeof e != "object" && (e = { default: parseInt(e) || Fe });
686
+ let o = Infinity, a = e.default || Fe;
687
+ for (let i in e) {
688
+ const l = parseInt(i);
689
+ l > 0 && t <= l && l < o && (o = l, a = e[i]);
690
+ }
691
+ a = Math.max(1, parseInt(a) || 1), this.state.columnCount !== a && this.setState({ columnCount: a });
692
+ }
693
+ itemsInColumns() {
694
+ const t = this.state.columnCount, e = new Array(t), o = n.default.Children.toArray(this.props.children);
695
+ for (let a = 0; a < o.length; a++) {
696
+ const i = a % t;
697
+ e[i] || (e[i] = []), e[i].push(o[a]);
698
+ }
699
+ return e;
700
+ }
701
+ renderColumns() {
702
+ const { column: t, columnAttrs: e = {}, columnClassName: o } = this.props, a = this.itemsInColumns(), i = `${100 / a.length}%`;
703
+ let l = o;
704
+ l && typeof l != "string" && (this.logDeprecated("The property \"columnClassName\" requires a string"), typeof l > "u" && (l = "my-masonry-grid_column"));
705
+ const C = Se(Se(Se({}, t), e), {}, {
706
+ style: Se(Se({}, e.style), {}, { width: i }),
707
+ className: l
708
+ });
709
+ return a.map((g, m) => n.default.createElement("div", De({}, C, { key: m }), g));
710
+ }
711
+ logDeprecated(t) {}
712
+ render() {
713
+ const t = this.props, { children: e, breakpointCols: o, columnClassName: a, columnAttrs: i, column: l, className: C } = t, g = kt(t, [
714
+ "children",
715
+ "breakpointCols",
716
+ "columnClassName",
717
+ "columnAttrs",
718
+ "column",
719
+ "className"
720
+ ]);
721
+ let m = C;
722
+ return typeof C != "string" && (this.logDeprecated("The property \"className\" requires a string"), typeof C > "u" && (m = "my-masonry-grid")), n.default.createElement("div", De({}, g, { className: m }), this.renderColumns());
723
+ }
724
+ };
725
+ Ge.defaultProps = Lt;
726
+ function ze(t, e) {
727
+ return t ? t.exhausted ? {
728
+ ...t,
729
+ src: null
730
+ } : {
731
+ ...t,
732
+ src: t.src || e || null
733
+ } : null;
734
+ }
735
+ function rt({ items: t, getItemId: e, getRequestUrl: o, createController: a }) {
736
+ const [i, l] = (0, n.useState)({}), C = (0, n.useRef)(new Map()), g = (0, n.useCallback)((m) => {
737
+ const x = e(m), R = o(m), p = `${x}:${R}`;
738
+ if (C.current.has(p)) return {
739
+ itemId: x,
740
+ requestUrl: R,
741
+ cacheKey: p,
742
+ controller: C.current.get(p)
743
+ };
744
+ const b = a(R);
745
+ return C.current.set(p, b), {
746
+ itemId: x,
747
+ requestUrl: R,
748
+ cacheKey: p,
749
+ controller: b
750
+ };
751
+ }, [
752
+ a,
753
+ e,
754
+ o
755
+ ]);
756
+ return (0, n.useEffect)(() => {
757
+ const m = new Set(), x = {}, R = t.map((p) => {
758
+ const { itemId: b, cacheKey: j, controller: w } = g(p);
759
+ m.add(j), x[b] = w.src;
760
+ const L = ze(w.handleChangeSrc?.(), w.src);
761
+ return L?.changed && L.src && (x[b] = L.src), w.subscribeToSrcChange?.((h) => {
762
+ const D = ze(h, w.src);
763
+ !D?.changed || !D.src || l((k) => k[b] === D.src ? k : {
764
+ ...k,
765
+ [b]: D.src
766
+ });
767
+ });
768
+ }).filter(Boolean);
769
+ return C.current.forEach((p, b) => {
770
+ m.has(b) || C.current.delete(b);
771
+ }), l(x), () => {
772
+ R.forEach((p) => p?.());
773
+ };
774
+ }, [g, t]), {
775
+ getDisplaySrc: (0, n.useCallback)((m) => {
776
+ const { itemId: x, requestUrl: R, controller: p } = g(m);
777
+ return i[x] || p.src || R;
778
+ }, [i, g]),
779
+ handleLoad: (0, n.useCallback)((m) => {
780
+ g(m).controller.handleSuccess();
781
+ }, [g]),
782
+ handleError: (0, n.useCallback)((m) => {
783
+ const { itemId: x, controller: R } = g(m), p = ze(R.handleError(), R.src);
784
+ p?.changed && p.src && l((b) => ({
785
+ ...b,
786
+ [x]: p.src
787
+ }));
788
+ }, [g])
789
+ };
790
+ }
791
+ var st = "blocks", Dt = ({ setCurrentImageLink: t, setModalHeight: e, setModalWidth: o, setImageStockList: a, imageStockList: i, currentReq: l, setCurrentReq: C, inputRef: g, setStockLink: m, customRequest: x }) => {
792
+ const R = u.useAppConfig(), p = u.useIsStandalone(), [b, j] = (0, n.useState)(!1), [w, L] = (0, n.useState)(2), { __: h } = f.useI18n(), D = f.useNotification(), [k] = Y.useLazyGetUnsplashImageQuery(), [z] = Y.useLazyGetSearchImageQuery(), V = (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 : h("Failed to load stock images through the configured proxy chain."), [h]), U = (0, n.useCallback)((s) => {
793
+ D.error({
794
+ id: "STOCK_IMAGES_SEARCH_FAILED",
795
+ title: h("Failed to load stock images"),
796
+ description: V(s)
797
+ });
798
+ }, [
799
+ h,
800
+ V,
801
+ D
802
+ ]), M = async () => {
803
+ b || (j(!0), z({
804
+ query: l,
805
+ page: w
806
+ }).then((s) => {
807
+ if (s?.error) {
808
+ U(s.error), j(!1);
809
+ return;
810
+ }
811
+ const y = s?.data?.results || [];
812
+ a((F) => [...F, ...y]), j(!1), L((F) => F + 1);
813
+ }).catch(() => {
814
+ j(!1);
815
+ }));
816
+ };
817
+ (0, n.useEffect)(() => {
818
+ l.keywords !== "" && K();
819
+ }, [l.color, l.orientation]);
820
+ const K = async () => {
821
+ const s = await z({
822
+ query: l,
823
+ page: 1
824
+ });
825
+ if (s?.error) {
826
+ U(s.error), a([]);
827
+ return;
828
+ }
829
+ const y = s?.data?.results || [];
830
+ y.length > 0 ? (a(y), setTimeout(() => {
831
+ o(1060), e("84vh");
832
+ }, 0)) : a([]);
833
+ }, [ee, E] = (0, n.useState)(null), P = (0, n.useCallback)((s, y, F) => `${s}${s.includes("?") ? "&" : "?"}w=${y}&q=${F}`, []), O = (0, n.useCallback)((s) => u.getProxiedUrl(s, {
834
+ config: R,
835
+ standalone: p,
836
+ resourceType: "stockImages",
837
+ intent: "display"
838
+ }), [R, p]), { getDisplaySrc: I, handleLoad: W, handleError: A } = rt({
839
+ items: i,
840
+ getItemId: (0, n.useCallback)((s) => s.id, []),
841
+ getRequestUrl: (0, n.useCallback)((s) => P(s.urls.raw, 644, 96), [P]),
842
+ createController: O
843
+ }), Q = (s) => (y) => {
844
+ W(s), y.target.parentNode.classList.add("loaded");
845
+ }, J = (s) => () => {
846
+ A(s);
847
+ }, q = (s, y, F) => {
848
+ k(y.download_location), E(F), setTimeout(() => E(null), 2e3), m(`${s.raw}&w=1200&q=96`), t(`${s.raw}&w=1200&q=96`), x(`${s.raw}&w=1200&q=96`);
849
+ };
850
+ return (0, r.jsxs)("div", {
851
+ className: "stock-tab",
852
+ children: [(0, r.jsxs)(f.Form, {
853
+ onValuesChange: K,
854
+ className: i.length > 0 ? "serach-results" : "",
855
+ children: [(0, r.jsxs)(f.Row, {
856
+ gutter: 24,
857
+ children: [(0, r.jsx)(f.Col, {
858
+ span: i.length > 0 ? "" : 24,
859
+ children: (0, r.jsx)(f.Form.Item, {
860
+ className: "stock-search-input",
861
+ children: (0, r.jsx)(f.SearchInput, {
862
+ onSearch: K,
863
+ allowClear: !0,
864
+ size: i.length > 0 ? "medium" : "large",
865
+ placeholder: h("Search image"),
866
+ value: l.keywords,
867
+ onChange: (s) => C((y) => ({
868
+ ...y,
869
+ keywords: s.target.value
870
+ })),
871
+ ref: g,
872
+ spellCheck: "false",
873
+ enterButton: !1
874
+ })
875
+ })
876
+ }), i.length > 0 && (0, r.jsxs)(r.Fragment, { children: [(0, r.jsx)(f.Col, { children: (0, r.jsxs)(f.Radio.Group, {
877
+ defaultValue: "",
878
+ onChange: (s) => C((y) => ({
879
+ ...y,
880
+ orientation: s.target.value
881
+ })),
882
+ children: [
883
+ (0, r.jsx)(f.Tooltip, {
884
+ title: h("All"),
885
+ placement: "top",
886
+ children: (0, r.jsx)(f.Radio.Button, {
887
+ value: "",
888
+ children: (0, r.jsx)(T.EmIcons, { icon: "MixedView" })
889
+ })
890
+ }),
891
+ (0, r.jsx)(f.Tooltip, {
892
+ title: h("Landscape"),
893
+ placement: "top",
894
+ children: (0, r.jsx)(f.Radio.Button, {
895
+ value: "landscape",
896
+ children: (0, r.jsx)(T.EmIcons, { icon: "LandscapeView" })
897
+ })
898
+ }),
899
+ (0, r.jsx)(f.Tooltip, {
900
+ title: h("Portrait"),
901
+ placement: "top",
902
+ children: (0, r.jsx)(f.Radio.Button, {
903
+ value: "portrait",
904
+ children: (0, r.jsx)(T.EmIcons, { icon: "PortraitView" })
905
+ })
906
+ }),
907
+ (0, r.jsx)(f.Tooltip, {
908
+ title: h("Squarish"),
909
+ placement: "top",
910
+ children: (0, r.jsx)(f.Radio.Button, {
911
+ value: "squarish",
912
+ children: (0, r.jsx)(T.EmIcons, { icon: "SquareView" })
913
+ })
914
+ })
915
+ ]
916
+ }) }), (0, r.jsx)(f.Col, { children: (0, r.jsx)(f.RadioColorFilter, {
917
+ defaultValue: "",
918
+ onChange: (s) => C((y) => ({
919
+ ...y,
920
+ color: s.target.value
921
+ })),
922
+ options: [
923
+ {
924
+ value: "",
925
+ colorClass: "all-colors",
926
+ label: h("All")
927
+ },
928
+ {
929
+ value: "black",
930
+ colorClass: "black-color",
931
+ label: h("Black")
932
+ },
933
+ {
934
+ value: "black_and_white",
935
+ colorClass: "bw-color",
936
+ label: h("Black and White")
937
+ },
938
+ {
939
+ value: "white",
940
+ colorClass: "white-color",
941
+ label: h("White")
942
+ },
943
+ {
944
+ value: "orange",
945
+ colorClass: "orange-color",
946
+ label: h("Orange")
947
+ },
948
+ {
949
+ value: "red",
950
+ colorClass: "red-color",
951
+ label: h("Red")
952
+ },
953
+ {
954
+ value: "purple",
955
+ colorClass: "purple-color",
956
+ label: h("Purple")
957
+ },
958
+ {
959
+ value: "magenta",
960
+ colorClass: "magenta-color",
961
+ label: h("Magenta")
962
+ },
963
+ {
964
+ value: "green",
965
+ colorClass: "green-color",
966
+ label: h("Green")
967
+ },
968
+ {
969
+ value: "teal",
970
+ colorClass: "teal-color",
971
+ label: h("Teal")
972
+ },
973
+ {
974
+ value: "blue",
975
+ colorClass: "blue-color",
976
+ label: h("Blue")
977
+ }
978
+ ],
979
+ tooltipPlacement: "top"
980
+ }) })] })]
981
+ }), i.length > 0 && (0, r.jsx)("div", {
982
+ className: "blocks-search__divider-wrapper",
983
+ children: (0, r.jsx)("div", {
984
+ className: "ant-divider ant-divider-horizontal",
985
+ role: "separator"
986
+ })
987
+ })]
988
+ }), (0, r.jsx)("div", {
989
+ className: "serach-output-wrapper",
990
+ style: { marginRight: -10 },
991
+ children: i.length > 0 && (0, r.jsx)("div", {
992
+ id: "scrollableDiv",
993
+ style: {
994
+ width: "100%",
995
+ height: "calc(84vh - 148px)",
996
+ overflow: "auto",
997
+ paddingTop: 24,
998
+ paddingRight: 14,
999
+ paddingLeft: 24,
1000
+ marginLeft: -24,
1001
+ lineHeight: "0",
1002
+ boxSizing: "unset"
1003
+ },
1004
+ children: (0, r.jsx)(tt, {
1005
+ dataLength: i && i.length,
1006
+ next: M,
1007
+ hasMore: i,
1008
+ endMessage: (0, r.jsxs)(f.Divider, {
1009
+ plain: !0,
1010
+ children: [h("That`s all we could find."), " 🤐"]
1011
+ }),
1012
+ scrollableTarget: "scrollableDiv",
1013
+ style: { overflow: "visible" },
1014
+ loader: null,
1015
+ children: (0, r.jsx)(Ge, {
1016
+ breakpointCols: { default: 3 },
1017
+ className: "my-masonry-grid",
1018
+ columnClassName: "my-masonry-grid_column",
1019
+ children: i.map((s) => (0, r.jsxs)("div", {
1020
+ className: "list-item",
1021
+ onClick: () => q(s.urls, s.links, s.id),
1022
+ children: [
1023
+ (0, r.jsx)("img", {
1024
+ className: ee === s.id ? "loaded-image" : "",
1025
+ width: "322px",
1026
+ src: I(s),
1027
+ alt: s.description,
1028
+ onLoad: Q(s),
1029
+ onError: J(s)
1030
+ }),
1031
+ (0, r.jsxs)("p", {
1032
+ className: "creator-info",
1033
+ onClick: (y) => y.stopPropagation(),
1034
+ children: [
1035
+ "Photo by",
1036
+ " ",
1037
+ (0, r.jsx)("a", {
1038
+ target: "_blank",
1039
+ href: `${s.user.links.html}?utm_source=${st}&utm_medium=referral`,
1040
+ rel: "noreferrer",
1041
+ children: s.user.name
1042
+ }),
1043
+ " ",
1044
+ "on",
1045
+ " ",
1046
+ (0, r.jsx)("a", {
1047
+ target: "_blank",
1048
+ href: `https://unsplash.com/?utm_source=${st}&utm_medium=referral`,
1049
+ rel: "noreferrer",
1050
+ children: "Unsplash"
1051
+ })
1052
+ ]
1053
+ }),
1054
+ ee === s.id && (0, r.jsx)(f.Spin, {
1055
+ className: "ant-spin",
1056
+ size: "small"
1057
+ })
1058
+ ]
1059
+ }, s.id))
1060
+ })
1061
+ })
1062
+ })
1063
+ })]
1064
+ });
1065
+ };
1066
+ function at(t) {
1067
+ return /^(https?:)?\/\//i.test(t.trim());
1068
+ }
1069
+ function Bt(t) {
1070
+ const e = t.trim();
1071
+ return at(e) || /^data:/i.test(e) ? e : `data:image/jpeg;base64, ${t}`;
1072
+ }
1073
+ var Ut = ({ images: t, transitionDuration: e = 1e3 }) => {
1074
+ const [o, a] = (0, n.useState)([]);
1075
+ return (0, n.useEffect)(() => {
1076
+ if (t.length > 0) {
1077
+ const i = t[t.length - 1];
1078
+ a((l) => [...l, {
1079
+ src: i,
1080
+ opacity: 0
1081
+ }]), setTimeout(() => {
1082
+ a((l) => l.map((C, g) => g === l.length - 1 ? {
1083
+ ...C,
1084
+ opacity: 1
1085
+ } : C));
1086
+ }, 1e3);
1087
+ }
1088
+ }, [t]), (0, r.jsx)("div", {
1089
+ className: "slideshow-container",
1090
+ children: o.map((i, l) => (0, r.jsx)("img", {
1091
+ src: Bt(i.src),
1092
+ alt: `Slide ${l + 1}`,
1093
+ className: "slideshow-image",
1094
+ style: {
1095
+ opacity: i.opacity,
1096
+ transition: `opacity ${e}ms linear`
1097
+ }
1098
+ }, l))
1099
+ });
1100
+ };
1101
+ function Mt({ setModalHeight: t, customRequest: e, aiTabRef: o, isImageUploaded: a, setIsImageUploaded: i, aiImageRequest: l, imageAiList: C, setImageAiList: g, isLoadingAi: m, setIsLoadingAi: x, onPluginAiImageLimitExceeded: R, onImageGenerateLimitExceeded: p }) {
1102
+ const { __: b } = f.useI18n(), j = u.useAppConfig(), w = f.useNotification(), L = u.usePushToDataLayer(), { emailId: h, blockId: D, projectId: k } = (0, Te.useParams)(), [z] = Y.useLazySendAiImageRequestQuery(), [V, { data: U = [] }] = Y.useLazyGetAiImageSSEQuery(), [M] = Y.useLazyGetLimitsStatsByTypeQuery(), K = j?.sendAIImageRequest || z, ee = j?.trigger || V, E = j?.handleLimitUsageEmitter || u.useEventEmitter(u.events.ON_LIMIT_ID), [P, O] = (0, n.useState)(0), [I, W] = (0, n.useState)(null), [A, Q] = (0, n.useState)(!1), [J, q] = (0, n.useState)(b("Evaluating the task")), [s, y] = (0, n.useState)(!1), F = h || 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(), G = re.shouldCountAiUsage({
1103
+ limitsInPlugin: $,
1104
+ hostedAiActive: X
1105
+ }), ie = !X && Z > 0 && P >= Z, he = (0, n.useCallback)(() => {
1106
+ E.fire({
1107
+ name: "AiImgCount",
1108
+ count: P + 1
1109
+ });
1110
+ }, [E, P]), ye = (0, n.useMemo)(() => !ie && (!G || Z === 0 || P < Z), [
1111
+ ie,
1112
+ G,
1113
+ P,
1114
+ Z
1115
+ ]), ue = (0, n.useCallback)(async () => {
1116
+ q(b("Evaluating the task")), l !== "" && !m && (x(!0), y(!0), g([]), L({
1117
+ event: "submit_form",
1118
+ action: "ai_image_generation",
1119
+ entity_id: h,
1120
+ project_id: k
1121
+ }), K({ body: {
1122
+ project_id: k,
1123
+ request: "create-image",
1124
+ connection: "midjourney",
1125
+ message: l
1126
+ } }).then(({ data: v, error: te }) => {
1127
+ if (te) throw te;
1128
+ if (v.data.status === 401) throw new Error(u.ERROR);
1129
+ if (v?.data?._eventResult) {
1130
+ g(v.data.task.images), x(!1), y(!1), q(b("Evaluating the task"));
1131
+ return;
1132
+ }
1133
+ v?.data.status === 200 ? (v?.data.task.id && (q(v.data.task.message), W(v.data.task.id)), v.message && w.success({
1134
+ id: "AI_IMAGE_SEND_SUCCESS",
1135
+ title: v.message,
1136
+ placement: "bottomRight",
1137
+ data: l
1138
+ }), ee({
1139
+ task_id: v?.data.task.id,
1140
+ entity_id: F
1141
+ })) : (x(!1), y(!1), w.error({
1142
+ id: "AI_IMAGE_SEND_ERROR",
1143
+ title: v?.message || b("Something went wrong, please try again"),
1144
+ placement: "bottomRight",
1145
+ data: l,
1146
+ innerException: v
1147
+ }));
1148
+ }).catch((v) => {
1149
+ x(!1), y(!1), (v?.error || v?.data) && w.fromError("AI_IMAGE_SEND_ERROR", l, v.error || v);
1150
+ }));
1151
+ }, [
1152
+ l,
1153
+ m,
1154
+ x,
1155
+ y,
1156
+ g,
1157
+ L,
1158
+ h,
1159
+ k,
1160
+ K,
1161
+ w,
1162
+ ee,
1163
+ F,
1164
+ b
1165
+ ]), _ = (0, n.useCallback)(async () => {
1166
+ if (ye) {
1167
+ if (!u.PLUGIN.isPlugin && !X) {
1168
+ const v = T.resolveLimitActionPreflightExceededForType("image_generate", (await M("image_generate")).data?.stats);
1169
+ if (v) {
1170
+ p?.(v);
1171
+ return;
1172
+ }
1173
+ }
1174
+ G && (O((v) => v + 1), he()), ue();
1175
+ } else $ && (R ? R() : w.error({
1176
+ title: b("The usage limit has been exceeded"),
1177
+ description: b(`The maximum number of requests for the current subscription period has been reached.
1178
+ Select the appropriate plan to fulfil more requests`),
1179
+ placement: "bottomRight"
1180
+ }));
1181
+ }, [
1182
+ ye,
1183
+ $,
1184
+ X,
1185
+ G,
1186
+ M,
1187
+ p,
1188
+ O,
1189
+ he,
1190
+ ue,
1191
+ w,
1192
+ b,
1193
+ R
1194
+ ]);
1195
+ (0, n.useEffect)(() => {
1196
+ $ && O(j?.counters?.ai_img_counter || 0);
1197
+ }, [j, $]);
1198
+ const se = u.useEventEmitter(u.events.AI_IMAGE_PROGRESS_ID);
1199
+ (0, n.useEffect)(() => {
1200
+ const v = se.event(({ progress: te, status: N }) => {
1201
+ q(N || `${Math.round(te)}%`);
1202
+ });
1203
+ return () => v.dispose();
1204
+ }, [se]);
1205
+ const B = (0, n.useCallback)(async (v) => {
1206
+ if (!a) {
1207
+ i(!0);
1208
+ try {
1209
+ const te = at(v) ? await (await fetch(v)).blob() : $e(v);
1210
+ e({ file: new File([te], "image.jpeg", { type: te.type || "image/jpeg" }) });
1211
+ } catch {
1212
+ i(!1);
1213
+ }
1214
+ }
1215
+ }, [
1216
+ a,
1217
+ i,
1218
+ e
1219
+ ]), ae = (0, n.useCallback)((v) => {
1220
+ v.status !== "error" && v.status !== "Canceled" ? v.images ? (q(v.status), v.progress === 100 && (g(v.images), q(b("Evaluating the task")), W(null), y(!1))) : (g([v.data]), x(!1)) : (x(!1), y(!1), w.error({
1221
+ id: "AI_IMAGE_GET_ERROR",
1222
+ title: b("Something went wrong, please try again"),
1223
+ placement: "bottomRight",
1224
+ data: I
1225
+ }));
1226
+ }, [
1227
+ g,
1228
+ q,
1229
+ b,
1230
+ x,
1231
+ t,
1232
+ I,
1233
+ w,
1234
+ y
1235
+ ]);
1236
+ return (0, n.useEffect)(() => {
1237
+ U.length > 1 && ae(U[U.length - 1]);
1238
+ }, [U, ae]), (0, n.useEffect)(() => {
1239
+ (m || C.length > 0) && setTimeout(() => {
1240
+ let v = 550;
1241
+ o.current && (v = o.current.offsetHeight + 68), t(v);
1242
+ }, 0);
1243
+ }, [
1244
+ o,
1245
+ U,
1246
+ C.length,
1247
+ m,
1248
+ t
1249
+ ]), {
1250
+ aiImageCounter: P,
1251
+ setAiImageCounter: O,
1252
+ currentAiImgLimits: Z,
1253
+ isFieldsDisabled: ie,
1254
+ canGenerateImage: ye,
1255
+ aiImageRequest: l,
1256
+ imageAiList: C,
1257
+ setImageAiList: g,
1258
+ isLoadingAi: m,
1259
+ setIsLoadingAi: x,
1260
+ loadingDuringGeneration: s,
1261
+ setLoadingDuringGeneration: y,
1262
+ requestStatus: J,
1263
+ setRequestStatus: q,
1264
+ handleGenerate: _,
1265
+ handleLimitAiImgCount: he,
1266
+ convertBase64ToFile: B,
1267
+ isShiftPressed: A,
1268
+ setIsShiftPressed: Q,
1269
+ currentReqId: I,
1270
+ setCurrentReqId: W,
1271
+ limitsInPlugin: $
1272
+ };
1273
+ }
1274
+ var Pt = ({ setModalHeight: t, customRequest: e, aiTabRef: o, inputAiRef: a, isImageUploaded: i, setIsImageUploaded: l, aiImageRequest: C, setAiImageRequest: g, imageAiList: m, setImageAiList: x, isLoadingAi: R, setIsLoadingAi: p }) => {
1275
+ const b = (0, Te.useNavigate)(), j = u.useDispatch(), { __: w, _n: L } = f.useI18n(), h = u.useAppConfig(), [D, k] = (0, n.useState)(!1), [z, V] = (0, n.useState)(null), { aiImageCounter: U, currentAiImgLimits: M, loadingDuringGeneration: K, requestStatus: ee, handleGenerate: E, convertBase64ToFile: P, isShiftPressed: O, setIsShiftPressed: I, limitsInPlugin: W } = Mt({
1276
+ setModalHeight: t,
1277
+ customRequest: e,
1278
+ aiTabRef: o,
1279
+ isImageUploaded: i,
1280
+ setIsImageUploaded: l,
1281
+ aiImageRequest: C,
1282
+ imageAiList: m,
1283
+ setImageAiList: x,
1284
+ isLoadingAi: R,
1285
+ setIsLoadingAi: p,
1286
+ onPluginAiImageLimitExceeded: () => k(!0),
1287
+ onImageGenerateLimitExceeded: V
1288
+ }), A = D && M > 0 ? re.getAiTariffUpgradeStep(M) : null, Q = A ? T.getLimitUpgradePresetDefinition(A.presetId) : null, J = z ? T.getLimitUpgradePresetDefinition(z.presetId) : null, [q, s] = (0, n.useState)(!1), y = (0, n.useCallback)(() => s(!0), []), F = (0, n.useCallback)(() => s(!1), []), ce = (0, n.useCallback)((G) => g(G.target.value), [g]), Z = (0, n.useCallback)((G) => {
1289
+ G.key === "Shift" ? I(!0) : G.key === "Enter" && !O && (G.preventDefault(), E());
1290
+ }, [
1291
+ O,
1292
+ E,
1293
+ I
1294
+ ]), $ = (0, n.useCallback)((G) => {
1295
+ G.key === "Shift" && I(!1);
1296
+ }, [I]), X = m[m.length - 1];
1297
+ return (0, r.jsxs)("div", {
1298
+ className: "image-ai",
1299
+ children: [
1300
+ Q && A ? (0, r.jsx)(T.LimitUpgradeModal, {
1301
+ open: !0,
1302
+ onClose: () => k(!1),
1303
+ title: w(Q.titleKey),
1304
+ subtitle: w(Q.subtitleKey),
1305
+ usageResource: Q.usageResource,
1306
+ previousDisplay: T.presetLimitDisplay(A.previousLimit),
1307
+ nextDisplay: T.presetLimitDisplay(A.nextLimit),
1308
+ onChangePlan: () => {
1309
+ k(!1), document.body.classList.remove("editor"), b("/billing"), j(Y.openModal(u.MODALS.SWITCH_TO_PLAN_MODAL));
1310
+ }
1311
+ }) : null,
1312
+ J && z ? (0, r.jsx)(T.LimitUpgradeModal, {
1313
+ open: !0,
1314
+ onClose: () => V(null),
1315
+ title: w(J.titleKey),
1316
+ subtitle: w(J.subtitleKey),
1317
+ usageResource: J.usageResource,
1318
+ previousDisplay: T.presetLimitDisplay(z.previousLimit),
1319
+ nextDisplay: T.presetLimitDisplay(z.nextLimit),
1320
+ onChangePlan: () => {
1321
+ V(null), document.body.classList.remove("editor"), b("/billing"), j(Y.openModal(u.MODALS.SWITCH_TO_PLAN_MODAL));
1322
+ }
1323
+ }) : null,
1324
+ W && (0, r.jsx)(f.LimitsCounter, {
1325
+ text: `${U} ${w("of")} ${M > 0 ? M : "∞"} images ${L("was used", "were used", U)}`,
1326
+ exceeded: M > 0 && U >= M,
1327
+ style: { marginTop: -25 },
1328
+ extra: (0, r.jsx)("span", {
1329
+ style: {
1330
+ textDecoration: "underline",
1331
+ cursor: "pointer"
1332
+ },
1333
+ onClick: () => b(h.billingPageUrl || u.APP_ROUTES.billing),
1334
+ children: w("Need more?")
1335
+ })
1336
+ }),
1337
+ (0, r.jsx)(f.Row, {
1338
+ gutter: 24,
1339
+ className: "image-ai__row",
1340
+ children: (0, r.jsx)(f.Col, {
1341
+ span: 24,
1342
+ children: (0, r.jsx)(f.Form.Item, {
1343
+ style: { margin: 0 },
1344
+ children: (0, r.jsxs)("span", {
1345
+ 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)(f.TextArea, {
1347
+ ref: a,
1348
+ onKeyDown: Z,
1349
+ onKeyUp: $,
1350
+ onFocus: y,
1351
+ onBlur: F,
1352
+ autoSize: !0,
1353
+ allowClear: !0,
1354
+ className: "text-area-input-hybrid image-ai__textarea",
1355
+ placeholder: w("Generate image"),
1356
+ value: C,
1357
+ onChange: ce,
1358
+ spellCheck: "false"
1359
+ }), (0, r.jsx)("span", {
1360
+ className: "ant-input-suffix image-ai__input-suffix",
1361
+ children: R || K ? (0, r.jsx)(T.EmIcons, {
1362
+ icon: "LoadingOutlined",
1363
+ className: "input-icon image-ai__input-icon",
1364
+ spin: !0
1365
+ }) : (0, r.jsx)(T.EmIcons, {
1366
+ icon: "AI",
1367
+ className: "input-icon image-ai__input-icon",
1368
+ onClick: E
1369
+ })
1370
+ })]
1371
+ })
1372
+ })
1373
+ })
1374
+ }),
1375
+ (R || m.length > 0) && (0, r.jsxs)("div", {
1376
+ className: "image-ai__preview",
1377
+ children: [R && m.length === 0 && (0, r.jsx)("div", {
1378
+ className: "image-ai__loading",
1379
+ children: (0, r.jsxs)("div", {
1380
+ className: "spin",
1381
+ children: [(0, r.jsx)(T.EmIcons, {
1382
+ icon: "LoadingOutlined",
1383
+ style: { fontSize: 48 },
1384
+ spin: !0
1385
+ }), (0, r.jsx)("p", {
1386
+ className: "status",
1387
+ children: ee
1388
+ })]
1389
+ })
1390
+ }), m.length > 0 && (0, r.jsxs)("div", {
1391
+ className: "image-ai__image-item",
1392
+ children: [(0, r.jsx)(Ut, { images: m }), (0, r.jsx)("div", {
1393
+ className: "buttons",
1394
+ children: (0, r.jsx)(f.Button, {
1395
+ onClick: () => P(X),
1396
+ icon: (0, r.jsx)(T.EmIcons, { icon: "CheckOutlined" }),
1397
+ children: w("Use this one")
1398
+ })
1399
+ })]
1400
+ })]
1401
+ })
1402
+ ]
1403
+ });
1404
+ }, Tt = ({ setNewLink: t, setCurrentImageLink: e, setModalHeight: o, setModalWidth: a, setImageGifList: i, imageGifList: l, currentReqGif: C, setCurrentReqGif: g, inputRef: m, setStockLink: x, customRequest: R }) => {
1405
+ const { __: p } = f.useI18n(), b = u.useAppConfig(), j = u.useIsStandalone(), w = f.useNotification(), [L, h] = (0, n.useState)(null), [D, k] = (0, n.useState)(!1), [z, V] = (0, n.useState)(25), [U] = Y.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]), K = (0, n.useCallback)((s) => {
1406
+ w.error({
1407
+ id: "STOCK_GIFS_SEARCH_FAILED",
1408
+ title: p("Failed to load GIFs"),
1409
+ description: M(s)
1410
+ });
1411
+ }, [
1412
+ p,
1413
+ M,
1414
+ w
1415
+ ]), ee = async () => {
1416
+ D || (k(!0), U({
1417
+ query: C,
1418
+ page: z
1419
+ }).then((s) => {
1420
+ if (s?.error) {
1421
+ K(s.error), k(!1);
1422
+ return;
1423
+ }
1424
+ i((y) => [...y, ...s.data.data]), k(!1), V((y) => y + 25);
1425
+ }).catch(() => {
1426
+ k(!1);
1427
+ }));
1428
+ }, E = async () => {
1429
+ const s = await U({
1430
+ query: C,
1431
+ page: 0
1432
+ });
1433
+ if (s?.error) {
1434
+ K(s.error), i([]);
1435
+ return;
1436
+ }
1437
+ s?.data?.data?.length > 0 && (i(s.data.data), setTimeout(() => {
1438
+ o("84vh"), a(1060);
1439
+ }, 0));
1440
+ }, P = (s, y) => {
1441
+ h(y), setTimeout(() => {
1442
+ h(null);
1443
+ }, 2e3), x(`${s}`), e(`${s}`), R(`${s}`);
1444
+ }, O = { default: 3 }, I = (0, n.useCallback)((s) => u.getProxiedUrl(s, {
1445
+ config: b,
1446
+ standalone: j,
1447
+ resourceType: "generic",
1448
+ intent: "display"
1449
+ }), [b, j]), { getDisplaySrc: W, handleLoad: A, handleError: Q } = rt({
1450
+ items: l,
1451
+ getItemId: (0, n.useCallback)((s) => s.id, []),
1452
+ getRequestUrl: (0, n.useCallback)((s) => s.images.downsized.url, []),
1453
+ createController: I
1454
+ }), J = (s) => (y) => {
1455
+ A(s), y.target.parentNode.classList.add("loaded");
1456
+ }, q = (s) => () => {
1457
+ Q(s);
1458
+ };
1459
+ return (0, r.jsxs)("div", {
1460
+ className: "stock-tab",
1461
+ children: [(0, r.jsxs)(f.Form, {
1462
+ onValuesChange: E,
1463
+ className: l.length > 0 ? "serach-results" : "",
1464
+ children: [(0, r.jsx)(f.Row, {
1465
+ gutter: 24,
1466
+ children: (0, r.jsx)(f.Col, {
1467
+ span: l.length > 0 ? "" : 24,
1468
+ children: (0, r.jsx)(f.Form.Item, {
1469
+ className: "stock-search-input",
1470
+ children: (0, r.jsx)(f.SearchInput, {
1471
+ onSearch: E,
1472
+ allowClear: !0,
1473
+ size: l.length > 0 ? "medium" : "large",
1474
+ placeholder: p("Search GIFs"),
1475
+ value: C.keywords,
1476
+ onChange: (s) => g((y) => ({
1477
+ ...y,
1478
+ keywords: s.target.value
1479
+ })),
1480
+ ref: m,
1481
+ spellCheck: "false",
1482
+ enterButton: !1
1483
+ })
1484
+ })
1485
+ })
1486
+ }), l.length > 0 && (0, r.jsx)("div", {
1487
+ className: "blocks-search__divider-wrapper",
1488
+ children: (0, r.jsx)("div", {
1489
+ className: "ant-divider ant-divider-horizontal",
1490
+ role: "separator"
1491
+ })
1492
+ })]
1493
+ }), (0, r.jsx)("div", {
1494
+ className: "serach-output-wrapper",
1495
+ style: { marginRight: -10 },
1496
+ children: l.length > 0 && (0, r.jsx)("div", {
1497
+ id: "scrollableDiv",
1498
+ style: {
1499
+ width: "100%",
1500
+ height: "calc(84vh - 148px)",
1501
+ overflow: "auto",
1502
+ paddingTop: 24,
1503
+ paddingRight: 14,
1504
+ paddingLeft: 24,
1505
+ marginLeft: -24,
1506
+ lineHeight: "0",
1507
+ boxSizing: "unset"
1508
+ },
1509
+ children: (0, r.jsx)(tt, {
1510
+ dataLength: l && l.length,
1511
+ next: ee,
1512
+ hasMore: l,
1513
+ endMessage: (0, r.jsxs)(f.Divider, {
1514
+ plain: !0,
1515
+ children: [p("That`s all we could find."), " 🤐"]
1516
+ }),
1517
+ scrollableTarget: "scrollableDiv",
1518
+ style: { overflow: "visible" },
1519
+ loader: (0, r.jsx)(f.Spin, { size: "small" }),
1520
+ children: (0, r.jsx)(Ge, {
1521
+ breakpointCols: O,
1522
+ className: "my-masonry-grid",
1523
+ columnClassName: "my-masonry-grid_column",
1524
+ children: l.map((s, y) => (0, r.jsxs)("div", {
1525
+ className: "list-item",
1526
+ onClick: () => P(s.images.downsized.url, s.id),
1527
+ children: [
1528
+ (0, r.jsx)("img", {
1529
+ className: L === s.id ? "loaded-image" : "",
1530
+ width: "322px",
1531
+ src: W(s),
1532
+ alt: s.title,
1533
+ onLoad: J(s),
1534
+ onError: q(s)
1535
+ }),
1536
+ (0, r.jsx)("a", {
1537
+ rel: "noreferrer",
1538
+ href: "https://giphy.com/",
1539
+ target: "_blank",
1540
+ onClick: (F) => F.stopPropagation(),
1541
+ children: (0, r.jsx)("div", {
1542
+ className: "overlay-image",
1543
+ 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
+ })
1545
+ }),
1546
+ L === s.id && (0, r.jsx)(f.Spin, {
1547
+ className: "ant-spin",
1548
+ size: "small"
1549
+ })
1550
+ ]
1551
+ }, s.id + y))
1552
+ })
1553
+ })
1554
+ })
1555
+ })]
1556
+ });
1557
+ };
1558
+ function Nt(t) {
1559
+ if (!(t == null || t === "")) return t;
1560
+ }
1561
+ async function Ft(t, e) {
1562
+ if (t) {
1563
+ if (t.url) return t.url;
1564
+ if (typeof e.getFileById == "function" && t.id) {
1565
+ const o = await e.getFileById(t.id);
1566
+ if (o?.url) return o.url;
1567
+ if (o?.thumbnailUrl) return o.thumbnailUrl;
1568
+ if (o?.thumbnail) return o.thumbnail;
1569
+ }
1570
+ if (typeof e.getFileUrl == "function" && t.folderId !== void 0 && t.name) {
1571
+ const o = await e.getFileUrl(t.folderId || "", t.name);
1572
+ if (o) return o;
1573
+ }
1574
+ if (typeof e.getUrl == "function" && t.name) {
1575
+ const o = await e.getUrl(t);
1576
+ if (o) return o;
1577
+ }
1578
+ return t.thumbnail || t.thumbnailUrl;
1579
+ }
1580
+ }
1581
+ function Gt(t) {
1582
+ if (!(!t?.success || !Array.isArray(t.detailed))) return t.detailed.find((e) => e?.success && e.data)?.data;
1583
+ }
1584
+ function zt(t, e, o) {
1585
+ if (t) return {
1586
+ id: t.id,
1587
+ name: t.name || e.name,
1588
+ size: t.size ?? e.size,
1589
+ type: t.type || e.type,
1590
+ folderId: t.folderId ?? o ?? "",
1591
+ url: t.url,
1592
+ thumbnail: t.thumbnail,
1593
+ thumbnailUrl: t.thumbnailUrl,
1594
+ date: t.date,
1595
+ dimensions: t.dimensions,
1596
+ aspectRatio: t.aspectRatio,
1597
+ extension: t.extension,
1598
+ selected: t.selected,
1599
+ isFolder: t.isFolder,
1600
+ lastEdited: t.lastEdited,
1601
+ childrenCount: t.childrenCount
1602
+ };
1603
+ }
1604
+ async function Kt(t, e, o) {
1605
+ if (!e) return;
1606
+ const a = Nt(o ?? e.rootId);
1607
+ let i;
1608
+ typeof e.uploadFiles == "function" ? i = Gt(await e.uploadFiles({
1609
+ folderId: a,
1610
+ items: [{
1611
+ name: t.name,
1612
+ size: t.size,
1613
+ type: t.type,
1614
+ folderId: a,
1615
+ data: t
1616
+ }]
1617
+ })) : typeof e.uploadFile == "function" && (i = zt(await e.uploadFile({
1618
+ name: t.name,
1619
+ size: t.size,
1620
+ type: t.type,
1621
+ folderId: a,
1622
+ data: t
1623
+ }), t, a));
1624
+ const l = await Ft(i, e);
1625
+ return l ? {
1626
+ item: i,
1627
+ url: l
1628
+ } : void 0;
1629
+ }
1630
+ var ot = "IMG", it = "BACKGROUND", Wt = "GALLERY", we = "EDITOR", pe = "UPLOAD", Ke = "STOCK", We = "GIF", He = "AI", Ht = { mode: "select" }, Vt = { mode: "save" }, { Dragger: Qt } = f.Upload, qt = (t, e = "image") => Y.decodeFileNameFromUrl(t) ?? e, Re = re.normalizeImageFormatForDisplay, _t = (t, e) => {
1631
+ const o = Re(e);
1632
+ return !o || t.includes(".") ? t : `${t}.${o}`;
1633
+ }, Yt = (t, e) => new File([t], _t(qt(e), t.type), { type: t.type || "application/octet-stream" }), lt = ({ dataProvider: t }) => {
1634
+ const e = u.useAppConfig(), o = u.useIsStandalone(), { __: a } = f.useI18n(), i = u.useDispatch(), { projectId: l } = (0, Te.useParams)(), [C] = Y.useLazyGetImageInfoQuery(), { modal: g } = f.App.useApp(), m = f.useNotification(), x = u.useSelector(u.selectedIsUserPaySmth), R = u.useSelector(u.selectedCurrentUser), p = u.useSelector(Y.selectActiveModal), { request: b, resolveImagePicker: j } = T.useImagePicker(), [w, L] = (0, n.useState)(""), [h, D] = (0, n.useState)(""), [k, z] = (0, n.useState)(""), [V, U] = (0, n.useState)(""), [M, K] = (0, n.useState)(pe), [ee, E] = (0, n.useState)({
1635
+ width: "",
1636
+ height: "",
1637
+ size: "",
1638
+ format: ""
1639
+ }), [P, O] = (0, n.useState)("success"), [I, W] = (0, n.useState)(!1), A = n.default.useRef(null), Q = n.default.useRef(null), J = n.default.useRef(null), q = n.default.useRef(null), s = n.default.useRef(null), y = n.default.useRef(null), F = n.default.useRef(null), ce = n.default.useRef(null), Z = n.default.useRef(null), [$, X] = (0, n.useState)("auto"), [G, ie] = (0, n.useState)(572), [he, ye] = (0, n.useState)(!1), [ue, _] = (0, n.useState)({
1640
+ keywords: "",
1641
+ color: "",
1642
+ orientation: ""
1643
+ }), [se, B] = (0, n.useState)({ keywords: "" }), [ae, v] = (0, n.useState)([]), [te, N] = (0, n.useState)([]), [fe, Zt] = (0, n.useState)([]), [ct, ut] = (0, n.useState)(!1), [dt, Ve] = (0, n.useState)(""), [Xt, je] = (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), ke = n.default.useRef(re.createImageUrlBlobResolver()), qe = n.default.useRef(""), be = n.default.useRef(0), Ae = n.default.useRef(""), [$t, pt] = (0, n.useState)(""), [en, gt] = (0, n.useState)(null), [tn, _e] = (0, n.useState)(""), Ue = (0, n.useCallback)((c) => {
1644
+ if (!(c instanceof Blob)) return;
1645
+ Ae.current && URL.revokeObjectURL(Ae.current);
1646
+ const d = URL.createObjectURL(c);
1647
+ Ae.current = d, pt(d), gt(c);
1648
+ }, []), ge = (0, n.useCallback)(() => {
1649
+ Ae.current && (URL.revokeObjectURL(Ae.current), Ae.current = ""), pt(""), gt(null);
1650
+ }, []), de = (0, n.useCallback)(() => {
1651
+ _e("");
1652
+ }, []);
1653
+ let ve = !(x || !T.isProjectOwner(Qe, R));
1654
+ const nn = (c) => {
1655
+ D(c.target.value);
1656
+ }, Me = (0, n.useCallback)((c, d, S = a("The image could not be uploaded.")) => {
1657
+ const H = d instanceof Error ? d.message : S;
1658
+ m.error({
1659
+ id: "IMAGE_UPLOAD_ERROR",
1660
+ data: c,
1661
+ title: a("Upload failed"),
1662
+ description: H
1663
+ });
1664
+ }, [a, m]), rn = (0, n.useCallback)(async (c) => T.pickUploadImageUrlFromFireResults(await mt.fire({
1665
+ file: c,
1666
+ project: ft
1667
+ })), [ft, mt]), Ee = re.useImageBlobFetch(), Pe = async (c) => {
1668
+ if (c) try {
1669
+ const d = await sn(c);
1670
+ d && Ze(d) ? await Oe({ file: d }) : d || Me({ url: c }, null, a("Failed to download image from URL."));
1671
+ } catch (d) {
1672
+ Me({ url: c }, d, a("Failed to process image URL."));
1673
+ }
1674
+ }, ht = n.default.useRef(Pe);
1675
+ ht.current = Pe, n.default.useEffect(() => {
1676
+ if (M !== pe || !V) return;
1677
+ const c = h.trim();
1678
+ if (!c || !c.toLowerCase().startsWith("http")) return;
1679
+ const d = setTimeout(() => {
1680
+ ht.current(c);
1681
+ }, 1e3);
1682
+ return () => {
1683
+ clearTimeout(d);
1684
+ };
1685
+ }, [
1686
+ h,
1687
+ M,
1688
+ V
1689
+ ]);
1690
+ const sn = async (c) => {
1691
+ try {
1692
+ const d = re.canonicalImageUrlKey(c);
1693
+ return Yt(await ke.current.resolve(d, void 0, Ee), d);
1694
+ } catch {}
1695
+ };
1696
+ document.onpaste = function(c) {
1697
+ const d = c.clipboardData?.items?.[0];
1698
+ if (M === pe && V) {
1699
+ if (d?.type?.indexOf("image") === 0 && e.imageCenterLocalUploadEnabled !== !1) {
1700
+ const H = d.getAsFile();
1701
+ Ze(H);
1702
+ const oe = { file: H };
1703
+ D(""), Oe(oe);
1704
+ return;
1705
+ }
1706
+ const S = c.clipboardData?.getData("text/plain");
1707
+ if (S && S.trim().toLowerCase().startsWith("http")) {
1708
+ c.preventDefault(), c.stopPropagation(), D(S.trim());
1709
+ return;
1710
+ }
1711
+ d?.type?.indexOf("text") === 0 && d.getAsString((H) => {
1712
+ if (H.trim().toLowerCase().startsWith("http")) D(H.trim());
1713
+ else if (H.toString().slice(1, 5) === "meta") {
1714
+ const oe = H.toString().split("\"")[1];
1715
+ oe && D(oe);
1716
+ }
1717
+ });
1718
+ }
1719
+ }, (0, n.useEffect)(() => {
1720
+ const c = (d) => {
1721
+ let S = null;
1722
+ b?.kind === "background" ? (S = it, U(it)) : b?.kind === "img" && (U(ot), S = ot), b?.currentUrl && S && (L(b.currentUrl), K(d));
1723
+ };
1724
+ p === u.MODALS.UPLOAD_IMAGE_MODAL || p === u.MODALS.UPLOAD_BACKGROUND_MODAL ? c(we) : p === u.MODALS.UPLOAD_IMAGE_MODAL_AI || p === u.MODALS.UPLOAD_BACKGROUND_MODAL_AI ? (ve ? (je(!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(() => y.current?.focus({ cursor: "start" }), 100)) : p === u.MODALS.UPLOAD_IMAGE_MODAL_STOCK || p === u.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK ? (ve ? (je(!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 ? (je(!0), Be(3)) : c(We), setTimeout(() => F.current?.focus({ cursor: "start" }), 100)) : p === u.MODALS.UPLOAD_IMAGE_MODAL_EDIT || p === u.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT ? (ve ? (je(!0), Be(5)) : c(we), i(Y.openSecondModal(u.MODALS.IMAGE_EDITOR_MODAL))) : U("");
1725
+ }, [
1726
+ p,
1727
+ i,
1728
+ ve,
1729
+ b
1730
+ ]);
1731
+ const Ye = (0, n.useCallback)(({ url: c = w || "", meta: d = Ht }) => {
1732
+ L(c), j({
1733
+ url: c,
1734
+ meta: d
1735
+ }), setTimeout(() => {
1736
+ de(), ge(), _({
1737
+ keywords: "",
1738
+ color: "",
1739
+ orientation: ""
1740
+ }), B({ keywords: "" }), N([]), v([]), U(""), Ve(""), ut(!1), z(""), D(""), K(pe);
1741
+ }, 200), i(Y.closeModal()), i(Y.closeSecondModal());
1742
+ }, [
1743
+ w,
1744
+ de,
1745
+ i,
1746
+ j,
1747
+ ge
1748
+ ]), yt = (0, n.useCallback)((c, d) => (X("auto"), W(!1), Ye({
1749
+ url: c,
1750
+ meta: Vt
1751
+ }), m.success({
1752
+ id: "IMAGE_UPLOAD_SUCCESS",
1753
+ data: d,
1754
+ title: a("The image was successfully uploaded.")
1755
+ }), c), [
1756
+ a,
1757
+ Ye,
1758
+ m
1759
+ ]);
1760
+ (0, n.useEffect)(() => {
1761
+ const c = h || k, d = re.canonicalImageUrlKey(c);
1762
+ if (!c || !d) {
1763
+ O(""), qe.current = "", de(), ge(), ke.current.invalidateAll();
1764
+ return;
1765
+ }
1766
+ const S = qe.current;
1767
+ S && S !== d && (ke.current.abandonKey(S), de(), ge()), qe.current = d;
1768
+ const H = new AbortController(), oe = h ? 800 : 0, ne = ++be.current, Xe = setTimeout(async () => {
1769
+ try {
1770
+ const Ie = async () => {
1771
+ const me = await ke.current.resolve(d, H.signal, Ee);
1772
+ if (ne !== be.current) return;
1773
+ const { width: Ce, height: cn } = await re.getImageDimensionsFromBlob(me);
1774
+ ne === be.current && (E({
1775
+ width: Ce,
1776
+ height: cn,
1777
+ size: (me.size / 1024).toFixed(2),
1778
+ format: Re(me.type)
1779
+ }), de(), Ue(me));
1780
+ };
1781
+ if (o) await Ie();
1782
+ else {
1783
+ const me = await re.resolveDataProviderPreview(t, d);
1784
+ if (me?.previewUrl && ne === be.current) {
1785
+ _e(me.previewUrl), ge();
1786
+ try {
1787
+ const { data: Ce } = await C(d);
1788
+ if (ne !== be.current) return;
1789
+ Ce ? E({
1790
+ width: Ce?.width,
1791
+ height: Ce?.height,
1792
+ size: Ce?.fileSize != null ? (Ce.fileSize / 1024).toFixed(2) : "",
1793
+ format: Re(Ce?.format)
1794
+ }) : await Ie();
1795
+ } catch {
1796
+ await Ie();
1797
+ }
1798
+ } else await Ie();
1799
+ }
1800
+ if (ne !== be.current) return;
1801
+ O("success"), L(c), ie(572), setTimeout(() => {
1802
+ let me = 0;
1803
+ Q.current && (me = Q.current.offsetHeight + 62), X(me);
1804
+ }, 0);
1805
+ } catch (Ie) {
1806
+ if (Ie?.name === "AbortError" || H.signal.aborted || ne !== be.current) return;
1807
+ de(), ge(), O("error");
1808
+ }
1809
+ }, oe);
1810
+ return () => {
1811
+ clearTimeout(Xe), H.abort();
1812
+ };
1813
+ }, [
1814
+ h,
1815
+ k,
1816
+ o,
1817
+ de,
1818
+ Ee,
1819
+ C,
1820
+ ge,
1821
+ t,
1822
+ Ue
1823
+ ]), (0, n.useEffect)(() => {
1824
+ if (!w || h || k) return;
1825
+ const c = re.canonicalImageUrlKey(w), d = new AbortController();
1826
+ let S = !1;
1827
+ const H = async () => {
1828
+ const oe = await ke.current.resolve(c, d.signal, Ee);
1829
+ if (S) return;
1830
+ const { width: ne, height: Xe } = await re.getImageDimensionsFromBlob(oe);
1831
+ S || (de(), Ue(oe), E({
1832
+ width: ne,
1833
+ height: Xe,
1834
+ size: (oe.size / 1024).toFixed(2),
1835
+ format: Re(oe.type)
1836
+ }));
1837
+ };
1838
+ return (async () => {
1839
+ try {
1840
+ if (!o) {
1841
+ const oe = await re.resolveDataProviderPreview(t, c);
1842
+ if (oe?.previewUrl && !S) {
1843
+ _e(oe.previewUrl), ge();
1844
+ try {
1845
+ const { data: ne } = await C(c);
1846
+ if (S) return;
1847
+ ne ? E({
1848
+ width: ne?.width,
1849
+ height: ne?.height,
1850
+ size: ne?.fileSize != null ? (ne.fileSize / 1024).toFixed(2) : "",
1851
+ format: Re(ne?.format)
1852
+ }) : await H();
1853
+ return;
1854
+ } catch {
1855
+ await H();
1856
+ }
1857
+ }
1858
+ }
1859
+ await H();
1860
+ } catch {
1861
+ S || de();
1862
+ }
1863
+ })(), () => {
1864
+ S = !0, d.abort();
1865
+ };
1866
+ }, [
1867
+ o,
1868
+ de,
1869
+ w,
1870
+ Ee,
1871
+ C,
1872
+ t,
1873
+ h,
1874
+ k,
1875
+ Ue
1876
+ ]);
1877
+ const an = () => {
1878
+ i(Y.closeModal()), setTimeout(() => {
1879
+ de(), ge(), L(""), D(""), N([]), N([]), _({
1880
+ keywords: "",
1881
+ color: "",
1882
+ orientation: ""
1883
+ }), B({ keywords: "" }), X("auto"), !ct && Ve(""), ie(572), K(pe);
1884
+ }, 200);
1885
+ }, on = (c) => {
1886
+ c === Wt ? g.success({
1887
+ mask: { closable: !0 },
1888
+ centered: !0,
1889
+ title: a("Coming soon"),
1890
+ content: a("The feature is under development."),
1891
+ okText: a("Ok. I'll be waiting"),
1892
+ onOk: () => {}
1893
+ }) : c === we && w === "" ? g.warning({
1894
+ mask: { closable: !0 },
1895
+ centered: !0,
1896
+ title: a(""),
1897
+ content: a("To preview and edit the uploaded image"),
1898
+ okText: a("Upload Image"),
1899
+ onOk: () => {
1900
+ K(pe);
1901
+ }
1902
+ }) : (setTimeout(() => {
1903
+ let d = 0, S = 0;
1904
+ c === pe && A.current ? (ue.keywords === "" && y.current?.focus({ cursor: "start" }), d = 300, S = 572) : c === we && Q.current ? (d = Q.current.offsetHeight + 62, S = 572) : c === Ke && J.current ? (ue.keywords === "" && ce.current?.focus({ cursor: "start" }), d = 130, S = 572, te.length > 0 && (S = 1060, d = "84vh")) : c === We && q.current ? (ue.keywords === "" && F.current?.focus({ cursor: "start" }), d = 130, S = 572, ae.length > 0 && (S = 1060, d = "84vh")) : c === He && s.current && (dt === "" && fe.length === 0 ? (Z.current?.focus({ cursor: "start" }), d = 130) : d = s.current.offsetHeight + 82, S = 572), X(d), ie(S);
1905
+ }, 0), K(c));
1906
+ };
1907
+ (0, n.useEffect)(() => {
1908
+ ue.keywords === "" && (y?.current?.focus({ cursor: "start" }), N([]), setTimeout(() => {
1909
+ X("auto"), ie(572);
1910
+ }, 0));
1911
+ }, [
1912
+ ue,
1913
+ N,
1914
+ X,
1915
+ ie
1916
+ ]);
1917
+ const Ze = (c) => {
1918
+ const d = 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";
1919
+ return d || m.error({
1920
+ id: "IMAGE_UPLOAD_WRONG_FORMAT",
1921
+ data: c,
1922
+ title: "Upload",
1923
+ description: "You can only upload JPG/JPEG/PNG/WEBP/GIF/SVG file!"
1924
+ }), d;
1925
+ }, Oe = async ({ file: c }) => {
1926
+ try {
1927
+ ye(!0);
1928
+ const d = await re.prepareImageForEditorUpload(c, e), S = await rn(d);
1929
+ if (S) return yt(S, d), S;
1930
+ const H = await Kt(d, t);
1931
+ if (H?.url) return yt(H.url, d), H.url;
1932
+ Me(d, null);
1933
+ return;
1934
+ } catch (d) {
1935
+ Me(c, d);
1936
+ return;
1937
+ } finally {
1938
+ ye(!1);
1939
+ }
1940
+ }, ln = (c) => Oe({ file: c });
1941
+ let Le = [{
1942
+ label: a("Upload"),
1943
+ key: pe,
1944
+ children: (0, r.jsxs)("div", {
1945
+ ref: A,
1946
+ style: { paddingBottom: 24 },
1947
+ children: [e.imageCenterLocalUploadEnabled !== !1 && (0, r.jsxs)(Qt, {
1948
+ showUploadList: !1,
1949
+ name: "Image",
1950
+ beforeUpload: Ze,
1951
+ customRequest: Oe,
1952
+ style: { marginBottom: 10 },
1953
+ multiple: !1,
1954
+ accept: "image/png, image/jpeg, image/jpg, image/webp, image/gif, image/svg+xml",
1955
+ children: [
1956
+ (0, r.jsx)("p", {
1957
+ className: "ant-upload-drag-icon",
1958
+ children: (0, r.jsx)(T.EmIcons, { icon: "InboxOutlined" })
1959
+ }),
1960
+ (0, r.jsx)("p", {
1961
+ className: "ant-upload-text",
1962
+ children: a("Click to select, paste from the clipboard, or drag and drop")
1963
+ }),
1964
+ (0, r.jsx)("p", {
1965
+ className: "ant-upload-hint",
1966
+ children: a("Accepted formats: PNG, JPG, WEBP, SVG or GIF.")
1967
+ })
1968
+ ]
1969
+ }), (0, r.jsx)(f.Form, {
1970
+ style: { padding: "0 2px 0 2px" },
1971
+ children: (0, r.jsx)(f.Form.Item, {
1972
+ validateStatus: P,
1973
+ children: (0, r.jsx)(f.Input, {
1974
+ ref: y,
1975
+ allowClear: !0,
1976
+ size: "large",
1977
+ placeholder: a("Paste image URL here"),
1978
+ value: h,
1979
+ onChange: nn,
1980
+ spellCheck: "false"
1981
+ })
1982
+ })
1983
+ })]
1984
+ })
1985
+ }];
1986
+ return e.imageCenterStockEnabled && !ve && Le.push({
1987
+ label: a("Stock"),
1988
+ key: Ke,
1989
+ children: (0, r.jsx)("div", {
1990
+ ref: J,
1991
+ style: { paddingBottom: 24 },
1992
+ children: (0, r.jsx)(Dt, {
1993
+ currentReq: ue,
1994
+ setCurrentReq: _,
1995
+ imageStockList: te,
1996
+ setImageStockList: N,
1997
+ setModalWidth: ie,
1998
+ setModalHeight: X,
1999
+ setStockLink: z,
2000
+ setCurrentImageLink: L,
2001
+ inputRef: ce,
2002
+ customRequest: Pe
2003
+ })
2004
+ })
2005
+ }), e.imageCenterGifEnabled && !ve && Le.push({
2006
+ label: a("GIF"),
2007
+ key: We,
2008
+ children: (0, r.jsx)("div", {
2009
+ ref: q,
2010
+ style: { paddingBottom: 24 },
2011
+ children: (0, r.jsx)(Tt, {
2012
+ currentReqGif: se,
2013
+ setCurrentReqGif: B,
2014
+ imageGifList: ae,
2015
+ setImageGifList: v,
2016
+ setModalWidth: ie,
2017
+ setModalHeight: X,
2018
+ setStockLink: z,
2019
+ setCurrentImageLink: L,
2020
+ inputRef: F,
2021
+ customRequest: Pe
2022
+ })
2023
+ })
2024
+ }), e.elementAIimageEnabled && !ve && Le.push({
2025
+ label: a("AI"),
2026
+ key: He,
2027
+ children: (0, r.jsx)("div", {
2028
+ ref: s,
2029
+ style: { paddingBottom: 24 },
2030
+ children: (0, r.jsx)(Pt, {
2031
+ setModalHeight: X,
2032
+ customRequest: Oe,
2033
+ aiImageRequest: dt,
2034
+ setAiImageRequest: Ve,
2035
+ imageAiList: fe,
2036
+ setImageAiList: Zt,
2037
+ isLoadingAi: ct,
2038
+ setIsLoadingAi: ut,
2039
+ aiTabRef: s,
2040
+ inputAiRef: Z,
2041
+ isImageUploaded: I,
2042
+ setIsImageUploaded: W
2043
+ })
2044
+ })
2045
+ }), e.imageCenterEditorEnabled && Le.push({
2046
+ label: "",
2047
+ key: we,
2048
+ children: (0, r.jsx)("div", {
2049
+ ref: Q,
2050
+ children: (0, r.jsx)(St, {
2051
+ currentImageLink: w,
2052
+ newLink: h,
2053
+ previewDisplayUrl: tn,
2054
+ resolvedPreviewObjectUrl: $t,
2055
+ resolvedPreviewBlob: en,
2056
+ imageSize: ee,
2057
+ onSave: ln,
2058
+ uploadImageResultIsLoading: he || !1
2059
+ })
2060
+ })
2061
+ }), (0, r.jsxs)(r.Fragment, { children: [(0, r.jsx)(f.Modal, {
2062
+ width: G,
2063
+ className: "image-center",
2064
+ title: a("Image Center"),
2065
+ style: { minHeight: 390 },
2066
+ open: !!V,
2067
+ onOk: Ye,
2068
+ onCancel: an,
2069
+ footer: M === we ? (0, r.jsx)(r.Fragment, {}) : null,
2070
+ children: (0, r.jsx)(f.Spin, {
2071
+ spinning: he,
2072
+ children: (0, r.jsx)(f.Tabs, {
2073
+ activeKey: M,
2074
+ onChange: on,
2075
+ items: Le,
2076
+ className: "modal-tabs",
2077
+ style: {
2078
+ height: $,
2079
+ minHeight: 130
2080
+ }
2081
+ })
2082
+ })
2083
+ }), (0, r.jsx)(T.ModalToChangeConfigOnFree, {
2084
+ open: Xt,
2085
+ onCancel: () => je(!1),
2086
+ initialSlide: Jt
2087
+ })] });
2088
+ };
2089
+ lt.propTypes = { dataProvider: Ne.default.object }, vt.default = lt;
2090
+ });