useblocks 1.1.64 → 1.1.70

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 (196) hide show
  1. package/README.md +2 -0
  2. package/assets/images/project-settings-inbox-envelope.png +0 -0
  3. package/assets/images/project-settings-plugin-support-avatar.png +0 -0
  4. package/fileManager.d.ts +519 -0
  5. package/iframe/css/sandbox-dark.css +1 -1
  6. package/iframe/css/sandbox-darktheme.css +1 -1
  7. package/iframe/css/sandbox-light.css +1 -1
  8. package/iframe/css/sandbox.css +112 -89
  9. package/iframe/js/amp.DllX-Im0.js +1 -0
  10. package/iframe/js/iframe-eblock.js +1 -1
  11. package/iframe/js/iframe.js +1 -1
  12. package/iframe/js/rules.4N5s3OV-.js +1 -1
  13. package/npm-publish.manifest.json +7 -7
  14. package/package.json +4 -1
  15. package/runtime/THIRD_PARTY_LICENSES.txt +1 -1
  16. package/static/core/{d2f93451.js → 0e53b7b5.js} +3 -3
  17. package/static/core/0fe242f22.js +3251 -0
  18. package/static/core/{e9ff66762.js → 10f0dad9.js} +3 -3
  19. package/static/core/{a79573972.js → 115218a42.js} +3 -3
  20. package/static/core/{d6b377d3.js → 1202bfdd.js} +3 -3
  21. package/static/core/{8d4aa933.js → 16c2d0e42.js} +6 -6
  22. package/static/core/{8aa09f022.js → 1ae75b972.js} +3 -3
  23. package/static/core/{e7c982c02.js → 2011fc95.js} +3 -3
  24. package/static/core/{925a1cfd2.js → 211482892.js} +3 -3
  25. package/static/core/222d29d9.js +468 -0
  26. package/static/core/{6c0b4555.js → 23546a64.js} +238 -257
  27. package/static/core/{6e177eb6.js → 26a1af95.js} +3 -3
  28. package/static/core/{9d8297c7.js → 27f62a39.js} +3 -3
  29. package/static/core/{fb834fb22.js → 288ca9522.js} +6 -6
  30. package/static/core/{45da436c.js → 28e9d3ff.js} +3 -3
  31. package/static/core/{1c82c2d52.js → 2bd2da322.js} +3 -3
  32. package/static/core/{712b11ba.js → 2c65c059.js} +3 -3
  33. package/static/core/{1d2a32d02.js → 2f216fd4.js} +4 -4
  34. package/static/core/{45fcca4f2.js → 2fd502bd2.js} +3 -3
  35. package/static/core/{b303b2a4.js → 34e0b0dc.js} +3 -3
  36. package/static/core/{b0712bbb.js → 35ad3ae5.js} +173 -173
  37. package/static/core/{8e6e6aaa2.js → 35e0d55e.js} +3 -3
  38. package/static/core/36bf6931.js +2119 -0
  39. package/static/core/{a953bf24.js → 375e98282.js} +3 -3
  40. package/static/core/{40d6d494.js → 38302247.js} +3 -3
  41. package/static/core/{99fd0b342.js → 38e879e9.js} +3 -3
  42. package/static/core/{b283b340.js → 39a68c91.js} +3 -3
  43. package/static/core/{68edd344.js → 3bbe4800.js} +3 -3
  44. package/static/core/{43108a122.js → 3bda5ccf2.js} +4 -4
  45. package/static/core/{220b2c2a.js → 3c1ef117.js} +7 -7
  46. package/static/core/{411c06d9.js → 3f22a9d32.js} +2018 -1808
  47. package/static/core/{8b8811812.js → 412f0d1c.js} +3 -3
  48. package/static/core/{601b4e7b.js → 46959096.js} +3 -3
  49. package/static/core/{9d1a7a182.js → 46abec11.js} +3 -3
  50. package/static/core/{292fe55d2.js → 4740c91e2.js} +3 -3
  51. package/static/core/{c7588e5f.js → 48560c89.js} +387 -385
  52. package/static/core/{1d173e97.js → 48d0a8bd2.js} +3 -3
  53. package/static/core/{af691d1f.js → 490f59592.js} +21 -21
  54. package/static/core/{205266672.js → 4953bced.js} +3 -3
  55. package/static/core/{668ae858.js → 4b59ab9f.js} +3 -3
  56. package/static/core/{664c38f8.js → 4bc74a4f.js} +3 -3
  57. package/static/core/{8b28b024.js → 508bcaba.js} +5 -5
  58. package/static/core/513594a8.js +583 -0
  59. package/static/core/54eadcf42.js +39 -0
  60. package/static/core/{da4b0874.js → 578fcc88.js} +3 -3
  61. package/static/core/{43764f5b.js → 585259872.js} +189 -181
  62. package/static/core/{cee370ea.js → 5b64d3ce2.js} +8 -8
  63. package/static/core/{b450a16a.js → 5e082e16.js} +59 -59
  64. package/static/core/{bc1a9cb2.js → 5e7c6c9c.js} +4 -4
  65. package/static/core/{bc557d9c.js → 60dcae06.js} +6 -6
  66. package/static/core/{fa23ae7b.js → 616e99a4.js} +3 -3
  67. package/static/core/{66f4dea3.js → 62c13c96.js} +3 -3
  68. package/static/core/{d892d2c82.js → 62f33dda.js} +3 -3
  69. package/static/core/{9c236031.js → 62fd385b.js} +3 -3
  70. package/static/core/{958e85b5.js → 6313868b.js} +3 -3
  71. package/static/core/63206e112.js +8956 -0
  72. package/static/core/{9e889fa1.js → 68ec11c8.js} +640 -638
  73. package/static/core/{951b9e3d.js → 6ca6133e.js} +9 -9
  74. package/static/core/6e2a0152.js +61 -0
  75. package/static/core/{656a0edc2.js → 6ee1838f2.js} +3 -3
  76. package/static/core/{b09300472.js → 7527fdc92.js} +3 -3
  77. package/static/core/{d8df6d5a.js → 75c2f232.js} +8 -8
  78. package/static/core/{49a037b02.js → 76c0586a2.js} +3 -3
  79. package/static/core/{2d8a7133.js → 76ea88d3.js} +5 -5
  80. package/static/core/{42e9eb802.js → 77c2efbb.js} +3 -3
  81. package/static/core/{5d0c727e.js → 7d07bfac.js} +3 -3
  82. package/static/core/{d46cb9672.js → 7d19dd28.js} +4 -4
  83. package/static/core/{2d13936a.js → 7ec8e1fc.js} +3 -3
  84. package/static/core/{9954153b2.js → 84326fa6.js} +3 -3
  85. package/static/core/{c52e08d6.js → 86515d932.js} +4 -4
  86. package/static/core/{a97bdbc8.js → 879bd3b1.js} +3 -3
  87. package/static/core/{e47711662.js → 8a061db42.js} +5 -5
  88. package/static/core/{4b0f73af.js → 8ed78147.js} +3 -3
  89. package/static/core/{1cbab2af2.js → 8ef06b232.js} +10 -10
  90. package/static/core/{75e8d4672.js → 8fafd12f2.js} +3 -3
  91. package/static/core/{a898230f.js → 8fbde229.js} +3 -3
  92. package/static/core/{f61e3e55.js → 92871f5a2.js} +7 -7
  93. package/static/core/{a83b01cb2.js → 92d1a0c9.js} +519 -523
  94. package/static/core/9355751a.js +126 -0
  95. package/static/core/{95d1d1aa2.js → 93b3c668.js} +3 -3
  96. package/static/core/{873142eb.js → 9933d0ff2.js} +3 -3
  97. package/static/core/{96417e98.js → 9a0c05f1.js} +4 -4
  98. package/static/core/9ab1c444.js +11452 -0
  99. package/static/core/{c8cb5d88.js → 9c09ec92.js} +7 -7
  100. package/static/core/{31ba662c2.js → 9df9c5262.js} +5 -5
  101. package/static/core/{85ea16112.js → a061a37c2.js} +3 -3
  102. package/static/core/{fff1a8622.js → a64e6cce2.js} +3 -3
  103. package/static/core/{f5d4906d2.js → a6d92d0b2.js} +5 -5
  104. package/static/core/{2e9906f7.js → a7518d2c.js} +3 -3
  105. package/static/core/{3c6f1d122.js → a8bed12d2.js} +3 -3
  106. package/static/core/{72e2612a2.js → a8f08cb22.js} +3 -3
  107. package/static/core/{6eb316fe2.js → ac70dfae2.js} +6 -6
  108. package/static/core/{7dd91b5f.js → b3ee36b6.js} +34713 -38523
  109. package/static/core/{89e7cc57.js → b8cecec8.js} +17 -17
  110. package/static/core/{a35fd8d22.js → b8ed4fd62.js} +13 -13
  111. package/static/core/{7735c90f.js → b9b92e01.js} +15 -15
  112. package/static/core/{b57c9e1f.js → bc703487.js} +3 -3
  113. package/static/core/{b165c6f6.js → bc9faec1.js} +134 -134
  114. package/static/core/{54e7728d.js → bf3a9be2.js} +5 -5
  115. package/static/core/c370a46c.js +683 -0
  116. package/static/core/{e96aadfa.js → c3b45fb6.js} +1846 -1847
  117. package/static/core/{d54353e72.js → c56eaffd.js} +3 -3
  118. package/static/core/{f562fb51.js → c5cf470c.js} +3 -3
  119. package/static/core/{ceffb8322.js → c8a41267.js} +3 -3
  120. package/static/core/{19572306.js → cc251d11.js} +3 -3
  121. package/static/core/{84df1edd2.js → cce631ad.js} +3 -3
  122. package/static/core/{a88996b3.js → ce9be2ec2.js} +4965 -4753
  123. package/static/core/cf655a1a.js +33627 -0
  124. package/static/core/{261ad211.js → d3bbb05e.js} +3 -3
  125. package/static/core/{4a9bd173.js → d43babb9.js} +3 -3
  126. package/static/core/{1a415abd2.js → d46d10f12.js} +12 -12
  127. package/static/core/{7ad0031e2.js → d684b4ef2.js} +38 -38
  128. package/static/core/{affffdf2.js → d8835f5f.js} +7 -7
  129. package/static/core/{b04145ff2.js → db5fa769.js} +10 -10
  130. package/static/core/{d32841a32.js → dbc6f1e52.js} +3 -3
  131. package/static/core/{db4e60fa2.js → dc256ccd2.js} +3 -3
  132. package/static/core/{eaa635532.js → dc6fa7c1.js} +3 -3
  133. package/static/core/{4b9709dc.js → dcc518ef2.js} +3 -3
  134. package/static/core/df237243.js +56 -0
  135. package/static/core/{5ea0fc40.js → e02024fb2.js} +97 -97
  136. package/static/core/e199fd0a.js +49 -0
  137. package/static/core/{678594cd.js → e3a541ab.js} +3 -3
  138. package/static/core/{6f0d961a2.js → e4c6d91e2.js} +7 -7
  139. package/static/core/e57e8a80.js +22 -0
  140. package/static/core/{d7a9fd822.js → e6ac2e652.js} +3 -3
  141. package/static/core/{de2e2a02.js → e6c7e14f.js} +3 -3
  142. package/static/core/{81a5ffb92.js → e83c0b482.js} +3 -3
  143. package/static/core/{2515c6a52.js → e923d1aa2.js} +3 -3
  144. package/static/core/{bcee99d6.js → ea6c5c93.js} +3596 -3422
  145. package/static/core/{d85e34c42.js → ebd51d83.js} +3 -3
  146. package/static/core/{b54ad117.js → ec4f2d562.js} +3 -3
  147. package/static/core/{da25e8fc.js → f0364bbd2.js} +4 -4
  148. package/static/core/{b1b3186f.js → f51ccb57.js} +7 -7
  149. package/static/core/{7fd85aa0.js → f73bbe35.js} +5 -5
  150. package/static/core/{211ca90b.js → f85b09cb.js} +3 -3
  151. package/static/core/{3ab5d1a4.js → f9aaa4b7.js} +7 -7
  152. package/static/core/{4c5c889d.js → fc962c9a2.js} +5 -5
  153. package/static/core/{fd9034a2.js → fd7386aa2.js} +37 -37
  154. package/static/core/{62dd04ca2.js → fe4feb362.js} +3 -3
  155. package/static/core/{f3b4a3102.js → ffcf92522.js} +3 -3
  156. package/static/media/image-editor/fonts/Rubik-Black.woff2 +0 -0
  157. package/static/media/image-editor/fonts/Rubik-Bold.woff2 +0 -0
  158. package/static/media/image-editor/fonts/Rubik-Light.woff2 +0 -0
  159. package/static/media/image-editor/fonts/Rubik-Regular.woff2 +0 -0
  160. package/static/media/image-editor/fonts/caveat-v23-cyrillic_latin-regular.woff2 +0 -0
  161. package/static/media/image-editor/fonts/commissioner-v24-cyrillic_latin-regular.woff2 +0 -0
  162. package/static/media/image-editor/fonts/inter-v20-cyrillic_latin-regular.woff2 +0 -0
  163. package/static/media/image-editor/fonts/oswald-v57-cyrillic_latin-regular.woff2 +0 -0
  164. package/static/media/image-editor/fonts/pacifico-v23-cyrillic_latin-regular.woff2 +0 -0
  165. package/static/media/image-editor/fonts/playfair-display-v40-cyrillic_latin-regular.woff2 +0 -0
  166. package/static/umd-runtime/ui-kit.js +1638 -1416
  167. package/test-font.otf +0 -0
  168. package/test-font.ttf +0 -0
  169. package/test-font.woff2 +0 -0
  170. package/two_step_headless_plugin.html +1 -1
  171. package/ui-kit/index.js +1317 -1104
  172. package/{useblocks-core.d874510b.js → useblocks-core.d9c7d790.js} +8 -8
  173. package/useblocks-esm.js +6 -3
  174. package/useblocks-po.d9c7d790.js +5945 -0
  175. package/useblocks.d.ts +36 -525
  176. package/useblocks.js +3 -3
  177. package/vite/index.cjs +4 -4
  178. package/vite/index.d.ts +4 -4
  179. package/vite/index.js +4 -4
  180. package/vite/pluginDev/index.cjs +2 -2
  181. package/vite/pluginDev/index.d.ts +12 -12
  182. package/vite/pluginDev/index.js +2 -2
  183. package/webpack/pluginDev/index.d.ts +12 -12
  184. package/iframe/js/amp.BP7EklKo.js +0 -1
  185. package/singlepage_headless_plugin.html +0 -592
  186. package/static/core/40f1c391.js +0 -43109
  187. package/static/core/47513981.js +0 -465
  188. package/static/core/63b7b25e.js +0 -68
  189. package/static/core/8460710a.js +0 -27
  190. package/static/core/86577bae.js +0 -666
  191. package/static/core/90f16a4b.js +0 -2089
  192. package/static/core/a44b0f6c.js +0 -12282
  193. package/static/core/aa783b9b.js +0 -124
  194. package/static/core/dc19c4fa.js +0 -93052
  195. /package/iframe/{iframe-eblock.d874510b.html → iframe-eblock.d9c7d790.html} +0 -0
  196. /package/iframe/{iframe.d874510b.html → iframe.d9c7d790.html} +0 -0
