cognova 0.2.8 → 0.2.10

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 (199) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/{CH_jROT9.js → 0NJ3PaRM.js} +1 -1
  3. package/.output/public/_nuxt/{C075hYlX.js → 0yk-pS3R.js} +2 -2
  4. package/.output/public/_nuxt/{CVYcsqmL.js → 10_wwHSz.js} +1 -1
  5. package/.output/public/_nuxt/{BUC36BHp.js → 1zUTf4AP.js} +1 -1
  6. package/.output/public/_nuxt/{njnzCNrH.js → 2dNDtTiv.js} +3 -3
  7. package/.output/public/_nuxt/{B8TQvzYX.js → 2nOqGUPr.js} +1 -1
  8. package/.output/public/_nuxt/{ijmD2cEW.js → 3jQMk_5H.js} +1 -1
  9. package/.output/public/_nuxt/{D4X6ONPF.js → 4K03TkGA.js} +1 -1
  10. package/.output/public/_nuxt/{C3tximD1.js → 6boMs_nF.js} +1 -1
  11. package/.output/public/_nuxt/{Drxf7nJz.js → 7oCGSglN.js} +1 -1
  12. package/.output/public/_nuxt/{Dt5mOzXj.js → 8q5NepGW.js} +1 -1
  13. package/.output/public/_nuxt/{GYf-vnR6.js → B93pdGAW.js} +1 -1
  14. package/.output/public/_nuxt/{BZBNJD7U.js → BA_pRWwX.js} +1 -1
  15. package/.output/public/_nuxt/{eE8TtXgC.js → BDyn4ApB.js} +3 -3
  16. package/.output/public/_nuxt/{0dqQoCHY.js → BGgwYWjH.js} +1 -1
  17. package/.output/public/_nuxt/{BrOKokPO.js → BH0QDWEm.js} +1 -1
  18. package/.output/public/_nuxt/{B5SnZL2l.js → BHtY0l0l.js} +1 -1
  19. package/.output/public/_nuxt/{ImPsUDiH.js → BIXrSYwR.js} +1 -1
  20. package/.output/public/_nuxt/BK8S2ony.js +1 -0
  21. package/.output/public/_nuxt/{Bkc1Hpcf.js → BKXg-alD.js} +1 -1
  22. package/.output/public/_nuxt/{BahXyh-A.js → BLnYhy_t.js} +1 -1
  23. package/.output/public/_nuxt/{Bhhg7oSf.js → BR8bKz8h.js} +1 -1
  24. package/.output/public/_nuxt/{D2kQkOaG.js → BS2ZNXI1.js} +1 -1
  25. package/.output/public/_nuxt/{BLm0UviR.js → BUghTae1.js} +1 -1
  26. package/.output/public/_nuxt/{D4_89MZm.js → BXuWCWsJ.js} +1 -1
  27. package/.output/public/_nuxt/{LQNRVThr.js → BYHCP8x7.js} +1 -1
  28. package/.output/public/_nuxt/{BYtVdUIW.js → BZrSPX0S.js} +1 -1
  29. package/.output/public/_nuxt/{U3f6dy8i.js → B_wilgcd.js} +1 -1
  30. package/.output/public/_nuxt/BaZwjF8o.js +1 -0
  31. package/.output/public/_nuxt/{BefOhWHD.js → Bciqk4dX.js} +1 -1
  32. package/.output/public/_nuxt/{CewcVxDS.js → Beom-INj.js} +1 -1
  33. package/.output/public/_nuxt/{BlsIfvSf.js → BfcLZ_fC.js} +1 -1
  34. package/.output/public/_nuxt/{dB7G4iIC.js → Bk6JUtIo.js} +1 -1
  35. package/.output/public/_nuxt/BkfI94R8.js +1 -0
  36. package/.output/public/_nuxt/{DqzomZoo.js → BmOtR1wX.js} +1 -1
  37. package/.output/public/_nuxt/{4XnyUc7C.js → BmVLxnDU.js} +1 -1
  38. package/.output/public/_nuxt/{DtJnWtpL.js → BtHQ1T0f.js} +1 -1
  39. package/.output/public/_nuxt/{DcbbfwCe.js → ByYh0uRg.js} +1 -1
  40. package/.output/public/_nuxt/{CbvNJVrk.js → C27WoGNZ.js} +1 -1
  41. package/.output/public/_nuxt/{CY7f553E.js → C2FxZbO_.js} +1 -1
  42. package/.output/public/_nuxt/{zO9MgHj2.js → C2vq6Te8.js} +1 -1
  43. package/.output/public/_nuxt/{BXtZVbmx.js → C39dQ88F.js} +1 -1
  44. package/.output/public/_nuxt/{DmDPSvxi.js → C3NST0BU.js} +1 -1
  45. package/.output/public/_nuxt/{nHSiDk8N.js → C4mwL7SE.js} +1 -1
  46. package/.output/public/_nuxt/{BBDxhFYY.js → C5R5QaCA.js} +1 -1
  47. package/.output/public/_nuxt/{D79lbuWG.js → C6qKcgOY.js} +1 -1
  48. package/.output/public/_nuxt/{C-HCArYP.js → C71_a1IX.js} +1 -1
  49. package/.output/public/_nuxt/{CSjOaBKu.js → C9WIgRRL.js} +1 -1
  50. package/.output/public/_nuxt/{DmOS3vFH.js → CBTkrk2M.js} +1 -1
  51. package/.output/public/_nuxt/CEnSeCqn.js +1 -0
  52. package/.output/public/_nuxt/{CAfyXyeo.js → CKxSHyww.js} +1 -1
  53. package/.output/public/_nuxt/{D4Cizi4y.js → CLfF6dSn.js} +1 -1
  54. package/.output/public/_nuxt/{C7qhmmZh.js → CPutXj8l.js} +1 -1
  55. package/.output/public/_nuxt/{BCCYopTB.js → CQqCBrXj.js} +1 -1
  56. package/.output/public/_nuxt/{D-Ge96eV.js → CSKJ-Ahh.js} +1 -1
  57. package/.output/public/_nuxt/{B2Xfh7am.js → CTCcEJU3.js} +1 -1
  58. package/.output/public/_nuxt/{BnJ-6YDw.js → CVFwOzbl.js} +1 -1
  59. package/.output/public/_nuxt/{C21BjagS.js → CVdCqaby.js} +1 -1
  60. package/.output/public/_nuxt/{2QHXgMyi.js → CVqlefTY.js} +1 -1
  61. package/.output/public/_nuxt/CWyMCJQH.js +1 -0
  62. package/.output/public/_nuxt/{B6-U3KqJ.js → CY-QVcA5.js} +2 -2
  63. package/.output/public/_nuxt/{Cr0NfhPB.js → CY-cjAwJ.js} +1 -1
  64. package/.output/public/_nuxt/{Bwn-CRYH.js → CYPO5o_C.js} +1 -1
  65. package/.output/public/_nuxt/{B-AlyT2D.js → CZRnNmU8.js} +1 -1
  66. package/.output/public/_nuxt/{DwIYtFfA.js → CZVzFlpI.js} +1 -1
  67. package/.output/public/_nuxt/{BkO884Ds.js → CZoEPC_Q.js} +3 -3
  68. package/.output/public/_nuxt/{BJUff9Ku.js → Cc-2ziaZ.js} +1 -1
  69. package/.output/public/_nuxt/{BLwctszt.js → ChcO9s3o.js} +1 -1
  70. package/.output/public/_nuxt/{DX_9SfFb.js → Cl-LOSDV.js} +1 -1
  71. package/.output/public/_nuxt/{CSHcfejh.js → CobqYwkp.js} +1 -1
  72. package/.output/public/_nuxt/{B0xuHXvN.js → CqNwHCpo.js} +1 -1
  73. package/.output/public/_nuxt/{DMb_1D81.js → CuxrHsu-.js} +1 -1
  74. package/.output/public/_nuxt/{GGcn5KPW.js → CwPdIZ9J.js} +1 -1
  75. package/.output/public/_nuxt/{D7pKT3IW.js → D0ifH682.js} +1 -1
  76. package/.output/public/_nuxt/{KEeoKtq_.js → D3AZaldL.js} +1 -1
  77. package/.output/public/_nuxt/{BdxP21ep.js → D4UJwDQJ.js} +1 -1
  78. package/.output/public/_nuxt/{C-Ygk9x5.js → D5jZq8b3.js} +1 -1
  79. package/.output/public/_nuxt/{B6G3NLfW.js → D5q8SnqE.js} +1 -1
  80. package/.output/public/_nuxt/{CDkyQ1eQ.js → D8M722pn.js} +1 -1
  81. package/.output/public/_nuxt/{BjnQ1pI1.js → D8lwrAYS.js} +1 -1
  82. package/.output/public/_nuxt/{C13FKhqK.js → D9nmzBAw.js} +1 -1
  83. package/.output/public/_nuxt/{ClGn48iq.js → DC4idAGt.js} +1 -1
  84. package/.output/public/_nuxt/{vES4kgx7.js → DEd2xVbS.js} +1 -1
  85. package/.output/public/_nuxt/{CClsKJ9A.js → DH4YkDAi.js} +1 -1
  86. package/.output/public/_nuxt/{D-5A6cMB.js → DJTCT0bl.js} +1 -1
  87. package/.output/public/_nuxt/{D_O7SlHm.js → DNP5E1bC.js} +1 -1
  88. package/.output/public/_nuxt/{BF3tVKtX.js → DO9SFIh1.js} +1 -1
  89. package/.output/public/_nuxt/DPklr_tJ.js +2 -0
  90. package/.output/public/_nuxt/{mfAEx0Kz.js → DQM4eBdt.js} +1 -1
  91. package/.output/public/_nuxt/{cPPThz84.js → DQh6I9z9.js} +1 -1
  92. package/.output/public/_nuxt/{CXTrUfQ5.js → DS2wStH1.js} +1 -1
  93. package/.output/public/_nuxt/{CYQP4zpi.js → DTAStixR.js} +1 -1
  94. package/.output/public/_nuxt/{CEz288t8.js → DTGenhcA.js} +1 -1
  95. package/.output/public/_nuxt/{B9zgEO8N.js → DUAAXJ6Q.js} +1 -1
  96. package/.output/public/_nuxt/{CzAZpALW.js → DUVzIl3o.js} +1 -1
  97. package/.output/public/_nuxt/{DJt7Rogf.js → DXdwpJ-I.js} +1 -1
  98. package/.output/public/_nuxt/{MWUW1sIF.js → DY3uK7wM.js} +1 -1
  99. package/.output/public/_nuxt/{CfY_bsV0.js → DYbZBZet.js} +1 -1
  100. package/.output/public/_nuxt/{DZEuR9ms.js → D_4LPm1U.js} +1 -1
  101. package/.output/public/_nuxt/{CrmE-JGu.js → Db4KMnt8.js} +1 -1
  102. package/.output/public/_nuxt/{BwC62XRN.js → DcJbYLTp.js} +1 -1
  103. package/.output/public/_nuxt/{C6sX7TYf.js → DfF81NlA.js} +1 -1
  104. package/.output/public/_nuxt/{BHn8tRjg.js → DhI5cA_n.js} +1 -1
  105. package/.output/public/_nuxt/{CQ3tAemj.js → DhuOKJda.js} +1 -1
  106. package/.output/public/_nuxt/{D887s9k9.js → Di-Nc75e.js} +1 -1
  107. package/.output/public/_nuxt/{D_obX2Hj.js → Djs0Tlpa.js} +1 -1
  108. package/.output/public/_nuxt/DmmdPt_5.js +1 -0
  109. package/.output/public/_nuxt/{DKKY8zWm.js → Dn5a-guE.js} +1 -1
  110. package/.output/public/_nuxt/{BvstjGHC.js → DtjjnHnt.js} +1 -1
  111. package/.output/public/_nuxt/{Dbfwn2zk.js → DuvzM-P1.js} +1 -1
  112. package/.output/public/_nuxt/{BxShcW0K.js → DwY7rCd_.js} +1 -1
  113. package/.output/public/_nuxt/{BmaHzvZM.js → Dya5oK8u.js} +1 -1
  114. package/.output/public/_nuxt/{CO3hceDE.js → DzA58_Lm.js} +1 -1
  115. package/.output/public/_nuxt/{CF33v_m5.js → DzGy77Vr.js} +1 -1
  116. package/.output/public/_nuxt/{DmlZSBjF.js → E3rXPwU8.js} +1 -1
  117. package/.output/public/_nuxt/{CEDw8osP.js → EgKnQnf-.js} +1 -1
  118. package/.output/public/_nuxt/{it8syoZI.js → GtEM7xVU.js} +1 -1
  119. package/.output/public/_nuxt/{DLUvsixu.js → H6JbrRBU.js} +1 -1
  120. package/.output/public/_nuxt/{BE1CVWts.js → ILEvizzp.js} +1 -1
  121. package/.output/public/_nuxt/{BSA-U0so.js → JX1oqJI9.js} +1 -1
  122. package/.output/public/_nuxt/{yJ9vRvHj.js → JbHa4oXq.js} +1 -1
  123. package/.output/public/_nuxt/{zXvvpsZj.js → Kw0zy3FG.js} +1 -1
  124. package/.output/public/_nuxt/{C6FFW_cO.js → N5XtbYVD.js} +1 -1
  125. package/.output/public/_nuxt/{D04CyXmf.js → PP_4ebzl.js} +1 -1
  126. package/.output/public/_nuxt/{6QDVg5TO.js → SrncdpaW.js} +1 -1
  127. package/.output/public/_nuxt/{36ZHqDPo.js → U1MWjQMi.js} +1 -1
  128. package/.output/public/_nuxt/{mT7Mt2d7.js → Um1vPiAz.js} +1 -1
  129. package/.output/public/_nuxt/{CqFcWBkW.js → XCjS70z4.js} +1 -1
  130. package/.output/public/_nuxt/{C24so3m7.js → YX8avsvq.js} +2 -2
  131. package/.output/public/_nuxt/{DaBSQDif.js → _cy8R3nk.js} +1 -1
  132. package/.output/public/_nuxt/{D9aYkNhQ.js → apYB9dr5.js} +1 -1
  133. package/.output/public/_nuxt/builds/latest.json +1 -1
  134. package/.output/public/_nuxt/builds/meta/def74b99-d70c-4f30-aa29-70248cbeac7d.json +1 -0
  135. package/.output/public/_nuxt/entry.NKPfH2kE.css +1 -0
  136. package/.output/public/_nuxt/{BqTdsCnW.js → fbyIeNkc.js} +1 -1
  137. package/.output/public/_nuxt/{-2AbaFNH.js → g5MjDvm5.js} +1 -1
  138. package/.output/public/_nuxt/{C1tCdK-M.js → gTrVszwd.js} +1 -1
  139. package/.output/public/_nuxt/{BVEFmI4I.js → ixlNW2So.js} +1 -1
  140. package/.output/public/_nuxt/{DtyyytRx.js → nnQqD5pb.js} +1 -1
  141. package/.output/public/_nuxt/{pHCJ6lhw.js → rfGRTJJW.js} +1 -1
  142. package/.output/public/_nuxt/{Buf1PAiO.js → t8aDAkZ5.js} +1 -1
  143. package/.output/public/_nuxt/{BmdlymIW.js → vIOxcXKR.js} +1 -1
  144. package/.output/public/_nuxt/{Cve4psva.js → vScW1Zgm.js} +1 -1
  145. package/.output/public/_nuxt/{SfaNtyKS.js → wO6z2ugJ.js} +1 -1
  146. package/.output/public/_nuxt/{BhYoxmLV.js → x6FRJ5ac.js} +1 -1
  147. package/.output/public/_nuxt/{Pn7VD6uQ.js → zq-a1TeT.js} +1 -1
  148. package/.output/server/chunks/build/{chat-CZMiB68R.mjs → chat-CR3JIVEq.mjs} +65 -11
  149. package/.output/server/chunks/build/chat-CR3JIVEq.mjs.map +1 -0
  150. package/.output/server/chunks/build/client.precomputed.mjs +1 -1
  151. package/.output/server/chunks/build/server.mjs +3 -3
  152. package/.output/server/chunks/build/{settings-ByUXa46k.mjs → settings-B2KXoGcz.mjs} +213 -26
  153. package/.output/server/chunks/build/settings-B2KXoGcz.mjs.map +1 -0
  154. package/.output/server/chunks/build/styles.mjs +2 -2
  155. package/.output/server/chunks/build/{usage-CSrBh4Or.mjs → usage-BHdQZbfI.mjs} +9 -5
  156. package/.output/server/chunks/build/{usage-CSrBh4Or.mjs.map → usage-BHdQZbfI.mjs.map} +1 -1
  157. package/.output/server/chunks/nitro/nitro.mjs +1161 -891
  158. package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
  159. package/.output/server/chunks/routes/_ws/chat.mjs +2 -1
  160. package/.output/server/chunks/routes/_ws/chat.mjs.map +1 -1
  161. package/.output/server/chunks/routes/api/conversations/_id_.delete.mjs +4 -1
  162. package/.output/server/chunks/routes/api/conversations/_id_.delete.mjs.map +1 -1
  163. package/.output/server/chunks/routes/api/index.get3.mjs +1 -1
  164. package/.output/server/chunks/routes/api/index.get3.mjs.map +1 -1
  165. package/.output/server/chunks/routes/api/usage/stats.get.mjs +2 -0
  166. package/.output/server/chunks/routes/api/usage/stats.get.mjs.map +1 -1
  167. package/.output/server/package.json +1 -1
  168. package/app/components/chat/ConversationList.vue +7 -1
  169. package/app/components/chat/MessageBubble.vue +45 -1
  170. package/app/components/usage/UsageRecordsTable.vue +4 -2
  171. package/app/components/usage/UsageSourceDonut.client.vue +4 -2
  172. package/app/components/usage/UsageTopConsumers.vue +4 -2
  173. package/app/composables/useChat.ts +3 -0
  174. package/app/pages/settings.vue +148 -9
  175. package/package.json +1 -1
  176. package/server/api/conversations/[id].delete.ts +9 -0
  177. package/server/api/conversations/index.get.ts +2 -1
  178. package/server/api/usage/stats.get.ts +2 -0
  179. package/server/bridge/adapters/telegram.ts +83 -8
  180. package/server/bridge/responder.ts +248 -0
  181. package/server/bridge/router.ts +6 -4
  182. package/server/db/schema.ts +3 -1
  183. package/server/drizzle/migrations/0015_great_mephistopheles.sql +2 -0
  184. package/server/drizzle/migrations/meta/0015_snapshot.json +1972 -0
  185. package/server/drizzle/migrations/meta/_journal.json +7 -0
  186. package/server/routes/_ws/chat.ts +2 -1
  187. package/server/utils/log-token-usage.ts +1 -1
  188. package/shared/types/index.ts +6 -0
  189. package/.output/public/_nuxt/BIo-9u_O.js +0 -1
  190. package/.output/public/_nuxt/BMs0mHEp.js +0 -1
  191. package/.output/public/_nuxt/BwyXWqBY.js +0 -1
  192. package/.output/public/_nuxt/CE9_ECxx.js +0 -1
  193. package/.output/public/_nuxt/DmcMCO8x.js +0 -1
  194. package/.output/public/_nuxt/JReYPlwF.js +0 -2
  195. package/.output/public/_nuxt/builds/meta/410e449d-9fe8-43a0-ae07-80797693b9b8.json +0 -1
  196. package/.output/public/_nuxt/entry._7ZkP07A.css +0 -1
  197. package/.output/public/_nuxt/iBaivqi8.js +0 -1
  198. package/.output/server/chunks/build/chat-CZMiB68R.mjs.map +0 -1
  199. package/.output/server/chunks/build/settings-ByUXa46k.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import{a as Hi,e as Fi,q as Vi,b5 as hs,F as ji,k as Pa,N as La,aA as Jd,c as he,O as za,P as $a,aT as We,am as xr,b7 as Kn,Q as st,R as ve,S as jt,T as ur,C as ze,a3 as ii,U as kn,G as dr,ai as hr,aj as Jo,ab as Gd,a9 as Ba,a4 as _a,V as nt,W as Jn,bR as Qd,b9 as Xd,s as Yd,y as Zd,c7 as eh,b4 as th,h as nh,c8 as rh,f as sh,K as ih}from"./njnzCNrH.js";import{S as oh}from"./Pn7VD6uQ.js";import{f as Ha,s as Fa,o as Va,d as ja,e as qa,g as Ua,h as Wa,i as Ka,j as Ja}from"./D9aYkNhQ.js";import{_ as lh}from"./DMb_1D81.js";import{_ as Go}from"./Cve4psva.js";import{k as ah,b as ch}from"./Vcq4gwWv.js";function ie(n){this.content=n}ie.prototype={constructor:ie,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new ie(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ie(t)},addToStart:function(n,e){return new ie([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ie(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new ie(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=ie.from(n),n.size?new ie(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ie.from(n),n.size?new ie(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ie.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};ie.from=function(n){if(n instanceof ie)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ie(e)};function Ga(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Ga(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Qa(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Qa(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class w{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new w(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new w(r,s)}cutByIndex(e,t){return e==t?w.empty:e==0&&t==this.content.length?this:new w(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new w(s,i)}addToStart(e){return new w([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new w(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,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Ga(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Qa(this,e,t,r)}findIndex(e){if(e==0)return Gn(0,e);if(e==this.size)return Gn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Gn(t+1,i):Gn(t,r);r=i}}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 w.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new w(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return w.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new w(t||e,r)}static from(e){if(!e)return w.empty;if(e instanceof w)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new w([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}w.empty=new w([],0);const Is={index:0,offset:0};function Gn(n,e){return Is.index=n,Is.offset=e,Is}function wr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!wr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!wr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let _=class oi{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||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&&wr(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 r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return oi.none;if(e instanceof oi)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};_.none=[];class vr extends Error{}class M{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Ya(this.content,e+this.openStart,t);return r&&new M(r,this.openStart,this.openEnd)}removeBetween(e,t){return new M(Xa(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 M.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new M(w.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new M(e,r,s)}}M.empty=new M(w.empty,0,0);function Xa(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Xa(i.content,e-s-1,t-s-1)))}function Ya(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Ya(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function uh(n,e,t){if(t.openStart>n.depth)throw new vr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new vr("Inconsistent open depths");return Za(n,e,t,0)}function Za(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Za(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return Mt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=dh(t,n);return Mt(i,tc(n,o,l,e,r))}else return Mt(i,Sr(n,e,r))}function ec(n,e){if(!e.type.compatibleContent(n.type))throw new vr("Cannot join "+e.type.name+" onto "+n.type.name)}function li(n,e,t){let r=n.node(t);return ec(r,e.node(t)),r}function Tt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function bn(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Tt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)Tt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Tt(e.nodeBefore,r)}function Mt(n,e){return n.type.checkContent(e),n.copy(e)}function tc(n,e,t,r,s){let i=n.depth>s&&li(n,e,s+1),o=r.depth>s&&li(t,r,s+1),l=[];return bn(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(ec(i,o),Tt(Mt(i,tc(n,e,t,r,s+1)),l)):(i&&Tt(Mt(i,Sr(n,e,s+1)),l),bn(e,t,s,l),o&&Tt(Mt(o,Sr(t,r,s+1)),l)),bn(r,null,s,l),new w(l)}function Sr(n,e,t){let r=[];if(bn(null,n,t,r),n.depth>t){let s=li(n,e,t+1);Tt(Mt(s,Sr(n,e,t+1)),r)}return bn(e,null,t,r),new w(r)}function dh(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(w.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class Nn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,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 r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}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 r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return _.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}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 r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Cr(this,e,r);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 r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new Nn(t,r,i)}static resolveCached(e,t){let r=Qo.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Qo.set(e,r=new hh);let s=r.elts[r.i]=Nn.resolve(e,t);return r.i=(r.i+1)%fh,s}}class hh{constructor(){this.elts=[],this.i=0}}const fh=12,Qo=new WeakMap;class Cr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}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 ph=Object.create(null);class Me{constructor(e,t,r,s=_.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||w.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,r,s=0){this.content.nodesBetween(e,t,r,s,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,r,s){return this.content.textBetween(e,t,r,s)}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,r){return this.type==e&&wr(this.attrs,t||e.defaultAttrs||ph)&&_.sameSet(this.marks,r||_.none)}copy(e=null){return e==this.content?this:new Me(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Me(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,r=!1){if(e==t)return M.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new M(c,s.depth-o,i.depth-o)}replace(e,t,r){return uh(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return Nn.resolveCached(this,e)}resolveNoCache(e){return Nn.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}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()+")"),nc(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,r=w.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.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=_.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!_.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 r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=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,r)}let s=w.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}Me.prototype.text=void 0;class Tr extends Me{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):nc(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 Tr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Tr(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 nc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Nt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new mh(e,t);if(r.next==null)return Nt.empty;let s=rc(r);r.next&&r.err("Unexpected trailing text");let i=vh(wh(s));return Sh(i,r),i}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,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}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 r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return w.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let h=i(d,l.concat(u));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.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(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
1
+ import{a as Hi,e as Fi,q as Vi,b5 as hs,F as ji,k as Pa,N as La,aA as Jd,c as he,O as za,P as $a,aT as We,am as xr,b7 as Kn,Q as st,R as ve,S as jt,T as ur,C as ze,a3 as ii,U as kn,G as dr,aj as hr,ak as Jo,ab as Gd,a9 as Ba,a4 as _a,V as nt,W as Jn,bR as Qd,b9 as Xd,s as Yd,y as Zd,c7 as eh,b4 as th,h as nh,c8 as rh,f as sh,K as ih}from"./2dNDtTiv.js";import{S as oh}from"./zq-a1TeT.js";import{f as Ha,s as Fa,o as Va,d as ja,e as qa,g as Ua,h as Wa,i as Ka,j as Ja}from"./apYB9dr5.js";import{_ as lh}from"./CuxrHsu-.js";import{_ as Go}from"./vScW1Zgm.js";import{k as ah,b as ch}from"./Vcq4gwWv.js";function ie(n){this.content=n}ie.prototype={constructor:ie,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new ie(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ie(t)},addToStart:function(n,e){return new ie([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ie(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new ie(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=ie.from(n),n.size?new ie(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ie.from(n),n.size?new ie(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ie.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};ie.from=function(n){if(n instanceof ie)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ie(e)};function Ga(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Ga(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Qa(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Qa(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class w{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new w(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new w(r,s)}cutByIndex(e,t){return e==t?w.empty:e==0&&t==this.content.length?this:new w(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new w(s,i)}addToStart(e){return new w([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new w(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,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Ga(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Qa(this,e,t,r)}findIndex(e){if(e==0)return Gn(0,e);if(e==this.size)return Gn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Gn(t+1,i):Gn(t,r);r=i}}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 w.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new w(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return w.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new w(t||e,r)}static from(e){if(!e)return w.empty;if(e instanceof w)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new w([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}w.empty=new w([],0);const Is={index:0,offset:0};function Gn(n,e){return Is.index=n,Is.offset=e,Is}function wr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!wr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!wr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let _=class oi{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||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&&wr(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 r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return oi.none;if(e instanceof oi)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};_.none=[];class vr extends Error{}class M{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Ya(this.content,e+this.openStart,t);return r&&new M(r,this.openStart,this.openEnd)}removeBetween(e,t){return new M(Xa(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 M.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new M(w.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new M(e,r,s)}}M.empty=new M(w.empty,0,0);function Xa(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Xa(i.content,e-s-1,t-s-1)))}function Ya(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Ya(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function uh(n,e,t){if(t.openStart>n.depth)throw new vr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new vr("Inconsistent open depths");return Za(n,e,t,0)}function Za(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Za(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return Mt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=dh(t,n);return Mt(i,tc(n,o,l,e,r))}else return Mt(i,Sr(n,e,r))}function ec(n,e){if(!e.type.compatibleContent(n.type))throw new vr("Cannot join "+e.type.name+" onto "+n.type.name)}function li(n,e,t){let r=n.node(t);return ec(r,e.node(t)),r}function Tt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function bn(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Tt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)Tt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Tt(e.nodeBefore,r)}function Mt(n,e){return n.type.checkContent(e),n.copy(e)}function tc(n,e,t,r,s){let i=n.depth>s&&li(n,e,s+1),o=r.depth>s&&li(t,r,s+1),l=[];return bn(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(ec(i,o),Tt(Mt(i,tc(n,e,t,r,s+1)),l)):(i&&Tt(Mt(i,Sr(n,e,s+1)),l),bn(e,t,s,l),o&&Tt(Mt(o,Sr(t,r,s+1)),l)),bn(r,null,s,l),new w(l)}function Sr(n,e,t){let r=[];if(bn(null,n,t,r),n.depth>t){let s=li(n,e,t+1);Tt(Mt(s,Sr(n,e,t+1)),r)}return bn(e,null,t,r),new w(r)}function dh(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(w.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class Nn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,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 r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}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 r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return _.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}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 r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Cr(this,e,r);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 r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new Nn(t,r,i)}static resolveCached(e,t){let r=Qo.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Qo.set(e,r=new hh);let s=r.elts[r.i]=Nn.resolve(e,t);return r.i=(r.i+1)%fh,s}}class hh{constructor(){this.elts=[],this.i=0}}const fh=12,Qo=new WeakMap;class Cr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}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 ph=Object.create(null);class Me{constructor(e,t,r,s=_.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||w.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,r,s=0){this.content.nodesBetween(e,t,r,s,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,r,s){return this.content.textBetween(e,t,r,s)}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,r){return this.type==e&&wr(this.attrs,t||e.defaultAttrs||ph)&&_.sameSet(this.marks,r||_.none)}copy(e=null){return e==this.content?this:new Me(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Me(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,r=!1){if(e==t)return M.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new M(c,s.depth-o,i.depth-o)}replace(e,t,r){return uh(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return Nn.resolveCached(this,e)}resolveNoCache(e){return Nn.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}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()+")"),nc(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,r=w.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.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=_.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!_.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 r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=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,r)}let s=w.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}Me.prototype.text=void 0;class Tr extends Me{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):nc(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 Tr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Tr(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 nc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Nt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new mh(e,t);if(r.next==null)return Nt.empty;let s=rc(r);r.next&&r.err("Unexpected trailing text");let i=vh(wh(s));return Sh(i,r),i}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,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}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 r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return w.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let h=i(d,l.concat(u));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.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(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
2
2
  `)}}Nt.empty=new Nt(!0);class mh{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 rc(n){let e=[];do e.push(gh(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function gh(n){let e=[];do e.push(yh(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function yh(n){let e=xh(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=kh(n,e);else break;return e}function Xo(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function kh(n,e){let t=Xo(n),r=t;return n.eat(",")&&(n.next!="}"?r=Xo(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function bh(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function xh(n){if(n.eat("(")){let e=rc(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=bh(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function wh(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();s(i(o.expr,a),u),a=u}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),s(i(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function sc(n,e){return e-n}function Yo(n,e){let t=[];return r(e),t.sort(sc);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&t.indexOf(a)==-1&&r(a)}}}function vh(n){let e=Object.create(null);return t(Yo(n,0));function t(r){let s=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);Yo(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new Nt(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(sc);i.next.push({type:s[o][0],next:e[l.join(",")]||t(l)})}return i}}function Sh(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ic(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function oc(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function lc(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let i=n[s];i.validate&&i.validate(e[s])}}function ac(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Th(n,r,e[r]);return t}let Zo=class cc{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ac(e,r.attrs),this.defaultAttrs=ic(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Nt.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:oc(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Me(this,this.computeAttrs(e),w.from(t),_.setFrom(r))}createChecked(e=null,t,r){return t=w.from(t),this.checkContent(t),new Me(this,this.computeAttrs(e),t,_.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=w.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(w.empty,!0);return i?new Me(this,e,t.append(i),_.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).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){lc(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 r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:_.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new cc(i,t,o));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Ch(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class Th{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Ch(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class fs{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=ac(e,s.attrs),this.excluded=null;let i=ic(this.attrs);this.instance=i?new _(this,i):null}create(e=null){return!e&&this.instance?this.instance:new _(this,oc(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new fs(i,s++,t,o)),r}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){lc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class uc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=ie.from(e.nodes),t.marks=ie.from(e.marks||{}),this.nodes=Zo.compile(this.spec.nodes,this),this.marks=fs.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Nt.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?el(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:el(this,o.split(" "))}this.nodeFromJSON=s=>Me.fromJSON(this,s),this.markFromJSON=s=>_.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Zo){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,r,s)}text(e,t){let r=this.nodes.text;return new Tr(r,r.defaultAttrs,e,_.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function el(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Mh(n){return n.tag!=null}function Eh(n){return n.style!=null}class Ye{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Mh(s))this.tags.push(s);else if(Eh(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new nl(this,t,!1);return r.addAll(e,_.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new nl(this,t,!0);return r.addAll(e,_.none,t.from,t.to),M.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(Nh(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=rl(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=rl(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ye(e,Ye.schemaRules(e)))}}const dc={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},Ah={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},hc={ol:!0,ul:!0},Rn=1,ai=2,xn=4;function tl(n,e,t){return e!=null?(e?Rn:0)|(e==="full"?ai:0):n&&n.whitespace=="pre"?Rn|ai:t&~xn}class Qn{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=_.none,this.match=i||(o&xn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(w.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Rn)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=w.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(w.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&&!dc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class nl{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=tl(null,t.preserveWhitespace,0)|(r?xn:0);s?i=new Qn(s.type,s.attrs,_.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Qn(null,null,_.none,!0,null,o):i=new Qn(e.schema.topNodeType,null,_.none,!0,null,o),this.nodes=[i],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 r=e.nodeValue,s=this.top,i=s.options&ai?"full":this.localPreserveWS||(s.options&Rn)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
3
3
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;hc.hasOwnProperty(o)&&this.parser.normalizeLists&&Oh(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Ah.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(dc.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}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 r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=_.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):sl(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=tl(e,i,o.options);o.options&xn&&o.content.length==0&&(l|=xn);let a=_.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):sl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Qn(e,t,a,s,null,l)),this.open++,r}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|=Rn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].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,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].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("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}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 r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function Oh(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&hc.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Nh(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function rl(n){let e={};for(let t in n)e[t]=n[t];return e}function sl(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class zt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Ds(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=fr(Ds(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&fr(Ds(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return fr(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new zt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=il(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return il(e.marks)}}function il(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Ds(n){return n.document||window.document}const ol=new WeakMap;function Rh(n){let e=ol.get(n);return e===void 0&&ol.set(n,e=Ih(n)),e}function Ih(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function fr(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Rh(r))&&i.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=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let h=d.indexOf(" ");h>0?a.setAttributeNS(d.slice(0,h),d.slice(h+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:f,contentDOM:p}=fr(n,h,t,r);if(a.appendChild(f),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const fc=65535,pc=Math.pow(2,16);function Dh(n,e){return n+e*pc}function ll(n){return n&fc}function Ph(n){return(n-(n&fc))/pc}const mc=1,gc=2,pr=4,yc=8;class ci{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&yc)>0}get deletedBefore(){return(this.delInfo&(mc|pr))>0}get deletedAfter(){return(this.delInfo&(gc|pr))>0}get deletedAcross(){return(this.delInfo&pr)>0}}class be{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&be.empty)return be.empty}recover(e){let t=0,r=ll(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+Ph(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],d=a+c;if(e<=d){let h=c?e==a?-1:e==d?1:t:t,f=a+s+(h<0?0:u);if(r)return f;let p=e==(t<0?a:d)?null:Dh(l/3,e-a),g=e==a?gc:e==d?mc:pr;return(t<0?e!=a:e!=d)&&(g|=yc),new ci(f,g,p)}s+=u-c}return r?e+s:new ci(e+s,0,null)}touches(e,t){let r=0,s=ll(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new be(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?be.empty:new be(e<0?[0,-e,0]:[0,0,e])}}be.empty=new be([]);class In{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new In(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,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s: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,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new In;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new ci(e,s,null)}}const Ps=Object.create(null);class ue{getMap(){return be.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ps[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ps)throw new RangeError("Duplicate use of step JSON ID "+e);return Ps[e]=t,t.prototype.jsonID=e,t}}class Q{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Q(e,null)}static fail(e){return new Q(null,e)}static fromReplace(e,t,r,s){try{return Q.ok(e.replace(t,r,s))}catch(i){if(i instanceof vr)return Q.fail(i.message);throw i}}}function qi(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(qi(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return w.fromArray(r)}class dt extends ue{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new M(qi(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return Q.fromReplace(e,this.from,this.to,i)}invert(){return new Re(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new dt(t.pos,r.pos,this.mark)}merge(e){return e instanceof dt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new dt(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 dt(t.from,t.to,e.markFromJSON(t.mark))}}ue.jsonID("addMark",dt);class Re extends ue{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new M(qi(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return Q.fromReplace(e,this.from,this.to,r)}invert(){return new dt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Re(t.pos,r.pos,this.mark)}merge(e){return e instanceof Re&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Re(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 Re(t.from,t.to,e.markFromJSON(t.mark))}}ue.jsonID("removeMark",Re);class ht extends ue{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Q.fromReplace(e,this.pos,this.pos+1,new M(w.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new ht(this.pos,t.marks[s]);return new ht(this.pos,this.mark)}}return new Rt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ht(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 ht(t.pos,e.markFromJSON(t.mark))}}ue.jsonID("addNodeMark",ht);class Rt extends ue{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Q.fromReplace(e,this.pos,this.pos+1,new M(w.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new ht(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Rt(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 Rt(t.pos,e.markFromJSON(t.mark))}}ue.jsonID("removeNodeMark",Rt);class te extends ue{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&ui(e,this.from,this.to)?Q.fail("Structure replace would overwrite content"):Q.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new be([this.from,this.to-this.from,this.slice.size])}invert(e){return new te(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new te(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof te)||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?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new te(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?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new te(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 te(t.from,t.to,M.fromJSON(e,t.slice),!!t.structure)}}ue.jsonID("replace",te);class re extends ue{constructor(e,t,r,s,i,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(ui(e,this.from,this.gapFrom)||ui(e,this.gapTo,this.to)))return Q.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Q.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Q.fromReplace(e,this.from,this.to,r):Q.fail("Content does not fit in gap")}getMap(){return new be([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 re(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),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new re(t.pos,r.pos,s,i,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 re(t.from,t.to,t.gapFrom,t.gapTo,M.fromJSON(e,t.slice),t.insert,!!t.structure)}}ue.jsonID("replaceAround",re);function ui(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function Lh(n,e,t,r){let s=[],i=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+a.nodeSize,t),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[g])?o.to=f:s.push(o=new Re(h,f,d[g])));l&&l.to==h?l.to=f:i.push(l=new dt(h,f,r))}}),s.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function zh(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof fs){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],h;for(let f=0;f<s.length;f++){let p=s[f];p.step==i-1&&d.eq(s[f].style)&&(h=p)}h?(h.to=c,h.step=i):s.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>n.step(new Re(o.from,o.to,o.style)))}function Ui(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new te(l,u,M.empty));else{r=d;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||n.step(new Re(l,u,c.marks[h]));if(s&&c.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new M(w.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new te(l+h.index,l+h.index+h[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(w.empty,!0);n.replace(l,l,new M(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function $h(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function sn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(l,a,t))return r;if(r==0||o.type.spec.isolating||!$h(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function Bh(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,u=w.empty,d=0;for(let p=i,g=!1;p>t;p--)g||r.index(p)>0?(g=!0,u=w.from(r.node(p).copy(u)),d++):a--;let h=w.empty,f=0;for(let p=i,g=!1;p>t;p--)g||s.after(p+1)<s.end(p)?(g=!0,h=w.from(s.node(p).copy(h)),f++):c++;n.step(new re(a,c,o,l,new M(u.append(h),d,f),u.size-d,!0))}function Wi(n,e,t=null,r=n){let s=_h(n,e),i=s&&Hh(r,e);return i?s.map(al).concat({type:e,attrs:t}).concat(i.map(al)):null}function al(n){return{type:n,attrs:null}}function _h(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function Hh(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function Fh(n,e,t){let r=w.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=w.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new re(s,i,s,i,new M(r,0,0),t.length,!0))}function Vh(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&jh(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&bc(n,o,l,i),Ui(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let u=n.mapping.slice(i),d=u.map(l,1),h=u.map(l+o.nodeSize,1);return n.step(new re(d,h,d+1,h-1,new M(w.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&kc(n,o,l,i),!1}})}function kc(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function bc(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(`
@@ -1 +1 @@
1
- import{G as s,a9 as o,C as n,R as a,aa as e,ab as t}from"./njnzCNrH.js";const i={key:0},u={__name:"ProseScript",props:{src:{type:String,required:!0}},setup(c){return(l,r)=>n(!1)?(a(),s("div",i,[...r[0]||(r[0]=[e(" Rendering the ",-1),t("code",null,"script",-1),e(" element is dangerous and is disabled by default. Consider implementing your own ",-1),t("code",null,"ProseScript",-1),e(" element to have control over script rendering. ",-1)])])):o("",!0)}};export{u as default};
1
+ import{G as s,a9 as o,C as n,R as a,aa as e,ab as t}from"./2dNDtTiv.js";const i={key:0},u={__name:"ProseScript",props:{src:{type:String,required:!0}},setup(c){return(l,r)=>n(!1)?(a(),s("div",i,[...r[0]||(r[0]=[e(" Rendering the ",-1),t("code",null,"script",-1),e(" element is dangerous and is disabled by default. Consider implementing your own ",-1),t("code",null,"ProseScript",-1),e(" element to have control over script rendering. ",-1)])])):o("",!0)}};export{u as default};
@@ -1 +1 @@
1
- import{r as n}from"./zXvvpsZj.js";import a from"./0dqQoCHY.js";import{N as s,Q as t,R as e,S as i,C as p}from"./njnzCNrH.js";import"./iik6CYzq.js";const d={__name:"ProseWarning",setup(c){const o=s();return(r,f)=>(e(),t(a,{color:"warning",icon:p(o).ui.icons.warning},{default:i(()=>[n(r.$slots,"default",{mdcUnwrap:"p"})]),_:3},8,["icon"]))}};export{d as default};
1
+ import{r as n}from"./Kw0zy3FG.js";import a from"./BGgwYWjH.js";import{N as s,Q as t,R as e,S as i,C as p}from"./2dNDtTiv.js";import"./iik6CYzq.js";const d={__name:"ProseWarning",setup(c){const o=s();return(r,f)=>(e(),t(a,{color:"warning",icon:p(o).ui.icons.warning},{default:i(()=>[n(r.$slots,"default",{mdcUnwrap:"p"})]),_:3},8,["icon"]))}};export{d as default};
@@ -1 +1 @@
1
- import{_ as s}from"./DlAUqK2U.js";import{G as t,R as a,ab as c,a4 as o}from"./njnzCNrH.js";const r={},n={class:"min-h-screen flex items-center justify-center bg-default"},l={class:"w-full max-w-md px-4"};function d(e,f){return a(),t("div",n,[c("div",l,[o(e.$slots,"default")])])}const m=s(r,[["render",d]]);export{m as default};
1
+ import{_ as s}from"./DlAUqK2U.js";import{G as t,R as a,ab as c,a4 as o}from"./2dNDtTiv.js";const r={},n={class:"min-h-screen flex items-center justify-center bg-default"},l={class:"w-full max-w-md px-4"};function d(e,f){return a(),t("div",n,[c("div",l,[o(e.$slots,"default")])])}const m=s(r,[["render",d]]);export{m as default};
@@ -0,0 +1 @@
1
+ import{_ as al}from"./BUghTae1.js";import{_ as sl,a as ol}from"./CqNwHCpo.js";import{_ as nl}from"./wO6z2ugJ.js";import{_ as il}from"./DJTCT0bl.js";import{a as dl,ag as rl,ah as R,e as p,f as ul,q as ml,Q as ge,S as n,R as r,T as a,ab as o,G as u,ai as H,C as t,W as cl,aa as c,aj as x,ak as I,a9 as U,_ as pl,ae as w,U as fl,al as be}from"./2dNDtTiv.js";import{_ as gl}from"./x6FRJ5ac.js";import{_ as bl}from"./BR8bKz8h.js";import{_ as vl}from"./DwY7rCd_.js";import{_ as yl}from"./BmOtR1wX.js";import{_ as wl}from"./1zUTf4AP.js";import{_ as hl}from"./CPutXj8l.js";import{_ as xl}from"./BHtY0l0l.js";import{_ as kl}from"./B93pdGAW.js";import{_ as _l}from"./C3NST0BU.js";import{u as Pl,d as fe}from"./GtEM7xVU.js";import{u as Ul}from"./BKXg-alD.js";import"./D5jZq8b3.js";import"./DhI5cA_n.js";import"./DEd2xVbS.js";import"./zq-a1TeT.js";import"./88opOQSr.js";import"./BS2ZNXI1.js";import"./DmmdPt_5.js";import"./Bk6JUtIo.js";import"./D0ifH682.js";import"./CYPO5o_C.js";import"./BIXrSYwR.js";import"./DH4YkDAi.js";import"./CWyMCJQH.js";import"./JbHa4oXq.js";import"./BA_pRWwX.js";import"./BZrSPX0S.js";import"./H6JbrRBU.js";import"./DUAAXJ6Q.js";import"./apYB9dr5.js";import"./Db4KMnt8.js";import"./CQqCBrXj.js";import"./BaZwjF8o.js";const Sl={class:"p-6"},Vl={class:"space-y-8 max-w-2xl mx-auto py-6"},Cl={class:"py-6"},Al={class:"flex items-center justify-between mb-6"},Il={class:"text-sm bg-elevated px-2 py-0.5 rounded"},Bl={class:"text-dimmed"},El={class:"text-dimmed text-sm"},$l={class:"flex gap-2 justify-end"},Dl={class:"py-12 text-center"},Ml={class:"py-6"},Ll={class:"flex items-center justify-between mb-6"},Nl={key:0,class:"space-y-3"},Tl={key:1,class:"py-12 text-center"},Rl={key:2,class:"space-y-3"},Hl=["onClick"],Ol={class:"flex items-center justify-between"},Fl={class:"flex items-center gap-3"},jl={class:"font-medium"},zl={class:"text-sm text-dimmed ml-2"},ql={class:"flex items-center gap-3"},Kl={key:0,class:"text-xs text-dimmed mt-1 pl-8"},Gl={class:"max-w-2xl mx-auto py-6"},Yl={class:"mb-8"},Wl={class:"flex gap-2"},Jl={key:0,class:"space-y-3"},Ql={key:1,class:"space-y-2"},Xl={class:"flex items-center justify-between px-4 py-3"},Zl={class:"flex items-center gap-3"},et={class:"font-medium"},lt={key:0,class:"border-t border-default px-4 py-3 space-y-2 bg-elevated/50"},tt={class:"text-sm text-dimmed capitalize"},at={class:"mt-6"},st={class:"space-y-8 max-w-xl mx-auto py-6"},ot={class:"space-y-4"},nt={class:"text-lg font-semibold"},it={class:"flex justify-end gap-2 pt-4"},dt={class:"mb-4"},rt={class:"bg-elevated px-2 py-0.5 rounded"},ut={class:"flex justify-end gap-2 pt-6"},mt={class:"space-y-4"},ct={key:0,class:"flex items-start gap-2 rounded-lg bg-error/10 border border-error/20 p-3 text-sm"},pt={class:"mt-1 space-y-0.5"},ft={class:"text-xs bg-elevated px-1.5 py-0.5 rounded"},gt={class:"flex justify-end gap-2 pt-4"},bt={class:"mb-4"},vt={class:"flex justify-end gap-2 pt-6"},yt={class:"flex items-center gap-2"},wt={class:"text-lg font-semibold"},ht={class:"space-y-4"},xt={key:0,class:"flex items-start gap-2 rounded-lg bg-elevated p-3 text-sm"},kt={class:"text-dimmed"},_t={class:"bg-elevated px-1 py-0.5 rounded text-xs"},Pt={key:0,class:"flex items-start gap-2 rounded-lg bg-error/10 border border-error/20 p-3 text-sm"},Ut={class:"space-y-2"},St=["checked","onChange"],Vt={class:"text-sm"},Ct={class:"grid grid-cols-2 gap-4"},At={class:"grid grid-cols-2 gap-4"},It={class:"flex justify-end gap-2 pt-4"},ba=dl({__name:"settings",setup(Bt){const{user:ve,updateProfile:ye,changeEmail:we,changePassword:he}=Ul(),d=rl(),{updatePreferences:xe}=Pl(),O=R({name:""}),X=p(!1),E=R({newEmail:""}),Z=p(!1),h=R({currentPassword:"",newPassword:"",confirmPassword:""}),ee=p(!1),$=p([]),le=p(!1),B=p(!1),D=p(!1),F=p(null),te=p(!1),_=p(null),b=R({key:"",value:"",description:""});ul(()=>ve.value,i=>{i&&(O.name=i.name||"",E.newEmail=i.email||"")},{immediate:!0});async function G(){le.value=!0;try{const{data:i}=await $fetch("/api/secrets");$.value=i}catch{d.add({title:"Failed to load secrets",color:"error"})}le.value=!1}const ke=[{label:"Account",icon:"i-lucide-user",value:"account",slot:"account"},{label:"Secrets",icon:"i-lucide-key",value:"secrets",slot:"secrets"},{label:"Integrations",icon:"i-lucide-plug",value:"integrations",slot:"integrations"},{label:"App",icon:"i-lucide-settings",value:"app",slot:"app"}],_e=[{accessorKey:"key",header:"Key"},{accessorKey:"description",header:"Description"},{accessorKey:"updatedAt",header:"Last Updated"},{accessorKey:"actions",header:""}];function Pe(){_.value=null,b.key="",b.value="",b.description="",B.value=!0}function Ue(i){_.value=i,b.key=i.key,b.value="",b.description=i.description||"",B.value=!0}function Se(i){F.value=i,D.value=!0}async function Ve(){if(!b.key||!_.value&&!b.value){d.add({title:"Missing fields",description:_.value?"Key is required.":"Key and value are required.",color:"error"});return}te.value=!0;try{_.value?(await $fetch(`/api/secrets/${_.value.key}`,{method:"PUT",body:{value:b.value||void 0,description:b.description||void 0}}),d.add({title:"Secret updated",color:"success"})):(await $fetch("/api/secrets",{method:"POST",body:{key:b.key,value:b.value,description:b.description||void 0}}),d.add({title:"Secret created",color:"success"})),B.value=!1,await G()}catch(i){const e=i;d.add({title:_.value?"Failed to update secret":"Failed to create secret",description:e.data?.message||"An error occurred",color:"error"})}te.value=!1}async function Ce(){if(F.value)try{await $fetch(`/api/secrets/${F.value.key}`,{method:"DELETE"}),d.add({title:"Secret deleted",color:"success"}),D.value=!1,F.value=null,await G()}catch{d.add({title:"Failed to delete secret",color:"error"})}}function Ae(i){return new Date(i).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}const C=p(""),ae=p(!1);async function Ie(){try{const{data:i}=await $fetch("/api/secrets/APP_URL");C.value=i.value||""}catch{C.value=""}}async function Be(){ae.value=!0;try{C.value?$.value.some(e=>e.key==="APP_URL")?await $fetch("/api/secrets/APP_URL",{method:"PUT",body:{value:C.value,description:"Public URL for webhooks and auth callbacks"}}):await $fetch("/api/secrets",{method:"POST",body:{key:"APP_URL",value:C.value,description:"Public URL for webhooks and auth callbacks"}}):$.value.some(e=>e.key==="APP_URL")&&await $fetch("/api/secrets/APP_URL",{method:"DELETE"}),d.add({title:"Public URL saved",description:"Restart running integrations for changes to take effect.",color:"success"}),await G()}catch{d.add({title:"Failed to save URL",color:"error"})}ae.value=!1}const S=p({...fe}),se=p(!1),oe=p(!1),j=p(new Set),Ee=[{key:"task",label:"Tasks",icon:"i-lucide-check-square",subtypes:["create","edit","delete","restore"]},{key:"project",label:"Projects",icon:"i-lucide-folder",subtypes:["create","edit","delete"]},{key:"agent",label:"Agents",icon:"i-lucide-bot",subtypes:["create","edit","delete","run","complete","fail","cancel"]},{key:"document",label:"Documents",icon:"i-lucide-file-text",subtypes:["edit","delete","restore"]},{key:"memory",label:"Memories",icon:"i-lucide-brain",subtypes:["create","delete"]},{key:"reminder",label:"Reminders",icon:"i-lucide-bell",subtypes:["create"]},{key:"secret",label:"Secrets",icon:"i-lucide-key-round",subtypes:["create","edit","delete"]},{key:"hook",label:"Hooks",icon:"i-lucide-webhook",subtypes:["create"]},{key:"conversation",label:"Conversations",icon:"i-lucide-message-square",subtypes:["delete"]},{key:"bridge",label:"Bridges",icon:"i-lucide-plug",subtypes:["create","edit","delete","complete","fail"]}];async function $e(){se.value=!0;try{const{data:i}=await $fetch("/api/settings");S.value={...fe,...i.notifications}}catch{S.value={...fe}}se.value=!1}async function De(){oe.value=!0;try{await $fetch("/api/settings",{method:"PUT",body:{notifications:S.value}}),xe(S.value),d.add({title:"Notification preferences saved",color:"success"})}catch{d.add({title:"Failed to save preferences",color:"error"})}oe.value=!1}function Me(i){j.value.has(i)?j.value.delete(i):j.value.add(i)}function Le(i,e){S.value[i]={...S.value[i],enabled:e}}function Ne(i,e,P){const V=S.value[i];S.value[i]={...V,subtypes:{...V?.subtypes,[e]:P}}}const ne=p([]),ie=p(!1),M=p(!1),de=p(!1),L=p(!1),z=p(null),k=R({platform:"telegram",name:""}),N=p(!1),y=p(null),re=p(!1),s=R({name:"",botUsername:"",allowedChatIds:"",listenMode:"mentions",guildId:"",channelId:"",strategy:"imsg",allowedNumbers:"",blueBubblesUrl:"",enabledServices:[],account:"",imapHost:"",imapPort:"",smtpHost:"",smtpPort:"",emailAddress:""}),Te=[{value:"mentions",label:"Mentions & DMs"},{value:"dm",label:"DMs only"},{value:"all",label:"All messages"}],Re=[{value:"imsg",label:"Local (imsg CLI)"},{value:"bluebubbles",label:"BlueBubbles"}],He=[{value:"gmail",label:"Gmail"},{value:"calendar",label:"Calendar"},{value:"drive",label:"Drive"},{value:"contacts",label:"Contacts"},{value:"tasks",label:"Tasks"}],Oe={telegram:"My Telegram Bot",discord:"My Discord Bot",imessage:"iMessage Bridge",google:"Google Suite",email:"Work Email"},Y={telegram:["TELEGRAM_BOT_TOKEN"],discord:["DISCORD_BOT_TOKEN"],imessage:[],google:[],email:[]},W=[{value:"telegram",label:"Telegram",icon:"i-lucide-send"},{value:"discord",label:"Discord",icon:"i-lucide-message-circle"},{value:"imessage",label:"iMessage",icon:"i-lucide-smartphone"},{value:"google",label:"Google Suite",icon:"i-lucide-mail"},{value:"email",label:"Email (IMAP)",icon:"i-lucide-at-sign"}];function J(i){const e=Y[i];if(!e.length)return[];const P=new Set($.value.map(V=>V.key));return e.filter(V=>!P.has(V))}const Fe={connected:"text-success",disconnected:"text-dimmed",error:"text-error",unconfigured:"text-dimmed"};async function q(){ie.value=!0;try{const{data:i}=await $fetch("/api/bridges");ne.value=i}catch{d.add({title:"Failed to load integrations",color:"error"})}ie.value=!1}function je(i){y.value=i,s.name=i.name;const e=i.config?JSON.parse(i.config):{};switch(s.botUsername="",s.allowedChatIds="",s.listenMode="mentions",s.guildId="",s.channelId="",s.strategy="imsg",s.allowedNumbers="",s.blueBubblesUrl="",s.enabledServices=[],s.account="",s.imapHost="",s.imapPort="",s.smtpHost="",s.smtpPort="",s.emailAddress="",i.platform){case"telegram":s.botUsername=e.botUsername||"",s.allowedChatIds=(e.allowedChatIds||[]).join(", ");break;case"discord":s.listenMode=e.listenMode||"mentions",s.guildId=e.guildId||"",s.channelId=e.channelId||"";break;case"imessage":s.strategy=e.strategy||"imsg",s.allowedNumbers=(e.allowedNumbers||[]).join(", "),s.blueBubblesUrl=e.blueBubblesUrl||"";break;case"google":s.enabledServices=e.enabledServices||[],s.account=e.account||"";break;case"email":s.imapHost=e.imapHost||"",s.imapPort=e.imapPort?.toString()||"",s.smtpHost=e.smtpHost||"",s.smtpPort=e.smtpPort?.toString()||"",s.emailAddress=e.emailAddress||"";break}N.value=!0}async function ze(){if(!y.value)return;const i=y.value.platform;let e={};switch(y.value.config&&(e=JSON.parse(y.value.config)),i){case"telegram":e.botUsername=s.botUsername||void 0,e.allowedChatIds=s.allowedChatIds?s.allowedChatIds.split(",").map(P=>P.trim()).filter(Boolean):void 0;break;case"discord":e.listenMode=s.listenMode,e.guildId=s.guildId||void 0,e.channelId=s.channelId||void 0;break;case"imessage":e.strategy=s.strategy,e.allowedNumbers=s.allowedNumbers?s.allowedNumbers.split(",").map(P=>P.trim()).filter(Boolean):void 0,e.blueBubblesUrl=s.blueBubblesUrl||void 0;break;case"google":e.enabledServices=s.enabledServices,e.account=s.account||void 0;break;case"email":e.imapHost=s.imapHost||void 0,e.imapPort=s.imapPort?Number(s.imapPort):void 0,e.smtpHost=s.smtpHost||void 0,e.smtpPort=s.smtpPort?Number(s.smtpPort):void 0,e.emailAddress=s.emailAddress||void 0;break}re.value=!0;try{await $fetch(`/api/bridges/${y.value.id}`,{method:"PUT",body:{name:s.name,config:e}}),d.add({title:"Integration updated",color:"success"}),N.value=!1,await q()}catch(P){const V=P;d.add({title:"Failed to update integration",description:V.data?.message,color:"error"})}re.value=!1}function qe(){k.platform="telegram",k.name="",M.value=!0}async function Ke(){if(!k.name){d.add({title:"Name is required",color:"error"});return}const i=J(k.platform);if(i.length){d.add({title:"Missing required secrets",description:`Add ${i.join(", ")} in the Secrets tab first.`,color:"error"});return}de.value=!0;try{await $fetch("/api/bridges",{method:"POST",body:{platform:k.platform,name:k.name}}),d.add({title:"Integration created",color:"success"}),M.value=!1,await q()}catch(e){const P=e;d.add({title:"Failed to create integration",description:P.data?.message,color:"error"})}de.value=!1}async function Ge(i){try{await $fetch(`/api/bridges/${i.id}`,{method:"PUT",body:{enabled:!i.enabled}}),await q()}catch{d.add({title:"Failed to update integration",color:"error"})}}function Ye(i){z.value=i,L.value=!0}async function We(){if(z.value)try{await $fetch(`/api/bridges/${z.value.id}`,{method:"DELETE"}),d.add({title:"Integration deleted",color:"success"}),L.value=!1,z.value=null,await q()}catch{d.add({title:"Failed to delete integration",color:"error"})}}ml(()=>{G(),$e(),q(),Ie()});async function Je(){X.value=!0;const i=await ye({name:O.name});i.error?d.add({title:"Update failed",description:i.error.message,color:"error"}):d.add({title:"Profile updated",description:"Your name has been updated successfully.",color:"success"}),X.value=!1}async function Qe(){if(!E.newEmail){d.add({title:"Email required",description:"Please enter a new email address.",color:"error"});return}Z.value=!0;const i=await we(E.newEmail);i.error?d.add({title:"Email change failed",description:i.error.message,color:"error"}):d.add({title:"Email updated",description:"Your email has been changed successfully.",color:"success"}),Z.value=!1}async function Xe(){if(h.newPassword!==h.confirmPassword){d.add({title:"Passwords do not match",description:"Please make sure your new passwords match.",color:"error"});return}if(!h.currentPassword||!h.newPassword){d.add({title:"Missing fields",description:"Please fill in all password fields.",color:"error"});return}ee.value=!0;const i=await he({currentPassword:h.currentPassword,newPassword:h.newPassword});i.error?d.add({title:"Password change failed",description:i.error.message,color:"error"}):(d.add({title:"Password changed",description:"Your password has been changed successfully.",color:"success"}),h.currentPassword="",h.newPassword="",h.confirmPassword=""),ee.value=!1}return(i,e)=>{const P=al,V=ol,f=nl,m=il,g=cl,Q=gl,ue=bl,A=pl,Ze=vl,T=yl,me=wl,el=hl,ll=xl,K=kl,ce=_l,tl=sl;return r(),ge(tl,{id:"settings",grow:""},{default:n(()=>[a(V,{title:"Settings"},{right:n(()=>[a(P)]),_:1}),o("div",Sl,[a(ll,null,{fallback:n(()=>[o("div",st,[a(T,{class:"h-10 w-full"}),o("div",ot,[a(T,{class:"h-5 w-20"}),a(T,{class:"h-10 w-full"}),a(T,{class:"h-10 w-28"})])])]),default:n(()=>[a(el,{items:ke,"default-value":"account",class:"w-full mx-auto",ui:{list:"max-w-xl"}},{account:n(()=>[o("div",Vl,[o("div",null,[e[38]||(e[38]=o("h3",{class:"text-lg font-semibold mb-4"}," Profile ",-1)),a(Q,{state:t(O),class:"space-y-4",onSubmit:Je},{default:n(()=>[a(m,{label:"Name",name:"name"},{default:n(()=>[a(f,{modelValue:t(O).name,"onUpdate:modelValue":e[0]||(e[0]=l=>t(O).name=l),placeholder:"Your name",class:"w-full"},null,8,["modelValue"])]),_:1}),a(g,{type:"submit",loading:t(X)},{default:n(()=>[...e[37]||(e[37]=[c(" Save Name ",-1)])]),_:1},8,["loading"])]),_:1},8,["state"])]),a(ue),o("div",null,[e[40]||(e[40]=o("h3",{class:"text-lg font-semibold mb-4"}," Email Address ",-1)),a(Q,{state:t(E),class:"space-y-4",onSubmit:Qe},{default:n(()=>[a(m,{label:"Email",name:"newEmail"},{default:n(()=>[a(f,{modelValue:t(E).newEmail,"onUpdate:modelValue":e[1]||(e[1]=l=>t(E).newEmail=l),type:"email",placeholder:"your@email.com",class:"w-full"},null,8,["modelValue"])]),_:1}),a(g,{type:"submit",loading:t(Z)},{default:n(()=>[...e[39]||(e[39]=[c(" Change Email ",-1)])]),_:1},8,["loading"])]),_:1},8,["state"])]),a(ue),o("div",null,[e[42]||(e[42]=o("h3",{class:"text-lg font-semibold mb-4"}," Change Password ",-1)),a(Q,{state:t(h),class:"space-y-4",onSubmit:Xe},{default:n(()=>[a(m,{label:"Current Password",name:"currentPassword"},{default:n(()=>[a(f,{modelValue:t(h).currentPassword,"onUpdate:modelValue":e[2]||(e[2]=l=>t(h).currentPassword=l),type:"password",class:"w-full"},null,8,["modelValue"])]),_:1}),a(m,{label:"New Password",name:"newPassword"},{default:n(()=>[a(f,{modelValue:t(h).newPassword,"onUpdate:modelValue":e[3]||(e[3]=l=>t(h).newPassword=l),type:"password",class:"w-full"},null,8,["modelValue"])]),_:1}),a(m,{label:"Confirm New Password",name:"confirmPassword"},{default:n(()=>[a(f,{modelValue:t(h).confirmPassword,"onUpdate:modelValue":e[4]||(e[4]=l=>t(h).confirmPassword=l),type:"password",class:"w-full"},null,8,["modelValue"])]),_:1}),a(g,{type:"submit",loading:t(ee)},{default:n(()=>[...e[41]||(e[41]=[c(" Change Password ",-1)])]),_:1},8,["loading"])]),_:1},8,["state"])])])]),secrets:n(()=>[o("div",Cl,[o("div",Al,[e[44]||(e[44]=o("div",null,[o("h3",{class:"text-lg font-semibold"}," Secrets "),o("p",{class:"text-sm text-dimmed"}," Encrypted key-value store for skills and integrations. ")],-1)),a(g,{icon:"i-lucide-plus",onClick:Pe},{default:n(()=>[...e[43]||(e[43]=[c(" Add Secret ",-1)])]),_:1})]),a(Ze,{columns:_e,data:t($),loading:t(le)},{"key-cell":n(({row:l})=>[o("code",Il,w(l.original.key),1)]),"description-cell":n(({row:l})=>[o("span",Bl,w(l.original.description||"—"),1)]),"updatedAt-cell":n(({row:l})=>[o("span",El,w(Ae(l.original.updatedAt)),1)]),"actions-cell":n(({row:l})=>[o("div",$l,[a(g,{variant:"ghost",icon:"i-lucide-pencil",size:"xs",onClick:v=>Ue(l.original)},null,8,["onClick"]),a(g,{variant:"ghost",color:"error",icon:"i-lucide-trash-2",size:"xs",onClick:v=>Se(l.original)},null,8,["onClick"])])]),empty:n(()=>[o("div",Dl,[a(A,{name:"i-lucide-key",class:"size-12 mx-auto mb-4 text-dimmed"}),e[45]||(e[45]=o("p",{class:"text-dimmed"}," No secrets yet. Add one to get started. ",-1))])]),_:1},8,["data","loading"])])]),integrations:n(()=>[o("div",Ml,[o("div",Ll,[e[47]||(e[47]=o("div",null,[o("h3",{class:"text-lg font-semibold"}," Integrations "),o("p",{class:"text-sm text-dimmed"}," Connect external platforms to the message bridge. ")],-1)),a(g,{icon:"i-lucide-plus",onClick:qe},{default:n(()=>[...e[46]||(e[46]=[c(" Add Integration ",-1)])]),_:1})]),t(ie)?(r(),u("div",Nl,[(r(),u(x,null,I(3,l=>a(T,{key:l,class:"h-16 w-full"})),64))])):t(ne).length===0?(r(),u("div",Tl,[a(A,{name:"i-lucide-plug",class:"size-12 mx-auto mb-4 text-dimmed"}),e[48]||(e[48]=o("p",{class:"text-dimmed"}," No integrations configured. ",-1)),e[49]||(e[49]=o("p",{class:"text-sm text-dimmed mt-1"}," Connect Telegram, Discord, iMessage, or Google Suite. ",-1))])):(r(),u("div",Rl,[(r(!0),u(x,null,I(t(ne),l=>(r(),u("div",{key:l.id,class:"border border-default rounded-lg px-4 py-3 cursor-pointer hover:bg-elevated/50 transition-colors",onClick:v=>je(l)},[o("div",Ol,[o("div",Fl,[a(A,{name:W.find(v=>v.value===l.platform)?.icon||"i-lucide-plug",class:"size-5 text-dimmed"},null,8,["name"]),o("div",null,[o("span",jl,w(l.name),1),o("span",zl,w(W.find(v=>v.value===l.platform)?.label),1)])]),o("div",ql,[o("span",{class:fl(["text-xs capitalize",Fe[l.healthStatus]||"text-dimmed"])},w(l.healthStatus),3),a(me,{"model-value":l.enabled,onClick:e[5]||(e[5]=be(()=>{},["stop"])),"onUpdate:modelValue":v=>Ge(l)},null,8,["model-value","onUpdate:modelValue"]),a(g,{variant:"ghost",color:"error",icon:"i-lucide-trash-2",size:"xs",onClick:be(v=>Ye(l),["stop"])},null,8,["onClick"])])]),l.healthMessage?(r(),u("p",Kl,w(l.healthMessage),1)):U("",!0)],8,Hl))),128))]))])]),app:n(()=>[o("div",Gl,[o("div",Yl,[e[51]||(e[51]=o("h3",{class:"text-lg font-semibold mb-1"}," Public URL ",-1)),e[52]||(e[52]=o("p",{class:"text-sm text-dimmed mb-4"}," The publicly accessible URL for this instance. Used for Telegram webhooks, auth callbacks, and other integrations that need to reach your server. ",-1)),o("div",Wl,[a(f,{modelValue:t(C),"onUpdate:modelValue":e[6]||(e[6]=l=>H(C)?C.value=l:null),placeholder:"https://example.com",class:"flex-1"},null,8,["modelValue"]),a(g,{loading:t(ae),onClick:Be},{default:n(()=>[...e[50]||(e[50]=[c(" Save ",-1)])]),_:1},8,["loading"])]),e[53]||(e[53]=o("p",{class:"text-xs text-dimmed mt-2"}," Leave empty to use long-polling for Telegram instead of webhooks. Changes require restarting running integrations. ",-1))]),a(ue,{class:"mb-8"}),e[55]||(e[55]=o("div",{class:"mb-6"},[o("h3",{class:"text-lg font-semibold mb-1"}," Notification Preferences "),o("p",{class:"text-sm text-dimmed"}," Choose which resource changes show toast notifications. ")],-1)),t(se)?(r(),u("div",Jl,[(r(),u(x,null,I(5,l=>a(T,{key:l,class:"h-12 w-full"})),64))])):(r(),u("div",Ql,[(r(),u(x,null,I(Ee,l=>o("div",{key:l.key,class:"border border-default rounded-lg"},[o("div",Xl,[o("div",Zl,[a(g,{variant:"ghost",size:"xs",icon:t(j).has(l.key)?"i-lucide-chevron-down":"i-lucide-chevron-right",onClick:v=>Me(l.key)},null,8,["icon","onClick"]),a(A,{name:l.icon,class:"size-5 text-dimmed"},null,8,["name"]),o("span",et,w(l.label),1)]),a(me,{"model-value":t(S)[l.key]?.enabled??!1,"onUpdate:modelValue":v=>Le(l.key,v)},null,8,["model-value","onUpdate:modelValue"])]),t(j).has(l.key)&&t(S)[l.key]?.enabled?(r(),u("div",lt,[(r(!0),u(x,null,I(l.subtypes,v=>(r(),u("div",{key:v,class:"flex items-center justify-between pl-11"},[o("span",tt,w(v),1),a(me,{"model-value":t(S)[l.key]?.subtypes?.[v]!==!1,size:"sm","onUpdate:modelValue":pe=>Ne(l.key,v,pe)},null,8,["model-value","onUpdate:modelValue"])]))),128))])):U("",!0)])),64))])),o("div",at,[a(g,{loading:t(oe),onClick:De},{default:n(()=>[...e[54]||(e[54]=[c(" Save Preferences ",-1)])]),_:1},8,["loading"])])])]),_:1})]),_:1})]),a(K,{open:t(B),"onUpdate:open":e[11]||(e[11]=l=>H(B)?B.value=l:null)},{header:n(()=>[o("h3",nt,w(t(_)?"Edit Secret":"Add Secret"),1)]),body:n(()=>[a(Q,{state:t(b),class:"space-y-4",onSubmit:Ve},{default:n(()=>[a(m,{label:"Key",name:"key",hint:t(_)?"":"SCREAMING_SNAKE_CASE"},{default:n(()=>[a(f,{modelValue:t(b).key,"onUpdate:modelValue":e[7]||(e[7]=l=>t(b).key=l),disabled:!!t(_),placeholder:"MY_API_KEY",class:"w-full font-mono"},null,8,["modelValue","disabled"])]),_:1},8,["hint"]),a(m,{label:"Value",name:"value",hint:t(_)?"Leave empty to keep current value":""},{default:n(()=>[a(f,{modelValue:t(b).value,"onUpdate:modelValue":e[8]||(e[8]=l=>t(b).value=l),type:"password",placeholder:t(_)?"••••••••":"Secret value",class:"w-full"},null,8,["modelValue","placeholder"])]),_:1},8,["hint"]),a(m,{label:"Description",name:"description"},{default:n(()=>[a(f,{modelValue:t(b).description,"onUpdate:modelValue":e[9]||(e[9]=l=>t(b).description=l),placeholder:"Optional description",class:"w-full"},null,8,["modelValue"])]),_:1}),o("div",it,[a(g,{variant:"ghost",onClick:e[10]||(e[10]=l=>B.value=!1)},{default:n(()=>[...e[56]||(e[56]=[c(" Cancel ",-1)])]),_:1}),a(g,{type:"submit",loading:t(te)},{default:n(()=>[c(w(t(_)?"Update":"Create"),1)]),_:1},8,["loading"])])]),_:1},8,["state"])]),_:1},8,["open"]),a(K,{open:t(D),"onUpdate:open":e[13]||(e[13]=l=>H(D)?D.value=l:null)},{header:n(()=>[...e[57]||(e[57]=[o("h3",{class:"text-lg font-semibold"}," Delete Secret ",-1)])]),body:n(()=>[o("p",dt,[e[58]||(e[58]=c(" Are you sure you want to delete ",-1)),o("code",rt,w(t(F)?.key),1),e[59]||(e[59]=c("? ",-1))]),e[62]||(e[62]=o("p",{class:"text-sm text-dimmed"}," This action cannot be undone. Any skills using this secret will stop working. ",-1)),o("div",ut,[a(g,{variant:"ghost",onClick:e[12]||(e[12]=l=>D.value=!1)},{default:n(()=>[...e[60]||(e[60]=[c(" Cancel ",-1)])]),_:1}),a(g,{color:"error",onClick:Ce},{default:n(()=>[...e[61]||(e[61]=[c(" Delete ",-1)])]),_:1})])]),_:1},8,["open"]),a(K,{open:t(M),"onUpdate:open":e[17]||(e[17]=l=>H(M)?M.value=l:null)},{header:n(()=>[...e[63]||(e[63]=[o("h3",{class:"text-lg font-semibold"}," Add Integration ",-1)])]),body:n(()=>[o("div",mt,[a(m,{label:"Platform",name:"platform"},{default:n(()=>[a(ce,{modelValue:t(k).platform,"onUpdate:modelValue":e[14]||(e[14]=l=>t(k).platform=l),items:W,"value-key":"value",class:"w-full"},null,8,["modelValue"])]),_:1}),J(t(k).platform).length?(r(),u("div",ct,[a(A,{name:"i-lucide-alert-triangle",class:"size-4 mt-0.5 text-error shrink-0"}),o("div",null,[e[64]||(e[64]=o("p",{class:"font-medium text-error"}," Missing required secrets ",-1)),e[65]||(e[65]=o("p",{class:"text-dimmed mt-1"}," Add the following in Settings → Secrets before creating: ",-1)),o("ul",pt,[(r(!0),u(x,null,I(J(t(k).platform),l=>(r(),u("li",{key:l},[o("code",ft,w(l),1)]))),128))])])])):U("",!0),a(m,{label:"Name",name:"name"},{default:n(()=>[a(f,{modelValue:t(k).name,"onUpdate:modelValue":e[15]||(e[15]=l=>t(k).name=l),placeholder:Oe[t(k).platform],class:"w-full"},null,8,["modelValue","placeholder"])]),_:1}),o("div",gt,[a(g,{variant:"ghost",onClick:e[16]||(e[16]=l=>M.value=!1)},{default:n(()=>[...e[66]||(e[66]=[c(" Cancel ",-1)])]),_:1}),a(g,{loading:t(de),disabled:J(t(k).platform).length>0,onClick:Ke},{default:n(()=>[...e[67]||(e[67]=[c(" Create ",-1)])]),_:1},8,["loading","disabled"])])])]),_:1},8,["open"]),a(K,{open:t(L),"onUpdate:open":e[19]||(e[19]=l=>H(L)?L.value=l:null)},{header:n(()=>[...e[68]||(e[68]=[o("h3",{class:"text-lg font-semibold"}," Delete Integration ",-1)])]),body:n(()=>[o("p",bt,[e[69]||(e[69]=c(" Are you sure you want to delete ",-1)),o("strong",null,w(t(z)?.name),1),e[70]||(e[70]=c("? ",-1))]),e[73]||(e[73]=o("p",{class:"text-sm text-dimmed"}," This will remove the integration and all associated message history. ",-1)),o("div",vt,[a(g,{variant:"ghost",onClick:e[18]||(e[18]=l=>L.value=!1)},{default:n(()=>[...e[71]||(e[71]=[c(" Cancel ",-1)])]),_:1}),a(g,{color:"error",onClick:We},{default:n(()=>[...e[72]||(e[72]=[c(" Delete ",-1)])]),_:1})])]),_:1},8,["open"]),a(K,{open:t(N),"onUpdate:open":e[36]||(e[36]=l=>H(N)?N.value=l:null)},{header:n(()=>[o("div",yt,[a(A,{name:W.find(l=>l.value===t(y)?.platform)?.icon||"i-lucide-plug",class:"size-5"},null,8,["name"]),o("h3",wt," Configure "+w(t(y)?.name),1)])]),body:n(()=>[o("div",ht,[t(y)&&Y[t(y).platform].length?(r(),u("div",xt,[a(A,{name:"i-lucide-info",class:"size-4 mt-0.5 text-dimmed shrink-0"}),o("span",kt,[e[74]||(e[74]=c(" Requires ",-1)),(r(!0),u(x,null,I(Y[t(y).platform],(l,v)=>(r(),u(x,{key:l},[o("code",_t,w(l),1),v<Y[t(y).platform].length-1?(r(),u(x,{key:0},[c(", ")],64)):U("",!0)],64))),128)),e[75]||(e[75]=c(" in the Secrets tab. ",-1))])])):U("",!0),a(m,{label:"Name",name:"name"},{default:n(()=>[a(f,{modelValue:t(s).name,"onUpdate:modelValue":e[20]||(e[20]=l=>t(s).name=l),placeholder:"Integration name",class:"w-full"},null,8,["modelValue"])]),_:1}),t(y)?.platform==="telegram"?(r(),u(x,{key:1},[a(m,{label:"Bot Username",name:"botUsername",hint:"Without the @ prefix"},{default:n(()=>[a(f,{modelValue:t(s).botUsername,"onUpdate:modelValue":e[21]||(e[21]=l=>t(s).botUsername=l),placeholder:"my_bot",class:"w-full"},null,8,["modelValue"])]),_:1}),a(m,{label:"Allowed Chat IDs",name:"allowedChatIds",hint:"Comma-separated. Leave empty for all."},{default:n(()=>[a(f,{modelValue:t(s).allowedChatIds,"onUpdate:modelValue":e[22]||(e[22]=l=>t(s).allowedChatIds=l),placeholder:"123456, -100789",class:"w-full"},null,8,["modelValue"])]),_:1})],64)):U("",!0),t(y)?.platform==="discord"?(r(),u(x,{key:2},[a(m,{label:"Listen Mode",name:"listenMode"},{default:n(()=>[a(ce,{modelValue:t(s).listenMode,"onUpdate:modelValue":e[23]||(e[23]=l=>t(s).listenMode=l),items:Te,"value-key":"value",class:"w-full"},null,8,["modelValue"])]),_:1}),a(m,{label:"Server ID",name:"guildId",hint:"Optional. Limit to one server."},{default:n(()=>[a(f,{modelValue:t(s).guildId,"onUpdate:modelValue":e[24]||(e[24]=l=>t(s).guildId=l),placeholder:"Discord server ID",class:"w-full"},null,8,["modelValue"])]),_:1}),a(m,{label:"Channel ID",name:"channelId",hint:"Optional. Limit to one channel (for 'all' mode)."},{default:n(()=>[a(f,{modelValue:t(s).channelId,"onUpdate:modelValue":e[25]||(e[25]=l=>t(s).channelId=l),placeholder:"Discord channel ID",class:"w-full"},null,8,["modelValue"])]),_:1})],64)):U("",!0),t(y)?.platform==="imessage"?(r(),u(x,{key:3},[a(m,{label:"Strategy",name:"strategy"},{default:n(()=>[a(ce,{modelValue:t(s).strategy,"onUpdate:modelValue":e[26]||(e[26]=l=>t(s).strategy=l),items:Re,"value-key":"value",class:"w-full"},null,8,["modelValue"])]),_:1}),t(s).strategy==="bluebubbles"&&!t($).some(l=>l.key==="BLUEBUBBLES_PASSWORD")?(r(),u("div",Pt,[a(A,{name:"i-lucide-alert-triangle",class:"size-4 mt-0.5 text-error shrink-0"}),e[76]||(e[76]=o("span",{class:"text-dimmed"},[c(" BlueBubbles requires secret "),o("code",{class:"text-xs bg-elevated px-1.5 py-0.5 rounded"},"BLUEBUBBLES_PASSWORD"),c(" in the Secrets tab. ")],-1))])):U("",!0),t(s).strategy==="bluebubbles"?(r(),ge(m,{key:1,label:"BlueBubbles URL",name:"blueBubblesUrl"},{default:n(()=>[a(f,{modelValue:t(s).blueBubblesUrl,"onUpdate:modelValue":e[27]||(e[27]=l=>t(s).blueBubblesUrl=l),placeholder:"http://192.168.1.100:1234",class:"w-full"},null,8,["modelValue"])]),_:1})):U("",!0),a(m,{label:"Allowed Numbers",name:"allowedNumbers",hint:"Comma-separated. Leave empty for all."},{default:n(()=>[a(f,{modelValue:t(s).allowedNumbers,"onUpdate:modelValue":e[28]||(e[28]=l=>t(s).allowedNumbers=l),placeholder:"+15551234567, +15559876543",class:"w-full"},null,8,["modelValue"])]),_:1})],64)):U("",!0),t(y)?.platform==="google"?(r(),u(x,{key:4},[a(m,{label:"Enabled Services",name:"enabledServices"},{default:n(()=>[o("div",Ut,[(r(),u(x,null,I(He,l=>o("label",{key:l.value,class:"flex items-center gap-2 cursor-pointer"},[o("input",{type:"checkbox",checked:t(s).enabledServices.includes(l.value),class:"rounded",onChange:v=>t(s).enabledServices.includes(l.value)?t(s).enabledServices=t(s).enabledServices.filter(pe=>pe!==l.value):t(s).enabledServices.push(l.value)},null,40,St),o("span",Vt,w(l.label),1)])),64))])]),_:1}),a(m,{label:"Google Account",name:"account",hint:"Email used with gogcli"},{default:n(()=>[a(f,{modelValue:t(s).account,"onUpdate:modelValue":e[29]||(e[29]=l=>t(s).account=l),placeholder:"user@gmail.com",class:"w-full"},null,8,["modelValue"])]),_:1})],64)):U("",!0),t(y)?.platform==="email"?(r(),u(x,{key:5},[a(m,{label:"Email Address",name:"emailAddress"},{default:n(()=>[a(f,{modelValue:t(s).emailAddress,"onUpdate:modelValue":e[30]||(e[30]=l=>t(s).emailAddress=l),placeholder:"user@example.com",class:"w-full"},null,8,["modelValue"])]),_:1}),o("div",Ct,[a(m,{label:"IMAP Host",name:"imapHost"},{default:n(()=>[a(f,{modelValue:t(s).imapHost,"onUpdate:modelValue":e[31]||(e[31]=l=>t(s).imapHost=l),placeholder:"imap.example.com",class:"w-full"},null,8,["modelValue"])]),_:1}),a(m,{label:"IMAP Port",name:"imapPort"},{default:n(()=>[a(f,{modelValue:t(s).imapPort,"onUpdate:modelValue":e[32]||(e[32]=l=>t(s).imapPort=l),placeholder:"993",class:"w-full"},null,8,["modelValue"])]),_:1})]),o("div",At,[a(m,{label:"SMTP Host",name:"smtpHost"},{default:n(()=>[a(f,{modelValue:t(s).smtpHost,"onUpdate:modelValue":e[33]||(e[33]=l=>t(s).smtpHost=l),placeholder:"smtp.example.com",class:"w-full"},null,8,["modelValue"])]),_:1}),a(m,{label:"SMTP Port",name:"smtpPort"},{default:n(()=>[a(f,{modelValue:t(s).smtpPort,"onUpdate:modelValue":e[34]||(e[34]=l=>t(s).smtpPort=l),placeholder:"587",class:"w-full"},null,8,["modelValue"])]),_:1})])],64)):U("",!0),o("div",It,[a(g,{variant:"ghost",onClick:e[35]||(e[35]=l=>N.value=!1)},{default:n(()=>[...e[77]||(e[77]=[c(" Cancel ",-1)])]),_:1}),a(g,{loading:t(re),onClick:ze},{default:n(()=>[...e[78]||(e[78]=[c(" Save ",-1)])]),_:1},8,["loading"])])])]),_:1},8,["open"])]),_:1})}}});export{ba as default};
@@ -1 +1 @@
1
- import{e as V,a as H,aP as X,aQ as L,c as _,aR as Z,bn as ee,Q,R as j,S as P,T as z,C as g,a3 as U,bm as B,ak as R,a4 as Y,k as te,a0 as M,a1 as le,V as ae,bo as $}from"./njnzCNrH.js";import{R as ne}from"./CClsKJ9A.js";import{u as re}from"./ImPsUDiH.js";import{f as O}from"./BvstjGHC.js";import{u as ue}from"./BCCYopTB.js";import{R as ie,M as se}from"./Bwn-CRYH.js";function de(r,f){const e=V(),o=(t,S)=>{if(f.multiple&&Array.isArray(r.value))if(f.selectionBehavior==="replace")r.value=[t],e.value=t;else{const h=r.value.findIndex(i=>S(i));h!==-1?r.value=r.value.filter((i,p)=>p!==h):r.value=[...r.value,t]}else f.selectionBehavior==="replace"?r.value={...t}:!Array.isArray(r.value)&&S(r.value)?r.value=void 0:r.value={...t};return r.value};function x(t,S,h,i){if(!e?.value||!f.multiple||!Array.isArray(r.value))return;const A=h().filter(C=>C.ref.dataset.disabled!=="").find(C=>C.ref===S)?.value;if(!A)return;let K=null;switch(t){case"prev":case"next":{K=O(i,e.value,A);break}case"first":{K=O(i,e.value,i?.[0]);break}case"last":{K=O(i,e.value,i?.[i.length-1]);break}}r.value=K}return{firstValue:e,onSelectItem:o,handleMultipleReplace:x}}function F(r){return r.reduce((f,e)=>(f.push(e),e.children&&f.push(...F(e.children)),f),[])}const[oe,ce]=Z("TreeRoot");var ve=H({__name:"TreeRoot",props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},items:{type:Array,required:!1},expanded:{type:Array,required:!1},defaultExpanded:{type:Array,required:!1},getKey:{type:Function,required:!0},getChildren:{type:Function,required:!1,default:r=>r.children},selectionBehavior:{type:String,required:!1,default:"toggle"},multiple:{type:Boolean,required:!1,skipCheck:!0},dir:{type:String,required:!1},disabled:{type:Boolean,required:!1},propagateSelect:{type:Boolean,required:!1},bubbleSelect:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"ul"}},emits:["update:modelValue","update:expanded"],setup(r,{emit:f}){const e=r,o=f,{items:x,multiple:t,disabled:S,propagateSelect:h,dir:i,bubbleSelect:p}=X(e),{handleTypeaheadSearch:A}=ue(),K=re(i),C=V(),k=V(!1),q=ee(),u=L(e,"modelValue",o,{defaultValue:e.defaultValue??(t.value?[]:void 0),passive:!0,deep:!0}),v=L(e,"expanded",o,{defaultValue:e.defaultExpanded??[],passive:e.expanded===void 0,deep:!0}),{onSelectItem:l,handleMultipleReplace:n}=de(u,e),s=_(()=>t.value&&Array.isArray(u.value)?u.value.map(a=>e.getKey(a)):[e.getKey(u.value??{})]);function I(a,d=1,y){return a.reduce((c,m,w)=>{const G=e.getKey(m),N=e.getChildren(m),J=v.value.includes(G),W={_id:G,value:m,index:w,level:d,parentItem:y,hasChildren:!!N,bind:{value:m,level:d,"aria-setsize":a.length,"aria-posinset":w+1}};return c.push(W),N&&J&&c.push(...I(N,d+1,m)),c},[])}const T=_(()=>{const a=e.items;return v.value.map(d=>d),I(a??[])});function E(a){if(k.value)q.trigger(a);else{const d=C.value?.getItems()??[];A(a.key,d)}}function b(a){if(k.value)return;const d=se[a.key];te(()=>{n(d,M(),C.value?.getItems,T.value.map(y=>y.value))})}function D(a){if(a.parentItem!=null&&Array.isArray(u.value)&&e.multiple){const d=T.value.find(y=>a.parentItem!=null&&e.getKey(y.value)===e.getKey(a.parentItem));d!=null&&(e.getChildren(d.value)?.every(c=>u.value.find(m=>e.getKey(m)===e.getKey(c)))?u.value=[...u.value,d.value]:u.value=u.value.filter(c=>e.getKey(c)!==e.getKey(d.value)),D(d))}}return ce({modelValue:u,selectedKeys:s,onSelect:a=>{const d=c=>e.getKey(c??{})===e.getKey(a),y=e.multiple&&Array.isArray(u.value)?u.value?.findIndex(d)!==-1:void 0;if(l(a,d),e.bubbleSelect&&e.multiple&&Array.isArray(u.value)){const c=T.value.find(m=>e.getKey(m.value)===e.getKey(a));c!=null&&D(c)}if(e.propagateSelect&&e.multiple&&Array.isArray(u.value)){const c=F(e.getChildren(a)??[]);y?u.value=[...u.value].filter(m=>!c.some(w=>e.getKey(m??{})===e.getKey(w))):u.value=[...u.value,...c]}},expanded:v,onToggle(a){if(!(a?e.getChildren(a):void 0))return;const y=e.getKey(a)??a;v.value.includes(y)?v.value=v.value.filter(c=>c!==y):v.value=[...v.value,y]},getKey:e.getKey,getChildren:e.getChildren,items:x,expandedItems:T,disabled:S,multiple:t,dir:K,propagateSelect:h,bubbleSelect:p,isVirtual:k,virtualKeydownHook:q,handleMultipleReplace:n}),(a,d)=>(j(),Q(g(ie),{ref_key:"rovingFocusGroupRef",ref:C,"as-child":"",orientation:"vertical",dir:g(K)},{default:P(()=>[z(g(U),{role:"tree",as:a.as,"as-child":a.asChild,"aria-multiselectable":g(t)?!0:void 0,onKeydown:[E,B(R(b,["shift"]),["up","down"])]},{default:P(()=>[Y(a.$slots,"default",{flattenItems:T.value,modelValue:g(u),expanded:g(v)})]),_:3},8,["as","as-child","aria-multiselectable","onKeydown"])]),_:3},8,["dir"]))}}),be=ve;const fe="tree.select",pe="tree.toggle";var ye=H({inheritAttrs:!1,__name:"TreeItem",props:{value:{type:null,required:!0},level:{type:Number,required:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"li"}},emits:["select","toggle"],setup(r,{expose:f,emit:e}){const o=r,x=e,t=oe(),{getItems:S}=le(),h=_(()=>!!t.getChildren(o.value)),i=_(()=>{const l=t.getKey(o.value);return t.expanded.value.includes(l)}),p=_(()=>{const l=t.getKey(o.value);return t.selectedKeys.value.includes(l)}),A=_(()=>{if(t.bubbleSelect.value&&h.value&&Array.isArray(t.modelValue.value)){const l=F(t.getChildren(o.value)||[]);return l.some(n=>t.modelValue.value.find(s=>t.getKey(s)===t.getKey(n)))&&!l.every(n=>t.modelValue.value.find(s=>t.getKey(s)===t.getKey(n)))}else return t.propagateSelect.value&&p.value&&h.value&&Array.isArray(t.modelValue.value)?!F(t.getChildren(o.value)||[]).every(n=>t.modelValue.value.find(s=>t.getKey(s)===t.getKey(n))):void 0});function K(l){if(h.value)if(i.value){const n=S().map(b=>b.ref),s=M(),I=n.indexOf(s),E=[...n].slice(I).find(b=>Number(b.getAttribute("data-indent"))===o.level+1);E&&E.focus()}else v(l)}function C(l){if(i.value)v(l);else{const n=S().map(b=>b.ref),s=M(),I=n.indexOf(s),E=[...n].slice(0,I).reverse().find(b=>Number(b.getAttribute("data-indent"))===o.level-1);E&&E.focus()}}async function k(l){x("select",l),!l?.defaultPrevented&&t.onSelect(o.value)}async function q(l){x("toggle",l),!l?.defaultPrevented&&t.onToggle(o.value)}async function u(l){if(!l)return;const n={originalEvent:l,value:o.value,isExpanded:i.value,isSelected:p.value};$(fe,k,n)}async function v(l){if(!l)return;const n={originalEvent:l,value:o.value,isExpanded:i.value,isSelected:p.value};$(pe,q,n)}return f({isExpanded:i,isSelected:p,isIndeterminate:A,handleToggle:()=>t.onToggle(o.value),handleSelect:()=>t.onSelect(o.value)}),(l,n)=>(j(),Q(g(ne),{"as-child":"",value:l.value,"allow-shift-key":""},{default:P(()=>[z(g(U),ae(l.$attrs,{role:"treeitem",as:l.as,"as-child":l.asChild,"aria-selected":p.value,"aria-expanded":h.value?i.value:void 0,"aria-level":l.level,"data-indent":l.level,"data-selected":p.value?"":void 0,"data-expanded":i.value?"":void 0,onKeydown:[B(R(u,["self","prevent"]),["enter","space"]),n[0]||(n[0]=B(R(s=>g(t).dir.value==="ltr"?K(s):C(s),["prevent"]),["right"])),n[1]||(n[1]=B(R(s=>g(t).dir.value==="ltr"?C(s):K(s),["prevent"]),["left"]))],onClick:n[2]||(n[2]=R(s=>{u(s),v(s)},["stop"]))}),{default:P(()=>[Y(l.$slots,"default",{isExpanded:i.value,isSelected:p.value,isIndeterminate:A.value,handleSelect:()=>g(t).onSelect(l.value),handleToggle:()=>g(t).onToggle(l.value)})]),_:3},16,["as","as-child","aria-selected","aria-expanded","aria-level","data-indent","data-selected","data-expanded","onKeydown"])]),_:3},8,["value"]))}}),Ae=ye;export{be as T,Ae as a,oe as i};
1
+ import{e as V,a as H,aP as X,aQ as L,c as _,aR as Z,bn as ee,Q,R as j,S as P,T as z,C as g,a3 as U,bm as B,al as R,a4 as Y,k as te,a0 as M,a1 as le,V as ae,bo as $}from"./2dNDtTiv.js";import{R as ne}from"./DH4YkDAi.js";import{u as re}from"./BIXrSYwR.js";import{f as O}from"./DtjjnHnt.js";import{u as ue}from"./CQqCBrXj.js";import{R as ie,M as se}from"./CYPO5o_C.js";function de(r,f){const e=V(),o=(t,S)=>{if(f.multiple&&Array.isArray(r.value))if(f.selectionBehavior==="replace")r.value=[t],e.value=t;else{const h=r.value.findIndex(i=>S(i));h!==-1?r.value=r.value.filter((i,p)=>p!==h):r.value=[...r.value,t]}else f.selectionBehavior==="replace"?r.value={...t}:!Array.isArray(r.value)&&S(r.value)?r.value=void 0:r.value={...t};return r.value};function x(t,S,h,i){if(!e?.value||!f.multiple||!Array.isArray(r.value))return;const A=h().filter(C=>C.ref.dataset.disabled!=="").find(C=>C.ref===S)?.value;if(!A)return;let K=null;switch(t){case"prev":case"next":{K=O(i,e.value,A);break}case"first":{K=O(i,e.value,i?.[0]);break}case"last":{K=O(i,e.value,i?.[i.length-1]);break}}r.value=K}return{firstValue:e,onSelectItem:o,handleMultipleReplace:x}}function F(r){return r.reduce((f,e)=>(f.push(e),e.children&&f.push(...F(e.children)),f),[])}const[oe,ce]=Z("TreeRoot");var ve=H({__name:"TreeRoot",props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},items:{type:Array,required:!1},expanded:{type:Array,required:!1},defaultExpanded:{type:Array,required:!1},getKey:{type:Function,required:!0},getChildren:{type:Function,required:!1,default:r=>r.children},selectionBehavior:{type:String,required:!1,default:"toggle"},multiple:{type:Boolean,required:!1,skipCheck:!0},dir:{type:String,required:!1},disabled:{type:Boolean,required:!1},propagateSelect:{type:Boolean,required:!1},bubbleSelect:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"ul"}},emits:["update:modelValue","update:expanded"],setup(r,{emit:f}){const e=r,o=f,{items:x,multiple:t,disabled:S,propagateSelect:h,dir:i,bubbleSelect:p}=X(e),{handleTypeaheadSearch:A}=ue(),K=re(i),C=V(),k=V(!1),q=ee(),u=L(e,"modelValue",o,{defaultValue:e.defaultValue??(t.value?[]:void 0),passive:!0,deep:!0}),v=L(e,"expanded",o,{defaultValue:e.defaultExpanded??[],passive:e.expanded===void 0,deep:!0}),{onSelectItem:l,handleMultipleReplace:n}=de(u,e),s=_(()=>t.value&&Array.isArray(u.value)?u.value.map(a=>e.getKey(a)):[e.getKey(u.value??{})]);function I(a,d=1,y){return a.reduce((c,m,w)=>{const G=e.getKey(m),N=e.getChildren(m),J=v.value.includes(G),W={_id:G,value:m,index:w,level:d,parentItem:y,hasChildren:!!N,bind:{value:m,level:d,"aria-setsize":a.length,"aria-posinset":w+1}};return c.push(W),N&&J&&c.push(...I(N,d+1,m)),c},[])}const T=_(()=>{const a=e.items;return v.value.map(d=>d),I(a??[])});function E(a){if(k.value)q.trigger(a);else{const d=C.value?.getItems()??[];A(a.key,d)}}function b(a){if(k.value)return;const d=se[a.key];te(()=>{n(d,M(),C.value?.getItems,T.value.map(y=>y.value))})}function D(a){if(a.parentItem!=null&&Array.isArray(u.value)&&e.multiple){const d=T.value.find(y=>a.parentItem!=null&&e.getKey(y.value)===e.getKey(a.parentItem));d!=null&&(e.getChildren(d.value)?.every(c=>u.value.find(m=>e.getKey(m)===e.getKey(c)))?u.value=[...u.value,d.value]:u.value=u.value.filter(c=>e.getKey(c)!==e.getKey(d.value)),D(d))}}return ce({modelValue:u,selectedKeys:s,onSelect:a=>{const d=c=>e.getKey(c??{})===e.getKey(a),y=e.multiple&&Array.isArray(u.value)?u.value?.findIndex(d)!==-1:void 0;if(l(a,d),e.bubbleSelect&&e.multiple&&Array.isArray(u.value)){const c=T.value.find(m=>e.getKey(m.value)===e.getKey(a));c!=null&&D(c)}if(e.propagateSelect&&e.multiple&&Array.isArray(u.value)){const c=F(e.getChildren(a)??[]);y?u.value=[...u.value].filter(m=>!c.some(w=>e.getKey(m??{})===e.getKey(w))):u.value=[...u.value,...c]}},expanded:v,onToggle(a){if(!(a?e.getChildren(a):void 0))return;const y=e.getKey(a)??a;v.value.includes(y)?v.value=v.value.filter(c=>c!==y):v.value=[...v.value,y]},getKey:e.getKey,getChildren:e.getChildren,items:x,expandedItems:T,disabled:S,multiple:t,dir:K,propagateSelect:h,bubbleSelect:p,isVirtual:k,virtualKeydownHook:q,handleMultipleReplace:n}),(a,d)=>(j(),Q(g(ie),{ref_key:"rovingFocusGroupRef",ref:C,"as-child":"",orientation:"vertical",dir:g(K)},{default:P(()=>[z(g(U),{role:"tree",as:a.as,"as-child":a.asChild,"aria-multiselectable":g(t)?!0:void 0,onKeydown:[E,B(R(b,["shift"]),["up","down"])]},{default:P(()=>[Y(a.$slots,"default",{flattenItems:T.value,modelValue:g(u),expanded:g(v)})]),_:3},8,["as","as-child","aria-multiselectable","onKeydown"])]),_:3},8,["dir"]))}}),be=ve;const fe="tree.select",pe="tree.toggle";var ye=H({inheritAttrs:!1,__name:"TreeItem",props:{value:{type:null,required:!0},level:{type:Number,required:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"li"}},emits:["select","toggle"],setup(r,{expose:f,emit:e}){const o=r,x=e,t=oe(),{getItems:S}=le(),h=_(()=>!!t.getChildren(o.value)),i=_(()=>{const l=t.getKey(o.value);return t.expanded.value.includes(l)}),p=_(()=>{const l=t.getKey(o.value);return t.selectedKeys.value.includes(l)}),A=_(()=>{if(t.bubbleSelect.value&&h.value&&Array.isArray(t.modelValue.value)){const l=F(t.getChildren(o.value)||[]);return l.some(n=>t.modelValue.value.find(s=>t.getKey(s)===t.getKey(n)))&&!l.every(n=>t.modelValue.value.find(s=>t.getKey(s)===t.getKey(n)))}else return t.propagateSelect.value&&p.value&&h.value&&Array.isArray(t.modelValue.value)?!F(t.getChildren(o.value)||[]).every(n=>t.modelValue.value.find(s=>t.getKey(s)===t.getKey(n))):void 0});function K(l){if(h.value)if(i.value){const n=S().map(b=>b.ref),s=M(),I=n.indexOf(s),E=[...n].slice(I).find(b=>Number(b.getAttribute("data-indent"))===o.level+1);E&&E.focus()}else v(l)}function C(l){if(i.value)v(l);else{const n=S().map(b=>b.ref),s=M(),I=n.indexOf(s),E=[...n].slice(0,I).reverse().find(b=>Number(b.getAttribute("data-indent"))===o.level-1);E&&E.focus()}}async function k(l){x("select",l),!l?.defaultPrevented&&t.onSelect(o.value)}async function q(l){x("toggle",l),!l?.defaultPrevented&&t.onToggle(o.value)}async function u(l){if(!l)return;const n={originalEvent:l,value:o.value,isExpanded:i.value,isSelected:p.value};$(fe,k,n)}async function v(l){if(!l)return;const n={originalEvent:l,value:o.value,isExpanded:i.value,isSelected:p.value};$(pe,q,n)}return f({isExpanded:i,isSelected:p,isIndeterminate:A,handleToggle:()=>t.onToggle(o.value),handleSelect:()=>t.onSelect(o.value)}),(l,n)=>(j(),Q(g(ne),{"as-child":"",value:l.value,"allow-shift-key":""},{default:P(()=>[z(g(U),ae(l.$attrs,{role:"treeitem",as:l.as,"as-child":l.asChild,"aria-selected":p.value,"aria-expanded":h.value?i.value:void 0,"aria-level":l.level,"data-indent":l.level,"data-selected":p.value?"":void 0,"data-expanded":i.value?"":void 0,onKeydown:[B(R(u,["self","prevent"]),["enter","space"]),n[0]||(n[0]=B(R(s=>g(t).dir.value==="ltr"?K(s):C(s),["prevent"]),["right"])),n[1]||(n[1]=B(R(s=>g(t).dir.value==="ltr"?C(s):K(s),["prevent"]),["left"]))],onClick:n[2]||(n[2]=R(s=>{u(s),v(s)},["stop"]))}),{default:P(()=>[Y(l.$slots,"default",{isExpanded:i.value,isSelected:p.value,isIndeterminate:A.value,handleSelect:()=>g(t).onSelect(l.value),handleToggle:()=>g(t).onToggle(l.value)})]),_:3},16,["as","as-child","aria-selected","aria-expanded","aria-level","data-indent","data-selected","data-expanded","onKeydown"])]),_:3},8,["value"]))}}),Ae=ye;export{be as T,Ae as a,oe as i};
@@ -1 +1 @@
1
- import{ad as s,G as a,R as i,ab as t,ae as n,T as u,S as c,aa as l,af as d}from"./njnzCNrH.js";import{_ as f}from"./DlAUqK2U.js";const p={class:"antialiased bg-white dark:bg-[#020420] dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-[#020420] tracking-wide"},m={class:"max-w-520px text-center"},h=["textContent"],g=["textContent"],b=["textContent"],x={class:"flex items-center justify-center w-full"},y={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"Page not found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(e){const r=e;return s({title:`${r.statusCode} - ${r.statusMessage} | ${r.appName}`,script:[{innerHTML:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver(e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)}).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1,h2{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1,h2,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(k,_)=>{const o=d;return i(),a("div",p,[t("div",m,[t("h1",{class:"font-semibold leading-none mb-4 sm:text-[110px] tabular-nums text-[80px]",textContent:n(e.statusCode)},null,8,h),t("h2",{class:"font-semibold mb-2 sm:text-3xl text-2xl",textContent:n(e.statusMessage)},null,8,g),t("p",{class:"mb-4 px-2 text-[#64748B] text-md",textContent:n(e.description)},null,8,b),t("div",x,[u(o,{to:"/",class:"font-medium hover:text-[#00DC82] text-sm underline underline-offset-3"},{default:c(()=>[l(n(e.backHome),1)]),_:1})])])])}}},v=f(y,[["__scopeId","data-v-8f98a97f"]]);export{v as default};
1
+ import{ad as s,G as a,R as i,ab as t,ae as n,T as u,S as c,aa as l,af as d}from"./2dNDtTiv.js";import{_ as f}from"./DlAUqK2U.js";const p={class:"antialiased bg-white dark:bg-[#020420] dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-[#020420] tracking-wide"},m={class:"max-w-520px text-center"},h=["textContent"],g=["textContent"],b=["textContent"],x={class:"flex items-center justify-center w-full"},y={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"Page not found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(e){const r=e;return s({title:`${r.statusCode} - ${r.statusMessage} | ${r.appName}`,script:[{innerHTML:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver(e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)}).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1,h2{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1,h2,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(k,_)=>{const o=d;return i(),a("div",p,[t("div",m,[t("h1",{class:"font-semibold leading-none mb-4 sm:text-[110px] tabular-nums text-[80px]",textContent:n(e.statusCode)},null,8,h),t("h2",{class:"font-semibold mb-2 sm:text-3xl text-2xl",textContent:n(e.statusMessage)},null,8,g),t("p",{class:"mb-4 px-2 text-[#64748B] text-md",textContent:n(e.description)},null,8,b),t("div",x,[u(o,{to:"/",class:"font-medium hover:text-[#00DC82] text-sm underline underline-offset-3"},{default:c(()=>[l(n(e.backHome),1)]),_:1})])])])}}},v=f(y,[["__scopeId","data-v-8f98a97f"]]);export{v as default};
@@ -1 +1 @@
1
- import{ao as T,N as $,aJ as C,aI as _,c as N,am as p,e as P,Q as o,R as s,S as d,T as y,G as v,a9 as g,C as r,U as c,a4 as u,ai as x,aj as m,_ as K,ax as R,V as f,Y as z,aa as k,ae as S}from"./njnzCNrH.js";import{a as j,T as E,c as F,d as H,b as L}from"./D7pKT3IW.js";import{_ as M}from"./yJ9vRvHj.js";const O={slots:{root:"flex items-center gap-2",list:"relative flex p-1 group",indicator:"absolute transition-[translate,width] duration-200",trigger:["group relative inline-flex items-center min-w-0 data-[state=inactive]:text-muted hover:data-[state=inactive]:not-disabled:text-default font-medium rounded-md disabled:cursor-not-allowed disabled:opacity-75","transition-colors"],leadingIcon:"shrink-0",leadingAvatar:"shrink-0",leadingAvatarSize:"",label:"truncate",trailingBadge:"shrink-0",trailingBadgeSize:"sm",content:"focus:outline-none w-full"},variants:{color:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},variant:{pill:{list:"bg-elevated rounded-lg",trigger:"grow",indicator:"rounded-md shadow-xs"},link:{list:"border-default",indicator:"rounded-full",trigger:"focus:outline-none"}},orientation:{horizontal:{root:"flex-col",list:"w-full",indicator:"left-0 w-(--reka-tabs-indicator-size) translate-x-(--reka-tabs-indicator-position)",trigger:"justify-center"},vertical:{list:"flex-col",indicator:"top-0 h-(--reka-tabs-indicator-size) translate-y-(--reka-tabs-indicator-position)"}},size:{xs:{trigger:"px-2 py-1 text-xs gap-1",leadingIcon:"size-4",leadingAvatarSize:"3xs"},sm:{trigger:"px-2.5 py-1.5 text-xs gap-1.5",leadingIcon:"size-4",leadingAvatarSize:"3xs"},md:{trigger:"px-3 py-1.5 text-sm gap-1.5",leadingIcon:"size-5",leadingAvatarSize:"2xs"},lg:{trigger:"px-3 py-2 text-sm gap-2",leadingIcon:"size-5",leadingAvatarSize:"2xs"},xl:{trigger:"px-3 py-2 text-base gap-2",leadingIcon:"size-6",leadingAvatarSize:"xs"}}},compoundVariants:[{orientation:"horizontal",variant:"pill",class:{indicator:"inset-y-1"}},{orientation:"horizontal",variant:"link",class:{list:"border-b -mb-px",indicator:"-bottom-px h-px"}},{orientation:"vertical",variant:"pill",class:{indicator:"inset-x-1",list:"items-center"}},{orientation:"vertical",variant:"link",class:{list:"border-s -ms-px",indicator:"-start-px w-px"}},{color:"primary",variant:"pill",class:{indicator:"bg-primary",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"}},{color:"secondary",variant:"pill",class:{indicator:"bg-secondary",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary"}},{color:"success",variant:"pill",class:{indicator:"bg-success",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-success"}},{color:"info",variant:"pill",class:{indicator:"bg-info",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-info"}},{color:"warning",variant:"pill",class:{indicator:"bg-warning",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-warning"}},{color:"error",variant:"pill",class:{indicator:"bg-error",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-error"}},{color:"neutral",variant:"pill",class:{indicator:"bg-inverted",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-inverted"}},{color:"primary",variant:"link",class:{indicator:"bg-primary",trigger:"data-[state=active]:text-primary focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary"}},{color:"secondary",variant:"link",class:{indicator:"bg-secondary",trigger:"data-[state=active]:text-secondary focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary"}},{color:"success",variant:"link",class:{indicator:"bg-success",trigger:"data-[state=active]:text-success focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-success"}},{color:"info",variant:"link",class:{indicator:"bg-info",trigger:"data-[state=active]:text-info focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-info"}},{color:"warning",variant:"link",class:{indicator:"bg-warning",trigger:"data-[state=active]:text-warning focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-warning"}},{color:"error",variant:"link",class:{indicator:"bg-error",trigger:"data-[state=active]:text-error focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-error"}},{color:"neutral",variant:"link",class:{indicator:"bg-inverted",trigger:"data-[state=active]:text-highlighted focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-inverted"}}],defaultVariants:{color:"primary",variant:"pill",size:"md"}},Q={__name:"UTabs",props:{as:{type:null,required:!1},items:{type:Array,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},orientation:{type:null,required:!1,default:"horizontal"},content:{type:Boolean,required:!1,default:!0},labelKey:{type:null,required:!1,default:"label"},class:{type:null,required:!1},ui:{type:null,required:!1},defaultValue:{type:null,required:!1,default:"0"},modelValue:{type:null,required:!1},activationMode:{type:String,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:["update:modelValue"],setup(l,{expose:w,emit:h}){const a=l,A=h,q=T(),B=$(),I=C(_(a,"as","unmountOnHide"),A),i=N(()=>p({extend:p(O),...B.ui?.tabs||{}})({color:a.color,variant:a.variant,size:a.size,orientation:a.orientation})),b=P([]);return w({triggersRef:b}),(n,U)=>(s(),o(r(L),f(r(I),{"model-value":l.modelValue,"default-value":l.defaultValue,orientation:l.orientation,"activation-mode":l.activationMode,"data-slot":"root",class:i.value.root({class:[a.ui?.root,a.class]})}),{default:d(()=>[y(r(j),{"data-slot":"list",class:c(i.value.list({class:a.ui?.list}))},{default:d(()=>[y(r(E),{"data-slot":"indicator",class:c(i.value.indicator({class:a.ui?.indicator}))},null,8,["class"]),u(n.$slots,"list-leading"),(s(!0),v(x,null,m(l.items,(e,t)=>(s(),o(r(F),{key:t,ref_for:!0,ref:V=>b.value[t]=V,value:e.value??String(t),disabled:e.disabled,"data-slot":"trigger",class:c(i.value.trigger({class:[a.ui?.trigger,e.ui?.trigger]}))},{default:d(()=>[u(n.$slots,"leading",{item:e,index:t,ui:i.value},()=>[e.icon?(s(),o(K,{key:0,name:e.icon,"data-slot":"leadingIcon",class:c(i.value.leadingIcon({class:[a.ui?.leadingIcon,e.ui?.leadingIcon]}))},null,8,["name","class"])):e.avatar?(s(),o(R,f({key:1,size:e.ui?.leadingAvatarSize||a.ui?.leadingAvatarSize||i.value.leadingAvatarSize()},{ref_for:!0},e.avatar,{"data-slot":"leadingAvatar",class:i.value.leadingAvatar({class:[a.ui?.leadingAvatar,e.ui?.leadingAvatar]})}),null,16,["size","class"])):g("",!0)]),r(z)(e,a.labelKey)||q.default?(s(),v("span",{key:0,"data-slot":"label",class:c(i.value.label({class:[a.ui?.label,e.ui?.label]}))},[u(n.$slots,"default",{item:e,index:t},()=>[k(S(r(z)(e,a.labelKey)),1)])],2)):g("",!0),u(n.$slots,"trailing",{item:e,index:t,ui:i.value},()=>[e.badge||e.badge===0?(s(),o(M,f({key:0,color:"neutral",variant:"outline",size:e.ui?.trailingBadgeSize||a.ui?.trailingBadgeSize||i.value.trailingBadgeSize()},{ref_for:!0},typeof e.badge=="string"||typeof e.badge=="number"?{label:e.badge}:e.badge,{"data-slot":"trailingBadge",class:i.value.trailingBadge({class:[a.ui?.trailingBadge,e.ui?.trailingBadge]})}),null,16,["size","class"])):g("",!0)])]),_:2},1032,["value","disabled","class"]))),128)),u(n.$slots,"list-trailing")]),_:3},8,["class"]),l.content?(s(!0),v(x,{key:0},m(l.items,(e,t)=>(s(),o(r(H),{key:t,value:e.value??String(t),"data-slot":"content",class:c(i.value.content({class:[a.ui?.content,e.ui?.content,e.class]}))},{default:d(()=>[u(n.$slots,e.slot||"content",{item:e,index:t,ui:i.value},()=>[k(S(e.content),1)])]),_:2},1032,["value","class"]))),128)):g("",!0)]),_:3},16,["model-value","default-value","orientation","activation-mode","class"]))}};export{Q as _};
1
+ import{ao as T,N as $,aJ as C,aI as _,c as N,am as p,e as P,Q as o,R as s,S as d,T as y,G as v,a9 as g,C as r,U as c,a4 as u,aj as x,ak as m,_ as K,ax as R,V as f,Y as z,aa as k,ae as S}from"./2dNDtTiv.js";import{a as j,T as E,c as F,d as H,b as L}from"./D0ifH682.js";import{_ as M}from"./JbHa4oXq.js";const O={slots:{root:"flex items-center gap-2",list:"relative flex p-1 group",indicator:"absolute transition-[translate,width] duration-200",trigger:["group relative inline-flex items-center min-w-0 data-[state=inactive]:text-muted hover:data-[state=inactive]:not-disabled:text-default font-medium rounded-md disabled:cursor-not-allowed disabled:opacity-75","transition-colors"],leadingIcon:"shrink-0",leadingAvatar:"shrink-0",leadingAvatarSize:"",label:"truncate",trailingBadge:"shrink-0",trailingBadgeSize:"sm",content:"focus:outline-none w-full"},variants:{color:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},variant:{pill:{list:"bg-elevated rounded-lg",trigger:"grow",indicator:"rounded-md shadow-xs"},link:{list:"border-default",indicator:"rounded-full",trigger:"focus:outline-none"}},orientation:{horizontal:{root:"flex-col",list:"w-full",indicator:"left-0 w-(--reka-tabs-indicator-size) translate-x-(--reka-tabs-indicator-position)",trigger:"justify-center"},vertical:{list:"flex-col",indicator:"top-0 h-(--reka-tabs-indicator-size) translate-y-(--reka-tabs-indicator-position)"}},size:{xs:{trigger:"px-2 py-1 text-xs gap-1",leadingIcon:"size-4",leadingAvatarSize:"3xs"},sm:{trigger:"px-2.5 py-1.5 text-xs gap-1.5",leadingIcon:"size-4",leadingAvatarSize:"3xs"},md:{trigger:"px-3 py-1.5 text-sm gap-1.5",leadingIcon:"size-5",leadingAvatarSize:"2xs"},lg:{trigger:"px-3 py-2 text-sm gap-2",leadingIcon:"size-5",leadingAvatarSize:"2xs"},xl:{trigger:"px-3 py-2 text-base gap-2",leadingIcon:"size-6",leadingAvatarSize:"xs"}}},compoundVariants:[{orientation:"horizontal",variant:"pill",class:{indicator:"inset-y-1"}},{orientation:"horizontal",variant:"link",class:{list:"border-b -mb-px",indicator:"-bottom-px h-px"}},{orientation:"vertical",variant:"pill",class:{indicator:"inset-x-1",list:"items-center"}},{orientation:"vertical",variant:"link",class:{list:"border-s -ms-px",indicator:"-start-px w-px"}},{color:"primary",variant:"pill",class:{indicator:"bg-primary",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"}},{color:"secondary",variant:"pill",class:{indicator:"bg-secondary",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary"}},{color:"success",variant:"pill",class:{indicator:"bg-success",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-success"}},{color:"info",variant:"pill",class:{indicator:"bg-info",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-info"}},{color:"warning",variant:"pill",class:{indicator:"bg-warning",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-warning"}},{color:"error",variant:"pill",class:{indicator:"bg-error",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-error"}},{color:"neutral",variant:"pill",class:{indicator:"bg-inverted",trigger:"data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-inverted"}},{color:"primary",variant:"link",class:{indicator:"bg-primary",trigger:"data-[state=active]:text-primary focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary"}},{color:"secondary",variant:"link",class:{indicator:"bg-secondary",trigger:"data-[state=active]:text-secondary focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary"}},{color:"success",variant:"link",class:{indicator:"bg-success",trigger:"data-[state=active]:text-success focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-success"}},{color:"info",variant:"link",class:{indicator:"bg-info",trigger:"data-[state=active]:text-info focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-info"}},{color:"warning",variant:"link",class:{indicator:"bg-warning",trigger:"data-[state=active]:text-warning focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-warning"}},{color:"error",variant:"link",class:{indicator:"bg-error",trigger:"data-[state=active]:text-error focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-error"}},{color:"neutral",variant:"link",class:{indicator:"bg-inverted",trigger:"data-[state=active]:text-highlighted focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-inverted"}}],defaultVariants:{color:"primary",variant:"pill",size:"md"}},Q={__name:"UTabs",props:{as:{type:null,required:!1},items:{type:Array,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},orientation:{type:null,required:!1,default:"horizontal"},content:{type:Boolean,required:!1,default:!0},labelKey:{type:null,required:!1,default:"label"},class:{type:null,required:!1},ui:{type:null,required:!1},defaultValue:{type:null,required:!1,default:"0"},modelValue:{type:null,required:!1},activationMode:{type:String,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:["update:modelValue"],setup(l,{expose:w,emit:h}){const a=l,A=h,q=T(),B=$(),I=C(_(a,"as","unmountOnHide"),A),i=N(()=>p({extend:p(O),...B.ui?.tabs||{}})({color:a.color,variant:a.variant,size:a.size,orientation:a.orientation})),b=P([]);return w({triggersRef:b}),(n,U)=>(s(),o(r(L),f(r(I),{"model-value":l.modelValue,"default-value":l.defaultValue,orientation:l.orientation,"activation-mode":l.activationMode,"data-slot":"root",class:i.value.root({class:[a.ui?.root,a.class]})}),{default:d(()=>[y(r(j),{"data-slot":"list",class:c(i.value.list({class:a.ui?.list}))},{default:d(()=>[y(r(E),{"data-slot":"indicator",class:c(i.value.indicator({class:a.ui?.indicator}))},null,8,["class"]),u(n.$slots,"list-leading"),(s(!0),v(x,null,m(l.items,(e,t)=>(s(),o(r(F),{key:t,ref_for:!0,ref:V=>b.value[t]=V,value:e.value??String(t),disabled:e.disabled,"data-slot":"trigger",class:c(i.value.trigger({class:[a.ui?.trigger,e.ui?.trigger]}))},{default:d(()=>[u(n.$slots,"leading",{item:e,index:t,ui:i.value},()=>[e.icon?(s(),o(K,{key:0,name:e.icon,"data-slot":"leadingIcon",class:c(i.value.leadingIcon({class:[a.ui?.leadingIcon,e.ui?.leadingIcon]}))},null,8,["name","class"])):e.avatar?(s(),o(R,f({key:1,size:e.ui?.leadingAvatarSize||a.ui?.leadingAvatarSize||i.value.leadingAvatarSize()},{ref_for:!0},e.avatar,{"data-slot":"leadingAvatar",class:i.value.leadingAvatar({class:[a.ui?.leadingAvatar,e.ui?.leadingAvatar]})}),null,16,["size","class"])):g("",!0)]),r(z)(e,a.labelKey)||q.default?(s(),v("span",{key:0,"data-slot":"label",class:c(i.value.label({class:[a.ui?.label,e.ui?.label]}))},[u(n.$slots,"default",{item:e,index:t},()=>[k(S(r(z)(e,a.labelKey)),1)])],2)):g("",!0),u(n.$slots,"trailing",{item:e,index:t,ui:i.value},()=>[e.badge||e.badge===0?(s(),o(M,f({key:0,color:"neutral",variant:"outline",size:e.ui?.trailingBadgeSize||a.ui?.trailingBadgeSize||i.value.trailingBadgeSize()},{ref_for:!0},typeof e.badge=="string"||typeof e.badge=="number"?{label:e.badge}:e.badge,{"data-slot":"trailingBadge",class:i.value.trailingBadge({class:[a.ui?.trailingBadge,e.ui?.trailingBadge]})}),null,16,["size","class"])):g("",!0)])]),_:2},1032,["value","disabled","class"]))),128)),u(n.$slots,"list-trailing")]),_:3},8,["class"]),l.content?(s(!0),v(x,{key:0},m(l.items,(e,t)=>(s(),o(r(H),{key:t,value:e.value??String(t),"data-slot":"content",class:c(i.value.content({class:[a.ui?.content,e.ui?.content,e.class]}))},{default:d(()=>[u(n.$slots,e.slot||"content",{item:e,index:t,ui:i.value},()=>[k(S(e.content),1)])]),_:2},1032,["value","class"]))),128)):g("",!0)]),_:3},16,["model-value","default-value","orientation","activation-mode","class"]))}};export{Q as _};
@@ -1 +1 @@
1
- import{$ as h,a0 as x}from"./njnzCNrH.js";function V(a){const e=h("",1e3);return{search:e,handleTypeaheadSearch:(s,d)=>{e.value=e.value+s;{const o=x(),c=d.map(t=>({...t,textValue:t.value?.textValue??t.ref.textContent?.trim()??""})),u=c.find(t=>t.ref===o),n=c.map(t=>t.textValue),i=m(n,e.value,u?.textValue),f=c.find(t=>t.textValue===i);return f&&f.ref.focus(),f?.ref}},resetTypeahead:()=>{e.value=""}}}function p(a,e){return a.map((r,l)=>a[(e+l)%a.length])}function m(a,e,r){const s=e.length>1&&Array.from(e).every(n=>n===e[0])?e[0]:e,d=r?a.indexOf(r):-1;let o=p(a,Math.max(d,0));s.length===1&&(o=o.filter(n=>n!==r));const u=o.find(n=>n.toLowerCase().startsWith(s.toLowerCase()));return u!==r?u:void 0}export{m as g,V as u};
1
+ import{$ as h,a0 as x}from"./2dNDtTiv.js";function V(a){const e=h("",1e3);return{search:e,handleTypeaheadSearch:(s,d)=>{e.value=e.value+s;{const o=x(),c=d.map(t=>({...t,textValue:t.value?.textValue??t.ref.textContent?.trim()??""})),u=c.find(t=>t.ref===o),n=c.map(t=>t.textValue),i=m(n,e.value,u?.textValue),f=c.find(t=>t.textValue===i);return f&&f.ref.focus(),f?.ref}},resetTypeahead:()=>{e.value=""}}}function p(a,e){return a.map((r,l)=>a[(e+l)%a.length])}function m(a,e,r){const s=e.length>1&&Array.from(e).every(n=>n===e[0])?e[0]:e,d=r?a.indexOf(r):-1;let o=p(a,Math.max(d,0));s.length===1&&(o=o.filter(n=>n!==r));const u=o.find(n=>n.toLowerCase().startsWith(s.toLowerCase()));return u!==r?u:void 0}export{m as g,V as u};
@@ -1 +1 @@
1
- import{a as j,e as S,q as it,a2 as dt,G as c,R as s,ab as a,ai as U,aj as A,a9 as h,ae as k,U as p,C as o,ao as G,N as q,c as x,am as T,Q as b,S as l,a4 as w,a3 as D,bI as H,bg as ct,bl as rt,f as M,bJ as ut,ag as mt,T as n,_ as pt,W as ft,aa as g}from"./njnzCNrH.js";import{_ as _t,c as vt}from"./B5SnZL2l.js";import{_ as gt}from"./pHCJ6lhw.js";import{d as yt,_ as xt,u as ht}from"./BahXyh-A.js";import{_ as bt}from"./yJ9vRvHj.js";import{_ as kt}from"./C24so3m7.js";import{_ as wt}from"./4XnyUc7C.js";import{p as Ct}from"./eE8TtXgC.js";import{u as $t}from"./CF33v_m5.js";import{u as Ut}from"./Bkc1Hpcf.js";import{u as Tt}from"./2QHXgMyi.js";import"./Vcq4gwWv.js";import"./88opOQSr.js";import"./iik6CYzq.js";import"./Buf1PAiO.js";import"./CqkleIqs.js";import"./vES4kgx7.js";const zt={key:0,class:"space-y-1"},Bt=["onClick"],Ft=["onClick"],St={key:1,class:"text-sm text-dimmed italic"},At=j({__name:"ViewToc",props:{links:{}},setup(f){const i=S(null);function u(_){const d=document.getElementById(_);d&&d.scrollIntoView({behavior:"smooth",block:"start"})}return it(()=>{const _=document.querySelectorAll("h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]"),d=new IntersectionObserver(t=>{for(const m of t)if(m.isIntersecting){i.value=m.target.id;break}},{rootMargin:"-80px 0px -80% 0px"});_.forEach(t=>d.observe(t)),dt(()=>d.disconnect())}),(_,d)=>f.links.length?(s(),c("nav",zt,[d[0]||(d[0]=a("p",{class:"text-sm font-semibold text-muted mb-3"}," On this page ",-1)),(s(!0),c(U,null,A(f.links,t=>(s(),c(U,{key:t.id},[a("button",{type:"button",class:p(["block w-full text-left text-sm py-1 hover:text-primary transition-colors",[o(i)===t.id?"text-primary font-medium":"text-dimmed",t.depth===2&&"pl-0",t.depth===3&&"pl-4",t.depth>=4&&"pl-8"]]),onClick:m=>u(t.id)},k(t.text),11,Bt),t.children?.length?(s(!0),c(U,{key:0},A(t.children,m=>(s(),c("button",{key:m.id,type:"button",class:p(["block w-full text-left text-sm py-1 hover:text-primary transition-colors pl-4",o(i)===m.id?"text-primary font-medium":"text-dimmed"]),onClick:E=>u(m.id)},k(m.text),11,Ft))),128)):h("",!0)],64))),128))])):(s(),c("div",St," No headings found "))}}),qt=Object.assign(At,{__name:"ViewToc"}),Dt={slots:{root:"hidden overflow-y-auto lg:block lg:max-h-[calc(100vh-var(--ui-header-height))] lg:sticky lg:top-(--ui-header-height) py-8 lg:ps-4 lg:-ms-4 lg:pe-6.5",container:"relative",top:"sticky -top-8 -mt-8 pointer-events-none z-[1]",topHeader:"h-8 bg-default -mx-4 px-4",topBody:"bg-default relative pointer-events-auto flex flex-col -mx-4 px-4",topFooter:"h-8 bg-gradient-to-b from-default -mx-4 px-4"}},Et={__name:"UPageAside",props:{as:{type:null,required:!1,default:"aside"},class:{type:null,required:!1},ui:{type:null,required:!1}},setup(f){const i=f,u=G(),_=q(),d=x(()=>T({extend:T(Dt),..._.ui?.pageAside||{}})());return(t,m)=>(s(),b(o(D),{as:f.as,"data-slot":"root",class:p(d.value.root({class:[i.ui?.root,i.class]}))},{default:l(()=>[a("div",{"data-slot":"container",class:p(d.value.container({class:i.ui?.container}))},[u.top?(s(),c("div",{key:0,"data-slot":"top",class:p(d.value.top({class:i.ui?.top}))},[a("div",{"data-slot":"topHeader",class:p(d.value.topHeader({class:i.ui?.topHeader}))},null,2),a("div",{"data-slot":"topBody",class:p(d.value.topBody({class:i.ui?.topBody}))},[w(t.$slots,"top")],2),a("div",{"data-slot":"topFooter",class:p(d.value.topFooter({class:i.ui?.topFooter}))},null,2)],2)):h("",!0),w(t.$slots,"default"),w(t.$slots,"bottom")],2)]),_:3},8,["as","class"]))}},It={base:"mt-8 pb-24 space-y-12"},Pt={__name:"UPageBody",props:{as:{type:null,required:!1},class:{type:null,required:!1}},setup(f){const i=f,u=q(),_=x(()=>T({extend:T(It),...u.ui?.pageBody||{}}));return(d,t)=>(s(),b(o(D),{as:f.as,class:p(_.value({class:i.class}))},{default:l(()=>[w(d.$slots,"default")]),_:3},8,["as","class"]))}},Lt={slots:{root:"flex flex-col lg:grid lg:grid-cols-10 lg:gap-10",left:"lg:col-span-2",center:"lg:col-span-8",right:"lg:col-span-2 order-first lg:order-last"},variants:{left:{true:""},right:{true:""}},compoundVariants:[{left:!0,right:!0,class:{center:"lg:col-span-6"}},{left:!1,right:!1,class:{center:"lg:col-span-10"}}]},Nt={__name:"UPage",props:{as:{type:null,required:!1},class:{type:null,required:!1},ui:{type:null,required:!1}},setup(f){const i=f,u=G(),_=q(),d=x(()=>T({extend:T(Lt),..._.ui?.page||{}})({left:!!u.left,right:!!u.right}));return(t,m)=>(s(),b(o(D),{as:f.as,"data-slot":"root",class:p(d.value.root({class:[i.ui?.root,i.class]}))},{default:l(()=>[u.left?(s(),b(o(H),{key:0,"data-slot":"left",class:p(d.value.left({class:i.ui?.left}))},{default:l(()=>[w(t.$slots,"left")]),_:3},8,["class"])):h("",!0),a("div",{"data-slot":"center",class:p(d.value.center({class:i.ui?.center}))},[w(t.$slots,"default")],2),u.right?(s(),b(o(H),{key:1,"data-slot":"right",class:p(d.value.right({class:i.ui?.right}))},{default:l(()=>[w(t.$slots,"right")]),_:3},8,["class"])):h("",!0)]),_:3},8,["as","class"]))}},Vt=vt(gt),Ot={key:0,class:"py-24 text-center"},Rt={key:1,class:"py-24 text-center"},Ht={key:2,class:"py-24 text-center"},Mt={key:3,class:"py-24 text-center"},jt={class:"flex items-center justify-between mb-4"},Gt={class:"text-2xl font-bold"},Jt={class:"flex items-center gap-2"},Qt={class:"border border-default rounded-lg overflow-hidden"},Wt={class:"flex items-center justify-between mb-4"},Kt={class:"text-2xl font-bold"},Xt={class:"flex items-center gap-2"},Yt={class:"flex flex-wrap items-center gap-4 text-sm text-dimmed mb-6"},Zt={key:0,class:"flex items-center gap-1.5"},te={class:"flex items-center gap-1.5"},ee={key:1,class:"flex items-center gap-1.5"},oe={key:2,class:"flex items-center gap-1.5"},se={class:"flex gap-1"},ae={key:0,class:"border border-default rounded-lg overflow-hidden"},ne={class:"prose prose-primary dark:prose-invert max-w-none"},we=j({__name:"[uuid]",async setup(f){let i,u;const _=ct(),d=x(()=>_.params.uuid),{data:t,error:m,status:E}=([i,u]=rt(()=>$t(`/api/documents/${d.value}/public`,"$x-U1b672rk")),i=await i,u(),i),B=S([]);M(()=>t.value?.data?.content,async r=>{if(r)try{const e=await Ct(r);B.value=e.toc?.links||[]}catch(e){console.error("Failed to parse markdown for TOC:",e),B.value=[]}},{immediate:!0});const J=x(()=>m.value?.statusCode===404),Q=x(()=>m.value?.statusCode===403),W=x(()=>t.value?.data?.document?.fileType==="markdown"),K=x(()=>t.value?.data?.document?.fileType==="text"),X=x(()=>t.value?.data?.document?.fileType==="binary"),Y=x(()=>yt(t.value?.data?.document?.path||""));ut({title:()=>t.value?.data?.document?.title||"Document",description:"Shared document from Cognova",robots:()=>t.value?.data?.document?.shareType==="public"?"index, follow":"noindex, nofollow"});const{isAuthenticated:I}=Ut(),{viewSourceMode:P}=Tt(),C=S(P.value);M(C,r=>P.value=r);const L=mt(),{copy:Z}=ht();async function N(){const r=t.value?.data?.content;if(!r)return;await Z(r)?L.add({title:"Copied to clipboard",icon:"i-lucide-check",color:"success"}):L.add({title:"Failed to copy",icon:"i-lucide-x",color:"error"})}function V(){const r=t.value?.data?.content,e=t.value?.data?.document?.path;if(!r||!e)return;const y=e.split("/").pop()||"document.txt",v=new Blob([r],{type:"text/plain;charset=utf-8"}),z=URL.createObjectURL(v),$=document.createElement("a");$.href=z,$.download=y,$.click(),URL.revokeObjectURL(z)}function O(r){return r?new Date(r).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):""}return(r,e)=>{const y=pt,v=ft,z=Vt,$=xt,R=_t,tt=bt,et=qt,ot=Et,st=kt,at=Pt,nt=Nt,lt=wt;return s(),b(lt,{class:"py-8"},{default:l(()=>[o(J)?(s(),c("div",Ot,[n(y,{name:"i-lucide-file-x",class:"size-16 mx-auto mb-4 text-dimmed"}),e[2]||(e[2]=a("h1",{class:"text-2xl font-bold mb-2"}," Document Not Found ",-1)),e[3]||(e[3]=a("p",{class:"text-dimmed mb-6"}," This document doesn't exist or has been deleted. ",-1)),n(v,{to:"/",variant:"soft"},{default:l(()=>[...e[1]||(e[1]=[g(" Go Home ",-1)])]),_:1})])):o(Q)?(s(),c("div",Rt,[n(y,{name:"i-lucide-lock",class:"size-16 mx-auto mb-4 text-dimmed"}),e[5]||(e[5]=a("h1",{class:"text-2xl font-bold mb-2"}," Access Denied ",-1)),e[6]||(e[6]=a("p",{class:"text-dimmed mb-6"}," This document is not publicly shared. ",-1)),n(v,{to:"/login",variant:"soft"},{default:l(()=>[...e[4]||(e[4]=[g(" Sign In ",-1)])]),_:1})])):o(X)&&o(t)?.data?(s(),c("div",Ht,[n(y,{name:"i-lucide-file-warning",class:"size-16 mx-auto mb-4 text-dimmed"}),e[8]||(e[8]=a("h1",{class:"text-2xl font-bold mb-2"}," Cannot Preview This File ",-1)),e[9]||(e[9]=a("p",{class:"text-dimmed mb-6"}," Binary files cannot be previewed. ",-1)),n(v,{to:"/",variant:"soft"},{default:l(()=>[...e[7]||(e[7]=[g(" Go Home ",-1)])]),_:1})])):o(E)==="pending"?(s(),c("div",Mt,[n(y,{name:"i-lucide-loader-2",class:"size-8 mx-auto animate-spin text-dimmed"})])):o(K)&&o(t)?.data?.content?(s(),c(U,{key:4},[a("div",jt,[a("h1",Gt,k(o(t).data.document.title),1),a("div",Jt,[n(v,{icon:"i-lucide-copy",variant:"ghost",size:"sm",onClick:N},{default:l(()=>[...e[10]||(e[10]=[g(" Copy ",-1)])]),_:1}),n(v,{icon:"i-lucide-download",variant:"ghost",size:"sm",onClick:V},{default:l(()=>[...e[11]||(e[11]=[g(" Download ",-1)])]),_:1}),o(I)?(s(),b(v,{key:0,icon:"i-lucide-pencil",variant:"soft",size:"sm",to:`/docs?path=${encodeURIComponent(o(t).data.document.path)}`},{default:l(()=>[...e[12]||(e[12]=[g(" Edit ",-1)])]),_:1},8,["to"])):h("",!0)])]),a("div",Qt,[n(R,null,{fallback:l(()=>[n($,{class:"h-96"})]),default:l(()=>[n(z,{"model-value":o(t).data.content,language:o(Y),"read-only":!0,class:"max-h-[80vh]"},null,8,["model-value","language"])]),_:1})])],64)):o(W)&&o(t)?.data?.content?(s(),c(U,{key:5},[a("div",Wt,[a("h1",Kt,k(o(t).data.document.title),1),a("div",Xt,[n(v,{icon:o(C)?"i-lucide-eye":"i-lucide-code",variant:"ghost",size:"sm",onClick:e[0]||(e[0]=F=>C.value=!o(C))},{default:l(()=>[g(k(o(C)?"Preview":"Source"),1)]),_:1},8,["icon"]),n(v,{icon:"i-lucide-copy",variant:"ghost",size:"sm",onClick:N},{default:l(()=>[...e[13]||(e[13]=[g(" Copy ",-1)])]),_:1}),n(v,{icon:"i-lucide-download",variant:"ghost",size:"sm",onClick:V},{default:l(()=>[...e[14]||(e[14]=[g(" Download ",-1)])]),_:1}),o(I)?(s(),b(v,{key:0,icon:"i-lucide-pencil",variant:"soft",size:"sm",to:`/docs?path=${encodeURIComponent(o(t).data.document.path)}`},{default:l(()=>[...e[15]||(e[15]=[g(" Edit ",-1)])]),_:1},8,["to"])):h("",!0)])]),a("div",Yt,[o(t).data.document.creatorName?(s(),c("div",Zt,[n(y,{name:"i-lucide-user",class:"size-4"}),a("span",null,k(o(t).data.document.creatorName),1)])):h("",!0),a("div",te,[n(y,{name:"i-lucide-calendar",class:"size-4"}),a("span",null,k(O(o(t).data.document.createdAt)),1)]),o(t).data.document.modifiedAt?(s(),c("div",ee,[n(y,{name:"i-lucide-pencil",class:"size-4"}),a("span",null,"Updated "+k(O(o(t).data.document.modifiedAt)),1)])):h("",!0),o(t).data.document.tags?.length?(s(),c("div",oe,[n(y,{name:"i-lucide-tags",class:"size-4"}),a("div",se,[(s(!0),c(U,null,A(o(t).data.document.tags,F=>(s(),b(tt,{key:F,color:"neutral",variant:"subtle",size:"sm"},{default:l(()=>[g(k(F),1)]),_:2},1024))),128))])])):h("",!0)]),o(C)?(s(),c("div",ae,[n(R,null,{fallback:l(()=>[n($,{class:"h-96"})]),default:l(()=>[n(z,{"model-value":o(t).data.content,language:"markdown","read-only":!0,class:"max-h-[80vh]"},null,8,["model-value"])]),_:1})])):(s(),b(nt,{key:1},{left:l(()=>[n(ot,null,{default:l(()=>[n(et,{links:o(B)},null,8,["links"])]),_:1})]),default:l(()=>[n(at,null,{default:l(()=>[a("div",ne,[n(st,{value:o(t).data.content},null,8,["value"])])]),_:1})]),_:1}))],64)):h("",!0)]),_:1})}}});export{we as default};
1
+ import{a as j,e as S,q as it,a2 as dt,G as c,R as s,ab as a,aj as U,ak as A,a9 as h,ae as k,U as p,C as o,ao as G,N as q,c as x,am as T,Q as b,S as l,a4 as w,a3 as D,bI as H,bg as ct,bl as rt,f as M,bJ as ut,ag as mt,T as n,_ as pt,W as ft,aa as g}from"./2dNDtTiv.js";import{_ as _t,c as vt}from"./BHtY0l0l.js";import{_ as gt}from"./rfGRTJJW.js";import{d as yt,_ as xt,u as ht}from"./BLnYhy_t.js";import{_ as bt}from"./JbHa4oXq.js";import{_ as kt}from"./YX8avsvq.js";import{_ as wt}from"./BmVLxnDU.js";import{p as Ct}from"./BDyn4ApB.js";import{u as $t}from"./DzGy77Vr.js";import{u as Ut}from"./BKXg-alD.js";import{u as Tt}from"./CVqlefTY.js";import"./Vcq4gwWv.js";import"./88opOQSr.js";import"./iik6CYzq.js";import"./t8aDAkZ5.js";import"./CqkleIqs.js";import"./DEd2xVbS.js";const zt={key:0,class:"space-y-1"},Bt=["onClick"],Ft=["onClick"],St={key:1,class:"text-sm text-dimmed italic"},At=j({__name:"ViewToc",props:{links:{}},setup(f){const i=S(null);function u(_){const d=document.getElementById(_);d&&d.scrollIntoView({behavior:"smooth",block:"start"})}return it(()=>{const _=document.querySelectorAll("h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]"),d=new IntersectionObserver(t=>{for(const m of t)if(m.isIntersecting){i.value=m.target.id;break}},{rootMargin:"-80px 0px -80% 0px"});_.forEach(t=>d.observe(t)),dt(()=>d.disconnect())}),(_,d)=>f.links.length?(s(),c("nav",zt,[d[0]||(d[0]=a("p",{class:"text-sm font-semibold text-muted mb-3"}," On this page ",-1)),(s(!0),c(U,null,A(f.links,t=>(s(),c(U,{key:t.id},[a("button",{type:"button",class:p(["block w-full text-left text-sm py-1 hover:text-primary transition-colors",[o(i)===t.id?"text-primary font-medium":"text-dimmed",t.depth===2&&"pl-0",t.depth===3&&"pl-4",t.depth>=4&&"pl-8"]]),onClick:m=>u(t.id)},k(t.text),11,Bt),t.children?.length?(s(!0),c(U,{key:0},A(t.children,m=>(s(),c("button",{key:m.id,type:"button",class:p(["block w-full text-left text-sm py-1 hover:text-primary transition-colors pl-4",o(i)===m.id?"text-primary font-medium":"text-dimmed"]),onClick:E=>u(m.id)},k(m.text),11,Ft))),128)):h("",!0)],64))),128))])):(s(),c("div",St," No headings found "))}}),qt=Object.assign(At,{__name:"ViewToc"}),Dt={slots:{root:"hidden overflow-y-auto lg:block lg:max-h-[calc(100vh-var(--ui-header-height))] lg:sticky lg:top-(--ui-header-height) py-8 lg:ps-4 lg:-ms-4 lg:pe-6.5",container:"relative",top:"sticky -top-8 -mt-8 pointer-events-none z-[1]",topHeader:"h-8 bg-default -mx-4 px-4",topBody:"bg-default relative pointer-events-auto flex flex-col -mx-4 px-4",topFooter:"h-8 bg-gradient-to-b from-default -mx-4 px-4"}},Et={__name:"UPageAside",props:{as:{type:null,required:!1,default:"aside"},class:{type:null,required:!1},ui:{type:null,required:!1}},setup(f){const i=f,u=G(),_=q(),d=x(()=>T({extend:T(Dt),..._.ui?.pageAside||{}})());return(t,m)=>(s(),b(o(D),{as:f.as,"data-slot":"root",class:p(d.value.root({class:[i.ui?.root,i.class]}))},{default:l(()=>[a("div",{"data-slot":"container",class:p(d.value.container({class:i.ui?.container}))},[u.top?(s(),c("div",{key:0,"data-slot":"top",class:p(d.value.top({class:i.ui?.top}))},[a("div",{"data-slot":"topHeader",class:p(d.value.topHeader({class:i.ui?.topHeader}))},null,2),a("div",{"data-slot":"topBody",class:p(d.value.topBody({class:i.ui?.topBody}))},[w(t.$slots,"top")],2),a("div",{"data-slot":"topFooter",class:p(d.value.topFooter({class:i.ui?.topFooter}))},null,2)],2)):h("",!0),w(t.$slots,"default"),w(t.$slots,"bottom")],2)]),_:3},8,["as","class"]))}},It={base:"mt-8 pb-24 space-y-12"},Pt={__name:"UPageBody",props:{as:{type:null,required:!1},class:{type:null,required:!1}},setup(f){const i=f,u=q(),_=x(()=>T({extend:T(It),...u.ui?.pageBody||{}}));return(d,t)=>(s(),b(o(D),{as:f.as,class:p(_.value({class:i.class}))},{default:l(()=>[w(d.$slots,"default")]),_:3},8,["as","class"]))}},Lt={slots:{root:"flex flex-col lg:grid lg:grid-cols-10 lg:gap-10",left:"lg:col-span-2",center:"lg:col-span-8",right:"lg:col-span-2 order-first lg:order-last"},variants:{left:{true:""},right:{true:""}},compoundVariants:[{left:!0,right:!0,class:{center:"lg:col-span-6"}},{left:!1,right:!1,class:{center:"lg:col-span-10"}}]},Nt={__name:"UPage",props:{as:{type:null,required:!1},class:{type:null,required:!1},ui:{type:null,required:!1}},setup(f){const i=f,u=G(),_=q(),d=x(()=>T({extend:T(Lt),..._.ui?.page||{}})({left:!!u.left,right:!!u.right}));return(t,m)=>(s(),b(o(D),{as:f.as,"data-slot":"root",class:p(d.value.root({class:[i.ui?.root,i.class]}))},{default:l(()=>[u.left?(s(),b(o(H),{key:0,"data-slot":"left",class:p(d.value.left({class:i.ui?.left}))},{default:l(()=>[w(t.$slots,"left")]),_:3},8,["class"])):h("",!0),a("div",{"data-slot":"center",class:p(d.value.center({class:i.ui?.center}))},[w(t.$slots,"default")],2),u.right?(s(),b(o(H),{key:1,"data-slot":"right",class:p(d.value.right({class:i.ui?.right}))},{default:l(()=>[w(t.$slots,"right")]),_:3},8,["class"])):h("",!0)]),_:3},8,["as","class"]))}},Vt=vt(gt),Ot={key:0,class:"py-24 text-center"},Rt={key:1,class:"py-24 text-center"},Ht={key:2,class:"py-24 text-center"},Mt={key:3,class:"py-24 text-center"},jt={class:"flex items-center justify-between mb-4"},Gt={class:"text-2xl font-bold"},Jt={class:"flex items-center gap-2"},Qt={class:"border border-default rounded-lg overflow-hidden"},Wt={class:"flex items-center justify-between mb-4"},Kt={class:"text-2xl font-bold"},Xt={class:"flex items-center gap-2"},Yt={class:"flex flex-wrap items-center gap-4 text-sm text-dimmed mb-6"},Zt={key:0,class:"flex items-center gap-1.5"},te={class:"flex items-center gap-1.5"},ee={key:1,class:"flex items-center gap-1.5"},oe={key:2,class:"flex items-center gap-1.5"},se={class:"flex gap-1"},ae={key:0,class:"border border-default rounded-lg overflow-hidden"},ne={class:"prose prose-primary dark:prose-invert max-w-none"},we=j({__name:"[uuid]",async setup(f){let i,u;const _=ct(),d=x(()=>_.params.uuid),{data:t,error:m,status:E}=([i,u]=rt(()=>$t(`/api/documents/${d.value}/public`,"$x-U1b672rk")),i=await i,u(),i),B=S([]);M(()=>t.value?.data?.content,async r=>{if(r)try{const e=await Ct(r);B.value=e.toc?.links||[]}catch(e){console.error("Failed to parse markdown for TOC:",e),B.value=[]}},{immediate:!0});const J=x(()=>m.value?.statusCode===404),Q=x(()=>m.value?.statusCode===403),W=x(()=>t.value?.data?.document?.fileType==="markdown"),K=x(()=>t.value?.data?.document?.fileType==="text"),X=x(()=>t.value?.data?.document?.fileType==="binary"),Y=x(()=>yt(t.value?.data?.document?.path||""));ut({title:()=>t.value?.data?.document?.title||"Document",description:"Shared document from Cognova",robots:()=>t.value?.data?.document?.shareType==="public"?"index, follow":"noindex, nofollow"});const{isAuthenticated:I}=Ut(),{viewSourceMode:P}=Tt(),C=S(P.value);M(C,r=>P.value=r);const L=mt(),{copy:Z}=ht();async function N(){const r=t.value?.data?.content;if(!r)return;await Z(r)?L.add({title:"Copied to clipboard",icon:"i-lucide-check",color:"success"}):L.add({title:"Failed to copy",icon:"i-lucide-x",color:"error"})}function V(){const r=t.value?.data?.content,e=t.value?.data?.document?.path;if(!r||!e)return;const y=e.split("/").pop()||"document.txt",v=new Blob([r],{type:"text/plain;charset=utf-8"}),z=URL.createObjectURL(v),$=document.createElement("a");$.href=z,$.download=y,$.click(),URL.revokeObjectURL(z)}function O(r){return r?new Date(r).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):""}return(r,e)=>{const y=pt,v=ft,z=Vt,$=xt,R=_t,tt=bt,et=qt,ot=Et,st=kt,at=Pt,nt=Nt,lt=wt;return s(),b(lt,{class:"py-8"},{default:l(()=>[o(J)?(s(),c("div",Ot,[n(y,{name:"i-lucide-file-x",class:"size-16 mx-auto mb-4 text-dimmed"}),e[2]||(e[2]=a("h1",{class:"text-2xl font-bold mb-2"}," Document Not Found ",-1)),e[3]||(e[3]=a("p",{class:"text-dimmed mb-6"}," This document doesn't exist or has been deleted. ",-1)),n(v,{to:"/",variant:"soft"},{default:l(()=>[...e[1]||(e[1]=[g(" Go Home ",-1)])]),_:1})])):o(Q)?(s(),c("div",Rt,[n(y,{name:"i-lucide-lock",class:"size-16 mx-auto mb-4 text-dimmed"}),e[5]||(e[5]=a("h1",{class:"text-2xl font-bold mb-2"}," Access Denied ",-1)),e[6]||(e[6]=a("p",{class:"text-dimmed mb-6"}," This document is not publicly shared. ",-1)),n(v,{to:"/login",variant:"soft"},{default:l(()=>[...e[4]||(e[4]=[g(" Sign In ",-1)])]),_:1})])):o(X)&&o(t)?.data?(s(),c("div",Ht,[n(y,{name:"i-lucide-file-warning",class:"size-16 mx-auto mb-4 text-dimmed"}),e[8]||(e[8]=a("h1",{class:"text-2xl font-bold mb-2"}," Cannot Preview This File ",-1)),e[9]||(e[9]=a("p",{class:"text-dimmed mb-6"}," Binary files cannot be previewed. ",-1)),n(v,{to:"/",variant:"soft"},{default:l(()=>[...e[7]||(e[7]=[g(" Go Home ",-1)])]),_:1})])):o(E)==="pending"?(s(),c("div",Mt,[n(y,{name:"i-lucide-loader-2",class:"size-8 mx-auto animate-spin text-dimmed"})])):o(K)&&o(t)?.data?.content?(s(),c(U,{key:4},[a("div",jt,[a("h1",Gt,k(o(t).data.document.title),1),a("div",Jt,[n(v,{icon:"i-lucide-copy",variant:"ghost",size:"sm",onClick:N},{default:l(()=>[...e[10]||(e[10]=[g(" Copy ",-1)])]),_:1}),n(v,{icon:"i-lucide-download",variant:"ghost",size:"sm",onClick:V},{default:l(()=>[...e[11]||(e[11]=[g(" Download ",-1)])]),_:1}),o(I)?(s(),b(v,{key:0,icon:"i-lucide-pencil",variant:"soft",size:"sm",to:`/docs?path=${encodeURIComponent(o(t).data.document.path)}`},{default:l(()=>[...e[12]||(e[12]=[g(" Edit ",-1)])]),_:1},8,["to"])):h("",!0)])]),a("div",Qt,[n(R,null,{fallback:l(()=>[n($,{class:"h-96"})]),default:l(()=>[n(z,{"model-value":o(t).data.content,language:o(Y),"read-only":!0,class:"max-h-[80vh]"},null,8,["model-value","language"])]),_:1})])],64)):o(W)&&o(t)?.data?.content?(s(),c(U,{key:5},[a("div",Wt,[a("h1",Kt,k(o(t).data.document.title),1),a("div",Xt,[n(v,{icon:o(C)?"i-lucide-eye":"i-lucide-code",variant:"ghost",size:"sm",onClick:e[0]||(e[0]=F=>C.value=!o(C))},{default:l(()=>[g(k(o(C)?"Preview":"Source"),1)]),_:1},8,["icon"]),n(v,{icon:"i-lucide-copy",variant:"ghost",size:"sm",onClick:N},{default:l(()=>[...e[13]||(e[13]=[g(" Copy ",-1)])]),_:1}),n(v,{icon:"i-lucide-download",variant:"ghost",size:"sm",onClick:V},{default:l(()=>[...e[14]||(e[14]=[g(" Download ",-1)])]),_:1}),o(I)?(s(),b(v,{key:0,icon:"i-lucide-pencil",variant:"soft",size:"sm",to:`/docs?path=${encodeURIComponent(o(t).data.document.path)}`},{default:l(()=>[...e[15]||(e[15]=[g(" Edit ",-1)])]),_:1},8,["to"])):h("",!0)])]),a("div",Yt,[o(t).data.document.creatorName?(s(),c("div",Zt,[n(y,{name:"i-lucide-user",class:"size-4"}),a("span",null,k(o(t).data.document.creatorName),1)])):h("",!0),a("div",te,[n(y,{name:"i-lucide-calendar",class:"size-4"}),a("span",null,k(O(o(t).data.document.createdAt)),1)]),o(t).data.document.modifiedAt?(s(),c("div",ee,[n(y,{name:"i-lucide-pencil",class:"size-4"}),a("span",null,"Updated "+k(O(o(t).data.document.modifiedAt)),1)])):h("",!0),o(t).data.document.tags?.length?(s(),c("div",oe,[n(y,{name:"i-lucide-tags",class:"size-4"}),a("div",se,[(s(!0),c(U,null,A(o(t).data.document.tags,F=>(s(),b(tt,{key:F,color:"neutral",variant:"subtle",size:"sm"},{default:l(()=>[g(k(F),1)]),_:2},1024))),128))])])):h("",!0)]),o(C)?(s(),c("div",ae,[n(R,null,{fallback:l(()=>[n($,{class:"h-96"})]),default:l(()=>[n(z,{"model-value":o(t).data.content,language:"markdown","read-only":!0,class:"max-h-[80vh]"},null,8,["model-value"])]),_:1})])):(s(),b(nt,{key:1},{left:l(()=>[n(ot,null,{default:l(()=>[n(et,{links:o(B)},null,8,["links"])]),_:1})]),default:l(()=>[n(at,null,{default:l(()=>[a("div",ne,[n(st,{value:o(t).data.content},null,8,["value"])])]),_:1})]),_:1}))],64)):h("",!0)]),_:1})}}});export{we as default};
@@ -1 +1 @@
1
- import{N as t,c as o,Q as r,R as l,U as i,_ as u,am as e}from"./njnzCNrH.js";const p={base:"size-4 shrink-0 align-sub"},d={__name:"ProseIcon",props:{name:{type:String,required:!0},class:{type:null,required:!1}},setup(s){const a=s,n=t(),c=o(()=>e({extend:e(p),...n.ui?.prose?.icon||{}}));return(m,f)=>(l(),r(u,{name:s.name,class:i(c.value({class:a.class}))},null,8,["name","class"]))}};export{d as default};
1
+ import{N as t,c as o,Q as r,R as l,U as i,_ as u,am as e}from"./2dNDtTiv.js";const p={base:"size-4 shrink-0 align-sub"},d={__name:"ProseIcon",props:{name:{type:String,required:!0},class:{type:null,required:!1}},setup(s){const a=s,n=t(),c=o(()=>e({extend:e(p),...n.ui?.prose?.icon||{}}));return(m,f)=>(l(),r(u,{name:s.name,class:i(c.value({class:a.class}))},null,8,["name","class"]))}};export{d as default};