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