@@ -0,0 +1,583 @@
1
+ __useblocks__.define("static/core/513594a8.js", [
2
+ "require",
3
+ "exports",
4
+ "module",
5
+ "static/core/df237243.js",
6
+ "static/core/ce9be2ec2.js",
7
+ "static/core/e199fd0a.js",
8
+ "static/core/cf655a1a.js",
9
+ "react",
10
+ "antd",
11
+ "react/jsx-runtime",
12
+ "@ant-design/icons"
13
+ ], function(R, le, ve) {
14
+ const se = R("./df237243.js"), d = R("./ce9be2ec2.js"), W = R("./e199fd0a.js"), ce = R("./cf655a1a.js");
15
+ let l = R("react");
16
+ l = se.__toESM(l);
17
+ let U = R("antd"), w = R("react/jsx-runtime"), $ = R("@ant-design/icons");
18
+ function fe(t, e, a, c, x, s) {
19
+ if (e.type === "linear") {
20
+ let n = t.createLinearGradient(a + e.coords.x1, c + e.coords.y1, a + e.coords.x2, c + e.coords.y2);
21
+ return e.colorStops.forEach((h) => n.addColorStop(h.offset, h.color)), n;
22
+ }
23
+ if (e.type === "radial") {
24
+ let n = t.createRadialGradient(a + e.coords.x1, c + e.coords.y1, e.coords.r1 ?? 0, a + e.coords.x2, c + e.coords.y2, e.coords.r2 ?? 0);
25
+ return e.colorStops.forEach((h) => n.addColorStop(h.offset, h.color)), n;
26
+ }
27
+ throw Error("Unknown gradient type");
28
+ }
29
+ function de(t) {
30
+ if (!this.backgroundColor) return;
31
+ let e = this._getNonTransformedDimensions(), a = -e.x / 2, c = -e.y / 2, x = e.x, s = e.y, n = this.backgroundColor;
32
+ if (typeof n == "string" || n instanceof CanvasGradient || n instanceof CanvasPattern) t.fillStyle = n, t.fillRect(a, c, x, s);
33
+ else if (typeof n == "object" && "type" in n && (n.type === "linear" || n.type === "radial")) t.fillStyle = fe(t, n, a, c, x, s), t.fillRect(a, c, x, s);
34
+ else if ("source" in n && (n.source instanceof HTMLImageElement || n.source instanceof HTMLCanvasElement)) if (n.repeat) {
35
+ let h = t.createPattern(n.source, n.repeat);
36
+ h && (t.fillStyle = h, t.fillRect(a, c, x, s));
37
+ } else t.drawImage(n.source, a, c, x, s);
38
+ this._removeShadow(t);
39
+ }
40
+ function ue(t) {
41
+ t.fabric && t.fabric.on("object:added", (e) => {
42
+ let a = e.target;
43
+ a && a.name === "text" && (a._renderBackground = de);
44
+ });
45
+ }
46
+ var H = "fm-pixie-editor", C = new class {
47
+ constructor() {
48
+ this._container = document.createElement("div"), this._instance = null, this._container.classList.add(H), this._container.style.width = "100%", this._container.style.height = "85vh", this._container.style.minHeight = "400px";
49
+ }
50
+ get className() {
51
+ return `.${H}`;
52
+ }
53
+ get canvas() {
54
+ return this._instance?.state.canvasRef?.current;
55
+ }
56
+ get tools() {
57
+ return this._instance?.tools;
58
+ }
59
+ isLoaded() {
60
+ return !!this._instance;
61
+ }
62
+ async _setConfig(t) {
63
+ this._instance ? await this._instance.resetEditor(t) : this._instance = await ce.Tf.init({
64
+ ...t,
65
+ selector: this.className
66
+ }), ue(this._instance);
67
+ }
68
+ async show(t, e, a = e.firstChild) {
69
+ e.insertBefore(this._container, a), await this._setConfig(t), this._instance.open();
70
+ }
71
+ close() {
72
+ this._container.parentNode?.removeChild(this._container);
73
+ }
74
+ }(), G = (t, e = "image/png") => fetch(`data:${e};base64,${t}`).then((a) => a.blob());
75
+ function me(t, e) {
76
+ if (t === "json") return new Blob([e], { type: "application/json" });
77
+ if (t === "svg") return new Blob([e], { type: "image/svg+xml" });
78
+ let a = `image/${t}`;
79
+ if (e.startsWith("data:")) {
80
+ let c = d.ae(e);
81
+ return c && c.startsWith("image/") && (a = c), G(e.replace(/data:image\/[^;]+;base64,/, ""), d.ie(a));
82
+ }
83
+ return G(e, d.ie(a));
84
+ }
85
+ function ge(t) {
86
+ return new Promise((e, a) => {
87
+ let c = new FileReader();
88
+ c.onload = () => e(c.result), c.onerror = () => a(c.error ?? Error("Failed to convert blob to data URL")), c.readAsDataURL(t);
89
+ });
90
+ }
91
+ var he = ({ visible: t, onClose: e, file: a, onSave: c, onSaveCopy: x }) => {
92
+ let { t: s } = d.Nn(), n = l.default.useRef(null), h = d.cr(), ye = d.Bi(), { options: Y, actions: pe } = d.V(), { i18n: T } = d.Nn(), { config: u } = Y, { setCurrentMenuFile: Q } = pe, { getFileData: V, resolveFileForEditByUrl: X } = ye, [F, p] = l.default.useState(!1), [L, Z] = l.default.useState(null), [N, J] = l.default.useState(""), [S, K] = l.default.useState(!1), [q, A] = l.default.useState(!1), [o, P] = l.default.useState(null), j = l.default.useRef(!1), ee = l.default.useRef(void 0), te = l.default.useRef(void 0), ae = l.default.useRef("saveCopy"), M = l.default.useRef(void 0);
93
+ ee.current = c, te.current = x, l.default.useEffect(() => {
94
+ a && !j.current && (async () => {
95
+ if (M.current !== a) {
96
+ if (typeof a == "object") {
97
+ P(a);
98
+ return;
99
+ }
100
+ M.current = a, p(!0);
101
+ try {
102
+ if (a.startsWith("data:")) P({
103
+ thumbnail: a,
104
+ saveWithoutFolder: !0
105
+ });
106
+ else {
107
+ let i = await X(a);
108
+ M.current === a && P(i);
109
+ }
110
+ } catch {
111
+ M.current === a && (M.current = null), e?.();
112
+ } finally {
113
+ p(!1);
114
+ }
115
+ }
116
+ })();
117
+ }, [
118
+ a,
119
+ e,
120
+ X
121
+ ]);
122
+ let oe = l.default.useCallback(async (i) => {
123
+ try {
124
+ if (typeof i.thumbnail == "string" && i.thumbnail.startsWith("data:")) return i.thumbnail;
125
+ let r = await V(i.id, !0);
126
+ if (!r) throw Error(s("Error loading image"));
127
+ return new Promise((g) => {
128
+ let f = new FileReader();
129
+ f.onload = () => g(f.result), f.readAsDataURL(r);
130
+ });
131
+ } catch (r) {
132
+ throw r;
133
+ }
134
+ }, [V, s]);
135
+ l.default.useEffect(() => {
136
+ if (!L && t && o) {
137
+ let i = !1;
138
+ return (async () => {
139
+ p(!0);
140
+ try {
141
+ let r = await oe(o);
142
+ if (!r || typeof r != "string" || r.trim() === "") throw Error("Invalid image data: empty or null");
143
+ if (!r.startsWith("data:")) throw Error("Invalid image data: not a valid data URL");
144
+ let g = r.match(/^data:([^;]+);base64,(.+)$/);
145
+ if (!g) throw Error("Invalid image data: malformed data URL format");
146
+ let [, f, m] = g;
147
+ if (!f.startsWith("image/")) throw Error(`Invalid image data: unsupported MIME type ${f}`);
148
+ if (m.length < 10) throw Error("Invalid image data: base64 content too short");
149
+ if (!/^[A-Za-z0-9+/]+=*$/.test(m)) throw Error("Invalid image data: corrupted base64 content");
150
+ if (!i) {
151
+ Z(r);
152
+ let v = d.Rr(o, "image/png");
153
+ J(v.mimeType);
154
+ }
155
+ } catch (r) {
156
+ i || (h.error({
157
+ id: "IMAGE_DOWNLOAD_FAILED",
158
+ innerException: r,
159
+ message: s("Error loading image"),
160
+ placement: "bottomRight",
161
+ data: {
162
+ itemId: o?.id ?? void 0,
163
+ itemName: o?.name ?? void 0,
164
+ folderId: o?.folderId ?? null,
165
+ thumbnail: o?.thumbnail
166
+ }
167
+ }), e?.());
168
+ } finally {
169
+ p(!1);
170
+ }
171
+ })(), () => {
172
+ i = !0;
173
+ };
174
+ }
175
+ }, [
176
+ o,
177
+ oe,
178
+ L,
179
+ e,
180
+ s,
181
+ t
182
+ ]);
183
+ let ie = l.default.useCallback(async (i, r, g) => {
184
+ let f = await me(g, i), m = d.ie(f.type || `image/${g}`), v = u?.compessorUrl ?? u?.compressorUrl;
185
+ if (m.startsWith("image/")) try {
186
+ let _ = await d._i(new File([f], r, { type: m }), {
187
+ maxSizeMB: u?.compressMaxSize,
188
+ maxWidthOrHeight: u?.compressMaxWidthOrHeight,
189
+ mimeType: m,
190
+ fileName: r,
191
+ libURL: v,
192
+ enableCompression: d.Hr(u, m)
193
+ });
194
+ f = _, m = _.type;
195
+ } catch {}
196
+ return {
197
+ blob: f,
198
+ mimeType: m,
199
+ thumbnailDataUrl: await ge(f)
200
+ };
201
+ }, [u]), D = l.default.useCallback(async (i, r, g, f) => {
202
+ let m = f === "save" ? ee.current : te.current;
203
+ if (!o || !m) return;
204
+ let v = typeof o == "object" && o ? o : null, _ = null;
205
+ try {
206
+ p(!0);
207
+ let { blob: E, mimeType: b, thumbnailDataUrl: k } = await ie(i, r, g), I = {
208
+ ...o,
209
+ thumbnail: k,
210
+ size: E.size,
211
+ date: new Date().toISOString().split("T")[0],
212
+ type: b,
213
+ folderId: o.folderId || "",
214
+ name: o.name || r,
215
+ extension: o.extension || (o.name || r).split(".").pop()?.toLowerCase() || ""
216
+ };
217
+ _ = I;
218
+ let O = await m(I, {
219
+ blob: E,
220
+ mimeType: b,
221
+ thumbnail: k,
222
+ mode: f
223
+ });
224
+ if (O) return p(!1), O;
225
+ throw Error(s(f === "saveCopy" ? "Failed to save image copy" : "Failed to save changes"));
226
+ } catch (E) {
227
+ let b = _ ?? v;
228
+ if (!E?.notificationShown) {
229
+ let k = d.U(E), I = d.H(k?.code, s) ?? k?.message ?? s(f === "saveCopy" ? "Failed to save image copy" : "Error saving image");
230
+ h.error({
231
+ id: f === "saveCopy" ? "IMAGE_SAVE_COPY_FAILED" : "IMAGE_SAVE_FAILED",
232
+ message: I,
233
+ placement: "bottomRight",
234
+ data: {
235
+ itemId: b?.id ?? void 0,
236
+ itemName: b?.name ?? r,
237
+ folderId: b?.folderId ?? null,
238
+ thumbnail: b?.thumbnail
239
+ },
240
+ innerException: E
241
+ });
242
+ }
243
+ p(!1);
244
+ }
245
+ }, [
246
+ o,
247
+ h,
248
+ ie,
249
+ s
250
+ ]), re = l.default.useCallback(async (i) => {
251
+ if (!C.isLoaded() || !o) return;
252
+ ae.current = i;
253
+ let r = o.name || "edited-image", g = d.Rr(o, N);
254
+ try {
255
+ await C.tools?.export.save(r.replace(/\.[^/.]+$/, ""), g.pixieFormat, d.zr.QUALITY);
256
+ } catch {
257
+ try {
258
+ let m = C.canvas, v = m ? m.toDataURL(g.mimeType) : null;
259
+ v && await D(v, r, g.extension, i);
260
+ } catch {}
261
+ }
262
+ }, [
263
+ o,
264
+ N,
265
+ D
266
+ ]), ne = l.default.useCallback(async () => {
267
+ if (!(!L || !t || !S || j.current)) try {
268
+ j.current = !0;
269
+ let i = n.current, r = 0;
270
+ for (; r < 20 && (i.clientWidth === 0 || i.clientHeight === 0);) await new Promise((y) => setTimeout(y, 50)), r++;
271
+ let g = u?.locale ? u?.locale.replace("_", "-") : "en", f = matchMedia("(prefers-color-scheme: dark)").matches ? d.C : d.S, m = u?.theme === "system" ? f : u?.theme, v = (u?.locale || T.language || "en").split("-")[0].split("_")[0], _ = (T.getResourceBundle(v, "translation") || {}).pixie || {}, E = (y) => y.split(" ").map((B) => B.charAt(0).toUpperCase() + B.slice(1).toLowerCase()).join(" "), b = {};
272
+ Object.entries(_).forEach(([y, B]) => {
273
+ let z = E(y);
274
+ b[z] = B, b[y] = B;
275
+ });
276
+ let k = { [g]: b }, I = d.Rr(o, N), O = {
277
+ selector: "#pixie-editor",
278
+ baseUrl: W.o(u?.baseUrl || "", u?.assetsUrl || "assets/image-editor"),
279
+ image: L,
280
+ activeLanguage: g,
281
+ languages: k,
282
+ ui: {
283
+ activeTheme: m,
284
+ mode: "inline",
285
+ forceOverlayModeOnMobile: !1,
286
+ visible: !0,
287
+ menubar: {
288
+ replaceDefaultItems: !0,
289
+ position: "top",
290
+ items: [
291
+ {
292
+ type: "undoWidget",
293
+ align: "left"
294
+ },
295
+ {
296
+ type: "zoomWidget",
297
+ align: "center",
298
+ desktopOnly: !0
299
+ },
300
+ {
301
+ type: "button",
302
+ align: "right",
303
+ desktopOnly: !0,
304
+ icon: () => (0, w.jsx)($.HistoryOutlined, { style: { fontSize: 20 } }),
305
+ action: (y) => {
306
+ y.togglePanel("history");
307
+ }
308
+ },
309
+ {
310
+ type: "button",
311
+ icon: () => (0, w.jsx)($.CloseOutlined, { style: { fontSize: 20 } }),
312
+ align: "right",
313
+ desktopOnly: !0,
314
+ action: e
315
+ }
316
+ ]
317
+ },
318
+ nav: { position: "top" }
319
+ },
320
+ tools: {
321
+ export: {
322
+ defaultFormat: I.pixieFormat,
323
+ defaultQuality: d.zr.QUALITY,
324
+ defaultName: o?.name?.replace(/\.[^/.]+$/, "") || "image"
325
+ },
326
+ text: {
327
+ replaceDefaultItems: !0,
328
+ defaultText: "Handwriting",
329
+ items: [
330
+ {
331
+ family: "Inter",
332
+ src: "fonts/inter-v20-cyrillic_latin-regular.woff2"
333
+ },
334
+ {
335
+ family: "Commissioner",
336
+ src: "fonts/commissioner-v24-cyrillic_latin-regular.woff2"
337
+ },
338
+ {
339
+ family: "Montserrat Light",
340
+ src: "fonts/Montserrat-Light.woff2"
341
+ },
342
+ {
343
+ family: "Montserrat Regular",
344
+ src: "fonts/Montserrat-Regular.woff2"
345
+ },
346
+ {
347
+ family: "Montserrat Bold",
348
+ src: "fonts/Montserrat-Bold.woff2"
349
+ },
350
+ {
351
+ family: "Montserrat Black",
352
+ src: "fonts/Montserrat-Black.woff2"
353
+ },
354
+ {
355
+ family: "Roboto Light",
356
+ src: "fonts/Roboto-Light.woff2"
357
+ },
358
+ {
359
+ family: "Roboto Regular",
360
+ src: "fonts/Roboto-Regular.woff2"
361
+ },
362
+ {
363
+ family: "Roboto Bold",
364
+ src: "fonts/Roboto-Bold.woff2"
365
+ },
366
+ {
367
+ family: "Roboto Black",
368
+ src: "fonts/Roboto-Black.woff2"
369
+ },
370
+ {
371
+ family: "Lato Light",
372
+ src: "fonts/Lato-Light.woff2"
373
+ },
374
+ {
375
+ family: "Lato Regular",
376
+ src: "fonts/Lato-Regular.woff2"
377
+ },
378
+ {
379
+ family: "Lato Bold",
380
+ src: "fonts/Lato-Bold.woff2"
381
+ },
382
+ {
383
+ family: "Lato Black",
384
+ src: "fonts/Lato-Black.woff2"
385
+ },
386
+ {
387
+ family: "Rubik Light",
388
+ src: "fonts/Rubik-Light.woff2"
389
+ },
390
+ {
391
+ family: "Rubik Regular",
392
+ src: "fonts/Rubik-Regular.woff2"
393
+ },
394
+ {
395
+ family: "Rubik Bold",
396
+ src: "fonts/Rubik-Bold.woff2"
397
+ },
398
+ {
399
+ family: "Rubik Black",
400
+ src: "fonts/Rubik-Black.woff2"
401
+ },
402
+ {
403
+ family: "Bebas Neue Light",
404
+ src: "fonts/BebasNeueLight.woff2"
405
+ },
406
+ {
407
+ family: "Bebas Neue Regular",
408
+ src: "fonts/BebasNeueRegular.woff2"
409
+ },
410
+ {
411
+ family: "Bebas Neue Book",
412
+ src: "fonts/BebasNeueBook.woff2"
413
+ },
414
+ {
415
+ family: "Bebas Neue Bold",
416
+ src: "fonts/BebasNeueBold.woff2"
417
+ },
418
+ {
419
+ family: "Fira Sans",
420
+ src: "fonts/fira-sans-v11-latin-ext_latin_cyrillic-regular.woff2"
421
+ },
422
+ {
423
+ family: "Lobster",
424
+ src: "fonts/Lobster.woff2"
425
+ },
426
+ {
427
+ family: "Pacifico",
428
+ src: "fonts/pacifico-v23-cyrillic_latin-regular.woff2"
429
+ },
430
+ {
431
+ family: "Playfair Display",
432
+ src: "fonts/playfair-display-v40-cyrillic_latin-regular.woff2"
433
+ },
434
+ {
435
+ family: "Oswald",
436
+ src: "fonts/oswald-v57-cyrillic_latin-regular.woff2"
437
+ },
438
+ {
439
+ family: "Caveat",
440
+ src: "fonts/caveat-v23-cyrillic_latin-regular.woff2"
441
+ }
442
+ ]
443
+ }
444
+ },
445
+ onSave: async function(y, B, z) {
446
+ try {
447
+ return p(!0), await D(y, B, z, ae.current);
448
+ } catch (we) {
449
+ throw p(!1), we;
450
+ }
451
+ }
452
+ };
453
+ try {
454
+ A(!1), await C.show(O, n.current);
455
+ let y = C.canvas;
456
+ y && y.focus(), A(!0), p(!1);
457
+ } catch {}
458
+ } catch (i) {
459
+ h.error({
460
+ id: "EDITOR_INIT_FAILED",
461
+ message: s("Error initializing editor"),
462
+ placement: "bottomRight",
463
+ innerException: i
464
+ }), j.current = !1, e?.();
465
+ }
466
+ }, [
467
+ o,
468
+ N,
469
+ L,
470
+ t,
471
+ S,
472
+ u?.locale,
473
+ u?.theme,
474
+ u?.baseUrl,
475
+ u?.assetsUrl,
476
+ e,
477
+ D,
478
+ h,
479
+ T,
480
+ s
481
+ ]);
482
+ l.default.useEffect(() => {
483
+ t && L && S && ne();
484
+ }, [
485
+ t,
486
+ L,
487
+ S,
488
+ ne
489
+ ]), l.default.useEffect(() => {
490
+ if (!t) {
491
+ try {
492
+ C.close();
493
+ } catch {}
494
+ p(!1), Z(null), J(""), j.current = !1, K(!1), A(!1);
495
+ }
496
+ return () => {
497
+ try {
498
+ C.close();
499
+ } catch {}
500
+ };
501
+ }, [t]);
502
+ let be = !!o?.id && u?.features?.enableUpdateFile !== !1;
503
+ return (0, w.jsx)(U.Modal, {
504
+ title: o?.name ? s("Editing: {{name}}", { name: o.name }) : s("Editing image"),
505
+ open: t,
506
+ closeIcon: null,
507
+ onCancel: e,
508
+ afterOpenChange: (i) => K(i),
509
+ forceRender: !0,
510
+ width: "100vw",
511
+ getContainer: Y.getModalContainer,
512
+ style: {
513
+ top: 0,
514
+ height: "100vh",
515
+ maxWidth: "none",
516
+ padding: 10
517
+ },
518
+ styles: { body: {
519
+ height: "85vh",
520
+ padding: 0
521
+ } },
522
+ footer: [
523
+ (0, w.jsx)(U.Button, {
524
+ onClick: e,
525
+ disabled: !S || F,
526
+ children: s("Cancel")
527
+ }, "cancel"),
528
+ (0, w.jsx)(U.Button, {
529
+ type: "primary",
530
+ onClick: () => re("saveCopy"),
531
+ loading: F,
532
+ children: s("Save as copy and choose")
533
+ }, "save-copy"),
534
+ ...be ? [(0, w.jsx)(U.Button, {
535
+ type: "primary",
536
+ onClick: () => re("save"),
537
+ loading: F,
538
+ children: s("Save and choose")
539
+ }, "save")] : []
540
+ ],
541
+ mask: { closable: !1 },
542
+ destroyOnHidden: !1,
543
+ afterClose: () => {
544
+ Q && Q("");
545
+ },
546
+ children: (0, w.jsxs)("div", {
547
+ ref: n,
548
+ style: {
549
+ position: "relative",
550
+ width: "100%",
551
+ height: "100%"
552
+ },
553
+ children: [t && !q ? (0, w.jsx)("div", {
554
+ style: {
555
+ position: "absolute",
556
+ inset: 0,
557
+ display: "flex",
558
+ alignItems: "center",
559
+ justifyContent: "center",
560
+ background: "rgba(255,255,255,0.45)",
561
+ backdropFilter: "blur(1px)",
562
+ pointerEvents: "all",
563
+ zIndex: 10
564
+ },
565
+ children: (0, w.jsx)("span", {
566
+ style: {
567
+ fontSize: 14,
568
+ color: "#555"
569
+ },
570
+ children: s("Loading editor...")
571
+ })
572
+ }) : null, F && q && (0, w.jsx)(W.r, { style: {
573
+ position: "absolute",
574
+ top: 0,
575
+ background: "var(--ub-colorBgLayout)",
576
+ zIndex: 100,
577
+ opacity: .7
578
+ } })]
579
+ })
580
+ });
581
+ };
582
+ le.PixieEditor = he;
583
+ });
@@ -0,0 +1,39 @@
1
+ __useblocks__.define("static/core/54eadcf42.js", [
2
+ "require",
3
+ "exports",
4
+ "module"
5
+ ], function(P, n, _) {
6
+ var b = Object.create, c = Object.defineProperty, f = Object.getOwnPropertyDescriptor, p = Object.getOwnPropertyNames, i = Object.getPrototypeOf, O = Object.prototype.hasOwnProperty, v = (e, r, t) => () => {
7
+ if (t) throw t[0];
8
+ try {
9
+ return e && (r = e(e = 0)), r;
10
+ } catch (u) {
11
+ throw t = [u], u;
12
+ }
13
+ }, y = (e, r) => () => (r || (e((r = { exports: {} }).exports, r), e = null), r.exports), j = (e, r, t, u) => {
14
+ if (r && typeof r == "object" || typeof r == "function") for (var l = p(r), a = 0, m = l.length, o; a < m; a++) o = l[a], !O.call(e, o) && o !== t && c(e, o, {
15
+ get: ((g) => r[g]).bind(null, o),
16
+ enumerable: !(u = f(r, o)) || u.enumerable
17
+ });
18
+ return e;
19
+ }, s = (e, r, t) => (t = e == null ? {} : b(i(e)), j(r || !e || !e.__esModule ? c(t, "default", {
20
+ value: e,
21
+ enumerable: !0
22
+ }) : t, e));
23
+ Object.defineProperty(n, "l", {
24
+ enumerable: !0,
25
+ get: function() {
26
+ return s;
27
+ }
28
+ }), Object.defineProperty(n, "o", {
29
+ enumerable: !0,
30
+ get: function() {
31
+ return v;
32
+ }
33
+ }), Object.defineProperty(n, "s", {
34
+ enumerable: !0,
35
+ get: function() {
36
+ return y;
37
+ }
38
+ });
39
+ });
@@ -1,10 +1,10 @@
1
- __useblocks__.define("static/core/da4b0874.js", [
1
+ __useblocks__.define("static/core/578fcc88.js", [
2
2
  "require",
3
3
  "exports",
4
4
  "module",
5
- "static/core/63b7b25e.js"
5
+ "static/core/df237243.js"
6
6
  ], function(t, e, o) {
7
- t("./63b7b25e.js");
7
+ t("./df237243.js");
8
8
  e.conf = {
9
9
  comments: { blockComment: ["<!--", "-->"] },
10
10
  brackets: [