adminizer 4.1.0-build.4 → 4.1.0-build.40

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 (268) hide show
  1. package/Readme.md +12 -2
  2. package/assets/{VanillaJSONEditor-FUe77pIA.js → VanillaJSONEditor-DTWads1Y.js} +104 -104
  3. package/assets/add-BOMae0jC.js +1 -0
  4. package/assets/add-form-DAMJbss4.js +1 -0
  5. package/assets/add-group-BHyaFPsj.js +1 -0
  6. package/assets/add-group-form-CQN_syZq.js +1 -0
  7. package/assets/add-user-DjT6o3z9.js +1 -0
  8. package/assets/add-user-form-C7T14FsG.js +1 -0
  9. package/assets/{app-DMmad2-f.css → app-BrkasjFX.css} +1 -1
  10. package/assets/app-layout-BC2Dk0GE.js +1 -0
  11. package/assets/{app-shell-BWMRMkHM.js → app-shell-jCQ5EbpR.js} +1 -1
  12. package/assets/{app-sidebar-header-DLAFi13E.js → app-sidebar-header-BcGzUtnn.js} +1 -1
  13. package/assets/app-sidebar-wFqi5-7E.js +1 -0
  14. package/assets/app.js +9 -9
  15. package/assets/{breadcrumbs-CQNon4Vl.js → breadcrumbs-CDxSbsTe.js} +1 -1
  16. package/assets/button-BV-GbIpN.js +1 -0
  17. package/assets/catalog-Cc6Mk9sX.css +1 -0
  18. package/assets/catalog-DGH9s-S8.js +16 -0
  19. package/assets/{checkbox-W0nGAXIj.js → checkbox-DrkQu16U.js} +1 -1
  20. package/assets/{compiler-runtime-tM4jBQ-T.js → compiler-runtime-Cj7rbuyn.js} +2 -2
  21. package/assets/dashboard-BOltB2Hq.css +1 -0
  22. package/assets/dashboard-DFn55U5H.js +3 -0
  23. package/assets/{date-picker-B__dVVqj.js → date-picker-hoDPF9Am.js} +1 -1
  24. package/assets/debounce-qdyXyOeG.js +1 -0
  25. package/assets/del-modal-BUVjhY0k.js +6 -0
  26. package/assets/dialog-stack-V6c1TlnC.js +1 -0
  27. package/assets/dropdown-menu-CeMIoM8d.js +1 -0
  28. package/assets/{field-renderer-CapylJU9.js → field-renderer-zGC76llY.js} +3 -3
  29. package/assets/form-B9sI77wk.js +1 -0
  30. package/assets/form-DkRGBp5e.js +1 -0
  31. package/assets/{geo-json-CwteYDGB.js → geo-json-VtXcqPd9.js} +1 -1
  32. package/assets/{handsontable-BCnjOpBr.js → handsontable-DrEU6lOi.js} +1 -1
  33. package/assets/home-BmydIqzz.js +2 -0
  34. package/assets/{icon-Bz9BMaD0.js → icon-CqJOMij7.js} +1 -1
  35. package/assets/index-BCpOvf4m.js +1 -0
  36. package/assets/{index-BbXEMx9n.js → index-B__NksD2.js} +1 -1
  37. package/assets/{index-DTRTjOmh.js → index-C0o7vG6r.js} +3 -3
  38. package/assets/{index-C0SL3SHw.js → index-CcxvoJO6.js} +1 -1
  39. package/assets/{index-D5ir9iUV.js → index-Cq31rrfZ.js} +1 -1
  40. package/assets/{index-K81GbF6O.js → index-DN1K56yz.js} +1 -1
  41. package/assets/{index-DrWfGwtf.js → index-DU8vYhyh.js} +1 -1
  42. package/assets/{index-BcE9FUM6.js → index-DoVAC0HX.js} +1 -1
  43. package/assets/{index-BC0yfOHo.js → index-lqMxC6QB.js} +1 -1
  44. package/assets/{index-DEk3sC8d.js → index-oMAR28Sy.js} +1 -1
  45. package/assets/{init-user-D9mW-g14.js → init-user-GyTJdhrh.js} +1 -1
  46. package/assets/{input-DF7Ue23C.js → input-B7wUhbil.js} +1 -1
  47. package/assets/{input-error-BBygona6.js → input-error-DFk1EyT_.js} +1 -1
  48. package/assets/{label-Z506NKsW.js → label-GEoZpZr4.js} +1 -1
  49. package/assets/list-Dy_nWfcN.js +1 -0
  50. package/assets/list-table-DqU7Spnz.js +57 -0
  51. package/assets/login-BWs195kG.js +6 -0
  52. package/assets/manifest.json +726 -604
  53. package/assets/{material-icon-CItZiB53.js → material-icon-BAd3Wrgn.js} +1 -1
  54. package/assets/module-UO5sAKpW.js +1 -0
  55. package/assets/{monaco-editor-DqAqwxw4.js → monaco-editor-B5kndNv5.js} +1 -1
  56. package/assets/{multi-select-oabtVhUP.js → multi-select-CSxVlxon.js} +2 -2
  57. package/assets/{nav-footer-CM-yHiRs.js → nav-footer-_TcxXo9x.js} +1 -1
  58. package/assets/nav-main-DPeRWb5e.js +1 -0
  59. package/assets/{nav-user-Ds8i0Pa2.js → nav-user-G2BeH6Uu.js} +1 -1
  60. package/assets/{pagination-render-B57pOpFy.js → pagination-render-B12W01AJ.js} +1 -1
  61. package/assets/{popover-I249Gg2O.js → popover-B3ZOyoLQ.js} +1 -1
  62. package/assets/{register-C9FQIDtS.js → register-CcA8kQ56.js} +1 -1
  63. package/assets/{select-D1N8zRPY.js → select-MzwxLt1D.js} +2 -2
  64. package/assets/{sidebar-4D-sX2l4.js → sidebar-CkxHTDia.js} +2 -2
  65. package/assets/skeleton-C3gmNc1Z.js +1 -0
  66. package/assets/sonner-Dp8PyHu_.js +1 -0
  67. package/assets/{toast-editor-FbrFd1ft.js → toast-editor-DRP2u8-X.js} +1 -1
  68. package/assets/{tooltip-D2ehgLlB.js → tooltip-Du62rBCn.js} +1 -1
  69. package/assets/{use-appearance-Co6mO0dV.js → use-appearance-DeUiDZ72.js} +1 -1
  70. package/assets/{use-window-size-B8l6Bpkf.js → use-window-size-ChEjEujj.js} +1 -1
  71. package/assets/{user-info-DBYoAJYJ.js → user-info-C_11jYGE.js} +1 -1
  72. package/assets/{user-menu-content-qkvdkUVd.js → user-menu-content-BNRzhEo_.js} +2 -2
  73. package/assets/welcome-Dh8vAafD.js +1 -0
  74. package/controllers/add.js +10 -10
  75. package/controllers/addGroup.js +2 -4
  76. package/controllers/addUser.js +4 -6
  77. package/controllers/catalog/Catalog.d.ts +1 -1
  78. package/controllers/catalog/Catalog.js +41 -36
  79. package/controllers/catalog/FrontentCatalogAdapter.d.ts +36 -26
  80. package/controllers/catalog/FrontentCatalogAdapter.js +68 -70
  81. package/controllers/ckeditorUpload.js +2 -3
  82. package/controllers/dashboard.js +16 -2
  83. package/controllers/edit.js +10 -14
  84. package/controllers/editGroup.js +2 -4
  85. package/controllers/editUser.js +3 -5
  86. package/controllers/form.js +2 -3
  87. package/controllers/getAllWidgets.js +3 -3
  88. package/controllers/initUser.js +1 -2
  89. package/controllers/list.js +6 -6
  90. package/controllers/login.js +43 -18
  91. package/controllers/media-manager/mediaManagerAdapter.js +1 -2
  92. package/controllers/media-manager/mediaManagerApi.js +2 -2
  93. package/controllers/navigation/edit.js +2 -2
  94. package/controllers/register.js +1 -4
  95. package/controllers/remove.js +3 -3
  96. package/controllers/timezones.js +1 -1
  97. package/controllers/view.js +3 -3
  98. package/controllers/welcome.js +1 -1
  99. package/controllers/widgets/Action.js +2 -2
  100. package/controllers/widgets/Custom.js +2 -2
  101. package/controllers/widgets/Info.js +2 -2
  102. package/controllers/widgets/switch.js +2 -2
  103. package/controllers/widgetsDB.js +5 -5
  104. package/helpers/JsUtils.d.ts +1 -0
  105. package/helpers/JsUtils.js +3 -0
  106. package/helpers/accessRightsHelper.d.ts +6 -2
  107. package/helpers/accessRightsHelper.js +28 -5
  108. package/helpers/configHelper.js +2 -1
  109. package/helpers/controllerHelper.js +39 -18
  110. package/helpers/fieldsHelper.d.ts +4 -3
  111. package/helpers/fieldsHelper.js +5 -1
  112. package/helpers/inertiaActionsHelper.js +1 -1
  113. package/helpers/inertiaAddHelper.d.ts +3 -4
  114. package/helpers/inertiaAddHelper.js +27 -7
  115. package/helpers/inertiaFromHelper.js +2 -0
  116. package/helpers/inertiaGroupHelper.d.ts +4 -2
  117. package/helpers/inertiaGroupHelper.js +1 -1
  118. package/helpers/inertiaListHelper.js +5 -5
  119. package/helpers/inertiaMenuHelper.d.ts +1 -1
  120. package/helpers/inertiaMenuHelper.js +2 -2
  121. package/helpers/inertiaUserHelper.d.ts +7 -1
  122. package/helpers/inertiaUserHelper.js +5 -1
  123. package/helpers/menuHelper.d.ts +8 -3
  124. package/helpers/menuHelper.js +26 -17
  125. package/index.d.ts +5 -3
  126. package/index.js +8 -3
  127. package/interfaces/adminpanelConfig.d.ts +41 -32
  128. package/interfaces/global.d.ts +10 -28
  129. package/interfaces/types.d.ts +1 -1
  130. package/lib/Adminizer.d.ts +10 -3
  131. package/lib/Adminizer.js +35 -18
  132. package/lib/media-manager/AbstractMediaManager.d.ts +2 -2
  133. package/lib/media-manager/AbstractMediaManager.js +1 -1
  134. package/lib/media-manager/Items.js +0 -3
  135. package/lib/requestProcessor.js +10 -3
  136. package/lib/v4/DataAccessor.d.ts +5 -2
  137. package/lib/v4/DataAccessor.js +44 -19
  138. package/lib/v4/I18n.js +2 -0
  139. package/lib/v4/POWCaptcha.js +0 -1
  140. package/lib/v4/PolicyManager.js +0 -1
  141. package/lib/{catalog → v4/catalog}/AbstractCatalog.d.ts +81 -54
  142. package/lib/{catalog → v4/catalog}/AbstractCatalog.js +50 -44
  143. package/lib/v4/catalog/Navigation.d.ts +43 -0
  144. package/lib/v4/catalog/Navigation.js +457 -0
  145. package/lib/{controls → v4/controls}/AbstractControls.d.ts +1 -1
  146. package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.d.ts +1 -1
  147. package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.d.ts +1 -1
  148. package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.d.ts +1 -1
  149. package/lib/{controls → v4/controls}/markdown/ToastUiEditor.d.ts +1 -1
  150. package/lib/{controls → v4/controls}/table/Handsontable.d.ts +1 -1
  151. package/lib/{controls → v4/controls}/wysiwyg/CKeditor.d.ts +1 -1
  152. package/lib/{datatable → v4/datatable}/NodeTable.d.ts +3 -3
  153. package/lib/{datatable → v4/datatable}/NodeTable.js +8 -8
  154. package/lib/v4/helper/jwt.d.ts +10 -0
  155. package/lib/v4/helper/jwt.js +18 -0
  156. package/lib/{inertia → v4/inertia}/inertiaAdapter.js +0 -1
  157. package/lib/v4/model/AbstractModel.d.ts +5 -1
  158. package/lib/v4/model/AbstractModel.js +2 -3
  159. package/lib/v4/model/ModelHandler.js +1 -4
  160. package/lib/v4/model/adapter/sequelize.d.ts +11 -2
  161. package/lib/v4/model/adapter/sequelize.js +451 -118
  162. package/lib/v4/model/adapter/waterline.js +5 -2
  163. package/lib/{widgets → v4/widgets}/abstractAction.d.ts +1 -1
  164. package/lib/v4/widgets/abstractCustom.d.ts +28 -0
  165. package/lib/v4/widgets/abstractCustom.js +9 -0
  166. package/lib/{widgets → v4/widgets}/abstractInfo.d.ts +1 -1
  167. package/lib/{widgets → v4/widgets}/abstractInfo.js +1 -1
  168. package/lib/{widgets → v4/widgets}/abstractLink.d.ts +2 -1
  169. package/lib/{widgets → v4/widgets}/abstractSwitch.d.ts +1 -1
  170. package/lib/{widgets → v4/widgets}/abstractWidgetBase.d.ts +2 -2
  171. package/lib/{widgets → v4/widgets}/widgetHandler.d.ts +29 -5
  172. package/lib/{widgets → v4/widgets}/widgetHandler.js +25 -25
  173. package/models/GroupAP.d.ts +8 -0
  174. package/models/NavigationAP.d.ts +7 -3
  175. package/models/NavigationAP.js +5 -6
  176. package/models/UserAP.d.ts +24 -2
  177. package/models/UserAP.js +2 -2
  178. package/package.json +28 -11
  179. package/policies/checkAuth.js +4 -3
  180. package/policies/setLocale.js +2 -2
  181. package/system/Router.js +14 -17
  182. package/system/bindAccessRights.js +0 -4
  183. package/system/bindAuthorization.js +4 -5
  184. package/system/bindControls.js +6 -6
  185. package/system/bindDev.js +1 -0
  186. package/system/bindInertia.js +17 -12
  187. package/system/bindMediaManager.js +0 -1
  188. package/system/bindModels.js +9 -6
  189. package/system/bindNavigation.d.ts +2 -0
  190. package/system/bindNavigation.js +42 -42
  191. package/system/bindReqFunctions.js +15 -0
  192. package/system/defaults.js +13 -6
  193. package/translations/ar.json +70 -1
  194. package/translations/cn.json +70 -1
  195. package/translations/de.json +71 -3
  196. package/translations/en.json +70 -102
  197. package/translations/es.json +70 -1
  198. package/translations/fr.json +70 -1
  199. package/translations/hi.json +70 -1
  200. package/translations/jp.json +70 -1
  201. package/translations/ko.json +70 -1
  202. package/translations/pt.json +70 -1
  203. package/translations/ru.json +71 -94
  204. package/translations/ua.json +70 -1
  205. package/translations/uz.json +72 -0
  206. package/translations/vi.json +70 -1
  207. package/assets/add-ZITr43GJ.js +0 -1
  208. package/assets/add-form-CYOfr0Ef.js +0 -1
  209. package/assets/add-group-B332wN8K.js +0 -1
  210. package/assets/add-group-form-dzadPSfL.js +0 -1
  211. package/assets/add-user-TC-mYdsB.js +0 -1
  212. package/assets/add-user-form-y2f_1_lM.js +0 -1
  213. package/assets/app-layout-D1m9Kvxq.js +0 -1
  214. package/assets/app-sidebar-BCtaEFGb.js +0 -1
  215. package/assets/button-CQ9t1kLz.js +0 -1
  216. package/assets/dashboard-BR602KhL.js +0 -1
  217. package/assets/dropdown-menu-SEBnEIiL.js +0 -1
  218. package/assets/form-DOUNk3o2.js +0 -1
  219. package/assets/form-lOKv4Qbw.js +0 -1
  220. package/assets/home-Ch6QfTIt.js +0 -2
  221. package/assets/index-Cdb9ACvz.js +0 -1
  222. package/assets/list-Qyd7ecQH.js +0 -1
  223. package/assets/list-table-DB1sEQLF.js +0 -62
  224. package/assets/login-DrGaTWhY.js +0 -6
  225. package/assets/module-DBaykv8l.js +0 -1
  226. package/assets/nav-main-Q3xofGRT.js +0 -1
  227. package/assets/sonner-Dzckw3U3.js +0 -1
  228. package/assets/welcome-D2adQ8EU.js +0 -1
  229. package/controllers/processInstallFinalize.d.ts +0 -1
  230. package/controllers/processInstallFinalize.js +0 -16
  231. package/controllers/processInstallStep.d.ts +0 -1
  232. package/controllers/processInstallStep.js +0 -132
  233. package/lib/catalog/Navigation.d.ts +0 -0
  234. package/lib/catalog/Navigation.js +0 -532
  235. package/lib/installStepper/InstallStepAbstract.d.ts +0 -52
  236. package/lib/installStepper/InstallStepAbstract.js +0 -69
  237. package/lib/installStepper/finalizeStep.d.ts +0 -21
  238. package/lib/installStepper/finalizeStep.js +0 -48
  239. package/lib/installStepper/installStepper.d.ts +0 -40
  240. package/lib/installStepper/installStepper.js +0 -195
  241. package/lib/widgets/abstractCustom.d.ts +0 -13
  242. package/lib/widgets/abstractCustom.js +0 -3
  243. package/models/MediaManagerAP.d.ts +0 -46
  244. package/models/MediaManagerAP.js +0 -45
  245. package/models/MediaManagerAssociationsAP.d.ts +0 -28
  246. package/models/MediaManagerAssociationsAP.js +0 -27
  247. package/models/MediaManagerMetaAP.d.ts +0 -22
  248. package/models/MediaManagerMetaAP.js +0 -21
  249. package/system/bindInstallStepper.d.ts +0 -2
  250. package/system/bindInstallStepper.js +0 -23
  251. /package/lib/{catalog → v4/catalog}/CatalogHandler.d.ts +0 -0
  252. /package/lib/{catalog → v4/catalog}/CatalogHandler.js +0 -0
  253. /package/lib/{controls → v4/controls}/AbstractControls.js +0 -0
  254. /package/lib/{controls → v4/controls}/ControlsHandler.d.ts +0 -0
  255. /package/lib/{controls → v4/controls}/ControlsHandler.js +0 -0
  256. /package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.js +0 -0
  257. /package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.js +0 -0
  258. /package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.js +0 -0
  259. /package/lib/{controls → v4/controls}/markdown/ToastUiEditor.js +0 -0
  260. /package/lib/{controls → v4/controls}/table/Handsontable.js +0 -0
  261. /package/lib/{controls → v4/controls}/wysiwyg/CKeditor.js +0 -0
  262. /package/lib/{inertia → v4/inertia}/flash.d.ts +0 -0
  263. /package/lib/{inertia → v4/inertia}/flash.js +0 -0
  264. /package/lib/{inertia → v4/inertia}/inertiaAdapter.d.ts +0 -0
  265. /package/lib/{widgets → v4/widgets}/abstractAction.js +0 -0
  266. /package/lib/{widgets → v4/widgets}/abstractLink.js +0 -0
  267. /package/lib/{widgets → v4/widgets}/abstractSwitch.js +0 -0
  268. /package/lib/{widgets → v4/widgets}/abstractWidgetBase.js +0 -0
