@layers-app/editor 0.7.17 → 0.7.18

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 (244) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.js +3 -3
  3. package/dist/layers.94hwidA2.js +198 -0
  4. package/dist/layers.B4l6ta1Q.js +1 -0
  5. package/dist/{layers.DfazY_Pm.js → layers.BMrOAD_P.js} +1 -1
  6. package/dist/{layers.C35KTUy2.js → layers.D99OBX9u.js} +8 -8
  7. package/dist/{layers.B3S_Iz7U.js → layers.DOzLBYZr.js} +31 -31
  8. package/dist/layers.YRyXopy_.js +151 -0
  9. package/dist/{layers.BlQ-fVEN.js → layers.usKC_Id5.js} +1 -1
  10. package/dist/{layers.CNTFg_PV.js → layers.zu-IYGYU.js} +12483 -13053
  11. package/package.json +24 -23
  12. package/dist/layers.04n4wbqY.js +0 -40
  13. package/dist/layers.0AjqeHO0.js +0 -52
  14. package/dist/layers.0YKivPbS.js +0 -40
  15. package/dist/layers.0ay1od4k.js +0 -41
  16. package/dist/layers.0cCD7Trw.js +0 -10
  17. package/dist/layers.192DYlty.js +0 -8
  18. package/dist/layers.1ws9_bfy.js +0 -1
  19. package/dist/layers.3NAUDSdp.js +0 -1
  20. package/dist/layers.41VWy-aG.js +0 -33
  21. package/dist/layers.52famHy6.js +0 -1
  22. package/dist/layers.5QVC7kU0.js +0 -1
  23. package/dist/layers.6IpHt_7d.js +0 -32
  24. package/dist/layers.7JqFgE4-.js +0 -15
  25. package/dist/layers.8CQh8R7p.js +0 -1
  26. package/dist/layers.9iKrwzo8.js +0 -32
  27. package/dist/layers.9p0T4nVw.js +0 -1
  28. package/dist/layers.9pNaFvaX.js +0 -1
  29. package/dist/layers.B19hGmey.js +0 -1
  30. package/dist/layers.B1auaUb-.js +0 -40
  31. package/dist/layers.B37cfkOz.js +0 -32
  32. package/dist/layers.B3D4g2HH.js +0 -1
  33. package/dist/layers.B5XF9q_I.js +0 -40
  34. package/dist/layers.B6hh7kZl.js +0 -6
  35. package/dist/layers.B7K7JjK6.js +0 -1510
  36. package/dist/layers.B7rTjLeq.js +0 -208
  37. package/dist/layers.B8_yUZ0B.js +0 -207
  38. package/dist/layers.B9JA0HLK.js +0 -2966
  39. package/dist/layers.BABmXbhN.js +0 -1088
  40. package/dist/layers.BAtv1CM7.js +0 -1
  41. package/dist/layers.BCWekfj1.js +0 -38
  42. package/dist/layers.BDhkw0hD.js +0 -2479
  43. package/dist/layers.BEm0EevB.js +0 -295
  44. package/dist/layers.BFOGMUuA.js +0 -8
  45. package/dist/layers.BFc__DH6.js +0 -6
  46. package/dist/layers.BGTnvNP0.js +0 -10
  47. package/dist/layers.BGdwpbmj.js +0 -32
  48. package/dist/layers.BGrn4rLd.js +0 -1
  49. package/dist/layers.BHgpnpIV.js +0 -320
  50. package/dist/layers.BIeVwYKL.js +0 -1
  51. package/dist/layers.BIwMjJXk.js +0 -1
  52. package/dist/layers.BJ0kBYXi.js +0 -41
  53. package/dist/layers.BJDrjORS.js +0 -244
  54. package/dist/layers.BK0gUtws.js +0 -9
  55. package/dist/layers.BLd2spTm.js +0 -1
  56. package/dist/layers.BMyOFpSB.js +0 -9
  57. package/dist/layers.BO1-27wB.js +0 -1
  58. package/dist/layers.BO54hyIV.js +0 -10
  59. package/dist/layers.BOUezSTL.js +0 -41
  60. package/dist/layers.BP0j0dgn.js +0 -7
  61. package/dist/layers.BPc2aeAC.js +0 -6
  62. package/dist/layers.BRrrKVX0.js +0 -51
  63. package/dist/layers.BRw0W8BA.js +0 -14
  64. package/dist/layers.BSTBZrFn.js +0 -1
  65. package/dist/layers.BSUQkbOc.js +0 -42
  66. package/dist/layers.BUA_HqY5.js +0 -13
  67. package/dist/layers.BVcL_n_M.js +0 -268
  68. package/dist/layers.BWePEr40.js +0 -1126
  69. package/dist/layers.BXcsZWke.js +0 -1
  70. package/dist/layers.BZfVYPU5.js +0 -1
  71. package/dist/layers.BbCfEXyj.js +0 -55
  72. package/dist/layers.BbJS6RnG.js +0 -35
  73. package/dist/layers.BbVq4Peg.js +0 -39
  74. package/dist/layers.BbXyLjxZ.js +0 -42
  75. package/dist/layers.Be1uXPSh.js +0 -9
  76. package/dist/layers.BeACRp58.js +0 -4
  77. package/dist/layers.Ben_68X-.js +0 -33
  78. package/dist/layers.BfaQveOZ.js +0 -198
  79. package/dist/layers.BgJtKoXK.js +0 -160
  80. package/dist/layers.BifTQ-Px.js +0 -32
  81. package/dist/layers.BjN6TTXp.js +0 -11
  82. package/dist/layers.BjkK2efb.js +0 -7
  83. package/dist/layers.BlHp_VrY.js +0 -3
  84. package/dist/layers.Blc7rw4s.js +0 -6
  85. package/dist/layers.Bnsmp92P.js +0 -11
  86. package/dist/layers.BpilXLfW.js +0 -6
  87. package/dist/layers.BqqCs8jG.js +0 -96
  88. package/dist/layers.BsmgPu7t.js +0 -42
  89. package/dist/layers.Bt7tcN4s.js +0 -6
  90. package/dist/layers.Btzp1z-r.js +0 -36
  91. package/dist/layers.BwTFFS1L.js +0 -8
  92. package/dist/layers.Bx3h2n9l.js +0 -39
  93. package/dist/layers.BxM1KZfC.js +0 -61
  94. package/dist/layers.BxM9-XMl.js +0 -9
  95. package/dist/layers.C0J8aakp.js +0 -5
  96. package/dist/layers.C0rSyLVd.js +0 -9
  97. package/dist/layers.C2Ghtbvc.js +0 -8
  98. package/dist/layers.C2jhvzOq.js +0 -21620
  99. package/dist/layers.C39A_3mH.js +0 -8
  100. package/dist/layers.C5BRzalR.js +0 -38
  101. package/dist/layers.C5Fx7NyW.js +0 -39
  102. package/dist/layers.C5hEmFnZ.js +0 -40
  103. package/dist/layers.C6s-F8xr.js +0 -7
  104. package/dist/layers.C7FVdo84.js +0 -37
  105. package/dist/layers.C7dJDI3p.js +0 -10
  106. package/dist/layers.C89PpG1h.js +0 -769
  107. package/dist/layers.C8_lu5UH.js +0 -23
  108. package/dist/layers.CAn91HUr.js +0 -7
  109. package/dist/layers.CDyM6rfz.js +0 -1619
  110. package/dist/layers.CG5E1s6L.js +0 -5
  111. package/dist/layers.CH6vY6nz.js +0 -793
  112. package/dist/layers.CHZsXQcr.js +0 -1
  113. package/dist/layers.CI8n-mXC.js +0 -8
  114. package/dist/layers.CIIPaPYQ.js +0 -37
  115. package/dist/layers.CJjfGFRn.js +0 -7
  116. package/dist/layers.CLyrFyTt.js +0 -7
  117. package/dist/layers.COxTigDs.js +0 -1359
  118. package/dist/layers.CPPTxpTa.js +0 -198
  119. package/dist/layers.CQw2c-FF.js +0 -1
  120. package/dist/layers.CS_v9If4.js +0 -118
  121. package/dist/layers.CTEInOdX.js +0 -41
  122. package/dist/layers.CTzj-R3i.js +0 -41
  123. package/dist/layers.CULMlCQg.js +0 -1580
  124. package/dist/layers.CWVWuX-h.js +0 -802
  125. package/dist/layers.CWetNlAM.js +0 -186
  126. package/dist/layers.CZLAcdMj.js +0 -960
  127. package/dist/layers.CZcNOn_g.js +0 -5
  128. package/dist/layers.C_IvrzZ3.js +0 -7
  129. package/dist/layers.C_gG9xio.js +0 -36
  130. package/dist/layers.CagLZWJV.js +0 -36
  131. package/dist/layers.CcQRJhOy.js +0 -10
  132. package/dist/layers.CdI08cP2.js +0 -37
  133. package/dist/layers.CfGn3EEn.js +0 -11
  134. package/dist/layers.CfTomFD-.js +0 -74
  135. package/dist/layers.Ci-h8bbt.js +0 -36
  136. package/dist/layers.CiOE4x64.js +0 -42
  137. package/dist/layers.CjDmXlbI.js +0 -32
  138. package/dist/layers.CkvEBALf.js +0 -1
  139. package/dist/layers.ClbtOgXD.js +0 -1
  140. package/dist/layers.CmMJ2vrz.js +0 -40
  141. package/dist/layers.CoHrmJZb.js +0 -1
  142. package/dist/layers.CqOjrhqg.js +0 -34
  143. package/dist/layers.CqVTtuYm.js +0 -6
  144. package/dist/layers.Cq_SVM9v.js +0 -2
  145. package/dist/layers.CtBDhkfE.js +0 -2
  146. package/dist/layers.Cvcaleoh.js +0 -425
  147. package/dist/layers.Cx1Gq9Dp.js +0 -10
  148. package/dist/layers.CxhBPjuM.js +0 -257
  149. package/dist/layers.CxzexeO2.js +0 -41
  150. package/dist/layers.Cyiby-Np.js +0 -4
  151. package/dist/layers.Cyzu9PKQ.js +0 -1
  152. package/dist/layers.CzPTBQLq.js +0 -7
  153. package/dist/layers.D-Jn2ZYp.js +0 -202
  154. package/dist/layers.D0zn4_Mx.js +0 -1
  155. package/dist/layers.D3f2mUJi.js +0 -904
  156. package/dist/layers.D3lMBPw_.js +0 -44
  157. package/dist/layers.D4HzIdc6.js +0 -116
  158. package/dist/layers.D4T8fTcj.js +0 -1223
  159. package/dist/layers.D66jwaU4.js +0 -39
  160. package/dist/layers.D7ZMXlyX.js +0 -423
  161. package/dist/layers.D7jGxypv.js +0 -8
  162. package/dist/layers.D8q3-pj1.js +0 -40
  163. package/dist/layers.D9YR6XE8.js +0 -437
  164. package/dist/layers.D9jdGpJr.js +0 -8
  165. package/dist/layers.DAl7I5u0.js +0 -39
  166. package/dist/layers.DGi30IzW.js +0 -6
  167. package/dist/layers.DJF9fzWp.js +0 -9
  168. package/dist/layers.DLwuMfdd.js +0 -84
  169. package/dist/layers.DMkBISW1.js +0 -1
  170. package/dist/layers.DN7zqtdR.js +0 -803
  171. package/dist/layers.DN9HoVxI.js +0 -18
  172. package/dist/layers.DODiJHd5.js +0 -8
  173. package/dist/layers.DOrgOHBr.js +0 -1
  174. package/dist/layers.DPgcx12Q.js +0 -1
  175. package/dist/layers.DPiZNyNm.js +0 -9166
  176. package/dist/layers.DQhlH0a7.js +0 -501
  177. package/dist/layers.DTik-pik.js +0 -11
  178. package/dist/layers.DVrOalPV.js +0 -7
  179. package/dist/layers.DWaBBiuP.js +0 -19
  180. package/dist/layers.DZkaq_lv.js +0 -1265
  181. package/dist/layers.DacVDKlC.js +0 -9
  182. package/dist/layers.DbaKVP5e.js +0 -1
  183. package/dist/layers.DgCULOvY.js +0 -40
  184. package/dist/layers.DgjixQuR.js +0 -84
  185. package/dist/layers.DhtGL7-o.js +0 -39
  186. package/dist/layers.DjUOC4st.js +0 -16
  187. package/dist/layers.DjYl24mJ.js +0 -40
  188. package/dist/layers.DkUY5uNV.js +0 -1
  189. package/dist/layers.DouGTsMz.js +0 -9
  190. package/dist/layers.Dq2XAyOc.js +0 -139
  191. package/dist/layers.DqL7bG3g.js +0 -41
  192. package/dist/layers.DrYzFfW_.js +0 -139
  193. package/dist/layers.DrdslLaU.js +0 -10
  194. package/dist/layers.Ds9-wuCp.js +0 -10
  195. package/dist/layers.DsLySzfR.js +0 -8
  196. package/dist/layers.DsXVRfSf.js +0 -41
  197. package/dist/layers.DtYnjrXZ.js +0 -8
  198. package/dist/layers.Dtg6Vr-6.js +0 -39
  199. package/dist/layers.DuwOgI-l.js +0 -40
  200. package/dist/layers.DwXNFr-I.js +0 -35
  201. package/dist/layers.DxA6ocdw.js +0 -70
  202. package/dist/layers.Dy1naDTQ.js +0 -14
  203. package/dist/layers.Ev3O6tfW.js +0 -1
  204. package/dist/layers.GRwBofUp.js +0 -37
  205. package/dist/layers.HAyebP5S.js +0 -791
  206. package/dist/layers.J8v8A5JD.js +0 -35
  207. package/dist/layers.JWCLFILJ.js +0 -1
  208. package/dist/layers.MerAdE1w.js +0 -39
  209. package/dist/layers.OE83Ve6T.js +0 -5
  210. package/dist/layers.P6mLQhtB.js +0 -42
  211. package/dist/layers.PV80K4Xy.js +0 -11
  212. package/dist/layers.QNYkTpWx.js +0 -39
  213. package/dist/layers.R8mPlCA0.js +0 -261
  214. package/dist/layers.RTKoEILv.js +0 -9
  215. package/dist/layers.SLjiLvui.js +0 -4
  216. package/dist/layers.VJ5q1w0_.js +0 -21938
  217. package/dist/layers.XOfuSupS.js +0 -373
  218. package/dist/layers.YNcfYAuY.js +0 -9
  219. package/dist/layers.YO08nJMd.js +0 -10
  220. package/dist/layers.YqzV3yPW.js +0 -220
  221. package/dist/layers.Z4R1XaSC.js +0 -1
  222. package/dist/layers.ZZQfmNLr.js +0 -10
  223. package/dist/layers.b0h5ZBmD.js +0 -61
  224. package/dist/layers.b9B2NY7n.js +0 -11690
  225. package/dist/layers.bHmhGLR5.js +0 -931
  226. package/dist/layers.cgUeweX2.js +0 -84
  227. package/dist/layers.dYPOB_yR.js +0 -5
  228. package/dist/layers.easeN7iP.js +0 -1
  229. package/dist/layers.f7Ihj79-.js +0 -1034
  230. package/dist/layers.hLd2Pb2X.js +0 -1
  231. package/dist/layers.i0Y9asvx.js +0 -2235
  232. package/dist/layers.ib9vHAA4.js +0 -2
  233. package/dist/layers.k6E3SRkR.js +0 -70
  234. package/dist/layers.lCpg7dOn.js +0 -21
  235. package/dist/layers.lDwCLT0I.js +0 -1
  236. package/dist/layers.lP9uODKD.js +0 -1283
  237. package/dist/layers.pc1SXYEj.js +0 -1089
  238. package/dist/layers.snXT5mu6.js +0 -1
  239. package/dist/layers.vIfEp2lU.js +0 -48146
  240. package/dist/layers.wJNNYF6u.js +0 -122
  241. package/dist/layers.wKL0lWNs.js +0 -4
  242. package/dist/layers.wU0hxeTl.js +0 -65
  243. package/dist/layers.wj-nS-86.js +0 -38
  244. package/dist/layers.xiOwns_l.js +0 -1
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),N=require("react-i18next"),a=require("./layers.94hwidA2.js"),t=require("@mantine/core"),P=require("@layers-app/shared"),C={};class L extends r.Component{render(){const{getComponent:l}=this.props,c=l("operations",!0);return e.jsx("div",{className:"swagger-ui",children:e.jsx(c,{})})}}const T=()=>({components:{OperationsLayout:L}}),q=s=>({statePlugins:{spec:{wrapSelectors:{taggedOperations:l=>(c,...f)=>{const i=l(c,...f);return s.operation?i.map(u=>u.update("operations",h=>h.filter(p=>p.get("operation").get("operationId")===s.operation))).filter(u=>u.get("operations").size>0):i}}}}}),U=({inputUrl:s,inputJSON:l,className:c,format:f,nodeKey:i,editor:u,create:h})=>{const{t:p}=N.useTranslation(),[j,m]=r.useState(""),[d,v]=r.useState(""),[k,w]=r.useState(!1),[B,O]=r.useState(!1),[g,x]=r.useState(!1),[b,S]=r.useState(!0);r.useEffect(()=>{h&&x(!0)},[h]),r.useEffect(()=>{g?a.blockScroll():a.unblockScroll()},[g]);const y=o=>{o.preventDefault(),u.update(()=>{const n=a.xo(i);a.$isSwaggerNode(n)&&(x(!1),n.setSrc(j||d),n.setJSON(d))})},{operation:I}=r.useMemo(()=>s?{operation:new URL(s).hash.split("/").pop()||""}:{operation:""},[s,l]);return s?e.jsxs(t.Box,{pos:"relative",mih:45,children:[e.jsx(t.LoadingOverlay,{visible:b,zIndex:1e3,overlayProps:{blur:4},loaderProps:{size:"xs"}}),e.jsx(C,{url:l,onComplete:()=>{S(!1)},responseInterceptor:o=>(o.ok||(S(!1),u.update(()=>{const n=a.xo(i);a.$isSwaggerNode(n)&&(x(!1),n.setSrc(""),n.setJSON(""))}),P.showErrorNotification({message:p("editor.validation.swaggerUnavailable")}),S(!0)),o),plugins:[q({operation:I}),T],layout:"OperationsLayout"})]}):e.jsxs(t.Popover,{width:400,position:"bottom",shadow:"md",opened:g,onChange:x,defaultOpened:!0,withinPortal:!0,children:[e.jsx(t.Popover.Target,{children:e.jsx(t.Flex,{w:"100%",children:e.jsx(a.p,{className:c,format:f,nodeKey:i,children:e.jsx(a.EmptyNodeButton,{title:p("editor.swagger.add"),icon:"api",onClick:()=>x(o=>!o),nodeKey:i})})})}),e.jsx(t.Popover.Dropdown,{"aria-hidden":!g,tabIndex:g?0:-1,children:e.jsx("form",{onSubmit:y,children:e.jsxs(t.Stack,{gap:16,children:[e.jsx(t.Box,{children:e.jsx(t.TextInput,{maxLength:500,placeholder:"https://api.example.com/v3/swagger.json","data-autofocus":!0,type:"url",value:d,rightSection:d?null:e.jsx("span",{style:{color:"red"},children:"*"}),onChange:o=>{v(o.currentTarget.value),O(!1)}})}),e.jsx(t.Box,{children:e.jsx(t.TextInput,{maxLength:500,placeholder:"https://api.swagger.io/#/user/getUser","data-autofocus":!0,type:"url",value:j,onChange:o=>{m(o.currentTarget.value),w(!1)}})}),e.jsx(t.Center,{children:e.jsx(t.Button,{w:"100%",type:"submit",disabled:!d,children:p("editor.video.apply")})})]})})})]})};exports.default=U;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),n=require("react"),V=require("react-i18next"),i=require("./layers.CPPTxpTa.js"),J=require("@mantine/core"),Q=require("@layers-app/shared"),$=t=>{const{width:c,height:r,isLoading:h,isError:S,src:f,id:m,altText:p,imageRef:x,maxWidth:g}=t;return u.jsxs("div",{className:"media-wrapper",style:{width:c,height:r,display:"inline-flex",position:"relative"},children:[u.jsx(J.LoadingOverlay,{visible:h,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),u.jsx(X,{className:null,src:f,altText:p,imageRef:x,width:"inherit",height:"inherit",maxWidth:g||"auto",id:m})]})};function X({altText:t,className:c,imageRef:r,src:h,width:S,height:f,maxWidth:m,id:p}){const[x,g]=n.useState(!1);return u.jsx("img",{className:`${c||void 0} ${x?"":"loading"}`,src:h,alt:t,ref:r,style:{height:f,maxWidth:m,width:S},onLoad:()=>{h.includes("splash")?setTimeout(()=>{g(!0)},100):g(!0)},draggable:"false","data-id":p})}function Y({src:t,altText:c,nodeKey:r,width:h,height:S,maxWidth:f,showCaption:m,caption:p,id:x,create:g,alignment:k}){var q,U;const M=n.useRef(null),[C,I]=n.useState(!0),[l]=i.o(),[w,j]=n.useState(!0),[d,y]=n.useState({width:0,height:0}),{start:H,cancel:D}=i.useCancelUpload(),[T,z]=n.useState(0),{fetchUploadMedia:L,fetchDeleteMedia:W,maxFileSize:Z}=n.useContext(i.Context),v=i.mediaMap.has(t)&&(((q=i.mediaMap.get(t))==null?void 0:q.mediaNodeKeys.length)===0||((U=i.mediaMap.get(t))==null?void 0:U.mediaNodeKeys.length)===void 0||t.trim()===""),{t:N}=V.useTranslation(),[K,_]=n.useState(0);n.useEffect(()=>l.registerDecoratorListener(()=>{_(e=>e+1)}),[v]),n.useEffect(()=>{if(!t||t.startsWith("data:image/")||!t.trim()){I(!1);return}const e=new Image;e.src=t,e.onload=()=>I(!1),e.onerror=()=>{I(!1)}},[t,v]);const F=(e,s)=>{l.update(()=>{i.wo(null);const o=i.xo(r);i.$isImageNode(o)&&o.setWidthAndHeight(e,s)})},{historyState:P}=i.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:A}}=i.useSettings(),[b,E]=n.useState(!1);function B(e){return e.endsWith(".svg")||e.includes("image/svg+xml")}function G(e){return new Promise((s,o)=>{if(B(e)){s(0);return}const a=new Image;a.src=e,a.onload=()=>{s(a.width)},a.onerror=()=>{o(new Error("Failed to load image"))}})}n.useEffect(()=>{g&&E(!0)},[g]),n.useEffect(()=>{let e=h,s=S,o=100;(t.includes("unsplash")?t.trim():!v&&t.trim()||t.includes("upload-src-editor"))&&t!=="upload"&&G(t).then(a=>{typeof e=="number"&&e<o&&a<o?(j(!0),y({width:e,height:s})):a<o?(j(!0),y({width:"auto",height:"auto"})):(y({width:a,height:a}),j(!1))}).catch(a=>{console.warn("Ошибка при загрузке изображения:",a.message)})},[t,v]),n.useEffect(()=>{d.width&&d.height&&w&&l.update(()=>{const e=i.xo(r);i.$isImageNode(e)&&e.setWidthAndHeight(d.width,d.height)})},[d.width,d.height,w]),n.useEffect(()=>{const e=document.documentElement;i.toggleLockScroll(b,e)},[b]),n.useEffect(()=>l.registerCommand(i.UPLOAD_IMAGE_COMMAND,e=>(t==="upload"&&O(e),!1),i.zi),[t,C]);const R=(e,s)=>{I(!1),l.update(()=>{const o=i.xo(r);i.$isImageNode(o)&&(o.setSrc(e),o.setId(s))})},O=e=>{I(!0);const s=H();L&&L(e[0],(o,a)=>{R(o,a),z(0)},o=>{o&&Q.showErrorNotification({message:N("editor.gallery.errorFile")}),z(0),R("","")},s,o=>{z(o)})};return!t||t==="upload"?u.jsx(i.ImagePicker,{uploading:!1,onUpload:e=>{!L||!e.length||(O(e),E(!1))},popoverProps:{opened:b,position:"bottom",onChange:E},onChange:e=>{E(!1),l.update(()=>{const s=i.xo(r);i.$isImageNode(s)&&s.setSrc(e)})},children:u.jsx(i.EmptyNodeButton,{title:N("editor.image.add_photo"),icon:"photo",onClick:()=>E(!b),isLoading:C,progress:T,onAfterCancel:()=>{D(),I(!1)}})}):w?u.jsx($,{width:d.width,height:d.height,isLoading:C,isError:!1,isIcon:w,src:t,id:x,editor:l,nodeKey:r,fetchDeleteMedia:W,altText:c,imageRef:M,maxWidth:f,showCaption:m,caption:p,isCollabActive:!1,historyState:P,showNestedEditorTreeView:A,t:N}):u.jsx(i.ResizableContainer,{editor:l,isIcon:w,width:i.parseContainerSize(h),height:i.parseContainerSize(S),initialWidth:d.width||"",initialHeight:d.height||"",onResizeEnd:F,alignment:k,children:u.jsx($,{width:"inherit",height:"inherit",isLoading:C,isError:!1,isIcon:w,src:t,id:x,editor:l,nodeKey:r,fetchDeleteMedia:W,altText:c,imageRef:M,maxWidth:f,showCaption:m,caption:p,isCollabActive:!1,historyState:P,showNestedEditorTreeView:A,t:N})})}exports.default=Y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),n=require("react"),V=require("react-i18next"),i=require("./layers.94hwidA2.js"),J=require("@mantine/core"),Q=require("@layers-app/shared"),$=t=>{const{width:c,height:r,isLoading:h,isError:S,src:f,id:m,altText:p,imageRef:x,maxWidth:g}=t;return u.jsxs("div",{className:"media-wrapper",style:{width:c,height:r,display:"inline-flex",position:"relative"},children:[u.jsx(J.LoadingOverlay,{visible:h,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),u.jsx(X,{className:null,src:f,altText:p,imageRef:x,width:"inherit",height:"inherit",maxWidth:g||"auto",id:m})]})};function X({altText:t,className:c,imageRef:r,src:h,width:S,height:f,maxWidth:m,id:p}){const[x,g]=n.useState(!1);return u.jsx("img",{className:`${c||void 0} ${x?"":"loading"}`,src:h,alt:t,ref:r,style:{height:f,maxWidth:m,width:S},onLoad:()=>{h.includes("splash")?setTimeout(()=>{g(!0)},100):g(!0)},draggable:"false","data-id":p})}function Y({src:t,altText:c,nodeKey:r,width:h,height:S,maxWidth:f,showCaption:m,caption:p,id:x,create:g,alignment:k}){var q,U;const M=n.useRef(null),[C,I]=n.useState(!0),[l]=i.o(),[w,j]=n.useState(!0),[d,y]=n.useState({width:0,height:0}),{start:H,cancel:D}=i.useCancelUpload(),[T,z]=n.useState(0),{fetchUploadMedia:L,fetchDeleteMedia:W,maxFileSize:Z}=n.useContext(i.Context),v=i.mediaMap.has(t)&&(((q=i.mediaMap.get(t))==null?void 0:q.mediaNodeKeys.length)===0||((U=i.mediaMap.get(t))==null?void 0:U.mediaNodeKeys.length)===void 0||t.trim()===""),{t:N}=V.useTranslation(),[K,_]=n.useState(0);n.useEffect(()=>l.registerDecoratorListener(()=>{_(e=>e+1)}),[v]),n.useEffect(()=>{if(!t||t.startsWith("data:image/")||!t.trim()){I(!1);return}const e=new Image;e.src=t,e.onload=()=>I(!1),e.onerror=()=>{I(!1)}},[t,v]);const F=(e,s)=>{l.update(()=>{i.wo(null);const o=i.xo(r);i.$isImageNode(o)&&o.setWidthAndHeight(e,s)})},{historyState:P}=i.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:A}}=i.useSettings(),[b,E]=n.useState(!1);function B(e){return e.endsWith(".svg")||e.includes("image/svg+xml")}function G(e){return new Promise((s,o)=>{if(B(e)){s(0);return}const a=new Image;a.src=e,a.onload=()=>{s(a.width)},a.onerror=()=>{o(new Error("Failed to load image"))}})}n.useEffect(()=>{g&&E(!0)},[g]),n.useEffect(()=>{let e=h,s=S,o=100;(t.includes("unsplash")?t.trim():!v&&t.trim()||t.includes("upload-src-editor"))&&t!=="upload"&&G(t).then(a=>{typeof e=="number"&&e<o&&a<o?(j(!0),y({width:e,height:s})):a<o?(j(!0),y({width:"auto",height:"auto"})):(y({width:a,height:a}),j(!1))}).catch(a=>{console.warn("Ошибка при загрузке изображения:",a.message)})},[t,v]),n.useEffect(()=>{d.width&&d.height&&w&&l.update(()=>{const e=i.xo(r);i.$isImageNode(e)&&e.setWidthAndHeight(d.width,d.height)})},[d.width,d.height,w]),n.useEffect(()=>{const e=document.documentElement;i.toggleLockScroll(b,e)},[b]),n.useEffect(()=>l.registerCommand(i.UPLOAD_IMAGE_COMMAND,e=>(t==="upload"&&O(e),!1),i.zi),[t,C]);const R=(e,s)=>{I(!1),l.update(()=>{const o=i.xo(r);i.$isImageNode(o)&&(o.setSrc(e),o.setId(s))})},O=e=>{I(!0);const s=H();L&&L(e[0],(o,a)=>{R(o,a),z(0)},o=>{o&&Q.showErrorNotification({message:N("editor.gallery.errorFile")}),z(0),R("","")},s,o=>{z(o)})};return!t||t==="upload"?u.jsx(i.ImagePicker,{uploading:!1,onUpload:e=>{!L||!e.length||(O(e),E(!1))},popoverProps:{opened:b,position:"bottom",onChange:E},onChange:e=>{E(!1),l.update(()=>{const s=i.xo(r);i.$isImageNode(s)&&s.setSrc(e)})},children:u.jsx(i.EmptyNodeButton,{title:N("editor.image.add_photo"),icon:"photo",onClick:()=>E(!b),isLoading:C,progress:T,onAfterCancel:()=>{D(),I(!1)}})}):w?u.jsx($,{width:d.width,height:d.height,isLoading:C,isError:!1,isIcon:w,src:t,id:x,editor:l,nodeKey:r,fetchDeleteMedia:W,altText:c,imageRef:M,maxWidth:f,showCaption:m,caption:p,isCollabActive:!1,historyState:P,showNestedEditorTreeView:A,t:N}):u.jsx(i.ResizableContainer,{editor:l,isIcon:w,width:i.parseContainerSize(h),height:i.parseContainerSize(S),initialWidth:d.width||"",initialHeight:d.height||"",onResizeEnd:F,alignment:k,children:u.jsx($,{width:"inherit",height:"inherit",isLoading:C,isError:!1,isIcon:w,src:t,id:x,editor:l,nodeKey:r,fetchDeleteMedia:W,altText:c,imageRef:M,maxWidth:f,showCaption:m,caption:p,isCollabActive:!1,historyState:P,showNestedEditorTreeView:A,t:N})})}exports.default=Y;
@@ -1,10 +1,10 @@
1
1
  import { jsx as l, jsxs as Y } from "react/jsx-runtime";
