@layers-app/editor 2.2.13 → 2.2.14

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 (212) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.d.ts +41 -5
  3. package/dist/index.js +4 -4
  4. package/dist/{layers.BdMRhosW.js → layers.-AA7n2AN.js} +4 -4
  5. package/dist/{layers.BC7vhblC.js → layers.58q6N-_w.js} +2 -2
  6. package/dist/{layers.CEaS6td1.js → layers.70k8TeKM.js} +1 -1
  7. package/dist/{layers.ESqpMXS3.js → layers.7QKxWctG.js} +1 -1
  8. package/dist/{layers.lpjtCe_h.js → layers.9FDvPQBQ.js} +1 -1
  9. package/dist/{layers.Cw3dSU_j.js → layers.B-EMJlG2.js} +4 -4
  10. package/dist/{layers.D9Qf2-2n.js → layers.B0aWRRWO.js} +1 -1
  11. package/dist/{layers.CDGYthd7.js → layers.B0gc0vbD.js} +1 -1
  12. package/dist/{layers.BdhtJPxa.js → layers.B0sE1QVr.js} +1 -1
  13. package/dist/{layers.Dhb2eyJ-.js → layers.B0v5R3Ga.js} +1 -1
  14. package/dist/{layers.CXDCVR_J.js → layers.B1ToJc-M.js} +1 -1
  15. package/dist/{layers.D1yQKEca.js → layers.B1pCN-60.js} +7 -7
  16. package/dist/{layers.CejpT0WV.js → layers.B6Ss4lrb.js} +1 -1
  17. package/dist/{layers.Dxz26OMI.js → layers.B8KQvhXQ.js} +1 -1
  18. package/dist/{layers.o9ZAvGrl.js → layers.B9xGMw0L.js} +1 -1
  19. package/dist/{layers.CYhG0PVj.js → layers.BAKYS6AU.js} +1 -1
  20. package/dist/{layers.CB5FEkIo.js → layers.BASO96wc.js} +3 -3
  21. package/dist/{layers.8FxnTxBD.js → layers.BAd43ZE0.js} +1 -1
  22. package/dist/{layers.B3JEjkxk.js → layers.BB3jmqyj.js} +2 -2
  23. package/dist/{layers.BAqKF19S.js → layers.BB9t_jjh.js} +4 -4
  24. package/dist/{layers.CDfbx7ul.js → layers.BBa8EIJ_.js} +1 -1
  25. package/dist/{layers.BAgJYqZS.js → layers.BCNyUFOM.js} +1 -1
  26. package/dist/{layers.Cj0AK_M3.js → layers.BEukRqRo.js} +1 -1
  27. package/dist/{layers.XH7cZ7RM.js → layers.BH9Q8Kni.js} +1 -1
  28. package/dist/{layers.sZIPFKhz.js → layers.BHFp0t5a.js} +4 -4
  29. package/dist/{layers.P85lya-a.js → layers.BHpQbQdV.js} +1 -1
  30. package/dist/{layers.DOb66OYY.js → layers.BK4tsNLE.js} +1 -1
  31. package/dist/{layers.Z-TdlRF3.js → layers.BKCN6VWb.js} +1 -1
  32. package/dist/{layers.Dkh0KNA7.js → layers.BKaPp4h9.js} +1 -1
  33. package/dist/{layers.BH9Su9z-.js → layers.BLRJK36q.js} +4 -4
  34. package/dist/{layers.BXtv16EU.js → layers.BMzykHfQ.js} +1 -1
  35. package/dist/{layers.CwbcSmTY.js → layers.BN6R4LF0.js} +117 -117
  36. package/dist/{layers.BigDr41r.js → layers.BNjEfnnW.js} +1 -1
  37. package/dist/{layers.DwAs0sw_.js → layers.BQ1eYBgq.js} +3 -3
  38. package/dist/{layers.k-T7HWtG.js → layers.BQr2nRqD.js} +1 -1
  39. package/dist/{layers.BqxDJqKM.js → layers.BQw07Z0M.js} +1 -1
  40. package/dist/{layers.BmCu7IPT.js → layers.BQz1Hu9h.js} +1 -1
  41. package/dist/{layers.BKWnKnjv.js → layers.BRprvitF.js} +3 -3
  42. package/dist/{layers.BaR-0FXu.js → layers.BSybvyED.js} +1 -1
  43. package/dist/{layers.CUNHYbl9.js → layers.BTcHeVN1.js} +4 -4
  44. package/dist/{layers.DQ3fD-nt.js → layers.BU0OV3LJ.js} +25 -25
  45. package/dist/{layers.DvK-Bg8a.js → layers.BUIqBBAL.js} +1 -1
  46. package/dist/{layers.CYuvR6xl.js → layers.BW2l1n1z.js} +1 -1
  47. package/dist/{layers.CeS02mnZ.js → layers.BYaqCPqT.js} +1 -1
  48. package/dist/{layers.BCUYEv9o.js → layers.BYukOPwz.js} +1 -1
  49. package/dist/{layers.Pkxzj3oB.js → layers.Bf5-l6i9.js} +1 -1
  50. package/dist/{layers.CvQehbdA.js → layers.BgIBNJ3r.js} +1 -1
  51. package/dist/{layers.BFwFOFp6.js → layers.BgqecZRX.js} +1 -1
  52. package/dist/{layers.C1cG7Bb2.js → layers.Bi15Lt1C.js} +1 -1
  53. package/dist/{layers.Bsi0UrCO.js → layers.Biut5UkR.js} +1 -1
  54. package/dist/{layers.DXB7J8Cv.js → layers.BjHPiI2f.js} +1 -1
  55. package/dist/{layers.C9ctlRmN.js → layers.BjLxYRTv.js} +1 -1
  56. package/dist/{layers.B_gZcwlE.js → layers.Bk0oEF-w.js} +1 -1
  57. package/dist/{layers.B2mGFsAC.js → layers.BlHhwY54.js} +1 -1
  58. package/dist/{layers.BAY04JaZ.js → layers.Bl_feozQ.js} +1 -1
  59. package/dist/{layers.1UfoZIrI.js → layers.BnYuJoo0.js} +1 -1
  60. package/dist/{layers.CleLwZl0.js → layers.BnnutrYe.js} +1 -1
  61. package/dist/{layers.Bt2vtG3f.js → layers.BnuOWmPX.js} +1 -1
  62. package/dist/layers.BpYn3piy.js +6 -0
  63. package/dist/{layers.DQ0s8efE.js → layers.Bqpeivbw.js} +1 -1
  64. package/dist/{layers.BZoloilP.js → layers.BssEhs-e.js} +1 -1
  65. package/dist/{layers.CBV4_Q8v.js → layers.Bua2BDqx.js} +1 -1
  66. package/dist/{layers.DUCC1vXz.js → layers.BusndHuJ.js} +1 -1
  67. package/dist/{layers.3wwQYvzE.js → layers.Bv0HdZny.js} +1 -1
  68. package/dist/{layers.BnVEoBHV.js → layers.Bv7VLzdo.js} +1 -1
  69. package/dist/{layers.BqB6Yq44.js → layers.BwwoMWw_.js} +1 -1
  70. package/dist/{layers.QncPHgyq.js → layers.By0sqh26.js} +1 -1
  71. package/dist/{layers.srPvwTOS.js → layers.BzVZKfPK.js} +1 -1
  72. package/dist/{layers.DusKIV96.js → layers.C31nc1gZ.js} +1 -1
  73. package/dist/{layers.BpS_R1ze.js → layers.C3gT6oYK.js} +1 -1
  74. package/dist/{layers.HGzaw5gb.js → layers.C5Ar18yH.js} +1 -1
  75. package/dist/{layers.Dg4wujI9.js → layers.C5ZN3c2q.js} +1 -1
  76. package/dist/{layers.CcDsGNq9.js → layers.C6MyC6Xm.js} +1 -1
  77. package/dist/{layers.DBO29Egl.js → layers.C8PORCMe.js} +1 -1
  78. package/dist/layers.CCjBYJuh.js +901 -0
  79. package/dist/{layers.DPKTuHVy.js → layers.CEqXhOtu.js} +1 -1
  80. package/dist/{layers.BnDREviU.js → layers.CH5R3SoT.js} +1 -1
  81. package/dist/{layers.BBKJEbGP.js → layers.CIuJ2Bt2.js} +2 -2
  82. package/dist/{layers.Clg0Pbcz.js → layers.CIz33X3S.js} +1 -1
  83. package/dist/{layers.BSmPG8nH.js → layers.CJAHbdiD.js} +1 -1
  84. package/dist/{layers.Bds0L5fM.js → layers.CJYpUfIn.js} +1 -1
  85. package/dist/{layers.ChpRh-ln.js → layers.CKsnwSZX.js} +3 -3
  86. package/dist/{layers.CxgO5L0U.js → layers.CLns-L6C.js} +1 -1
  87. package/dist/{layers.BigEixkp.js → layers.CQE2JbtY.js} +1 -1
  88. package/dist/{layers.BSvoaj4y.js → layers.CTGULWkZ.js} +1 -1
  89. package/dist/{layers.D331JcVc.js → layers.CTbCv_to.js} +4 -4
  90. package/dist/{layers.CDeO1yM0.js → layers.CVm09GVA.js} +1 -1
  91. package/dist/{layers.DdCcfPLj.js → layers.CW2fY7gf.js} +3 -3
  92. package/dist/{layers.DhqkpEla.js → layers.CWibiUwe.js} +1 -1
  93. package/dist/{layers.g-krtm71.js → layers.CWwYawcp.js} +1 -1
  94. package/dist/{layers.CscLHDkP.js → layers.CYtlRIm-.js} +1 -1
  95. package/dist/{layers.DS8FRAoI.js → layers.CZa8S9kz.js} +1 -1
  96. package/dist/{layers.BbFbumMx.js → layers.CdAAZYfq.js} +1 -1
  97. package/dist/layers.CdLf_fls.js +1 -0
  98. package/dist/{layers.BJnYBCs1.js → layers.Ce8_pBFc.js} +3 -3
  99. package/dist/{layers.C0d-rEWd.js → layers.CfbI9_Ok.js} +1 -1
  100. package/dist/{layers.BcsT75ls.js → layers.Cgug9aks.js} +1 -1
  101. package/dist/{layers.DjX2hnXr.js → layers.ChW2HICq.js} +1 -1
  102. package/dist/{layers.Dnp2z9ph.js → layers.CheyCotv.js} +3 -3
  103. package/dist/{layers.DNahvyh3.js → layers.CoCwrHbF.js} +1 -1
  104. package/dist/{layers.DtsEFkET.js → layers.CoDTX7AY.js} +1 -1
  105. package/dist/{layers.37tEugLg.js → layers.ColCuHZ0.js} +1 -1
  106. package/dist/{layers.yJpgPNcv.js → layers.CqUQOmWq.js} +1 -1
  107. package/dist/{layers.BjbTCxL7.js → layers.Cr8C6kow.js} +1 -1
  108. package/dist/{layers.C8ZH1mci.js → layers.CsD7MDuA.js} +1 -1
  109. package/dist/{layers.OumDuIvP.js → layers.CtQ49w-t.js} +1 -1
  110. package/dist/{layers.AndwUZMN.js → layers.Ctomm4pI.js} +1 -1
  111. package/dist/{layers.WZzI_Kta.js → layers.Cv2x1yvr.js} +1 -1
  112. package/dist/{layers.yCLo3Wbl.js → layers.CwPa1yiT.js} +8 -8
  113. package/dist/{layers.D1hpe05R.js → layers.CyIXeXkj.js} +1 -1
  114. package/dist/{layers.CFJf_XjC.js → layers.D-i7M6xc.js} +3 -3
  115. package/dist/{layers.CZB2dVO1.js → layers.D0kU1k2c.js} +1 -1
  116. package/dist/{layers.BuAZE5RA.js → layers.D6Jg-fey.js} +1 -1
  117. package/dist/{layers.BSyurqR0.js → layers.D8Po6sUA.js} +1 -1
  118. package/dist/{layers.CZXlcEmg.js → layers.D9Czc_mI.js} +1 -1
  119. package/dist/{layers.CjScpCJV.js → layers.DA-lgY7r.js} +1 -1
  120. package/dist/{layers.g1tbWHIt.js → layers.DALKUbaU.js} +1 -1
  121. package/dist/{layers.BhT5rikg.js → layers.DBubxfkO.js} +1 -1
  122. package/dist/{layers.B6b2Mbvh.js → layers.DBv4NwOt.js} +1 -1
  123. package/dist/{layers.C8XQB0hE.js → layers.DEKnvziz.js} +1 -1
  124. package/dist/{layers.CeOT2PQd.js → layers.DFXp66_A.js} +1 -1
  125. package/dist/{layers.CsU3BVt1.js → layers.DG_XULUE.js} +4 -4
  126. package/dist/{layers.Wc4x1Zm8.js → layers.DHB3djhL.js} +1 -1
  127. package/dist/{layers.B_fnqaZz.js → layers.DI1FzMDv.js} +3 -3
  128. package/dist/{layers.DjhDyCyv.js → layers.DII8V62n.js} +1 -1
  129. package/dist/{layers.DnQ8Hqqs.js → layers.DISSvA7Q.js} +1 -1
  130. package/dist/{layers.BtoPheAp.js → layers.DIrUFOhk.js} +1 -1
  131. package/dist/{layers.dTSX6ksI.js → layers.DKdWSbiM.js} +3 -3
  132. package/dist/{layers.DHjIFQ_M.js → layers.DNVMtoQq.js} +1 -1
  133. package/dist/{layers.nY2hjF-S.js → layers.DRNYGISn.js} +2 -2
  134. package/dist/{layers.CP5kVDkH.js → layers.DROMSEPR.js} +1 -1
  135. package/dist/{layers.l3mgnfnL.js → layers.DVo_2Pzu.js} +1 -1
  136. package/dist/{layers.DCw7IDLF.js → layers.DW9QM58r.js} +1 -1
  137. package/dist/{layers.BsvIPtfm.js → layers.DWnd7jy-.js} +1 -1
  138. package/dist/{layers.DhYyc8EE.js → layers.DXilZetK.js} +1 -1
  139. package/dist/{layers.B_5WEr0K.js → layers.D_TH_zWM.js} +1 -1
  140. package/dist/{layers.D2M9J9av.js → layers.Da7y_C1A.js} +1 -1
  141. package/dist/{layers.BPV47e59.js → layers.Dfme3dN5.js} +1 -1
  142. package/dist/{layers.BcVU2ayW.js → layers.DfnwcyH3.js} +1 -1
  143. package/dist/{layers.DZ31VEe-.js → layers.DhgOcmXd.js} +1 -1
  144. package/dist/{layers.CGyBG9uN.js → layers.DhvG0gsC.js} +1 -1
  145. package/dist/{layers.DaX7VtGb.js → layers.Di1YtYO2.js} +1 -1
  146. package/dist/{layers.CStfj82G.js → layers.Dim33y7f.js} +1 -1
  147. package/dist/{layers.BYPnQ-jA.js → layers.DjCZuw-B.js} +1 -1
  148. package/dist/layers.Dkoa-BgF.js +8 -0
  149. package/dist/{layers.B5OSUMkS.js → layers.DobDcLSl.js} +1 -1
  150. package/dist/{layers.wGzJrfo_.js → layers.DpImBLiW.js} +1 -1
  151. package/dist/{layers.qzgeeXgK.js → layers.DtoUTxie.js} +1 -1
  152. package/dist/{layers.DeH-6Bdd.js → layers.DvLM0GXp.js} +5 -5
  153. package/dist/{layers.bzCn6mlQ.js → layers.Dwwmpvfl.js} +2 -2
  154. package/dist/{layers.BrlWHGOv.js → layers.Dxq1kDGX.js} +1 -1
  155. package/dist/{layers.DlzA-xHt.js → layers.DzfFkHkj.js} +1 -1
  156. package/dist/{layers.CD59hFOU.js → layers.F2sk2P8q.js} +1 -1
  157. package/dist/layers.F3nE4XJo.js +1 -0
  158. package/dist/{layers.CclBI9O_.js → layers.GPgYBu_Y.js} +1 -1
  159. package/dist/{layers.CrhsbZkv.js → layers.Hi8vmTUT.js} +1 -1
  160. package/dist/{layers.ClJnHuky.js → layers.HmfAWin0.js} +1 -1
  161. package/dist/{layers.DeilQ54T.js → layers.I06LpANg.js} +1 -1
  162. package/dist/{layers.D8a6nUov.js → layers.JZZPCNzi.js} +1 -1
  163. package/dist/{layers.DIYNIhmL.js → layers.L1nRk48J.js} +1 -1
  164. package/dist/{layers.D5yxCQUQ.js → layers.LLoAZD7f.js} +4 -4
  165. package/dist/{layers.CtPms5Xq.js → layers.LaWi0M_Z.js} +1 -1
  166. package/dist/{layers.B9sf0spO.js → layers.LivFkxRN.js} +1 -1
  167. package/dist/{layers.C1uyYyYs.js → layers.MRoWc_CU.js} +1 -1
  168. package/dist/{layers.Bl1Au46v.js → layers.MlnLe7Gj.js} +1 -1
  169. package/dist/{layers.BIs6O-GJ.js → layers.NMm9i3gm.js} +1 -1
  170. package/dist/{layers.B3zYKBsf.js → layers.NqbevyNu.js} +1 -1
  171. package/dist/{layers.BThnJXqq.js → layers.QycQ7GvM.js} +1 -1
  172. package/dist/layers.R-6ecGhR.js +1 -0
  173. package/dist/{layers.Cc6Dy3lN.js → layers.REoUR8qw.js} +1 -1
  174. package/dist/{layers.BacWku-_.js → layers.S4YiWa7X.js} +1 -1
  175. package/dist/{layers.B66zWJVX.js → layers.St6BScTW.js} +1 -1
  176. package/dist/{layers.Dz4O4wYH.js → layers.TE0E-vt7.js} +1 -1
  177. package/dist/{layers.B2bKeFdG.js → layers.Tn67zn8l.js} +1 -1
  178. package/dist/{layers.C_T_LMJy.js → layers.Y2IE7iby.js} +17454 -18606
  179. package/dist/{layers.BQwJz_NL.js → layers.YT6mZnie.js} +1 -1
  180. package/dist/layers._8rxAQG8.js +700 -0
  181. package/dist/{layers.CSNHMV8J.js → layers._ERPO831.js} +1 -1
  182. package/dist/{layers.CW7IYnjZ.js → layers._YrHBtzZ.js} +1 -1
  183. package/dist/{layers.BY8-cdIn.js → layers.dzdjnSOc.js} +1 -1
  184. package/dist/{layers.BZsKqMo_.js → layers.e4COsDmT.js} +1 -1
  185. package/dist/{layers.BzM8rwNt.js → layers.eA5-JNBO.js} +1 -1
  186. package/dist/{layers.ai2dep1M.js → layers.eKkuuF-o.js} +1 -1
  187. package/dist/{layers.BKUDAY8p.js → layers.fIAyWjW4.js} +1 -1
  188. package/dist/{layers.CMwdDXVu.js → layers.fKLXkf0x.js} +1 -1
  189. package/dist/{layers.CwPRjURH.js → layers.hP-Wg9l6.js} +6 -6
  190. package/dist/{layers.B3YzwKY_.js → layers.hk-v21Xo.js} +1 -1
  191. package/dist/{layers.BrfCLctd.js → layers.iC6ji2P7.js} +1 -1
  192. package/dist/{layers.BvHIl1Jn.js → layers.iK7jWHHM.js} +1 -1
  193. package/dist/layers.jgYEpEmX.js +1 -0
  194. package/dist/{layers.dH54y4EX.js → layers.k0pb4U_n.js} +1 -1
  195. package/dist/{layers.7nD94Zq9.js → layers.kkbkfuDx.js} +1 -1
  196. package/dist/{layers.0aPpAvdf.js → layers.mc2OVE9h.js} +1 -1
  197. package/dist/{layers.DNUSxXhb.js → layers.nhsEAdpf.js} +2 -2
  198. package/dist/{layers.DKgfPRYD.js → layers.o7qToHra.js} +5 -5
  199. package/dist/{layers._PAU7LYb.js → layers.oXEy6U3H.js} +1 -1
  200. package/dist/{layers.Dynz-n4p.js → layers.uIR3QS9O.js} +4 -4
  201. package/dist/{layers.CYKwKRmZ.js → layers.wCasgrop.js} +1 -1
  202. package/dist/{layers.DjwXaeUR.js → layers.yFnU2lCF.js} +1 -1
  203. package/dist/{layers.DosKpDm5.js → layers.ybbvb0a7.js} +1 -1
  204. package/package.json +80 -80
  205. package/dist/layers.BugevNWi.js +0 -520
  206. package/dist/layers.CNAxOHS_.js +0 -1
  207. package/dist/layers.Cl1WZyZB.js +0 -8
  208. package/dist/layers.D2OzccOg.js +0 -1
  209. package/dist/layers.IOldzt94.js +0 -1
  210. package/dist/layers.NG3ggnia.js +0 -6
  211. package/dist/layers.__VjF_qK.js +0 -1126
  212. package/dist/layers.ur5mqrxg.js +0 -1
