@payloadcms/next 3.0.0-beta.90 → 3.0.0-beta.92

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 (462) hide show
  1. package/dist/cjs/withPayload.js +111 -0
  2. package/dist/cjs/withPayload.js.map +1 -0
  3. package/dist/config.js +0 -1
  4. package/dist/config.js.map +1 -1
  5. package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js +15 -9
  6. package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js.map +1 -1
  7. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +100 -35
  8. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
  9. package/dist/elements/DocumentHeader/Tabs/Tab/index.js +74 -63
  10. package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
  11. package/dist/elements/DocumentHeader/Tabs/getCustomViews.js +31 -35
  12. package/dist/elements/DocumentHeader/Tabs/getCustomViews.js.map +1 -1
  13. package/dist/elements/DocumentHeader/Tabs/getViewConfig.js +15 -12
  14. package/dist/elements/DocumentHeader/Tabs/getViewConfig.js.map +1 -1
  15. package/dist/elements/DocumentHeader/Tabs/index.js +86 -79
  16. package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
  17. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +32 -13
  18. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
  19. package/dist/elements/DocumentHeader/Tabs/tabs/index.js +60 -52
  20. package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
  21. package/dist/elements/DocumentHeader/index.js +24 -23
  22. package/dist/elements/DocumentHeader/index.js.map +1 -1
  23. package/dist/elements/EmailAndUsername/index.js +107 -75
  24. package/dist/elements/EmailAndUsername/index.js.map +1 -1
  25. package/dist/elements/LeaveWithoutSaving/index.js +150 -83
  26. package/dist/elements/LeaveWithoutSaving/index.js.map +1 -1
  27. package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts.map +1 -1
  28. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js +119 -101
  29. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js.map +1 -1
  30. package/dist/elements/Logo/index.js +36 -21
  31. package/dist/elements/Logo/index.js.map +1 -1
  32. package/dist/elements/Nav/NavHamburger/index.js +41 -13
  33. package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
  34. package/dist/elements/Nav/NavWrapper/index.js +48 -16
  35. package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
  36. package/dist/elements/Nav/index.client.js +149 -76
  37. package/dist/elements/Nav/index.client.js.map +1 -1
  38. package/dist/elements/Nav/index.js +56 -50
  39. package/dist/elements/Nav/index.js.map +1 -1
  40. package/dist/exports/layouts.js +0 -1
  41. package/dist/exports/layouts.js.map +1 -1
  42. package/dist/exports/routes.js +0 -1
  43. package/dist/exports/routes.js.map +1 -1
  44. package/dist/exports/templates.js +0 -1
  45. package/dist/exports/templates.js.map +1 -1
  46. package/dist/exports/utilities.js +0 -1
  47. package/dist/exports/utilities.js.map +1 -1
  48. package/dist/exports/views.js +0 -1
  49. package/dist/exports/views.js.map +1 -1
  50. package/dist/fetchAPI-multipart/fileFactory.js +35 -34
  51. package/dist/fetchAPI-multipart/fileFactory.js.map +1 -1
  52. package/dist/fetchAPI-multipart/handlers.js +77 -78
  53. package/dist/fetchAPI-multipart/handlers.js.map +1 -1
  54. package/dist/fetchAPI-multipart/index.js +33 -31
  55. package/dist/fetchAPI-multipart/index.js.map +1 -1
  56. package/dist/fetchAPI-multipart/isEligibleRequest.js +13 -21
  57. package/dist/fetchAPI-multipart/isEligibleRequest.js.map +1 -1
  58. package/dist/fetchAPI-multipart/processMultipart.js +158 -141
  59. package/dist/fetchAPI-multipart/processMultipart.js.map +1 -1
  60. package/dist/fetchAPI-multipart/processNested.js +23 -21
  61. package/dist/fetchAPI-multipart/processNested.js.map +1 -1
  62. package/dist/fetchAPI-multipart/uploadTimer.js +16 -17
  63. package/dist/fetchAPI-multipart/uploadTimer.js.map +1 -1
  64. package/dist/fetchAPI-multipart/utilities.js +166 -166
  65. package/dist/fetchAPI-multipart/utilities.js.map +1 -1
  66. package/dist/fetchAPI-stream-file/index.js +19 -17
  67. package/dist/fetchAPI-stream-file/index.js.map +1 -1
  68. package/dist/index.js +0 -1
  69. package/dist/index.js.map +1 -1
  70. package/dist/layouts/Root/index.js +118 -115
  71. package/dist/layouts/Root/index.js.map +1 -1
  72. package/dist/prod/styles.css +1 -1
  73. package/dist/routes/graphql/handler.js +109 -103
  74. package/dist/routes/graphql/handler.js.map +1 -1
  75. package/dist/routes/graphql/index.js +0 -1
  76. package/dist/routes/graphql/index.js.map +1 -1
  77. package/dist/routes/graphql/playground.js +23 -24
  78. package/dist/routes/graphql/playground.js.map +1 -1
  79. package/dist/routes/index.js +0 -1
  80. package/dist/routes/index.js.map +1 -1
  81. package/dist/routes/rest/auth/access.js +22 -21
  82. package/dist/routes/rest/auth/access.js.map +1 -1
  83. package/dist/routes/rest/auth/forgotPassword.js +29 -25
  84. package/dist/routes/rest/auth/forgotPassword.js.map +1 -1
  85. package/dist/routes/rest/auth/init.js +16 -14
  86. package/dist/routes/rest/auth/init.js.map +1 -1
  87. package/dist/routes/rest/auth/login.js +43 -38
  88. package/dist/routes/rest/auth/login.js.map +1 -1
  89. package/dist/routes/rest/auth/logout.js +31 -27
  90. package/dist/routes/rest/auth/logout.js.map +1 -1
  91. package/dist/routes/rest/auth/me.js +23 -21
  92. package/dist/routes/rest/auth/me.js.map +1 -1
  93. package/dist/routes/rest/auth/refresh.js +31 -27
  94. package/dist/routes/rest/auth/refresh.js.map +1 -1
  95. package/dist/routes/rest/auth/registerFirstUser.js +43 -38
  96. package/dist/routes/rest/auth/registerFirstUser.js.map +1 -1
  97. package/dist/routes/rest/auth/resetPassword.js +38 -33
  98. package/dist/routes/rest/auth/resetPassword.js.map +1 -1
  99. package/dist/routes/rest/auth/unlock.js +27 -23
  100. package/dist/routes/rest/auth/unlock.js.map +1 -1
  101. package/dist/routes/rest/auth/verifyEmail.js +22 -17
  102. package/dist/routes/rest/auth/verifyEmail.js.map +1 -1
  103. package/dist/routes/rest/buildFormState.js +38 -37
  104. package/dist/routes/rest/buildFormState.js.map +1 -1
  105. package/dist/routes/rest/checkEndpoints.js +11 -9
  106. package/dist/routes/rest/checkEndpoints.js.map +1 -1
  107. package/dist/routes/rest/collections/count.js +15 -11
  108. package/dist/routes/rest/collections/count.js.map +1 -1
  109. package/dist/routes/rest/collections/create.js +30 -26
  110. package/dist/routes/rest/collections/create.js.map +1 -1
  111. package/dist/routes/rest/collections/delete.js +40 -35
  112. package/dist/routes/rest/collections/delete.js.map +1 -1
  113. package/dist/routes/rest/collections/deleteByID.js +36 -31
  114. package/dist/routes/rest/collections/deleteByID.js.map +1 -1
  115. package/dist/routes/rest/collections/docAccess.js +17 -14
  116. package/dist/routes/rest/collections/docAccess.js.map +1 -1
  117. package/dist/routes/rest/collections/duplicate.js +36 -31
  118. package/dist/routes/rest/collections/duplicate.js.map +1 -1
  119. package/dist/routes/rest/collections/find.js +29 -20
  120. package/dist/routes/rest/collections/find.js.map +1 -1
  121. package/dist/routes/rest/collections/findByID.js +28 -23
  122. package/dist/routes/rest/collections/findByID.js.map +1 -1
  123. package/dist/routes/rest/collections/findVersionByID.js +27 -22
  124. package/dist/routes/rest/collections/findVersionByID.js.map +1 -1
  125. package/dist/routes/rest/collections/findVersions.js +27 -19
  126. package/dist/routes/rest/collections/findVersions.js.map +1 -1
  127. package/dist/routes/rest/collections/preview.js +39 -34
  128. package/dist/routes/rest/collections/preview.js.map +1 -1
  129. package/dist/routes/rest/collections/restoreVersion.js +32 -27
  130. package/dist/routes/rest/collections/restoreVersion.js.map +1 -1
  131. package/dist/routes/rest/collections/update.js +43 -37
  132. package/dist/routes/rest/collections/update.js.map +1 -1
  133. package/dist/routes/rest/collections/updateByID.js +38 -33
  134. package/dist/routes/rest/collections/updateByID.js.map +1 -1
  135. package/dist/routes/rest/files/checkFileAccess.js +46 -44
  136. package/dist/routes/rest/files/checkFileAccess.js.map +1 -1
  137. package/dist/routes/rest/files/getFile.js +52 -49
  138. package/dist/routes/rest/files/getFile.js.map +1 -1
  139. package/dist/routes/rest/files/getFileTypeFallback.js +16 -17
  140. package/dist/routes/rest/files/getFileTypeFallback.js.map +1 -1
  141. package/dist/routes/rest/globals/docAccess.js +15 -13
  142. package/dist/routes/rest/globals/docAccess.js.map +1 -1
  143. package/dist/routes/rest/globals/findOne.js +22 -18
  144. package/dist/routes/rest/globals/findOne.js.map +1 -1
  145. package/dist/routes/rest/globals/findVersionByID.js +22 -17
  146. package/dist/routes/rest/globals/findVersionByID.js.map +1 -1
  147. package/dist/routes/rest/globals/findVersions.js +27 -19
  148. package/dist/routes/rest/globals/findVersions.js.map +1 -1
  149. package/dist/routes/rest/globals/preview.js +38 -34
  150. package/dist/routes/rest/globals/preview.js.map +1 -1
  151. package/dist/routes/rest/globals/restoreVersion.js +27 -22
  152. package/dist/routes/rest/globals/restoreVersion.js.map +1 -1
  153. package/dist/routes/rest/globals/update.js +32 -28
  154. package/dist/routes/rest/globals/update.js.map +1 -1
  155. package/dist/routes/rest/index.js +651 -626
  156. package/dist/routes/rest/index.js.map +1 -1
  157. package/dist/routes/rest/og/image.js +74 -76
  158. package/dist/routes/rest/og/image.js.map +1 -1
  159. package/dist/routes/rest/og/index.js +60 -59
  160. package/dist/routes/rest/og/index.js.map +1 -1
  161. package/dist/routes/rest/routeError.js +102 -95
  162. package/dist/routes/rest/routeError.js.map +1 -1
  163. package/dist/routes/rest/types.js +1 -2
  164. package/dist/routes/rest/types.js.map +1 -1
  165. package/dist/routes/rest/utilities/sanitizeCollectionID.js +14 -11
  166. package/dist/routes/rest/utilities/sanitizeCollectionID.js.map +1 -1
  167. package/dist/scss/app.scss +4 -4
  168. package/dist/scss/type.scss +4 -4
  169. package/dist/templates/Default/NavHamburger/index.js +18 -6
  170. package/dist/templates/Default/NavHamburger/index.js.map +1 -1
  171. package/dist/templates/Default/Wrapper/index.js +42 -13
  172. package/dist/templates/Default/Wrapper/index.js.map +1 -1
  173. package/dist/templates/Default/index.js +54 -47
  174. package/dist/templates/Default/index.js.map +1 -1
  175. package/dist/templates/Minimal/index.js +16 -16
  176. package/dist/templates/Minimal/index.js.map +1 -1
  177. package/dist/utilities/addDataAndFileToRequest.js +40 -35
  178. package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
  179. package/dist/utilities/addLocalesToRequest.js +44 -36
  180. package/dist/utilities/addLocalesToRequest.js.map +1 -1
  181. package/dist/utilities/createPayloadRequest.js +85 -74
  182. package/dist/utilities/createPayloadRequest.js.map +1 -1
  183. package/dist/utilities/getNextRequestI18n.js +13 -11
  184. package/dist/utilities/getNextRequestI18n.js.map +1 -1
  185. package/dist/utilities/getPayloadHMR.d.ts +1 -1
  186. package/dist/utilities/getPayloadHMR.d.ts.map +1 -1
  187. package/dist/utilities/getPayloadHMR.js +91 -94
  188. package/dist/utilities/getPayloadHMR.js.map +1 -1
  189. package/dist/utilities/getRequestLanguage.js +16 -13
  190. package/dist/utilities/getRequestLanguage.js.map +1 -1
  191. package/dist/utilities/getRequestLocales.js +27 -24
  192. package/dist/utilities/getRequestLocales.js.map +1 -1
  193. package/dist/utilities/getRequestTheme.js +16 -16
  194. package/dist/utilities/getRequestTheme.js.map +1 -1
  195. package/dist/utilities/headersWithCors.js +21 -30
  196. package/dist/utilities/headersWithCors.js.map +1 -1
  197. package/dist/utilities/initPage/handleAdminPage.js +46 -42
  198. package/dist/utilities/initPage/handleAdminPage.js.map +1 -1
  199. package/dist/utilities/initPage/handleAuthRedirect.js +45 -32
  200. package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
  201. package/dist/utilities/initPage/index.js +146 -120
  202. package/dist/utilities/initPage/index.js.map +1 -1
  203. package/dist/utilities/initPage/shared.js +26 -25
  204. package/dist/utilities/initPage/shared.js.map +1 -1
  205. package/dist/utilities/initPage/types.js +1 -2
  206. package/dist/utilities/initPage/types.js.map +1 -1
  207. package/dist/utilities/mergeHeaders.js +8 -9
  208. package/dist/utilities/mergeHeaders.js.map +1 -1
  209. package/dist/utilities/meta.js +66 -68
  210. package/dist/utilities/meta.js.map +1 -1
  211. package/dist/utilities/timestamp.js +4 -5
  212. package/dist/utilities/timestamp.js.map +1 -1
  213. package/dist/views/API/LocaleSelector/index.d.ts.map +1 -1
  214. package/dist/views/API/LocaleSelector/index.js +38 -11
  215. package/dist/views/API/LocaleSelector/index.js.map +1 -1
  216. package/dist/views/API/RenderJSON/index.js +124 -112
  217. package/dist/views/API/RenderJSON/index.js.map +1 -1
  218. package/dist/views/API/index.client.js +190 -202
  219. package/dist/views/API/index.client.js.map +1 -1
  220. package/dist/views/API/index.js +2 -3
  221. package/dist/views/API/index.js.map +1 -1
  222. package/dist/views/API/meta.js +22 -18
  223. package/dist/views/API/meta.js.map +1 -1
  224. package/dist/views/Account/Settings/LanguageSelector.js +45 -12
  225. package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
  226. package/dist/views/Account/Settings/index.js +21 -28
  227. package/dist/views/Account/Settings/index.js.map +1 -1
  228. package/dist/views/Account/ToggleTheme/index.js +51 -30
  229. package/dist/views/Account/ToggleTheme/index.js.map +1 -1
  230. package/dist/views/Account/index.client.js +32 -16
  231. package/dist/views/Account/index.client.js.map +1 -1
  232. package/dist/views/Account/index.js +99 -68
  233. package/dist/views/Account/index.js.map +1 -1
  234. package/dist/views/Account/meta.js +12 -8
  235. package/dist/views/Account/meta.js.map +1 -1
  236. package/dist/views/CreateFirstUser/index.client.js +95 -57
  237. package/dist/views/CreateFirstUser/index.client.js.map +1 -1
  238. package/dist/views/CreateFirstUser/index.js +42 -28
  239. package/dist/views/CreateFirstUser/index.js.map +1 -1
  240. package/dist/views/CreateFirstUser/meta.js +12 -8
  241. package/dist/views/CreateFirstUser/meta.js.map +1 -1
  242. package/dist/views/Dashboard/Default/index.js +132 -115
  243. package/dist/views/Dashboard/Default/index.js.map +1 -1
  244. package/dist/views/Dashboard/index.js +61 -52
  245. package/dist/views/Dashboard/index.js.map +1 -1
  246. package/dist/views/Dashboard/meta.js +16 -12
  247. package/dist/views/Dashboard/meta.js.map +1 -1
  248. package/dist/views/Document/getCustomViewByKey.js +2 -3
  249. package/dist/views/Document/getCustomViewByKey.js.map +1 -1
  250. package/dist/views/Document/getCustomViewByRoute.js +30 -27
  251. package/dist/views/Document/getCustomViewByRoute.js.map +1 -1
  252. package/dist/views/Document/getDocumentData.js +34 -28
  253. package/dist/views/Document/getDocumentData.js.map +1 -1
  254. package/dist/views/Document/getDocumentPermissions.js +83 -74
  255. package/dist/views/Document/getDocumentPermissions.js.map +1 -1
  256. package/dist/views/Document/getMetaBySegment.js +113 -107
  257. package/dist/views/Document/getMetaBySegment.js.map +1 -1
  258. package/dist/views/Document/getViewsFromConfig.js +309 -331
  259. package/dist/views/Document/getViewsFromConfig.js.map +1 -1
  260. package/dist/views/Document/index.d.ts.map +1 -1
  261. package/dist/views/Document/index.js +193 -159
  262. package/dist/views/Document/index.js.map +1 -1
  263. package/dist/views/Document/meta.js +1 -2
  264. package/dist/views/Document/meta.js.map +1 -1
  265. package/dist/views/Edit/Default/Auth/APIKey.js +118 -132
  266. package/dist/views/Edit/Default/Auth/APIKey.js.map +1 -1
  267. package/dist/views/Edit/Default/Auth/index.js +293 -196
  268. package/dist/views/Edit/Default/Auth/index.js.map +1 -1
  269. package/dist/views/Edit/Default/Auth/types.js +1 -2
  270. package/dist/views/Edit/Default/Auth/types.js.map +1 -1
  271. package/dist/views/Edit/Default/SetDocumentStepNav/index.js +121 -70
  272. package/dist/views/Edit/Default/SetDocumentStepNav/index.js.map +1 -1
  273. package/dist/views/Edit/Default/SetDocumentTitle/index.js +74 -29
  274. package/dist/views/Edit/Default/SetDocumentTitle/index.js.map +1 -1
  275. package/dist/views/Edit/Default/index.js +190 -187
  276. package/dist/views/Edit/Default/index.js.map +1 -1
  277. package/dist/views/Edit/Default/types.js +1 -2
  278. package/dist/views/Edit/Default/types.js.map +1 -1
  279. package/dist/views/Edit/index.client.js +45 -21
  280. package/dist/views/Edit/index.client.js.map +1 -1
  281. package/dist/views/Edit/index.js +2 -3
  282. package/dist/views/Edit/index.js.map +1 -1
  283. package/dist/views/Edit/meta.js +43 -35
  284. package/dist/views/Edit/meta.js.map +1 -1
  285. package/dist/views/Edit/sanitizeEditViewProps.js +8 -9
  286. package/dist/views/Edit/sanitizeEditViewProps.js.map +1 -1
  287. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +151 -94
  288. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
  289. package/dist/views/ForgotPassword/index.js +59 -46
  290. package/dist/views/ForgotPassword/index.js.map +1 -1
  291. package/dist/views/ForgotPassword/meta.js +12 -8
  292. package/dist/views/ForgotPassword/meta.js.map +1 -1
  293. package/dist/views/List/Default/index.js +348 -208
  294. package/dist/views/List/Default/index.js.map +1 -1
  295. package/dist/views/List/Default/types.js +1 -2
  296. package/dist/views/List/Default/types.js.map +1 -1
  297. package/dist/views/List/index.js +153 -137
  298. package/dist/views/List/index.js.map +1 -1
  299. package/dist/views/List/meta.js +20 -17
  300. package/dist/views/List/meta.js.map +1 -1
  301. package/dist/views/LivePreview/Context/collisionDetection.js +24 -21
  302. package/dist/views/LivePreview/Context/collisionDetection.js.map +1 -1
  303. package/dist/views/LivePreview/Context/context.d.ts +2 -1
  304. package/dist/views/LivePreview/Context/context.d.ts.map +1 -1
  305. package/dist/views/LivePreview/Context/context.js +39 -36
  306. package/dist/views/LivePreview/Context/context.js.map +1 -1
  307. package/dist/views/LivePreview/Context/index.js +134 -142
  308. package/dist/views/LivePreview/Context/index.js.map +1 -1
  309. package/dist/views/LivePreview/Context/sizeReducer.js +18 -19
  310. package/dist/views/LivePreview/Context/sizeReducer.js.map +1 -1
  311. package/dist/views/LivePreview/Device/index.d.ts.map +1 -1
  312. package/dist/views/LivePreview/Device/index.js +78 -71
  313. package/dist/views/LivePreview/Device/index.js.map +1 -1
  314. package/dist/views/LivePreview/DeviceContainer/index.js +47 -23
  315. package/dist/views/LivePreview/DeviceContainer/index.js.map +1 -1
  316. package/dist/views/LivePreview/IFrame/index.js +21 -16
  317. package/dist/views/LivePreview/IFrame/index.js.map +1 -1
  318. package/dist/views/LivePreview/Preview/index.js +145 -92
  319. package/dist/views/LivePreview/Preview/index.js.map +1 -1
  320. package/dist/views/LivePreview/Toolbar/Controls/index.js +136 -115
  321. package/dist/views/LivePreview/Toolbar/Controls/index.js.map +1 -1
  322. package/dist/views/LivePreview/Toolbar/SizeInput/index.js +89 -51
  323. package/dist/views/LivePreview/Toolbar/SizeInput/index.js.map +1 -1
  324. package/dist/views/LivePreview/Toolbar/index.js +82 -50
  325. package/dist/views/LivePreview/Toolbar/index.js.map +1 -1
  326. package/dist/views/LivePreview/ToolbarArea/index.js +32 -10
  327. package/dist/views/LivePreview/ToolbarArea/index.js.map +1 -1
  328. package/dist/views/LivePreview/index.client.js +316 -160
  329. package/dist/views/LivePreview/index.client.js.map +1 -1
  330. package/dist/views/LivePreview/index.js +67 -55
  331. package/dist/views/LivePreview/index.js.map +1 -1
  332. package/dist/views/LivePreview/meta.js +14 -9
  333. package/dist/views/LivePreview/meta.js.map +1 -1
  334. package/dist/views/LivePreview/usePopupWindow.js +91 -94
  335. package/dist/views/LivePreview/usePopupWindow.js.map +1 -1
  336. package/dist/views/Login/LoginField/index.js +83 -39
  337. package/dist/views/Login/LoginField/index.js.map +1 -1
  338. package/dist/views/Login/LoginForm/index.js +130 -66
  339. package/dist/views/Login/LoginForm/index.js.map +1 -1
  340. package/dist/views/Login/index.js +77 -54
  341. package/dist/views/Login/index.js.map +1 -1
  342. package/dist/views/Login/meta.js +12 -8
  343. package/dist/views/Login/meta.js.map +1 -1
  344. package/dist/views/Logout/LogoutClient.js +84 -39
  345. package/dist/views/Logout/LogoutClient.js.map +1 -1
  346. package/dist/views/Logout/index.js +29 -16
  347. package/dist/views/Logout/index.js.map +1 -1
  348. package/dist/views/Logout/meta.js +11 -7
  349. package/dist/views/Logout/meta.js.map +1 -1
  350. package/dist/views/NotFound/index.client.js +78 -40
  351. package/dist/views/NotFound/index.client.js.map +1 -1
  352. package/dist/views/NotFound/index.js +47 -37
  353. package/dist/views/NotFound/index.js.map +1 -1
  354. package/dist/views/NotFound/meta.js +9 -7
  355. package/dist/views/NotFound/meta.js.map +1 -1
  356. package/dist/views/ResetPassword/index.client.js +97 -59
  357. package/dist/views/ResetPassword/index.client.js.map +1 -1
  358. package/dist/views/ResetPassword/index.js +68 -53
  359. package/dist/views/ResetPassword/index.js.map +1 -1
  360. package/dist/views/ResetPassword/meta.js +12 -8
  361. package/dist/views/ResetPassword/meta.js.map +1 -1
  362. package/dist/views/Root/generateCustomViewMetadata.js +21 -19
  363. package/dist/views/Root/generateCustomViewMetadata.js.map +1 -1
  364. package/dist/views/Root/getCustomViewByRoute.js +42 -31
  365. package/dist/views/Root/getCustomViewByRoute.js.map +1 -1
  366. package/dist/views/Root/getViewFromConfig.js +162 -156
  367. package/dist/views/Root/getViewFromConfig.js.map +1 -1
  368. package/dist/views/Root/index.js +99 -82
  369. package/dist/views/Root/index.js.map +1 -1
  370. package/dist/views/Root/isPathMatchingRoute.js +18 -13
  371. package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
  372. package/dist/views/Root/meta.js +141 -136
  373. package/dist/views/Root/meta.js.map +1 -1
  374. package/dist/views/Unauthorized/index.js +32 -22
  375. package/dist/views/Unauthorized/index.js.map +1 -1
  376. package/dist/views/Unauthorized/meta.js +12 -8
  377. package/dist/views/Unauthorized/meta.js.map +1 -1
  378. package/dist/views/Verify/index.js +58 -43
  379. package/dist/views/Verify/index.js.map +1 -1
  380. package/dist/views/Verify/meta.js +12 -8
  381. package/dist/views/Verify/meta.js.map +1 -1
  382. package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
  383. package/dist/views/Version/Default/SetStepNav.js +147 -103
  384. package/dist/views/Version/Default/SetStepNav.js.map +1 -1
  385. package/dist/views/Version/Default/index.js +198 -114
  386. package/dist/views/Version/Default/index.js.map +1 -1
  387. package/dist/views/Version/Default/types.js +1 -2
  388. package/dist/views/Version/Default/types.js.map +1 -1
  389. package/dist/views/Version/RenderFieldsToDiff/Label/index.js +6 -5
  390. package/dist/views/Version/RenderFieldsToDiff/Label/index.js.map +1 -1
  391. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
  392. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +65 -69
  393. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
  394. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.d.ts.map +1 -1
  395. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js +34 -31
  396. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js.map +1 -1
  397. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +108 -78
  398. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
  399. package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js +17 -11
  400. package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js.map +1 -1
  401. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
  402. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +40 -38
  403. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
  404. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts.map +1 -1
  405. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +42 -32
  406. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
  407. package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js +17 -11
  408. package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js.map +1 -1
  409. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
  410. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +34 -31
  411. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
  412. package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js +4 -5
  413. package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js.map +1 -1
  414. package/dist/views/Version/RenderFieldsToDiff/fields/index.js +20 -21
  415. package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
  416. package/dist/views/Version/RenderFieldsToDiff/fields/styles.js +23 -24
  417. package/dist/views/Version/RenderFieldsToDiff/fields/styles.js.map +1 -1
  418. package/dist/views/Version/RenderFieldsToDiff/fields/types.js +1 -2
  419. package/dist/views/Version/RenderFieldsToDiff/fields/types.js.map +1 -1
  420. package/dist/views/Version/RenderFieldsToDiff/index.js +102 -97
  421. package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
  422. package/dist/views/Version/RenderFieldsToDiff/types.js +1 -2
  423. package/dist/views/Version/RenderFieldsToDiff/types.js.map +1 -1
  424. package/dist/views/Version/Restore/index.js +107 -110
  425. package/dist/views/Version/Restore/index.js.map +1 -1
  426. package/dist/views/Version/Restore/types.js +1 -2
  427. package/dist/views/Version/Restore/types.js.map +1 -1
  428. package/dist/views/Version/SelectComparison/index.js +130 -138
  429. package/dist/views/Version/SelectComparison/index.js.map +1 -1
  430. package/dist/views/Version/SelectComparison/types.js +1 -2
  431. package/dist/views/Version/SelectComparison/types.js.map +1 -1
  432. package/dist/views/Version/SelectLocales/index.js +58 -30
  433. package/dist/views/Version/SelectLocales/index.js.map +1 -1
  434. package/dist/views/Version/SelectLocales/types.js +1 -2
  435. package/dist/views/Version/SelectLocales/types.js.map +1 -1
  436. package/dist/views/Version/index.js +126 -105
  437. package/dist/views/Version/index.js.map +1 -1
  438. package/dist/views/Version/meta.js +49 -43
  439. package/dist/views/Version/meta.js.map +1 -1
  440. package/dist/views/Versions/buildColumns.js +87 -82
  441. package/dist/views/Versions/buildColumns.js.map +1 -1
  442. package/dist/views/Versions/cells/AutosaveCell/index.js +69 -42
  443. package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
  444. package/dist/views/Versions/cells/CreatedAt/index.js +70 -17
  445. package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
  446. package/dist/views/Versions/cells/ID/index.js +17 -5
  447. package/dist/views/Versions/cells/ID/index.js.map +1 -1
  448. package/dist/views/Versions/getLatestVersion.js +33 -29
  449. package/dist/views/Versions/getLatestVersion.js.map +1 -1
  450. package/dist/views/Versions/index.client.js +80 -77
  451. package/dist/views/Versions/index.client.js.map +1 -1
  452. package/dist/views/Versions/index.js +148 -127
  453. package/dist/views/Versions/index.js.map +1 -1
  454. package/dist/views/Versions/meta.js +43 -37
  455. package/dist/views/Versions/meta.js.map +1 -1
  456. package/dist/views/Versions/types.js +1 -2
  457. package/dist/views/Versions/types.js.map +1 -1
  458. package/dist/withPayload.js +83 -117
  459. package/dist/withPayload.js.map +1 -1
  460. package/package.json +20 -10
  461. package/dist/cjs/withPayload.cjs +0 -145
  462. package/dist/cjs/withPayload.cjs.map +0 -1