2
2
  import { useRef as Z, useState as u, useContext as K, useEffect as g } from "react";
3
3
  import { useTranslation as ee } from "react-i18next";
4
- import { o as te, u as ie, C as oe, m as M, a as ae, b as ne, x as z, c as L, t as se, U as re, z as le, I as de, d as he, R as ge, p as T, w as ue } from "./layers.CNTFg_PV.js";
4
+ import { o as te, u as ie, C as oe, m as M, a as ae, b as ne, x as z, $ as L, t as se, U as re, z as le, I as de, E as he, R as ge, p as F, w as ue } from "./layers.zu-IYGYU.js";
5
5
  import { LoadingOverlay as me } from "@mantine/core";
6
6
  import { showErrorNotification as fe } from "@layers-app/shared";
7
- const $ = (t) => {
7
+ const T = (t) => {
8
8
  const {
9
9
  width: m,
10
10
  height: n,
@@ -99,11 +99,11 @@ function Ne({
99
99
  create: h,
100
100
  alignment: j
101
101
  }) {
102
- var _, F;
102
+ var _, $;
103
103
  const R = Z(null), [b, I] = u(!0), [r] = te(), [C, W] = u(!0), [s, y] = u({
104
104
  width: 0,
105
105
  height: 0
106
- }), { start: B, cancel: G } = ie(), [V, A] = u(0), { fetchUploadMedia: P, fetchDeleteMedia: U, maxFileSize: pe } = K(oe), E = M.has(t) && (((_ = M.get(t)) == null ? void 0 : _.mediaNodeKeys.length) === 0 || ((F = M.get(t)) == null ? void 0 : F.mediaNodeKeys.length) === void 0 || t.trim() === ""), { t: N } = ee(), [we, q] = u(0);
106
+ }), { start: B, cancel: G } = ie(), [V, A] = u(0), { fetchUploadMedia: P, fetchDeleteMedia: U, maxFileSize: pe } = K(oe), E = M.has(t) && (((_ = M.get(t)) == null ? void 0 : _.mediaNodeKeys.length) === 0 || (($ = M.get(t)) == null ? void 0 : $.mediaNodeKeys.length) === void 0 || t.trim() === ""), { t: N } = ee(), [we, q] = u(0);
107
107
  g(() => r.registerDecoratorListener(() => {
108
108
  q((e) => e + 1);
109
109
  }), [E]), g(() => {
@@ -230,7 +230,7 @@ function Ne({
230
230
  )
231
231
  }
232
232
  ) : C ? /* @__PURE__ */ l(
233
- $,
233
+ T,
234
234
  {
235
235
  width: s.width,
236
236
  height: s.height,
@@ -257,14 +257,14 @@ function Ne({
257
257
  {
258
258
  editor: r,
259
259
  isIcon: C,
260
- width: T(d),
261
- height: T(v),
260
+ width: F(d),
261
+ height: F(v),
262
262
  initialWidth: s.width || "",
263
263
  initialHeight: s.height || "",
264
264
  onResizeEnd: J,
265
265
  alignment: j,
266
266
  children: /* @__PURE__ */ l(
267
- $,
267
+ T,
268
268
  {
269
269
  width: "inherit",
270
270
  height: "inherit",
@@ -1,9 +1,9 @@
1
- import { jsx as n, jsxs as k, Fragment as W } from "react/jsx-runtime";
2
- import { useRef as M, useContext as O, useMemo as K, useEffect as F, useState as T, useCallback as y, Suspense as X } from "react";
3
- import { v as U, y as G, X as H, B as $, D as j, F as J, G as Q, j as V, o as Y, H as P, L as R, x as z, J as Z, w as A, k as q, M as ee, z as _, N as te, l as ne, O as ae, P as se, s as oe, Q as re, S as ie, T as le, V as ce, W as de, Y as ue, Z as fe } from "./layers.CNTFg_PV.js";
1
+ import { jsx as n, jsxs as k, Fragment as z } from "react/jsx-runtime";
2
+ import { useRef as D, useContext as O, useMemo as K, useEffect as F, useState as M, useCallback as y, Suspense as X } from "react";
3
+ import { r as A, c as q, X as G, j as U, d as $, l as H, e as J, f as Q, o as V, g as P, L as R, x as W, h as Y, w as j, i as Z, k as ee, z as S, N as te, n as ne, O as ae, q as se, s as oe, v as re, y as ie, F as le, A as ce, B as de, D as ue, G as fe } from "./layers.zu-IYGYU.js";
4
4
  import { TextInput as pe } from "@mantine/core";
5
5
  function ge({ initialEditor: e, children: l, initialNodes: a, initialTheme: h, skipCollabChecks: c, skipEditableListener: d }) {
6
- const r = M(!1), E = O(U);
6
+ const r = D(!1), E = O(A);
7
7
  E == null && (function(t, ...x) {
8
8
  const v = new URL("https://lexical.dev/docs/error"), m = new URLSearchParams();
9
9
  m.append("code", t);
@@ -11,28 +11,28 @@ function ge({ initialEditor: e, children: l, initialNodes: a, initialTheme: h, s
11
11
  throw v.search = m.toString(), Error(`Minified Lexical error #${t}; visit ${v.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
12
12
  })(9);
13
13
  const [u, { getTheme: N }] = E, w = K(() => {
14
- const t = h || N() || void 0, x = G(E, t);
14
+ const t = h || N() || void 0, x = q(E, t);
15
15
  t !== void 0 && (e._config.theme = t), e._parentEditor = e._parentEditor || u;
16
16
  const v = e._createEditorArgs, m = v && v.namespace;
17
17
  if (a) {
18
18
  m || (e._config.namespace = u._config.namespace);
19
19
  for (let s of a) {
20
- let S = null, p = null;
20
+ let _ = null, p = null;
21
21
  if (typeof s != "function") {
22
22
  const o = s;
23
- s = o.replace, S = o.with, p = o.withKlass || null;
23
+ s = o.replace, _ = o.with, p = o.withKlass || null;
24
24
  }
25
- const D = H(e, s.getType());
26
- e._nodes.set(s.getType(), { exportDOM: D ? D.exportDOM : void 0, klass: s, replace: S, replaceWithKlass: p, sharedNodeState: j(s), transforms: $(s) });
25
+ const T = G(e, s.getType());
26
+ e._nodes.set(s.getType(), { exportDOM: T ? T.exportDOM : void 0, klass: s, replace: _, replaceWithKlass: p, sharedNodeState: $(s), transforms: U(s) });
27
27
  }
28
28
  } else if (v && v.nodes) m || (e._config.namespace = u._config.namespace);
29
29
  else {
30
30
  const s = e._nodes = new Map(u._nodes);
31
31
  m || (e._config.namespace = u._config.namespace);
32
- for (const [S, p] of s) e._nodes.set(S, { exportDOM: p.exportDOM, klass: p.klass, replace: p.replace, replaceWithKlass: p.replaceWithKlass, sharedNodeState: j(p.klass), transforms: $(p.klass) });
32
+ for (const [_, p] of s) e._nodes.set(_, { exportDOM: p.exportDOM, klass: p.klass, replace: p.replace, replaceWithKlass: p.replaceWithKlass, sharedNodeState: $(p.klass), transforms: U(p.klass) });
33
33
  }
34
34
  return [e, x];
35
- }, []), C = O(J), { isCollabActive: g, yjsDocMap: f } = C ?? {}, I = c || r.current || f && f.has(e.getKey());
35
+ }, []), C = O(H), { isCollabActive: g, yjsDocMap: f } = C ?? {}, I = c || r.current || f && f.has(e.getKey());
36
36
  return F(() => {
37
37
  I && (r.current = !0);
38
38
  }, [I]), F(() => {
@@ -40,7 +40,7 @@ function ge({ initialEditor: e, children: l, initialNodes: a, initialTheme: h, s
40
40
  const t = (x) => e.setEditable(x);
41
41
  return t(u.isEditable()), u.registerEditableListener(t);
42
42
  }
43
- }, [e, u, d]), n(U.Provider, { value: w, children: !g || I ? l : null });
43
+ }, [e, u, d]), n(A.Provider, { value: w, children: !g || I ? l : null });
44
44
  }
45
45
  function me({
46
46
  children: e,
@@ -113,8 +113,8 @@ function be({
113
113
  onClose: a
114
114
  }) {
115
115
  const c = e.getEditorState().read(
116
- () => z(l)
117
- ), [d, r] = T(c.getAltText()), [E, u] = T(c.getShowCaption()), [N, w] = T(c.getPosition()), C = (f) => {
116
+ () => W(l)
117
+ ), [d, r] = M(c.getAltText()), [E, u] = M(c.getShowCaption()), [N, w] = M(c.getPosition()), C = (f) => {
118
118
  u(f.target.checked);
119
119
  }, g = () => {
120
120
  const f = { altText: d, position: N, showCaption: E };
@@ -122,7 +122,7 @@ function be({
122
122
  c.update(f);
123
123
  }), a();
124
124
  };
125
- return /* @__PURE__ */ k(W, { children: [
125
+ return /* @__PURE__ */ k(z, { children: [
126
126
  /* @__PURE__ */ n("div", { style: { marginBottom: "1em" }, children: /* @__PURE__ */ n(
127
127
  he,
128
128
  {
@@ -165,22 +165,22 @@ function we({
165
165
  caption: r,
166
166
  position: E
167
167
  }) {
168
- const [u, N] = Q(), w = M(null), C = M(null), [g, f, I] = V(a), [t] = Y(), [x, v] = T(null), m = M(null), s = y(
168
+ const [u, N] = J(), w = D(null), C = D(null), [g, f, I] = Q(a), [t] = V(), [x, v] = M(null), m = D(null), s = y(
169
169
  (o) => {
170
170
  if (g && P(R())) {
171
171
  o.preventDefault();
172
- const i = z(a);
173
- Z(i) && i.remove();
172
+ const i = W(a);
173
+ Y(i) && i.remove();
174
174
  }
175
175
  return !1;
176
176
  },
177
177
  [g, a]
178
- ), S = y(
178
+ ), _ = y(
179
179
  (o) => {
180
180
  const b = R(), i = C.current;
181
181
  if (g && P(b) && b.getNodes().length === 1) {
182
182
  if (d)
183
- return A(null), o.preventDefault(), r.focus(), !0;
183
+ return j(null), o.preventDefault(), r.focus(), !0;
184
184
  if (i !== null && i !== document.activeElement)
185
185
  return o.preventDefault(), i.focus(), !0;
186
186
  }
@@ -188,7 +188,7 @@ function we({
188
188
  },
189
189
  [r, g, d]
190
190
  ), p = y(
191
- (o) => m.current === r || C.current === o.target ? (A(null), t.update(() => {
191
+ (o) => m.current === r || C.current === o.target ? (j(null), t.update(() => {
192
192
  f(!0);
193
193
  const b = t.getRootElement();
194
194
  b !== null && b.focus();
@@ -197,14 +197,14 @@ function we({
197
197
  );
198
198
  return F(() => {
199
199
  let o = !0;
200
- const b = q(
200
+ const b = Z(
201
201
  t.registerUpdateListener(({ editorState: i }) => {
202
202
  o && v(i.read(() => R()));
203
203
  }),
204
204
  t.registerCommand(
205
205
  re,
206
206
  (i, L) => (m.current = L, !1),
207
- _
207
+ S
208
208
  ),
209
209
  t.registerCommand(
210
210
  oe,
@@ -212,28 +212,28 @@ function we({
212
212
  const L = i;
213
213
  return L.target === w.current ? (L.shiftKey ? f(!g) : (I(), f(!0)), !0) : !1;
214
214
  },
215
- _
215
+ S
216
216
  ),
217
217
  t.registerCommand(
218
218
  se,
219
219
  (i) => i.target === w.current ? (i.preventDefault(), !0) : !1,
220
- _
220
+ S
221
221
  ),
222
222
  t.registerCommand(
223
223
  ae,
224
224
  s,
225
- _
225
+ S
226
226
  ),
227
227
  t.registerCommand(
228
228
  ne,
229
229
  s,
230
- _
230
+ S
231
231
  ),
232
- t.registerCommand(te, S, _),
232
+ t.registerCommand(te, _, S),
233
233
  t.registerCommand(
234
234
  ee,
235
235
  p,
236
- _
236
+ S
237
237
  )
238
238
  );
239
239
  return () => {
@@ -245,11 +245,11 @@ function we({
245
245
  g,
246
246
  a,
247
247
  s,
248
- S,
248
+ _,
249
249
  p,
250
250
  f
251
251
  ]), /* @__PURE__ */ k(X, { fallback: null, children: [
252
- /* @__PURE__ */ k(W, { children: [
252
+ /* @__PURE__ */ k(z, { children: [
253
253
  /* @__PURE__ */ k("div", { draggable: !1, children: [
254
254
  /* @__PURE__ */ n(
255
255
  "button",
@@ -0,0 +1,151 @@
1
+ import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
+ import { useState as i, useEffect as x, useMemo as k, Component as T } from "react";
3
+ import { useTranslation as E } from "react-i18next";
4
+ import { H as j, J as z, K as B, E as M, x as O, M as b } from "./layers.zu-IYGYU.js";
5
+ import { Popover as v, Flex as D, Stack as F, Box as S, TextInput as y, Center as H, Button as R, LoadingOverlay as $ } from "@mantine/core";
6
+ import { showErrorNotification as q } from "@layers-app/shared";
7
+ const A = {};
8
+ class G extends T {
9
+ render() {
10
+ const { getComponent: a } = this.props, l = a("operations", !0);
11
+ return /* @__PURE__ */ e("div", { className: "swagger-ui", children: /* @__PURE__ */ e(l, {}) });
12
+ }
13
+ }
14
+ const Q = () => ({
15
+ components: {
16
+ OperationsLayout: G
17
+ }
18
+ }), V = (o) => ({
19
+ statePlugins: {
20
+ spec: {
21
+ wrapSelectors: {
22
+ taggedOperations: (a) => (l, ...h) => {
23
+ const n = a(l, ...h);
24
+ return o.operation ? n.map(
25
+ (s) => s.update(
26
+ "operations",
27
+ (g) => g.filter((p) => p.get("operation").get("operationId") === o.operation)
28
+ )
29
+ ).filter((s) => s.get("operations").size > 0) : n;
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }), oe = ({
35
+ inputUrl: o,
36
+ inputJSON: a,
37
+ className: l,
38
+ format: h,
39
+ nodeKey: n,
40
+ editor: s,
41
+ create: g
42
+ }) => {
43
+ const { t: p } = E(), [w, C] = i(""), [d, I] = i(""), [W, L] = i(!1), [X, N] = i(!1), [c, u] = i(!1), [P, f] = i(!0);
44
+ x(() => {
45
+ g && u(!0);
46
+ }, [g]), x(() => {
47
+ c ? j() : z();
48
+ }, [c]);
49
+ const J = (t) => {
50
+ t.preventDefault(), s.update(() => {
51
+ const r = O(n);
52
+ b(r) && (u(!1), r.setSrc(w || d), r.setJSON(d));
53
+ });
54
+ }, { operation: U } = k(() => o ? {
55
+ operation: new URL(o).hash.split("/").pop() || ""
56
+ } : { operation: "" }, [o, a]);
57
+ return o ? /* @__PURE__ */ m(S, { pos: "relative", mih: 45, children: [
58
+ /* @__PURE__ */ e(
59
+ $,
60
+ {
61
+ visible: P,
62
+ zIndex: 1e3,
63
+ overlayProps: { blur: 4 },
64
+ loaderProps: { size: "xs" }
65
+ }
66
+ ),
67
+ /* @__PURE__ */ e(
68
+ A,
69
+ {
70
+ url: a,
71
+ onComplete: () => {
72
+ f(!1);
73
+ },
74
+ responseInterceptor: (t) => (t.ok || (f(!1), s.update(() => {
75
+ const r = O(n);
76
+ b(r) && (u(!1), r.setSrc(""), r.setJSON(""));
77
+ }), q({
78
+ message: p("editor.validation.swaggerUnavailable")
79
+ }), f(!0)), t),
80
+ plugins: [
81
+ V({ operation: U }),
82
+ Q
83
+ ],
84
+ layout: "OperationsLayout"
85
+ }
86
+ )
87
+ ] }) : /* @__PURE__ */ m(
88
+ v,
89
+ {
90
+ width: 400,
91
+ position: "bottom",
92
+ shadow: "md",
93
+ opened: c,
94
+ onChange: u,
95
+ defaultOpened: !0,
96
+ withinPortal: !0,
97
+ children: [
98
+ /* @__PURE__ */ e(v.Target, { children: /* @__PURE__ */ e(D, { w: "100%", children: /* @__PURE__ */ e(
99
+ B,
100
+ {
101
+ className: l,
102
+ format: h,
103
+ nodeKey: n,
104
+ children: /* @__PURE__ */ e(
105
+ M,
106
+ {
107
+ title: p("editor.swagger.add"),
108
+ icon: "api",
109
+ onClick: () => u((t) => !t),
110
+ nodeKey: n
111
+ }
112
+ )
113
+ }
114
+ ) }) }),
115
+ /* @__PURE__ */ e(v.Dropdown, { "aria-hidden": !c, tabIndex: c ? 0 : -1, children: /* @__PURE__ */ e("form", { onSubmit: J, children: /* @__PURE__ */ m(F, { gap: 16, children: [
116
+ /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(
117
+ y,
118
+ {
119
+ maxLength: 500,
120
+ placeholder: "https://api.example.com/v3/swagger.json",
121
+ "data-autofocus": !0,
122
+ type: "url",
123
+ value: d,
124
+ rightSection: d ? null : /* @__PURE__ */ e("span", { style: { color: "red" }, children: "*" }),
125
+ onChange: (t) => {
126
+ I(t.currentTarget.value), N(!1);
127
+ }
128
+ }
129
+ ) }),
130
+ /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(
131
+ y,
132
+ {
133
+ maxLength: 500,
134
+ placeholder: "https://api.swagger.io/#/user/getUser",
135
+ "data-autofocus": !0,
136
+ type: "url",
137
+ value: w,
138
+ onChange: (t) => {
139
+ C(t.currentTarget.value), L(!1);
140
+ }
141
+ }
142
+ ) }),
143
+ /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(R, { w: "100%", type: "submit", disabled: !d, children: p("editor.video.apply") }) })
144
+ ] }) }) })
145
+ ]
146
+ }
147
+ );
148
+ };
149
+ export {
150
+ oe as default
151
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("react"),e=require("./layers.CPPTxpTa.js"),y=require("@mantine/core");function D({initialEditor:t,children:u,initialNodes:r,initialTheme:b,skipCollabChecks:d,skipEditableListener:f}){const l=a.useRef(!1),v=a.useContext(e.r);v==null&&(function(s,...S){const j=new URL("https://lexical.dev/docs/error"),x=new URLSearchParams;x.append("code",s);for(const o of S)x.append("v",o);throw j.search=x.toString(),Error(`Minified Lexical error #${s}; visit ${j.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(9);const[g,{getTheme:w}]=v,I=a.useMemo(()=>{const s=b||w()||void 0,S=e.t(v,s);s!==void 0&&(t._config.theme=s),t._parentEditor=t._parentEditor||g;const j=t._createEditorArgs,x=j&&j.namespace;if(r){x||(t._config.namespace=g._config.namespace);for(let o of r){let _=null,m=null;if(typeof o!="function"){const i=o;o=i.replace,_=i.with,m=i.withKlass||null}const N=e.Xi(t,o.getType());t._nodes.set(o.getType(),{exportDOM:N?N.exportDOM:void 0,klass:o,replace:_,replaceWithKlass:m,sharedNodeState:e.at(o),transforms:e.ji(o)})}}else if(j&&j.nodes)x||(t._config.namespace=g._config.namespace);else{const o=t._nodes=new Map(g._nodes);x||(t._config.namespace=g._config.namespace);for(const[_,m]of o)t._nodes.set(_,{exportDOM:m.exportDOM,klass:m.klass,replace:m.replace,replaceWithKlass:m.replaceWithKlass,sharedNodeState:e.at(m.klass),transforms:e.ji(m.klass)})}return[t,S]},[]),E=a.useContext(e.l),{isCollabActive:h,yjsDocMap:p}=E??{},k=d||l.current||p&&p.has(t.getKey());return a.useEffect(()=>{k&&(l.current=!0)},[k]),a.useEffect(()=>{if(!f){const s=S=>t.setEditable(S);return s(g.isEditable()),g.registerEditableListener(s)}},[t,g,f]),n.jsx(e.r.Provider,{value:I,children:!h||k?u:null})}function T({children:t,className:u}){return n.jsx("div",{className:u||"Placeholder__root",children:t})}function P({label:t,value:u,onChange:r,placeholder:b="","data-test-id":d,type:f="text"}){return n.jsx(y.TextInput,{type:f,placeholder:b,value:u,onChange:l=>{r(l.target.value)},label:t,"data-test-id":d,mb:10})}const M=new Set;function z(t){if(!M.has(t))throw new Promise(u=>{const r=new Image;r.src=t,r.onload=()=>{M.add(t),u(null)}})}function O({altText:t,className:u,imageRef:r,src:b,width:d,height:f,position:l}){return z(b),n.jsx("img",{className:u||void 0,src:b,alt:t,ref:r,"data-position":l,style:{display:"block",height:f,width:d},draggable:"false"})}function R({activeEditor:t,nodeKey:u,onClose:r}){const d=t.getEditorState().read(()=>e.xo(u)),[f,l]=a.useState(d.getAltText()),[v,g]=a.useState(d.getShowCaption()),[w,I]=a.useState(d.getPosition()),E=p=>{g(p.target.checked)},h=()=>{const p={altText:f,position:w,showCaption:v};d&&t.update(()=>{d.update(p)}),r()};return n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{marginBottom:"1em"},children:n.jsx(P,{label:"Alt-текст",placeholder:"Альтернативный текст",onChange:l,value:f,"data-test-id":"image-modal-alt-text-input"})}),n.jsxs("div",{className:"Input__wrapper",children:[n.jsx("input",{id:"caption",type:"checkbox",checked:v,onChange:E}),n.jsx("label",{htmlFor:"caption",children:"Show Caption"})]}),n.jsx(e.Button,{"data-test-id":"image-modal-file-upload-btn",onClick:()=>h(),children:"Применить"})]})}function U({src:t,altText:u,nodeKey:r,width:b,height:d,showCaption:f,caption:l,position:v}){const[g,w]=e.useModal(),I=a.useRef(null),E=a.useRef(null),[h,p,k]=e.u(r),[s]=e.o(),[S,j]=a.useState(null),x=a.useRef(null),o=a.useCallback(i=>{if(h&&e.xr(e.Lr())){i.preventDefault();const c=e.xo(r);e.$isInlineImageNode(c)&&c.remove()}return!1},[h,r]),_=a.useCallback(i=>{const C=e.Lr(),c=E.current;if(h&&e.xr(C)&&C.getNodes().length===1){if(f)return e.wo(null),i.preventDefault(),l.focus(),!0;if(c!==null&&c!==document.activeElement)return i.preventDefault(),c.focus(),!0}return!1},[l,h,f]),m=a.useCallback(i=>x.current===l||E.current===i.target?(e.wo(null),s.update(()=>{p(!0);const C=s.getRootElement();C!==null&&C.focus()}),!0):!1,[l,s,p]);a.useEffect(()=>{let i=!0;const C=e.U(s.registerUpdateListener(({editorState:c})=>{i&&j(c.read(()=>e.Lr()))}),s.registerCommand(e.ie,(c,L)=>(x.current=L,!1),e.zi),s.registerCommand(e.se,c=>{const L=c;return L.target===I.current?(L.shiftKey?p(!h):(k(),p(!0)),!0):!1},e.zi),s.registerCommand(e.Ie,c=>c.target===I.current?(c.preventDefault(),!0):!1,e.zi),s.registerCommand(e.Oe,o,e.zi),s.registerCommand(e.we,o,e.zi),s.registerCommand(e.Ne,_,e.zi),s.registerCommand(e.Ee,m,e.zi));return()=>{i=!1,C()}},[k,s,h,r,o,_,m,p]);const N=h;return n.jsxs(a.Suspense,{fallback:null,children:[n.jsxs(n.Fragment,{children:[n.jsxs("div",{draggable:!1,children:[n.jsx("button",{className:"image-edit-button",ref:E,onClick:()=>{w("Update Inline Image",i=>n.jsx(R,{activeEditor:s,nodeKey:r,onClose:i}))},children:"Edit"}),n.jsx(O,{className:N?`focused ${e.xr(S)?"draggable":""}`:null,src:t,altText:u,imageRef:I,width:b,height:d,position:v})]}),f&&n.jsx("div",{className:"image-caption-container",children:n.jsxs(D,{initialEditor:l,children:[n.jsx(e.LinkPlugin,{}),n.jsx(e.FloatingTextFormatToolbarPlugin,{}),n.jsx(e.L,{contentEditable:n.jsx(e.LexicalContentEditable,{className:"InlineImageNode__contentEditable"}),placeholder:n.jsx(T,{className:"InlineImageNode__placeholder",children:"Enter a caption..."}),ErrorBoundary:e.n})]})})]}),g]})}exports.UpdateInlineImageDialog=R;exports.default=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("react"),e=require("./layers.94hwidA2.js"),y=require("@mantine/core");function D({initialEditor:t,children:u,initialNodes:r,initialTheme:b,skipCollabChecks:d,skipEditableListener:f}){const l=a.useRef(!1),v=a.useContext(e.r);v==null&&(function(s,...S){const j=new URL("https://lexical.dev/docs/error"),x=new URLSearchParams;x.append("code",s);for(const o of S)x.append("v",o);throw j.search=x.toString(),Error(`Minified Lexical error #${s}; visit ${j.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(9);const[g,{getTheme:w}]=v,I=a.useMemo(()=>{const s=b||w()||void 0,S=e.t(v,s);s!==void 0&&(t._config.theme=s),t._parentEditor=t._parentEditor||g;const j=t._createEditorArgs,x=j&&j.namespace;if(r){x||(t._config.namespace=g._config.namespace);for(let o of r){let _=null,m=null;if(typeof o!="function"){const i=o;o=i.replace,_=i.with,m=i.withKlass||null}const N=e.Xi(t,o.getType());t._nodes.set(o.getType(),{exportDOM:N?N.exportDOM:void 0,klass:o,replace:_,replaceWithKlass:m,sharedNodeState:e.at(o),transforms:e.ji(o)})}}else if(j&&j.nodes)x||(t._config.namespace=g._config.namespace);else{const o=t._nodes=new Map(g._nodes);x||(t._config.namespace=g._config.namespace);for(const[_,m]of o)t._nodes.set(_,{exportDOM:m.exportDOM,klass:m.klass,replace:m.replace,replaceWithKlass:m.replaceWithKlass,sharedNodeState:e.at(m.klass),transforms:e.ji(m.klass)})}return[t,S]},[]),E=a.useContext(e.l),{isCollabActive:h,yjsDocMap:p}=E??{},k=d||l.current||p&&p.has(t.getKey());return a.useEffect(()=>{k&&(l.current=!0)},[k]),a.useEffect(()=>{if(!f){const s=S=>t.setEditable(S);return s(g.isEditable()),g.registerEditableListener(s)}},[t,g,f]),n.jsx(e.r.Provider,{value:I,children:!h||k?u:null})}function T({children:t,className:u}){return n.jsx("div",{className:u||"Placeholder__root",children:t})}function P({label:t,value:u,onChange:r,placeholder:b="","data-test-id":d,type:f="text"}){return n.jsx(y.TextInput,{type:f,placeholder:b,value:u,onChange:l=>{r(l.target.value)},label:t,"data-test-id":d,mb:10})}const M=new Set;function z(t){if(!M.has(t))throw new Promise(u=>{const r=new Image;r.src=t,r.onload=()=>{M.add(t),u(null)}})}function O({altText:t,className:u,imageRef:r,src:b,width:d,height:f,position:l}){return z(b),n.jsx("img",{className:u||void 0,src:b,alt:t,ref:r,"data-position":l,style:{display:"block",height:f,width:d},draggable:"false"})}function R({activeEditor:t,nodeKey:u,onClose:r}){const d=t.getEditorState().read(()=>e.xo(u)),[f,l]=a.useState(d.getAltText()),[v,g]=a.useState(d.getShowCaption()),[w,I]=a.useState(d.getPosition()),E=p=>{g(p.target.checked)},h=()=>{const p={altText:f,position:w,showCaption:v};d&&t.update(()=>{d.update(p)}),r()};return n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{marginBottom:"1em"},children:n.jsx(P,{label:"Alt-текст",placeholder:"Альтернативный текст",onChange:l,value:f,"data-test-id":"image-modal-alt-text-input"})}),n.jsxs("div",{className:"Input__wrapper",children:[n.jsx("input",{id:"caption",type:"checkbox",checked:v,onChange:E}),n.jsx("label",{htmlFor:"caption",children:"Show Caption"})]}),n.jsx(e.Button,{"data-test-id":"image-modal-file-upload-btn",onClick:()=>h(),children:"Применить"})]})}function U({src:t,altText:u,nodeKey:r,width:b,height:d,showCaption:f,caption:l,position:v}){const[g,w]=e.useModal(),I=a.useRef(null),E=a.useRef(null),[h,p,k]=e.u(r),[s]=e.o(),[S,j]=a.useState(null),x=a.useRef(null),o=a.useCallback(i=>{if(h&&e.xr(e.Lr())){i.preventDefault();const c=e.xo(r);e.$isInlineImageNode(c)&&c.remove()}return!1},[h,r]),_=a.useCallback(i=>{const C=e.Lr(),c=E.current;if(h&&e.xr(C)&&C.getNodes().length===1){if(f)return e.wo(null),i.preventDefault(),l.focus(),!0;if(c!==null&&c!==document.activeElement)return i.preventDefault(),c.focus(),!0}return!1},[l,h,f]),m=a.useCallback(i=>x.current===l||E.current===i.target?(e.wo(null),s.update(()=>{p(!0);const C=s.getRootElement();C!==null&&C.focus()}),!0):!1,[l,s,p]);a.useEffect(()=>{let i=!0;const C=e.U(s.registerUpdateListener(({editorState:c})=>{i&&j(c.read(()=>e.Lr()))}),s.registerCommand(e.ie,(c,L)=>(x.current=L,!1),e.zi),s.registerCommand(e.se,c=>{const L=c;return L.target===I.current?(L.shiftKey?p(!h):(k(),p(!0)),!0):!1},e.zi),s.registerCommand(e.Ie,c=>c.target===I.current?(c.preventDefault(),!0):!1,e.zi),s.registerCommand(e.Oe,o,e.zi),s.registerCommand(e.we,o,e.zi),s.registerCommand(e.Ne,_,e.zi),s.registerCommand(e.Ee,m,e.zi));return()=>{i=!1,C()}},[k,s,h,r,o,_,m,p]);const N=h;return n.jsxs(a.Suspense,{fallback:null,children:[n.jsxs(n.Fragment,{children:[n.jsxs("div",{draggable:!1,children:[n.jsx("button",{className:"image-edit-button",ref:E,onClick:()=>{w("Update Inline Image",i=>n.jsx(R,{activeEditor:s,nodeKey:r,onClose:i}))},children:"Edit"}),n.jsx(O,{className:N?`focused ${e.xr(S)?"draggable":""}`:null,src:t,altText:u,imageRef:I,width:b,height:d,position:v})]}),f&&n.jsx("div",{className:"image-caption-container",children:n.jsxs(D,{initialEditor:l,children:[n.jsx(e.LinkPlugin,{}),n.jsx(e.FloatingTextFormatToolbarPlugin,{}),n.jsx(e.L,{contentEditable:n.jsx(e.LexicalContentEditable,{className:"InlineImageNode__contentEditable"}),placeholder:n.jsx(T,{className:"InlineImageNode__placeholder",children:"Enter a caption..."}),ErrorBoundary:e.n})]})})]}),g]})}exports.UpdateInlineImageDialog=R;exports.default=U;