@@ -1,520 +0,0 @@
1
- import { jsxs as P, jsx as o, Fragment as le } from "react/jsx-runtime";
2
- import { useState as w, useCallback as C, useMemo as de, useContext as Q, useRef as ce, useEffect as D } from "react";
3
- import { useTranslation as H } from "react-i18next";
4
- import { useLexicalComposerContext as $ } from "@lexical/react/LexicalComposerContext";
5
- import { Stack as me, Button as L, Box as ue, LoadingOverlay as ge } from "@mantine/core";
6
- import { $getNodeByKey as N, COMMAND_PRIORITY_LOW as he, $setSelection as pe } from "lexical";
7
- import { b as A, c as fe, d as K, i as ee, P as ve, N as we, M as Ie, A as be, O as Ce, e as ye, H as R, g as Ne, T as Ae, f as xe, C as te, h as De, j as Oe, m as F, k as Te, n as Se, o as Ee, U as Me, q as Pe, r as ke, R as We, s as Y, t as _e, v as ze, w as Ue } from "./layers.C_T_LMJy.js";
8
- import { AttachmentsGalleryModal as Le, showErrorNotification as Re } from "@layers-app/shared";
9
- import "@lexical/react/LexicalDecoratorBlockNode";
10
- import "@lexical/utils";
11
- import { useDisclosure as Z } from "@mantine/hooks";
12
- import "@lexical/mark";
13
- import "@lexical/code";
14
- import "@lexical/selection";
15
- import "@lexical/react/LexicalBlockWithAlignableContents";
16
- import "@mantine/notifications";
17
- const Fe = () => {
18
- };
19
- function He({ nodeKey: e, src: n, id: i }) {
20
- const { t: r } = H(), [m] = $(), [u, g] = w(!1), [l, h] = w(!1), p = C(() => {
21
- h(!1), m.update(() => {
22
- const v = N(e);
23
- if (!A(v)) return;
24
- const I = v.getParent();
25
- fe(I) ? I.remove() : v.remove();
26
- });
27
- }, [m, e]), x = C(async () => {
28
- if (n)
29
- try {
30
- await K(n, ee(n));
31
- } catch {
32
- }
33
- }, [n]);
34
- return /* @__PURE__ */ P(
35
- "div",
36
- {
37
- className: "media-actions visible",
38
- style: {
39
- position: "absolute",
40
- top: 10,
41
- right: 10,
42
- zIndex: 10,
43
- pointerEvents: "auto",
44
- display: "flex",
45
- gap: 4
46
- },
47
- onClick: (v) => v.stopPropagation(),
48
- children: [
49
- /* @__PURE__ */ o(ve, { t: r, src: n, setShown: Fe, id: i }),
50
- /* @__PURE__ */ o(
51
- we,
52
- {
53
- opened: u,
54
- setOpened: g,
55
- t: r,
56
- editor: m,
57
- nodeKey: e
58
- }
59
- ),
60
- /* @__PURE__ */ o(
61
- Ie,
62
- {
63
- opened: l,
64
- onOpenChange: h,
65
- t: r,
66
- onDownload: () => void x(),
67
- onDelete: p
68
- }
69
- )
70
- ]
71
- }
72
- );
73
- }
74
- function $e({ nodeKey: e, src: n, id: i }) {
75
- const { t: r } = H(), [m] = $(), [u, { open: g, close: l }] = Z(!1), [h, { open: p, close: x }] = Z(!1), v = de(
76
- () => [
77
- {
78
- id: !i || i === "0" ? "" : i,
79
- Url: n ?? "",
80
- contentType: "",
81
- originalFileName: "",
82
- fileSize: 0,
83
- storageType: "",
84
- storagePath: "",
85
- fileName: "",
86
- parentType: "",
87
- parentId: "",
88
- ownerId: "",
89
- createdAt: /* @__PURE__ */ new Date(),
90
- updatedAt: /* @__PURE__ */ new Date(),
91
- version: 0,
92
- deleted: !1,
93
- deletedAt: /* @__PURE__ */ new Date()
94
- }
95
- ],
96
- [n, i]
97
- ), I = () => {
98
- l(), p();
99
- }, O = C(async () => {
100
- if (l(), !!n)
101
- try {
102
- await K(n, ee(n));
103
- } catch {
104
- }
105
- }, [n, l]), b = C(() => {
106
- l(), m.update(() => {
107
- const a = N(e);
108
- A(a) && a.remove();
109
- });
110
- }, [m, e, l]);
111
- return /* @__PURE__ */ P(le, { children: [
112
- /* @__PURE__ */ o(
113
- "div",
114
- {
115
- className: "image-touch-actions",
116
- style: {
117
- position: "absolute",
118
- top: 8,
119
- right: 8,
120
- zIndex: 10,
121
- pointerEvents: "auto"
122
- },
123
- onClick: (a) => a.stopPropagation(),
124
- children: /* @__PURE__ */ o(
125
- be,
126
- {
127
- label: r("editor.toolbar.more"),
128
- icon: Ce,
129
- iconColor: "var(--mantine-color-gray-text)",
130
- "aria-label": r("editor.toolbar.more"),
131
- onClick: g
132
- }
133
- )
134
- }
135
- ),
136
- /* @__PURE__ */ o(
137
- Le,
138
- {
139
- opened: h,
140
- onOpenChange: (a) => a ? p() : x(),
141
- attachments: v
142
- }
143
- ),
144
- /* @__PURE__ */ o(
145
- ye,
146
- {
147
- opened: u,
148
- onClose: l,
149
- title: r("editor.image.mobileActions"),
150
- children: /* @__PURE__ */ P(me, { gap: 4, p: 0, children: [
151
- /* @__PURE__ */ o(
152
- L,
153
- {
154
- type: "button",
155
- variant: "subtle",
156
- color: "gray",
157
- fullWidth: !0,
158
- justify: "flex-start",
159
- bg: "light-dark(var(--mantine-color-gray-0), var(--mantine-color-gray-outline-hover))",
160
- onClick: I,
161
- leftSection: /* @__PURE__ */ o(
162
- R,
163
- {
164
- icon: Ne,
165
- size: 16,
166
- color: "var(--mantine-color-dimmed)"
167
- }
168
- ),
169
- children: r("editor.image.previewFullScreen")
170
- }
171
- ),
172
- /* @__PURE__ */ o(
173
- L,
174
- {
175
- type: "button",
176
- variant: "subtle",
177
- color: "gray",
178
- fullWidth: !0,
179
- justify: "flex-start",
180
- bg: "light-dark(var(--mantine-color-gray-0), var(--mantine-color-gray-outline-hover))",
181
- onClick: () => void O(),
182
- leftSection: /* @__PURE__ */ o(
183
- R,
184
- {
185
- icon: Ae,
186
- size: 16,
187
- color: "var(--mantine-color-dimmed)"
188
- }
189
- ),
190
- children: r("editor.gallery.download")
191
- }
192
- ),
193
- /* @__PURE__ */ o(
194
- L,
195
- {
196
- type: "button",
197
- variant: "subtle",
198
- color: "red",
199
- fullWidth: !0,
200
- justify: "flex-start",
201
- bg: "light-dark(var(--mantine-color-gray-0), var(--mantine-color-gray-outline-hover))",
202
- onClick: b,
203
- leftSection: /* @__PURE__ */ o(
204
- R,
205
- {
206
- icon: xe,
207
- size: 16,
208
- color: "var(--mantine-color-red-6)"
209
- }
210
- ),
211
- children: r("editor.actions.delete")
212
- }
213
- )
214
- ] })
215
- }
216
- )
217
- ] });
218
- }
219
- const J = (e) => {
220
- const {
221
- width: n,
222
- height: i,
223
- isLoading: r,
224
- isError: m,
225
- src: u,
226
- id: g,
227
- altText: l,
228
- imageRef: h,
229
- maxWidth: p
230
- } = e;
231
- return /* @__PURE__ */ P(
232
- "div",
233
- {
234
- className: "media-wrapper",
235
- style: {
236
- width: n,
237
- height: i,
238
- display: "inline-flex",
239
- position: "relative"
240
- },
241
- children: [
242
- /* @__PURE__ */ o(
243
- ge,
244
- {
245
- visible: r,
246
- zIndex: 1e3,
247
- overlayProps: { backgroundOpacity: 0.5 },
248
- loaderProps: { size: 24, color: "black" }
249
- }
250
- ),
251
- /* @__PURE__ */ o(
252
- je,
253
- {
254
- className: null,
255
- src: u,
256
- altText: l,
257
- imageRef: h,
258
- width: "inherit",
259
- height: "inherit",
260
- maxWidth: p || "auto",
261
- id: g
262
- }
263
- ),
264
- ze && /* @__PURE__ */ o($e, { nodeKey: e.nodeKey, src: u, id: g }),
265
- Ue && /* @__PURE__ */ o(He, { nodeKey: e.nodeKey, src: u, id: g })
266
- ]
267
- }
268
- );
269
- };
270
- function je({
271
- altText: e,
272
- className: n,
273
- imageRef: i,
274
- src: r,
275
- width: m,
276
- height: u,
277
- maxWidth: g,
278
- id: l
279
- }) {
280
- const [h, p] = w(!1);
281
- return /* @__PURE__ */ o(
282
- "img",
283
- {
284
- className: `${n || void 0} ${h ? "" : "loading"}`,
285
- src: r,
286
- alt: e,
287
- ref: i,
288
- style: {
289
- height: u,
290
- maxWidth: g,
291
- width: m
292
- },
293
- onLoad: () => {
294
- r.includes("splash") ? setTimeout(() => {
295
- p(!0);
296
- }, 100) : p(!0);
297
- },
298
- draggable: "false",
299
- "data-id": l
300
- }
301
- );
302
- }
303
- function ct(e) {
304
- const { disable: n } = Q(te);
305
- return n && De.isPlaceholderSrc(e.src) ? null : /* @__PURE__ */ o(Be, { ...e });
306
- }
307
- function Be({
308
- src: e,
309
- altText: n,
310
- nodeKey: i,
311
- width: r,
312
- height: m,
313
- maxWidth: u,
314
- showCaption: g,
315
- caption: l,
316
- id: h,
317
- create: p,
318
- alignment: x,
319
- imagePickerTab: v
320
- }) {
321
- var q, X;
322
- const I = ce(null), [O, b] = w(!0), [a] = $(), [y, k] = w(!0), [f, W] = w({
323
- width: 0,
324
- height: 0
325
- }), { start: j } = Oe(), [Ge, _] = w(0), {
326
- fetchUploadMedia: T,
327
- fetchDeleteMedia: B,
328
- maxFileSize: Ve,
329
- imperativeHandleRef: S,
330
- disable: oe
331
- } = Q(te), E = F.has(e) && (((q = F.get(e)) == null ? void 0 : q.mediaNodeKeys.length) === 0 || ((X = F.get(e)) == null ? void 0 : X.mediaNodeKeys.length) === void 0 || e.trim() === ""), { t: M } = H(), [qe, ie] = w(0);
332
- D(() => a.registerDecoratorListener(() => {
333
- ie((t) => t + 1);
334
- }), [E]), D(() => {
335
- if (!e || e.startsWith("data:image/") || !e.trim()) {
336
- b(!1);
337
- return;
338
- }
339
- const t = new Image();
340
- t.src = e, t.onload = () => b(!1), t.onerror = () => {
341
- b(!1);
342
- };
343
- }, [e, E]);
344
- const ne = (t, d) => {
345
- a.update(() => {
346
- pe(null);
347
- const s = N(i);
348
- A(s) && s.setWidthAndHeight(t, d);
349
- });
350
- }, { historyState: G } = Te(), {
351
- settings: { showNestedEditorTreeView: V }
352
- } = Se();
353
- function ae(t) {
354
- return t.endsWith(".svg") || t.includes("image/svg+xml");
355
- }
356
- function re(t) {
357
- return new Promise((d, s) => {
358
- if (ae(t)) {
359
- d(0);
360
- return;
361
- }
362
- const c = new Image();
363
- c.src = t, c.onload = () => {
364
- d(c.width);
365
- }, c.onerror = () => {
366
- s(new Error("Failed to load image"));
367
- };
368
- });
369
- }
370
- D(() => {
371
- let t = r, d = m, s = 100;
372
- (e.includes("unsplash") ? e.trim() : !E && e.trim() || e.includes("upload-src-editor")) && e !== "upload" && re(e).then((c) => {
373
- typeof t == "number" && t < s && c < s ? (k(!0), W({
374
- width: t,
375
- height: d
376
- })) : c < s ? (k(!0), W({
377
- width: "auto",
378
- height: "auto"
379
- })) : (W({
380
- width: c,
381
- height: c
382
- }), k(!1));
383
- }).catch((c) => {
384
- console.warn("Ошибка при загрузке изображения:", c.message);
385
- });
386
- }, [e, E]), D(() => {
387
- f.width && f.height && y && a.update(() => {
388
- const t = N(i);
389
- A(t) && t.setWidthAndHeight(f.width, f.height);
390
- });
391
- }, [f.width, f.height, y]);
392
- const se = C(
393
- (t) => Ee(a, i, t),
394
- [a, i]
395
- ), z = C(
396
- (t, d) => {
397
- b(!1), a.update(() => {
398
- const s = N(i);
399
- A(s) && (s.setSrc(t), s.setId(d));
400
- });
401
- },
402
- [a, i]
403
- ), U = C(
404
- (t) => {
405
- b(!0);
406
- const d = j();
407
- T && T(
408
- t[0],
409
- (s, c) => {
410
- z(s, c), _(0);
411
- },
412
- (s) => {
413
- s && Re({
414
- message: M("editor.gallery.errorFile")
415
- }), _(0), z("", "");
416
- },
417
- d,
418
- (s) => {
419
- _(s);
420
- }
421
- );
422
- },
423
- [T, j, M, z]
424
- );
425
- return D(() => a.registerCommand(
426
- Me,
427
- (t) => e !== "upload" || t.targetNodeKey !== i ? !1 : (U(t.files), !0),
428
- he
429
- ), [a, U, i, e]), !e || e === "upload" ? /* @__PURE__ */ o(ue, { "data-editor-image-picker-drop-root": !0, w: "100%", children: /* @__PURE__ */ o(
430
- Pe,
431
- {
432
- inline: !0,
433
- nodeKey: i,
434
- defaultTabValue: v,
435
- onWriteTabToNode: se,
436
- uploading: !1,
437
- onUpload: (t) => {
438
- !T || !t.length || U(t);
439
- },
440
- popoverProps: {
441
- opened: !0,
442
- position: "bottom",
443
- zIndex: ke
444
- },
445
- onChange: (t) => {
446
- a.update(() => {
447
- const d = N(i);
448
- A(d) && d.setSrc(t);
449
- });
450
- }
451
- }
452
- ) }) : y ? /* @__PURE__ */ o(
453
- J,
454
- {
455
- width: f.width,
456
- height: f.height,
457
- isLoading: O,
458
- isError: !1,
459
- isIcon: y,
460
- src: e,
461
- id: h,
462
- editor: a,
463
- nodeKey: i,
464
- fetchDeleteMedia: B,
465
- altText: n,
466
- imageRef: I,
467
- maxWidth: u,
468
- showCaption: g,
469
- caption: l,
470
- isCollabActive: !1,
471
- historyState: G,
472
- showNestedEditorTreeView: V,
473
- t: M
474
- }
475
- ) : /* @__PURE__ */ o(
476
- We,
477
- {
478
- editor: a,
479
- isIcon: y,
480
- width: Y(r),
481
- height: Y(m),
482
- initialWidth: f.width || "",
483
- initialHeight: f.height || "",
484
- onResizeEnd: ne,
485
- alignment: x,
486
- disable: oe,
487
- onRegisterDecoratorEnter: (t) => {
488
- S != null && S.current && (S.current.decoratorEnterAction = t);
489
- },
490
- onActivate: () => a.dispatchCommand(_e, "show_menu"),
491
- children: /* @__PURE__ */ o(
492
- J,
493
- {
494
- width: "inherit",
495
- height: "inherit",
496
- isLoading: O,
497
- isError: !1,
498
- isIcon: y,
499
- src: e,
500
- id: h,
501
- editor: a,
502
- nodeKey: i,
503
- fetchDeleteMedia: B,
504
- altText: n,
505
- imageRef: I,
506
- maxWidth: u,
507
- showCaption: g,
508
- caption: l,
509
- isCollabActive: !1,
510
- historyState: G,
511
- showNestedEditorTreeView: V,
512
- t: M
513
- }
514
- )
515
- }
516
- );
517
- }
518
- export {
519
- ct as default
520
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),i=require("react"),q=require("react-i18next"),z=require("@lexical/react/LexicalComposerContext"),N=require("@mantine/core"),w=require("lexical"),e=require("./layers.__VjF_qK.js"),G=require("@layers-app/shared");require("@lexical/react/LexicalDecoratorBlockNode");require("@lexical/utils");const R=require("@mantine/hooks");require("@lexical/mark");require("@lexical/code");require("@lexical/selection");require("@lexical/react/LexicalBlockWithAlignableContents");require("@mantine/notifications");const K=()=>{};function ee({nodeKey:t,src:r,id:a}){const{t:l}=q.useTranslation(),[m]=z.useLexicalComposerContext(),[h,f]=i.useState(!1),[c,p]=i.useState(!1),x=i.useCallback(()=>{p(!1),m.update(()=>{const v=w.$getNodeByKey(t);if(!e.$isImageNode(v))return;const C=v.getParent();e.$isImageOverlayWrapperNode(C)?C.remove():v.remove()})},[m,t]),j=i.useCallback(async()=>{if(r)try{await e.downloadImageFromExternalUrl(r,e.inferImageFilenameFromUrl(r))}catch{}},[r]);return n.jsxs("div",{className:"media-actions visible",style:{position:"absolute",top:10,right:10,zIndex:10,pointerEvents:"auto",display:"flex",gap:4},onClick:v=>v.stopPropagation(),children:[n.jsx(e.PreviewImage,{t:l,src:r,setShown:K,id:a}),n.jsx(e.NodeAlignmentMenu,{opened:h,setOpened:f,t:l,editor:m,nodeKey:t}),n.jsx(e.MediaActionMenu,{opened:c,onOpenChange:p,t:l,onDownload:()=>void j(),onDelete:x})]})}function te({nodeKey:t,src:r,id:a}){const{t:l}=q.useTranslation(),[m]=z.useLexicalComposerContext(),[h,{open:f,close:c}]=R.useDisclosure(!1),[p,{open:x,close:j}]=R.useDisclosure(!1),v=i.useMemo(()=>[{id:!a||a==="0"?"":a,Url:r??"",contentType:"",originalFileName:"",fileSize:0,storageType:"",storagePath:"",fileName:"",parentType:"",parentId:"",ownerId:"",createdAt:new Date,updatedAt:new Date,version:0,deleted:!1,deletedAt:new Date}],[r,a]),C=()=>{c(),x()},S=i.useCallback(async()=>{if(c(),!!r)try{await e.downloadImageFromExternalUrl(r,e.inferImageFilenameFromUrl(r))}catch{}},[r,c]),b=i.useCallback(()=>{c(),m.update(()=>{const s=w.$getNodeByKey(t);e.$isImageNode(s)&&s.remove()})},[m,t,c]);return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"image-touch-actions",style:{position:"absolute",top:8,right:8,zIndex:10,pointerEvents:"auto"},onClick:s=>s.stopPropagation(),children:n.jsx(e.ActionIcon,{label:l("editor.toolbar.more"),icon:e.O1,iconColor:"var(--mantine-color-gray-text)","aria-label":l("editor.toolbar.more"),onClick:f})}),n.jsx(G.AttachmentsGalleryModal,{opened:p,onOpenChange:s=>s?x():j(),attachments:v}),n.jsx(e.MobileDrawer,{opened:h,onClose:c,title:l("editor.image.mobileActions"),children:n.jsxs(N.Stack,{gap:4,p:0,children:[n.jsx(N.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"light-dark(var(--mantine-color-gray-0), var(--mantine-color-gray-outline-hover))",onClick:C,leftSection:n.jsx(e.HugeiconsIcon,{icon:e.gn,size:16,color:"var(--mantine-color-dimmed)"}),children:l("editor.image.previewFullScreen")}),n.jsx(N.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"light-dark(var(--mantine-color-gray-0), var(--mantine-color-gray-outline-hover))",onClick:()=>void S(),leftSection:n.jsx(e.HugeiconsIcon,{icon:e.Tm,size:16,color:"var(--mantine-color-dimmed)"}),children:l("editor.gallery.download")}),n.jsx(N.Button,{type:"button",variant:"subtle",color:"red",fullWidth:!0,justify:"flex-start",bg:"light-dark(var(--mantine-color-gray-0), var(--mantine-color-gray-outline-hover))",onClick:b,leftSection:n.jsx(e.HugeiconsIcon,{icon:e.lg,size:16,color:"var(--mantine-color-red-6)"}),children:l("editor.actions.delete")})]})})]})}const H=t=>{const{width:r,height:a,isLoading:l,isError:m,src:h,id:f,altText:c,imageRef:p,maxWidth:x}=t;return n.jsxs("div",{className:"media-wrapper",style:{width:r,height:a,display:"inline-flex",position:"relative"},children:[n.jsx(N.LoadingOverlay,{visible:l,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),n.jsx(oe,{className:null,src:h,altText:c,imageRef:p,width:"inherit",height:"inherit",maxWidth:x||"auto",id:f}),e.IS_TOUCH_DEVICE&&n.jsx(te,{nodeKey:t.nodeKey,src:h,id:f}),e.IS_TOUCH_TABLET&&n.jsx(ee,{nodeKey:t.nodeKey,src:h,id:f})]})};function oe({altText:t,className:r,imageRef:a,src:l,width:m,height:h,maxWidth:f,id:c}){const[p,x]=i.useState(!1);return n.jsx("img",{className:`${r||void 0} ${p?"":"loading"}`,src:l,alt:t,ref:a,style:{height:h,maxWidth:f,width:m},onLoad:()=>{l.includes("splash")?setTimeout(()=>{x(!0)},100):x(!0)},draggable:"false","data-id":c})}function ne(t){const{disable:r}=i.useContext(e.Context);return r&&e.ImageNode.isPlaceholderSrc(t.src)?null:n.jsx(ie,{...t})}function ie({src:t,altText:r,nodeKey:a,width:l,height:m,maxWidth:h,showCaption:f,caption:c,id:p,create:x,alignment:j,imagePickerTab:v}){var F,B;const C=i.useRef(null),[S,b]=i.useState(!0),[s]=z.useLexicalComposerContext(),[y,k]=i.useState(!0),[I,O]=i.useState({width:0,height:0}),{start:W}=e.useCancelUpload(),[ae,M]=i.useState(0),{fetchUploadMedia:A,fetchDeleteMedia:_,maxFileSize:re,imperativeHandleRef:D,disable:V}=i.useContext(e.Context),E=e.mediaMap.has(t)&&(((F=e.mediaMap.get(t))==null?void 0:F.mediaNodeKeys.length)===0||((B=e.mediaMap.get(t))==null?void 0:B.mediaNodeKeys.length)===void 0||t.trim()===""),{t:T}=q.useTranslation(),[se,X]=i.useState(0);i.useEffect(()=>s.registerDecoratorListener(()=>{X(o=>o+1)}),[E]),i.useEffect(()=>{if(!t||t.startsWith("data:image/")||!t.trim()){b(!1);return}const o=new Image;o.src=t,o.onload=()=>b(!1),o.onerror=()=>{b(!1)}},[t,E]);const Y=(o,u)=>{s.update(()=>{w.$setSelection(null);const d=w.$getNodeByKey(a);e.$isImageNode(d)&&d.setWidthAndHeight(o,u)})},{historyState:L}=e.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:U}}=e.useSettings();function Z(o){return o.endsWith(".svg")||o.includes("image/svg+xml")}function J(o){return new Promise((u,d)=>{if(Z(o)){u(0);return}const g=new Image;g.src=o,g.onload=()=>{u(g.width)},g.onerror=()=>{d(new Error("Failed to load image"))}})}i.useEffect(()=>{let o=l,u=m,d=100;(t.includes("unsplash")?t.trim():!E&&t.trim()||t.includes("upload-src-editor"))&&t!=="upload"&&J(t).then(g=>{typeof o=="number"&&o<d&&g<d?(k(!0),O({width:o,height:u})):g<d?(k(!0),O({width:"auto",height:"auto"})):(O({width:g,height:g}),k(!1))}).catch(g=>{console.warn("Ошибка при загрузке изображения:",g.message)})},[t,E]),i.useEffect(()=>{I.width&&I.height&&y&&s.update(()=>{const o=w.$getNodeByKey(a);e.$isImageNode(o)&&o.setWidthAndHeight(I.width,I.height)})},[I.width,I.height,y]);const Q=i.useCallback(o=>e.$writeImagePickerTabToNode(s,a,o),[s,a]),P=i.useCallback((o,u)=>{b(!1),s.update(()=>{const d=w.$getNodeByKey(a);e.$isImageNode(d)&&(d.setSrc(o),d.setId(u))})},[s,a]),$=i.useCallback(o=>{b(!0);const u=W();A&&A(o[0],(d,g)=>{P(d,g),M(0)},d=>{d&&G.showErrorNotification({message:T("editor.gallery.errorFile")}),M(0),P("","")},u,d=>{M(d)})},[A,W,T,P]);return i.useEffect(()=>s.registerCommand(e.UPLOAD_IMAGE_COMMAND,o=>t!=="upload"||o.targetNodeKey!==a?!1:($(o.files),!0),w.COMMAND_PRIORITY_LOW),[s,$,a,t]),!t||t==="upload"?n.jsx(N.Box,{"data-editor-image-picker-drop-root":!0,w:"100%",children:n.jsx(e.ImagePicker,{inline:!0,nodeKey:a,defaultTabValue:v,onWriteTabToNode:Q,uploading:!1,onUpload:o=>{!A||!o.length||$(o)},popoverProps:{opened:!0,position:"bottom",zIndex:e.EDITOR_UI_MIN_Z_INDEX},onChange:o=>{s.update(()=>{const u=w.$getNodeByKey(a);e.$isImageNode(u)&&u.setSrc(o)})}})}):y?n.jsx(H,{width:I.width,height:I.height,isLoading:S,isError:!1,isIcon:y,src:t,id:p,editor:s,nodeKey:a,fetchDeleteMedia:_,altText:r,imageRef:C,maxWidth:h,showCaption:f,caption:c,isCollabActive:!1,historyState:L,showNestedEditorTreeView:U,t:T}):n.jsx(e.ResizableContainer,{editor:s,isIcon:y,width:e.parseContainerSize(l),height:e.parseContainerSize(m),initialWidth:I.width||"",initialHeight:I.height||"",onResizeEnd:Y,alignment:j,disable:V,onRegisterDecoratorEnter:o=>{D!=null&&D.current&&(D.current.decoratorEnterAction=o)},onActivate:()=>s.dispatchCommand(e.ON_CHANGE_COMMAND,"show_menu"),children:n.jsx(H,{width:"inherit",height:"inherit",isLoading:S,isError:!1,isIcon:y,src:t,id:p,editor:s,nodeKey:a,fetchDeleteMedia:_,altText:r,imageRef:C,maxWidth:h,showCaption:f,caption:c,isCollabActive:!1,historyState:L,showNestedEditorTreeView:U,t:T})})}exports.default=ne;
@@ -1,8 +0,0 @@
1
- import { C as e, Q as t, N as m, A as r } from "./layers.BbFbumMx.js";
2
- import "./layers.yCLo3Wbl.js";
3
- export {
4
- e as Commands,
5
- t as subsetToBase64,
6
- m as subsetToBinary,
7
- r as toBase64
8
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),r=require("react"),J=require("@lexical/react/LexicalComposerContext"),K=require("@lexical/react/useLexicalEditable"),P=require("@lexical/react/useLexicalNodeSelection"),Q=require("@lexical/utils"),p=require("lexical"),t=require("./layers.__VjF_qK.js"),G=require("react-i18next"),w=require("@mantine/core"),Z=require("@mantine/hooks");require("@lexical/mark");require("@lexical/code");const ee=require("@layers-app/shared"),te=({isCloseModal:i,setCloseModalOpen:a,confirmClose:b})=>{const{t:v}=G.useTranslation();return o.jsx(w.Modal,{opened:i,onClose:()=>{a(!1)},centered:!0,title:v("editor.unsavedChanges.title"),closeOnClickOutside:!0,closeOnEscape:!0,size:"500",zIndex:999,children:o.jsxs("div",{children:[o.jsx(w.Text,{mb:"md",children:v("editor.unsavedChanges.message")}),o.jsxs(w.Flex,{justify:"flex-end",gap:"sm",children:[o.jsx(w.Button,{variant:"default",onClick:()=>{a(!1)},fullWidth:!0,children:v("editor.unsavedChanges.cancel")}),o.jsx(w.Button,{color:"red",onClick:b,fullWidth:!0,children:v("editor.unsavedChanges.closeWithoutSaving")})]})]})})};function oe({imageContainerRef:i,editor:a,rootClassName:b=null,width:v="inherit",height:g="inherit",nodeKey:u,alignment:W,setModalOpen:R,previewSVG:l,isModalOpen:x}){const{disable:h,imperativeHandleRef:k}=r.useContext(t.Context),F=r.useMemo(()=>l??"",[l]),[O,C]=r.useState(!1),[z,{open:T,close:S}]=Z.useDisclosure(!1),{t:y}=G.useTranslation();r.useEffect(()=>{x&&C(!1)},[x]);const N=(e,E)=>{a.update(()=>{p.$setSelection(null);const c=p.$getNodeByKey(u);return t.$isExcalidrawNode(c)&&c.setWidthAndHeight(e,E),!0})},j=()=>{t.deleteNode(a,u)},I=()=>{S(),R(!0)},_=()=>{S(),t.deleteNode(a,u)};return o.jsxs(t.ResizableContainer,{editor:a,isIcon:!1,isEmbed:!0,width:t.parseContainerSize(v),height:t.parseContainerSize(g),onResizeEnd:N,alignment:W,disable:h,onRegisterDecoratorEnter:e=>{k!=null&&k.current&&(k.current.decoratorEnterAction=e)},onActivate:()=>a.dispatchCommand(t.ON_CHANGE_COMMAND,"show_menu"),children:[o.jsxs(w.Box,{className:"media-wrapper excaildraw",children:[o.jsx("div",{className:`media-actions${t.IS_TOUCH_DEVICE||!t.IS_HOVER_CAPABLE?" visible":""}`,children:t.IS_TOUCH_DEVICE?o.jsx(t.ActionIcon,{"aria-label":y("editor.toolbar.more"),label:y("editor.toolbar.more"),flexBorder:!0,onClick:T,icon:t.K1,iconColor:"var(--mantine-color-gray-text)"}):o.jsxs(o.Fragment,{children:[o.jsx(t.ActionIcon,{"aria-label":"Settings",label:y("editor.link.edit"),flexBorder:!0,onClick:()=>{R(!0)},icon:t.tf,iconColor:"var(--mantine-color-gray-text)"}),o.jsx(t.NodeAlignmentMenu,{opened:O,setOpened:C,t:y,editor:a,nodeKey:u,flexBorder:!0}),o.jsx(t.ActionIcon,{"aria-label":"Delete",label:y("editor.actions.delete"),flexBorder:!0,onClick:j,icon:t.lg,iconColor:"var(--mantine-color-red-outline)"})]})}),o.jsx(w.Box,{w:"100%",ref:e=>{e&&i&&(i.current=e)},className:b??"",dangerouslySetInnerHTML:{__html:F}})]}),t.IS_TOUCH_DEVICE&&o.jsx(t.MobileDrawer,{opened:z,onClose:S,title:y("editor.image.mobileActions"),children:o.jsxs(w.Stack,{gap:4,p:0,children:[o.jsx(w.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"light-dark(var(--mantine-color-gray-0), var(--mantine-color-gray-outline-hover))",onClick:I,leftSection:o.jsx(t.HugeiconsIcon,{icon:t.tf,size:16,color:"var(--mantine-color-dimmed)"}),children:y("editor.link.edit")}),o.jsx(w.Button,{type:"button",variant:"subtle",color:"red",fullWidth:!0,justify:"flex-start",bg:"light-dark(var(--mantine-color-gray-0), var(--mantine-color-gray-outline-hover))",onClick:_,leftSection:o.jsx(t.HugeiconsIcon,{icon:t.lg,size:16,color:"var(--mantine-color-red-6)"}),children:y("editor.actions.delete")})]})})]})}let $=null;const ne=r.lazy(async()=>{var a;const i=await Promise.resolve().then(()=>require("./layers.D1yQKEca.js")).then(b=>b.index);return!$&&i&&($=i.exportToSvg||((a=i.default)==null?void 0:a.exportToSvg)||i.default),{default:i.Excalidraw}}),re=()=>{const[i,a]=r.useState(null),b=r.useCallback(v=>a(v),[]);return[i,b]};function se({onSave:i,initialElements:a,initialAppState:b,initialFiles:v,isShown:g=!1,onDelete:u,onClose:W,isEdited:R}){const[l,x]=re(),{i18n:h,t:k}=G.useTranslation(),{colorScheme:F}=w.useMantineColorScheme(),O=r.useRef(!1),[C,z]=r.useState(a),[T,S]=r.useState(v),[y,N]=r.useState(g);r.useEffect(()=>{g&&N(!0)},[g]),r.useEffect(()=>{!g||O.current||(O.current=!0,Promise.resolve().then(()=>require("./layers.Dyvby5gX.js")))},[g]),r.useEffect(()=>{g&&setTimeout(()=>{var e,E;(e=l==null?void 0:l.refresh)==null||e.call(l),(E=l==null?void 0:l.scrollToContent)==null||E.call(l)},500)},[g,l]),r.useEffect(()=>{if(!g)return;const e=(s,d)=>{const n=k(s);return n.startsWith("editor.menu")?d:n},E=e("editor.menu.excalidraw.tools.frameTool",h.language==="ru"?"Инструмент рамки":h.language==="es"?"Herramienta de marco":"Frame tool"),c=e("editor.menu.excalidraw.tools.webEmbed",h.language==="ru"?"Веб-встраивание":h.language==="es"?"Incrustación web":"Web Embed"),f=e("editor.menu.excalidraw.tools.generate",h.language==="ru"?"Генерировать":h.language==="es"?"Generar":"Generate"),L={"Frame tool":E,"Web Embed":c,"Web embeded":c,Generate:f},q=()=>{const s=document.querySelector(".App-toolbar__extra-tools-dropdown");if(!s)return;const d=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,null);let n;for(;n=d.nextNode();)if(n.nodeType===Node.TEXT_NODE&&n.textContent){const m=n.textContent.trim();for(const[D,A]of Object.entries(L))if(m===D&&A&&!m.includes(A)){n.textContent=n.textContent.replace(D,A);break}}},B=()=>{setTimeout(()=>{q()},0)},M=setTimeout(()=>{const s=document.querySelector(".excalidraw-container");if(s){const d=s.querySelector(".App-toolbar__extra-tools-trigger");d&&d.addEventListener("click",B)}},300);return()=>{clearTimeout(M);const s=document.querySelector(".excalidraw-container");if(s){const d=s.querySelector(".App-toolbar__extra-tools-trigger");d&&d.removeEventListener("click",B)}}},[g,h.language,k]);const j=r.useCallback(async()=>{var q,B,M;let e=$;if(!e||typeof e!="function"){const s=await Promise.resolve().then(()=>require("./layers.D1yQKEca.js")).then(d=>d.index);e=s.exportToSvg||((q=s.default)==null?void 0:q.exportToSvg)||s.default,e&&typeof e=="function"&&($=e)}if(!e||typeof e!="function"){const s=await Promise.resolve().then(()=>require("./layers.D1yQKEca.js")).then(n=>n.index),d=s?Object.keys(s):[];throw console.error("Excalidraw module structure:",{keys:d,hasExportToSvg:s&&"exportToSvg"in s,hasDefault:s&&"default"in s,moduleType:typeof s,module:s}),new Error(`exportToSvg is not available from @excalidraw/excalidraw. Module keys: ${d.join(", ")}. Please ensure @excalidraw/excalidraw is properly installed.`)}const E=((B=l==null?void 0:l.getAppState)==null?void 0:B.call(l))??b,c=await e({appState:E,elements:C,files:T}),f=(M=c==null?void 0:c.firstElementChild)==null?void 0:M.firstElementChild,L=c.getAttribute("viewBox");if(L!=null){const s=L.split(" ");c.setAttribute("width",s[2]),c.setAttribute("height",s[3])}return f&&f.tagName==="style"&&f.remove(),c.setAttribute("width","100%"),c.setAttribute("height","100%"),c.setAttribute("display","block"),c.classList.add("excalidraw-svg"),c.outerHTML},[C,T,l,b]),I=()=>{if(C&&C.filter(e=>!e.isDeleted).length>0){const e=l==null?void 0:l.getAppState(),E={exportBackground:e==null?void 0:e.exportBackground,exportScale:e==null?void 0:e.exportScale,exportWithDarkMode:(e==null?void 0:e.theme)==="dark",isBindingEnabled:e==null?void 0:e.isBindingEnabled,isLoading:e==null?void 0:e.isLoading,name:e==null?void 0:e.name,theme:e==null?void 0:e.theme,viewBackgroundColor:e==null?void 0:e.viewBackgroundColor,viewModeEnabled:e==null?void 0:e.viewModeEnabled,zenModeEnabled:e==null?void 0:e.zenModeEnabled,zoom:e==null?void 0:e.zoom};(async()=>{const c=await j();i(C,E,T,c)})()}else u()},_=(e,E,c)=>{(e==null?void 0:e.length)!==(a==null?void 0:a.length)&&(R.current=!0),z(e),S(c)};return o.jsx(ee.BottomDrawerWithoutHeader,{opened:g,onClose:W,onSave:I,className:"excaildraw-modal",closeOnEscape:!1,children:y&&o.jsx(r.Suspense,{fallback:o.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",minHeight:"400px"},children:o.jsx(w.Loader,{size:"sm"})}),children:o.jsx(ne,{langCode:t.languageToLocaleMap[h.language],theme:F,onChange:_,excalidrawAPI:x,initialData:{appState:{...b||{isLoading:!1}},elements:a,files:v,scrollToContent:!0}})})})}function le({nodeKey:i,data:a,width:b,height:v,alignment:g}){var d;const[u]=J.useLexicalComposerContext(),{fetchUploadMedia:W,fetchDeleteMedia:R}=r.useContext(t.Context),l=K.useLexicalEditable(),x=r.useMemo(()=>t.parseExcalidrawData(a),[a]),h=r.useRef(t.extractAttachmentIdsFromFiles(x.files??{})),k=r.useRef(Object.keys(x.files??{}));r.useEffect(()=>{const n=t.extractAttachmentIdsFromFiles(x.files??{});for(const m of Object.keys(n))h.current[m]=n[m]},[x.files]);const F=((d=x==null?void 0:x.elements)==null?void 0:d.length)===0&&!x.previewSVG,[O,C]=r.useState(F&&u.isEditable()),[z,T]=r.useState(!1),S=r.useRef(null),y=r.useRef(null),N=r.useRef(null),[j,I,_]=P.useLexicalNodeSelection(i),e=r.useCallback(n=>(j&&(n.preventDefault(),u.update(()=>{const m=p.$getNodeByKey(i);m&&m.remove()})),!1),[u,j,i]);r.useEffect(()=>{if(!l){j&&_();return}return Q.mergeRegister(u.registerCommand(p.CLICK_COMMAND,n=>{const m=y.current,D=n.target;return m!==null&&m.contains(D)?(n.shiftKey||_(),I(!j),n.detail>1&&C(!0),!0):!1},p.COMMAND_PRIORITY_LOW),u.registerCommand(p.KEY_DELETE_COMMAND,e,p.COMMAND_PRIORITY_LOW),u.registerCommand(p.KEY_BACKSPACE_COMMAND,e,p.COMMAND_PRIORITY_LOW))},[_,u,j,e,I,l]);const E=r.useCallback(()=>(C(!1),u.update(()=>{const n=p.$getNodeByKey(i);n&&n.remove()})),[u,i]),c=async(n,m,D,A)=>{const{files:H,urlByDataUrl:U,attachmentIdByFileId:Y}=await t.uploadInlineFiles(D,W,h.current);h.current=t.deleteRemovedAttachments(k.current,H,Y,R),k.current=Object.keys(H);const X=t.rewriteSvgDataUrls(A,U);u.update(()=>{const V=p.$getNodeByKey(i);t.$isExcalidrawNode(V)&&(n&&n.length>0||Object.keys(H).length>0?V.setData(JSON.stringify({appState:m,elements:n,files:H,previewSVG:X})):V.remove())})},{elements:f=[],files:L={},appState:q={},previewSVG:B}=x,M=r.useCallback(()=>{C(!1),T(!1),N.current=!1,(f==null?void 0:f.length)===0&&u.update(()=>{const n=p.$getNodeByKey(i);n&&n.remove()})},[u,i,f==null?void 0:f.length]),s=r.useCallback(()=>{N.current?T(!0):M()},[M]);return o.jsxs(o.Fragment,{children:[o.jsx(te,{isCloseModal:z,confirmClose:M,setCloseModalOpen:T}),o.jsx(se,{initialElements:f,isEdited:N,initialFiles:L,initialAppState:q,isShown:O,onDelete:E,onClose:s,onSave:async(n,m,D,A)=>{await c(n,m,D,A),C(!1)},closeOnClickOutside:!1}),(f==null?void 0:f.length)&&o.jsx("div",{style:{display:"flex",justifyContent:g},children:o.jsx(oe,{imageContainerRef:S,className:"image",width:b,height:v,editor:u,nodeKey:i,alignment:g,setModalOpen:C,previewSVG:B,isModalOpen:O})})]})}exports.default=le;
@@ -1 +0,0 @@
1
- "use strict";const n=require("./layers.D5yxCQUQ.js"),s=(e,r)=>n.Utils.lang.round(n.Color.parse(e)[r]);exports.channel=s;
@@ -1,6 +0,0 @@
1
- import { e as o, j as s, o as f } from "./layers.yCLo3Wbl.js";
2
- export {
3
- o as default,
4
- s as en,
5
- f as kaa
6
- };