@@ -0,0 +1 @@
1
+ import{r as mt,W as o,R as Ut,j as Xt}from"./app.js";import{c as Kt}from"./compiler-runtime-Cj7rbuyn.js";var qt=(n,a,e,s,E,l,u,v)=>{let m=document.documentElement,i=["light","dark"];function x(g){(Array.isArray(n)?n:[n]).forEach(y=>{let W=y==="class",c=W&&l?E.map(D=>l[D]||D):E;W?(m.classList.remove(...c),m.classList.add(l&&l[g]?l[g]:g)):m.setAttribute(y,g)}),t(g)}function t(g){v&&i.includes(g)&&(m.style.colorScheme=g)}function R(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(s)x(s);else try{let g=localStorage.getItem(a)||e,y=u&&g==="system"?R():g;x(y)}catch{}},Gt=mt.createContext(void 0),Jt={setTheme:n=>{},themes:[]},Qt=()=>{var n;return(n=mt.useContext(Gt))!=null?n:Jt};mt.memo(({forcedTheme:n,storageKey:a,attribute:e,enableSystem:s,enableColorScheme:E,defaultTheme:l,value:u,themes:v,nonce:m,scriptProps:i})=>{let x=JSON.stringify([e,a,l,n,v,u,s,E]).slice(1,-1);return mt.createElement("script",{...i,suppressHydrationWarning:!0,nonce:typeof window>"u"?m:"",dangerouslySetInnerHTML:{__html:`(${qt.toString()})(${x})`}})});function Zt(n){if(typeof document>"u")return;let a=document.head||document.getElementsByTagName("head")[0],e=document.createElement("style");e.type="text/css",a.appendChild(e),e.styleSheet?e.styleSheet.cssText=n:e.appendChild(document.createTextNode(n))}const te=n=>{switch(n){case"success":return oe;case"info":return ne;case"warning":return se;case"error":return re;default:return null}},ee=Array(12).fill(0),ae=({visible:n,className:a})=>o.createElement("div",{className:["sonner-loading-wrapper",a].filter(Boolean).join(" "),"data-visible":n},o.createElement("div",{className:"sonner-spinner"},ee.map((e,s)=>o.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),oe=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},o.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),se=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},o.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),ne=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},o.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),re=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},o.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),ie=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},o.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),le=()=>{const[n,a]=o.useState(document.hidden);return o.useEffect(()=>{const e=()=>{a(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),n};let xt=1;class de{constructor(){this.subscribe=a=>(this.subscribers.push(a),()=>{const e=this.subscribers.indexOf(a);this.subscribers.splice(e,1)}),this.publish=a=>{this.subscribers.forEach(e=>e(a))},this.addToast=a=>{this.publish(a),this.toasts=[...this.toasts,a]},this.create=a=>{var e;const{message:s,...E}=a,l=typeof(a==null?void 0:a.id)=="number"||((e=a.id)==null?void 0:e.length)>0?a.id:xt++,u=this.toasts.find(m=>m.id===l),v=a.dismissible===void 0?!0:a.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),u?this.toasts=this.toasts.map(m=>m.id===l?(this.publish({...m,...a,id:l,title:s}),{...m,...a,id:l,dismissible:v,title:s}):m):this.addToast({title:s,...E,dismissible:v,id:l}),l},this.dismiss=a=>(a?(this.dismissedToasts.add(a),requestAnimationFrame(()=>this.subscribers.forEach(e=>e({id:a,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(s=>s({id:e.id,dismiss:!0}))}),a),this.message=(a,e)=>this.create({...e,message:a}),this.error=(a,e)=>this.create({...e,message:a,type:"error"}),this.success=(a,e)=>this.create({...e,type:"success",message:a}),this.info=(a,e)=>this.create({...e,type:"info",message:a}),this.warning=(a,e)=>this.create({...e,type:"warning",message:a}),this.loading=(a,e)=>this.create({...e,type:"loading",message:a}),this.promise=(a,e)=>{if(!e)return;let s;e.loading!==void 0&&(s=this.create({...e,promise:a,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));const E=Promise.resolve(a instanceof Function?a():a);let l=s!==void 0,u;const v=E.then(async i=>{if(u=["resolve",i],o.isValidElement(i))l=!1,this.create({id:s,type:"default",message:i});else if(ue(i)&&!i.ok){l=!1;const t=typeof e.error=="function"?await e.error(`HTTP error! status: ${i.status}`):e.error,R=typeof e.description=="function"?await e.description(`HTTP error! status: ${i.status}`):e.description,y=typeof t=="object"&&!o.isValidElement(t)?t:{message:t};this.create({id:s,type:"error",description:R,...y})}else if(i instanceof Error){l=!1;const t=typeof e.error=="function"?await e.error(i):e.error,R=typeof e.description=="function"?await e.description(i):e.description,y=typeof t=="object"&&!o.isValidElement(t)?t:{message:t};this.create({id:s,type:"error",description:R,...y})}else if(e.success!==void 0){l=!1;const t=typeof e.success=="function"?await e.success(i):e.success,R=typeof e.description=="function"?await e.description(i):e.description,y=typeof t=="object"&&!o.isValidElement(t)?t:{message:t};this.create({id:s,type:"success",description:R,...y})}}).catch(async i=>{if(u=["reject",i],e.error!==void 0){l=!1;const x=typeof e.error=="function"?await e.error(i):e.error,t=typeof e.description=="function"?await e.description(i):e.description,g=typeof x=="object"&&!o.isValidElement(x)?x:{message:x};this.create({id:s,type:"error",description:t,...g})}}).finally(()=>{l&&(this.dismiss(s),s=void 0),e.finally==null||e.finally.call(e)}),m=()=>new Promise((i,x)=>v.then(()=>u[0]==="reject"?x(u[1]):i(u[1])).catch(x));return typeof s!="string"&&typeof s!="number"?{unwrap:m}:Object.assign(s,{unwrap:m})},this.custom=(a,e)=>{const s=(e==null?void 0:e.id)||xt++;return this.create({jsx:a(s),id:s,...e}),s},this.getActiveToasts=()=>this.toasts.filter(a=>!this.dismissedToasts.has(a.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const k=new de,ce=(n,a)=>{const e=(a==null?void 0:a.id)||xt++;return k.addToast({title:n,...a,id:e}),e},ue=n=>n&&typeof n=="object"&&"ok"in n&&typeof n.ok=="boolean"&&"status"in n&&typeof n.status=="number",fe=ce,me=()=>k.toasts,pe=()=>k.getActiveToasts(),De=Object.assign(fe,{success:k.success,info:k.info,warning:k.warning,error:k.error,custom:k.custom,message:k.message,promise:k.promise,dismiss:k.dismiss,loading:k.loading},{getHistory:me,getToasts:pe});Zt("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}[data-sonner-toaster][data-lifted=true]{transform:translateY(-8px)}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function ft(n){return n.label!==void 0}const ge=3,he="24px",be="16px",Mt=4e3,ve=356,ye=14,xe=45,we=200;function L(...n){return n.filter(Boolean).join(" ")}function Ee(n){const[a,e]=n.split("-"),s=[];return a&&s.push(a),e&&s.push(e),s}const Te=n=>{var a,e,s,E,l,u,v,m,i;const{invert:x,toast:t,unstyled:R,interacting:g,setHeights:y,visibleToasts:W,heights:c,index:D,toasts:nt,expanded:Q,removeToast:rt,defaultRichColors:I,closeButton:U,style:pt,cancelButtonStyle:it,actionButtonStyle:gt,className:lt="",descriptionClassName:j="",duration:X,position:Z,gap:ht,expandByDefault:z,classNames:d,icons:C,closeButtonAriaLabel:P="Close toast"}=n,[A,tt]=o.useState(null),[f,h]=o.useState(null),[p,B]=o.useState(!1),[F,b]=o.useState(!1),[et,K]=o.useState(!1),[at,ot]=o.useState(!1),[Ct,wt]=o.useState(!1),[At,bt]=o.useState(0),[Ht,Et]=o.useState(0),st=o.useRef(t.duration||X||Mt),Tt=o.useRef(null),$=o.useRef(null),Ot=D===0,zt=D+1<=W,N=t.type,q=t.dismissible!==!1,Lt=t.className||"",jt=t.descriptionClassName||"",dt=o.useMemo(()=>c.findIndex(r=>r.toastId===t.id)||0,[c,t.id]),Pt=o.useMemo(()=>{var r;return(r=t.closeButton)!=null?r:U},[t.closeButton,U]),St=o.useMemo(()=>t.duration||X||Mt,[t.duration,X]),vt=o.useRef(0),G=o.useRef(0),kt=o.useRef(0),J=o.useRef(null),[$t,Yt]=Z.split("-"),Nt=o.useMemo(()=>c.reduce((r,w,S)=>S>=dt?r:r+w.height,0),[c,dt]),_t=le(),Ft=t.invert||x,yt=N==="loading";G.current=o.useMemo(()=>dt*ht+Nt,[dt,Nt]),o.useEffect(()=>{st.current=St},[St]),o.useEffect(()=>{B(!0)},[]),o.useEffect(()=>{const r=$.current;if(r){const w=r.getBoundingClientRect().height;return Et(w),y(S=>[{toastId:t.id,height:w,position:t.position},...S]),()=>y(S=>S.filter(_=>_.toastId!==t.id))}},[y,t.id]),o.useLayoutEffect(()=>{if(!p)return;const r=$.current,w=r.style.height;r.style.height="auto";const S=r.getBoundingClientRect().height;r.style.height=w,Et(S),y(_=>_.find(T=>T.toastId===t.id)?_.map(T=>T.toastId===t.id?{...T,height:S}:T):[{toastId:t.id,height:S,position:t.position},..._])},[p,t.title,t.description,y,t.id]);const Y=o.useCallback(()=>{b(!0),bt(G.current),y(r=>r.filter(w=>w.toastId!==t.id)),setTimeout(()=>{rt(t)},we)},[t,rt,y,G]);o.useEffect(()=>{if(t.promise&&N==="loading"||t.duration===1/0||t.type==="loading")return;let r;return Q||g||_t?(()=>{if(kt.current<vt.current){const _=new Date().getTime()-vt.current;st.current=st.current-_}kt.current=new Date().getTime()})():(()=>{st.current!==1/0&&(vt.current=new Date().getTime(),r=setTimeout(()=>{t.onAutoClose==null||t.onAutoClose.call(t,t),Y()},st.current))})(),()=>clearTimeout(r)},[Q,g,t,N,_t,Y]),o.useEffect(()=>{t.delete&&Y()},[Y,t.delete]);function Vt(){var r;if(C!=null&&C.loading){var w;return o.createElement("div",{className:L(d==null?void 0:d.loader,t==null||(w=t.classNames)==null?void 0:w.loader,"sonner-loader"),"data-visible":N==="loading"},C.loading)}return o.createElement(ae,{className:L(d==null?void 0:d.loader,t==null||(r=t.classNames)==null?void 0:r.loader),visible:N==="loading"})}const Wt=t.icon||(C==null?void 0:C[N])||te(N);var Rt,Dt;return o.createElement("li",{tabIndex:0,ref:$,className:L(lt,Lt,d==null?void 0:d.toast,t==null||(a=t.classNames)==null?void 0:a.toast,d==null?void 0:d.default,d==null?void 0:d[N],t==null||(e=t.classNames)==null?void 0:e[N]),"data-sonner-toast":"","data-rich-colors":(Rt=t.richColors)!=null?Rt:I,"data-styled":!(t.jsx||t.unstyled||R),"data-mounted":p,"data-promise":!!t.promise,"data-swiped":Ct,"data-removed":F,"data-visible":zt,"data-y-position":$t,"data-x-position":Yt,"data-index":D,"data-front":Ot,"data-swiping":et,"data-dismissible":q,"data-type":N,"data-invert":Ft,"data-swipe-out":at,"data-swipe-direction":f,"data-expanded":!!(Q||z&&p),style:{"--index":D,"--toasts-before":D,"--z-index":nt.length-D,"--offset":`${F?At:G.current}px`,"--initial-height":z?"auto":`${Ht}px`,...pt,...t.style},onDragEnd:()=>{K(!1),tt(null),J.current=null},onPointerDown:r=>{yt||!q||(Tt.current=new Date,bt(G.current),r.target.setPointerCapture(r.pointerId),r.target.tagName!=="BUTTON"&&(K(!0),J.current={x:r.clientX,y:r.clientY}))},onPointerUp:()=>{var r,w,S;if(at||!q)return;J.current=null;const _=Number(((r=$.current)==null?void 0:r.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ct=Number(((w=$.current)==null?void 0:w.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),T=new Date().getTime()-((S=Tt.current)==null?void 0:S.getTime()),M=A==="x"?_:ct,ut=Math.abs(M)/T;if(Math.abs(M)>=xe||ut>.11){bt(G.current),t.onDismiss==null||t.onDismiss.call(t,t),h(A==="x"?_>0?"right":"left":ct>0?"down":"up"),Y(),ot(!0);return}else{var H,O;(H=$.current)==null||H.style.setProperty("--swipe-amount-x","0px"),(O=$.current)==null||O.style.setProperty("--swipe-amount-y","0px")}wt(!1),K(!1),tt(null)},onPointerMove:r=>{var w,S,_;if(!J.current||!q||((w=window.getSelection())==null?void 0:w.toString().length)>0)return;const T=r.clientY-J.current.y,M=r.clientX-J.current.x;var ut;const H=(ut=n.swipeDirections)!=null?ut:Ee(Z);!A&&(Math.abs(M)>1||Math.abs(T)>1)&&tt(Math.abs(M)>Math.abs(T)?"x":"y");let O={x:0,y:0};const Bt=V=>1/(1.5+Math.abs(V)/20);if(A==="y"){if(H.includes("top")||H.includes("bottom"))if(H.includes("top")&&T<0||H.includes("bottom")&&T>0)O.y=T;else{const V=T*Bt(T);O.y=Math.abs(V)<Math.abs(T)?V:T}}else if(A==="x"&&(H.includes("left")||H.includes("right")))if(H.includes("left")&&M<0||H.includes("right")&&M>0)O.x=M;else{const V=M*Bt(M);O.x=Math.abs(V)<Math.abs(M)?V:M}(Math.abs(O.x)>0||Math.abs(O.y)>0)&&wt(!0),(S=$.current)==null||S.style.setProperty("--swipe-amount-x",`${O.x}px`),(_=$.current)==null||_.style.setProperty("--swipe-amount-y",`${O.y}px`)}},Pt&&!t.jsx&&N!=="loading"?o.createElement("button",{"aria-label":P,"data-disabled":yt,"data-close-button":!0,onClick:yt||!q?()=>{}:()=>{Y(),t.onDismiss==null||t.onDismiss.call(t,t)},className:L(d==null?void 0:d.closeButton,t==null||(s=t.classNames)==null?void 0:s.closeButton)},(Dt=C==null?void 0:C.close)!=null?Dt:ie):null,(N||t.icon||t.promise)&&t.icon!==null&&((C==null?void 0:C[N])!==null||t.icon)?o.createElement("div",{"data-icon":"",className:L(d==null?void 0:d.icon,t==null||(E=t.classNames)==null?void 0:E.icon)},t.promise||t.type==="loading"&&!t.icon?t.icon||Vt():null,t.type!=="loading"?Wt:null):null,o.createElement("div",{"data-content":"",className:L(d==null?void 0:d.content,t==null||(l=t.classNames)==null?void 0:l.content)},o.createElement("div",{"data-title":"",className:L(d==null?void 0:d.title,t==null||(u=t.classNames)==null?void 0:u.title)},t.jsx?t.jsx:typeof t.title=="function"?t.title():t.title),t.description?o.createElement("div",{"data-description":"",className:L(j,jt,d==null?void 0:d.description,t==null||(v=t.classNames)==null?void 0:v.description)},typeof t.description=="function"?t.description():t.description):null),o.isValidElement(t.cancel)?t.cancel:t.cancel&&ft(t.cancel)?o.createElement("button",{"data-button":!0,"data-cancel":!0,style:t.cancelButtonStyle||it,onClick:r=>{ft(t.cancel)&&q&&(t.cancel.onClick==null||t.cancel.onClick.call(t.cancel,r),Y())},className:L(d==null?void 0:d.cancelButton,t==null||(m=t.classNames)==null?void 0:m.cancelButton)},t.cancel.label):null,o.isValidElement(t.action)?t.action:t.action&&ft(t.action)?o.createElement("button",{"data-button":!0,"data-action":!0,style:t.actionButtonStyle||gt,onClick:r=>{ft(t.action)&&(t.action.onClick==null||t.action.onClick.call(t.action,r),!r.defaultPrevented&&Y())},className:L(d==null?void 0:d.actionButton,t==null||(i=t.classNames)==null?void 0:i.actionButton)},t.action.label):null)};function It(){if(typeof window>"u"||typeof document>"u")return"ltr";const n=document.documentElement.getAttribute("dir");return n==="auto"||!n?window.getComputedStyle(document.documentElement).direction:n}function Se(n,a){const e={};return[n,a].forEach((s,E)=>{const l=E===1,u=l?"--mobile-offset":"--offset",v=l?be:he;function m(i){["top","right","bottom","left"].forEach(x=>{e[`${u}-${x}`]=typeof i=="number"?`${i}px`:i})}typeof s=="number"||typeof s=="string"?m(s):typeof s=="object"?["top","right","bottom","left"].forEach(i=>{s[i]===void 0?e[`${u}-${i}`]=v:e[`${u}-${i}`]=typeof s[i]=="number"?`${s[i]}px`:s[i]}):m(v)}),e}const ke=o.forwardRef(function(a,e){const{invert:s,position:E="bottom-right",hotkey:l=["altKey","KeyT"],expand:u,closeButton:v,className:m,offset:i,mobileOffset:x,theme:t="light",richColors:R,duration:g,style:y,visibleToasts:W=ge,toastOptions:c,dir:D=It(),gap:nt=ye,icons:Q,containerAriaLabel:rt="Notifications"}=a,[I,U]=o.useState([]),pt=o.useMemo(()=>Array.from(new Set([E].concat(I.filter(f=>f.position).map(f=>f.position)))),[I,E]),[it,gt]=o.useState([]),[lt,j]=o.useState(!1),[X,Z]=o.useState(!1),[ht,z]=o.useState(t!=="system"?t:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),d=o.useRef(null),C=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),P=o.useRef(null),A=o.useRef(!1),tt=o.useCallback(f=>{U(h=>{var p;return(p=h.find(B=>B.id===f.id))!=null&&p.delete||k.dismiss(f.id),h.filter(({id:B})=>B!==f.id)})},[]);return o.useEffect(()=>k.subscribe(f=>{if(f.dismiss){requestAnimationFrame(()=>{U(h=>h.map(p=>p.id===f.id?{...p,delete:!0}:p))});return}setTimeout(()=>{Ut.flushSync(()=>{U(h=>{const p=h.findIndex(B=>B.id===f.id);return p!==-1?[...h.slice(0,p),{...h[p],...f},...h.slice(p+1)]:[f,...h]})})})}),[I]),o.useEffect(()=>{if(t!=="system"){z(t);return}if(t==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window>"u")return;const f=window.matchMedia("(prefers-color-scheme: dark)");try{f.addEventListener("change",({matches:h})=>{z(h?"dark":"light")})}catch{f.addListener(({matches:p})=>{try{z(p?"dark":"light")}catch(B){console.error(B)}})}},[t]),o.useEffect(()=>{I.length<=1&&j(!1)},[I]),o.useEffect(()=>{const f=h=>{var p;if(l.every(b=>h[b]||h.code===b)){var F;j(!0),(F=d.current)==null||F.focus()}h.code==="Escape"&&(document.activeElement===d.current||(p=d.current)!=null&&p.contains(document.activeElement))&&j(!1)};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[l]),o.useEffect(()=>{if(d.current)return()=>{P.current&&(P.current.focus({preventScroll:!0}),P.current=null,A.current=!1)}},[d.current]),o.createElement("section",{ref:e,"aria-label":`${rt} ${C}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},pt.map((f,h)=>{var p;const[B,F]=f.split("-");return I.length?o.createElement("ol",{key:f,dir:D==="auto"?It():D,tabIndex:-1,ref:d,className:m,"data-sonner-toaster":!0,"data-sonner-theme":ht,"data-y-position":B,"data-lifted":lt&&I.length>1&&!u,"data-x-position":F,style:{"--front-toast-height":`${((p=it[0])==null?void 0:p.height)||0}px`,"--width":`${ve}px`,"--gap":`${nt}px`,...y,...Se(i,x)},onBlur:b=>{A.current&&!b.currentTarget.contains(b.relatedTarget)&&(A.current=!1,P.current&&(P.current.focus({preventScroll:!0}),P.current=null))},onFocus:b=>{b.target instanceof HTMLElement&&b.target.dataset.dismissible==="false"||A.current||(A.current=!0,P.current=b.relatedTarget)},onMouseEnter:()=>j(!0),onMouseMove:()=>j(!0),onMouseLeave:()=>{X||j(!1)},onDragEnd:()=>j(!1),onPointerDown:b=>{b.target instanceof HTMLElement&&b.target.dataset.dismissible==="false"||Z(!0)},onPointerUp:()=>Z(!1)},I.filter(b=>!b.position&&h===0||b.position===f).map((b,et)=>{var K,at;return o.createElement(Te,{key:b.id,icons:Q,index:et,toast:b,defaultRichColors:R,duration:(K=c==null?void 0:c.duration)!=null?K:g,className:c==null?void 0:c.className,descriptionClassName:c==null?void 0:c.descriptionClassName,invert:s,visibleToasts:W,closeButton:(at=c==null?void 0:c.closeButton)!=null?at:v,interacting:X,position:f,style:c==null?void 0:c.style,unstyled:c==null?void 0:c.unstyled,classNames:c==null?void 0:c.classNames,cancelButtonStyle:c==null?void 0:c.cancelButtonStyle,actionButtonStyle:c==null?void 0:c.actionButtonStyle,closeButtonAriaLabel:c==null?void 0:c.closeButtonAriaLabel,removeToast:tt,toasts:I.filter(ot=>ot.position==b.position),heights:it.filter(ot=>ot.position==b.position),setHeights:gt,expandByDefault:u,gap:nt,expanded:lt,swipeDirections:a.swipeDirections})})):null}))}),Be=n=>{const a=Kt.c(6);let e;a[0]!==n?({...e}=n,a[0]=n,a[1]=e):e=a[1];const{theme:s}=Qt(),l=s===void 0?"system":s;let u;a[2]===Symbol.for("react.memo_cache_sentinel")?(u={"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},a[2]=u):u=a[2];let v;return a[3]!==e||a[4]!==l?(v=Xt.jsx(ke,{theme:l,className:"toaster group",style:u,...e}),a[3]=e,a[4]=l,a[5]=v):v=a[5],v};export{Be as T,De as t};
@@ -1,4 +1,4 @@
1
- import{g as KZ,W as No,r as Cf,j as bv}from"./app.js";import{c as JZ}from"./compiler-runtime-tM4jBQ-T.js";import{k as YZ,b as XZ}from"./index-Vcq4gwWv.js";import{u as ZZ}from"./use-window-size-B8l6Bpkf.js";import{u as QZ}from"./use-appearance-Co6mO0dV.js";function Or(r){this.content=r}Or.prototype={constructor:Or,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),a=n.content.slice();return i==-1?a.push(t||r,e):(a[i+1]=e,t&&(a[i]=t)),new Or(a)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Or(t)},addToStart:function(r,e){return new Or([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new Or(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),a=n.find(r);return i.splice(a==-1?i.length:a,0,e,t),new Or(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=Or.from(r),r.size?new Or(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=Or.from(r),r.size?new Or(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=Or.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};Or.from=function(r){if(r instanceof Or)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new Or(e)};function Ky(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),a=e.child(n);if(i==a){t+=i.nodeSize;continue}if(!i.sameMarkup(a))return t;if(i.isText&&i.text!=a.text){for(let o=0;i.text[o]==a.text[o];o++)t++;return t}if(i.content.size||a.content.size){let o=Ky(i.content,a.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Jy(r,e,t,n){for(let i=r.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:t,b:n};let o=r.child(--i),s=e.child(--a),l=o.nodeSize;if(o==s){t-=l,n-=l;continue}if(!o.sameMarkup(s))return{a:t,b:n};if(o.isText&&o.text!=s.text){let f=0,p=Math.min(o.text.length,s.text.length);for(;f<p&&o.text[o.text.length-f-1]==s.text[s.text.length-f-1];)f++,t--,n--;return{a:t,b:n}}if(o.content.size||s.content.size){let f=Jy(o.content,s.content,t-1,n-1);if(f)return f}t-=l,n-=l}}class Oe{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,a){for(let o=0,s=0;s<t;o++){let l=this.content[o],f=s+l.nodeSize;if(f>e&&n(l,i+s,a||null,o)!==!1&&l.content.size){let p=s+1;l.nodesBetween(Math.max(0,e-p),Math.min(l.content.size,t-p),n,i+p)}s=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let a="",o=!0;return this.nodesBetween(e,t,(s,l)=>{let f=s.isText?s.text.slice(Math.max(e,l)-l,t-l):s.isLeaf?i?typeof i=="function"?i(s):i:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&f||s.isTextblock)&&n&&(o?o=!1:a+=n),a+=f},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),a=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new Oe(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let a=0,o=0;o<t;a++){let s=this.content[a],l=o+s.nodeSize;l>e&&((o<e||l>t)&&(s.isText?s=s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s=s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),i+=s.nodeSize),o=l}return new Oe(n,i)}cutByIndex(e,t){return e==t?Oe.empty:e==0&&t==this.content.length?this:new Oe(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),a=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new Oe(i,a)}addToStart(e){return new Oe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Oe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return Ky(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Jy(this,e,t,n)}findIndex(e,t=-1){if(e==0)return Al(0,e);if(e==this.size)return Al(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let a=this.child(n),o=i+a.nodeSize;if(o>=e)return o==e||t>0?Al(n+1,o):Al(n,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Oe.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Oe(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Oe.empty;let t,n=0;for(let i=0;i<e.length;i++){let a=e[i];n+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(t||(t=e.slice(0,i)),t[t.length-1]=a.withText(t[t.length-1].text+a.text)):t&&t.push(a)}return new Oe(t||e,n)}static from(e){if(!e)return Oe.empty;if(e instanceof Oe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Oe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Oe.empty=new Oe([],0);const Tf={index:0,offset:0};function Al(r,e){return Tf.index=r,Tf.offset=e,Tf}function Zl(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!Zl(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!Zl(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let Pt=class fd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))t||(t=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!n&&a.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(a)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Zl(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return fd.none;if(e instanceof fd)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};Pt.none=[];class Ql extends Error{}class Ue{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Xy(this.content,e+this.openStart,t);return n&&new Ue(n,this.openStart,this.openEnd)}removeBetween(e,t){return new Ue(Yy(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Ue.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ue(Oe.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.firstChild)n++;for(let a=e.lastChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.lastChild)i++;return new Ue(e,n,i)}}Ue.empty=new Ue(Oe.empty,0,0);function Yy(r,e,t){let{index:n,offset:i}=r.findIndex(e),a=r.maybeChild(n),{index:o,offset:s}=r.findIndex(t);if(i==e||a.isText){if(s!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,a.copy(Yy(a.content,e-i-1,t-i-1)))}function Xy(r,e,t,n){let{index:i,offset:a}=r.findIndex(e),o=r.maybeChild(i);if(a==e||o.isText)return r.cut(0,e).append(t).append(r.cut(e));let s=Xy(o.content,e-a-1,t);return s&&r.replaceChild(i,o.copy(s))}function eQ(r,e,t){if(t.openStart>r.depth)throw new Ql("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new Ql("Inconsistent open depths");return Zy(r,e,t,0)}function Zy(r,e,t,n){let i=r.index(n),a=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=Zy(r,e,t,n+1);return a.copy(a.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,s=o.content;return Ha(o,s.cut(0,r.parentOffset).append(t.content).append(s.cut(e.parentOffset)))}else{let{start:o,end:s}=tQ(t,r);return Ha(a,eb(r,o,s,e,n))}else return Ha(a,eu(r,e,n))}function Qy(r,e){if(!e.type.compatibleContent(r.type))throw new Ql("Cannot join "+e.type.name+" onto "+r.type.name)}function dd(r,e,t){let n=r.node(t);return Qy(n,e.node(t)),n}function qa(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function ws(r,e,t,n){let i=(e||r).node(t),a=0,o=e?e.index(t):i.childCount;r&&(a=r.index(t),r.depth>t?a++:r.textOffset&&(qa(r.nodeAfter,n),a++));for(let s=a;s<o;s++)qa(i.child(s),n);e&&e.depth==t&&e.textOffset&&qa(e.nodeBefore,n)}function Ha(r,e){return r.type.checkContent(e),r.copy(e)}function eb(r,e,t,n,i){let a=r.depth>i&&dd(r,e,i+1),o=n.depth>i&&dd(t,n,i+1),s=[];return ws(null,r,i,s),a&&o&&e.index(i)==t.index(i)?(Qy(a,o),qa(Ha(a,eb(r,e,t,n,i+1)),s)):(a&&qa(Ha(a,eu(r,e,i+1)),s),ws(e,t,i,s),o&&qa(Ha(o,eu(t,n,i+1)),s)),ws(n,null,i,s),new Oe(s)}function eu(r,e,t){let n=[];if(ws(null,r,t,n),r.depth>t){let i=dd(r,e,t+1);qa(Ha(i,eu(r,e,t+1)),n)}return ws(e,null,t,n),new Oe(n)}function tQ(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let a=t-1;a>=0;a--)i=e.node(a).copy(Oe.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class Es{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let a=0;a<e;a++)i+=n.child(a).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Pt.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let s=n;n=i,i=s}let a=n.marks;for(var o=0;o<a.length;o++)a[o].type.spec.inclusive===!1&&(!i||!a[o].isInSet(i.marks))&&(a=a[o--].removeFromSet(a));return a}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<n.length;a++)n[a].type.spec.inclusive===!1&&(!i||!n[a].isInSet(i.marks))&&(n=n[a--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new tu(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,a=t;for(let o=e;;){let{index:s,offset:l}=o.content.findIndex(a),f=a-l;if(n.push(o,s,i+l),!f||(o=o.child(s),o.isText))break;a=f-1,i+=l+1}return new Es(t,n,a)}static resolveCached(e,t){let n=kv.get(e);if(n)for(let a=0;a<n.elts.length;a++){let o=n.elts[a];if(o.pos==t)return o}else kv.set(e,n=new rQ);let i=n.elts[n.i]=Es.resolve(e,t);return n.i=(n.i+1)%nQ,i}}class rQ{constructor(){this.elts=[],this.i=0}}const nQ=12,kv=new WeakMap;class tu{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const iQ=Object.create(null);let ra=class hd{constructor(e,t,n,i=Pt.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||Oe.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Zl(this.attrs,t||e.defaultAttrs||iQ)&&Pt.sameSet(this.marks,n||Pt.none)}copy(e=null){return e==this.content?this:new hd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new hd(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Ue.empty;let i=this.resolve(e),a=this.resolve(t),o=n?0:i.sharedDepth(t),s=i.start(o),f=i.node(o).content.cut(i.pos-s,a.pos-s);return new Ue(f,i.depth-o,a.depth-o)}replace(e,t,n){return eQ(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return Es.resolveCached(this,e)}resolveNoCache(e){return Es.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,a=>(n.isInSet(a.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),tb(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Oe.empty,i=0,a=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,a),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(n),o=a&&a.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Pt.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Pt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=Oe.fromJSON(e,t.content),a=e.nodeType(t.type).create(t.attrs,i,n);return a.type.checkAttrs(a.attrs),a}};ra.prototype.text=void 0;class ru extends ra{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):tb(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ru(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ru(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function tb(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class Ua{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new aQ(e,t);if(n.next==null)return Ua.empty;let i=rb(n);n.next&&n.err("Unexpected trailing text");let a=dQ(fQ(i));return hQ(a,n),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let a=t;i&&a<n;a++)i=i.matchType(e.child(a).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function a(o,s){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return Oe.from(s.map(f=>f.createAndFill()));for(let f=0;f<o.next.length;f++){let{type:p,next:k}=o.next[f];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(k)==-1){i.push(k);let T=a(k,s.concat(p));if(T)return T}}return null}return a(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),a=i.match;if(a.matchType(e)){let o=[];for(let s=i;s.type;s=s.via)o.push(s.type);return o.reverse()}for(let o=0;o<a.next.length;o++){let{type:s,next:l}=a.next[o];!s.isLeaf&&!s.hasRequiredAttrs()&&!(s.name in t)&&(!i.type||l.validEnd)&&(n.push({match:s.contentMatch,type:s,via:i}),t[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let a=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)a+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return a}).join(`
1
+ import{g as KZ,W as No,r as Cf,j as bv}from"./app.js";import{c as JZ}from"./compiler-runtime-Cj7rbuyn.js";import{k as YZ,b as XZ}from"./index-Vcq4gwWv.js";import{u as ZZ}from"./use-window-size-ChEjEujj.js";import{u as QZ}from"./use-appearance-DeUiDZ72.js";function Or(r){this.content=r}Or.prototype={constructor:Or,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),a=n.content.slice();return i==-1?a.push(t||r,e):(a[i+1]=e,t&&(a[i]=t)),new Or(a)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Or(t)},addToStart:function(r,e){return new Or([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new Or(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),a=n.find(r);return i.splice(a==-1?i.length:a,0,e,t),new Or(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=Or.from(r),r.size?new Or(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=Or.from(r),r.size?new Or(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=Or.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};Or.from=function(r){if(r instanceof Or)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new Or(e)};function Ky(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),a=e.child(n);if(i==a){t+=i.nodeSize;continue}if(!i.sameMarkup(a))return t;if(i.isText&&i.text!=a.text){for(let o=0;i.text[o]==a.text[o];o++)t++;return t}if(i.content.size||a.content.size){let o=Ky(i.content,a.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Jy(r,e,t,n){for(let i=r.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:t,b:n};let o=r.child(--i),s=e.child(--a),l=o.nodeSize;if(o==s){t-=l,n-=l;continue}if(!o.sameMarkup(s))return{a:t,b:n};if(o.isText&&o.text!=s.text){let f=0,p=Math.min(o.text.length,s.text.length);for(;f<p&&o.text[o.text.length-f-1]==s.text[s.text.length-f-1];)f++,t--,n--;return{a:t,b:n}}if(o.content.size||s.content.size){let f=Jy(o.content,s.content,t-1,n-1);if(f)return f}t-=l,n-=l}}class Oe{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,a){for(let o=0,s=0;s<t;o++){let l=this.content[o],f=s+l.nodeSize;if(f>e&&n(l,i+s,a||null,o)!==!1&&l.content.size){let p=s+1;l.nodesBetween(Math.max(0,e-p),Math.min(l.content.size,t-p),n,i+p)}s=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let a="",o=!0;return this.nodesBetween(e,t,(s,l)=>{let f=s.isText?s.text.slice(Math.max(e,l)-l,t-l):s.isLeaf?i?typeof i=="function"?i(s):i:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&f||s.isTextblock)&&n&&(o?o=!1:a+=n),a+=f},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),a=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new Oe(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let a=0,o=0;o<t;a++){let s=this.content[a],l=o+s.nodeSize;l>e&&((o<e||l>t)&&(s.isText?s=s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s=s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),i+=s.nodeSize),o=l}return new Oe(n,i)}cutByIndex(e,t){return e==t?Oe.empty:e==0&&t==this.content.length?this:new Oe(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),a=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new Oe(i,a)}addToStart(e){return new Oe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Oe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return Ky(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Jy(this,e,t,n)}findIndex(e,t=-1){if(e==0)return Al(0,e);if(e==this.size)return Al(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let a=this.child(n),o=i+a.nodeSize;if(o>=e)return o==e||t>0?Al(n+1,o):Al(n,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Oe.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Oe(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Oe.empty;let t,n=0;for(let i=0;i<e.length;i++){let a=e[i];n+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(t||(t=e.slice(0,i)),t[t.length-1]=a.withText(t[t.length-1].text+a.text)):t&&t.push(a)}return new Oe(t||e,n)}static from(e){if(!e)return Oe.empty;if(e instanceof Oe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Oe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Oe.empty=new Oe([],0);const Tf={index:0,offset:0};function Al(r,e){return Tf.index=r,Tf.offset=e,Tf}function Zl(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!Zl(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!Zl(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let Pt=class fd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))t||(t=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!n&&a.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(a)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Zl(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return fd.none;if(e instanceof fd)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};Pt.none=[];class Ql extends Error{}class Ue{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Xy(this.content,e+this.openStart,t);return n&&new Ue(n,this.openStart,this.openEnd)}removeBetween(e,t){return new Ue(Yy(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Ue.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ue(Oe.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.firstChild)n++;for(let a=e.lastChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.lastChild)i++;return new Ue(e,n,i)}}Ue.empty=new Ue(Oe.empty,0,0);function Yy(r,e,t){let{index:n,offset:i}=r.findIndex(e),a=r.maybeChild(n),{index:o,offset:s}=r.findIndex(t);if(i==e||a.isText){if(s!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,a.copy(Yy(a.content,e-i-1,t-i-1)))}function Xy(r,e,t,n){let{index:i,offset:a}=r.findIndex(e),o=r.maybeChild(i);if(a==e||o.isText)return r.cut(0,e).append(t).append(r.cut(e));let s=Xy(o.content,e-a-1,t);return s&&r.replaceChild(i,o.copy(s))}function eQ(r,e,t){if(t.openStart>r.depth)throw new Ql("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new Ql("Inconsistent open depths");return Zy(r,e,t,0)}function Zy(r,e,t,n){let i=r.index(n),a=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=Zy(r,e,t,n+1);return a.copy(a.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,s=o.content;return Ha(o,s.cut(0,r.parentOffset).append(t.content).append(s.cut(e.parentOffset)))}else{let{start:o,end:s}=tQ(t,r);return Ha(a,eb(r,o,s,e,n))}else return Ha(a,eu(r,e,n))}function Qy(r,e){if(!e.type.compatibleContent(r.type))throw new Ql("Cannot join "+e.type.name+" onto "+r.type.name)}function dd(r,e,t){let n=r.node(t);return Qy(n,e.node(t)),n}function qa(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function ws(r,e,t,n){let i=(e||r).node(t),a=0,o=e?e.index(t):i.childCount;r&&(a=r.index(t),r.depth>t?a++:r.textOffset&&(qa(r.nodeAfter,n),a++));for(let s=a;s<o;s++)qa(i.child(s),n);e&&e.depth==t&&e.textOffset&&qa(e.nodeBefore,n)}function Ha(r,e){return r.type.checkContent(e),r.copy(e)}function eb(r,e,t,n,i){let a=r.depth>i&&dd(r,e,i+1),o=n.depth>i&&dd(t,n,i+1),s=[];return ws(null,r,i,s),a&&o&&e.index(i)==t.index(i)?(Qy(a,o),qa(Ha(a,eb(r,e,t,n,i+1)),s)):(a&&qa(Ha(a,eu(r,e,i+1)),s),ws(e,t,i,s),o&&qa(Ha(o,eu(t,n,i+1)),s)),ws(n,null,i,s),new Oe(s)}function eu(r,e,t){let n=[];if(ws(null,r,t,n),r.depth>t){let i=dd(r,e,t+1);qa(Ha(i,eu(r,e,t+1)),n)}return ws(e,null,t,n),new Oe(n)}function tQ(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let a=t-1;a>=0;a--)i=e.node(a).copy(Oe.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class Es{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let a=0;a<e;a++)i+=n.child(a).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Pt.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let s=n;n=i,i=s}let a=n.marks;for(var o=0;o<a.length;o++)a[o].type.spec.inclusive===!1&&(!i||!a[o].isInSet(i.marks))&&(a=a[o--].removeFromSet(a));return a}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<n.length;a++)n[a].type.spec.inclusive===!1&&(!i||!n[a].isInSet(i.marks))&&(n=n[a--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new tu(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,a=t;for(let o=e;;){let{index:s,offset:l}=o.content.findIndex(a),f=a-l;if(n.push(o,s,i+l),!f||(o=o.child(s),o.isText))break;a=f-1,i+=l+1}return new Es(t,n,a)}static resolveCached(e,t){let n=kv.get(e);if(n)for(let a=0;a<n.elts.length;a++){let o=n.elts[a];if(o.pos==t)return o}else kv.set(e,n=new rQ);let i=n.elts[n.i]=Es.resolve(e,t);return n.i=(n.i+1)%nQ,i}}class rQ{constructor(){this.elts=[],this.i=0}}const nQ=12,kv=new WeakMap;class tu{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const iQ=Object.create(null);let ra=class hd{constructor(e,t,n,i=Pt.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||Oe.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Zl(this.attrs,t||e.defaultAttrs||iQ)&&Pt.sameSet(this.marks,n||Pt.none)}copy(e=null){return e==this.content?this:new hd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new hd(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Ue.empty;let i=this.resolve(e),a=this.resolve(t),o=n?0:i.sharedDepth(t),s=i.start(o),f=i.node(o).content.cut(i.pos-s,a.pos-s);return new Ue(f,i.depth-o,a.depth-o)}replace(e,t,n){return eQ(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return Es.resolveCached(this,e)}resolveNoCache(e){return Es.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,a=>(n.isInSet(a.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),tb(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Oe.empty,i=0,a=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,a),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(n),o=a&&a.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Pt.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Pt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=Oe.fromJSON(e,t.content),a=e.nodeType(t.type).create(t.attrs,i,n);return a.type.checkAttrs(a.attrs),a}};ra.prototype.text=void 0;class ru extends ra{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):tb(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ru(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ru(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function tb(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class Ua{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new aQ(e,t);if(n.next==null)return Ua.empty;let i=rb(n);n.next&&n.err("Unexpected trailing text");let a=dQ(fQ(i));return hQ(a,n),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let a=t;i&&a<n;a++)i=i.matchType(e.child(a).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function a(o,s){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return Oe.from(s.map(f=>f.createAndFill()));for(let f=0;f<o.next.length;f++){let{type:p,next:k}=o.next[f];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(k)==-1){i.push(k);let T=a(k,s.concat(p));if(T)return T}}return null}return a(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),a=i.match;if(a.matchType(e)){let o=[];for(let s=i;s.type;s=s.via)o.push(s.type);return o.reverse()}for(let o=0;o<a.next.length;o++){let{type:s,next:l}=a.next[o];!s.isLeaf&&!s.hasRequiredAttrs()&&!(s.name in t)&&(!i.type||l.validEnd)&&(n.push({match:s.contentMatch,type:s,via:i}),t[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let a=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)a+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return a}).join(`
2
2
  `)}}Ua.empty=new Ua(!0);class aQ{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function rb(r){let e=[];do e.push(oQ(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function oQ(r){let e=[];do e.push(sQ(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function sQ(r){let e=cQ(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=lQ(r,e);else break;return e}function wv(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function lQ(r,e){let t=wv(r),n=t;return r.eat(",")&&(r.next!="}"?n=wv(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function uQ(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let a in t){let o=t[a];o.isInGroup(e)&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function cQ(r){if(r.eat("(")){let e=rb(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=uQ(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function fQ(r){let e=[[]];return i(a(r,0),t()),e;function t(){return e.push([])-1}function n(o,s,l){let f={term:l,to:s};return e[o].push(f),f}function i(o,s){o.forEach(l=>l.to=s)}function a(o,s){if(o.type=="choice")return o.exprs.reduce((l,f)=>l.concat(a(f,s)),[]);if(o.type=="seq")for(let l=0;;l++){let f=a(o.exprs[l],s);if(l==o.exprs.length-1)return f;i(f,s=t())}else if(o.type=="star"){let l=t();return n(s,l),i(a(o.expr,l),l),[n(l)]}else if(o.type=="plus"){let l=t();return i(a(o.expr,s),l),i(a(o.expr,l),l),[n(l)]}else{if(o.type=="opt")return[n(s)].concat(a(o.expr,s));if(o.type=="range"){let l=s;for(let f=0;f<o.min;f++){let p=t();i(a(o.expr,l),p),l=p}if(o.max==-1)i(a(o.expr,l),l);else for(let f=o.min;f<o.max;f++){let p=t();n(l,p),i(a(o.expr,l),p),l=p}return[n(l)]}else{if(o.type=="name")return[n(s,void 0,o.value)];throw new Error("Unknown expr type")}}}}function nb(r,e){return e-r}function Cv(r,e){let t=[];return n(e),t.sort(nb);function n(i){let a=r[i];if(a.length==1&&!a[0].term)return n(a[0].to);t.push(i);for(let o=0;o<a.length;o++){let{term:s,to:l}=a[o];!s&&t.indexOf(l)==-1&&n(l)}}}function dQ(r){let e=Object.create(null);return t(Cv(r,0));function t(n){let i=[];n.forEach(o=>{r[o].forEach(({term:s,to:l})=>{if(!s)return;let f;for(let p=0;p<i.length;p++)i[p][0]==s&&(f=i[p][1]);Cv(r,l).forEach(p=>{f||i.push([s,f=[]]),f.indexOf(p)==-1&&f.push(p)})})});let a=e[n.join(",")]=new Ua(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let s=i[o][1].sort(nb);a.next.push({type:i[o][0],next:e[s.join(",")]||t(s)})}return a}}function hQ(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],a=!i.validEnd,o=[];for(let s=0;s<i.next.length;s++){let{type:l,next:f}=i.next[s];o.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),n.indexOf(f)==-1&&n.push(f)}a&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ib(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function ab(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let a=r[n];if(a.hasDefault)i=a.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function ob(r,e,t,n){for(let i in e)if(!(i in r))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in r){let a=r[i];a.validate&&a.validate(e[i])}}function sb(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new vQ(r,n,e[n]);return t}let Tv=class lb{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=sb(e,n.attrs),this.defaultAttrs=ib(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ua.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ab(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ra(this,this.computeAttrs(e),Oe.from(t),Pt.setFrom(n))}createChecked(e=null,t,n){return t=Oe.from(t),this.checkContent(t),new ra(this,this.computeAttrs(e),t,Pt.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=Oe.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),a=i&&i.fillBefore(Oe.empty,!0);return a?new ra(this,e,t.append(a),Pt.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ob(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Pt.none:e}static compile(e,t){let n=Object.create(null);e.forEach((a,o)=>n[a]=new lb(a,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let a in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function pQ(r,e,t){let n=t.split("|");return i=>{let a=i===null?"null":typeof i;if(n.indexOf(a)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${a}`)}}class vQ{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?pQ(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Mu{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=sb(e,i.attrs),this.excluded=null;let a=ib(this.attrs);this.instance=a?new Pt(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Pt(this,ab(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((a,o)=>n[a]=new Mu(a,i++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){ob(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ub{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Or.from(e.nodes),t.marks=Or.from(e.marks||{}),this.nodes=Tv.compile(this.spec.nodes,this),this.marks=Mu.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],o=a.spec.content||"",s=a.spec.marks;if(a.contentMatch=n[o]||(n[o]=Ua.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=s=="_"?null:s?Sv(this,s.split(" ")):s==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:Sv(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Tv){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new ru(n,n.defaultAttrs,e,Pt.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return ra.fromJSON(this,e)}markFromJSON(e){return Pt.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Sv(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],a=r.marks[i],o=a;if(a)t.push(a);else for(let s in r.marks){let l=r.marks[s];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function mQ(r){return r.tag!=null}function gQ(r){return r.style!=null}class $a{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(mQ(i))this.tags.push(i);else if(gQ(i)){let a=/[^=]*/.exec(i.style)[0];n.indexOf(a)<0&&n.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,t={}){let n=new Ev(this,t,!1);return n.addAll(e,Pt.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Ev(this,t,!0);return n.addAll(e,Pt.none,t.from,t.to),Ue.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let a=this.tags[i];if(kQ(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||t.matchesContext(a.context))){if(a.getAttrs){let o=a.getAttrs(e);if(o===!1)continue;a.attrs=o||void 0}return a}}}matchStyle(e,t,n,i){for(let a=i?this.styles.indexOf(i)+1:0;a<this.styles.length;a++){let o=this.styles[a],s=o.style;if(!(s.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||s.length>e.length&&(s.charCodeAt(e.length)!=61||s.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let a=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let s=t[o];if((s.priority==null?50:s.priority)<a)break}t.splice(o,0,i)}for(let i in e.marks){let a=e.marks[i].spec.parseDOM;a&&a.forEach(o=>{n(o=Mv(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(o=>{n(o=Mv(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new $a(e,$a.schemaRules(e)))}}const cb={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},yQ={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},fb={ol:!0,ul:!0},Ms=1,pd=2,zl=4;function xv(r,e,t){return e!=null?(e?Ms:0)|(e==="full"?pd:0):r&&r.whitespace=="pre"?Ms|pd:t&-5}class Ol{constructor(e,t,n,i,a,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=Pt.none,this.match=a||(o&zl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Oe.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ms)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let a=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let t=Oe.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Oe.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!cb.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ev{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,a,o=xv(null,t.preserveWhitespace,0)|(n?zl:0);i?a=new Ol(i.type,i.attrs,Pt.none,!0,t.topMatch||i.type.contentMatch,o):n?a=new Ol(null,null,Pt.none,!0,null,o):a=new Ol(e.schema.topNodeType,null,Pt.none,!0,null,o),this.nodes=[a],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,i=this.top,a=i.options&pd?"full":this.localPreserveWS||(i.options&Ms)>0;if(a==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(a)a!=="full"?n=n.replace(/\r?\n|\r/g," "):n=n.replace(/\r\n?/g,`
3
3
  `);else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let i=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),s;fb.hasOwnProperty(o)&&this.parser.normalizeLists&&bQ(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));e:if(l?l.ignore:yQ.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let f,p=this.needsBlock;if(cb.hasOwnProperty(o))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),f=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let k=l&&l.skip?t:this.readStyles(e,t);k&&this.addAll(e,k),f&&this.sync(a),this.needsBlock=p}else{let f=this.readStyles(e,t);f&&this.addElementByRule(e,l,f,l.consuming===!1?s:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let a=this.parser.matchedStyles[i],o=n.getPropertyValue(a);if(o)for(let s=void 0;;){let l=this.parser.matchStyle(a,o,this,s);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(f=>!l.clearMark(f)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)s=l;else break}}return t}addElementByRule(e,t,n,i){let a,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let l=this.enter(o,t.attrs||null,n,t.preserveWhitespace);l&&(a=!0,n=l)}else{let l=this.parser.schema.marks[t.mark];n=n.concat(l.create(t.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,n,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,n),this.findAround(e,l,!1)}a&&this.sync(s)&&this.open--}addAll(e,t,n,i){let a=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=i==null?null:e.childNodes[i];o!=s;o=o.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(o,t);this.findAtPoint(e,a)}findPlace(e,t,n){let i,a;for(let o=this.open,s=0;o>=0;o--){let l=this.nodes[o],f=l.findWrapping(e);if(f&&(!i||i.length>f.length+s)&&(i=f,a=l,!f.length))break;if(l.solid){if(n)break;s+=2}}if(!i)return null;this.sync(a);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(t=this.enterInner(a,null,t))}let i=this.findPlace(e,t,n);if(i){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let o=Pt.none;for(let s of i.concat(e.marks))(a.type?a.type.allowsMarkType(s.type):Av(s.type,e.type))&&(o=s.addToSet(o));return a.content.push(e.mark(o)),!0}return!1}enter(e,t,n,i){let a=this.findPlace(e.create(t),n,!1);return a&&(a=this.enterInner(e,t,n,!0,i)),a}enterInner(e,t,n,i=!1,a){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=xv(e,a,o.options);o.options&zl&&o.content.length==0&&(s|=zl);let l=Pt.none;return n=n.filter(f=>(o.type?o.type.allowsMarkType(f.type):Av(f.type,e))?(l=f.addToSet(l),!1):!0),this.nodes.push(new Ol(e,t,l,i,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Ms)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),a=-(n?n.depth+1:0)+(i?0:1),o=(s,l)=>{for(;s>=0;s--){let f=t[s];if(f==""){if(s==t.length-1||s==0)continue;for(;l>=a;l--)if(o(s-1,l))return!0;return!1}else{let p=l>0||l==0&&i?this.nodes[l].type:n&&l>=a?n.node(l-a).type:null;if(!p||p.name!=f&&!p.isInGroup(f))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function bQ(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&fb.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function kQ(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function Mv(r){let e={};for(let t in r)e[t]=r[t];return e}function Av(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let a=[],o=s=>{a.push(s);for(let l=0;l<s.edgeCount;l++){let{type:f,next:p}=s.edge(l);if(f==e||a.indexOf(p)<0&&o(p))return!0}};if(o(i.contentMatch))return!0}}class Jo{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Sf(t).createDocumentFragment());let i=n,a=[];return e.forEach(o=>{if(a.length||o.marks.length){let s=0,l=0;for(;s<a.length&&l<o.marks.length;){let f=o.marks[l];if(!this.marks[f.type.name]){l++;continue}if(!f.eq(a[s][0])||f.type.spec.spanning===!1)break;s++,l++}for(;s<a.length;)i=a.pop()[1];for(;l<o.marks.length;){let f=o.marks[l++],p=this.serializeMark(f,o.isInline,t);p&&(a.push([f,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:i}=Vl(Sf(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let a=this.serializeMark(e.marks[i],e.isInline,t);a&&((a.contentDOM||a.dom).appendChild(n),n=a.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&Vl(Sf(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return Vl(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Jo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ov(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return Ov(e.marks)}}function Ov(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function Sf(r){return r.document||window.document}const Nv=new WeakMap;function wQ(r){let e=Nv.get(r);return e===void 0&&Nv.set(r,e=CQ(r)),e}function CQ(r){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i<n.length;i++)t(n[i]);else for(let i in n)t(n[i])}return t(r),e}function Vl(r,e,t,n){if(typeof e=="string")return{dom:r.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],a;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(a=wQ(n))&&a.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let s,l=t?r.createElementNS(t,i):r.createElement(i),f=e[1],p=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){p=2;for(let k in f)if(f[k]!=null){let T=k.indexOf(" ");T>0?l.setAttributeNS(k.slice(0,T),k.slice(T+1),f[k]):l.setAttribute(k,f[k])}}for(let k=p;k<e.length;k++){let T=e[k];if(T===0){if(k<e.length-1||k>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:x,contentDOM:E}=Vl(r,T,t,n);if(l.appendChild(x),E){if(s)throw new RangeError("Multiple content holes");s=E}}}return{dom:l,contentDOM:s}}const db=65535,hb=Math.pow(2,16);function TQ(r,e){return r+e*hb}function Dv(r){return r&db}function SQ(r){return(r-(r&db))/hb}const pb=1,vb=2,Ul=4,mb=8;class vd{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&mb)>0}get deletedBefore(){return(this.delInfo&(pb|Ul))>0}get deletedAfter(){return(this.delInfo&(vb|Ul))>0}get deletedAcross(){return(this.delInfo&Ul)>0}}class un{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&un.empty)return un.empty}recover(e){let t=0,n=Dv(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+SQ(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,a=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?i:0);if(l>e)break;let f=this.ranges[s+a],p=this.ranges[s+o],k=l+f;if(e<=k){let T=f?e==l?-1:e==k?1:t:t,x=l+i+(T<0?0:p);if(n)return x;let E=e==(t<0?l:k)?null:TQ(s/3,e-l),P=e==l?vb:e==k?pb:Ul;return(t<0?e!=l:e!=k)&&(P|=mb),new vd(x,P,E)}i+=p-f}return n?e+i:new vd(e+i,0,null)}touches(e,t){let n=0,i=Dv(t),a=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?n:0);if(l>e)break;let f=this.ranges[s+a],p=l+f;if(e<=p&&s==i*3)return!0;n+=this.ranges[s+o]-f}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,a=0;i<this.ranges.length;i+=3){let o=this.ranges[i],s=o-(this.inverted?a:0),l=o+(this.inverted?0:a),f=this.ranges[i+t],p=this.ranges[i+n];e(s,s+f,l,l+p),a+=p-f}}invert(){return new un(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?un.empty:new un(e<0?[0,-e,0]:[0,0,e])}}un.empty=new un([]);class As{constructor(e,t,n=0,i=e?e.length:0){this.mirror=t,this.from=n,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new As(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?n+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new As;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let i=0;for(let a=this.from;a<this.to;a++){let o=this._maps[a],s=o.mapResult(e,t);if(s.recover!=null){let l=this.getMirror(a);if(l!=null&&l>a&&l<this.to){a=l,e=this._maps[l].recover(s.recover);continue}}i|=s.delInfo,e=s.pos}return n?e:new vd(e,i,null)}}const xf=Object.create(null);class Ur{getMap(){return un.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=xf[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in xf)throw new RangeError("Duplicate use of step JSON ID "+e);return xf[e]=t,t.prototype.jsonID=e,t}}class hr{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new hr(e,null)}static fail(e){return new hr(null,e)}static fromReplace(e,t,n,i){try{return hr.ok(e.replace(t,n,i))}catch(a){if(a instanceof Ql)return hr.fail(a.message);throw a}}}function eh(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let a=r.child(i);a.content.size&&(a=a.copy(eh(a.content,e,a))),a.isInline&&(a=e(a,t,i)),n.push(a)}return Oe.fromArray(n)}class Qi extends Ur{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),a=new Ue(eh(t.content,(o,s)=>!o.isAtom||!s.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return hr.fromReplace(e,this.from,this.to,a)}invert(){return new oi(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Qi(t.pos,n.pos,this.mark)}merge(e){return e instanceof Qi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Qi(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Qi(t.from,t.to,e.markFromJSON(t.mark))}}Ur.jsonID("addMark",Qi);class oi extends Ur{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Ue(eh(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return hr.fromReplace(e,this.from,this.to,n)}invert(){return new Qi(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new oi(t.pos,n.pos,this.mark)}merge(e){return e instanceof oi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new oi(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new oi(t.from,t.to,e.markFromJSON(t.mark))}}Ur.jsonID("removeMark",oi);class ea extends Ur{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return hr.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return hr.fromReplace(e,this.pos,this.pos+1,new Ue(Oe.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new ea(this.pos,t.marks[i]);return new ea(this.pos,this.mark)}}return new Wa(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ea(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ea(t.pos,e.markFromJSON(t.mark))}}Ur.jsonID("addNodeMark",ea);class Wa extends Ur{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return hr.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return hr.fromReplace(e,this.pos,this.pos+1,new Ue(Oe.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new ea(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Wa(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Wa(t.pos,e.markFromJSON(t.mark))}}Ur.jsonID("removeNodeMark",Wa);class _r extends Ur{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&md(e,this.from,this.to)?hr.fail("Structure replace would overwrite content"):hr.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new un([this.from,this.to-this.from,this.slice.size])}invert(e){return new _r(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new _r(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof _r)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?Ue.empty:new Ue(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new _r(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?Ue.empty:new Ue(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new _r(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new _r(t.from,t.to,Ue.fromJSON(e,t.slice),!!t.structure)}}Ur.jsonID("replace",_r);class Sr extends Ur{constructor(e,t,n,i,a,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=a,this.insert=o,this.structure=s}apply(e){if(this.structure&&(md(e,this.from,this.gapFrom)||md(e,this.gapTo,this.to)))return hr.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return hr.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?hr.fromReplace(e,this.from,this.to,n):hr.fail("Content does not fit in gap")}getMap(){return new un([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Sr(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||a>n.pos?null:new Sr(t.pos,n.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Sr(t.from,t.to,t.gapFrom,t.gapTo,Ue.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ur.jsonID("replaceAround",Sr);function md(r,e,t){let n=r.resolve(e),i=t-e,a=n.depth;for(;i>0&&a>0&&n.indexAfter(a)==n.node(a).childCount;)a--,i--;if(i>0){let o=n.node(a).maybeChild(n.indexAfter(a));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function xQ(r,e,t,n){let i=[],a=[],o,s;r.doc.nodesBetween(e,t,(l,f,p)=>{if(!l.isInline)return;let k=l.marks;if(!n.isInSet(k)&&p.type.allowsMarkType(n.type)){let T=Math.max(f,e),x=Math.min(f+l.nodeSize,t),E=n.addToSet(k);for(let P=0;P<k.length;P++)k[P].isInSet(E)||(o&&o.to==T&&o.mark.eq(k[P])?o.to=x:i.push(o=new oi(T,x,k[P])));s&&s.to==T?s.to=x:a.push(s=new Qi(T,x,n))}}),i.forEach(l=>r.step(l)),a.forEach(l=>r.step(l))}function EQ(r,e,t,n){let i=[],a=0;r.doc.nodesBetween(e,t,(o,s)=>{if(!o.isInline)return;a++;let l=null;if(n instanceof Mu){let f=o.marks,p;for(;p=n.isInSet(f);)(l||(l=[])).push(p),f=p.removeFromSet(f)}else n?n.isInSet(o.marks)&&(l=[n]):l=o.marks;if(l&&l.length){let f=Math.min(s+o.nodeSize,t);for(let p=0;p<l.length;p++){let k=l[p],T;for(let x=0;x<i.length;x++){let E=i[x];E.step==a-1&&k.eq(i[x].style)&&(T=E)}T?(T.to=f,T.step=a):i.push({style:k,from:Math.max(s,e),to:f,step:a})}}}),i.forEach(o=>r.step(new oi(o.from,o.to,o.style)))}function th(r,e,t,n=t.contentMatch,i=!0){let a=r.doc.nodeAt(e),o=[],s=e+1;for(let l=0;l<a.childCount;l++){let f=a.child(l),p=s+f.nodeSize,k=n.matchType(f.type);if(!k)o.push(new _r(s,p,Ue.empty));else{n=k;for(let T=0;T<f.marks.length;T++)t.allowsMarkType(f.marks[T].type)||r.step(new oi(s,p,f.marks[T]));if(i&&f.isText&&t.whitespace!="pre"){let T,x=/\r?\n|\r/g,E;for(;T=x.exec(f.text);)E||(E=new Ue(Oe.from(t.schema.text(" ",t.allowedMarks(f.marks))),0,0)),o.push(new _r(s+T.index,s+T.index+T[0].length,E))}}s=p}if(!n.validEnd){let l=n.fillBefore(Oe.empty,!0);r.replace(s,s,new Ue(l,0,0))}for(let l=o.length-1;l>=0;l--)r.step(o[l])}function MQ(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function Au(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth;;--n){let i=r.$from.node(n),a=r.$from.index(n),o=r.$to.indexAfter(n);if(n<r.depth&&i.canReplace(a,o,t))return n;if(n==0||i.type.spec.isolating||!MQ(i,a,o))break}return null}function AQ(r,e,t){let{$from:n,$to:i,depth:a}=e,o=n.before(a+1),s=i.after(a+1),l=o,f=s,p=Oe.empty,k=0;for(let E=a,P=!1;E>t;E--)P||n.index(E)>0?(P=!0,p=Oe.from(n.node(E).copy(p)),k++):l--;let T=Oe.empty,x=0;for(let E=a,P=!1;E>t;E--)P||i.after(E+1)<i.end(E)?(P=!0,T=Oe.from(i.node(E).copy(T)),x++):f++;r.step(new Sr(l,f,o,s,new Ue(p.append(T),k,x),p.size-k,!0))}function OQ(r,e,t=null,n=r){let i=NQ(r,e),a=i&&DQ(n,e);return a?i.map(Lv).concat({type:e,attrs:t}).concat(a.map(Lv)):null}function Lv(r){return{type:r,attrs:null}}function NQ(r,e){let{parent:t,startIndex:n,endIndex:i}=r,a=t.contentMatchAt(n).findWrapping(e);if(!a)return null;let o=a.length?a[0]:e;return t.canReplaceWith(n,i,o)?a:null}function DQ(r,e){let{parent:t,startIndex:n,endIndex:i}=r,a=t.child(n),o=e.contentMatch.findWrapping(a.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let f=n;l&&f<i;f++)l=l.matchType(t.child(f).type);return!l||!l.validEnd?null:o}function LQ(r,e,t){let n=Oe.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let s=t[o].type.contentMatch.matchFragment(n);if(!s||!s.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=Oe.from(t[o].type.create(t[o].attrs,n))}let i=e.start,a=e.end;r.step(new Sr(i,a,i,a,new Ue(n,0,0),t.length,!0))}function RQ(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=r.steps.length;r.doc.nodesBetween(e,t,(o,s)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,l)&&IQ(r.doc,r.mapping.slice(a).map(s),n)){let f=null;if(n.schema.linebreakReplacement){let x=n.whitespace=="pre",E=!!n.contentMatch.matchType(n.schema.linebreakReplacement);x&&!E?f=!1:!x&&E&&(f=!0)}f===!1&&yb(r,o,s,a),th(r,r.mapping.slice(a).map(s,1),n,void 0,f===null);let p=r.mapping.slice(a),k=p.map(s,1),T=p.map(s+o.nodeSize,1);return r.step(new Sr(k,T,k+1,T-1,new Ue(Oe.from(n.create(l,null,o.marks)),0,0),1,!0)),f===!0&&gb(r,o,s,a),!1}})}function gb(r,e,t,n){e.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let l=r.mapping.slice(n).map(t+1+a+o.index);r.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function yb(r,e,t,n){e.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let o=r.mapping.slice(n).map(t+1+a);r.replaceWith(o,o+1,e.type.schema.text(`
@@ -1 +1 @@
1
- import{r as i,j as u}from"./app.js";import{c as j}from"./compiler-runtime-tM4jBQ-T.js";import{d as S,A as K,c as C,a as W,u as J,R as Q,P as Z,D as ee,C as te,e as oe}from"./index-Cdb9ACvz.js";import{u as H,a as re}from"./index-DrWfGwtf.js";import{c as ne}from"./index-D5ir9iUV.js";import{P as $}from"./index-BC0yfOHo.js";import{P as se}from"./index-K81GbF6O.js";import{R as ae}from"./index-BcE9FUM6.js";import{c as ie}from"./utils-DjqsqOe8.js";var[D,$e]=ne("Tooltip",[S]),O=S(),G="TooltipProvider",le=700,A="tooltip.open",[ce,k]=D(G),F=o=>{const{__scopeTooltip:e,delayDuration:t=le,skipDelayDuration:r=300,disableHoverableContent:n=!1,children:s}=o,l=i.useRef(!0),p=i.useRef(!1),a=i.useRef(0);return i.useEffect(()=>{const d=a.current;return()=>window.clearTimeout(d)},[]),u.jsx(ce,{scope:e,isOpenDelayedRef:l,delayDuration:t,onOpen:i.useCallback(()=>{window.clearTimeout(a.current),l.current=!1},[]),onClose:i.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:p,onPointerInTransitChange:i.useCallback(d=>{p.current=d},[]),disableHoverableContent:n,children:s})};F.displayName=G;var R="Tooltip",[ue,_]=D(R),z=o=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:n,onOpenChange:s,disableHoverableContent:l,delayDuration:p}=o,a=k(R,o.__scopeTooltip),d=O(e),[c,v]=i.useState(null),x=W(),f=i.useRef(0),m=l??a.disableHoverableContent,T=p??a.delayDuration,h=i.useRef(!1),[g,y]=J({prop:r,defaultProp:n??!1,onChange:I=>{I?(a.onOpen(),document.dispatchEvent(new CustomEvent(A))):a.onClose(),s==null||s(I)},caller:R}),w=i.useMemo(()=>g?h.current?"delayed-open":"instant-open":"closed",[g]),P=i.useCallback(()=>{window.clearTimeout(f.current),f.current=0,h.current=!1,y(!0)},[y]),E=i.useCallback(()=>{window.clearTimeout(f.current),f.current=0,y(!1)},[y]),N=i.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{h.current=!0,y(!0),f.current=0},T)},[T,y]);return i.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),u.jsx(Q,{...d,children:u.jsx(ue,{scope:e,contentId:x,open:g,stateAttribute:w,trigger:c,onTriggerChange:v,onTriggerEnter:i.useCallback(()=>{a.isOpenDelayedRef.current?N():P()},[a.isOpenDelayedRef,N,P]),onTriggerLeave:i.useCallback(()=>{m?E():(window.clearTimeout(f.current),f.current=0)},[E,m]),onOpen:P,onClose:E,disableHoverableContent:m,children:t})})};z.displayName=R;var L="TooltipTrigger",B=i.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=_(L,t),s=k(L,t),l=O(t),p=i.useRef(null),a=H(e,p,n.onTriggerChange),d=i.useRef(!1),c=i.useRef(!1),v=i.useCallback(()=>d.current=!1,[]);return i.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),u.jsx(K,{asChild:!0,...l,children:u.jsx(se.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...r,ref:a,onPointerMove:C(o.onPointerMove,x=>{x.pointerType!=="touch"&&!c.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),c.current=!0)}),onPointerLeave:C(o.onPointerLeave,()=>{n.onTriggerLeave(),c.current=!1}),onPointerDown:C(o.onPointerDown,()=>{n.open&&n.onClose(),d.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:C(o.onFocus,()=>{d.current||n.onOpen()}),onBlur:C(o.onBlur,n.onClose),onClick:C(o.onClick,n.onClose)})})});B.displayName=L;var M="TooltipPortal",[pe,de]=D(M,{forceMount:void 0}),U=o=>{const{__scopeTooltip:e,forceMount:t,children:r,container:n}=o,s=_(M,e);return u.jsx(pe,{scope:e,forceMount:t,children:u.jsx($,{present:t||s.open,children:u.jsx(Z,{asChild:!0,container:n,children:r})})})};U.displayName=M;var b="TooltipContent",V=i.forwardRef((o,e)=>{const t=de(b,o.__scopeTooltip),{forceMount:r=t.forceMount,side:n="top",...s}=o,l=_(b,o.__scopeTooltip);return u.jsx($,{present:r||l.open,children:l.disableHoverableContent?u.jsx(Y,{side:n,...s,ref:e}):u.jsx(fe,{side:n,...s,ref:e})})}),fe=i.forwardRef((o,e)=>{const t=_(b,o.__scopeTooltip),r=k(b,o.__scopeTooltip),n=i.useRef(null),s=H(e,n),[l,p]=i.useState(null),{trigger:a,onClose:d}=t,c=n.current,{onPointerInTransitChange:v}=r,x=i.useCallback(()=>{p(null),v(!1)},[v]),f=i.useCallback((m,T)=>{const h=m.currentTarget,g={x:m.clientX,y:m.clientY},y=he(g,h.getBoundingClientRect()),w=Te(g,y),P=ye(T.getBoundingClientRect()),E=Ce([...w,...P]);p(E),v(!0)},[v]);return i.useEffect(()=>()=>x(),[x]),i.useEffect(()=>{if(a&&c){const m=h=>f(h,c),T=h=>f(h,a);return a.addEventListener("pointerleave",m),c.addEventListener("pointerleave",T),()=>{a.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",T)}}},[a,c,f,x]),i.useEffect(()=>{if(l){const m=T=>{const h=T.target,g={x:T.clientX,y:T.clientY},y=(a==null?void 0:a.contains(h))||(c==null?void 0:c.contains(h)),w=!ge(g,l);y?x():w&&(x(),d())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[a,c,l,d,x]),u.jsx(Y,{...o,ref:s})}),[ve,xe]=D(R,{isInside:!1}),me=re("TooltipContent"),Y=i.forwardRef((o,e)=>{const{__scopeTooltip:t,children:r,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:l,...p}=o,a=_(b,t),d=O(t),{onClose:c}=a;return i.useEffect(()=>(document.addEventListener(A,c),()=>document.removeEventListener(A,c)),[c]),i.useEffect(()=>{if(a.trigger){const v=x=>{const f=x.target;f!=null&&f.contains(a.trigger)&&c()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[a.trigger,c]),u.jsx(ee,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:v=>v.preventDefault(),onDismiss:c,children:u.jsxs(te,{"data-state":a.stateAttribute,...d,...p,ref:e,style:{...p.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[u.jsx(me,{children:r}),u.jsx(ve,{scope:t,isInside:!0,children:u.jsx(ae,{id:a.contentId,role:"tooltip",children:n||r})})]})})});V.displayName=b;var q="TooltipArrow",X=i.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=O(t);return xe(q,t).isInside?null:u.jsx(oe,{...n,...r,ref:e})});X.displayName=q;function he(o,e){const t=Math.abs(e.top-o.y),r=Math.abs(e.bottom-o.y),n=Math.abs(e.right-o.x),s=Math.abs(e.left-o.x);switch(Math.min(t,r,n,s)){case s:return"left";case n:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Te(o,e,t=5){const r=[];switch(e){case"top":r.push({x:o.x-t,y:o.y+t},{x:o.x+t,y:o.y+t});break;case"bottom":r.push({x:o.x-t,y:o.y-t},{x:o.x+t,y:o.y-t});break;case"left":r.push({x:o.x+t,y:o.y-t},{x:o.x+t,y:o.y+t});break;case"right":r.push({x:o.x-t,y:o.y-t},{x:o.x-t,y:o.y+t});break}return r}function ye(o){const{top:e,right:t,bottom:r,left:n}=o;return[{x:n,y:e},{x:t,y:e},{x:t,y:r},{x:n,y:r}]}function ge(o,e){const{x:t,y:r}=o;let n=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const p=e[s],a=e[l],d=p.x,c=p.y,v=a.x,x=a.y;c>r!=x>r&&t<(v-d)*(r-c)/(x-c)+d&&(n=!n)}return n}function Ce(o){const e=o.slice();return e.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),be(e)}function be(o){if(o.length<=1)return o.slice();const e=[];for(let r=0;r<o.length;r++){const n=o[r];for(;e.length>=2;){const s=e[e.length-1],l=e[e.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))e.pop();else break}e.push(n)}e.pop();const t=[];for(let r=o.length-1;r>=0;r--){const n=o[r];for(;t.length>=2;){const s=t[t.length-1],l=t[t.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))t.pop();else break}t.push(n)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}var we=F,Pe=z,Ee=B,Re=U,_e=V,je=X;function De(o){const e=j.c(6);let t,r;e[0]!==o?({delayDuration:r,...t}=o,e[0]=o,e[1]=t,e[2]=r):(t=e[1],r=e[2]);const n=r===void 0?0:r;let s;return e[3]!==n||e[4]!==t?(s=u.jsx(we,{"data-slot":"tooltip-provider",delayDuration:n,...t}),e[3]=n,e[4]=t,e[5]=s):s=e[5],s}function Ge(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=u.jsx(De,{children:u.jsx(Pe,{"data-slot":"tooltip",...t})}),e[2]=t,e[3]=r):r=e[3],r}function Fe(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=u.jsx(Ee,{"data-slot":"tooltip-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function ze(o){const e=j.c(13);let t,r,n,s;e[0]!==o?({className:r,sideOffset:s,children:t,...n}=o,e[0]=o,e[1]=t,e[2]=r,e[3]=n,e[4]=s):(t=e[1],r=e[2],n=e[3],s=e[4]);const l=s===void 0?0:s;let p;e[5]!==r?(p=ie("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",r),e[5]=r,e[6]=p):p=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(je,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"}),e[7]=a):a=e[7];let d;return e[8]!==t||e[9]!==n||e[10]!==l||e[11]!==p?(d=u.jsx(Re,{children:u.jsxs(_e,{"data-slot":"tooltip-content",sideOffset:l,className:p,...n,children:[t,a]})}),e[8]=t,e[9]=n,e[10]=l,e[11]=p,e[12]=d):d=e[12],d}export{De as T,Ge as a,Fe as b,ze as c};
1
+ import{r as i,j as u}from"./app.js";import{c as j}from"./compiler-runtime-Cj7rbuyn.js";import{k as S,A as K,c as C,i as W,j as J,m as Q,P as Z,D as ee,C as te,n as oe}from"./index-BCpOvf4m.js";import{u as H,a as re}from"./index-DU8vYhyh.js";import{c as ne}from"./index-Cq31rrfZ.js";import{P as $}from"./index-lqMxC6QB.js";import{P as se}from"./index-DN1K56yz.js";import{R as ae}from"./index-DoVAC0HX.js";import{c as ie}from"./utils-DjqsqOe8.js";var[D,$e]=ne("Tooltip",[S]),O=S(),G="TooltipProvider",le=700,A="tooltip.open",[ce,k]=D(G),F=o=>{const{__scopeTooltip:e,delayDuration:t=le,skipDelayDuration:r=300,disableHoverableContent:n=!1,children:s}=o,l=i.useRef(!0),p=i.useRef(!1),a=i.useRef(0);return i.useEffect(()=>{const d=a.current;return()=>window.clearTimeout(d)},[]),u.jsx(ce,{scope:e,isOpenDelayedRef:l,delayDuration:t,onOpen:i.useCallback(()=>{window.clearTimeout(a.current),l.current=!1},[]),onClose:i.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:p,onPointerInTransitChange:i.useCallback(d=>{p.current=d},[]),disableHoverableContent:n,children:s})};F.displayName=G;var R="Tooltip",[ue,_]=D(R),z=o=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:n,onOpenChange:s,disableHoverableContent:l,delayDuration:p}=o,a=k(R,o.__scopeTooltip),d=O(e),[c,v]=i.useState(null),x=W(),f=i.useRef(0),m=l??a.disableHoverableContent,T=p??a.delayDuration,h=i.useRef(!1),[g,y]=J({prop:r,defaultProp:n??!1,onChange:I=>{I?(a.onOpen(),document.dispatchEvent(new CustomEvent(A))):a.onClose(),s==null||s(I)},caller:R}),w=i.useMemo(()=>g?h.current?"delayed-open":"instant-open":"closed",[g]),P=i.useCallback(()=>{window.clearTimeout(f.current),f.current=0,h.current=!1,y(!0)},[y]),E=i.useCallback(()=>{window.clearTimeout(f.current),f.current=0,y(!1)},[y]),N=i.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{h.current=!0,y(!0),f.current=0},T)},[T,y]);return i.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),u.jsx(Q,{...d,children:u.jsx(ue,{scope:e,contentId:x,open:g,stateAttribute:w,trigger:c,onTriggerChange:v,onTriggerEnter:i.useCallback(()=>{a.isOpenDelayedRef.current?N():P()},[a.isOpenDelayedRef,N,P]),onTriggerLeave:i.useCallback(()=>{m?E():(window.clearTimeout(f.current),f.current=0)},[E,m]),onOpen:P,onClose:E,disableHoverableContent:m,children:t})})};z.displayName=R;var L="TooltipTrigger",B=i.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=_(L,t),s=k(L,t),l=O(t),p=i.useRef(null),a=H(e,p,n.onTriggerChange),d=i.useRef(!1),c=i.useRef(!1),v=i.useCallback(()=>d.current=!1,[]);return i.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),u.jsx(K,{asChild:!0,...l,children:u.jsx(se.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...r,ref:a,onPointerMove:C(o.onPointerMove,x=>{x.pointerType!=="touch"&&!c.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),c.current=!0)}),onPointerLeave:C(o.onPointerLeave,()=>{n.onTriggerLeave(),c.current=!1}),onPointerDown:C(o.onPointerDown,()=>{n.open&&n.onClose(),d.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:C(o.onFocus,()=>{d.current||n.onOpen()}),onBlur:C(o.onBlur,n.onClose),onClick:C(o.onClick,n.onClose)})})});B.displayName=L;var M="TooltipPortal",[pe,de]=D(M,{forceMount:void 0}),U=o=>{const{__scopeTooltip:e,forceMount:t,children:r,container:n}=o,s=_(M,e);return u.jsx(pe,{scope:e,forceMount:t,children:u.jsx($,{present:t||s.open,children:u.jsx(Z,{asChild:!0,container:n,children:r})})})};U.displayName=M;var b="TooltipContent",V=i.forwardRef((o,e)=>{const t=de(b,o.__scopeTooltip),{forceMount:r=t.forceMount,side:n="top",...s}=o,l=_(b,o.__scopeTooltip);return u.jsx($,{present:r||l.open,children:l.disableHoverableContent?u.jsx(Y,{side:n,...s,ref:e}):u.jsx(fe,{side:n,...s,ref:e})})}),fe=i.forwardRef((o,e)=>{const t=_(b,o.__scopeTooltip),r=k(b,o.__scopeTooltip),n=i.useRef(null),s=H(e,n),[l,p]=i.useState(null),{trigger:a,onClose:d}=t,c=n.current,{onPointerInTransitChange:v}=r,x=i.useCallback(()=>{p(null),v(!1)},[v]),f=i.useCallback((m,T)=>{const h=m.currentTarget,g={x:m.clientX,y:m.clientY},y=he(g,h.getBoundingClientRect()),w=Te(g,y),P=ye(T.getBoundingClientRect()),E=Ce([...w,...P]);p(E),v(!0)},[v]);return i.useEffect(()=>()=>x(),[x]),i.useEffect(()=>{if(a&&c){const m=h=>f(h,c),T=h=>f(h,a);return a.addEventListener("pointerleave",m),c.addEventListener("pointerleave",T),()=>{a.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",T)}}},[a,c,f,x]),i.useEffect(()=>{if(l){const m=T=>{const h=T.target,g={x:T.clientX,y:T.clientY},y=(a==null?void 0:a.contains(h))||(c==null?void 0:c.contains(h)),w=!ge(g,l);y?x():w&&(x(),d())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[a,c,l,d,x]),u.jsx(Y,{...o,ref:s})}),[ve,xe]=D(R,{isInside:!1}),me=re("TooltipContent"),Y=i.forwardRef((o,e)=>{const{__scopeTooltip:t,children:r,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:l,...p}=o,a=_(b,t),d=O(t),{onClose:c}=a;return i.useEffect(()=>(document.addEventListener(A,c),()=>document.removeEventListener(A,c)),[c]),i.useEffect(()=>{if(a.trigger){const v=x=>{const f=x.target;f!=null&&f.contains(a.trigger)&&c()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[a.trigger,c]),u.jsx(ee,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:v=>v.preventDefault(),onDismiss:c,children:u.jsxs(te,{"data-state":a.stateAttribute,...d,...p,ref:e,style:{...p.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[u.jsx(me,{children:r}),u.jsx(ve,{scope:t,isInside:!0,children:u.jsx(ae,{id:a.contentId,role:"tooltip",children:n||r})})]})})});V.displayName=b;var q="TooltipArrow",X=i.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=O(t);return xe(q,t).isInside?null:u.jsx(oe,{...n,...r,ref:e})});X.displayName=q;function he(o,e){const t=Math.abs(e.top-o.y),r=Math.abs(e.bottom-o.y),n=Math.abs(e.right-o.x),s=Math.abs(e.left-o.x);switch(Math.min(t,r,n,s)){case s:return"left";case n:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Te(o,e,t=5){const r=[];switch(e){case"top":r.push({x:o.x-t,y:o.y+t},{x:o.x+t,y:o.y+t});break;case"bottom":r.push({x:o.x-t,y:o.y-t},{x:o.x+t,y:o.y-t});break;case"left":r.push({x:o.x+t,y:o.y-t},{x:o.x+t,y:o.y+t});break;case"right":r.push({x:o.x-t,y:o.y-t},{x:o.x-t,y:o.y+t});break}return r}function ye(o){const{top:e,right:t,bottom:r,left:n}=o;return[{x:n,y:e},{x:t,y:e},{x:t,y:r},{x:n,y:r}]}function ge(o,e){const{x:t,y:r}=o;let n=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const p=e[s],a=e[l],d=p.x,c=p.y,v=a.x,x=a.y;c>r!=x>r&&t<(v-d)*(r-c)/(x-c)+d&&(n=!n)}return n}function Ce(o){const e=o.slice();return e.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),be(e)}function be(o){if(o.length<=1)return o.slice();const e=[];for(let r=0;r<o.length;r++){const n=o[r];for(;e.length>=2;){const s=e[e.length-1],l=e[e.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))e.pop();else break}e.push(n)}e.pop();const t=[];for(let r=o.length-1;r>=0;r--){const n=o[r];for(;t.length>=2;){const s=t[t.length-1],l=t[t.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))t.pop();else break}t.push(n)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}var we=F,Pe=z,Ee=B,Re=U,_e=V,je=X;function De(o){const e=j.c(6);let t,r;e[0]!==o?({delayDuration:r,...t}=o,e[0]=o,e[1]=t,e[2]=r):(t=e[1],r=e[2]);const n=r===void 0?0:r;let s;return e[3]!==n||e[4]!==t?(s=u.jsx(we,{"data-slot":"tooltip-provider",delayDuration:n,...t}),e[3]=n,e[4]=t,e[5]=s):s=e[5],s}function Ge(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=u.jsx(De,{children:u.jsx(Pe,{"data-slot":"tooltip",...t})}),e[2]=t,e[3]=r):r=e[3],r}function Fe(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=u.jsx(Ee,{"data-slot":"tooltip-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function ze(o){const e=j.c(13);let t,r,n,s;e[0]!==o?({className:r,sideOffset:s,children:t,...n}=o,e[0]=o,e[1]=t,e[2]=r,e[3]=n,e[4]=s):(t=e[1],r=e[2],n=e[3],s=e[4]);const l=s===void 0?0:s;let p;e[5]!==r?(p=ie("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",r),e[5]=r,e[6]=p):p=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(je,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"}),e[7]=a):a=e[7];let d;return e[8]!==t||e[9]!==n||e[10]!==l||e[11]!==p?(d=u.jsx(Re,{children:u.jsxs(_e,{"data-slot":"tooltip-content",sideOffset:l,className:p,...n,children:[t,a]})}),e[8]=t,e[9]=n,e[10]=l,e[11]=p,e[12]=d):d=e[12],d}export{De as T,Ge as a,Fe as b,ze as c};
@@ -1 +1 @@
1
- import{c as S}from"./compiler-runtime-tM4jBQ-T.js";import{r as l}from"./app.js";const y=()=>typeof window>"u"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches,E=(e,a,r=365)=>{if(typeof document>"u")return;const o=r*24*60*60;document.cookie=`${e}=${a};path=/;max-age=${o};SameSite=Lax`},c=e=>{const a=e==="dark"||e==="system"&&y();document.documentElement.classList.toggle("dark",a)},w=()=>typeof window>"u"?null:window.matchMedia("(prefers-color-scheme: dark)"),v=()=>{const e=localStorage.getItem("appearance");c(e||"light")};function C(){var a;const e=localStorage.getItem("appearance")||"system";c(e),(a=w())==null||a.addEventListener("change",v)}function L(){const e=S.c(6),[a,r]=l.useState("system"),[o,g]=l.useState(!1);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n=>{g(!0),r(n),localStorage.setItem("appearance",n),E("appearance",n),c(n),setTimeout(()=>{g(!1),window.dispatchEvent(new Event("appearanceChanged"))},0)},e[0]=s):s=e[0];const d=s;let p,i;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{const n=localStorage.getItem("appearance");d(n||"light");const h=t=>{if(t.key==="appearance"){const f=t.newValue;r(f),c(f)}},u=()=>{const t=localStorage.getItem("appearance");r(t),c(t)};return window.addEventListener("storage",h),window.addEventListener("appearanceChanged",u),()=>{var t;window.removeEventListener("storage",h),window.removeEventListener("appearanceChanged",u),(t=w())==null||t.removeEventListener("change",v)}},i=[d],e[1]=p,e[2]=i):(p=e[1],i=e[2]),l.useEffect(p,i);let m;return e[3]!==a||e[4]!==o?(m={appearance:a,updateAppearance:d,isThemeChanging:o},e[3]=a,e[4]=o,e[5]=m):m=e[5],m}export{C as i,L as u};
1
+ import{c as S}from"./compiler-runtime-Cj7rbuyn.js";import{r as l}from"./app.js";const y=()=>typeof window>"u"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches,E=(e,a,r=365)=>{if(typeof document>"u")return;const o=r*24*60*60;document.cookie=`${e}=${a};path=/;max-age=${o};SameSite=Lax`},c=e=>{const a=e==="dark"||e==="system"&&y();document.documentElement.classList.toggle("dark",a)},w=()=>typeof window>"u"?null:window.matchMedia("(prefers-color-scheme: dark)"),v=()=>{const e=localStorage.getItem("appearance");c(e||"light")};function C(){var a;const e=localStorage.getItem("appearance")||"system";c(e),(a=w())==null||a.addEventListener("change",v)}function L(){const e=S.c(6),[a,r]=l.useState("system"),[o,g]=l.useState(!1);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n=>{g(!0),r(n),localStorage.setItem("appearance",n),E("appearance",n),c(n),setTimeout(()=>{g(!1),window.dispatchEvent(new Event("appearanceChanged"))},0)},e[0]=s):s=e[0];const d=s;let p,i;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{const n=localStorage.getItem("appearance");d(n||"light");const h=t=>{if(t.key==="appearance"){const f=t.newValue;r(f),c(f)}},u=()=>{const t=localStorage.getItem("appearance");r(t),c(t)};return window.addEventListener("storage",h),window.addEventListener("appearanceChanged",u),()=>{var t;window.removeEventListener("storage",h),window.removeEventListener("appearanceChanged",u),(t=w())==null||t.removeEventListener("change",v)}},i=[d],e[1]=p,e[2]=i):(p=e[1],i=e[2]),l.useEffect(p,i);let m;return e[3]!==a||e[4]!==o?(m={appearance:a,updateAppearance:d,isThemeChanging:o},e[3]=a,e[4]=o,e[5]=m):m=e[5],m}export{C as i,L as u};
@@ -1 +1 @@
1
- import{c as s}from"./compiler-runtime-tM4jBQ-T.js";import{r}from"./app.js";const h=()=>{const e=s.c(3);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={width:typeof window<"u"?window.innerWidth:1024,height:typeof window<"u"?window.innerHeight:768},e[0]=i):i=e[0];const[d,w]=r.useState(i);let n,t;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=()=>{if(typeof window>"u")return;const o=()=>{w({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},t=[],e[1]=n,e[2]=t):(n=e[1],t=e[2]),r.useEffect(n,t),d};export{h as u};
1
+ import{c as s}from"./compiler-runtime-Cj7rbuyn.js";import{r}from"./app.js";const h=()=>{const e=s.c(3);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={width:typeof window<"u"?window.innerWidth:1024,height:typeof window<"u"?window.innerHeight:768},e[0]=i):i=e[0];const[d,w]=r.useState(i);let n,t;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=()=>{if(typeof window>"u")return;const o=()=>{w({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},t=[],e[1]=n,e[2]=t):(n=e[1],t=e[2]),r.useEffect(n,t),d};export{h as u};
@@ -1,4 +1,4 @@
1
- import{d as F,r as g,j as c}from"./app.js";import{c as S}from"./compiler-runtime-tM4jBQ-T.js";import{c as U,a as M,u as w}from"./index-D5ir9iUV.js";import{P as y}from"./index-K81GbF6O.js";import{c as I}from"./utils-DjqsqOe8.js";import"./index-DrWfGwtf.js";var E={exports:{}},A={};/**
1
+ import{c as F,r as g,j as c}from"./app.js";import{c as S}from"./compiler-runtime-Cj7rbuyn.js";import{c as U,u as M,a as w}from"./index-Cq31rrfZ.js";import{P as y}from"./index-DN1K56yz.js";import{c as I}from"./utils-DjqsqOe8.js";import"./index-DU8vYhyh.js";var E={exports:{}},A={};/**
2
2
  * @license React
3
3
  * use-sync-external-store-shim.production.js
4
4
  *
@@ -1,6 +1,6 @@
1
- import{j as t,J as u}from"./app.js";import{c as f}from"./compiler-runtime-tM4jBQ-T.js";import{g as d,e as x,d as h}from"./dropdown-menu-SEBnEIiL.js";import{UserInfo as y}from"./user-info-DBYoAJYJ.js";import{c as g}from"./createLucideIcon-BFG25zNo.js";import"./index-Cdb9ACvz.js";import"./index-D5ir9iUV.js";import"./index-K81GbF6O.js";import"./index-DrWfGwtf.js";import"./index-DEk3sC8d.js";import"./index-BbXEMx9n.js";import"./index-C0SL3SHw.js";import"./index-BC0yfOHo.js";import"./utils-DjqsqOe8.js";/**
1
+ import{j as t,J as u}from"./app.js";import{c as f}from"./compiler-runtime-Cj7rbuyn.js";import{c as d,d as x,e as h}from"./dropdown-menu-CeMIoM8d.js";import{UserInfo as y}from"./user-info-C_11jYGE.js";import{c as j}from"./createLucideIcon-BFG25zNo.js";import"./index-BCpOvf4m.js";import"./index-Cq31rrfZ.js";import"./index-DN1K56yz.js";import"./index-DU8vYhyh.js";import"./index-oMAR28Sy.js";import"./index-B__NksD2.js";import"./index-CcxvoJO6.js";import"./index-lqMxC6QB.js";import"./utils-DjqsqOe8.js";/**
2
2
  * @license lucide-react v0.485.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const j=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],b=g("log-out",j);function _(){return M}function M(){document.body.style.removeProperty("pointer-events")}function B(p){const e=f.c(11),{user:l,logout:m,logoutBtn:c}=p,a=_();let o;e[0]!==l?(o=t.jsx(d,{className:"p-0 font-normal",children:t.jsx("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:t.jsx(y,{user:l,showEmail:!0})})}),e[0]=l,e[1]=o):o=e[1];let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(x,{}),e[2]=s):s=e[2];let n;e[3]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(b,{className:"mr-2"}),e[3]=n):n=e[3];let r;e[4]!==a||e[5]!==m||e[6]!==c?(r=t.jsx(h,{asChild:!0,children:t.jsxs(u,{className:"block w-full cursor-pointer",method:"get",href:m,as:"button",onClick:a,children:[n,c]})}),e[4]=a,e[5]=m,e[6]=c,e[7]=r):r=e[7];let i;return e[8]!==o||e[9]!==r?(i=t.jsxs(t.Fragment,{children:[o,s,r]}),e[8]=o,e[9]=r,e[10]=i):i=e[10],i}export{B as UserMenuContent};
6
+ */const g=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],b=j("log-out",g);function _(){return M}function M(){document.body.style.removeProperty("pointer-events")}function B(p){const e=f.c(11),{user:l,logout:m,logoutBtn:c}=p,a=_();let o;e[0]!==l?(o=t.jsx(d,{className:"p-0 font-normal",children:t.jsx("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:t.jsx(y,{user:l,showEmail:!0})})}),e[0]=l,e[1]=o):o=e[1];let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(x,{}),e[2]=s):s=e[2];let n;e[3]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(b,{className:"mr-2"}),e[3]=n):n=e[3];let r;e[4]!==a||e[5]!==m||e[6]!==c?(r=t.jsx(h,{asChild:!0,children:t.jsxs(u,{className:"block w-full cursor-pointer",method:"get",href:m,as:"button",onClick:a,children:[n,c]})}),e[4]=a,e[5]=m,e[6]=c,e[7]=r):r=e[7];let i;return e[8]!==o||e[9]!==r?(i=t.jsxs(t.Fragment,{children:[o,s,r]}),e[8]=o,e[9]=r,e[10]=i):i=e[10],i}export{B as UserMenuContent};
@@ -0,0 +1 @@
1
+ import{q as s,j as i}from"./app.js";import{c as l}from"./compiler-runtime-Cj7rbuyn.js";import{A as x}from"./app-layout-BC2Dk0GE.js";import"./sidebar-CkxHTDia.js";import"./index-DU8vYhyh.js";import"./button-BV-GbIpN.js";import"./utils-DjqsqOe8.js";import"./index-C0o7vG6r.js";import"./createLucideIcon-BFG25zNo.js";import"./index-BCpOvf4m.js";import"./index-Cq31rrfZ.js";import"./index-DN1K56yz.js";import"./index-CcxvoJO6.js";import"./index-lqMxC6QB.js";import"./tooltip-Du62rBCn.js";import"./index-DoVAC0HX.js";import"./app-shell-jCQ5EbpR.js";import"./app-sidebar-wFqi5-7E.js";import"./nav-main-DPeRWb5e.js";import"./material-icon-BAd3Wrgn.js";import"./chevron-right-D5q8rF7h.js";import"./index-B__NksD2.js";import"./index-oMAR28Sy.js";import"./chevrons-up-down-kALltqHV.js";import"./app-sidebar-header-BcGzUtnn.js";import"./breadcrumbs-CDxSbsTe.js";import"./nav-user-G2BeH6Uu.js";import"./dropdown-menu-CeMIoM8d.js";import"./user-info-C_11jYGE.js";import"./user-menu-content-BNRzhEo_.js";import"./icon-CqJOMij7.js";import"./use-appearance-DeUiDZ72.js";const a=[];function J(){const t=l.c(8),r=s();let o;t[0]!==r.props.title?(o=r.props.title&&i.jsx("div",{className:"text-3xl mb-8",children:r.props.title}),t[0]=r.props.title,t[1]=o):o=t[1];let e;t[2]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("div",{className:"text-3xl mb-8",children:"Adminizer"}),t[2]=e):e=t[2];let p;t[3]!==r.props.text?(p=r.props.text&&i.jsx("div",{dangerouslySetInnerHTML:{__html:r.props.text}}),t[3]=r.props.text,t[4]=p):p=t[4];let m;return t[5]!==o||t[6]!==p?(m=i.jsx(x,{breadcrumbs:a,children:i.jsxs("div",{className:"flex h-full flex-1 flex-col gap-4 rounded-xl p-4",children:[o,e,p]})}),t[5]=o,t[6]=p,t[7]=m):m=t[7],m}export{J as default};
@@ -14,14 +14,14 @@ export default async function add(req, res) {
14
14
  return req.Inertia.redirect(`${req.adminizer.config.routePrefix}/${entity.uri}`);
15
15
  }
16
16
  if (req.adminizer.config.auth.enable) {
17
- if (!req.session.UserAP) {
17
+ if (!req.user) {
18
18
  return req.Inertia.redirect(`${req.adminizer.config.routePrefix}/model/userap/login`);
19
19
  }
20
- else if (!req.adminizer.accessRightsHelper.hasPermission(`create-${entity.name}-model`, req.session.UserAP)) {
20
+ else if (!req.adminizer.accessRightsHelper.hasPermission(`create-${entity.name}-model`, req.user)) {
21
21
  return res.sendStatus(403);
22
22
  }
23
23
  }
24
- let dataAccessor = new DataAccessor(req, entity, "add");
24
+ let dataAccessor = new DataAccessor(req.adminizer, req.user, entity, "add");
25
25
  let fields = dataAccessor.getFieldsConfig();
26
26
  // add deprecated 'records' to config
27
27
  fields = await FieldsHelper.loadAssociations(req, fields, "add");
@@ -91,6 +91,9 @@ export default async function add(req, res) {
91
91
  await saveRelationsMediaManager(fields, rawReqData, entity.model.identity, record.id);
92
92
  Adminizer.log.debug(`A new record was created: `, record);
93
93
  if (req.body.jsonPopupCatalog) {
94
+ dataAccessor = new DataAccessor(req.adminizer, req.user, entity, "edit");
95
+ record = await entity.model.findOne({ id: record.id }, dataAccessor);
96
+ // await new Promise(resolve => setTimeout(resolve, 2000));
94
97
  return res.json({ record: record });
95
98
  }
96
99
  else {
@@ -104,16 +107,13 @@ export default async function add(req, res) {
104
107
  data = reqData;
105
108
  }
106
109
  }
110
+ const props = inertiaAddHelper(req, entity, fields);
107
111
  if (req.query?.without_layout) {
108
- // return res.viewAdmin("./../ejs/partials/content/addPopup.ejs", {
109
- // entity: entity,
110
- // fields: fields,
111
- // data: data
112
- // });
113
- return null;
112
+ return res.json({
113
+ props: props
114
+ });
114
115
  }
115
116
  else {
116
- const props = inertiaAddHelper(req, entity, fields);
117
117
  return req.Inertia.render({
118
118
  component: 'add',
119
119
  props: props
@@ -4,10 +4,10 @@ import { inertiaGroupHelper } from "../helpers/inertiaGroupHelper";
4
4
  export default async function addGroup(req, res) {
5
5
  let entity = ControllerHelper.findEntityObject(req);
6
6
  if (req.adminizer.config.auth.enable) {
7
- if (!req.session.UserAP) {
7
+ if (!req.user) {
8
8
  return res.redirect(`${req.adminizer.config.routePrefix}/model/userap/login`);
9
9
  }
10
- else if (!req.adminizer.accessRightsHelper.hasPermission(`create-${entity.name}-model`, req.session.UserAP)) {
10
+ else if (!req.adminizer.accessRightsHelper.hasPermission(`create-${entity.name}-model`, req.user)) {
11
11
  return res.sendStatus(403);
12
12
  }
13
13
  }
@@ -25,7 +25,6 @@ export default async function addGroup(req, res) {
25
25
  groupedTokens[department] = req.adminizer.accessRightsHelper.getTokensByDepartment(department);
26
26
  }
27
27
  if (req.method.toUpperCase() === 'POST') {
28
- // console.log(req.body);
29
28
  let allTokens = req.adminizer.accessRightsHelper.getTokens();
30
29
  let usersInThisGroup = [];
31
30
  let tokensOfThisGroup = [];
@@ -60,7 +59,6 @@ export default async function addGroup(req, res) {
60
59
  Adminizer.log.error(e);
61
60
  req.session.messages.adminError.push(e.message || 'Something went wrong...');
62
61
  }
63
- // console.log(group)
64
62
  }
65
63
  const props = inertiaGroupHelper(entity, req, users, groupedTokens);
66
64
  return req.Inertia.render({
@@ -5,10 +5,10 @@ import { inertiaUserHelper } from "../helpers/inertiaUserHelper";
5
5
  export default async function (req, res) {
6
6
  let entity = ControllerHelper.findEntityObject(req);
7
7
  if (req.adminizer.config.auth.enable) {
8
- if (!req.session.UserAP) {
8
+ if (!req.user) {
9
9
  return res.redirect(`${req.adminizer.config.routePrefix}/model/userap/login`);
10
10
  }
11
- else if (!req.adminizer.accessRightsHelper.hasPermission(`create-${entity.name}-model`, req.session.UserAP)) {
11
+ else if (!req.adminizer.accessRightsHelper.hasPermission(`create-${entity.name}-model`, req.user)) {
12
12
  return res.sendStatus(403);
13
13
  }
14
14
  }
@@ -22,7 +22,6 @@ export default async function (req, res) {
22
22
  }
23
23
  let user;
24
24
  if (req.method.toUpperCase() === 'POST') {
25
- // console.log(req.body);
26
25
  let userGroups = [];
27
26
  for (let key in req.body) {
28
27
  if (key.startsWith("group-checkbox-") && req.body[key] === true) {
@@ -40,12 +39,12 @@ export default async function (req, res) {
40
39
  locale = req.body.locale === 'default' ? req.adminizer.config.translation.defaultLocale : req.body.locale;
41
40
  }
42
41
  try {
43
- let passwordHashed = generate(req.body.login + req.body.userPassword);
42
+ let passwordHashed = generate(req.body.login + req.body.userPassword + process.env.AP_PASSWORD_SALT);
44
43
  let password = 'masked';
45
44
  // TODO refactor CRUD functions for DataAccessor usage
46
45
  user = await req.adminizer.modelHandler.model.get("UserAP")["_create"]({
47
46
  login: req.body.login, fullName: req.body.fullName, email: req.body.email,
48
- password: password, passwordHashed: passwordHashed, timezone: req.body.timezone, expires: req.body.date,
47
+ passwordHashed: passwordHashed, timezone: req.body.timezone, expires: req.body.date,
49
48
  locale: locale, isAdministrator: isAdministrator, isConfirmed: isConfirmed, groups: userGroups
50
49
  });
51
50
  Adminizer.log.debug(`A new user was created: `, user);
@@ -56,7 +55,6 @@ export default async function (req, res) {
56
55
  Adminizer.log.error(e);
57
56
  req.session.messages.adminError.push(e.message || 'Something went wrong...');
58
57
  }
59
- // console.log(user)
60
58
  }
61
59
  const props = inertiaUserHelper(entity, req, groups);
62
60
  return req.Inertia.render({
@@ -1 +1 @@
1
- export declare function catalogController(req: ReqType, res: ResType): Promise<void | ResType>;
1
+ export declare function catalogController(req: ReqType, res: ResType): Promise<void | import("express").Response<any, Record<string, any>>>;