@@ -1,31 +1,55 @@
1
1
  'use client';
2
+
3
+ import { c as _c } from "react/compiler-runtime";
2
4
  import { jsx as _jsx } from "react/jsx-runtime";
3
5
  import React from 'react';
4
6
  import { useLivePreviewContext } from '../Context/context.js';
5
- export const DeviceContainer = (props)=>{
6
- const { children } = props;
7
- const { breakpoint, breakpoints, size, zoom } = useLivePreviewContext();
8
- const foundBreakpoint = breakpoint && breakpoints?.find((bp)=>bp.name === breakpoint);
9
- let x = '0';
10
- let margin = '0';
11
- if (foundBreakpoint && breakpoint !== 'responsive') {
12
- x = '-50%';
13
- if (typeof zoom === 'number' && typeof size.width === 'number' && typeof size.height === 'number') {
14
- const scaledWidth = size.width / zoom;
15
- const difference = scaledWidth - size.width;
16
- x = `${difference / 2}px`;
17
- margin = '0 auto';
18
- }
7
+ export const DeviceContainer = props => {
8
+ const $ = _c(6);
9
+ const {
10
+ children
11
+ } = props;
12
+ const {
13
+ breakpoint,
14
+ breakpoints,
15
+ size,
16
+ zoom
17
+ } = useLivePreviewContext();
18
+ const foundBreakpoint = breakpoint && breakpoints?.find(bp => bp.name === breakpoint);
19
+ let x = "0";
20
+ let margin = "0";
21
+ if (foundBreakpoint && breakpoint !== "responsive") {
22
+ x = "-50%";
23
+ if (typeof zoom === "number" && typeof size.width === "number" && typeof size.height === "number") {
24
+ const scaledWidth = size.width / zoom;
25
+ const difference = scaledWidth - size.width;
26
+ x = `${difference / 2}px`;
27
+ margin = "0 auto";
19
28
  }
20
- return /*#__PURE__*/ _jsx("div", {
21
- style: {
22
- height: foundBreakpoint && foundBreakpoint?.name !== 'responsive' ? `${size?.height / (typeof zoom === 'number' ? zoom : 1)}px` : typeof zoom === 'number' ? `${100 / zoom}%` : '100%',
23
- margin,
24
- transform: `translate3d(${x}, 0, 0)`,
25
- width: foundBreakpoint && foundBreakpoint?.name !== 'responsive' ? `${size?.width / (typeof zoom === 'number' ? zoom : 1)}px` : typeof zoom === 'number' ? `${100 / zoom}%` : '100%'
26
- },
27
- children: children
29
+ }
30
+ const t0 = foundBreakpoint && foundBreakpoint?.name !== "responsive" ? `${size?.height / (typeof zoom === "number" ? zoom : 1)}px` : typeof zoom === "number" ? `${100 / zoom}%` : "100%";
31
+ const t1 = `translate3d(${x}, 0, 0)`;
32
+ const t2 = foundBreakpoint && foundBreakpoint?.name !== "responsive" ? `${size?.width / (typeof zoom === "number" ? zoom : 1)}px` : typeof zoom === "number" ? `${100 / zoom}%` : "100%";
33
+ let t3;
34
+ if ($[0] !== t0 || $[1] !== margin || $[2] !== t1 || $[3] !== t2 || $[4] !== children) {
35
+ t3 = _jsx("div", {
36
+ style: {
37
+ height: t0,
38
+ margin,
39
+ transform: t1,
40
+ width: t2
41
+ },
42
+ children
28
43
  });
44
+ $[0] = t0;
45
+ $[1] = margin;
46
+ $[2] = t1;
47
+ $[3] = t2;
48
+ $[4] = children;
49
+ $[5] = t3;
50
+ } else {
51
+ t3 = $[5];
52
+ }
53
+ return t3;
29
54
  };
30
-
31
55
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/views/LivePreview/DeviceContainer/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useLivePreviewContext } from '../Context/context.js'\n\nexport const DeviceContainer: React.FC<{\n children: React.ReactNode\n}> = (props) => {\n const { children } = props\n\n const { breakpoint, breakpoints, size, zoom } = useLivePreviewContext()\n\n const foundBreakpoint = breakpoint && breakpoints?.find((bp) => bp.name === breakpoint)\n\n let x = '0'\n let margin = '0'\n\n if (foundBreakpoint && breakpoint !== 'responsive') {\n x = '-50%'\n\n if (\n typeof zoom === 'number' &&\n typeof size.width === 'number' &&\n typeof size.height === 'number'\n ) {\n const scaledWidth = size.width / zoom\n const difference = scaledWidth - size.width\n x = `${difference / 2}px`\n margin = '0 auto'\n }\n }\n\n return (\n <div\n style={{\n height:\n foundBreakpoint && foundBreakpoint?.name !== 'responsive'\n ? `${size?.height / (typeof zoom === 'number' ? zoom : 1)}px`\n : typeof zoom === 'number'\n ? `${100 / zoom}%`\n : '100%',\n margin,\n transform: `translate3d(${x}, 0, 0)`,\n width:\n foundBreakpoint && foundBreakpoint?.name !== 'responsive'\n ? `${size?.width / (typeof zoom === 'number' ? zoom : 1)}px`\n : typeof zoom === 'number'\n ? `${100 / zoom}%`\n : '100%',\n }}\n >\n {children}\n </div>\n )\n}\n"],"names":["React","useLivePreviewContext","DeviceContainer","props","children","breakpoint","breakpoints","size","zoom","foundBreakpoint","find","bp","name","x","margin","width","height","scaledWidth","difference","div","style","transform"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,qBAAqB,QAAQ,wBAAuB;AAE7D,OAAO,MAAMC,kBAER,CAACC;IACJ,MAAM,EAAEC,QAAQ,EAAE,GAAGD;IAErB,MAAM,EAAEE,UAAU,EAAEC,WAAW,EAAEC,IAAI,EAAEC,IAAI,EAAE,GAAGP;IAEhD,MAAMQ,kBAAkBJ,cAAcC,aAAaI,KAAK,CAACC,KAAOA,GAAGC,IAAI,KAAKP;IAE5E,IAAIQ,IAAI;IACR,IAAIC,SAAS;IAEb,IAAIL,mBAAmBJ,eAAe,cAAc;QAClDQ,IAAI;QAEJ,IACE,OAAOL,SAAS,YAChB,OAAOD,KAAKQ,KAAK,KAAK,YACtB,OAAOR,KAAKS,MAAM,KAAK,UACvB;YACA,MAAMC,cAAcV,KAAKQ,KAAK,GAAGP;YACjC,MAAMU,aAAaD,cAAcV,KAAKQ,KAAK;YAC3CF,IAAI,CAAC,EAAEK,aAAa,EAAE,EAAE,CAAC;YACzBJ,SAAS;QACX;IACF;IAEA,qBACE,KAACK;QACCC,OAAO;YACLJ,QACEP,mBAAmBA,iBAAiBG,SAAS,eACzC,CAAC,EAAEL,MAAMS,SAAU,CAAA,OAAOR,SAAS,WAAWA,OAAO,CAAA,EAAG,EAAE,CAAC,GAC3D,OAAOA,SAAS,WACd,CAAC,EAAE,MAAMA,KAAK,CAAC,CAAC,GAChB;YACRM;YACAO,WAAW,CAAC,YAAY,EAAER,EAAE,OAAO,CAAC;YACpCE,OACEN,mBAAmBA,iBAAiBG,SAAS,eACzC,CAAC,EAAEL,MAAMQ,QAAS,CAAA,OAAOP,SAAS,WAAWA,OAAO,CAAA,EAAG,EAAE,CAAC,GAC1D,OAAOA,SAAS,WACd,CAAC,EAAE,MAAMA,KAAK,CAAC,CAAC,GAChB;QACV;kBAECJ;;AAGP,EAAC"}
1
+ {"version":3,"file":"index.js","names":["c","_c","React","useLivePreviewContext","DeviceContainer","props","$","children","breakpoint","breakpoints","size","zoom","foundBreakpoint","find","bp","name","x","margin","width","height","scaledWidth","difference","t0","t1","t2","t3","_jsx","style","transform"],"sources":["../../../../src/views/LivePreview/DeviceContainer/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useLivePreviewContext } from '../Context/context.js'\n\nexport const DeviceContainer: React.FC<{\n children: React.ReactNode\n}> = (props) => {\n const { children } = props\n\n const { breakpoint, breakpoints, size, zoom } = useLivePreviewContext()\n\n const foundBreakpoint = breakpoint && breakpoints?.find((bp) => bp.name === breakpoint)\n\n let x = '0'\n let margin = '0'\n\n if (foundBreakpoint && breakpoint !== 'responsive') {\n x = '-50%'\n\n if (\n typeof zoom === 'number' &&\n typeof size.width === 'number' &&\n typeof size.height === 'number'\n ) {\n const scaledWidth = size.width / zoom\n const difference = scaledWidth - size.width\n x = `${difference / 2}px`\n margin = '0 auto'\n }\n }\n\n return (\n <div\n style={{\n height:\n foundBreakpoint && foundBreakpoint?.name !== 'responsive'\n ? `${size?.height / (typeof zoom === 'number' ? zoom : 1)}px`\n : typeof zoom === 'number'\n ? `${100 / zoom}%`\n : '100%',\n margin,\n transform: `translate3d(${x}, 0, 0)`,\n width:\n foundBreakpoint && foundBreakpoint?.name !== 'responsive'\n ? `${size?.width / (typeof zoom === 'number' ? zoom : 1)}px`\n : typeof zoom === 'number'\n ? `${100 / zoom}%`\n : '100%',\n }}\n >\n {children}\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,qBAAqB,QAAQ;AAEtC,OAAO,MAAMC,eAAA,GAERC,KAAA;EAAA,MAAAC,CAAA,GAAAL,EAAA;EACH;IAAAM;EAAA,IAAqBF,KAAA;EAErB;IAAAG,UAAA;IAAAC,WAAA;IAAAC,IAAA;IAAAC;EAAA,IAAgDR,qBAAA;EAEhD,MAAAS,eAAA,GAAwBJ,UAAA,IAAcC,WAAA,EAAAI,IAAA,CAAAC,EAAA,IAA0BA,EAAA,CAAAC,IAAA,KAAYP,UAAA;EAE5E,IAAAQ,CAAA,GAAQ;EACR,IAAAC,MAAA,GAAa;EAAA,IAETL,eAAA,IAAmBJ,UAAA,KAAe;IACpCQ,CAAA,CAAAA,CAAA,CAAIA,MAAA;IAAJ,IAGE,OAAOL,IAAA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4
  import React, { forwardRef } from 'react';
4
5
  import { useLivePreviewContext } from '../Context/context.js';
5
6
  const baseClass = 'live-preview-iframe';
6
- export const IFrame = /*#__PURE__*/ forwardRef((props, ref)=>{
7
- const { setIframeHasLoaded, url } = props;
8
- const { zoom } = useLivePreviewContext();
9
- return /*#__PURE__*/ _jsx("iframe", {
10
- className: baseClass,
11
- onLoad: ()=>{
12
- setIframeHasLoaded(true);
13
- },
14
- ref: ref,
15
- src: url,
16
- style: {
17
- transform: typeof zoom === 'number' ? `scale(${zoom}) ` : undefined
18
- },
19
- title: url
20
- });
7
+ export const IFrame = /*#__PURE__*/forwardRef((props, ref) => {
8
+ const {
9
+ setIframeHasLoaded,
10
+ url
11
+ } = props;
12
+ const {
13
+ zoom
14
+ } = useLivePreviewContext();
15
+ return /*#__PURE__*/_jsx("iframe", {
16
+ className: baseClass,
17
+ onLoad: () => {
18
+ setIframeHasLoaded(true);
19
+ },
20
+ ref: ref,
21
+ src: url,
22
+ style: {
23
+ transform: typeof zoom === 'number' ? `scale(${zoom}) ` : undefined
24
+ },
25
+ title: url
26
+ });
21
27
  });
22
-
23
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/views/LivePreview/IFrame/index.tsx"],"sourcesContent":["'use client'\nimport React, { forwardRef } from 'react'\n\nimport { useLivePreviewContext } from '../Context/context.js'\nimport './index.scss'\n\nconst baseClass = 'live-preview-iframe'\n\ntype Props = {\n setIframeHasLoaded: (value: boolean) => void\n url: string\n}\n\nexport const IFrame = forwardRef<HTMLIFrameElement, Props>((props, ref) => {\n const { setIframeHasLoaded, url } = props\n\n const { zoom } = useLivePreviewContext()\n\n return (\n <iframe\n className={baseClass}\n onLoad={() => {\n setIframeHasLoaded(true)\n }}\n ref={ref}\n src={url}\n style={{\n transform: typeof zoom === 'number' ? `scale(${zoom}) ` : undefined,\n }}\n title={url}\n />\n )\n})\n"],"names":["React","forwardRef","useLivePreviewContext","baseClass","IFrame","props","ref","setIframeHasLoaded","url","zoom","iframe","className","onLoad","src","style","transform","undefined","title"],"mappings":"AAAA;;AACA,OAAOA,SAASC,UAAU,QAAQ,QAAO;AAEzC,SAASC,qBAAqB,QAAQ,wBAAuB;AAG7D,MAAMC,YAAY;AAOlB,OAAO,MAAMC,uBAASH,WAAqC,CAACI,OAAOC;IACjE,MAAM,EAAEC,kBAAkB,EAAEC,GAAG,EAAE,GAAGH;IAEpC,MAAM,EAAEI,IAAI,EAAE,GAAGP;IAEjB,qBACE,KAACQ;QACCC,WAAWR;QACXS,QAAQ;YACNL,mBAAmB;QACrB;QACAD,KAAKA;QACLO,KAAKL;QACLM,OAAO;YACLC,WAAW,OAAON,SAAS,WAAW,CAAC,MAAM,EAAEA,KAAK,EAAE,CAAC,GAAGO;QAC5D;QACAC,OAAOT;;AAGb,GAAE"}
1
+ {"version":3,"file":"index.js","names":["React","forwardRef","useLivePreviewContext","baseClass","IFrame","props","ref","setIframeHasLoaded","url","zoom","_jsx","className","onLoad","src","style","transform","undefined","title"],"sources":["../../../../src/views/LivePreview/IFrame/index.tsx"],"sourcesContent":["'use client'\nimport React, { forwardRef } from 'react'\n\nimport { useLivePreviewContext } from '../Context/context.js'\nimport './index.scss'\n\nconst baseClass = 'live-preview-iframe'\n\ntype Props = {\n setIframeHasLoaded: (value: boolean) => void\n url: string\n}\n\nexport const IFrame = forwardRef<HTMLIFrameElement, Props>((props, ref) => {\n const { setIframeHasLoaded, url } = props\n\n const { zoom } = useLivePreviewContext()\n\n return (\n <iframe\n className={baseClass}\n onLoad={() => {\n setIframeHasLoaded(true)\n }}\n ref={ref}\n src={url}\n style={{\n transform: typeof zoom === 'number' ? `scale(${zoom}) ` : undefined,\n }}\n title={url}\n />\n )\n})\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,IAASC,UAAU,QAAQ;AAElC,SAASC,qBAAqB,QAAQ;AAGtC,MAAMC,SAAA,GAAY;AAOlB,OAAO,MAAMC,MAAA,gBAASH,UAAA,CAAqC,CAACI,KAAA,EAAOC,GAAA;EACjE,MAAM;IAAEC,kBAAkB;IAAEC;EAAG,CAAE,GAAGH,KAAA;EAEpC,MAAM;IAAEI;EAAI,CAAE,GAAGP,qBAAA;EAEjB,oBACEQ,IAAA,CAAC;IACCC,SAAA,EAAWR,SAAA;IACXS,MAAA,EAAQA,CAAA;MACNL,kBAAA,CAAmB;IACrB;IACAD,GAAA,EAAKA,GAAA;IACLO,GAAA,EAAKL,GAAA;IACLM,KAAA,EAAO;MACLC,SAAA,EAAW,OAAON,IAAA,KAAS,WAAW,SAASA,IAAA,IAAQ,GAAGO;IAC5D;IACAC,KAAA,EAAOT;;AAGb","ignoreList":[]}
@@ -1,4 +1,6 @@
1
1
  'use client';
2
+
3
+ import { c as _c } from "react/compiler-runtime";
2
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
5
  import { ShimmerEffect, useAllFormFields, useDocumentEvents } from '@payloadcms/ui';
4
6
  import { reduceFieldsToValues } from 'payload/shared';
@@ -8,103 +10,154 @@ import { DeviceContainer } from '../Device/index.js';
8
10
  import { IFrame } from '../IFrame/index.js';
9
11
  import { LivePreviewToolbar } from '../Toolbar/index.js';
10
12
  const baseClass = 'live-preview-window';
11
- export const LivePreview = (props)=>{
12
- const { appIsReady, iframeHasLoaded, iframeRef, popupRef, previewWindowType, setIframeHasLoaded, url } = useLivePreviewContext();
13
- const { mostRecentUpdate } = useDocumentEvents();
14
- const { breakpoint, fieldSchemaJSON } = useLivePreviewContext();
15
- const prevWindowType = React.useRef(undefined);
16
- const [fields] = useAllFormFields();
17
- // For client-side apps, send data through `window.postMessage`
18
- // The preview could either be an iframe embedded on the page
19
- // Or it could be a separate popup window
20
- // We need to transmit data to both accordingly
21
- useEffect(()=>{
22
- // For performance, do no reduce fields to values until after the iframe or popup has loaded
23
- if (fields && window && 'postMessage' in window && appIsReady) {
24
- const values = reduceFieldsToValues(fields, true);
25
- // To reduce on large `postMessage` payloads, only send `fieldSchemaToJSON` one time
26
- // To do this, the underlying JS function maintains a cache of this value
27
- // So we need to send it through each time the window type changes
28
- // But only once per window type change, not on every render, because this is a potentially large obj
29
- const shouldSendSchema = !prevWindowType.current || prevWindowType.current !== previewWindowType;
30
- prevWindowType.current = previewWindowType;
31
- const message = {
32
- type: 'payload-live-preview',
33
- data: values,
34
- externallyUpdatedRelationship: mostRecentUpdate,
35
- fieldSchemaJSON: shouldSendSchema ? fieldSchemaJSON : undefined
36
- };
37
- // Post message to external popup window
38
- if (previewWindowType === 'popup' && popupRef.current) {
39
- popupRef.current.postMessage(message, url);
40
- }
41
- // Post message to embedded iframe
42
- if (previewWindowType === 'iframe' && iframeRef.current) {
43
- iframeRef.current.contentWindow?.postMessage(message, url);
44
- }
45
- }
46
- }, [
47
- fields,
48
- url,
49
- iframeHasLoaded,
50
- previewWindowType,
51
- popupRef,
52
- appIsReady,
53
- iframeRef,
54
- setIframeHasLoaded,
55
- fieldSchemaJSON,
56
- mostRecentUpdate
57
- ]);
58
- // To support SSR, we transmit a `window.postMessage` event without a payload
59
- // This is because the event will ultimately trigger a server-side roundtrip
60
- // i.e., save, save draft, autosave, etc. will fire `router.refresh()`
61
- useEffect(()=>{
13
+ export const LivePreview = props => {
14
+ const $ = _c(39);
15
+ const {
16
+ appIsReady,
17
+ iframeHasLoaded,
18
+ iframeRef,
19
+ popupRef,
20
+ previewWindowType,
21
+ setIframeHasLoaded,
22
+ url
23
+ } = useLivePreviewContext();
24
+ const {
25
+ mostRecentUpdate
26
+ } = useDocumentEvents();
27
+ const {
28
+ breakpoint,
29
+ fieldSchemaJSON
30
+ } = useLivePreviewContext();
31
+ const prevWindowType = React.useRef(undefined);
32
+ const [fields] = useAllFormFields();
33
+ let t0;
34
+ if ($[0] !== fields || $[1] !== appIsReady || $[2] !== previewWindowType || $[3] !== mostRecentUpdate || $[4] !== fieldSchemaJSON || $[5] !== popupRef.current || $[6] !== url || $[7] !== iframeRef.current) {
35
+ t0 = () => {
36
+ if (fields && window && "postMessage" in window && appIsReady) {
37
+ const values = reduceFieldsToValues(fields, true);
38
+ const shouldSendSchema = !prevWindowType.current || prevWindowType.current !== previewWindowType;
39
+ prevWindowType.current = previewWindowType;
62
40
  const message = {
63
- type: 'payload-document-event'
41
+ type: "payload-live-preview",
42
+ data: values,
43
+ externallyUpdatedRelationship: mostRecentUpdate,
44
+ fieldSchemaJSON: shouldSendSchema ? fieldSchemaJSON : undefined
64
45
  };
65
- // Post message to external popup window
66
- if (previewWindowType === 'popup' && popupRef.current) {
67
- popupRef.current.postMessage(message, url);
46
+ if (previewWindowType === "popup" && popupRef.current) {
47
+ popupRef.current.postMessage(message, url);
68
48
  }
69
- // Post message to embedded iframe
70
- if (previewWindowType === 'iframe' && iframeRef.current) {
71
- iframeRef.current.contentWindow?.postMessage(message, url);
49
+ if (previewWindowType === "iframe" && iframeRef.current) {
50
+ iframeRef.current.contentWindow?.postMessage(message, url);
72
51
  }
73
- }, [
74
- mostRecentUpdate,
75
- iframeRef,
76
- popupRef,
77
- previewWindowType,
78
- url
79
- ]);
80
- if (previewWindowType === 'iframe') {
81
- return /*#__PURE__*/ _jsx("div", {
82
- className: [
83
- baseClass,
84
- breakpoint && breakpoint !== 'responsive' && `${baseClass}--has-breakpoint`
85
- ].filter(Boolean).join(' '),
86
- children: /*#__PURE__*/ _jsxs("div", {
87
- className: `${baseClass}__wrapper`,
88
- children: [
89
- /*#__PURE__*/ _jsx(LivePreviewToolbar, {
90
- ...props
91
- }),
92
- /*#__PURE__*/ _jsx("div", {
93
- className: `${baseClass}__main`,
94
- children: /*#__PURE__*/ _jsx(DeviceContainer, {
95
- children: url ? /*#__PURE__*/ _jsx(IFrame, {
96
- ref: iframeRef,
97
- setIframeHasLoaded: setIframeHasLoaded,
98
- url: url
99
- }) : /*#__PURE__*/ _jsx(ShimmerEffect, {
100
- height: "100%"
101
- })
102
- })
103
- })
104
- ]
52
+ }
53
+ };
54
+ $[0] = fields;
55
+ $[1] = appIsReady;
56
+ $[2] = previewWindowType;
57
+ $[3] = mostRecentUpdate;
58
+ $[4] = fieldSchemaJSON;
59
+ $[5] = popupRef.current;
60
+ $[6] = url;
61
+ $[7] = iframeRef.current;
62
+ $[8] = t0;
63
+ } else {
64
+ t0 = $[8];
65
+ }
66
+ let t1;
67
+ if ($[9] !== fields || $[10] !== url || $[11] !== iframeHasLoaded || $[12] !== previewWindowType || $[13] !== popupRef || $[14] !== appIsReady || $[15] !== iframeRef || $[16] !== setIframeHasLoaded || $[17] !== fieldSchemaJSON || $[18] !== mostRecentUpdate) {
68
+ t1 = [fields, url, iframeHasLoaded, previewWindowType, popupRef, appIsReady, iframeRef, setIframeHasLoaded, fieldSchemaJSON, mostRecentUpdate];
69
+ $[9] = fields;
70
+ $[10] = url;
71
+ $[11] = iframeHasLoaded;
72
+ $[12] = previewWindowType;
73
+ $[13] = popupRef;
74
+ $[14] = appIsReady;
75
+ $[15] = iframeRef;
76
+ $[16] = setIframeHasLoaded;
77
+ $[17] = fieldSchemaJSON;
78
+ $[18] = mostRecentUpdate;
79
+ $[19] = t1;
80
+ } else {
81
+ t1 = $[19];
82
+ }
83
+ useEffect(t0, t1);
84
+ let t2;
85
+ if ($[20] !== previewWindowType || $[21] !== popupRef.current || $[22] !== url || $[23] !== iframeRef.current) {
86
+ t2 = () => {
87
+ const message_0 = {
88
+ type: "payload-document-event"
89
+ };
90
+ if (previewWindowType === "popup" && popupRef.current) {
91
+ popupRef.current.postMessage(message_0, url);
92
+ }
93
+ if (previewWindowType === "iframe" && iframeRef.current) {
94
+ iframeRef.current.contentWindow?.postMessage(message_0, url);
95
+ }
96
+ };
97
+ $[20] = previewWindowType;
98
+ $[21] = popupRef.current;
99
+ $[22] = url;
100
+ $[23] = iframeRef.current;
101
+ $[24] = t2;
102
+ } else {
103
+ t2 = $[24];
104
+ }
105
+ let t3;
106
+ if ($[25] !== mostRecentUpdate || $[26] !== iframeRef || $[27] !== popupRef || $[28] !== previewWindowType || $[29] !== url) {
107
+ t3 = [mostRecentUpdate, iframeRef, popupRef, previewWindowType, url];
108
+ $[25] = mostRecentUpdate;
109
+ $[26] = iframeRef;
110
+ $[27] = popupRef;
111
+ $[28] = previewWindowType;
112
+ $[29] = url;
113
+ $[30] = t3;
114
+ } else {
115
+ t3 = $[30];
116
+ }
117
+ useEffect(t2, t3);
118
+ if (previewWindowType === "iframe") {
119
+ const t4 = breakpoint && breakpoint !== "responsive" && `${baseClass}--has-breakpoint`;
120
+ let t5;
121
+ if ($[31] !== t4) {
122
+ t5 = [baseClass, t4].filter(Boolean);
123
+ $[31] = t4;
124
+ $[32] = t5;
125
+ } else {
126
+ t5 = $[32];
127
+ }
128
+ const t6 = t5.join(" ");
129
+ let t7;
130
+ if ($[33] !== props || $[34] !== url || $[35] !== iframeRef || $[36] !== setIframeHasLoaded || $[37] !== t6) {
131
+ t7 = _jsx("div", {
132
+ className: t6,
133
+ children: _jsxs("div", {
134
+ className: `${baseClass}__wrapper`,
135
+ children: [_jsx(LivePreviewToolbar, {
136
+ ...props
137
+ }), _jsx("div", {
138
+ className: `${baseClass}__main`,
139
+ children: _jsx(DeviceContainer, {
140
+ children: url ? _jsx(IFrame, {
141
+ ref: iframeRef,
142
+ setIframeHasLoaded,
143
+ url
144
+ }) : _jsx(ShimmerEffect, {
145
+ height: "100%"
146
+ })
105
147
  })
106
- });
148
+ })]
149
+ })
150
+ });
151
+ $[33] = props;
152
+ $[34] = url;
153
+ $[35] = iframeRef;
154
+ $[36] = setIframeHasLoaded;
155
+ $[37] = t6;
156
+ $[38] = t7;
157
+ } else {
158
+ t7 = $[38];
107
159
  }
160
+ return t7;
161
+ }
108
162
  };
109
-
110
163
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/views/LivePreview/Preview/index.tsx"],"sourcesContent":["'use client'\n\nimport type { EditViewProps } from 'payload'\n\nimport { ShimmerEffect, useAllFormFields, useDocumentEvents } from '@payloadcms/ui'\nimport { reduceFieldsToValues } from 'payload/shared'\nimport React, { useEffect } from 'react'\n\nimport { useLivePreviewContext } from '../Context/context.js'\nimport { DeviceContainer } from '../Device/index.js'\nimport { IFrame } from '../IFrame/index.js'\nimport { LivePreviewToolbar } from '../Toolbar/index.js'\nimport './index.scss'\n\nconst baseClass = 'live-preview-window'\n\nexport const LivePreview: React.FC<EditViewProps> = (props) => {\n const {\n appIsReady,\n iframeHasLoaded,\n iframeRef,\n popupRef,\n previewWindowType,\n setIframeHasLoaded,\n url,\n } = useLivePreviewContext()\n\n const { mostRecentUpdate } = useDocumentEvents()\n\n const { breakpoint, fieldSchemaJSON } = useLivePreviewContext()\n\n const prevWindowType =\n React.useRef<ReturnType<typeof useLivePreviewContext>['previewWindowType']>(undefined)\n\n const [fields] = useAllFormFields()\n\n // For client-side apps, send data through `window.postMessage`\n // The preview could either be an iframe embedded on the page\n // Or it could be a separate popup window\n // We need to transmit data to both accordingly\n useEffect(() => {\n // For performance, do no reduce fields to values until after the iframe or popup has loaded\n if (fields && window && 'postMessage' in window && appIsReady) {\n const values = reduceFieldsToValues(fields, true)\n\n // To reduce on large `postMessage` payloads, only send `fieldSchemaToJSON` one time\n // To do this, the underlying JS function maintains a cache of this value\n // So we need to send it through each time the window type changes\n // But only once per window type change, not on every render, because this is a potentially large obj\n const shouldSendSchema =\n !prevWindowType.current || prevWindowType.current !== previewWindowType\n\n prevWindowType.current = previewWindowType\n\n const message = {\n type: 'payload-live-preview',\n data: values,\n externallyUpdatedRelationship: mostRecentUpdate,\n fieldSchemaJSON: shouldSendSchema ? fieldSchemaJSON : undefined,\n }\n\n // Post message to external popup window\n if (previewWindowType === 'popup' && popupRef.current) {\n popupRef.current.postMessage(message, url)\n }\n\n // Post message to embedded iframe\n if (previewWindowType === 'iframe' && iframeRef.current) {\n iframeRef.current.contentWindow?.postMessage(message, url)\n }\n }\n }, [\n fields,\n url,\n iframeHasLoaded,\n previewWindowType,\n popupRef,\n appIsReady,\n iframeRef,\n setIframeHasLoaded,\n fieldSchemaJSON,\n mostRecentUpdate,\n ])\n\n // To support SSR, we transmit a `window.postMessage` event without a payload\n // This is because the event will ultimately trigger a server-side roundtrip\n // i.e., save, save draft, autosave, etc. will fire `router.refresh()`\n useEffect(() => {\n const message = {\n type: 'payload-document-event',\n }\n\n // Post message to external popup window\n if (previewWindowType === 'popup' && popupRef.current) {\n popupRef.current.postMessage(message, url)\n }\n\n // Post message to embedded iframe\n if (previewWindowType === 'iframe' && iframeRef.current) {\n iframeRef.current.contentWindow?.postMessage(message, url)\n }\n }, [mostRecentUpdate, iframeRef, popupRef, previewWindowType, url])\n\n if (previewWindowType === 'iframe') {\n return (\n <div\n className={[\n baseClass,\n breakpoint && breakpoint !== 'responsive' && `${baseClass}--has-breakpoint`,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <div className={`${baseClass}__wrapper`}>\n <LivePreviewToolbar {...props} />\n <div className={`${baseClass}__main`}>\n <DeviceContainer>\n {url ? (\n <IFrame ref={iframeRef} setIframeHasLoaded={setIframeHasLoaded} url={url} />\n ) : (\n <ShimmerEffect height=\"100%\" />\n )}\n </DeviceContainer>\n </div>\n </div>\n </div>\n )\n }\n}\n"],"names":["ShimmerEffect","useAllFormFields","useDocumentEvents","reduceFieldsToValues","React","useEffect","useLivePreviewContext","DeviceContainer","IFrame","LivePreviewToolbar","baseClass","LivePreview","props","appIsReady","iframeHasLoaded","iframeRef","popupRef","previewWindowType","setIframeHasLoaded","url","mostRecentUpdate","breakpoint","fieldSchemaJSON","prevWindowType","useRef","undefined","fields","window","values","shouldSendSchema","current","message","type","data","externallyUpdatedRelationship","postMessage","contentWindow","div","className","filter","Boolean","join","ref","height"],"mappings":"AAAA;;AAIA,SAASA,aAAa,EAAEC,gBAAgB,EAAEC,iBAAiB,QAAQ,iBAAgB;AACnF,SAASC,oBAAoB,QAAQ,iBAAgB;AACrD,OAAOC,SAASC,SAAS,QAAQ,QAAO;AAExC,SAASC,qBAAqB,QAAQ,wBAAuB;AAC7D,SAASC,eAAe,QAAQ,qBAAoB;AACpD,SAASC,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,MAAM0B,UAAU;YACdC,MAAM;QACR;QAEA,wCAAwC;QACxC,IAAIf,sBAAsB,WAAWD,SAASc,OAAO,EAAE;YACrDd,SAASc,OAAO,CAACK,WAAW,CAACJ,SAASZ;QACxC;QAEA,kCAAkC;QAClC,IAAIF,sBAAsB,YAAYF,UAAUe,OAAO,EAAE;YACvDf,UAAUe,OAAO,CAACM,aAAa,EAAED,YAAYJ,SAASZ;QACxD;IACF,GAAG;QAACC;QAAkBL;QAAWC;QAAUC;QAAmBE;KAAI;IAElE,IAAIF,sBAAsB,UAAU;QAClC,qBACE,KAACoB;YACCC,WAAW;gBACT5B;gBACAW,cAAcA,eAAe,gBAAgB,CAAC,EAAEX,UAAU,gBAAgB,CAAC;aAC5E,CACE6B,MAAM,CAACC,SACPC,IAAI,CAAC;sBAER,cAAA,MAACJ;gBAAIC,WAAW,CAAC,EAAE5B,UAAU,SAAS,CAAC;;kCACrC,KAACD;wBAAoB,GAAGG,KAAK;;kCAC7B,KAACyB;wBAAIC,WAAW,CAAC,EAAE5B,UAAU,MAAM,CAAC;kCAClC,cAAA,KAACH;sCACEY,oBACC,KAACX;gCAAOkC,KAAK3B;gCAAWG,oBAAoBA;gCAAoBC,KAAKA;+CAErE,KAACnB;gCAAc2C,QAAO;;;;;;;IAOpC;AACF,EAAC"}
1
+ {"version":3,"file":"index.js","names":["c","_c","ShimmerEffect","useAllFormFields","useDocumentEvents","reduceFieldsToValues","React","useEffect","useLivePreviewContext","DeviceContainer","IFrame","LivePreviewToolbar","baseClass","LivePreview","props","$","appIsReady","iframeHasLoaded","iframeRef","popupRef","previewWindowType","setIframeHasLoaded","url","mostRecentUpdate","breakpoint","fieldSchemaJSON","prevWindowType","useRef","undefined","fields","t0","current","window","values","shouldSendSchema","message","type","data","externallyUpdatedRelationship","postMessage","contentWindow","t1","t2","message_0","t3","t4","t5","filter","Boolean","t6","join","t7","_jsx","className","children","_jsxs","ref","height"],"sources":["../../../../src/views/LivePreview/Preview/index.tsx"],"sourcesContent":["'use client'\n\nimport type { EditViewProps } from 'payload'\n\nimport { ShimmerEffect, useAllFormFields, useDocumentEvents } from '@payloadcms/ui'\nimport { reduceFieldsToValues } from 'payload/shared'\nimport React, { useEffect } from 'react'\n\nimport { useLivePreviewContext } from '../Context/context.js'\nimport { DeviceContainer } from '../Device/index.js'\nimport { IFrame } from '../IFrame/index.js'\nimport { LivePreviewToolbar } from '../Toolbar/index.js'\nimport './index.scss'\n\nconst baseClass = 'live-preview-window'\n\nexport const LivePreview: React.FC<EditViewProps> = (props) => {\n const {\n appIsReady,\n iframeHasLoaded,\n iframeRef,\n popupRef,\n previewWindowType,\n setIframeHasLoaded,\n url,\n } = useLivePreviewContext()\n\n const { mostRecentUpdate } = useDocumentEvents()\n\n const { breakpoint, fieldSchemaJSON } = useLivePreviewContext()\n\n const prevWindowType =\n React.useRef<ReturnType<typeof useLivePreviewContext>['previewWindowType']>(undefined)\n\n const [fields] = useAllFormFields()\n\n // For client-side apps, send data through `window.postMessage`\n // The preview could either be an iframe embedded on the page\n // Or it could be a separate popup window\n // We need to transmit data to both accordingly\n useEffect(() => {\n // For performance, do no reduce fields to values until after the iframe or popup has loaded\n if (fields && window && 'postMessage' in window && appIsReady) {\n const values = reduceFieldsToValues(fields, true)\n\n // To reduce on large `postMessage` payloads, only send `fieldSchemaToJSON` one time\n // To do this, the underlying JS function maintains a cache of this value\n // So we need to send it through each time the window type changes\n // But only once per window type change, not on every render, because this is a potentially large obj\n const shouldSendSchema =\n !prevWindowType.current || prevWindowType.current !== previewWindowType\n\n prevWindowType.current = previewWindowType\n\n const message = {\n type: 'payload-live-preview',\n data: values,\n externallyUpdatedRelationship: mostRecentUpdate,\n fieldSchemaJSON: shouldSendSchema ? fieldSchemaJSON : undefined,\n }\n\n // Post message to external popup window\n if (previewWindowType === 'popup' && popupRef.current) {\n popupRef.current.postMessage(message, url)\n }\n\n // Post message to embedded iframe\n if (previewWindowType === 'iframe' && iframeRef.current) {\n iframeRef.current.contentWindow?.postMessage(message, url)\n }\n }\n }, [\n fields,\n url,\n iframeHasLoaded,\n previewWindowType,\n popupRef,\n appIsReady,\n iframeRef,\n setIframeHasLoaded,\n fieldSchemaJSON,\n mostRecentUpdate,\n ])\n\n // To support SSR, we transmit a `window.postMessage` event without a payload\n // This is because the event will ultimately trigger a server-side roundtrip\n // i.e., save, save draft, autosave, etc. will fire `router.refresh()`\n useEffect(() => {\n const message = {\n type: 'payload-document-event',\n }\n\n // Post message to external popup window\n if (previewWindowType === 'popup' && popupRef.current) {\n popupRef.current.postMessage(message, url)\n }\n\n // Post message to embedded iframe\n if (previewWindowType === 'iframe' && iframeRef.current) {\n iframeRef.current.contentWindow?.postMessage(message, url)\n }\n }, [mostRecentUpdate, iframeRef, popupRef, previewWindowType, url])\n\n if (previewWindowType === 'iframe') {\n return (\n <div\n className={[\n baseClass,\n breakpoint && breakpoint !== 'responsive' && `${baseClass}--has-breakpoint`,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <div className={`${baseClass}__wrapper`}>\n <LivePreviewToolbar {...props} />\n <div className={`${baseClass}__main`}>\n <DeviceContainer>\n {url ? (\n <IFrame ref={iframeRef} setIframeHasLoaded={setIframeHasLoaded} url={url} />\n ) : (\n <ShimmerEffect height=\"100%\" />\n )}\n </DeviceContainer>\n </div>\n </div>\n </div>\n )\n }\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,aAAa,EAAEC,gBAAgB,EAAEC,iBAAiB,QAAQ;AACnE,SAASC,oBAAoB,QAAQ;AACrC,OAAOC,KAAA,IAASC,SAAS,QAAQ;AAEjC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,eAAe,QAAQ;AAChC,SAASC,MAAM,QAAQ;AACvB,SAASC,kBAAkB,QAAQ;AAGnC,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,WAAA,GAAuCC,KAAA;EAAA,MAAAC,CAAA,GAAAd,EAAA;EAClD;IAAAe,UAAA;IAAAC,e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