@strapi/content-manager 0.0.0-experimental.e14656d3b8681880212c13260b9a2b340c182f2d → 0.0.0-experimental.e576af447d9f97e89e24c6daa32d8f714376cd5f

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 (500) hide show
  1. package/dist/admin/chunks/CardDragPreview-DwuraT0K.mjs +80 -0
  2. package/dist/admin/chunks/CardDragPreview-DwuraT0K.mjs.map +1 -0
  3. package/dist/admin/chunks/CardDragPreview-_dubYgXO.js +82 -0
  4. package/dist/admin/chunks/CardDragPreview-_dubYgXO.js.map +1 -0
  5. package/dist/admin/chunks/ComponentConfigurationPage-BRMxaaa0.mjs +277 -0
  6. package/dist/admin/chunks/ComponentConfigurationPage-BRMxaaa0.mjs.map +1 -0
  7. package/dist/admin/chunks/ComponentConfigurationPage-DwjhCutb.js +299 -0
  8. package/dist/admin/chunks/ComponentConfigurationPage-DwjhCutb.js.map +1 -0
  9. package/dist/admin/chunks/ComponentIcon-BZcTc4rj.mjs +153 -0
  10. package/dist/admin/chunks/ComponentIcon-BZcTc4rj.mjs.map +1 -0
  11. package/dist/admin/chunks/ComponentIcon-C-EjOUPA.js +176 -0
  12. package/dist/admin/chunks/ComponentIcon-C-EjOUPA.js.map +1 -0
  13. package/dist/admin/chunks/EditConfigurationPage-DPQ6e_ZU.js +181 -0
  14. package/dist/admin/chunks/EditConfigurationPage-DPQ6e_ZU.js.map +1 -0
  15. package/dist/admin/chunks/EditConfigurationPage-mHz7EIZ9.mjs +159 -0
  16. package/dist/admin/chunks/EditConfigurationPage-mHz7EIZ9.mjs.map +1 -0
  17. package/dist/admin/chunks/EditViewPage-CXmEDGW2.js +334 -0
  18. package/dist/admin/chunks/EditViewPage-CXmEDGW2.js.map +1 -0
  19. package/dist/admin/chunks/EditViewPage-DC_tEaOd.mjs +311 -0
  20. package/dist/admin/chunks/EditViewPage-DC_tEaOd.mjs.map +1 -0
  21. package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.mjs +56 -0
  22. package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.mjs.map +1 -0
  23. package/dist/admin/chunks/FieldTypeIcon-Bxh-7Jin.js +58 -0
  24. package/dist/admin/chunks/FieldTypeIcon-Bxh-7Jin.js.map +1 -0
  25. package/dist/admin/chunks/Form-CmzyWdCy.js +978 -0
  26. package/dist/admin/chunks/Form-CmzyWdCy.js.map +1 -0
  27. package/dist/admin/chunks/Form-Sz84KGej.mjs +955 -0
  28. package/dist/admin/chunks/Form-Sz84KGej.mjs.map +1 -0
  29. package/dist/admin/chunks/History-B75NuF92.js +1380 -0
  30. package/dist/admin/chunks/History-B75NuF92.js.map +1 -0
  31. package/dist/admin/chunks/History-C5fFAagI.mjs +1357 -0
  32. package/dist/admin/chunks/History-C5fFAagI.mjs.map +1 -0
  33. package/dist/admin/chunks/Input-BIzj18xW.js +7221 -0
  34. package/dist/admin/chunks/Input-BIzj18xW.js.map +1 -0
  35. package/dist/admin/chunks/Input-DDV2blpv.mjs +7190 -0
  36. package/dist/admin/chunks/Input-DDV2blpv.mjs.map +1 -0
  37. package/dist/admin/chunks/ListConfigurationPage-DVFNbbLl.js +819 -0
  38. package/dist/admin/chunks/ListConfigurationPage-DVFNbbLl.js.map +1 -0
  39. package/dist/admin/chunks/ListConfigurationPage-Ddq1APAQ.mjs +796 -0
  40. package/dist/admin/chunks/ListConfigurationPage-Ddq1APAQ.mjs.map +1 -0
  41. package/dist/admin/chunks/ListViewPage-D3gpvdM2.js +1155 -0
  42. package/dist/admin/chunks/ListViewPage-D3gpvdM2.js.map +1 -0
  43. package/dist/admin/chunks/ListViewPage-IIou-WFn.mjs +1133 -0
  44. package/dist/admin/chunks/ListViewPage-IIou-WFn.mjs.map +1 -0
  45. package/dist/admin/chunks/NoContentTypePage-B7sfKVrj.js +60 -0
  46. package/dist/admin/chunks/NoContentTypePage-B7sfKVrj.js.map +1 -0
  47. package/dist/admin/chunks/NoContentTypePage-mZFnYA3z.mjs +58 -0
  48. package/dist/admin/chunks/NoContentTypePage-mZFnYA3z.mjs.map +1 -0
  49. package/dist/admin/chunks/NoPermissionsPage-C-XBYfpZ.js +39 -0
  50. package/dist/admin/chunks/NoPermissionsPage-C-XBYfpZ.js.map +1 -0
  51. package/dist/admin/chunks/NoPermissionsPage-CfUdeuGT.mjs +37 -0
  52. package/dist/admin/chunks/NoPermissionsPage-CfUdeuGT.mjs.map +1 -0
  53. package/dist/admin/chunks/Preview-DkU1bar6.js +696 -0
  54. package/dist/admin/chunks/Preview-DkU1bar6.js.map +1 -0
  55. package/dist/admin/chunks/Preview-xr-5BCHr.mjs +674 -0
  56. package/dist/admin/chunks/Preview-xr-5BCHr.mjs.map +1 -0
  57. package/dist/admin/chunks/Relations-Ddnb_jYb.mjs +1291 -0
  58. package/dist/admin/chunks/Relations-Ddnb_jYb.mjs.map +1 -0
  59. package/dist/admin/chunks/Relations-VSItCr8c.js +1318 -0
  60. package/dist/admin/chunks/Relations-VSItCr8c.js.map +1 -0
  61. package/dist/admin/chunks/ar-DckYq_WK.mjs +222 -0
  62. package/dist/{_chunks/ar-CCEVvqGG.mjs.map → admin/chunks/ar-DckYq_WK.mjs.map} +1 -1
  63. package/dist/admin/chunks/ar-DeQBSsfl.js +227 -0
  64. package/dist/{_chunks/ru-BT3ybNny.js.map → admin/chunks/ar-DeQBSsfl.js.map} +1 -1
  65. package/dist/admin/chunks/ca-ClDTvatJ.js +202 -0
  66. package/dist/admin/chunks/ca-ClDTvatJ.js.map +1 -0
  67. package/dist/admin/chunks/ca-DviY7mRj.mjs +197 -0
  68. package/dist/admin/chunks/ca-DviY7mRj.mjs.map +1 -0
  69. package/dist/admin/chunks/cs-BJFxwIWj.js +126 -0
  70. package/dist/{_chunks/cs-CkJy6B2v.js.map → admin/chunks/cs-BJFxwIWj.js.map} +1 -1
  71. package/dist/admin/chunks/cs-C7OSYFQ7.mjs +122 -0
  72. package/dist/{_chunks/cs-CM2aBUar.mjs.map → admin/chunks/cs-C7OSYFQ7.mjs.map} +1 -1
  73. package/dist/admin/chunks/de-5QRlDHyR.mjs +195 -0
  74. package/dist/{_chunks/eu-CdALomew.mjs.map → admin/chunks/de-5QRlDHyR.mjs.map} +1 -1
  75. package/dist/admin/chunks/de-CbImAUA5.js +200 -0
  76. package/dist/{_chunks/gu-BRmF601H.js.map → admin/chunks/de-CbImAUA5.js.map} +1 -1
  77. package/dist/admin/chunks/en-CImiNxXE.mjs +310 -0
  78. package/dist/{_chunks/en-BrCTWlZv.mjs.map → admin/chunks/en-CImiNxXE.mjs.map} +1 -1
  79. package/dist/admin/chunks/en-CLf4SuMQ.js +315 -0
  80. package/dist/{_chunks/en-uOUIxfcQ.js.map → admin/chunks/en-CLf4SuMQ.js.map} +1 -1
  81. package/dist/admin/chunks/es-C8vLuvZL.js +197 -0
  82. package/dist/{_chunks/es-EUonQTon.js.map → admin/chunks/es-C8vLuvZL.js.map} +1 -1
  83. package/dist/admin/chunks/es-DkoWSExG.mjs +192 -0
  84. package/dist/{_chunks/ja-CtsUxOvk.mjs.map → admin/chunks/es-DkoWSExG.mjs.map} +1 -1
  85. package/dist/admin/chunks/eu-BG1xX7HK.mjs +198 -0
  86. package/dist/admin/chunks/eu-BG1xX7HK.mjs.map +1 -0
  87. package/dist/admin/chunks/eu-BJW3AvXu.js +203 -0
  88. package/dist/admin/chunks/eu-BJW3AvXu.js.map +1 -0
  89. package/dist/admin/chunks/fr-CFdRaRVj.mjs +215 -0
  90. package/dist/admin/chunks/fr-CFdRaRVj.mjs.map +1 -0
  91. package/dist/admin/chunks/fr-gQSilC7w.js +220 -0
  92. package/dist/admin/chunks/fr-gQSilC7w.js.map +1 -0
  93. package/dist/admin/chunks/gu-D5MMMXRs.mjs +196 -0
  94. package/dist/admin/chunks/gu-D5MMMXRs.mjs.map +1 -0
  95. package/dist/admin/chunks/gu-DPU4wyx7.js +201 -0
  96. package/dist/{_chunks/eu-VDH-3ovk.js.map → admin/chunks/gu-DPU4wyx7.js.map} +1 -1
  97. package/dist/admin/chunks/hi-Dp4omeBb.js +201 -0
  98. package/dist/admin/chunks/hi-Dp4omeBb.js.map +1 -0
  99. package/dist/admin/chunks/hi-lp17SCjr.mjs +196 -0
  100. package/dist/admin/chunks/hi-lp17SCjr.mjs.map +1 -0
  101. package/dist/{_chunks/hooks-BAaaKPS_.js → admin/chunks/hooks-D-sOYd1s.js} +6 -3
  102. package/dist/admin/chunks/hooks-D-sOYd1s.js.map +1 -0
  103. package/dist/admin/chunks/hooks-DMvik5y_.mjs +7 -0
  104. package/dist/admin/chunks/hooks-DMvik5y_.mjs.map +1 -0
  105. package/dist/admin/chunks/hu-CLka1U2C.mjs +198 -0
  106. package/dist/admin/chunks/hu-CLka1U2C.mjs.map +1 -0
  107. package/dist/admin/chunks/hu-CtFJuhTd.js +203 -0
  108. package/dist/admin/chunks/hu-CtFJuhTd.js.map +1 -0
  109. package/dist/admin/chunks/id-D7V5S1rB.js +161 -0
  110. package/dist/{_chunks/it-DkBIs7vD.js.map → admin/chunks/id-D7V5S1rB.js.map} +1 -1
  111. package/dist/admin/chunks/id-USfY9m1g.mjs +156 -0
  112. package/dist/{_chunks/id-BtwA9WJT.mjs.map → admin/chunks/id-USfY9m1g.mjs.map} +1 -1
  113. package/dist/admin/chunks/index-BE23Vyc8.js +5456 -0
  114. package/dist/admin/chunks/index-BE23Vyc8.js.map +1 -0
  115. package/dist/admin/chunks/index-TXDGJBhY.mjs +5389 -0
  116. package/dist/admin/chunks/index-TXDGJBhY.mjs.map +1 -0
  117. package/dist/admin/chunks/it-BAHrwmYS.mjs +158 -0
  118. package/dist/{_chunks/it-BrVPqaf1.mjs.map → admin/chunks/it-BAHrwmYS.mjs.map} +1 -1
  119. package/dist/admin/chunks/it-CQFpa_Dc.js +163 -0
  120. package/dist/{_chunks/ko-woFZPmLk.js.map → admin/chunks/it-CQFpa_Dc.js.map} +1 -1
  121. package/dist/admin/chunks/ja-BWKmBJFT.mjs +192 -0
  122. package/dist/{_chunks/ko-HVQRlfUI.mjs.map → admin/chunks/ja-BWKmBJFT.mjs.map} +1 -1
  123. package/dist/admin/chunks/ja-jdQM-B79.js +197 -0
  124. package/dist/{_chunks/de-CCEmbAah.js.map → admin/chunks/ja-jdQM-B79.js.map} +1 -1
  125. package/dist/admin/chunks/ko-CgADGBNt.mjs +191 -0
  126. package/dist/{_chunks/es-CeXiYflN.mjs.map → admin/chunks/ko-CgADGBNt.mjs.map} +1 -1
  127. package/dist/admin/chunks/ko-k46sEyzt.js +196 -0
  128. package/dist/{_chunks/ja-CcFe8diO.js.map → admin/chunks/ko-k46sEyzt.js.map} +1 -1
  129. package/dist/admin/chunks/layout-B3zsQDhd.js +619 -0
  130. package/dist/admin/chunks/layout-B3zsQDhd.js.map +1 -0
  131. package/dist/admin/chunks/layout-DmbmZmt8.mjs +599 -0
  132. package/dist/admin/chunks/layout-DmbmZmt8.mjs.map +1 -0
  133. package/dist/admin/chunks/ml-CnhCfOn_.mjs +196 -0
  134. package/dist/admin/chunks/ml-CnhCfOn_.mjs.map +1 -0
  135. package/dist/admin/chunks/ml-DqxPwODx.js +201 -0
  136. package/dist/admin/chunks/ml-DqxPwODx.js.map +1 -0
  137. package/dist/admin/chunks/ms-Bh09NFff.mjs +140 -0
  138. package/dist/{_chunks/ms-m_WjyWx7.mjs.map → admin/chunks/ms-Bh09NFff.mjs.map} +1 -1
  139. package/dist/admin/chunks/ms-CvSC0OdG.js +145 -0
  140. package/dist/{_chunks/ms-BuFotyP_.js.map → admin/chunks/ms-CvSC0OdG.js.map} +1 -1
  141. package/dist/admin/chunks/nl-BEubhS8C.js +203 -0
  142. package/dist/admin/chunks/nl-BEubhS8C.js.map +1 -0
  143. package/dist/admin/chunks/nl-C8HYflTc.mjs +198 -0
  144. package/dist/admin/chunks/nl-C8HYflTc.mjs.map +1 -0
  145. package/dist/admin/chunks/objects-C3EebVVe.js +76 -0
  146. package/dist/admin/chunks/objects-C3EebVVe.js.map +1 -0
  147. package/dist/admin/chunks/objects-wl73iEma.mjs +73 -0
  148. package/dist/admin/chunks/objects-wl73iEma.mjs.map +1 -0
  149. package/dist/admin/chunks/pl-DWhGDzmM.js +200 -0
  150. package/dist/{_chunks/ca-Cmk45QO6.js.map → admin/chunks/pl-DWhGDzmM.js.map} +1 -1
  151. package/dist/admin/chunks/pl-MFCZJZuZ.mjs +195 -0
  152. package/dist/{_chunks/ca-5U32ON2v.mjs.map → admin/chunks/pl-MFCZJZuZ.mjs.map} +1 -1
  153. package/dist/admin/chunks/pt-BR-CPtAXD-4.js +202 -0
  154. package/dist/{_chunks/pt-BR-BiOz37D9.js.map → admin/chunks/pt-BR-CPtAXD-4.js.map} +1 -1
  155. package/dist/admin/chunks/pt-BR-CcotyBGJ.mjs +197 -0
  156. package/dist/{_chunks/pt-BR-C71iDxnh.mjs.map → admin/chunks/pt-BR-CcotyBGJ.mjs.map} +1 -1
  157. package/dist/admin/chunks/pt-BoPxN80n.js +96 -0
  158. package/dist/admin/chunks/pt-BoPxN80n.js.map +1 -0
  159. package/dist/admin/chunks/pt-HbmgeiYO.mjs +93 -0
  160. package/dist/admin/chunks/pt-HbmgeiYO.mjs.map +1 -0
  161. package/dist/admin/chunks/relations-B93RmIIQ.js +178 -0
  162. package/dist/admin/chunks/relations-B93RmIIQ.js.map +1 -0
  163. package/dist/admin/chunks/relations-Ccbyl2K1.mjs +173 -0
  164. package/dist/admin/chunks/relations-Ccbyl2K1.mjs.map +1 -0
  165. package/dist/admin/chunks/ru-C0op0ALG.js +232 -0
  166. package/dist/admin/chunks/ru-C0op0ALG.js.map +1 -0
  167. package/dist/admin/chunks/ru-CB4BUyQp.mjs +230 -0
  168. package/dist/{_chunks/ru-BE6A4Exp.mjs.map → admin/chunks/ru-CB4BUyQp.mjs.map} +1 -1
  169. package/dist/admin/chunks/sa-B_FuPyMw.js +201 -0
  170. package/dist/admin/chunks/sa-B_FuPyMw.js.map +1 -0
  171. package/dist/admin/chunks/sa-n_aPA-pU.mjs +196 -0
  172. package/dist/admin/chunks/sa-n_aPA-pU.mjs.map +1 -0
  173. package/dist/admin/chunks/sk-D_iXML2C.js +203 -0
  174. package/dist/admin/chunks/sk-D_iXML2C.js.map +1 -0
  175. package/dist/admin/chunks/sk-tn_BDjE2.mjs +198 -0
  176. package/dist/admin/chunks/sk-tn_BDjE2.mjs.map +1 -0
  177. package/dist/admin/chunks/sv-BstBC1Yp.js +203 -0
  178. package/dist/admin/chunks/sv-BstBC1Yp.js.map +1 -0
  179. package/dist/admin/chunks/sv-cq4ZrQRd.mjs +198 -0
  180. package/dist/admin/chunks/sv-cq4ZrQRd.mjs.map +1 -0
  181. package/dist/admin/chunks/th-lXoOCqPC.js +149 -0
  182. package/dist/{_chunks/th-D9_GfAjc.js.map → admin/chunks/th-lXoOCqPC.js.map} +1 -1
  183. package/dist/admin/chunks/th-mUH7hEtc.mjs +144 -0
  184. package/dist/{_chunks/uk-CR-zDhAY.mjs.map → admin/chunks/th-mUH7hEtc.mjs.map} +1 -1
  185. package/dist/admin/chunks/tr-CkS6sLIE.js +200 -0
  186. package/dist/admin/chunks/tr-CkS6sLIE.js.map +1 -0
  187. package/dist/admin/chunks/tr-Yt38daxh.mjs +195 -0
  188. package/dist/{_chunks/de-C72KDNOl.mjs.map → admin/chunks/tr-Yt38daxh.mjs.map} +1 -1
  189. package/dist/admin/chunks/uk-BtM6WnaE.mjs +313 -0
  190. package/dist/admin/chunks/uk-BtM6WnaE.mjs.map +1 -0
  191. package/dist/admin/chunks/uk-DB6OgySY.js +318 -0
  192. package/dist/admin/chunks/uk-DB6OgySY.js.map +1 -0
  193. package/dist/admin/chunks/useDragAndDrop-HYwNDExe.mjs +247 -0
  194. package/dist/admin/chunks/useDragAndDrop-HYwNDExe.mjs.map +1 -0
  195. package/dist/admin/chunks/useDragAndDrop-gcqEJMnO.js +271 -0
  196. package/dist/admin/chunks/useDragAndDrop-gcqEJMnO.js.map +1 -0
  197. package/dist/admin/chunks/usePrev-Bjw2dhmq.mjs +18 -0
  198. package/dist/admin/chunks/usePrev-Bjw2dhmq.mjs.map +1 -0
  199. package/dist/admin/chunks/usePrev-DIYl-IAL.js +21 -0
  200. package/dist/admin/chunks/usePrev-DIYl-IAL.js.map +1 -0
  201. package/dist/admin/chunks/vi-BGr1X_HZ.js +112 -0
  202. package/dist/{_chunks/vi-CJlYDheJ.js.map → admin/chunks/vi-BGr1X_HZ.js.map} +1 -1
  203. package/dist/admin/chunks/vi-CvBGlTjr.mjs +108 -0
  204. package/dist/{_chunks/vi-DUXIk_fw.mjs.map → admin/chunks/vi-CvBGlTjr.mjs.map} +1 -1
  205. package/dist/admin/chunks/zh-BmF-sHaT.mjs +205 -0
  206. package/dist/admin/chunks/zh-BmF-sHaT.mjs.map +1 -0
  207. package/dist/admin/chunks/zh-DwFu_Kfj.js +210 -0
  208. package/dist/admin/chunks/zh-DwFu_Kfj.js.map +1 -0
  209. package/dist/admin/chunks/zh-Hans-CI0HKio3.mjs +934 -0
  210. package/dist/{_chunks/zh-Hans-BPQcRIyH.mjs.map → admin/chunks/zh-Hans-CI0HKio3.mjs.map} +1 -1
  211. package/dist/admin/chunks/zh-Hans-JVK9x7xr.js +953 -0
  212. package/dist/{_chunks/zh-Hans-9kOncHGw.js.map → admin/chunks/zh-Hans-JVK9x7xr.js.map} +1 -1
  213. package/dist/admin/index.js +26 -4
  214. package/dist/admin/index.js.map +1 -1
  215. package/dist/admin/index.mjs +17 -11
  216. package/dist/admin/index.mjs.map +1 -1
  217. package/dist/admin/src/components/InjectionZone.d.ts +7 -1
  218. package/dist/admin/src/content-manager.d.ts +7 -2
  219. package/dist/admin/src/exports.d.ts +2 -1
  220. package/dist/admin/src/history/services/historyVersion.d.ts +2 -2
  221. package/dist/admin/src/hooks/useDocument.d.ts +52 -2
  222. package/dist/admin/src/hooks/useDocumentActions.d.ts +1 -0
  223. package/dist/admin/src/index.d.ts +1 -0
  224. package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
  225. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +3 -2
  226. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +3 -3
  227. package/dist/admin/src/pages/EditView/components/EditorToolbarObserver.d.ts +11 -0
  228. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +55 -0
  229. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
  230. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
  231. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
  232. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +2 -1
  233. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.d.ts +1 -2
  234. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +0 -32
  235. package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +29 -1
  236. package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
  237. package/dist/admin/src/pages/EditView/utils/data.d.ts +1 -0
  238. package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
  239. package/dist/admin/src/preview/components/PreviewHeader.d.ts +3 -0
  240. package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
  241. package/dist/admin/src/preview/index.d.ts +3 -0
  242. package/dist/admin/src/preview/pages/Preview.d.ts +15 -0
  243. package/dist/admin/src/preview/routes.d.ts +3 -0
  244. package/dist/admin/src/preview/services/preview.d.ts +3 -0
  245. package/dist/admin/src/router.d.ts +1 -1
  246. package/dist/admin/src/services/api.d.ts +1 -1
  247. package/dist/admin/src/services/components.d.ts +2 -2
  248. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  249. package/dist/admin/src/services/documents.d.ts +19 -20
  250. package/dist/admin/src/services/init.d.ts +1 -1
  251. package/dist/admin/src/services/relations.d.ts +2 -2
  252. package/dist/admin/src/services/uid.d.ts +3 -3
  253. package/dist/server/index.js +5473 -4131
  254. package/dist/server/index.js.map +1 -1
  255. package/dist/server/index.mjs +5451 -4106
  256. package/dist/server/index.mjs.map +1 -1
  257. package/dist/server/src/bootstrap.d.ts.map +1 -1
  258. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  259. package/dist/server/src/controllers/index.d.ts.map +1 -1
  260. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  261. package/dist/server/src/controllers/utils/metadata.d.ts +17 -2
  262. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  263. package/dist/server/src/history/controllers/history-version.d.ts +1 -1
  264. package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
  265. package/dist/server/src/history/services/history.d.ts +3 -3
  266. package/dist/server/src/history/services/history.d.ts.map +1 -1
  267. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  268. package/dist/server/src/history/services/utils.d.ts +7 -11
  269. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  270. package/dist/server/src/index.d.ts +7 -6
  271. package/dist/server/src/index.d.ts.map +1 -1
  272. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  273. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  274. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  275. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  276. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  277. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  278. package/dist/server/src/preview/index.d.ts +4 -0
  279. package/dist/server/src/preview/index.d.ts.map +1 -0
  280. package/dist/server/src/preview/routes/index.d.ts +8 -0
  281. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  282. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  283. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  284. package/dist/server/src/preview/services/index.d.ts +16 -0
  285. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  286. package/dist/server/src/preview/services/preview-config.d.ts +32 -0
  287. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  288. package/dist/server/src/preview/services/preview.d.ts +12 -0
  289. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  290. package/dist/server/src/preview/utils.d.ts +19 -0
  291. package/dist/server/src/preview/utils.d.ts.map +1 -0
  292. package/dist/server/src/register.d.ts.map +1 -1
  293. package/dist/server/src/routes/index.d.ts.map +1 -1
  294. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  295. package/dist/server/src/services/document-metadata.d.ts +12 -10
  296. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  297. package/dist/server/src/services/index.d.ts +7 -6
  298. package/dist/server/src/services/index.d.ts.map +1 -1
  299. package/dist/server/src/services/utils/count.d.ts +1 -1
  300. package/dist/server/src/services/utils/count.d.ts.map +1 -1
  301. package/dist/server/src/services/utils/populate.d.ts +3 -3
  302. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  303. package/dist/server/src/utils/index.d.ts +2 -0
  304. package/dist/server/src/utils/index.d.ts.map +1 -1
  305. package/dist/shared/contracts/collection-types.d.ts +3 -2
  306. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  307. package/dist/shared/contracts/components.d.ts +0 -1
  308. package/dist/shared/contracts/content-types.d.ts +0 -1
  309. package/dist/shared/contracts/history-versions.d.ts +0 -1
  310. package/dist/shared/contracts/index.d.ts +1 -1
  311. package/dist/shared/contracts/index.d.ts.map +1 -1
  312. package/dist/shared/contracts/init.d.ts +0 -1
  313. package/dist/shared/contracts/preview.d.ts +26 -0
  314. package/dist/shared/contracts/preview.d.ts.map +1 -0
  315. package/dist/shared/contracts/relations.d.ts +1 -2
  316. package/dist/shared/contracts/relations.d.ts.map +1 -1
  317. package/dist/shared/contracts/review-workflows.d.ts +0 -1
  318. package/dist/shared/contracts/single-types.d.ts +0 -1
  319. package/dist/shared/contracts/uid.d.ts +0 -1
  320. package/dist/shared/index.d.ts +0 -1
  321. package/dist/shared/index.js +37 -22
  322. package/dist/shared/index.js.map +1 -1
  323. package/dist/shared/index.mjs +36 -23
  324. package/dist/shared/index.mjs.map +1 -1
  325. package/package.json +25 -21
  326. package/dist/_chunks/CardDragPreview-C0QyJgRA.js +0 -69
  327. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +0 -1
  328. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs +0 -70
  329. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +0 -1
  330. package/dist/_chunks/ComponentConfigurationPage-D_M8iBw5.js +0 -255
  331. package/dist/_chunks/ComponentConfigurationPage-D_M8iBw5.js.map +0 -1
  332. package/dist/_chunks/ComponentConfigurationPage-qemkOlnj.mjs +0 -236
  333. package/dist/_chunks/ComponentConfigurationPage-qemkOlnj.mjs.map +0 -1
  334. package/dist/_chunks/ComponentIcon-BXdiCGQp.js +0 -176
  335. package/dist/_chunks/ComponentIcon-BXdiCGQp.js.map +0 -1
  336. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs +0 -157
  337. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +0 -1
  338. package/dist/_chunks/EditConfigurationPage-BePwPuHy.js +0 -151
  339. package/dist/_chunks/EditConfigurationPage-BePwPuHy.js.map +0 -1
  340. package/dist/_chunks/EditConfigurationPage-CjUrEewK.mjs +0 -132
  341. package/dist/_chunks/EditConfigurationPage-CjUrEewK.mjs.map +0 -1
  342. package/dist/_chunks/EditViewPage-B-RJeiJD.js +0 -233
  343. package/dist/_chunks/EditViewPage-B-RJeiJD.js.map +0 -1
  344. package/dist/_chunks/EditViewPage-De8GyU8P.mjs +0 -214
  345. package/dist/_chunks/EditViewPage-De8GyU8P.mjs.map +0 -1
  346. package/dist/_chunks/Field-dq8Tg1M_.js +0 -5589
  347. package/dist/_chunks/Field-dq8Tg1M_.js.map +0 -1
  348. package/dist/_chunks/Field-pb2o8uBe.mjs +0 -5557
  349. package/dist/_chunks/Field-pb2o8uBe.mjs.map +0 -1
  350. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs +0 -50
  351. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +0 -1
  352. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js +0 -49
  353. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +0 -1
  354. package/dist/_chunks/Form-DGIf4jQU.js +0 -771
  355. package/dist/_chunks/Form-DGIf4jQU.js.map +0 -1
  356. package/dist/_chunks/Form-DJn0Dxha.mjs +0 -750
  357. package/dist/_chunks/Form-DJn0Dxha.mjs.map +0 -1
  358. package/dist/_chunks/History-BowL3JKP.mjs +0 -1032
  359. package/dist/_chunks/History-BowL3JKP.mjs.map +0 -1
  360. package/dist/_chunks/History-Dh2NEHnR.js +0 -1053
  361. package/dist/_chunks/History-Dh2NEHnR.js.map +0 -1
  362. package/dist/_chunks/ListConfigurationPage-BpVOB-hn.mjs +0 -632
  363. package/dist/_chunks/ListConfigurationPage-BpVOB-hn.mjs.map +0 -1
  364. package/dist/_chunks/ListConfigurationPage-BxYCWz9e.js +0 -652
  365. package/dist/_chunks/ListConfigurationPage-BxYCWz9e.js.map +0 -1
  366. package/dist/_chunks/ListViewPage-4XsciqHZ.js +0 -848
  367. package/dist/_chunks/ListViewPage-4XsciqHZ.js.map +0 -1
  368. package/dist/_chunks/ListViewPage-CXFUjZQC.mjs +0 -824
  369. package/dist/_chunks/ListViewPage-CXFUjZQC.mjs.map +0 -1
  370. package/dist/_chunks/NoContentTypePage-C8OpoHeU.js +0 -51
  371. package/dist/_chunks/NoContentTypePage-C8OpoHeU.js.map +0 -1
  372. package/dist/_chunks/NoContentTypePage-DuhOTp3x.mjs +0 -51
  373. package/dist/_chunks/NoContentTypePage-DuhOTp3x.mjs.map +0 -1
  374. package/dist/_chunks/NoPermissionsPage-DVz3mzDz.mjs +0 -23
  375. package/dist/_chunks/NoPermissionsPage-DVz3mzDz.mjs.map +0 -1
  376. package/dist/_chunks/NoPermissionsPage-y_r7DVA2.js +0 -23
  377. package/dist/_chunks/NoPermissionsPage-y_r7DVA2.js.map +0 -1
  378. package/dist/_chunks/Relations-CVNLrn1Y.mjs +0 -694
  379. package/dist/_chunks/Relations-CVNLrn1Y.mjs.map +0 -1
  380. package/dist/_chunks/Relations-DPFCAa7b.js +0 -714
  381. package/dist/_chunks/Relations-DPFCAa7b.js.map +0 -1
  382. package/dist/_chunks/ar-BUUWXIYu.js +0 -226
  383. package/dist/_chunks/ar-BUUWXIYu.js.map +0 -1
  384. package/dist/_chunks/ar-CCEVvqGG.mjs +0 -226
  385. package/dist/_chunks/ca-5U32ON2v.mjs +0 -201
  386. package/dist/_chunks/ca-Cmk45QO6.js +0 -201
  387. package/dist/_chunks/cs-CM2aBUar.mjs +0 -125
  388. package/dist/_chunks/cs-CkJy6B2v.js +0 -125
  389. package/dist/_chunks/de-C72KDNOl.mjs +0 -199
  390. package/dist/_chunks/de-CCEmbAah.js +0 -199
  391. package/dist/_chunks/en-BrCTWlZv.mjs +0 -292
  392. package/dist/_chunks/en-uOUIxfcQ.js +0 -292
  393. package/dist/_chunks/es-CeXiYflN.mjs +0 -196
  394. package/dist/_chunks/es-EUonQTon.js +0 -196
  395. package/dist/_chunks/eu-CdALomew.mjs +0 -202
  396. package/dist/_chunks/eu-VDH-3ovk.js +0 -202
  397. package/dist/_chunks/fr-B7kGGg3E.js +0 -206
  398. package/dist/_chunks/fr-B7kGGg3E.js.map +0 -1
  399. package/dist/_chunks/fr-CD9VFbPM.mjs +0 -206
  400. package/dist/_chunks/fr-CD9VFbPM.mjs.map +0 -1
  401. package/dist/_chunks/gu-BRmF601H.js +0 -200
  402. package/dist/_chunks/gu-CNpaMDpH.mjs +0 -200
  403. package/dist/_chunks/gu-CNpaMDpH.mjs.map +0 -1
  404. package/dist/_chunks/hi-CCJBptSq.js +0 -200
  405. package/dist/_chunks/hi-CCJBptSq.js.map +0 -1
  406. package/dist/_chunks/hi-Dwvd04m3.mjs +0 -200
  407. package/dist/_chunks/hi-Dwvd04m3.mjs.map +0 -1
  408. package/dist/_chunks/hooks-BAaaKPS_.js.map +0 -1
  409. package/dist/_chunks/hooks-E5u1mcgM.mjs +0 -8
  410. package/dist/_chunks/hooks-E5u1mcgM.mjs.map +0 -1
  411. package/dist/_chunks/hu-CeYvaaO0.mjs +0 -202
  412. package/dist/_chunks/hu-CeYvaaO0.mjs.map +0 -1
  413. package/dist/_chunks/hu-sNV_yLYy.js +0 -202
  414. package/dist/_chunks/hu-sNV_yLYy.js.map +0 -1
  415. package/dist/_chunks/id-B5Ser98A.js +0 -160
  416. package/dist/_chunks/id-B5Ser98A.js.map +0 -1
  417. package/dist/_chunks/id-BtwA9WJT.mjs +0 -160
  418. package/dist/_chunks/index-C3fJE-1-.js +0 -3999
  419. package/dist/_chunks/index-C3fJE-1-.js.map +0 -1
  420. package/dist/_chunks/index-DiMrfcfy.mjs +0 -3980
  421. package/dist/_chunks/index-DiMrfcfy.mjs.map +0 -1
  422. package/dist/_chunks/it-BrVPqaf1.mjs +0 -162
  423. package/dist/_chunks/it-DkBIs7vD.js +0 -162
  424. package/dist/_chunks/ja-CcFe8diO.js +0 -196
  425. package/dist/_chunks/ja-CtsUxOvk.mjs +0 -196
  426. package/dist/_chunks/ko-HVQRlfUI.mjs +0 -195
  427. package/dist/_chunks/ko-woFZPmLk.js +0 -195
  428. package/dist/_chunks/layout-C788OmNr.js +0 -488
  429. package/dist/_chunks/layout-C788OmNr.js.map +0 -1
  430. package/dist/_chunks/layout-ls3gxfpH.mjs +0 -470
  431. package/dist/_chunks/layout-ls3gxfpH.mjs.map +0 -1
  432. package/dist/_chunks/ml-BihZwQit.mjs +0 -200
  433. package/dist/_chunks/ml-BihZwQit.mjs.map +0 -1
  434. package/dist/_chunks/ml-C2W8N8k1.js +0 -200
  435. package/dist/_chunks/ml-C2W8N8k1.js.map +0 -1
  436. package/dist/_chunks/ms-BuFotyP_.js +0 -144
  437. package/dist/_chunks/ms-m_WjyWx7.mjs +0 -144
  438. package/dist/_chunks/nl-D4R9gHx5.mjs +0 -202
  439. package/dist/_chunks/nl-D4R9gHx5.mjs.map +0 -1
  440. package/dist/_chunks/nl-bbEOHChV.js +0 -202
  441. package/dist/_chunks/nl-bbEOHChV.js.map +0 -1
  442. package/dist/_chunks/objects-gigeqt7s.js +0 -49
  443. package/dist/_chunks/objects-gigeqt7s.js.map +0 -1
  444. package/dist/_chunks/objects-mKMAmfec.mjs +0 -47
  445. package/dist/_chunks/objects-mKMAmfec.mjs.map +0 -1
  446. package/dist/_chunks/pl-sbx9mSt_.mjs +0 -199
  447. package/dist/_chunks/pl-sbx9mSt_.mjs.map +0 -1
  448. package/dist/_chunks/pl-uzwG-hk7.js +0 -199
  449. package/dist/_chunks/pl-uzwG-hk7.js.map +0 -1
  450. package/dist/_chunks/pt-BR-BiOz37D9.js +0 -201
  451. package/dist/_chunks/pt-BR-C71iDxnh.mjs +0 -201
  452. package/dist/_chunks/pt-BsaFvS8-.mjs +0 -95
  453. package/dist/_chunks/pt-BsaFvS8-.mjs.map +0 -1
  454. package/dist/_chunks/pt-CeXQuq50.js +0 -95
  455. package/dist/_chunks/pt-CeXQuq50.js.map +0 -1
  456. package/dist/_chunks/relations-CLcOmGO0.mjs +0 -135
  457. package/dist/_chunks/relations-CLcOmGO0.mjs.map +0 -1
  458. package/dist/_chunks/relations-DYeotliT.js +0 -134
  459. package/dist/_chunks/relations-DYeotliT.js.map +0 -1
  460. package/dist/_chunks/ru-BE6A4Exp.mjs +0 -231
  461. package/dist/_chunks/ru-BT3ybNny.js +0 -231
  462. package/dist/_chunks/sa-CcvkYInH.js +0 -200
  463. package/dist/_chunks/sa-CcvkYInH.js.map +0 -1
  464. package/dist/_chunks/sa-Dag0k-Z8.mjs +0 -200
  465. package/dist/_chunks/sa-Dag0k-Z8.mjs.map +0 -1
  466. package/dist/_chunks/sk-BFg-R8qJ.mjs +0 -202
  467. package/dist/_chunks/sk-BFg-R8qJ.mjs.map +0 -1
  468. package/dist/_chunks/sk-CvY09Xjv.js +0 -202
  469. package/dist/_chunks/sk-CvY09Xjv.js.map +0 -1
  470. package/dist/_chunks/sv-CUnfWGsh.mjs +0 -202
  471. package/dist/_chunks/sv-CUnfWGsh.mjs.map +0 -1
  472. package/dist/_chunks/sv-MYDuzgvT.js +0 -202
  473. package/dist/_chunks/sv-MYDuzgvT.js.map +0 -1
  474. package/dist/_chunks/th-BqbI8lIT.mjs +0 -148
  475. package/dist/_chunks/th-BqbI8lIT.mjs.map +0 -1
  476. package/dist/_chunks/th-D9_GfAjc.js +0 -148
  477. package/dist/_chunks/tr-CgeK3wJM.mjs +0 -199
  478. package/dist/_chunks/tr-CgeK3wJM.mjs.map +0 -1
  479. package/dist/_chunks/tr-D9UH-O_R.js +0 -199
  480. package/dist/_chunks/tr-D9UH-O_R.js.map +0 -1
  481. package/dist/_chunks/uk-C8EiqJY7.js +0 -144
  482. package/dist/_chunks/uk-C8EiqJY7.js.map +0 -1
  483. package/dist/_chunks/uk-CR-zDhAY.mjs +0 -144
  484. package/dist/_chunks/useDragAndDrop-DdHgKsqq.mjs +0 -231
  485. package/dist/_chunks/useDragAndDrop-DdHgKsqq.mjs.map +0 -1
  486. package/dist/_chunks/useDragAndDrop-J0TUUbR6.js +0 -249
  487. package/dist/_chunks/useDragAndDrop-J0TUUbR6.js.map +0 -1
  488. package/dist/_chunks/usePrev-B9w_-eYc.js +0 -15
  489. package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
  490. package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
  491. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
  492. package/dist/_chunks/vi-CJlYDheJ.js +0 -111
  493. package/dist/_chunks/vi-DUXIk_fw.mjs +0 -111
  494. package/dist/_chunks/zh-BWZspA60.mjs +0 -209
  495. package/dist/_chunks/zh-BWZspA60.mjs.map +0 -1
  496. package/dist/_chunks/zh-CQQfszqR.js +0 -209
  497. package/dist/_chunks/zh-CQQfszqR.js.map +0 -1
  498. package/dist/_chunks/zh-Hans-9kOncHGw.js +0 -952
  499. package/dist/_chunks/zh-Hans-BPQcRIyH.mjs +0 -952
  500. package/strapi-server.js +0 -3
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditConfigurationPage-CjUrEewK.mjs","sources":["../../admin/src/pages/EditConfigurationPage.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Page, useNotification, useTracking, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { useDoc } from '../hooks/useDocument';\nimport { useDocLayout } from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport { useUpdateContentTypeConfigurationMutation } from '../services/contentTypes';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\nconst EditConfigurationPage = () => {\n const { trackUsage } = useTracking();\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n const { isLoading: isLoadingSchema, schema, model } = useDoc();\n const { isLoading: isLoadingLayout, error, list, edit } = useDocLayout();\n\n const {\n fieldSizes,\n error: errorFieldSizes,\n isLoading: isLoadingFieldSizes,\n isFetching: isFetchingFieldSizes,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const fieldSizes = Object.entries(res.data?.fieldSizes ?? {}).reduce<\n ConfigurationFormProps['fieldSizes']\n >((acc, [attributeName, { default: size }]) => {\n acc[attributeName] = size;\n\n return acc;\n }, {});\n\n return {\n isFetching: res.isFetching,\n isLoading: res.isLoading,\n error: res.error,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorFieldSizes) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorFieldSizes),\n });\n }\n }, [errorFieldSizes, formatAPIError, toggleNotification]);\n\n const isLoading =\n isLoadingSchema || isLoadingLayout || isLoadingFieldSizes || isFetchingFieldSizes;\n\n const [updateConfiguration] = useUpdateContentTypeConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (data) => {\n try {\n trackUsage('willSaveContentTypeLayout');\n\n /**\n * We reconstruct the metadatas object by taking the existing list metadatas\n * and re-merging that by attribute name with the current list metadatas, whilst overwriting\n * the data from the form we've built.\n */\n const meta = Object.entries(list.metadatas).reduce<Metadatas>(\n (acc, [name, { mainField: _mainField, ...listMeta }]) => {\n const existingEditMeta = edit.metadatas[name];\n\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = data.layout.flatMap((row) => row.children).find((field) => field.name === name) ?? {};\n\n acc[name] = {\n edit: {\n ...existingEditMeta,\n ...editedMetadata,\n },\n list: listMeta,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: data.layout.map((row) =>\n row.children.reduce<Array<{ name: string; size: number }>>((acc, { name, size }) => {\n if (name !== TEMP_FIELD_NAME) {\n return [...acc, { name, size }];\n }\n\n return acc;\n }, [])\n ),\n list: list.layout.map((field) => field.name),\n },\n settings: setIn(data.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\n trackUsage('didEditEditSettings');\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.success.saved', defaultMessage: 'Saved' }),\n });\n } else {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n }\n } catch {\n toggleNotification({\n type: 'danger',\n message: formatMessage({ id: 'notification.error', defaultMessage: 'An error occurred' }),\n });\n }\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (errorFieldSizes || error || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${edit.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={edit}\n />\n </>\n );\n};\n\nconst ProtectedEditConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.collectionTypesConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <EditConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ProtectedEditConfigurationPage, EditConfigurationPage };\n"],"names":["fieldSizes"],"mappings":";;;;;;;;AAgBA,MAAM,wBAAwB,MAAM;AAC5B,QAAA,EAAE,eAAe;AACjB,QAAA,EAAE,kBAAkB;AACpB,QAAA,EAAE,uBAAuB;AAC/B,QAAM,EAAE,yBAAyB,eAAe,IAAI,mBAAmB;AACvE,QAAM,EAAE,WAAW,iBAAiB,QAAQ,MAAA,IAAU;AACtD,QAAM,EAAE,WAAW,iBAAiB,OAAO,MAAM,KAAA,IAAS;AAEpD,QAAA;AAAA,IACJ;AAAA,IACA,OAAO;AAAA,IACP,WAAW;AAAA,IACX,YAAY;AAAA,EAAA,IACV,uBAAuB,QAAW;AAAA,IACpC,kBAAkB,CAAC,QAAQ;AACzB,YAAMA,cAAa,OAAO,QAAQ,IAAI,MAAM,cAAc,CAAE,CAAA,EAAE,OAE5D,CAAC,KAAK,CAAC,eAAe,EAAE,SAAS,KAAA,CAAM,MAAM;AAC7C,YAAI,aAAa,IAAI;AAEd,eAAA;AAAA,MACT,GAAG,CAAE,CAAA;AAEE,aAAA;AAAA,QACL,YAAY,IAAI;AAAA,QAChB,WAAW,IAAI;AAAA,QACf,OAAO,IAAI;AAAA,QACX,YAAAA;AAAAA,MAAA;AAAA,IAEJ;AAAA,EAAA,CACD;AAED,QAAM,UAAU,MAAM;AACpB,QAAI,iBAAiB;AACA,yBAAA;AAAA,QACjB,MAAM;AAAA,QACN,SAAS,eAAe,eAAe;AAAA,MAAA,CACxC;AAAA,IACH;AAAA,EACC,GAAA,CAAC,iBAAiB,gBAAgB,kBAAkB,CAAC;AAElD,QAAA,YACJ,mBAAmB,mBAAmB,uBAAuB;AAEzD,QAAA,CAAC,mBAAmB,IAAI;AACxB,QAAA,eAAm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UACjB,MAAM;AAAA,UACN,SAAS,eAAe,IAAI,KAAK;AAAA,QAAA,CAClC;AAAA,MACH;AAAA,IAAA,QACM;AACa,yBAAA;AAAA,QACjB,MAAM;AAAA,QACN,SAAS,cAAc,EAAE,IAAI,sBAAsB,gBAAgB,qBAAqB;AAAA,MAAA,CACzF;AAAA,IACH;AAAA,EAAA;AAGF,MAAI,WAAW;AACN,WAAA,oBAAC,KAAK,SAAL,CAAa,CAAA;AAAA,EACvB;AAEI,MAAA,mBAAmB,SAAS,CAAC,QAAQ;AAChC,WAAA,oBAAC,KAAK,OAAL,CAAW,CAAA;AAAA,EACrB;AAEA,SAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,IAAA,oBAAC,KAAK,OAAL,EAAY,uBAAa,KAAK,SAAS,WAAW,aAAa,CAAA;AAAA,IAChE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,UAAU;AAAA,QACV,YAAY,OAAO;AAAA,QACnB;AAAA,QACA,QAAQ;AAAA,MAAA;AAAA,IACV;AAAA,EACF,EAAA,CAAA;AAEJ;AAEA,MAAM,iCAAiC,MAAM;AAC3C,QAAM,cAAc;AAAA,IAClB,CAAC,UAAU,MAAM,UAAU,YAAY,gBAAgB;AAAA,EAAA;AAGzD,6BACG,KAAK,SAAL,EAAa,aACZ,UAAA,oBAAC,yBAAsB,EACzB,CAAA;AAEJ;"}
@@ -1,233 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
5
- const strapiAdmin = require("@strapi/admin/strapi-admin");
6
- const designSystem = require("@strapi/design-system");
7
- const reactIntl = require("react-intl");
8
- const reactRouterDom = require("react-router-dom");
9
- const styledComponents = require("styled-components");
10
- const index = require("./index-C3fJE-1-.js");
11
- const Field = require("./Field-dq8Tg1M_.js");
12
- function _interopNamespace(e) {
13
- if (e && e.__esModule)
14
- return e;
15
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
16
- if (e) {
17
- for (const k in e) {
18
- if (k !== "default") {
19
- const d = Object.getOwnPropertyDescriptor(e, k);
20
- Object.defineProperty(n, k, d.get ? d : {
21
- enumerable: true,
22
- get: () => e[k]
23
- });
24
- }
25
- }
26
- }
27
- n.default = e;
28
- return Object.freeze(n);
29
- }
30
- const React__namespace = /* @__PURE__ */ _interopNamespace(React);
31
- const useOnce = (effect) => React__namespace.useEffect(effect, emptyDeps);
32
- const emptyDeps = [];
33
- const FormLayout = ({ layout }) => {
34
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((panel, index2) => {
35
- if (panel.some((row) => row.some((field) => field.type === "dynamiczone"))) {
36
- const [row] = panel;
37
- const [field] = row;
38
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, s: 12, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(Field.MemoizedInputRenderer, { ...field }) }) }, field.name);
39
- }
40
- return /* @__PURE__ */ jsxRuntime.jsx(
41
- designSystem.Box,
42
- {
43
- hasRadius: true,
44
- background: "neutral0",
45
- shadow: "tableShadow",
46
- paddingLeft: 6,
47
- paddingRight: 6,
48
- paddingTop: 6,
49
- paddingBottom: 6,
50
- borderColor: "neutral150",
51
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: panel.map((row, gridRowIndex) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
52
- return /* @__PURE__ */ jsxRuntime.jsx(
53
- designSystem.Grid.Item,
54
- {
55
- col: size,
56
- s: 12,
57
- xs: 12,
58
- direction: "column",
59
- alignItems: "stretch",
60
- children: /* @__PURE__ */ jsxRuntime.jsx(Field.MemoizedInputRenderer, { ...field })
61
- },
62
- field.name
63
- );
64
- }) }, gridRowIndex)) })
65
- },
66
- index2
67
- );
68
- }) });
69
- };
70
- const EditViewPage = () => {
71
- const location = reactRouterDom.useLocation();
72
- const [
73
- {
74
- query: { status }
75
- },
76
- setQuery
77
- ] = strapiAdmin.useQueryParams({
78
- status: "draft"
79
- });
80
- const { formatMessage } = reactIntl.useIntl();
81
- const { toggleNotification } = strapiAdmin.useNotification();
82
- const {
83
- document,
84
- meta,
85
- isLoading: isLoadingDocument,
86
- schema,
87
- components,
88
- collectionType,
89
- id,
90
- model
91
- } = index.useDoc();
92
- const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;
93
- useOnce(() => {
94
- if (location?.state && "error" in location.state) {
95
- toggleNotification({
96
- type: "danger",
97
- message: location.state.error,
98
- timeout: 5e3
99
- });
100
- }
101
- });
102
- const isLoadingActionsRBAC = index.useDocumentRBAC("EditViewPage", (state) => state.isLoading);
103
- const isSingleType = collectionType === index.SINGLE_TYPES;
104
- const isCreatingDocument = !id && !isSingleType;
105
- const {
106
- isLoading: isLoadingLayout,
107
- edit: {
108
- layout,
109
- settings: { mainField }
110
- }
111
- } = index.useDocumentLayout(model);
112
- const { isLazyLoading } = Field.useLazyComponents([]);
113
- const isLoading = isLoadingActionsRBAC || isLoadingDocument || isLoadingLayout || isLazyLoading;
114
- const initialValues = React__namespace.useMemo(() => {
115
- if (!document && !isCreatingDocument && !isSingleType || !schema) {
116
- return void 0;
117
- }
118
- const form = document?.id ? document : Field.createDefaultForm(schema, components);
119
- return Field.transformDocument(schema, components)(form);
120
- }, [document, isCreatingDocument, isSingleType, schema, components]);
121
- if (isLoading && !document?.documentId) {
122
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
123
- }
124
- if (!initialValues) {
125
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
126
- }
127
- const handleTabChange = (status2) => {
128
- if (status2 === "published" || status2 === "draft") {
129
- setQuery({ status: status2 }, "push", true);
130
- }
131
- };
132
- const documentTitle = mainField !== "id" && document?.[mainField] ? document[mainField] : "Untitled";
133
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { paddingLeft: 10, paddingRight: 10, children: [
134
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Title, { children: `${documentTitle}` }),
135
- /* @__PURE__ */ jsxRuntime.jsx(
136
- strapiAdmin.Form,
137
- {
138
- disabled: hasDraftAndPublished && status === "published",
139
- initialValues,
140
- method: isCreatingDocument ? "POST" : "PUT",
141
- validationSchema: index.createYupSchema(schema?.attributes, components, { status }),
142
- children: ({ resetForm }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
143
- /* @__PURE__ */ jsxRuntime.jsx(
144
- index.Header,
145
- {
146
- isCreating: isCreatingDocument,
147
- status: hasDraftAndPublished ? getDocumentStatus(document, meta) : void 0,
148
- title: documentTitle
149
- }
150
- ),
151
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.Root, { variant: "simple", value: status, onValueChange: handleTabChange, children: [
152
- /* @__PURE__ */ jsxRuntime.jsx(
153
- designSystem.Tabs.List,
154
- {
155
- "aria-label": formatMessage({
156
- id: index.getTranslation("containers.edit.tabs.label"),
157
- defaultMessage: "Document status"
158
- }),
159
- children: hasDraftAndPublished ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
160
- /* @__PURE__ */ jsxRuntime.jsx(StatusTab, { value: "draft", children: formatMessage({
161
- id: index.getTranslation("containers.edit.tabs.draft"),
162
- defaultMessage: "draft"
163
- }) }),
164
- /* @__PURE__ */ jsxRuntime.jsx(
165
- StatusTab,
166
- {
167
- disabled: !meta || meta.availableStatus.length === 0,
168
- value: "published",
169
- children: formatMessage({
170
- id: index.getTranslation("containers.edit.tabs.published"),
171
- defaultMessage: "published"
172
- })
173
- }
174
- )
175
- ] }) : null
176
- }
177
- ),
178
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { paddingTop: 8, gap: 4, children: [
179
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Item, { col: 9, s: 12, direction: "column", alignItems: "stretch", children: [
180
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "draft", children: /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { layout }) }),
181
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "published", children: /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { layout }) })
182
- ] }),
183
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, s: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(index.Panels, {}) })
184
- ] })
185
- ] }),
186
- /* @__PURE__ */ jsxRuntime.jsx(
187
- strapiAdmin.Blocker,
188
- {
189
- onProceed: resetForm
190
- }
191
- )
192
- ] })
193
- }
194
- )
195
- ] });
196
- };
197
- const StatusTab = styledComponents.styled(designSystem.Tabs.Trigger)`
198
- text-transform: uppercase;
199
- `;
200
- const getDocumentStatus = (document, meta) => {
201
- const docStatus = document?.status;
202
- const statuses = meta?.availableStatus ?? [];
203
- if (!docStatus) {
204
- return "draft";
205
- }
206
- if (docStatus === "draft" && statuses.find((doc) => doc.publishedAt !== null)) {
207
- return "published";
208
- }
209
- return docStatus;
210
- };
211
- const ProtectedEditViewPage = () => {
212
- const { slug = "" } = reactRouterDom.useParams();
213
- const {
214
- permissions = [],
215
- isLoading,
216
- error
217
- } = strapiAdmin.useRBAC(
218
- index.PERMISSIONS.map((action) => ({
219
- action,
220
- subject: slug
221
- }))
222
- );
223
- if (isLoading) {
224
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
225
- }
226
- if (error || !slug) {
227
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
228
- }
229
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: ({ permissions: permissions2 }) => /* @__PURE__ */ jsxRuntime.jsx(index.DocumentRBAC, { permissions: permissions2, children: /* @__PURE__ */ jsxRuntime.jsx(EditViewPage, {}) }) });
230
- };
231
- exports.EditViewPage = EditViewPage;
232
- exports.ProtectedEditViewPage = ProtectedEditViewPage;
233
- //# sourceMappingURL=EditViewPage-B-RJeiJD.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditViewPage-B-RJeiJD.js","sources":["../../admin/src/hooks/useOnce.ts","../../admin/src/pages/EditView/components/FormLayout.tsx","../../admin/src/pages/EditView/EditViewPage.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport * as React from 'react';\n\nexport const useOnce = (effect: React.EffectCallback) => React.useEffect(effect, emptyDeps);\n\nconst emptyDeps: React.DependencyList = [];\n","import { Box, Flex, Grid } from '@strapi/design-system';\n\nimport { EditLayout } from '../../../hooks/useDocumentLayout';\n\nimport { InputRenderer } from './InputRenderer';\n\ninterface FormLayoutProps extends Pick<EditLayout, 'layout'> {}\n\nconst FormLayout = ({ layout }: FormLayoutProps) => {\n return (\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {layout.map((panel, index) => {\n if (panel.some((row) => row.some((field) => field.type === 'dynamiczone'))) {\n const [row] = panel;\n const [field] = row;\n return (\n <Grid.Root key={field.name} gap={4}>\n <Grid.Item col={12} s={12} xs={12} direction=\"column\" alignItems=\"stretch\">\n <InputRenderer {...field} />\n </Grid.Item>\n </Grid.Root>\n );\n }\n\n return (\n <Box\n key={index}\n hasRadius\n background=\"neutral0\"\n shadow=\"tableShadow\"\n paddingLeft={6}\n paddingRight={6}\n paddingTop={6}\n paddingBottom={6}\n borderColor=\"neutral150\"\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {panel.map((row, gridRowIndex) => (\n <Grid.Root key={gridRowIndex} gap={4}>\n {row.map(({ size, ...field }) => {\n return (\n <Grid.Item\n col={size}\n key={field.name}\n s={12}\n xs={12}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <InputRenderer {...field} />\n </Grid.Item>\n );\n })}\n </Grid.Root>\n ))}\n </Flex>\n </Box>\n );\n })}\n </Flex>\n );\n};\n\nexport { FormLayout, FormLayoutProps };\n","import * as React from 'react';\n\nimport {\n Page,\n Blocker,\n Form,\n useRBAC,\n useNotification,\n useQueryParams,\n} from '@strapi/admin/strapi-admin';\nimport { Grid, Main, Tabs } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { useLocation, useParams } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { SINGLE_TYPES } from '../../constants/collections';\nimport { PERMISSIONS } from '../../constants/plugin';\nimport { DocumentRBAC, useDocumentRBAC } from '../../features/DocumentRBAC';\nimport { type UseDocument, useDoc } from '../../hooks/useDocument';\nimport { useDocumentLayout } from '../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../hooks/useLazyComponents';\nimport { useOnce } from '../../hooks/useOnce';\nimport { getTranslation } from '../../utils/translations';\nimport { createYupSchema } from '../../utils/validation';\n\nimport { FormLayout } from './components/FormLayout';\nimport { Header } from './components/Header';\nimport { Panels } from './components/Panels';\nimport { transformDocument } from './utils/data';\nimport { createDefaultForm } from './utils/forms';\n\n/* -------------------------------------------------------------------------------------------------\n * EditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst EditViewPage = () => {\n const location = useLocation();\n const [\n {\n query: { status },\n },\n setQuery,\n ] = useQueryParams<{ status: 'draft' | 'published' }>({\n status: 'draft',\n });\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n\n const {\n document,\n meta,\n isLoading: isLoadingDocument,\n schema,\n components,\n collectionType,\n id,\n model,\n } = useDoc();\n\n const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;\n\n useOnce(() => {\n /**\n * We only ever want to fire the notification once otherwise\n * whenever the app re-renders it'll pop up regardless of\n * what we do because the state comes from react-router-dom\n */\n if (location?.state && 'error' in location.state) {\n toggleNotification({\n type: 'danger',\n message: location.state.error,\n timeout: 5000,\n });\n }\n });\n\n const isLoadingActionsRBAC = useDocumentRBAC('EditViewPage', (state) => state.isLoading);\n\n const isSingleType = collectionType === SINGLE_TYPES;\n\n /**\n * single-types don't current have an id, but because they're a singleton\n * we can simply use the update operation to continuously update the same\n * document with varying params.\n */\n const isCreatingDocument = !id && !isSingleType;\n\n const {\n isLoading: isLoadingLayout,\n edit: {\n layout,\n settings: { mainField },\n },\n } = useDocumentLayout(model);\n\n const { isLazyLoading } = useLazyComponents([]);\n\n const isLoading = isLoadingActionsRBAC || isLoadingDocument || isLoadingLayout || isLazyLoading;\n\n /**\n * Here we prepare the form for editing, we need to:\n * - remove prohibited fields from the document (passwords | ADD YOURS WHEN THERES A NEW ONE)\n * - swap out count objects on relations for empty arrays\n * - set __temp_key__ on array objects for drag & drop\n *\n * We also prepare the form for new documents, so we need to:\n * - set default values on fields\n */\n const initialValues = React.useMemo(() => {\n if ((!document && !isCreatingDocument && !isSingleType) || !schema) {\n return undefined;\n }\n\n /**\n * Check that we have an ID so we know the\n * document has been created in some way.\n */\n const form = document?.id ? document : createDefaultForm(schema, components);\n\n return transformDocument(schema, components)(form);\n }, [document, isCreatingDocument, isSingleType, schema, components]);\n\n if (isLoading && !document?.documentId) {\n return <Page.Loading />;\n }\n\n if (!initialValues) {\n return <Page.Error />;\n }\n\n const handleTabChange = (status: string) => {\n if (status === 'published' || status === 'draft') {\n setQuery({ status }, 'push', true);\n }\n };\n\n /**\n * We look to see what the mainField is from the configuration,\n * if it's an id we don't use it because it's a uuid format and\n * not very user friendly. Instead in that case, we simply write \"Untitled\".\n */\n const documentTitle =\n mainField !== 'id' && document?.[mainField] ? document[mainField] : 'Untitled';\n\n return (\n <Main paddingLeft={10} paddingRight={10}>\n <Page.Title>{`${documentTitle}`}</Page.Title>\n <Form\n disabled={hasDraftAndPublished && status === 'published'}\n initialValues={initialValues}\n method={isCreatingDocument ? 'POST' : 'PUT'}\n validationSchema={createYupSchema(schema?.attributes, components, { status })}\n >\n {({ resetForm }) => (\n <>\n <Header\n isCreating={isCreatingDocument}\n status={hasDraftAndPublished ? getDocumentStatus(document, meta) : undefined}\n title={documentTitle}\n />\n <Tabs.Root variant=\"simple\" value={status} onValueChange={handleTabChange}>\n <Tabs.List\n aria-label={formatMessage({\n id: getTranslation('containers.edit.tabs.label'),\n defaultMessage: 'Document status',\n })}\n >\n {hasDraftAndPublished ? (\n <>\n <StatusTab value=\"draft\">\n {formatMessage({\n id: getTranslation('containers.edit.tabs.draft'),\n defaultMessage: 'draft',\n })}\n </StatusTab>\n <StatusTab\n disabled={!meta || meta.availableStatus.length === 0}\n value=\"published\"\n >\n {formatMessage({\n id: getTranslation('containers.edit.tabs.published'),\n defaultMessage: 'published',\n })}\n </StatusTab>\n </>\n ) : null}\n </Tabs.List>\n <Grid.Root paddingTop={8} gap={4}>\n <Grid.Item col={9} s={12} direction=\"column\" alignItems=\"stretch\">\n <Tabs.Content value=\"draft\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n <Tabs.Content value=\"published\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n </Grid.Item>\n <Grid.Item col={3} s={12} direction=\"column\" alignItems=\"stretch\">\n <Panels />\n </Grid.Item>\n </Grid.Root>\n </Tabs.Root>\n <Blocker\n // We reset the form to the published version to avoid errors like – https://strapi-inc.atlassian.net/browse/CONTENT-2284\n onProceed={resetForm}\n />\n </>\n )}\n </Form>\n </Main>\n );\n};\n\nconst StatusTab = styled(Tabs.Trigger)`\n text-transform: uppercase;\n`;\n\n/**\n * @internal\n * @description Returns the status of the document where it's latest state takes priority,\n * this typically will be \"published\" unless a user has edited their draft in which we should\n * display \"modified\".\n */\nconst getDocumentStatus = (\n document: ReturnType<UseDocument>['document'],\n meta: ReturnType<UseDocument>['meta']\n): 'draft' | 'published' | 'modified' => {\n const docStatus = document?.status;\n const statuses = meta?.availableStatus ?? [];\n\n /**\n * Creating an entry\n */\n if (!docStatus) {\n return 'draft';\n }\n\n /**\n * We're viewing a draft, but the document could have a published version\n */\n if (docStatus === 'draft' && statuses.find((doc) => doc.publishedAt !== null)) {\n return 'published';\n }\n\n return docStatus;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ProtectedEditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedEditViewPage = () => {\n const { slug = '' } = useParams<{\n slug: string;\n }>();\n const {\n permissions = [],\n isLoading,\n error,\n } = useRBAC(\n PERMISSIONS.map((action) => ({\n action,\n subject: slug,\n }))\n );\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || !slug) {\n return <Page.Error />;\n }\n\n return (\n <Page.Protect permissions={permissions}>\n {({ permissions }) => (\n <DocumentRBAC permissions={permissions}>\n <EditViewPage />\n </DocumentRBAC>\n )}\n </Page.Protect>\n );\n};\n\nexport { EditViewPage, ProtectedEditViewPage };\n"],"names":["React","jsx","Flex","index","Grid","InputRenderer","Box","useLocation","useQueryParams","useIntl","useNotification","useDoc","useDocumentRBAC","SINGLE_TYPES","useDocumentLayout","useLazyComponents","createDefaultForm","transformDocument","Page","status","jsxs","Main","Form","createYupSchema","Fragment","Header","Tabs","getTranslation","Panels","Blocker","styled","useParams","useRBAC","PERMISSIONS","permissions","DocumentRBAC"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,MAAM,UAAU,CAAC,WAAiCA,iBAAM,UAAU,QAAQ,SAAS;AAE1F,MAAM,YAAkC,CAAC;ACGzC,MAAM,aAAa,CAAC,EAAE,aAA8B;AAClD,SACGC,2BAAAA,IAAAC,aAAAA,MAAA,EAAK,WAAU,UAAS,YAAW,WAAU,KAAK,GAChD,UAAO,OAAA,IAAI,CAAC,OAAOC,WAAU;AAC5B,QAAI,MAAM,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,UAAU,MAAM,SAAS,aAAa,CAAC,GAAG;AACpE,YAAA,CAAC,GAAG,IAAI;AACR,YAAA,CAAC,KAAK,IAAI;AAEd,aAAAF,2BAAAA,IAACG,aAAAA,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kBAAK,OAAO;AAAA;AAAA;AAUrC,MAAM,oBAAoB,CACxB,UACA,SACuC;AACvC,QAAM,YAAY,UAAU;AACtB,QAAA,WAAW,MAAM,mBAAmB;AAK1C,MAAI,CAAC,WAAW;AACP,WAAA;AAAA,EACT;AAKI,MAAA,cAAc,WAAW,SAAS,KAAK,CAAC,QAAQ,IAAI,gBAAgB,IAAI,GAAG;AACtE,WAAA;AAAA,EACT;AAEO,SAAA;AACT;AAMA,MAAM,wBAAwB,MAAM;AAClC,QAAM,EAAE,OAAO,GAAG,IAAIK,eAEnB,UAAA;AACG,QAAA;AAAA,IACJ,cAAc,CAAC;AAAA,IACf;AAAA,IACA;AAAA,EAAA,IACEC,YAAA;AAAA,IACFC,kBAAY,IAAI,CAAC,YAAY;AAAA,MAC3B;AAAA,MACA,SAAS;AAAA,IAAA,EACT;AAAA,EAAA;AAGJ,MAAI,WAAW;AACN,WAAAhC,+BAACiB,YAAAA,KAAK,SAAL,CAAa,CAAA;AAAA,EACvB;AAEI,MAAA,SAAS,CAAC,MAAM;AACX,WAAAjB,+BAACiB,YAAAA,KAAK,OAAL,CAAW,CAAA;AAAA,EACrB;AAEA,wCACGA,iBAAK,SAAL,EAAa,aACX,WAAC,EAAE,aAAAgB,kDACDC,MAAAA,cAAa,EAAA,aAAaD,cACzB,UAACjC,2BAAAA,IAAA,cAAA,CAAa,CAAA,GAChB,EAEJ,CAAA;AAEJ;;;"}
@@ -1,214 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import * as React from "react";
3
- import { useQueryParams, useNotification, Page, Form, Blocker, useRBAC } from "@strapi/admin/strapi-admin";
4
- import { Flex, Grid, Box, Main, Tabs } from "@strapi/design-system";
5
- import { useIntl } from "react-intl";
6
- import { useLocation, useParams } from "react-router-dom";
7
- import { styled } from "styled-components";
8
- import { c as useDoc, f as useDocumentRBAC, h as useDocumentLayout, i as createYupSchema, j as Header, g as getTranslation, P as Panels, k as PERMISSIONS, l as DocumentRBAC, S as SINGLE_TYPES } from "./index-DiMrfcfy.mjs";
9
- import { M as MemoizedInputRenderer, u as useLazyComponents, c as createDefaultForm, t as transformDocument } from "./Field-pb2o8uBe.mjs";
10
- const useOnce = (effect) => React.useEffect(effect, emptyDeps);
11
- const emptyDeps = [];
12
- const FormLayout = ({ layout }) => {
13
- return /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((panel, index) => {
14
- if (panel.some((row) => row.some((field) => field.type === "dynamiczone"))) {
15
- const [row] = panel;
16
- const [field] = row;
17
- return /* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: /* @__PURE__ */ jsx(Grid.Item, { col: 12, s: 12, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field }) }) }, field.name);
18
- }
19
- return /* @__PURE__ */ jsx(
20
- Box,
21
- {
22
- hasRadius: true,
23
- background: "neutral0",
24
- shadow: "tableShadow",
25
- paddingLeft: 6,
26
- paddingRight: 6,
27
- paddingTop: 6,
28
- paddingBottom: 6,
29
- borderColor: "neutral150",
30
- children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: panel.map((row, gridRowIndex) => /* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
31
- return /* @__PURE__ */ jsx(
32
- Grid.Item,
33
- {
34
- col: size,
35
- s: 12,
36
- xs: 12,
37
- direction: "column",
38
- alignItems: "stretch",
39
- children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field })
40
- },
41
- field.name
42
- );
43
- }) }, gridRowIndex)) })
44
- },
45
- index
46
- );
47
- }) });
48
- };
49
- const EditViewPage = () => {
50
- const location = useLocation();
51
- const [
52
- {
53
- query: { status }
54
- },
55
- setQuery
56
- ] = useQueryParams({
57
- status: "draft"
58
- });
59
- const { formatMessage } = useIntl();
60
- const { toggleNotification } = useNotification();
61
- const {
62
- document,
63
- meta,
64
- isLoading: isLoadingDocument,
65
- schema,
66
- components,
67
- collectionType,
68
- id,
69
- model
70
- } = useDoc();
71
- const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;
72
- useOnce(() => {
73
- if (location?.state && "error" in location.state) {
74
- toggleNotification({
75
- type: "danger",
76
- message: location.state.error,
77
- timeout: 5e3
78
- });
79
- }
80
- });
81
- const isLoadingActionsRBAC = useDocumentRBAC("EditViewPage", (state) => state.isLoading);
82
- const isSingleType = collectionType === SINGLE_TYPES;
83
- const isCreatingDocument = !id && !isSingleType;
84
- const {
85
- isLoading: isLoadingLayout,
86
- edit: {
87
- layout,
88
- settings: { mainField }
89
- }
90
- } = useDocumentLayout(model);
91
- const { isLazyLoading } = useLazyComponents([]);
92
- const isLoading = isLoadingActionsRBAC || isLoadingDocument || isLoadingLayout || isLazyLoading;
93
- const initialValues = React.useMemo(() => {
94
- if (!document && !isCreatingDocument && !isSingleType || !schema) {
95
- return void 0;
96
- }
97
- const form = document?.id ? document : createDefaultForm(schema, components);
98
- return transformDocument(schema, components)(form);
99
- }, [document, isCreatingDocument, isSingleType, schema, components]);
100
- if (isLoading && !document?.documentId) {
101
- return /* @__PURE__ */ jsx(Page.Loading, {});
102
- }
103
- if (!initialValues) {
104
- return /* @__PURE__ */ jsx(Page.Error, {});
105
- }
106
- const handleTabChange = (status2) => {
107
- if (status2 === "published" || status2 === "draft") {
108
- setQuery({ status: status2 }, "push", true);
109
- }
110
- };
111
- const documentTitle = mainField !== "id" && document?.[mainField] ? document[mainField] : "Untitled";
112
- return /* @__PURE__ */ jsxs(Main, { paddingLeft: 10, paddingRight: 10, children: [
113
- /* @__PURE__ */ jsx(Page.Title, { children: `${documentTitle}` }),
114
- /* @__PURE__ */ jsx(
115
- Form,
116
- {
117
- disabled: hasDraftAndPublished && status === "published",
118
- initialValues,
119
- method: isCreatingDocument ? "POST" : "PUT",
120
- validationSchema: createYupSchema(schema?.attributes, components, { status }),
121
- children: ({ resetForm }) => /* @__PURE__ */ jsxs(Fragment, { children: [
122
- /* @__PURE__ */ jsx(
123
- Header,
124
- {
125
- isCreating: isCreatingDocument,
126
- status: hasDraftAndPublished ? getDocumentStatus(document, meta) : void 0,
127
- title: documentTitle
128
- }
129
- ),
130
- /* @__PURE__ */ jsxs(Tabs.Root, { variant: "simple", value: status, onValueChange: handleTabChange, children: [
131
- /* @__PURE__ */ jsx(
132
- Tabs.List,
133
- {
134
- "aria-label": formatMessage({
135
- id: getTranslation("containers.edit.tabs.label"),
136
- defaultMessage: "Document status"
137
- }),
138
- children: hasDraftAndPublished ? /* @__PURE__ */ jsxs(Fragment, { children: [
139
- /* @__PURE__ */ jsx(StatusTab, { value: "draft", children: formatMessage({
140
- id: getTranslation("containers.edit.tabs.draft"),
141
- defaultMessage: "draft"
142
- }) }),
143
- /* @__PURE__ */ jsx(
144
- StatusTab,
145
- {
146
- disabled: !meta || meta.availableStatus.length === 0,
147
- value: "published",
148
- children: formatMessage({
149
- id: getTranslation("containers.edit.tabs.published"),
150
- defaultMessage: "published"
151
- })
152
- }
153
- )
154
- ] }) : null
155
- }
156
- ),
157
- /* @__PURE__ */ jsxs(Grid.Root, { paddingTop: 8, gap: 4, children: [
158
- /* @__PURE__ */ jsxs(Grid.Item, { col: 9, s: 12, direction: "column", alignItems: "stretch", children: [
159
- /* @__PURE__ */ jsx(Tabs.Content, { value: "draft", children: /* @__PURE__ */ jsx(FormLayout, { layout }) }),
160
- /* @__PURE__ */ jsx(Tabs.Content, { value: "published", children: /* @__PURE__ */ jsx(FormLayout, { layout }) })
161
- ] }),
162
- /* @__PURE__ */ jsx(Grid.Item, { col: 3, s: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(Panels, {}) })
163
- ] })
164
- ] }),
165
- /* @__PURE__ */ jsx(
166
- Blocker,
167
- {
168
- onProceed: resetForm
169
- }
170
- )
171
- ] })
172
- }
173
- )
174
- ] });
175
- };
176
- const StatusTab = styled(Tabs.Trigger)`
177
- text-transform: uppercase;
178
- `;
179
- const getDocumentStatus = (document, meta) => {
180
- const docStatus = document?.status;
181
- const statuses = meta?.availableStatus ?? [];
182
- if (!docStatus) {
183
- return "draft";
184
- }
185
- if (docStatus === "draft" && statuses.find((doc) => doc.publishedAt !== null)) {
186
- return "published";
187
- }
188
- return docStatus;
189
- };
190
- const ProtectedEditViewPage = () => {
191
- const { slug = "" } = useParams();
192
- const {
193
- permissions = [],
194
- isLoading,
195
- error
196
- } = useRBAC(
197
- PERMISSIONS.map((action) => ({
198
- action,
199
- subject: slug
200
- }))
201
- );
202
- if (isLoading) {
203
- return /* @__PURE__ */ jsx(Page.Loading, {});
204
- }
205
- if (error || !slug) {
206
- return /* @__PURE__ */ jsx(Page.Error, {});
207
- }
208
- return /* @__PURE__ */ jsx(Page.Protect, { permissions, children: ({ permissions: permissions2 }) => /* @__PURE__ */ jsx(DocumentRBAC, { permissions: permissions2, children: /* @__PURE__ */ jsx(EditViewPage, {}) }) });
209
- };
210
- export {
211
- EditViewPage,
212
- ProtectedEditViewPage
213
- };
214
- //# sourceMappingURL=EditViewPage-De8GyU8P.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditViewPage-De8GyU8P.mjs","sources":["../../admin/src/hooks/useOnce.ts","../../admin/src/pages/EditView/components/FormLayout.tsx","../../admin/src/pages/EditView/EditViewPage.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport * as React from 'react';\n\nexport const useOnce = (effect: React.EffectCallback) => React.useEffect(effect, emptyDeps);\n\nconst emptyDeps: React.DependencyList = [];\n","import { Box, Flex, Grid } from '@strapi/design-system';\n\nimport { EditLayout } from '../../../hooks/useDocumentLayout';\n\nimport { InputRenderer } from './InputRenderer';\n\ninterface FormLayoutProps extends Pick<EditLayout, 'layout'> {}\n\nconst FormLayout = ({ layout }: FormLayoutProps) => {\n return (\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {layout.map((panel, index) => {\n if (panel.some((row) => row.some((field) => field.type === 'dynamiczone'))) {\n const [row] = panel;\n const [field] = row;\n return (\n <Grid.Root key={field.name} gap={4}>\n <Grid.Item col={12} s={12} xs={12} direction=\"column\" alignItems=\"stretch\">\n <InputRenderer {...field} />\n </Grid.Item>\n </Grid.Root>\n );\n }\n\n return (\n <Box\n key={index}\n hasRadius\n background=\"neutral0\"\n shadow=\"tableShadow\"\n paddingLeft={6}\n paddingRight={6}\n paddingTop={6}\n paddingBottom={6}\n borderColor=\"neutral150\"\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {panel.map((row, gridRowIndex) => (\n <Grid.Root key={gridRowIndex} gap={4}>\n {row.map(({ size, ...field }) => {\n return (\n <Grid.Item\n col={size}\n key={field.name}\n s={12}\n xs={12}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <InputRenderer {...field} />\n </Grid.Item>\n );\n })}\n </Grid.Root>\n ))}\n </Flex>\n </Box>\n );\n })}\n </Flex>\n );\n};\n\nexport { FormLayout, FormLayoutProps };\n","import * as React from 'react';\n\nimport {\n Page,\n Blocker,\n Form,\n useRBAC,\n useNotification,\n useQueryParams,\n} from '@strapi/admin/strapi-admin';\nimport { Grid, Main, Tabs } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { useLocation, useParams } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { SINGLE_TYPES } from '../../constants/collections';\nimport { PERMISSIONS } from '../../constants/plugin';\nimport { DocumentRBAC, useDocumentRBAC } from '../../features/DocumentRBAC';\nimport { type UseDocument, useDoc } from '../../hooks/useDocument';\nimport { useDocumentLayout } from '../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../hooks/useLazyComponents';\nimport { useOnce } from '../../hooks/useOnce';\nimport { getTranslation } from '../../utils/translations';\nimport { createYupSchema } from '../../utils/validation';\n\nimport { FormLayout } from './components/FormLayout';\nimport { Header } from './components/Header';\nimport { Panels } from './components/Panels';\nimport { transformDocument } from './utils/data';\nimport { createDefaultForm } from './utils/forms';\n\n/* -------------------------------------------------------------------------------------------------\n * EditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst EditViewPage = () => {\n const location = useLocation();\n const [\n {\n query: { status },\n },\n setQuery,\n ] = useQueryParams<{ status: 'draft' | 'published' }>({\n status: 'draft',\n });\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n\n const {\n document,\n meta,\n isLoading: isLoadingDocument,\n schema,\n components,\n collectionType,\n id,\n model,\n } = useDoc();\n\n const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;\n\n useOnce(() => {\n /**\n * We only ever want to fire the notification once otherwise\n * whenever the app re-renders it'll pop up regardless of\n * what we do because the state comes from react-router-dom\n */\n if (location?.state && 'error' in location.state) {\n toggleNotification({\n type: 'danger',\n message: location.state.error,\n timeout: 5000,\n });\n }\n });\n\n const isLoadingActionsRBAC = useDocumentRBAC('EditViewPage', (state) => state.isLoading);\n\n const isSingleType = collectionType === SINGLE_TYPES;\n\n /**\n * single-types don't current have an id, but because they're a singleton\n * we can simply use the update operation to continuously update the same\n * document with varying params.\n */\n const isCreatingDocument = !id && !isSingleType;\n\n const {\n isLoading: isLoadingLayout,\n edit: {\n layout,\n settings: { mainField },\n },\n } = useDocumentLayout(model);\n\n const { isLazyLoading } = useLazyComponents([]);\n\n const isLoading = isLoadingActionsRBAC || isLoadingDocument || isLoadingLayout || isLazyLoading;\n\n /**\n * Here we prepare the form for editing, we need to:\n * - remove prohibited fields from the document (passwords | ADD YOURS WHEN THERES A NEW ONE)\n * - swap out count objects on relations for empty arrays\n * - set __temp_key__ on array objects for drag & drop\n *\n * We also prepare the form for new documents, so we need to:\n * - set default values on fields\n */\n const initialValues = React.useMemo(() => {\n if ((!document && !isCreatingDocument && !isSingleType) || !schema) {\n return undefined;\n }\n\n /**\n * Check that we have an ID so we know the\n * document has been created in some way.\n */\n const form = document?.id ? document : createDefaultForm(schema, components);\n\n return transformDocument(schema, components)(form);\n }, [document, isCreatingDocument, isSingleType, schema, components]);\n\n if (isLoading && !document?.documentId) {\n return <Page.Loading />;\n }\n\n if (!initialValues) {\n return <Page.Error />;\n }\n\n const handleTabChange = (status: string) => {\n if (status === 'published' || status === 'draft') {\n setQuery({ status }, 'push', true);\n }\n };\n\n /**\n * We look to see what the mainField is from the configuration,\n * if it's an id we don't use it because it's a uuid format and\n * not very user friendly. Instead in that case, we simply write \"Untitled\".\n */\n const documentTitle =\n mainField !== 'id' && document?.[mainField] ? document[mainField] : 'Untitled';\n\n return (\n <Main paddingLeft={10} paddingRight={10}>\n <Page.Title>{`${documentTitle}`}</Page.Title>\n <Form\n disabled={hasDraftAndPublished && status === 'published'}\n initialValues={initialValues}\n method={isCreatingDocument ? 'POST' : 'PUT'}\n validationSchema={createYupSchema(schema?.attributes, components, { status })}\n >\n {({ resetForm }) => (\n <>\n <Header\n isCreating={isCreatingDocument}\n status={hasDraftAndPublished ? getDocumentStatus(document, meta) : undefined}\n title={documentTitle}\n />\n <Tabs.Root variant=\"simple\" value={status} onValueChange={handleTabChange}>\n <Tabs.List\n aria-label={formatMessage({\n id: getTranslation('containers.edit.tabs.label'),\n defaultMessage: 'Document status',\n })}\n >\n {hasDraftAndPublished ? (\n <>\n <StatusTab value=\"draft\">\n {formatMessage({\n id: getTranslation('containers.edit.tabs.draft'),\n defaultMessage: 'draft',\n })}\n </StatusTab>\n <StatusTab\n disabled={!meta || meta.availableStatus.length === 0}\n value=\"published\"\n >\n {formatMessage({\n id: getTranslation('containers.edit.tabs.published'),\n defaultMessage: 'published',\n })}\n </StatusTab>\n </>\n ) : null}\n </Tabs.List>\n <Grid.Root paddingTop={8} gap={4}>\n <Grid.Item col={9} s={12} direction=\"column\" alignItems=\"stretch\">\n <Tabs.Content value=\"draft\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n <Tabs.Content value=\"published\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n </Grid.Item>\n <Grid.Item col={3} s={12} direction=\"column\" alignItems=\"stretch\">\n <Panels />\n </Grid.Item>\n </Grid.Root>\n </Tabs.Root>\n <Blocker\n // We reset the form to the published version to avoid errors like – https://strapi-inc.atlassian.net/browse/CONTENT-2284\n onProceed={resetForm}\n />\n </>\n )}\n </Form>\n </Main>\n );\n};\n\nconst StatusTab = styled(Tabs.Trigger)`\n text-transform: uppercase;\n`;\n\n/**\n * @internal\n * @description Returns the status of the document where it's latest state takes priority,\n * this typically will be \"published\" unless a user has edited their draft in which we should\n * display \"modified\".\n */\nconst getDocumentStatus = (\n document: ReturnType<UseDocument>['document'],\n meta: ReturnType<UseDocument>['meta']\n): 'draft' | 'published' | 'modified' => {\n const docStatus = document?.status;\n const statuses = meta?.availableStatus ?? [];\n\n /**\n * Creating an entry\n */\n if (!docStatus) {\n return 'draft';\n }\n\n /**\n * We're viewing a draft, but the document could have a published version\n */\n if (docStatus === 'draft' && statuses.find((doc) => doc.publishedAt !== null)) {\n return 'published';\n }\n\n return docStatus;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ProtectedEditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedEditViewPage = () => {\n const { slug = '' } = useParams<{\n slug: string;\n }>();\n const {\n permissions = [],\n isLoading,\n error,\n } = useRBAC(\n PERMISSIONS.map((action) => ({\n action,\n subject: slug,\n }))\n );\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || !slug) {\n return <Page.Error />;\n }\n\n return (\n <Page.Protect permissions={permissions}>\n {({ permissions }) => (\n <DocumentRBAC permissions={permissions}>\n <EditViewPage />\n </DocumentRBAC>\n )}\n </Page.Protect>\n );\n};\n\nexport { EditViewPage, ProtectedEditViewPage };\n"],"names":["InputRenderer","status","permissions"],"mappings":";;;;;;;;;AAGO,MAAM,UAAU,CAAC,WAAiC,MAAM,UAAU,QAAQ,SAAS;AAE1F,MAAM,YAAkC,CAAC;ACGzC,MAAM,aAAa,CAAC,EAAE,aAA8B;AAClD,SACG,oBAAA,MAAA,EAAK,WAAU,UAAS,YAAW,WAAU,KAAK,GAChD,UAAO,OAAA,IAAI,CAAC,OAAO,UAAU;AAC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