@inkeep/open-knowledge 0.50.0-beta.7 → 0.50.0-beta.8

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 (170) hide show
  1. package/dist/{acp-harness-probe-DknlAQmM.mjs → acp-harness-probe-CcFQmgX3.mjs} +2 -2
  2. package/dist/cli.mjs +18 -18
  3. package/dist/config-schema.json +6 -33
  4. package/dist/config.user.schema.json +6 -33
  5. package/dist/constants-B51mAM4l.mjs +2 -0
  6. package/dist/fs-traced-B2GMd7hO.mjs +12 -0
  7. package/dist/fs-traced-Bkh7Uqka.mjs +1 -0
  8. package/dist/{git-handle-D48CPnbp.mjs → git-handle-C_J8Il_Y.mjs} +2 -2
  9. package/dist/git-handle-k-1cd6rA.mjs +1 -0
  10. package/dist/index.d.mts +21 -48
  11. package/dist/index.mjs +170 -170
  12. package/dist/{init-LDlpt5v5.mjs → init-BBQ5oZSu.mjs} +5 -5
  13. package/dist/init-DnZMOBvW.mjs +1 -0
  14. package/dist/{launch-json-removal-BsTgc5gY.mjs → launch-json-removal-2TjcexXj.mjs} +2 -2
  15. package/dist/loader-BIpUYYKt.mjs +2 -0
  16. package/dist/loader-CyB-T8UJ.mjs +1 -0
  17. package/dist/md-manager-CmcPG20v.mjs +2 -0
  18. package/dist/{open-browser-CzSvhfe-.mjs → open-browser-BE__nPRv.mjs} +2 -2
  19. package/dist/parse-worker.mjs +1 -1
  20. package/dist/preview-D3Txy4Ba.mjs +1 -0
  21. package/dist/{preview-DfsV8cng.mjs → preview-DmCOiYiE.mjs} +2 -2
  22. package/dist/public/assets/{ActivityModeContent-c7Ng5dOt.js → ActivityModeContent-Do0P5PkB.js} +1 -1
  23. package/dist/public/assets/{AgentDiffPane-CdvdlrTA.js → AgentDiffPane-DFRVwXr-.js} +1 -1
  24. package/dist/public/assets/{AgentThreadClientBinder-CvHvukLZ.js → AgentThreadClientBinder-BO7zX8GD.js} +1 -1
  25. package/dist/public/assets/{ChangedOutsideBadge-Bu8uPTJS.js → ChangedOutsideBadge-do2_817w.js} +1 -1
  26. package/dist/public/assets/CodeMirrorPropInput-BTBqLMWS.js +3 -0
  27. package/dist/public/assets/{DocumentContext-sNpqhUlI.js → DocumentContext-B1UtgXw5.js} +10 -10
  28. package/dist/public/assets/{EditorModeToggle-D4871FSZ.js → EditorModeToggle-DsMo0oeU.js} +1 -1
  29. package/dist/public/assets/{EnableSyncConfirmDialog-cBuI6coM.js → EnableSyncConfirmDialog-BrRBeEzr.js} +1 -1
  30. package/dist/public/assets/FeedbackForm-BXQKPBhM.js +1 -0
  31. package/dist/public/assets/{GraphPanel-CAMYjjtr.js → GraphPanel-CNCFVViE.js} +2 -2
  32. package/dist/public/assets/{ImportSkillDialog-BepHDHz6.js → ImportSkillDialog-ChNKMjwJ.js} +1 -1
  33. package/dist/public/assets/{LintConfigEditor-DRA7zDJD.js → LintConfigEditor-Cg_osArr.js} +1 -1
  34. package/dist/public/assets/ManagedArtifactProperties-CBhFU95H.js +1 -0
  35. package/dist/public/assets/ManagedArtifactProperties-DmLlKjD9.js +2 -0
  36. package/dist/public/assets/{McpConsentDialogBody-ONRUf-u9.js → McpConsentDialogBody-C02gJb5g.js} +1 -1
  37. package/dist/public/assets/{MermaidDocEditor-DC95RR-G.js → MermaidDocEditor-BmIEBgEV.js} +1 -1
  38. package/dist/public/assets/{ReportBugDialogBody-7VaenClj.js → ReportBugDialogBody-CrlxwAm_.js} +1 -1
  39. package/dist/public/assets/{SchemaConfigEditor-B2VRQNhY.js → SchemaConfigEditor-BBqKhENz.js} +1 -1
  40. package/dist/public/assets/{SessionsHost-CJM2wXx0.js → SessionsHost-BQqsJZay.js} +2 -2
  41. package/dist/public/assets/SettingsDialogBody-okmHTajR.js +12 -0
  42. package/dist/public/assets/{ShareBranchSwitchDialog-DD7xybfa.js → ShareBranchSwitchDialog-BUEkE4LA.js} +1 -1
  43. package/dist/public/assets/{ShareReceiveDialog-Bz3zpKKF.js → ShareReceiveDialog-XWYS81GX.js} +1 -1
  44. package/dist/public/assets/{ShareReceiveMissDialog-DqXylco3.js → ShareReceiveMissDialog-BRiPsQxv.js} +1 -1
  45. package/dist/public/assets/{SkillEditBanner-BwzPIxd8.js → SkillEditBanner-SWeBUR9w.js} +1 -1
  46. package/dist/public/assets/{SkillOriginInline-BFCXo8sI.js → SkillOriginInline-BG4CIOQu.js} +1 -1
  47. package/dist/public/assets/{SkillToolbarControls-DF0m8f6g.js → SkillToolbarControls-CIzXYpP0.js} +1 -1
  48. package/dist/public/assets/{SlidesToolbarControls-DJXDoZdd.js → SlidesToolbarControls-qIPApX9s.js} +1 -1
  49. package/dist/public/assets/SourceEditor-D-ZojZ1R.js +1 -0
  50. package/dist/public/assets/{TerminalPanel-BlK8X0ar.js → TerminalPanel-BY_O1gj3.js} +2 -2
  51. package/dist/public/assets/{TerminalWindowApp-Cy9Ov0_z.js → TerminalWindowApp--SieYOj2.js} +1 -1
  52. package/dist/public/assets/{TextDocEditor-D3Hjb2Vu.js → TextDocEditor-CR8RlbZz.js} +1 -1
  53. package/dist/public/assets/{ThreadView-YWeuTsL5.js → ThreadView-BZQgz_OT.js} +1 -1
  54. package/dist/public/assets/{TimelineDiffPane-CGiWI4cl.js → TimelineDiffPane-CBnAmGxS.js} +1 -1
  55. package/dist/public/assets/{agent-diff-store-CEeOURzl.js → agent-diff-store-CGbJo0xm.js} +1 -1
  56. package/dist/public/assets/auth-state-cache-BrIjR7Qf.js +11 -0
  57. package/dist/public/assets/{client-version-B0MkkJjB.js → client-version-BM5nu9rX.js} +1 -1
  58. package/dist/public/assets/{comment-chips-CmSdX8nJ.js → comment-chips-uegP4pH6.js} +1 -1
  59. package/dist/public/assets/config-provider-7a2bYG1Y.js +5 -0
  60. package/dist/public/assets/{dist-Cy5lktAQ2.js → dist-D6d8jhW_2.js} +184 -184
  61. package/dist/public/assets/{doc-paths-CBKXYveW.js → doc-paths-B610Q5eD.js} +1 -1
  62. package/dist/public/assets/{documents-events-DNLLVEPR.js → documents-events-DQ-lmKb8.js} +1 -1
  63. package/dist/public/assets/{file-tree-adapter-BQ9idF-F.js → file-tree-adapter-Bmhiw8ek.js} +1 -1
  64. package/dist/public/assets/{file-tree-utils-DrTcSGTj.js → file-tree-utils-bTlUKR2h.js} +1 -1
  65. package/dist/public/assets/{folder-config-api-Cf3ca6iE.js → folder-config-api-BFi_uZNT.js} +1 -1
  66. package/dist/public/assets/{follow-file-Ctr47jtP.js → follow-file-BcVK10qo.js} +1 -1
  67. package/dist/public/assets/globals-Bq7QmnDv.css +1 -0
  68. package/dist/public/assets/i18n-CDj8TaBr.js +1 -0
  69. package/dist/public/assets/{index-DrqV8949.js → index--rSjedb-.js} +14 -14
  70. package/dist/public/assets/{lint-config-client-DzdtSJp-.js → lint-config-client-DTg6epjB.js} +1 -1
  71. package/dist/public/assets/{markdownlint-rule-browser-DMQXiRek.js → markdownlint-rule-browser-BG8UPutR.js} +1 -1
  72. package/dist/public/assets/messages-7Y8pfBz0.js +1 -0
  73. package/dist/public/assets/messages-B4sBf5fy.js +1 -0
  74. package/dist/public/assets/messages-BIEb40JZ.js +1 -0
  75. package/dist/public/assets/messages-BfLJys0I.js +1 -0
  76. package/dist/public/assets/messages-Cf6YBtq4.js +1 -0
  77. package/dist/public/assets/messages-CtiGbVvK.js +1 -0
  78. package/dist/public/assets/messages-D1QObPqW.js +1 -0
  79. package/dist/public/assets/messages-D1nlMujt.js +1 -0
  80. package/dist/public/assets/messages-Dg4RPh9k.js +1 -0
  81. package/dist/public/assets/messages-gxmuaITL.js +1 -0
  82. package/dist/public/assets/messages-mE27tR2H.js +1 -0
  83. package/dist/public/assets/navigation-targets-Ch69zMGC.js +1 -0
  84. package/dist/public/assets/{open-managed-artifact-tab-B84Y6EsP.js → open-managed-artifact-tab-CY_LAv2n.js} +1 -1
  85. package/dist/public/assets/{pending-receive-nav-store-DosIhFkt.js → pending-receive-nav-store-Bgy0uGX1.js} +1 -1
  86. package/dist/public/assets/{prop-types-BxhIEdp4.js → prop-types-C-BAUUTo.js} +1 -1
  87. package/dist/public/assets/{receive-store-DO5w93VK.js → receive-store-CbFpknqD.js} +1 -1
  88. package/dist/public/assets/{selection-context-DAl-Wxy6.js → selection-context-BzSHpc5K.js} +1 -1
  89. package/dist/public/assets/{skill-actions-1VvTttnO.js → skill-actions-CcWeYGSe.js} +2 -2
  90. package/dist/public/assets/{skill-scope-uWACL-4X.js → skill-scope-BpzNeizS.js} +1 -1
  91. package/dist/public/assets/{skills-api-S9b1zvZ6.js → skills-api-CnFnvcRc.js} +1 -1
  92. package/dist/public/assets/{src-CVA7Dtfv.js → src-CuYJwSNo.js} +2 -2
  93. package/dist/public/assets/{tag-pill-input-er0MqvFK.js → tag-pill-input-BMvx5BmV.js} +1 -1
  94. package/dist/public/assets/{target-navigation-intent-DBvgpA7l.js → target-navigation-intent-C776WObz.js} +1 -1
  95. package/dist/public/assets/{terminal-cli-display-CBMTYLbQ.js → terminal-cli-display-C7F4bitQ.js} +1 -1
  96. package/dist/public/assets/{terminal-launch-events-CbqKUJ57.js → terminal-launch-events-9H84Qwtv.js} +1 -1
  97. package/dist/public/assets/{terminal-telemetry-BRNk9k9Y.js → terminal-telemetry-CedWu1hq.js} +1 -1
  98. package/dist/public/assets/{typing-burst-detector-D114TNgO.js → typing-burst-detector-BBlqPp_d.js} +2 -2
  99. package/dist/public/assets/{uninstall-B7OIrc24.js → uninstall-BmrDQXtu.js} +1 -1
  100. package/dist/public/assets/{use-activity-panel-DnpzFXIs.js → use-activity-panel-aHDXnP43.js} +1 -1
  101. package/dist/public/assets/use-apply-config-color-theme-DA6djYET.js +1 -0
  102. package/dist/public/assets/{use-collab-url-CjkHphlr.js → use-collab-url-DCLqu1UG.js} +1 -1
  103. package/dist/public/assets/{use-live-xterm-theme-CVQrPooY.js → use-live-xterm-theme-Br4z4FVs.js} +1 -1
  104. package/dist/public/assets/{use-open-skill-DImLrKgY.js → use-open-skill-IVQ8LRcM.js} +1 -1
  105. package/dist/public/assets/{use-popular-skills-Dj_DcxJ4.js → use-popular-skills-BAuUERAB.js} +1 -1
  106. package/dist/public/assets/{use-settings-route-DEoOHvHf.js → use-settings-route-C0dQSoJu.js} +1 -1
  107. package/dist/public/assets/{use-skill-origin-Bj3wYKq2.js → use-skill-origin-Dsa-uKgK.js} +1 -1
  108. package/dist/public/assets/{use-skills-k_NyqOb0.js → use-skills-CFPPlRb6.js} +1 -1
  109. package/dist/public/assets/{use-terminal-enabled-D2ShR7ZJ.js → use-terminal-enabled-BXKMhE7B.js} +1 -1
  110. package/dist/public/assets/{use-timeline-entry-diff-CjhWQfrw.js → use-timeline-entry-diff-DBpBbxuy.js} +4 -4
  111. package/dist/public/assets/{use-workspace-D0EhHpoU.js → use-workspace-ow-NJpFl.js} +1 -1
  112. package/dist/public/index.html +57 -54
  113. package/dist/public/uninstall.html +6 -6
  114. package/dist/{repair-launch-json-B74_k_CB.mjs → repair-launch-json-Ccf7daSp.mjs} +2 -2
  115. package/dist/{repair-mcp-configs-DLcs5mOV.mjs → repair-mcp-configs-CoNwCRjc.mjs} +2 -2
  116. package/dist/{repair-skills-DUqnCrnn.mjs → repair-skills-BrOFbDSH.mjs} +2 -2
  117. package/dist/repair-skills-SUdBvS9h.mjs +1 -0
  118. package/dist/schemas/v0/config.user.schema.json +6 -33
  119. package/dist/{server-lock-V3bg8zL0.mjs → server-lock-BOsuOHaz.mjs} +2 -2
  120. package/dist/server-lock-SvEBQb4s.mjs +1 -0
  121. package/dist/{skill-teardown-BjKuJDgu.mjs → skill-teardown-D31Ah_77.mjs} +2 -2
  122. package/dist/{sleep-DVOInM4H.mjs → sleep-Dj1Ck0gp.mjs} +6 -5
  123. package/dist/src-5W71opsG.mjs +1 -0
  124. package/dist/{src-BtRlmozK.mjs → src-BvzFYC4G.mjs} +3 -3
  125. package/dist/src-D6v6esDL.mjs +2032 -0
  126. package/dist/{src-IM6msWeV.mjs → src-DS92rBYx.mjs} +131 -131
  127. package/dist/src-DqxPJWfl.mjs +1 -0
  128. package/dist/start-Bjkfv8bC.mjs +1 -0
  129. package/dist/{start-DMyot_xR.mjs → start-CCD3K5PY.mjs} +3 -3
  130. package/dist/{write-project-skill-CM5uu_kY.mjs → write-project-skill-Dpr3DYpv.mjs} +3 -3
  131. package/package.json +4 -4
  132. package/dist/constants-FqYgjf01.mjs +0 -2
  133. package/dist/fs-traced-DVpoNaQJ.mjs +0 -12
  134. package/dist/fs-traced-_QGcVmcb.mjs +0 -1
  135. package/dist/git-handle-B24ZRv9k.mjs +0 -1
  136. package/dist/init-BX4KzM5O.mjs +0 -1
  137. package/dist/loader-BJnkY5sq.mjs +0 -2
  138. package/dist/loader-sVkz35uc.mjs +0 -1
  139. package/dist/md-manager-DLcJdRDn.mjs +0 -2
  140. package/dist/preview-AblVr_fw.mjs +0 -1
  141. package/dist/public/assets/CodeMirrorPropInput-fWbdlCkS.js +0 -3
  142. package/dist/public/assets/FeedbackForm-BFd0ubqI.js +0 -1
  143. package/dist/public/assets/ManagedArtifactProperties-CLh5T0qS.js +0 -2
  144. package/dist/public/assets/ManagedArtifactProperties-Ct_XfVJo.js +0 -1
  145. package/dist/public/assets/SettingsDialogBody-LwuRFjnU.js +0 -12
  146. package/dist/public/assets/SourceEditor-CBToWgb8.js +0 -1
  147. package/dist/public/assets/auth-state-cache-kFk2nWdi.js +0 -11
  148. package/dist/public/assets/config-provider-BkvKKK43.js +0 -5
  149. package/dist/public/assets/globals-B-lWUzDu.css +0 -1
  150. package/dist/public/assets/i18n-CC8DkJXO.js +0 -1
  151. package/dist/public/assets/messages-BNq0JS1I.js +0 -1
  152. package/dist/public/assets/messages-C1QZwdEx.js +0 -1
  153. package/dist/public/assets/messages-CAevTmZQ.js +0 -1
  154. package/dist/public/assets/messages-CG-GHBB9.js +0 -1
  155. package/dist/public/assets/messages-CIxg-v3C.js +0 -1
  156. package/dist/public/assets/messages-CKi8pZ4Q.js +0 -1
  157. package/dist/public/assets/messages-Cv5HHzZF.js +0 -1
  158. package/dist/public/assets/messages-DTRz3g9F.js +0 -1
  159. package/dist/public/assets/messages-DWBpIisU.js +0 -1
  160. package/dist/public/assets/messages-XzeH2iOB.js +0 -1
  161. package/dist/public/assets/messages-bBtIkGs7.js +0 -1
  162. package/dist/public/assets/navigation-targets-Ce74CisT.js +0 -1
  163. package/dist/public/assets/use-apply-config-color-theme-DLZre1dS.js +0 -1
  164. package/dist/repair-skills-CiQl2WaL.mjs +0 -1
  165. package/dist/server-lock-Dy_yO6Nk.mjs +0 -1
  166. package/dist/src-DJld4DjV.mjs +0 -2032
  167. package/dist/src-D_WOo8A_.mjs +0 -1
  168. package/dist/src-KzlEeO27.mjs +0 -1
  169. package/dist/start-jl_w5kPf.mjs +0 -1
  170. /package/dist/public/assets/{globals-CZJtsuL5.js → globals-B8Za6o5Q.js} +0 -0
@@ -1,11 +0,0 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Dn as n,Hn as r,i,zn as a}from"./DocumentContext-sNpqhUlI.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./compiler-runtime-BfE3aGVn.js";import{a as u,o as d,r as f}from"./local-menu-action-bus-BKJCODnD.js";import{t as p}from"./utils-CPqDy6Hr.js";import{c as m,i as h,l as g}from"./ChangedOutsideBadge-Bu8uPTJS.js";import{t as _}from"./button-RQ5o7P7w.js";import{i as v,n as y,t as b}from"./tooltip-x7BNUa3s.js";import{a as x,c as S,i as C,n as w,o as T,s as E,t as D}from"./dialog-Bxcn1sLm.js";import{a as O,m as k,r as A,t as j}from"./dropdown-menu-K4eCFwQy.js";import{t as M}from"./label-BT2yjpKR.js";import{n as N,t as P}from"./radio-group-CmCnommQ.js";import{t as F}from"./switch-0kSGDL9E.js";import{n as I,t as L}from"./toggle-group-DAYvcc1F.js";import{At as R,Go as z,Mt as B,Pt as V,Uo as ee,Vt as H,jt as U,kt as W,lo as G,oo as K,ts as q,vt as te}from"./dist-Cy5lktAQ2.js";import{t as J}from"./dist-DoS8xGN6.js";import{n as ne}from"./dist-Bkx5dDHT2.js";import{d as re,o as ie,p as Y}from"./documents-events-DNLLVEPR.js";import{m as ae}from"./use-apply-config-color-theme-DLZre1dS.js";import{t as oe}from"./parse-api-error-Mgtc4OJu.js";import{t as se}from"./use-workspace-D0EhHpoU.js";import{t as X}from"./createLucideIcon-6iYxif1u.js";import{f as ce,n as le,r as ue,t as de}from"./EnableSyncConfirmDialog-cBuI6coM.js";import{s as fe}from"./Mermaid-D-pcyGRV.js";import{t as pe}from"./arrow-up-right-D_WN0VGP.js";import{t as me}from"./check-xiKupoJh.js";import{n as he}from"./CopyButton-DhHoiQJR.js";import{s as ge}from"./prop-types-BxhIEdp4.js";import{t as _e}from"./download-btG_KeFQ.js";import{a as ve,r as ye,t as be}from"./folder-config-api-Cf3ca6iE.js";import{t as xe}from"./loader-circle-BJLNGSB4.js";import{t as Se}from"./refresh-cw-CAV3aG7d.js";import{t as Ce}from"./trash-2-CSpv7np3.js";import{t as we}from"./triangle-alert-xKPljhlK.js";import{t as Te}from"./x-BopM5CF8.js";import{f as Ee,n as De,u as Oe,v as ke}from"./doc-paths-CBKXYveW.js";import{t as Ae}from"./input-VnbFvuKd.js";import{a as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./field-9eXIpxzl.js";import"./config-provider-BkvKKK43.js";import{x as Re}from"./skills-api-S9b1zvZ6.js";import{t as ze}from"./external-link-CHCx4FXC.js";import{t as Be}from"./textarea-D59GB_Zy.js";import{n as Ve,t as He}from"./clipboard-adapter-DEJxizFj.js";var Ue=X(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),We=X(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Ge=X(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),Ke=X(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),qe=X(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Je=X(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=l(),Q=e(o(),1);function Ye(e){let t=(0,Z.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return Y(()=>{o($e)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,Q.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(Ze).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:J._({id:`_ci9Bj`})});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,Q.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(Xe),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function Xe(e){return e+1}async function Ze(e){if(!e.ok){let t=await e.json().catch(Qe);throw Error(oe(t)??`HTTP ${e.status}`)}return e.json()}function Qe(){return null}function $e(e){return e+1}function et(){let e=(0,Z.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>Y(()=>{a(rt)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,Q.useEffect)(o,s);let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/templates`).then(tt).then(t=>{if(e)return;let n=H.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:J._({id:`RLNIgv`})});return}r({status:`ready`,data:n.data.templates})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let l;return e[4]===i?l=e[5]:(l=[i],e[4]=i,e[5]=l),(0,Q.useEffect)(c,l),n}async function tt(e){if(!e.ok){let t=await e.json().catch(nt);throw Error(oe(t)??`HTTP ${e.status}`)}return e.json()}function nt(){return null}function rt(e){return e+1}async function it(){try{let e=await fetch(`/api/semantic-status`);return e.ok?await e.json():(console.debug(`[semantic-status] probe returned`,e.status),null)}catch(e){return console.debug(`[semantic-status] probe failed`,e),null}}function at(e){let t=(0,Z.c)(16),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n.enabled??!0,[i,a]=(0,Q.useState)(null),o;t[2]===r?o=t[3]:(o=function(){r&&it().then(e=>{e&&a(e)})},t[2]=r,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=()=>{s()},t[4]=s,t[5]=c);let l;t[6]===r?l=t[7]:(l=[r],t[6]=r,t[7]=l),(0,Q.useEffect)(c,l);let u;t[8]!==r||t[9]!==s?(u=()=>{if(r)return re(e=>{e.includes(`files`)&&s()})},t[8]=r,t[9]=s,t[10]=u):u=t[10];let d;t[11]===r?d=t[12]:(d=[r],t[11]=r,t[12]=d),(0,Q.useEffect)(u,d);let f;return t[13]!==s||t[14]!==i?(f={status:i,refresh:s},t[13]=s,t[14]=i,t[15]=f):f=t[15],f}var $=t(),ot=`github.com`,st=new Map;async function ct(e){try{let t=await e.json(),n=te.safeParse(t);if(n.success)return n.data.title}catch{}}async function lt(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function ut(e){let t=e?.host??ot,n=await lt(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await ct(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t,a=r.ghAvailable===!0;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0,ghAvailable:a}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0,ghAvailable:a}}function dt(e){let t=e?.host??ot,n=st.get(t);if(n)return n;let r=ut(e).finally(()=>{st.delete(t)});return st.set(t,r),r}function ft(e){let t=e.split(`
2
- `);for(let e=t.length-1;e>=0;e--){let n=t[e]?.trim();if(n)try{let e=JSON.parse(n);if(e&&typeof e==`object`)return e}catch{}}return null}function pt(){return{status:dt,async repos(e){let t=e?.host??`github.com`,n=await lt(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:await ct(n)??J._({id:`sGZLfB`})};let r=ft(await n.text());if(r&&r.type===`error`&&r.problem&&typeof r.problem==`object`){let e=r.problem;return{ok:!1,error:e.detail||e.title||J._({id:`sGZLfB`})}}if(!r||!Array.isArray(r.repos))return{ok:!1,error:J._({id:`sGZLfB`})};let i=[];for(let e of r.repos){let t=e;typeof t?.full_name==`string`&&typeof t.clone_url==`string`&&i.push({full_name:t.full_name,clone_url:t.clone_url,private:t.private===!0})}return{ok:!0,host:typeof r.host==`string`?r.host:t,repos:i}},async signout(e){let t=await lt(`/api/local-op/auth/signout`,e);return t.ok?{ok:!0}:{ok:!1,error:await ct(t)}}}}function mt(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function ht(e,t){let n=e.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)return i+=r.decode(),!!(i.trim()&&t(i)===`terminal`);i+=r.decode(a,{stream:!0});let o=i.split(`
3
- `);i=o.pop()??``;for(let e of o)if(e.trim()&&t(e)===`terminal`)return!0}}function gt(e){let t=[],n=[],r=new AbortController,i=!1,a=()=>{for(let e of n.splice(0))e(null)};return e(e=>{i||(n.length>0?n.shift()?.(e):t.push(e),(e.type===`complete`||e.type===`error`)&&(i=!0,r.abort(),a()))},r.signal),{events:{[Symbol.asyncIterator](){return{async next(){if(t.length>0){let e=t.shift();return e===void 0?{value:void 0,done:!0}:{value:e,done:!1}}return i?{value:void 0,done:!0}:new Promise(e=>{n.push(t=>{e(t===null?{value:void 0,done:!0}:{value:t,done:!1})})})}}}},cancel:()=>{i||(i=!0,r.abort(),a())}}}var _t=2e3,vt=1e4;function yt(e,t){return new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n()},e);function i(){clearTimeout(r),n()}t.addEventListener(`abort`,i,{once:!0})})}function bt(e){fetch(`/api/local-op/auth/cancel`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({channel:e})}).catch(e=>{console.warn(`[auth-transport] Cancel request failed (best-effort):`,e instanceof Error?e.message:e)})}async function xt(e,t,n,r){let i=pt(),a=_t;for(;!t.aborted&&Date.now()<n;){try{let n=await i.status(r?{host:r}:void 0);if(t.aborted)return;if(n.authenticated){e({type:`complete`,host:n.host,login:n.login,name:n.name,email:n.email});return}}catch(e){console.warn(`[auth-transport] Recovery probe failed:`,e instanceof Error?e.message:e)}await yt(a,t),a=Math.min(a*1.5,vt)}t.aborted||e({type:`error`,message:J._({id:`ve8vEM`})})}function St(e,t,n){let r=!1,i=gt((n,i)=>{let a=e=>{(e.type===`complete`||e.type===`error`)&&(r=!0),n(e)};(async()=>{let n=null;try{let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:i});if(!r.ok){let e=J._({id:`LnVIW4`});try{let t=te.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}a({type:`error`,message:e});return}if(!r.body){a({type:`error`,message:J._({id:`LnVIW4`})});return}if(await ht(r.body,e=>{let t;try{t=JSON.parse(e)}catch{return console.warn(`[auth-transport] Dropped unparseable NDJSON line:`,e.slice(0,100)),`continue`}if(t&&typeof t==`object`&&t.type===`error`&&`problem`in t){let e=t.problem;return a({type:`error`,message:e?.detail||e?.title||J._({id:`29VNqC`})}),`terminal`}if(t.type===`ping`)return`continue`;let r=t;return r.type===`verification`&&(n=Date.now()+r.expires_in*1e3),a(r),r.type===`complete`||r.type===`error`?`terminal`:`continue`})||i.aborted)return;if(n===null){a({type:`error`,message:J._({id:`DskIkK`})});return}await xt(a,i,n,t.host)}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;if(n!==null){await xt(a,i,n,t.host);return}a({type:`error`,message:J._({id:`Q5fqMz`})})}})()});return{events:i.events,cancel:()=>{r||bt(n),i.cancel()}}}function Ct(){return{start(){return St(`/api/local-op/auth/login`,{json:!0},`login`)},ghLogin(e){return St(`/api/local-op/auth/gh-login`,{host:e,json:!0},`gh-login`)},async pat(e,t){try{let n=await fetch(`/api/local-op/auth/pat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({host:e,token:t})});if(n.ok){let e=await n.json();return{ok:!0,login:typeof e.login==`string`?e.login:``}}let r=J._({id:`sNeKjP`});try{let e=te.safeParse(await n.json());e.success&&(r=e.data.detail||e.data.title)}catch{}return{ok:!1,error:r}}catch{return{ok:!1,error:J._({id:`Q5fqMz`})}}}}}function wt(e){return{start(){return e.localOp.auth.start()}}}async function Tt(e){try{await navigator.clipboard.writeText(e)}catch{}}function Et(e){let t=(0,Z.c)(25),{onSuccess:n,startFlow:r}=e,{_:i}=c(),[a,o]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(`https://github.com/login/device`),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(0),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S;t[0]!==i||t[1]!==n||t[2]!==r?(S=async function(){m(null);try{let e=r();b.current=e.cancel;let t=e.events[Symbol.asyncIterator](),a=!1,s=await t.next();for(;!s.done;){let e=s.value;if(e.type===`verification`)o(e.user_code),u(e.verification_uri),g(Date.now()+e.expires_in*1e3),y(e.expires_in*1e3),Tt(e.user_code).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)});else if(e.type===`complete`){a=!0,n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){a=!0,m(e.message);break}s=await t.next()}a||m(i({id:`DskIkK`}))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&m(i({id:`Q5fqMz`}))}},t[0]=i,t[1]=n,t[2]=r,t[3]=S):S=t[3];let C=S,w;t[4]===C?w=t[5]:(w=()=>{let e=!1;return queueMicrotask(()=>{e||C()}),()=>{e=!0,b.current?.(),b.current=null,x.current&&clearInterval(x.current)}},t[4]=C,t[5]=w);let T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[6]=T):T=t[6],(0,Q.useEffect)(w,T);let E,D;t[7]!==i||t[8]!==h?(E=()=>{if(h!==null)return x.current=setInterval(()=>{let e=h-Date.now();e<=0?(y(0),x.current&&clearInterval(x.current),m(i({id:`ve8vEM`}))):y(e)},1e3),()=>{x.current&&clearInterval(x.current)}},D=[h,i],t[7]=i,t[8]=h,t[9]=E,t[10]=D):(E=t[9],D=t[10]),(0,Q.useEffect)(E,D);let O=Math.floor(v/6e4),k=Math.floor(v%6e4/1e3),A;t[11]===k?A=t[12]:(A=k.toString().padStart(2,`0`),t[11]=k,t[12]=A);let j=`${O}:${A}`,M;t[13]!==i||t[14]!==d||t[15]!==p||t[16]!==j||t[17]!==a||t[18]!==l?(M=a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`eVPynQ`,values:{verificationUri:l},components:{0:(0,$.jsx)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>ze(e,l),onAuxClick:e=>ze(e,l),className:`inline-flex items-center gap-0.5 text-foreground hover:text-primary hover:underline`}),1:(0,$.jsx)(`span`,{}),2:(0,$.jsx)(pe,{className:`inline size-3.5`,"aria-hidden":!0})}})}),(0,$.jsxs)(_,{type:`button`,variant:`outline`,"aria-label":i({id:`nCzR-G`,values:{userCode:a}}),onClick:()=>void Tt(a).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)}),className:`relative h-auto w-full justify-center rounded-md bg-muted px-12 py-3 hover:bg-muted/80`,children:[(0,$.jsx)(`code`,{className:`font-mono text-2xl font-bold tracking-widest`,children:a}),(0,$.jsx)(`span`,{className:`absolute right-3 text-muted-foreground`,"aria-hidden":`true`,children:d?(0,$.jsx)(me,{className:`size-4`}):(0,$.jsx)(he,{className:`size-4`})})]}),(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:d?(0,$.jsx)(s,{id:`80c4-P`}):null}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),(0,$.jsx)(s,{id:`5y_9lO`})]}),(0,$.jsx)(`span`,{children:(0,$.jsx)(s,{id:`gYz2ep`,values:{timeLabel:j}})})]})]}):(0,$.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:p?null:(0,$.jsx)(s,{id:`aWlJai`})}),t[13]=i,t[14]=d,t[15]=p,t[16]=j,t[17]=a,t[18]=l,t[19]=M):M=t[19];let N;t[20]===p?N=t[21]:(N=p&&(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,children:p}),t[20]=p,t[21]=N);let P;return t[22]!==M||t[23]!==N?(P=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[M,N]}),t[22]=M,t[23]=N,t[24]=P):P=t[24],P}function Dt(e){let t=(0,Z.c)(30),{login:n,name:r,onNameChange:i,email:a,onEmailChange:o}=e,{_:l}=c(),u;t[0]===n?u=t[1]:(u=(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:(0,$.jsx)(s,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=u);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`gp3I7-`})}),t[2]=d):d=t[2];let f;t[3]===l?f=t[4]:(f=l({id:`6YtxFj`}),t[3]=l,t[4]=f);let p;t[5]!==l||t[6]!==n?(p=l({id:`J2Mv98`,values:{login:n}}),t[5]=l,t[6]=n,t[7]=p):p=t[7];let m;t[8]===i?m=t[9]:(m=e=>i(e.target.value),t[8]=i,t[9]=m);let h;t[10]!==r||t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,$.jsx)(Ae,{"aria-label":f,placeholder:p,value:r,onChange:m}),t[10]=r,t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===l?g=t[16]:(g=l({id:`O3oNi5`}),t[15]=l,t[16]=g);let _;t[17]===l?_=t[18]:(_=l({id:`O3oNi5`}),t[17]=l,t[18]=_);let v;t[19]===o?v=t[20]:(v=e=>o(e.target.value),t[19]=o,t[20]=v);let y;t[21]!==a||t[22]!==g||t[23]!==_||t[24]!==v?(y=(0,$.jsx)(Ae,{type:`email`,"aria-label":g,placeholder:_,value:a,onChange:v}),t[21]=a,t[22]=g,t[23]=_,t[24]=v,t[25]=y):y=t[25];let b;return t[26]!==u||t[27]!==y||t[28]!==h?(b=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u,d,h,y]}),t[26]=u,t[27]=y,t[28]=h,t[29]=b):b=t[29],b}function Ot(e){let t=(0,Z.c)(37),{host:n,token:r,onTokenChange:i,error:a,onSubmit:o,showGhOption:l,onGhSignIn:u}=e,{_:d}=c(),f=`https://${n}/settings/tokens/new?scopes=repo,read:user&description=OpenKnowledge`,p;t[0]!==n||t[1]!==u||t[2]!==l?(p=l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_,{type:`button`,onClick:u,children:(0,$.jsx)(s,{id:`_SDGzH`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,$.jsx)(s,{id:`8L0EPw`}),(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`})]})]}):(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`8k6INX`,values:{host:n},components:{0:(0,$.jsx)(`span`,{className:`font-medium text-foreground`})}})}),t[0]=n,t[1]=u,t[2]=l,t[3]=p):p=t[3];let m,h;t[4]===f?(m=t[5],h=t[6]):(m=e=>ze(e,f),h=e=>ze(e,f),t[4]=f,t[5]=m,t[6]=h);let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(s,{id:`6hYjww`,values:{host:n}}),t[7]=n,t[8]=g);let v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(pe,{className:`inline size-3.5`,"aria-hidden":!0}),t[9]=v):v=t[9];let y;t[10]!==f||t[11]!==m||t[12]!==h||t[13]!==g?(y=(0,$.jsxs)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,onClick:m,onAuxClick:h,className:`inline-flex w-fit items-center gap-0.5 text-sm text-foreground hover:text-primary hover:underline`,children:[g,v]}),t[10]=f,t[11]=m,t[12]=h,t[13]=g,t[14]=y):y=t[14];let b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(s,{id:`Xg-Ntj`})}),t[15]=b):b=t[15];let x;t[16]===d?x=t[17]:(x=d({id:`p2LEhJ`}),t[16]=d,t[17]=x);let S;t[18]===i?S=t[19]:(S=e=>i(e.target.value),t[18]=i,t[19]=S);let C;t[20]===o?C=t[21]:(C=e=>{e.key===`Enter`&&o()},t[20]=o,t[21]=C);let w;t[22]!==C||t[23]!==x||t[24]!==S||t[25]!==r?(w=(0,$.jsx)(Ae,{type:`password`,"aria-label":x,placeholder:`ghp_`,value:r,onChange:S,onKeyDown:C}),t[22]=C,t[23]=x,t[24]=S,t[25]=r,t[26]=w):w=t[26];let T;t[27]===a?T=t[28]:(T=a&&(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,children:a}),t[27]=a,t[28]=T);let E;t[29]===l?E=t[30]:(E=!l&&(0,$.jsxs)(`div`,{className:`mt-1 rounded-md border border-border/60 bg-muted/40 p-3 text-sm text-muted-foreground`,children:[(0,$.jsx)(`p`,{children:(0,$.jsx)(s,{id:`qX-ABr`})}),(0,$.jsxs)(`ol`,{className:`mt-1.5 list-decimal space-y-0.5 pl-5`,children:[(0,$.jsx)(`li`,{children:(0,$.jsx)(s,{id:`jxtXZI`})}),(0,$.jsx)(`li`,{children:(0,$.jsx)(s,{id:`9Vh9Jf`})})]})]}),t[29]=l,t[30]=E);let D;return t[31]!==p||t[32]!==w||t[33]!==T||t[34]!==E||t[35]!==y?(D=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[p,y,b,w,T,E]}),t[31]=p,t[32]=w,t[33]=T,t[34]=E,t[35]=y,t[36]=D):D=t[36],D}var kt=1e4;function At(e){let t=(0,Z.c)(92),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:l,queryTransport:u,host:d,ghAvailable:f}=e,{_:p}=c(),m;t[0]===l?m=t[1]:(m=l??Ct(),t[0]=l,t[1]=m);let h=m,g;t[2]===u?g=t[3]:(g=u??pt(),t[2]=u,t[3]=g);let v=g,[y,b]=(0,Q.useState)(`auth`),[x,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(``),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(void 0),[V,ee]=(0,Q.useState)(void 0),H=d??z,U=!!H&&H!==`github.com`&&!!(f??V)&&typeof h.ghLogin==`function`,W=!a&&d===void 0,G,K;t[4]!==d||t[5]!==a||t[6]!==W||t[7]!==n?(G=()=>{n&&(O(null),A(``),M(``),P(``),I(null),R(!1),B(void 0),ee(void 0),b(a||W?`checking`:d&&d!==`github.com`?`pat`:`auth`))},K=[n,a,d,W],t[4]=d,t[5]=a,t[6]=W,t[7]=n,t[8]=G,t[9]=K):(G=t[8],K=t[9]),(0,Q.useLayoutEffect)(G,K);let q;t[10]!==a||t[11]!==n||t[12]!==v?(q=()=>{if(!n||!a)return;let e=!1,t=t=>{e||(e=!0,b(t))},r=setTimeout(()=>t(`auth`),kt);return v.status().then(n=>{e||(n.authenticated?(O({login:n.login,name:n.name,email:n.email}),A(n.name??``),M(n.email??``),t(`identity`)):t(`auth`))}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[10]=a,t[11]=n,t[12]=v,t[13]=q):q=t[13];let te;t[14]!==a||t[15]!==n?(te=[n,a],t[14]=a,t[15]=n,t[16]=te):te=t[16],(0,Q.useEffect)(q,te);let J;t[17]!==W||t[18]!==n||t[19]!==v?(J=()=>{if(!n||!W)return;let e=!1,t=t=>{e||(e=!0,b(t))},r=setTimeout(()=>t(`auth`),kt);return v.status().then(n=>{if(e)return;let r=!!n.host&&n.host!==`github.com`;B(n.host),ee(n.ghAvailable),t(r?`pat`:`auth`)}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[17]=W,t[18]=n,t[19]=v,t[20]=J):J=t[20];let re;t[21]!==W||t[22]!==n?(re=[n,W],t[21]=W,t[22]=n,t[23]=re):re=t[23],(0,Q.useEffect)(J,re);let ie;t[24]!==p||t[25]!==a||t[26]!==r||t[27]!==i?(ie=function(e){if(O(e),a)A(e.name??``),M(e.email??``),b(`identity`);else{b(`done`),i?.(e),r(!1);let t=e.login;ne.success(p(t?{id:`E_tNGD`,values:{login:t}}:{id:`cgl-gn`}))}},t[24]=p,t[25]=a,t[26]=r,t[27]=i,t[28]=ie):ie=t[28];let Y=ie,ae;t[29]!==p||t[30]!==H||t[31]!==Y||t[32]!==L||t[33]!==N||t[34]!==h?(ae=async function(){let e=N.trim();if(!e||!H||L)return;if(!h.pat){I(p({id:`iMYFJM`}));return}R(!0),I(null);let t=await h.pat(H,e);R(!1),t.ok?Y({login:t.login??``}):I(t.error??p({id:`sNeKjP`}))},t[29]=p,t[30]=H,t[31]=Y,t[32]=L,t[33]=N,t[34]=h,t[35]=ae):ae=t[35];let oe=ae,se;t[36]!==p||t[37]!==x||t[38]!==r||t[39]!==i?(se=function(e,t){fetch(`/api/local-op/auth/set-identity`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,email:t})}).catch(jt);let n={...x??{login:``},name:e,email:t};b(`done`),i?.(n),r(!1);let a=n.login;ne.success(p(a?{id:`E_tNGD`,values:{login:a}}:{id:`cgl-gn`}))},t[36]=p,t[37]=x,t[38]=r,t[39]=i,t[40]=se):se=t[40];let X=se,ce;t[41]!==p||t[42]!==x||t[43]!==r||t[44]!==i?(ce=function(){if(!x)return;b(`done`),i?.(x),r(!1);let e=x.login;ne.success(p(e?{id:`E_tNGD`,values:{login:e}}:{id:`cgl-gn`}))},t[41]=p,t[42]=x,t[43]=r,t[44]=i,t[45]=ce):ce=t[45];let le=ce,ue;t[46]===r?ue=t[47]:(ue=function(){r(!1)},t[46]=r,t[47]=ue);let de=ue,fe;t[48]!==a||t[49]!==o||t[50]!==y?(fe=(0,$.jsx)(E,{children:(0,$.jsx)(S,{children:o&&(y===`pat`||y===`gh-device`)?(0,$.jsx)(s,{id:`DUWgfT`}):o?(0,$.jsx)(s,{id:`X8kjQX`}):y===`pat`||y===`gh-device`?(0,$.jsx)(s,{id:`tzZ6ha`}):a&&y!==`auth`?(0,$.jsx)(s,{id:`29XZXN`}):(0,$.jsx)(s,{id:`3jod3l`})})}),t[48]=a,t[49]=o,t[50]=y,t[51]=fe):fe=t[51];let pe;t[52]===y?pe=t[53]:(pe=y===`checking`&&(0,$.jsx)(w,{children:(0,$.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`gBbxn_`})})}),t[52]=y,t[53]=pe);let me;t[54]!==Y||t[55]!==de||t[56]!==h||t[57]!==y?(me=y===`auth`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(w,{children:(0,$.jsx)(Et,{onSuccess:Y,startFlow:()=>h.start()})}),(0,$.jsx)(T,{children:(0,$.jsx)(_,{variant:`outline`,className:`font-mono uppercase`,onClick:de,children:(0,$.jsx)(s,{id:`dEgA5A`})})})]}),t[54]=Y,t[55]=de,t[56]=h,t[57]=y,t[58]=me):me=t[58];let he;t[59]!==U||t[60]!==H||t[61]!==de||t[62]!==oe||t[63]!==F||t[64]!==L||t[65]!==N||t[66]!==y?(he=y===`pat`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(w,{children:(0,$.jsx)(Ot,{host:H??``,token:N,onTokenChange:P,error:F,onSubmit:oe,showGhOption:U,onGhSignIn:()=>b(`gh-device`)})}),(0,$.jsxs)(T,{children:[(0,$.jsx)(_,{variant:`outline`,className:`font-mono uppercase`,onClick:de,children:(0,$.jsx)(s,{id:`dEgA5A`})}),(0,$.jsx)(_,{onClick:oe,disabled:!N.trim()||L,children:L?(0,$.jsx)(s,{id:`9zb2WA`}):(0,$.jsx)(s,{id:`iSLIjg`})})]})]}),t[59]=U,t[60]=H,t[61]=de,t[62]=oe,t[63]=F,t[64]=L,t[65]=N,t[66]=y,t[67]=he):he=t[67];let ge;t[68]!==H||t[69]!==Y||t[70]!==de||t[71]!==h||t[72]!==y?(ge=y===`gh-device`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(w,{children:(0,$.jsx)(Et,{onSuccess:Y,startFlow:()=>h.ghLogin?.(H??``)??h.start()})}),(0,$.jsxs)(T,{children:[(0,$.jsx)(_,{variant:`ghost`,onClick:()=>b(`pat`),children:(0,$.jsx)(s,{id:`hLKfZe`})}),(0,$.jsx)(_,{variant:`outline`,className:`font-mono uppercase`,onClick:de,children:(0,$.jsx)(s,{id:`dEgA5A`})})]})]}),t[68]=H,t[69]=Y,t[70]=de,t[71]=h,t[72]=y,t[73]=ge):ge=t[73];let _e;t[74]!==x||t[75]!==X||t[76]!==le||t[77]!==j||t[78]!==k||t[79]!==y?(_e=y===`identity`&&x&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(w,{children:(0,$.jsx)(Dt,{login:x.login,name:k,onNameChange:A,email:j,onEmailChange:M})}),(0,$.jsxs)(T,{children:[(0,$.jsx)(_,{variant:`ghost`,onClick:le,children:(0,$.jsx)(s,{id:`6Uau97`})}),(0,$.jsx)(_,{onClick:()=>X(k.trim(),j.trim()),disabled:!k.trim()||!j.trim(),children:(0,$.jsx)(s,{id:`tfDRzk`})})]})]}),t[74]=x,t[75]=X,t[76]=le,t[77]=j,t[78]=k,t[79]=y,t[80]=_e):_e=t[80];let ve;t[81]!==fe||t[82]!==pe||t[83]!==me||t[84]!==he||t[85]!==ge||t[86]!==_e?(ve=(0,$.jsxs)(C,{className:`sm:max-w-md`,children:[fe,pe,me,he,ge,_e]}),t[81]=fe,t[82]=pe,t[83]=me,t[84]=he,t[85]=ge,t[86]=_e,t[87]=ve):ve=t[87];let ye;return t[88]!==r||t[89]!==n||t[90]!==ve?(ye=(0,$.jsx)(D,{open:n,onOpenChange:r,children:ve}),t[88]=r,t[89]=n,t[90]=ve,t[91]=ye):ye=t[91],ye}function jt(){}function Mt(e){let t=(0,Z.c)(16),{value:n,onChange:r,disabled:i,placeholder:a,rows:o}=e,c=i===void 0?!1:i,l=o===void 0?12:o,u=(0,Q.useId)(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(s,{id:`3o3tur`}),t[0]=d):d=t[0];let f;t[1]===u?f=t[2]:(f=(0,$.jsx)(Pe,{htmlFor:u,children:d}),t[1]=u,t[2]=f);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(Fe,{children:(0,$.jsx)(s,{id:`5gr_ev`,values:{dateToken:`{{date}}`,userToken:`{{user}}`},components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}),t[3]=p):p=t[3];let m;t[4]===r?m=t[5]:(m=e=>r(e.target.value),t[4]=r,t[5]=m);let h;t[6]!==c||t[7]!==u||t[8]!==a||t[9]!==l||t[10]!==m||t[11]!==n?(h=(0,$.jsx)(Be,{id:u,value:n,onChange:m,disabled:c,rows:l,spellCheck:!1,placeholder:a,className:`font-mono text-xs leading-relaxed min-h-72`}),t[6]=c,t[7]=u,t[8]=a,t[9]=l,t[10]=m,t[11]=n,t[12]=h):h=t[12];let g;return t[13]!==f||t[14]!==h?(g=(0,$.jsxs)(Le,{children:[f,p,h]}),t[13]=f,t[14]=h,t[15]=g):g=t[15],g}var Nt=/^[A-Za-z0-9_-]+$/;function Pt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function Ft(e){let t={},n=e.title.trim();n&&(t.title=n);let r=e.description.trim();return r&&(t.description=r),t}var It=0;function Lt(){return It+=1,`prop-${It}`}function Rt(e){let{frontmatter:t,body:n}=K(e);if(t===``)return{type:``,properties:[],markdown:e};let r=[];for(let e of G(t).split(`
4
- `)){if(e.trim()===``)continue;let t=e.indexOf(`:`);if((/^\s/.test(e)||t===-1)&&r.length>0){let t=r[r.length-1];t&&(t.value+=`\n${e}`);continue}t!==-1&&r.push({key:e.slice(0,t).trim(),value:e.slice(t+1).replace(/^ /,``)})}let i=``,a=[];for(let e of r){if(e.key===`type`&&i===``){i=e.value.trim();continue}a.push({id:Lt(),key:e.key,value:e.value})}return{type:i,properties:a,markdown:n}}function zt(e){let t=[],n=e.type.trim();n&&t.push(`type: ${n}`);for(let n of e.properties){let e=n.key.trim();e===``||e===`type`||t.push(n.value===``?`${e}:`:`${e}: ${n.value}`)}if(t.length===0)return e.markdown.replace(/^\n+/,``);let r=e.markdown.startsWith(`
5
- `)?e.markdown:`\n${e.markdown}`;return`---\n${t.join(`
6
- `)}\n---\n${r}`}function Bt(e){let t=(0,Z.c)(54),{mode:n,folderPath:r,scope:i,initial:a,existingNames:o,onCommitted:s}=e,c=i===void 0?`local`:i,[l,u]=(0,Q.useState)(a.title),[d,f]=(0,Q.useState)(a.name),[p,m]=(0,Q.useState)(a.description),h;t[0]===a.body?h=t[1]:(h=()=>Rt(a.body),t[0]=a.body,t[1]=h);let g=(0,Q.useState)(h)[0],[_,v]=(0,Q.useState)(g.type),[y,b]=(0,Q.useState)(g.properties),[x,S]=(0,Q.useState)(g.markdown),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(!1),k;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(e,t){b(n=>n.map(n=>n.id===e?{...n,...t}:n))},t[2]=k):k=t[2];let A=k,j;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){b(Vt)},t[3]=j):j=t[3];let M=j,N;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e){b(t=>t.filter(t=>t.id!==e))},t[4]=N):N=t[4];let P=N,F;t[5]!==n||t[6]!==T?(F=function(e){u(e),n===`create`&&!T&&f(Pt(e))},t[5]=n,t[6]=T,t[7]=F):F=t[7];let I=F,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(L=function(e){f(e),E(!0)},t[8]=L):L=t[8];let R=L,z=n===`edit`&&c===`local`,B=n===`create`||z,V;t[9]===l?V=t[10]:(V=l.trim(),t[9]=l,t[10]=V);let ee=V,H,U,W,G;t[11]!==o||t[12]!==n||t[13]!==d||t[14]!==B||t[15]!==ee?(G=d.trim(),W=ee===``,H=B&&(G===``||!Nt.test(G)),U=n===`create`&&!H&&(o?.has(G)??!1),t[11]=o,t[12]=n,t[13]=d,t[14]=B,t[15]=ee,t[16]=H,t[17]=U,t[18]=W,t[19]=G):(H=t[16],U=t[17],W=t[18],G=t[19]);let K=U,q=!C&&!W&&!H,te;t[20]!==x||t[21]!==z||t[22]!==q||t[23]!==p||t[24]!==r||t[25]!==a.name||t[26]!==n||t[27]!==s||t[28]!==y||t[29]!==l||t[30]!==G||t[31]!==ee||t[32]!==_?(te=async function(){if(!q){O(!0);return}w(!0);let e=Ft({title:l,description:p}),t=zt({type:_,properties:y,markdown:x}),i=z&&G!==a.name,o=i?await ye({fromFolder:r,fromName:a.name,toFolder:r,toName:G,frontmatter:e,body:t}):await ve({folder:r,name:n===`create`?G:a.name,frontmatter:e,body:t});if(w(!1),!o.ok){let{error:e}=o;ne.error(n===`create`?J._({id:`jdGUeI`,values:{error:e}}):J._({id:`rQAQus`,values:{error:e}}));return}i?ne.success(J._({id:`YKLP_-`})):`warnings`in o&&o.warnings.length>0?ne.warning(o.warnings.join(` `)):n===`create`?ne.success(J._({id:`06SZfb`,values:{trimmedTitle:ee}})):ne.success(J._({id:`GamjcN`})),s(n===`create`||i?G:a.name)},t[20]=x,t[21]=z,t[22]=q,t[23]=p,t[24]=r,t[25]=a.name,t[26]=n,t[27]=s,t[28]=y,t[29]=l,t[30]=G,t[31]=ee,t[32]=_,t[33]=te):te=t[33];let re=te,ie;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>O(!0),t[34]=ie):ie=t[34];let Y;return t[35]!==x||t[36]!==z||t[37]!==q||t[38]!==p||t[39]!==a.name||t[40]!==n||t[41]!==y||t[42]!==C||t[43]!==I||t[44]!==d||t[45]!==H||t[46]!==K||t[47]!==re||t[48]!==l||t[49]!==W||t[50]!==D||t[51]!==G||t[52]!==_?(Y={mode:n,title:l,slug:d,description:p,type:_,properties:y,body:x,setTitle:I,setSlug:R,setDescription:m,setType:v,setProperty:A,addProperty:M,removeProperty:P,setBody:S,markTitleTouched:ie,titleTouched:D,isSaving:C,canSubmit:q,titleInvalid:W,slugInvalid:H,slugShadows:K,trimmedSlug:G,fixedName:a.name,canRename:z,submit:re},t[35]=x,t[36]=z,t[37]=q,t[38]=p,t[39]=a.name,t[40]=n,t[41]=y,t[42]=C,t[43]=I,t[44]=d,t[45]=H,t[46]=K,t[47]=re,t[48]=l,t[49]=W,t[50]=D,t[51]=G,t[52]=_,t[53]=Y):Y=t[53],Y}function Vt(e){return[...e,{id:Lt(),key:``,value:``}]}function Ht(e){let t=(0,Z.c)(72),{form:n,bodyPlaceholder:r}=e,{_:i}=c(),a=(0,Q.useId)(),o=(0,Q.useId)(),l=(0,Q.useId)(),u=n.titleTouched&&n.titleInvalid,{fixedName:d}=n,f,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(s,{id:`MHrjPM`}),p=(0,$.jsx)(`span`,{className:`text-destructive`,children:`*`}),t[0]=f,t[1]=p):(f=t[0],p=t[1]);let m;t[2]===a?m=t[3]:(m=(0,$.jsxs)(Pe,{htmlFor:a,children:[f,p]}),t[2]=a,t[3]=m);let h=n.title,g;t[4]===n?g=t[5]:(g=e=>n.setTitle(e.target.value),t[4]=n,t[5]=g);let _=n.markTitleTouched,v;t[6]===i?v=t[7]:(v=i({id:`KWL_Ih`}),t[6]=i,t[7]=v);let y;t[8]!==n.isSaving||t[9]!==n.markTitleTouched||t[10]!==n.title||t[11]!==a||t[12]!==u||t[13]!==g||t[14]!==v?(y=(0,$.jsx)(Ae,{id:a,"data-testid":`template-name-input`,value:h,onChange:g,onBlur:_,placeholder:v,disabled:n.isSaving,"aria-invalid":u}),t[8]=n.isSaving,t[9]=n.markTitleTouched,t[10]=n.title,t[11]=a,t[12]=u,t[13]=g,t[14]=v,t[15]=y):y=t[15];let b;t[16]===u?b=t[17]:(b=u?(0,$.jsx)(Me,{children:(0,$.jsx)(s,{id:`V_wltx`})}):null,t[16]=u,t[17]=b);let x;t[18]!==m||t[19]!==y||t[20]!==b?(x=(0,$.jsxs)(Le,{children:[m,y,b]}),t[18]=m,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]!==d||t[23]!==n?(S=n.mode===`create`?(0,$.jsx)(Wt,{form:n}):n.canRename?(0,$.jsx)(Gt,{form:n}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(s,{id:`NjrIak`,values:{fixedName:d},components:{0:(0,$.jsx)(`code`,{className:`font-mono`})}})}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(s,{id:`jSO1X5`})})]}),t[22]=d,t[23]=n,t[24]=S):S=t[24];let C;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(s,{id:`Nu4oKW`}),t[25]=C):C=t[25];let w;t[26]===o?w=t[27]:(w=(0,$.jsx)(Pe,{htmlFor:o,children:C}),t[26]=o,t[27]=w);let T=n.description,E;t[28]===n?E=t[29]:(E=e=>n.setDescription(e.target.value),t[28]=n,t[29]=E);let D;t[30]===i?D=t[31]:(D=i({id:`3FMvls`}),t[30]=i,t[31]=D);let O;t[32]!==o||t[33]!==n.description||t[34]!==n.isSaving||t[35]!==E||t[36]!==D?(O=(0,$.jsx)(Be,{id:o,value:T,onChange:E,placeholder:D,disabled:n.isSaving,rows:2}),t[32]=o,t[33]=n.description,t[34]=n.isSaving,t[35]=E,t[36]=D,t[37]=O):O=t[37];let k;t[38]!==w||t[39]!==O?(k=(0,$.jsxs)(Le,{children:[w,O]}),t[38]=w,t[39]=O,t[40]=k):k=t[40];let A;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(s,{id:`-zy2Nq`}),t[41]=A):A=t[41];let j;t[42]===l?j=t[43]:(j=(0,$.jsx)(Pe,{htmlFor:l,children:A}),t[42]=l,t[43]=j);let M=n.type,N;t[44]===n?N=t[45]:(N=e=>n.setType(e.target.value),t[44]=n,t[45]=N);let P;t[46]===i?P=t[47]:(P=i({id:`o9CrsQ`}),t[46]=i,t[47]=P);let F;t[48]!==n.isSaving||t[49]!==n.type||t[50]!==N||t[51]!==P||t[52]!==l?(F=(0,$.jsx)(Ae,{id:l,value:M,onChange:N,placeholder:P,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`font-mono`}),t[48]=n.isSaving,t[49]=n.type,t[50]=N,t[51]=P,t[52]=l,t[53]=F):F=t[53];let I;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(Fe,{children:(0,$.jsx)(s,{id:`ipn17C`,components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}),t[54]=I):I=t[54];let L;t[55]!==j||t[56]!==F?(L=(0,$.jsxs)(Le,{children:[j,F,I]}),t[55]=j,t[56]=F,t[57]=L):L=t[57];let R;t[58]===n?R=t[59]:(R=(0,$.jsx)(Ut,{form:n}),t[58]=n,t[59]=R);let z;t[60]!==r||t[61]!==n.body||t[62]!==n.isSaving||t[63]!==n.setBody?(z=(0,$.jsx)(Mt,{value:n.body,onChange:n.setBody,disabled:n.isSaving,placeholder:r}),t[60]=r,t[61]=n.body,t[62]=n.isSaving,t[63]=n.setBody,t[64]=z):z=t[64];let B;return t[65]!==x||t[66]!==S||t[67]!==k||t[68]!==L||t[69]!==R||t[70]!==z?(B=(0,$.jsxs)(je,{children:[x,S,k,L,R,z]}),t[65]=x,t[66]=S,t[67]=k,t[68]=L,t[69]=R,t[70]=z,t[71]=B):B=t[71],B}function Ut(e){let t=(0,Z.c)(12),{form:n}=e,{_:r}=c(),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(Pe,{children:(0,$.jsx)(s,{id:`-WFFG2`})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(Fe,{children:(0,$.jsx)(s,{id:`zrP8HX`,components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}),t[1]=a):a=t[1];let o;t[2]!==r||t[3]!==n?(o=n.properties.length>0?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.properties.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Ae,{"aria-label":r({id:`56xUL1`}),value:e.key,onChange:t=>n.setProperty(e.id,{key:t.target.value}),placeholder:r({id:`Aq-O0x`}),disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`font-mono w-1/3`}),(0,$.jsx)(Ae,{"aria-label":r({id:`iKZkk1`}),value:e.value,onChange:t=>n.setProperty(e.id,{value:t.target.value}),placeholder:r({id:`jEZ6Lf`}),disabled:n.isSaving,spellCheck:!1,className:`font-mono flex-1`}),(0,$.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":r({id:`rNifQd`}),onClick:()=>n.removeProperty(e.id),disabled:n.isSaving,children:(0,$.jsx)(Te,{"aria-hidden":`true`})})]},e.id))}):null,t[2]=r,t[3]=n,t[4]=o):o=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(s,{id:`F-NRCj`}),t[5]=l):l=t[5];let u;t[6]!==n.addProperty||t[7]!==n.isSaving?(u=(0,$.jsx)(_,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,onClick:n.addProperty,disabled:n.isSaving,children:l}),t[6]=n.addProperty,t[7]=n.isSaving,t[8]=u):u=t[8];let d;return t[9]!==o||t[10]!==u?(d=(0,$.jsxs)(Le,{children:[i,a,o,u]}),t[9]=o,t[10]=u,t[11]=d):d=t[11],d}function Wt(e){let t=(0,Z.c)(34),{form:n}=e,{_:r}=c(),i=(0,Q.useId)(),[a,o]=(0,Q.useState)(!1),l=a||n.titleTouched&&(n.slugInvalid||n.slugShadows),{slug:u,trimmedSlug:d}=n;if(!l){if(d===``)return null;let e;t[0]===u?e=t[1]:(e={slug:u},t[0]=u,t[1]=e);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,$.jsx)(`code`,{className:`font-mono`})},t[2]=r):r=t[2];let i;t[3]===e?i=t[4]:(i=(0,$.jsx)(s,{id:`Pgu10b`,values:e,components:r}),t[3]=e,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>o(!0),t[5]=a):a=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(s,{id:`ePK91l`}),t[6]=c):c=t[6];let l;t[7]===n.isSaving?l=t[8]:(l=(0,$.jsx)(_,{type:`button`,variant:`link`,className:`h-auto p-0 align-baseline text-xs font-mono uppercase`,onClick:a,disabled:n.isSaving,children:c}),t[7]=n.isSaving,t[8]=l);let f;return t[9]!==i||t[10]!==l?(f=(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[i,` `,l]}),t[9]=i,t[10]=l,t[11]=f):f=t[11],f}let f;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(s,{id:`GN6L5F`}),t[12]=f):f=t[12];let p;t[13]===i?p=t[14]:(p=(0,$.jsx)(Pe,{htmlFor:i,children:f}),t[13]=i,t[14]=p);let m;t[15]===n?m=t[16]:(m=e=>n.setSlug(e.target.value),t[15]=n,t[16]=m);let h;t[17]===r?h=t[18]:(h=r({id:`tjXez2`}),t[17]=r,t[18]=h);let g;t[19]!==n.isSaving||t[20]!==n.slugInvalid||t[21]!==u||t[22]!==i||t[23]!==m||t[24]!==h?(g=(0,$.jsx)(Ae,{id:i,value:u,onChange:m,placeholder:h,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":n.slugInvalid,className:`font-mono`}),t[19]=n.isSaving,t[20]=n.slugInvalid,t[21]=u,t[22]=i,t[23]=m,t[24]=h,t[25]=g):g=t[25];let v;t[26]!==n.slugInvalid||t[27]!==n.slugShadows||t[28]!==d?(v=n.slugInvalid?(0,$.jsx)(Me,{children:(0,$.jsx)(s,{id:`l_FAT6`,components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}):n.slugShadows?(0,$.jsx)(Fe,{className:`text-yellow-600 dark:text-yellow-500`,children:(0,$.jsx)(s,{id:`jwnpdM`,values:{trimmedSlug:d},components:{0:(0,$.jsx)(`code`,{className:`font-mono`})}})}):(0,$.jsx)(Fe,{children:(0,$.jsx)(s,{id:`TsZmgr`})}),t[26]=n.slugInvalid,t[27]=n.slugShadows,t[28]=d,t[29]=v):v=t[29];let y;return t[30]!==p||t[31]!==g||t[32]!==v?(y=(0,$.jsxs)(Le,{children:[p,g,v]}),t[30]=p,t[31]=g,t[32]=v,t[33]=y):y=t[33],y}function Gt(e){let t=(0,Z.c)(20),{form:n}=e,{_:r}=c(),i=(0,Q.useId)(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(s,{id:`GN6L5F`}),t[0]=a):a=t[0];let o;t[1]===i?o=t[2]:(o=(0,$.jsx)(Pe,{htmlFor:i,children:a}),t[1]=i,t[2]=o);let l=n.slug,u;t[3]===n?u=t[4]:(u=e=>n.setSlug(e.target.value),t[3]=n,t[4]=u);let d;t[5]===r?d=t[6]:(d=r({id:`tjXez2`}),t[5]=r,t[6]=d);let f;t[7]!==n.isSaving||t[8]!==n.slug||t[9]!==n.slugInvalid||t[10]!==i||t[11]!==u||t[12]!==d?(f=(0,$.jsx)(Ae,{id:i,value:l,onChange:u,placeholder:d,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":n.slugInvalid,className:`font-mono`}),t[7]=n.isSaving,t[8]=n.slug,t[9]=n.slugInvalid,t[10]=i,t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]===n.slugInvalid?p=t[15]:(p=n.slugInvalid?(0,$.jsx)(Me,{children:(0,$.jsx)(s,{id:`l_FAT6`,components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}):(0,$.jsx)(Fe,{children:(0,$.jsx)(s,{id:`FvMSms`})}),t[14]=n.slugInvalid,t[15]=p);let m;return t[16]!==o||t[17]!==f||t[18]!==p?(m=(0,$.jsxs)(Le,{children:[o,f,p]}),t[16]=o,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}var Kt={name:``,title:``,description:``,body:``},qt=`## Overview
7
-
8
- (Replace with the starting content for new documents.)
9
- `;function Jt(e){let t=(0,Z.c)(12),{folderPath:n,existingNames:r,open:i,onOpenChange:a,onCreated:o}=e,s;t[0]!==r||t[1]!==n||t[2]!==o||t[3]!==a||t[4]!==i?(s=i?(0,$.jsx)(Yt,{folderPath:n,existingNames:r,onOpenChange:a,onCreated:o}):null,t[0]=r,t[1]=n,t[2]=o,t[3]=a,t[4]=i,t[5]=s):s=t[5];let c;t[6]===s?c=t[7]:(c=(0,$.jsx)(C,{className:`sm:max-w-3xl max-h-[85vh] flex flex-col`,children:s}),t[6]=s,t[7]=c);let l;return t[8]!==a||t[9]!==i||t[10]!==c?(l=(0,$.jsx)(D,{open:i,onOpenChange:a,children:c}),t[8]=a,t[9]=i,t[10]=c,t[11]=l):l=t[11],l}function Yt(e){let t=(0,Z.c)(31),{folderPath:n,existingNames:r,onOpenChange:i,onCreated:a}=e,o;t[0]!==a||t[1]!==i?(o=e=>{a(e),i(!1)},t[0]=a,t[1]=i,t[2]=o):o=t[2];let c;t[3]!==r||t[4]!==n||t[5]!==o?(c={mode:`create`,folderPath:n,initial:Kt,existingNames:r,onCommitted:o},t[3]=r,t[4]=n,t[5]=o,t[6]=c):c=t[6];let l=Bt(c),u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(S,{children:(0,$.jsx)(s,{id:`G1Gw0v`})}),t[7]=u):u=t[7];let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsxs)(E,{children:[u,(0,$.jsx)(x,{children:(0,$.jsx)(s,{id:`NUr4kz`})})]}),t[8]=d):d=t[8];let f;t[9]===l?f=t[10]:(f=(0,$.jsx)(w,{children:(0,$.jsx)(Ht,{form:l,bodyPlaceholder:qt})}),t[9]=l,t[10]=f);let p;t[11]===i?p=t[12]:(p=()=>i(!1),t[11]=i,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(s,{id:`dEgA5A`}),t[13]=m):m=t[13];let h;t[14]!==l.isSaving||t[15]!==p?(h=(0,$.jsx)(_,{variant:`outline`,className:`font-mono uppercase`,onMouseDown:Xt,onClick:p,disabled:l.isSaving,children:m}),t[14]=l.isSaving,t[15]=p,t[16]=h):h=t[16];let g;t[17]===l?g=t[18]:(g=()=>void l.submit(),t[17]=l,t[18]=g);let v;t[19]===l.isSaving?v=t[20]:(v=l.isSaving?(0,$.jsx)(s,{id:`E9bKSA`}):(0,$.jsx)(s,{id:`A5hiCy`}),t[19]=l.isSaving,t[20]=v);let y;t[21]!==l.isSaving||t[22]!==v||t[23]!==g?(y=(0,$.jsx)(_,{onClick:g,disabled:l.isSaving,children:v}),t[21]=l.isSaving,t[22]=v,t[23]=g,t[24]=y):y=t[24];let b;t[25]!==y||t[26]!==h?(b=(0,$.jsxs)(T,{children:[h,y]}),t[25]=y,t[26]=h,t[27]=b):b=t[27];let C;return t[28]!==b||t[29]!==f?(C=(0,$.jsxs)($.Fragment,{children:[d,f,b]}),t[28]=b,t[29]=f,t[30]=C):C=t[30],C}function Xt(e){return e.preventDefault()}function Zt(e){let t=(0,Z.c)(16),{template:n,onOpenChange:r,onDeleted:i}=e,{_:a}=c(),[o,s]=(0,Q.useState)(!1),l;t[0]!==a||t[1]!==i||t[2]!==r?(l=async function(e){s(!0);let t=await be(e.source_folder,e.name);if(s(!1),!t.ok){let{error:e}=t;ne.error(a({id:`36WXSC`,values:{error:e}}));return}let n=e.title??e.name;ne.success(a({id:`ErRi6L`,values:{label:n}})),i(),r(!1)},t[0]=a,t[1]=i,t[2]=r,t[3]=l):l=t[3];let u=l,d=n!==null,f;t[4]!==o||t[5]!==r?(f=e=>{!e&&!o&&r(!1)},t[4]=o,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==a||t[8]!==o||t[9]!==u||t[10]!==n?(p=n?(()=>{let{name:e,path:t,scope:r}=n,i=r===`inherited`?`\n\n${a({id:`8uAWix`})}`:``;return(0,$.jsx)(h,{itemName:a({id:`XfzqjK`,values:{name:e}}),isSubmitting:o,onDelete:()=>u(n),customDescription:`${a({id:`5LXwX8`,values:{path:t}})}${i}`})})():null,t[7]=a,t[8]=o,t[9]=u,t[10]=n,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,$.jsx)(D,{open:d,onOpenChange:f,children:p}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function Qt(e){let t=(0,Z.c)(45),{template:r,onEdit:i,onDelete:a,onCreate:o,badge:l}=e,{_:u}=c(),d=r.title??r.name,f=!!(r.title&&r.title!==r.name),p;t[0]===d?p=t[1]:(p=(0,$.jsx)(`span`,{className:`truncate font-medium`,children:d}),t[0]=d,t[1]=p);let h;t[2]!==f||t[3]!==r.name?(h=f?(0,$.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:r.name}):null,t[2]=f,t[3]=r.name,t[4]=h):h=t[4];let v;t[5]===l?v=t[6]:(v=l?(0,$.jsx)(`span`,{className:`ml-auto shrink-0`,children:l}):null,t[5]=l,t[6]=v);let y;t[7]!==p||t[8]!==h||t[9]!==v?(y=(0,$.jsxs)(`span`,{className:`flex w-full items-center gap-2`,children:[p,h,v]}),t[7]=p,t[8]=h,t[9]=v,t[10]=y):y=t[10];let b;t[11]===r.description?b=t[12]:(b=r.description?(0,$.jsx)(`span`,{className:`w-full truncate text-sm text-muted-foreground`,children:r.description}):null,t[11]=r.description,t[12]=b);let x;t[13]!==i||t[14]!==y||t[15]!==b?(x=(0,$.jsxs)(_,{type:`button`,variant:`ghost`,onClick:i,className:`h-auto min-w-0 flex-1 flex-col items-start gap-0.5 px-1.5 py-1 text-left font-normal hover:bg-transparent`,children:[y,b]}),t[13]=i,t[14]=y,t[15]=b,t[16]=x):x=t[16];let S;t[17]!==u||t[18]!==d||t[19]!==o?(S=o?(0,$.jsxs)(_,{type:`button`,variant:`ghost`,size:`sm`,className:`shrink-0 font-mono uppercase opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:o,"aria-label":u({id:`mZ1r4i`,values:{label:d}}),children:[(0,$.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(s,{id:`hYgDIe`})]}):null,t[17]=u,t[18]=d,t[19]=o,t[20]=S):S=t[20];let C;t[21]!==u||t[22]!==d?(C=u({id:`Bx4EXG`,values:{label:d}}),t[21]=u,t[22]=d,t[23]=C):C=t[23];let w;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(_,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,"aria-label":C,children:w})}),t[25]=C,t[26]=T);let E,D;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(n,{"aria-hidden":!0}),D=(0,$.jsx)(s,{id:`ePK91l`}),t[27]=E,t[28]=D):(E=t[27],D=t[28]);let M;t[29]===i?M=t[30]:(M=(0,$.jsxs)(O,{onSelect:i,children:[E,D]}),t[29]=i,t[30]=M);let N,P;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(Ce,{"aria-hidden":!0}),P=(0,$.jsx)(s,{id:`cnGeoo`}),t[31]=N,t[32]=P):(N=t[31],P=t[32]);let F;t[33]===a?F=t[34]:(F=(0,$.jsxs)(O,{variant:`destructive`,onSelect:a,children:[N,P]}),t[33]=a,t[34]=F);let I;t[35]!==M||t[36]!==F?(I=(0,$.jsxs)(A,{align:`end`,className:`min-w-52`,children:[M,F]}),t[35]=M,t[36]=F,t[37]=I):I=t[37];let L;t[38]!==T||t[39]!==I?(L=(0,$.jsxs)(j,{modal:!1,children:[T,I]}),t[38]=T,t[39]=I,t[40]=L):L=t[40];let R;return t[41]!==L||t[42]!==x||t[43]!==S?(R=(0,$.jsxs)(`li`,{className:`group flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-muted/50`,children:[x,S,L]}),t[41]=L,t[42]=x,t[43]=S,t[44]=R):R=t[44],R}function $t(){let e=(0,Z.c)(8),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(0),[o,s]=(0,Q.useState)(!1),c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/skill-targets`).then(tn).then(t=>{if(e)return;let n=V.safeParse(t);if(!n.success){console.error(`[ok-skills] /api/skill-targets response failed schema validation:`,n.error.issues),r({status:`error`,message:J._({id:`PXaT32`})});return}r({status:`ready`,data:n.data})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[1]=c):c=e[1];let l;e[2]===i?l=e[3]:(l=[i],e[2]=i,e[3]=l),(0,Q.useEffect)(c,l);let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=async e=>{s(!0);let t=await Re(e);if(!t.ok)throw s(!1),Error(t.error);ie(),a(en),s(!1)},e[4]=u):u=e[4];let d=u,f;return e[5]!==o||e[6]!==n?(f={state:n,saving:o,folderAction:d},e[5]=o,e[6]=n,e[7]=f):f=e[7],f}function en(e){return e+1}async function tn(e){if(!e.ok){let t=await e.json().catch(nn);throw Error(oe(t)??`HTTP ${e.status}`)}return e.json()}function nn(){return null}var rn=`claude-cowork`,an=`ok:skill:cowork:installed:v`,on=250,sn=`/api/skill/install-state`,cn=null,ln=new Set,un=null,dn=!1,fn=()=>{wn(Mn())},pn=e=>{e.key?.startsWith(an)&&wn(Mn())};function mn(){dn||typeof window>`u`||(window.addEventListener(`focus`,fn),window.addEventListener(`storage`,pn),dn=!0)}function hn(){dn&&(typeof window>`u`||(window.removeEventListener(`focus`,fn),window.removeEventListener(`storage`,pn),dn=!1))}var gn=!1,_n=!1,vn=!1,yn=!1,bn=!1,xn=!1,Sn=!1;async function Cn(e){let t=!0;if(e.detectClaudeDesktop)try{t=await e.detectClaudeDesktop()}catch(e){t=!0,gn||(gn=!0,console.warn(`[claude-desktop-integration] detectClaudeDesktop IPC rejected — falling back to desktopPresent=true`,e))}let n=await e.fetchSnapshot();if(n){let e=n.targets?.[rn]??null;return e?.version?{desktopPresent:t,skillInstalled:!0,skillVersion:e.version}:{desktopPresent:t,skillInstalled:!1,skillVersion:null}}let r=e.readLocalStorageGuard();return{desktopPresent:t,skillInstalled:r.skillInstalled,skillVersion:r.skillVersion}}async function wn(e){return un||(un=(async()=>{try{cn=await Cn(e);for(let e of ln)try{e()}catch(e){console.error(`[claude-desktop-integration] subscriber threw`,e)}}catch(e){console.error(`[claude-desktop-integration] probe rejected unexpectedly`,e)}finally{un=null}})(),un)}function Tn(e){return ln.size===0&&mn(),ln.add(e),()=>{ln.delete(e),ln.size===0&&hn()}}function En(){return cn}function Dn(){if(typeof window>`u`)return;let e=window.okDesktop?.skill,t=e?.detectClaudeDesktop;if(t)return()=>t.call(e)}function On(e){let t=e?.timeoutMs??on,n=e?.fetchImpl??(typeof fetch<`u`?fetch:void 0);return async()=>{if(!n)return null;let e;try{let r=new AbortController,i=setTimeout(()=>r.abort(),t);try{e=await n(sn,{method:`GET`,cache:`no-store`,signal:r.signal})}finally{clearTimeout(i)}}catch(e){let n=e instanceof DOMException&&e.name===`AbortError`;return n&&!vn?(vn=!0,console.warn(`[claude-desktop-integration] fetch ${sn} timed out (>${t}ms) — falling back to localStorage guard`)):!n&&!_n&&(_n=!0,console.warn(`[claude-desktop-integration] fetch ${sn} failed — falling back to localStorage guard`,e)),null}if(!e.ok)return yn||(yn=!0,console.warn(`[claude-desktop-integration] ${sn} returned ${e.status} ${e.statusText} — falling back to localStorage guard`)),null;let r;try{r=await e.json()}catch(e){return bn||(bn=!0,console.warn(`[claude-desktop-integration] ${sn} returned unparseable JSON — falling back to localStorage guard`,e)),null}return kn(r)}}function kn(e){if(typeof e!=`object`||!e)return An(`not an object`);let t=e;if(typeof t.currentVersion!=`string`||t.currentVersion===``)return An(`currentVersion not a non-empty string`);if(t.targets!==void 0){if(t.targets===null||typeof t.targets!=`object`)return An(`targets not object`);for(let[,e]of Object.entries(t.targets)){if(e==null)continue;if(typeof e!=`object`)return An(`target entry not object`);let t=e;if(typeof t.version!=`string`||t.version===``)return An(`target.version not a non-empty string`)}}return t}function An(e){return xn||(xn=!0,console.warn(`[claude-desktop-integration] ${sn} response failed shape validation (${e}) — falling back to localStorage guard`)),null}function jn(){if(typeof localStorage>`u`)return{skillInstalled:!1,skillVersion:null};try{for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);if(t?.startsWith(an))return{skillInstalled:!0,skillVersion:t.slice(27)}}}catch(e){Sn||(Sn=!0,console.warn(`[claude-desktop-integration] localStorage scan threw — falling back to skillInstalled=false`,e))}return{skillInstalled:!1,skillVersion:null}}function Mn(){return{detectClaudeDesktop:Dn(),fetchSnapshot:On(),readLocalStorageGuard:jn}}function Nn(){let e=(0,Z.c)(5),t=(0,Q.useSyncExternalStore)(Tn,En,En),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],e[0]=n):n=e[0],(0,Q.useEffect)(Fn,n);let r=t?.desktopPresent??!0,i=t?.skillInstalled??!1,a=t?.skillVersion??null,o;return e[1]!==r||e[2]!==i||e[3]!==a?(o={desktopPresent:r,skillInstalled:i,skillVersion:a,refresh:Pn},e[1]=r,e[2]=i,e[3]=a,e[4]=o):o=e[4],o}function Pn(){wn(Mn())}function Fn(){cn||wn(Mn())}var In=[{path:[`appearance`,`theme`],label:{id:`FEr96N`},description:{id:`JZ8cO6`},control:`enum-toggle`},{path:[`appearance`,`language`],label:{id:`vXIe7J`},description:{id:`gUx34c`},control:`language-select`},{path:[`editor`,`wordWrap`],label:{id:`iKSP5j`},description:{id:`mmpzAq`}},{path:[`editor`,`previewTabs`],label:{id:`drzzZw`},description:{id:`AIC67-`}},{path:[`appearance`,`preview`,`autoOpen`],label:{id:`2XQ8Ww`},description:{id:`bultyE`}},{path:[`telemetry`,`skillInstallReports`,`enabled`],label:{id:`2jUGEP`},description:{id:`Ns0z5o`}}],Ln=[{path:[`appearance`,`colorThemeLight`],label:{id:`rFmBG3`},description:{id:`mnpsVn`},control:`theme-tiles`}],Rn=[{sectionId:`preferences`,fields:In},{sectionId:`plugin:theme`,fields:Ln}];async function zn(){try{let e=await fetch(`/api/sync/conflicts`);return e.ok?{conflicts:(await e.json()).conflicts??[]}:(console.warn(JSON.stringify({event:`conflicts-fetch-failed`,status:e.status})),{conflicts:[],error:`server`})}catch(e){return console.warn(JSON.stringify({event:`conflicts-fetch-failed`,status:null,detail:e instanceof Error?e.message:String(e)})),{conflicts:[],error:`network`}}}function Bn(){let e=(0,Z.c)(10),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(0),l;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=function(){let e=c.current+=1;zn().then(t=>{let{conflicts:n,error:i}=t;e===c.current&&(r(n),s(i??null),a(!1))})},e[1]=l):l=e[1];let u=l,d,f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{u()},f=[],e[2]=d,e[3]=f):(d=e[2],f=e[3]),(0,Q.useEffect)(d,f);let p,m;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>re(e=>{e.includes(`sync-status`)&&u()}),m=[],e[4]=p,e[5]=m):(p=e[4],m=e[5]),(0,Q.useEffect)(p,m);let h;return e[6]!==n||e[7]!==o||e[8]!==i?(h={conflicts:n,loading:i,error:o},e[6]=n,e[7]=o,e[8]=i,e[9]=h):h=e[9],h}function Vn(e){if(!e)return``;let t=e.replace(/[/\\]+$/g,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?t:t.slice(n+1)}function Hn(e){let t=e.trim();return t.length===0?{kind:`blank`,raw:e}:t.startsWith(`#`)?{kind:`comment`,raw:e}:{kind:`pattern`,raw:e,text:t}}function Un(e){return{lines:e.split(`
10
- `).map(Hn)}}function Wn(e){return e.lines.map(e=>e.raw).join(`
11
- `)}function Gn(e){return e.lines.filter(e=>e.kind===`pattern`)}function Kn(e,t){let n=t.trim();if(n.length===0)return e;for(let t of e.lines)if(t.kind===`pattern`&&t.text===n)return e;let r={kind:`pattern`,raw:n,text:n},i=e.lines.slice(),a=i[i.length-1];return a&&a.kind===`blank`&&a.raw===``?i.splice(i.length-1,0,r):i.push(r,{kind:`blank`,raw:``}),{lines:i}}function qn(e,t){let n=t.trim();if(n.length===0)return-1;let r=0;for(let t of e.lines)if(t.kind===`pattern`){if(t.text===n)return r;r++}return-1}function Jn(e,t,n){let r=n.trim();if(r.length===0)return Yn(e,t);let i=Zn(e,t);if(i<0)return e;let a=e.lines.slice();return a[i]={kind:`pattern`,raw:r,text:r},{lines:a}}function Yn(e,t){let n=Zn(e,t);if(n<0)return e;let r=e.lines.slice();return r.splice(n,1),{lines:r}}function Xn(e,t,n){if(t===n)return e;let r=[],i=[];if(e.lines.forEach((e,t)=>{e.kind===`pattern`&&(r.push(t),i.push(e))}),t<0||t>=i.length||n<0||n>=i.length)return e;let a=i.slice(),[o]=a.splice(t,1);if(!o)return e;a.splice(n,0,o);let s=e.lines.slice();return r.forEach((e,t)=>{let n=a[t];n&&(s[e]=n)}),{lines:s}}function Zn(e,t){if(t<0)return-1;let n=0;for(let r=0;r<e.lines.length;r++)if(e.lines[r]?.kind===`pattern`){if(n===t)return r;n++}return-1}var Qn=`/api/share/construct-url`;function $n(e){return{kind:`doc`,docName:e}}function er(e){return{kind:`folder`,folderRelativePath:e}}async function tr(e,t=fetch){let n=await t(Qn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(`construct-url transport ${n.status}`);let r=await n.json(),i=W.safeParse(r);if(!i.success)throw Error(`construct-url response shape mismatch`);return i.data}function nr(e,t){switch(e){case`detached-head`:return J._({id:`jLOL1H`});case`branch-not-on-origin`:return t?J._({id:`x-fZxg`,values:{branch:t}}):J._({id:`ZGVsOD`});case`non-github-remote`:return J._({id:`V4JHny`});case`invalid-path`:return J._({id:`0pZmTP`});case`no-remote`:return J._({id:`pA16WG`})}}async function rr(e,t){if(!e.hasRemote)return e.onClickWhenNoRemote(),{kind:`opened-wizard`};let n=e.kind===`folder`?{kind:`folder`,folderPath:e.folderRelativePath}:{kind:`doc`,docPath:De(e.docName)},r;try{r=await tr(n,t.fetchFn)}catch{return t.toastError(J._({id:`u3YnKw`}),`transport`),{kind:`transport-error`}}if(r.ok){try{await t.clipboardWrite(r.shareUrl)}catch{return t.toastError(J._({id:`E_A2Nq`}),`clipboard`),t.logEvent(`[share] action=link-construct result=clipboard-failed`),{kind:`clipboard-failed`,shareUrl:r.shareUrl,freshness:r.freshness}}return t.toastSuccess(e.kind===`folder`?J._({id:`xcGVzH`}):J._({id:`c1LZZH`})),t.logEvent(`[share] action=link-construct`),{kind:`copied`,shareUrl:r.shareUrl,branch:r.branch,freshness:r.freshness}}if(r.error===`no-remote`)return e.onClickWhenNoRemote(),{kind:`opened-wizard`};let i=r.branch;return t.toastError(nr(r.error,i),`business`),{kind:`business-error`,error:r.error,branch:i}}var ir=`/api/share/publish/owners`,ar=`/api/share/publish/name-check`,or=`/api/share/publish`,sr=/[A-Za-z0-9._-]/g;function cr(e){return(e.match(sr)?.join(``)??``).replace(/[-.]{2,}/g,e=>e[0]??`-`).replace(/^[-.]+/,``).replace(/[-.]+$/,``)}function lr(e){return e.find(e=>e.kind===`org`)?.login??e[0]?.login??``}function ur(e){return`https://github.com/orgs/${encodeURIComponent(e)}/policies/applications`}function dr(e,t,n){switch(e){case`name-conflict`:return{banner:J._({id:`n81AV0`,values:{owner:t,name:n}}),next:{kind:`edit-name`}};case`saml-sso`:return{banner:J._({id:`gLCE2c`,values:{owner:t}}),next:{kind:`authorize-org`,authorizeUrl:ur(t)}};case`push-failed`:return{banner:J._({id:`7Y9yTo`,values:{owner:t,name:n}}),next:{kind:`retry-push`}};case`auth-required`:return{banner:J._({id:`UGtPix`}),next:{kind:`reauth`}};case`init-failed`:return{banner:J._({id:`kGp168`}),next:{kind:`edit-form`}};case`network`:return{banner:J._({id:`UVLlMV`}),next:{kind:`edit-form`}};case`no-project`:return{banner:J._({id:`S6eHlw`}),next:{kind:`edit-form`}}}}async function fr(e=fetch){let t=await e(ir,{method:`GET`});if(!t.ok)throw Error(`owners transport ${t.status}`);let n=await t.json(),r=U.safeParse(n);if(!r.success)throw Error(`owners response shape mismatch`);return r.data}async function pr(e,t,n=fetch){let r=await n(`${ar}?owner=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`,{method:`GET`});if(!r.ok)throw Error(`name-check transport ${r.status}`);let i=await r.json(),a=R.safeParse(i);if(!a.success)throw Error(`name-check response shape mismatch`);return a.data}async function mr(e,t=fetch){let n=await t(or,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(`publish transport ${n.status}`);let r=await n.json(),i=B.safeParse(r);if(!i.success)throw Error(`publish response shape mismatch`);return i.data}function hr(e,t,n){return e.ok?e.available?{kind:`available`}:{kind:`taken`,owner:t,name:n}:e.error===`auth-required`?{kind:`error`,banner:J._({id:`UGtPix`})}:{kind:`error`,banner:J._({id:`UVLlMV`})}}function gr(e){return e.submitting||e.owner===null||e.sanitizedName.length===0?!1:e.nameCheck.kind===`available`}var _r=500;function vr(e){let t=(0,Z.c)(69),{open:n,onOpenChange:r}=e,{_:a}=c(),o=se(),{activeDocName:l}=i(),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(`private`),[A,j]=(0,Q.useState)(``),F;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(F={kind:`idle`},t[0]=F):F=t[0];let[I,L]=(0,Q.useState)(F),[R,z]=(0,Q.useState)(!1),[B,V]=(0,Q.useState)(null),[ee,H]=(0,Q.useState)(!1),[U,W]=(0,Q.useState)(null),[G,K]=(0,Q.useState)(!1),[q,te]=(0,Q.useState)(null),[J,re]=(0,Q.useState)(null),ie=(0,Q.useRef)(null),Y=(0,Q.useRef)(null),ae=(0,Q.useRef)(null),oe;t[1]===y?oe=t[2]:(oe=cr(y),t[1]=y,t[2]=oe);let X=oe,ce=u?.find(e=>e.login===g)??null,le;t[3]!==a||t[4]!==g?(le=async function(){p(!0),h(null);try{let e=await fr();if(!e.ok){e.error===`auth-required`?(H(!0),h(a({id:`6cyguR`}))):h(a({id:`UVLlMV`})),p(!1);return}d(e.owners),e.owners.length>0&&g===``&&v(lr(e.owners))}catch{h(a({id:`UVLlMV`}))}p(!1)},t[3]=a,t[4]=g,t[5]=le):le=t[5];let ue=le,de;t[6]!==ue||t[7]!==n||t[8]!==u||t[9]!==g||t[10]!==o?.contentDir?(de=()=>{n&&(L({kind:`idle`}),V(null),z(!1),h(null),W(null),K(!1),te(null),re(null),b(cr(Vn(o?.contentDir??``))),k(`private`),j(``),u===null?ue():g===``&&u.length>0&&v(lr(u)))},t[6]=ue,t[7]=n,t[8]=u,t[9]=g,t[10]=o?.contentDir,t[11]=de):de=t[11];let fe;t[12]===n?fe=t[13]:(fe=[n],t[12]=n,t[13]=fe),(0,Q.useEffect)(de,fe);let pe,me;t[14]!==a||t[15]!==n||t[16]!==X||t[17]!==g?(pe=()=>{if(n){if(ie.current!==null&&clearTimeout(ie.current),g===``||X===``){L({kind:`idle`});return}return L({kind:`pending`}),ie.current=setTimeout(async()=>{let e=g,t=X;Y.current=`${e}|${t}`,L({kind:`checking`});try{let n=await pr(e,t);if(Y.current!==`${e}|${t}`)return;L(hr(n,e,t))}catch{if(Y.current!==`${e}|${t}`)return;L({kind:`error`,banner:a({id:`UVLlMV`})})}},_r),()=>{ie.current!==null&&(clearTimeout(ie.current),ie.current=null)}}},me=[n,g,X,a],t[14]=a,t[15]=n,t[16]=X,t[17]=g,t[18]=pe,t[19]=me):(pe=t[18],me=t[19]),(0,Q.useEffect)(pe,me);let he,ge;t[20]!==a||t[21]!==l||t[22]!==U?(he=()=>{if(!U||!l)return;let e=!1;return(async()=>{try{let t=await tr({kind:`doc`,docPath:De(l)});if(e)return;t.ok?te(t.shareUrl):re(nr(t.error,t.branch))}catch(t){let n=t;if(e)return;console.warn(`[share] action=prefetch-share-url result=failed`,n),re(a({id:`J6N5MX`}))}})(),()=>{e=!0}},ge=[U,l,a],t[20]=a,t[21]=l,t[22]=U,t[23]=he,t[24]=ge):(he=t[23],ge=t[24]),(0,Q.useEffect)(he,ge);let _e;t[25]===ue?_e=t[26]:(_e=function(){H(!1),h(null),ue()},t[25]=ue,t[26]=_e);let ve=_e,ye=async function(){if(gr({owner:ce,sanitizedName:X,nameCheck:I,submitting:R})){z(!0),V(null);try{let e=await mr({owner:g,name:X,visibility:O,description:A.trim().length>0?A.trim():void 0});if(e.ok){W({ownerLogin:e.ownerLogin,repoName:e.repoName}),z(!1);return}let t=dr(e.error,g,X);V({message:t.banner,next:t.next}),t.next.kind===`edit-name`?(ae.current?.focus(),ae.current?.select()):t.next.kind===`reauth`&&H(!0)}catch{V({message:a({id:`UVLlMV`}),next:{kind:`edit-form`}})}z(!1)}},be;t[27]!==a||t[28]!==G||t[29]!==r||t[30]!==q?(be=function(){!q||G||(K(!0),Ve(q).then(()=>{ne.success(a({id:`c1LZZH`})),r(!1)}).catch(e=>{if(console.warn(`[share] action=link-construct result=clipboard-failed`,e),He(e)&&window.self!==window.top){ne.error(a({id:`Dub54T`}));return}ne.error(a({id:`MQIM_Y`}))}).finally(()=>{K(!1)}))},t[27]=a,t[28]=G,t[29]=r,t[30]=q,t[31]=be):be=t[31];let Se=be,Ce;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(e){let t=window.okDesktop?.shell?.openExternal;t?t(e):window.open(e,`_blank`,`noopener`)},t[32]=Ce):Ce=t[32];let we=Ce,Te;t[33]===r?Te=t[34]:(Te=function(){r(!1)},t[33]=r,t[34]=Te);let Ee=Te,Oe=!gr({owner:ce,sanitizedName:X,nameCheck:I,submitting:R}),ke;t[35]!==a||t[36]!==l||t[37]!==B||t[38]!==G||t[39]!==A||t[40]!==we||t[41]!==Ee||t[42]!==Se||t[43]!==ye||t[44]!==ue||t[45]!==y||t[46]!==I||t[47]!==u||t[48]!==m||t[49]!==f||t[50]!==U||t[51]!==X||t[52]!==g||t[53]!==q||t[54]!==J||t[55]!==Oe||t[56]!==R||t[57]!==O?(ke=(0,$.jsx)(C,{className:`sm:max-w-lg`,showCloseButton:!1,children:U?(0,$.jsx)(br,{ownerLogin:U.ownerLogin,repoName:U.repoName,shareUrl:q,shareUrlError:J,copying:G,canCopy:l!==null,onCopy:Se,onClose:Ee}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(E,{children:[(0,$.jsx)(S,{children:(0,$.jsx)(s,{id:`qXsafh`})}),(0,$.jsx)(x,{children:(0,$.jsx)(s,{id:`Z1LF1M`})})]}),(0,$.jsxs)(w,{className:`flex flex-col gap-6`,children:[(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(M,{id:`publish-owner-label`,children:(0,$.jsx)(s,{id:`LtI9AS`})}),f&&u===null?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(xe,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`Z3FXyt`})]}):m?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm text-destructive`,children:m}),(0,$.jsx)(_,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>ue(),children:(0,$.jsx)(s,{id:`6gRgw8`})})]}):(0,$.jsx)(P,{value:g,onValueChange:v,"aria-labelledby":`publish-owner-label`,"data-testid":`publish-owner-radio`,children:(u??[]).map(yr)})]}),(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(M,{htmlFor:`publish-name`,children:(0,$.jsx)(s,{id:`0xnmlQ`})}),(0,$.jsx)(Ae,{id:`publish-name`,ref:ae,"data-testid":`publish-name`,value:y,onChange:e=>b(e.target.value),onBlur:()=>{Y.current=null},placeholder:`my-knowledge-base`,autoComplete:`off`,spellCheck:!1}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-1sm`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:X?(0,$.jsx)(s,{id:`Nn4GgW`,values:{sanitizedName:X},components:{0:(0,$.jsx)(`code`,{className:`font-mono`})}}):(0,$.jsx)(s,{id:`Oxyd5f`})}),(0,$.jsx)(Tr,{status:I})]})]}),(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(M,{id:`publish-visibility-label`,children:(0,$.jsx)(s,{id:`2q_Q7x`})}),(0,$.jsxs)(P,{value:O,onValueChange:e=>k(e===`public`?`public`:`private`),className:`sm:flex`,"aria-labelledby":`publish-visibility-label`,children:[(0,$.jsx)(Pe,{htmlFor:`publish-visibility-private`,children:(0,$.jsxs)(Le,{orientation:`horizontal`,children:[(0,$.jsxs)(Ne,{children:[(0,$.jsx)(Ie,{children:(0,$.jsx)(s,{id:`zwBp5t`})}),(0,$.jsx)(Fe,{className:`text-1sm`,children:(0,$.jsx)(s,{id:`D8OV7J`})})]}),(0,$.jsx)(N,{value:`private`,id:`publish-visibility-private`,"data-testid":`publish-visibility-private`})]})}),(0,$.jsx)(Pe,{htmlFor:`publish-visibility-public`,children:(0,$.jsxs)(Le,{orientation:`horizontal`,children:[(0,$.jsxs)(Ne,{children:[(0,$.jsx)(Ie,{children:(0,$.jsx)(s,{id:`7d1a0d`})}),(0,$.jsx)(Fe,{className:`text-1sm`,children:(0,$.jsx)(s,{id:`4jDd0j`})})]}),(0,$.jsx)(N,{value:`public`,id:`publish-visibility-public`,"data-testid":`publish-visibility-public`})]})})]})]}),(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(M,{htmlFor:`publish-description`,children:(0,$.jsx)(s,{id:`Fxf4jq`})}),(0,$.jsx)(Be,{id:`publish-description`,"data-testid":`publish-description`,rows:2,value:A,onChange:e=>j(e.target.value),placeholder:a({id:`c5rF4v`})})]}),B&&(0,$.jsx)(wr,{banner:B,onAuthorize:we,onRetryPush:ye})]}),(0,$.jsxs)(T,{children:[(0,$.jsx)(_,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:Ee,children:(0,$.jsx)(s,{id:`dEgA5A`})}),(0,$.jsx)(_,{type:`button`,onClick:ye,disabled:Oe,"data-testid":`publish-submit`,children:R?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xe,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`Bdha5y`})]}):(0,$.jsx)(s,{id:`EEYbdt`})})]})]})}),t[35]=a,t[36]=l,t[37]=B,t[38]=G,t[39]=A,t[40]=we,t[41]=Ee,t[42]=Se,t[43]=ye,t[44]=ue,t[45]=y,t[46]=I,t[47]=u,t[48]=m,t[49]=f,t[50]=U,t[51]=X,t[52]=g,t[53]=q,t[54]=J,t[55]=Oe,t[56]=R,t[57]=O,t[58]=ke):ke=t[58];let je;t[59]!==r||t[60]!==n||t[61]!==ke?(je=(0,$.jsx)(D,{open:n,onOpenChange:r,children:ke}),t[59]=r,t[60]=n,t[61]=ke,t[62]=je):je=t[62];let Me;t[63]!==ee||t[64]!==ve?(Me=(0,$.jsx)(At,{open:ee,onOpenChange:H,onSuccess:ve}),t[63]=ee,t[64]=ve,t[65]=Me):Me=t[65];let Re;return t[66]!==je||t[67]!==Me?(Re=(0,$.jsxs)($.Fragment,{children:[je,Me]}),t[66]=je,t[67]=Me,t[68]=Re):Re=t[68],Re}function yr(e){let t=`publish-owner-${e.login}`;return(0,$.jsx)(Pe,{htmlFor:t,children:(0,$.jsxs)(Le,{orientation:`horizontal`,children:[(0,$.jsx)(Ne,{children:(0,$.jsxs)(Ie,{children:[e.avatarUrl?(0,$.jsx)(`img`,{src:e.avatarUrl,alt:``,"aria-hidden":!0,className:`size-4 rounded-full`}):null,(0,$.jsx)(`span`,{children:e.login})]})}),(0,$.jsx)(N,{value:e.login,id:t,"data-testid":`publish-owner-option-${e.login}`})]})},e.login)}function br(e){let t=(0,Z.c)(36),{ownerLogin:n,repoName:r,shareUrl:i,shareUrlError:a,copying:o,canCopy:l,onCopy:u,onClose:d}=e,{_:f}=c(),p=(0,Q.useRef)(null),m,h;t[0]===i?(m=t[1],h=t[2]):(m=()=>{!i||!p.current||(p.current.focus(),p.current.select())},h=[i],t[0]=i,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(S,{children:(0,$.jsx)(s,{id:`u3wRF-`})}),t[3]=g):g=t[3];let v;t[4]!==n||t[5]!==r?(v={ownerLogin:n,repoName:r},t[4]=n,t[5]=r,t[6]=v):v=t[6];let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y={0:(0,$.jsx)(`code`,{className:`font-mono`})},t[7]=y):y=t[7];let b;t[8]===v?b=t[9]:(b=(0,$.jsxs)(E,{children:[g,(0,$.jsx)(x,{children:(0,$.jsx)(s,{id:`r871ed`,values:v,components:y})})]}),t[8]=v,t[9]=b);let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(ge,{className:`mt-0.5 size-4 text-emerald-600`,"aria-hidden":!0}),t[10]=C):C=t[10];let D;t[11]===l?D=t[12]:(D=(0,$.jsxs)(`div`,{role:`status`,"data-testid":`publish-success`,className:`flex items-start gap-3 rounded-md border border-emerald-500/40 bg-emerald-500/5 p-3 text-sm`,children:[C,(0,$.jsx)(`span`,{className:`text-foreground`,children:l?(0,$.jsx)(s,{id:`cOrTMo`}):(0,$.jsx)(s,{id:`nTwL53`})})]}),t[11]=l,t[12]=D);let O;t[13]!==l||t[14]!==i||t[15]!==a?(O=l&&(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(M,{htmlFor:`publish-share-url`,children:(0,$.jsx)(s,{id:`5-FeN2`})}),a?(0,$.jsx)(`div`,{role:`alert`,"data-testid":`publish-share-url-error`,className:`rounded-md border border-destructive/50 bg-destructive/5 p-2 text-sm text-destructive`,children:a}):i?(0,$.jsx)(Ae,{id:`publish-share-url`,ref:p,"data-testid":`publish-share-url`,readOnly:!0,value:i,onFocus:Cr,onClick:Sr,onContextMenu:xr,className:`font-mono text-xs`}):(0,$.jsxs)(`div`,{"data-testid":`publish-share-url-loading`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(xe,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`M9597s`})]})]}),t[13]=l,t[14]=i,t[15]=a,t[16]=O):O=t[16];let k;t[17]!==D||t[18]!==O?(k=(0,$.jsxs)(w,{className:`flex flex-col gap-4`,children:[D,O]}),t[17]=D,t[18]=O,t[19]=k):k=t[19];let A;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(s,{id:`DPfwMq`}),t[20]=A):A=t[20];let j;t[21]===d?j=t[22]:(j=(0,$.jsx)(_,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:d,"data-testid":`publish-success-done`,children:A}),t[21]=d,t[22]=j);let N;t[23]!==f||t[24]!==l||t[25]!==o||t[26]!==u||t[27]!==i?(N=l&&(0,$.jsx)(_,{type:`button`,onClick:u,disabled:o||!i,"data-testid":`publish-copy-link`,"aria-label":f({id:`RGCCrg`}),children:o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xe,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`OvEjsP`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(he,{className:`size-3.5`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`RGCCrg`})]})}),t[23]=f,t[24]=l,t[25]=o,t[26]=u,t[27]=i,t[28]=N):N=t[28];let P;t[29]!==j||t[30]!==N?(P=(0,$.jsxs)(T,{children:[j,N]}),t[29]=j,t[30]=N,t[31]=P):P=t[31];let F;return t[32]!==k||t[33]!==P||t[34]!==b?(F=(0,$.jsxs)($.Fragment,{children:[b,k,P]}),t[32]=k,t[33]=P,t[34]=b,t[35]=F):F=t[35],F}function xr(e){return e.currentTarget.select()}function Sr(e){return e.currentTarget.select()}function Cr(e){return e.currentTarget.select()}function wr(e){let t=(0,Z.c)(13),{banner:n,onAuthorize:r,onRetryPush:i}=e,o=n.next,c;t[0]===n.message?c=t[1]:(c=(0,$.jsx)(`span`,{children:n.message}),t[0]=n.message,t[1]=c);let l;t[2]!==o.authorizeUrl||t[3]!==o.kind||t[4]!==r?(l=o.kind===`authorize-org`&&(0,$.jsxs)(_,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,"data-testid":`publish-authorize-org`,onClick:()=>r(o.authorizeUrl),children:[(0,$.jsx)(s,{id:`FyW0WO`}),` `,(0,$.jsx)(a,{className:`ml-1 size-3`,"aria-hidden":!0})]}),t[2]=o.authorizeUrl,t[3]=o.kind,t[4]=r,t[5]=l):l=t[5];let u;t[6]!==o.kind||t[7]!==i?(u=o.kind===`retry-push`&&(0,$.jsx)(_,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,"data-testid":`publish-retry-push`,onClick:i,children:(0,$.jsx)(s,{id:`NOHyEE`})}),t[6]=o.kind,t[7]=i,t[8]=u):u=t[8];let d;return t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,$.jsxs)(`div`,{role:`alert`,"data-testid":`publish-banner`,className:`flex flex-col gap-2 rounded-md border border-destructive/50 bg-destructive/5 p-3 text-sm`,children:[c,l,u]}),t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function Tr(e){let t=(0,Z.c)(12),{status:n}=e;if(n.kind===`available`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":`available`,className:`flex items-center gap-1 text-emerald-600 dark:text-emerald-400`,children:[e,` `,(0,$.jsx)(s,{id:`csDS2L`})]}),t[1]=n):n=t[1],n}if(n.kind===`taken`){let{owner:e,name:i}=n,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(r,{className:`size-3.5`,"aria-hidden":!0}),t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==e?(o=(0,$.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":`taken`,className:`flex items-center gap-1 text-destructive`,children:[a,` `,(0,$.jsx)(s,{id:`LRgZAt`,values:{owner:e,name:i}})]}),t[3]=i,t[4]=e,t[5]=o):o=t[5],o}if(n.kind===`checking`||n.kind===`pending`){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(xe,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),t[6]=e):e=t[6];let r;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(s,{id:`pWT04I`}),t[7]=r):r=t[7];let i;return t[8]===n.kind?i=t[9]:(i=(0,$.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":n.kind,className:`flex items-center gap-1 text-muted-foreground`,children:[e,` `,r]}),t[8]=n.kind,t[9]=i),i}if(n.kind===`error`){let e;return t[10]===n.banner?e=t[11]:(e=(0,$.jsx)(`span`,{"data-testid":`publish-name-check`,"data-status":`error`,className:`text-destructive`,children:n.banner}),t[10]=n.banner,t[11]=e),e}return null}function Er(e=`sync`){le(e).catch(e=>{console.warn(`[sync-badge] manual sync trigger failed`,e instanceof Error?e.message:e)})}function Dr(e){if(!e)return J._({id:`Zul8Ry`});let t=Date.now()-new Date(e).getTime();if(t<6e4)return J._({id:`xOTzt5`});if(t<36e5){let e=Math.floor(t/6e4);return J._({id:`LNum6A`,values:{minutes:e}})}if(t<864e5){let e=Math.floor(t/36e5);return J._({id:`nYeBmY`,values:{hours:e}})}return new Date(e).toLocaleDateString()}function Or(e){return e.syncMode===`follow`}function kr(e){return Or(e)&&e.state===`idle`&&e.conflictCount>0?`conflict`:e.state}function Ar(e){let t=(0,Z.c)(10),{status:n,paused:r}=e;if(r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(qe,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}switch(kr(n)){case`dormant`:{let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(We,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Se,{className:`size-3.5 text-muted-foreground`}),t[2]=e):e=t[2],e}let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(We,{className:`size-3.5 text-muted-foreground`}),t[3]=e):e=t[3],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Se,{className:`size-3.5 text-muted-foreground animate-spin`}),t[4]=e):e=t[4],e}case`conflict`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(we,{className:`size-3.5 text-amber-500`}),t[5]=e):e=t[5],e}case`offline`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ue,{className:`size-3.5 text-muted-foreground`}),t[6]=e):e=t[6],e}case`auth-error`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ge,{className:`size-3.5 text-destructive`}),t[7]=e):e=t[7],e}case`disabled`:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(we,{className:`size-3.5 text-amber-500`}),t[8]=e):e=t[8],e}default:{let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(We,{className:`size-3.5 text-muted-foreground`}),t[9]=e):e=t[9],e}}}function jr(e){switch(kr(e)){case`idle`:return!Or(e)&&e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function Mr(e,t=!1){switch(e){case`dormant`:return J._({id:`RmBY0A`});case`idle`:return t?J._({id:`j5CWO4`}):J._({id:`N2FcBE`});case`fetching`:return t?J._({id:`7IsvrP`}):J._({id:`Wgmlsw`});case`pulling`:return t?J._({id:`JL3si7`}):J._({id:`4uNLmk`});case`pushing`:return J._({id:`iycx_A`});case`conflict`:return J._({id:`IInnZo`});case`offline`:return J._({id:`6Aih4U`});case`auth-error`:return J._({id:`mHVPm5`});case`disabled`:return J._({id:`DrYM2Z`});default:return e}}function Nr(e){switch(e){case`external-changes-pending`:return J._({id:`W9_Bub`});case`dirty-tree`:return J._({id:`a5Gha5`});case`non-content-merge-failure`:return J._({id:`sIxSSP`});case`detached-head`:return J._({id:`uQNW00`});case`diverged-local-commits`:return J._({id:`LQsCPn`});case`auth-error`:return J._({id:`mHVPm5`});case`protected-branch`:return J._({id:`8fc_3j`});case`no-push-permission`:return J._({id:`ChAtFg`});default:return e}}function Pr(e){switch(e){case`not-authenticated`:return J._({id:`ycIX5i`});case`no-collaborator`:return J._({id:`ChAtFg`});case`private-no-access`:return J._({id:`07gHun`});case`repo-not-found`:return J._({id:`uksqrP`});default:return J._({id:`ChAtFg`})}}function Fr(e){return e?.checkStatus===`denied`&&e.deniedReason===`not-authenticated`}function Ir(e){switch(e){case`auth-403`:return J._({id:`EiVgl5`});case`auth-401`:return J._({id:`-Qw-1t`});case`auth-scope-mismatch`:return J._({id:`Zue_jx`});case`auth-no-credential`:return J._({id:`uCaIdy`});case`semantic-protected-branch`:return J._({id:`T0OVm7`});default:return J._({id:`1AumWo`})}}function Lr(e){switch(e){case`auth-403`:return J._({id:`RgbKEe`});case`auth-401`:return J._({id:`-Qw-1t`});case`auth-scope-mismatch`:return J._({id:`Zue_jx`});case`auth-no-credential`:return J._({id:`uCaIdy`});default:return J._({id:`jZ_E5M`})}}function Rr(e){switch(e){case`auth-403`:return J._({id:`RgbKEe`});case`auth-401`:return J._({id:`-Qw-1t`});case`auth-scope-mismatch`:return J._({id:`Zue_jx`});case`auth-no-credential`:return J._({id:`uCaIdy`});case`semantic-protected-branch`:return J._({id:`T0OVm7`});default:return J._({id:`cUk6TF`})}}function zr(e){let t=e.pushErrorCode!=null||e.pushError!=null,n=e.pullErrorCode!=null||e.pullError!=null;if(t&&n&&(e.pushErrorCode==null?e.pullErrorCode==null&&e.pushError===e.pullError:e.pushErrorCode===e.pullErrorCode))return[{key:`sync`,direction:null,message:e.pushErrorCode==null?e.pushError:Rr(e.pushErrorCode)}];let r=t&&n,i=[];return t&&i.push({key:`push`,direction:r?`push`:null,message:e.pushErrorCode?Ir(e.pushErrorCode):e.pushError}),n&&i.push({key:`pull`,direction:r?`pull`:null,message:e.pullErrorCode?Lr(e.pullErrorCode):e.pullError}),i}function Br(e){return e?.checkStatus===`unknown`&&e.unknownError===`token-invalid`}function Vr(e,t=!1){if(t)return J._({id:`U6wmNc`});let n=Or(e);if(!e.syncEnabled&&!n)return J._({id:`kUn-CN`});let r=kr(e);if(r===`conflict`&&e.conflictCount>0){let{conflictCount:t}=e;return J._({id:`cUK8lW`,values:{conflictCount:t}})}if(r===`idle`){let{ahead:t,behind:r}=e;return n?r>0?J._({id:`9o1bIV`,values:{behind:r}}):J._({id:`j5CWO4`}):t>0&&r>0?J._({id:`5F5HYj`,values:{ahead:t,behind:r}}):t>0?J._({id:`PdA9NZ`,values:{ahead:t}}):r>0?J._({id:`9o1bIV`,values:{behind:r}}):J._({id:`N2FcBE`})}return Mr(r,n)}function Hr(e){let t=(0,Z.c)(69),{status:n,onSignIn:r,onSetIdentity:i}=e,{_:a}=c(),{behind:o,conflictCount:l}=n,{projectLocalConfig:u,projectLocalSynced:d}=ae(),f=u?.autoSync,{active:p,paused:m,everEnabled:h,toggleMode:g,confirmOpen:v,setConfirmOpen:y,pendingMode:b,strandedCommitCount:x,onToggleActive:S,onModeSelect:C,onConfirm:w}=ue(f,n.ahead),T=q(f)??`off`,E=Or(n),D=kr(n),O=Dr(n.lastSyncUtc),k=!(n.pushPermission?.checkStatus===`denied`&&n.pushPermission.deniedReason!==`not-authenticated`),{conflicts:A}=Bn(),j=A[0]??null,M=!m&&D===`conflict`&&j!==null,N=!m&&D===`auth-error`,P=h&&!M&&!N&&(m||D!==`dormant`),R=p&&T===`full`?`sync`:`pull`,z;t[0]!==m||t[1]!==n?(z=(0,$.jsx)(Ar,{status:n,paused:m}),t[0]=m,t[1]=n,t[2]=z):z=t[2];let B=m?a({id:`U6wmNc`}):Mr(D,E),V;t[3]===B?V=t[4]:(V=(0,$.jsx)(`span`,{className:`text-1sm font-medium truncate`,children:B}),t[3]=B,t[4]=V);let H;t[5]!==z||t[6]!==V?(H=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[z,V]}),t[5]=z,t[6]=V,t[7]=H):H=t[7];let U=!d,W;t[8]!==a||t[9]!==p?(W=a(p?{id:`MGBNwj`}:{id:`rn7n0G`}),t[8]=a,t[9]=p,t[10]=W):W=t[10];let G;t[11]!==p||t[12]!==S||t[13]!==U||t[14]!==W?(G=(0,$.jsx)(F,{checked:p,disabled:U,onCheckedChange:S,"aria-label":W}),t[11]=p,t[12]=S,t[13]=U,t[14]=W,t[15]=G):G=t[15];let K;t[16]!==H||t[17]!==G?(K=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[H,G]}),t[16]=H,t[17]=G,t[18]=K):K=t[18];let te=b??`full`,J;t[19]!==v||t[20]!==w||t[21]!==y||t[22]!==x||t[23]!==te?(J=(0,$.jsx)(de,{open:v,onOpenChange:y,onConfirm:w,variant:te,strandedCommitCount:x}),t[19]=v,t[20]=w,t[21]=y,t[22]=x,t[23]=te,t[24]=J):J=t[24];let ne;t[25]!==a||t[26]!==p||t[27]!==E||t[28]!==r||t[29]!==m||t[30]!==n?(ne=m?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-paused-line`,children:(0,$.jsx)(s,{id:`PTb1Nx`})}):(0,$.jsxs)($.Fragment,{children:[zr(n).map(e=>(0,$.jsx)(`p`,{className:`text-xs text-destructive`,children:e.direction===`push`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`font-medium`,children:[a({id:`uO9WLl`}),`: `]}),e.message]}):e.direction===`pull`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`font-medium`,children:[a({id:`e4GHWP`}),`: `]}),e.message]}):e.message},e.key)),!E&&Fr(n.pushPermission)?(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground flex-1 min-w-0`,children:(0,$.jsx)(s,{id:`ycIX5i`})}),r&&(0,$.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:r,children:(0,$.jsx)(s,{id:`5lWFkC`})})]}):n.pausedReason?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:Nr(n.pausedReason)}):E?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-mode-line`,children:(0,$.jsx)(s,{id:`-imiMK`})}):p?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-mode-line`,children:(0,$.jsx)(s,{id:`iy64Li`})}):n.pushPermission?.checkStatus===`denied`?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:Pr(n.pushPermission.deniedReason)}):Br(n.pushPermission)?(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground flex-1 min-w-0`,children:(0,$.jsx)(s,{id:`C_cPoW`})}),r&&(0,$.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:r,children:(0,$.jsx)(s,{id:`5lWFkC`})})]}):null]}),t[25]=a,t[26]=p,t[27]=E,t[28]=r,t[29]=m,t[30]=n,t[31]=ne):ne=t[31];let re;t[32]!==E||t[33]!==m||t[34]!==D?(re=!m&&D===`conflict`&&(0,$.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:E?(0,$.jsx)(s,{id:`ko386X`}):(0,$.jsx)(s,{id:`t2TkQ3`})}),t[32]=E,t[33]=m,t[34]=D,t[35]=re):re=t[35];let ie;t[36]!==a||t[37]!==n.remote?(ie=n.remote&&(0,$.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,$.jsx)(s,{id:`IreQBq`})}),n.remote.webUrl?(0,$.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-0.5 text-foreground hover:text-primary hover:underline`,"aria-label":a({id:`1nke1r`,values:{0:n.remote.label}}),children:[(0,$.jsx)(`span`,{className:`truncate`,children:n.remote.label}),(0,$.jsx)(pe,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,$.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:n.remote.label})]}),t[36]=a,t[37]=n.remote,t[38]=ie):ie=t[38];let Y;t[39]!==p||t[40]!==o||t[41]!==E||t[42]!==n.behind?(Y=p&&!E&&n.behind>0&&(0,$.jsx)(`div`,{children:(0,$.jsx)(s,{id:`YsEYYS`,values:{behind:o}})}),t[39]=p,t[40]=o,t[41]=E,t[42]=n.behind,t[43]=Y):Y=t[43];let oe;t[44]!==l||t[45]!==n.conflictCount?(oe=n.conflictCount>0&&(0,$.jsx)(`div`,{children:(0,$.jsx)(s,{id:`B4_ipX`,values:{conflictCount:l}})}),t[44]=l,t[45]=n.conflictCount,t[46]=oe):oe=t[46];let se;t[47]!==a||t[48]!==k||t[49]!==C||t[50]!==g?(se=k&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-0.5`,children:[(0,$.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,$.jsx)(s,{id:`zz_Wd_`})}),(0,$.jsxs)(L,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,value:g,onValueChange:e=>{ee(e)&&C(e)},"aria-label":a({id:`CnOGgs`}),"data-testid":`sync-popover-mode-toggle`,children:[(0,$.jsx)(I,{value:`full`,"data-testid":`sync-popover-mode-full`,children:(0,$.jsx)(s,{id:`g2Tj8R`})}),(0,$.jsx)(I,{value:`follow`,"data-testid":`sync-popover-mode-follow`,children:(0,$.jsx)(s,{id:`MKEPCY`})})]})]}),t[47]=a,t[48]=k,t[49]=C,t[50]=g,t[51]=se):se=t[51];let X;t[52]!==ie||t[53]!==Y||t[54]!==oe||t[55]!==se?(X=(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-2 border-t pt-3`,children:[ie,Y,oe,se]}),t[52]=ie,t[53]=Y,t[54]=oe,t[55]=se,t[56]=X):X=t[56];let ce;t[57]!==i||t[58]!==m||t[59]!==n.identityUnresolved?(ce=!m&&n.identityUnresolved&&i&&(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,$.jsx)(Je,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:(0,$.jsx)(s,{id:`nrGWJ7`})}),(0,$.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:i,children:(0,$.jsx)(s,{id:`keNFEd`})})]})]}),t[57]=i,t[58]=m,t[59]=n.identityUnresolved,t[60]=ce):ce=t[60];let le=(P||N||M||p&&D!==`dormant`)&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[p&&D!==`dormant`?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-last-sync`,children:a(E?{id:`4DcimZ`,values:{lastSyncedRelative:O}}:{id:`g85bAo`,values:{lastSyncedRelative:O}})}):(0,$.jsx)(`span`,{}),(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-1`,children:[P&&(0,$.jsx)(_,{variant:`outline`,size:`xs`,onClick:()=>Er(R),children:(0,$.jsx)(s,{id:`Nu4DdT`})}),N&&(0,$.jsx)(_,{variant:`outline`,size:`xs`,onClick:r,children:(0,$.jsx)(s,{id:`5lWFkC`})}),M&&j&&(0,$.jsx)(_,{variant:`outline`,size:`xs`,onClick:()=>{if(typeof window>`u`)return;let e=Ee(Oe(j.file));ke(window.location.hash,e)||(window.location.hash=e)},children:(0,$.jsx)(s,{id:`0yL--g`})})]})]}),fe;return t[61]!==J||t[62]!==ne||t[63]!==re||t[64]!==X||t[65]!==ce||t[66]!==le||t[67]!==K?(fe=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[K,J,ne,re,X,ce,le]}),t[61]=J,t[62]=ne,t[63]=re,t[64]=X,t[65]=ce,t[66]=le,t[67]=K,t[68]=fe):fe=t[68],fe}function Ur(e){let t=(0,Z.c)(74),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onSetIdentity:i}=n,{_:a}=c(),{status:o,fetchError:l}=ce(),{projectLocalConfig:p}=ae(),m=p?.autoSync,h;t[2]===m?h=t[3]:(h=z(m),t[2]=m,t[3]=h);let g=h,x=ee(q(p?.autoSync));if(!o){if(l){let e;t[4]===a?e=t[5]:(e=a({id:`iqIDv4`}),t[4]=a,t[5]=e);let n;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Ue,{className:`size-3.5`}),t[6]=n):n=t[6];let r;t[7]===e?r=t[8]:(r=(0,$.jsx)(v,{asChild:!0,children:(0,$.jsx)(_,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":e,disabled:!0,children:n})}),t[7]=e,t[8]=r);let i;t[9]===l?i=t[10]:(i=(0,$.jsx)(y,{children:l===`network`?(0,$.jsx)(s,{id:`I5AfhE`}):(0,$.jsx)(s,{id:`uKRYiW`})}),t[9]=l,t[10]=i);let o;return t[11]!==r||t[12]!==i?(o=(0,$.jsxs)(b,{children:[r,i]}),t[11]=r,t[12]=i,t[13]=o):o=t[13],o}return null}if(o.state===`dormant`&&!o.hasRemote||o.state===`disabled`&&!o.pausedReason&&o.syncMode!==`follow`&&!g&&!x)return null;let S;t[14]!==g||t[15]!==o?(S=g?``:jr(o),t[14]=g,t[15]=o,t[16]=S):S=t[16];let C=S,w,T,E,D,O,k,A,j,M,N,P,F;if(t[17]!==a||t[18]!==g||t[19]!==o){let e=g?a({id:`U6wmNc`}):Mr(kr(o),Or(o));k=!!o.identityUnresolved,O=f,D=b,E=v,A=!0,T=d,F=!0,w=_,j=`ghost`,M=`icon-sm`,N=`text-muted-foreground relative`,P=a(k?{id:`DFfRbX`,values:{syncStateLabel:e}}:{id:`F4vEsL`,values:{syncStateLabel:e}}),t[17]=a,t[18]=g,t[19]=o,t[20]=w,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k,t[26]=A,t[27]=j,t[28]=M,t[29]=N,t[30]=P,t[31]=F}else w=t[20],T=t[21],E=t[22],D=t[23],O=t[24],k=t[25],A=t[26],j=t[27],M=t[28],N=t[29],P=t[30],F=t[31];let I;t[32]!==g||t[33]!==o?(I=(0,$.jsx)(Ar,{status:o,paused:g}),t[32]=g,t[33]=o,t[34]=I):I=t[34];let L;t[35]===C?L=t[36]:(L=C&&(0,$.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:C}),t[35]=C,t[36]=L);let R;t[37]!==C||t[38]!==k?(R=!C&&k&&(0,$.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[37]=C,t[38]=k,t[39]=R):R=t[39];let B;t[40]!==w||t[41]!==I||t[42]!==L||t[43]!==R||t[44]!==j||t[45]!==M||t[46]!==N||t[47]!==P?(B=(0,$.jsxs)(w,{variant:j,size:M,className:N,"aria-label":P,children:[I,L,R]}),t[40]=w,t[41]=I,t[42]=L,t[43]=R,t[44]=j,t[45]=M,t[46]=N,t[47]=P,t[48]=B):B=t[48];let V;t[49]!==T||t[50]!==B||t[51]!==F?(V=(0,$.jsx)(T,{asChild:F,children:B}),t[49]=T,t[50]=B,t[51]=F,t[52]=V):V=t[52];let H;t[53]!==E||t[54]!==A||t[55]!==V?(H=(0,$.jsx)(E,{asChild:A,children:V}),t[53]=E,t[54]=A,t[55]=V,t[56]=H):H=t[56];let U;t[57]!==g||t[58]!==o?(U=Vr(o,g),t[57]=g,t[58]=o,t[59]=U):U=t[59];let W;t[60]===U?W=t[61]:(W=(0,$.jsx)(y,{children:U}),t[60]=U,t[61]=W);let G;t[62]!==D||t[63]!==H||t[64]!==W?(G=(0,$.jsxs)(D,{children:[H,W]}),t[62]=D,t[63]=H,t[64]=W,t[65]=G):G=t[65];let K;t[66]!==i||t[67]!==r||t[68]!==o?(K=(0,$.jsx)(u,{align:`end`,className:`w-80 p-3`,children:(0,$.jsx)(Hr,{status:o,onSignIn:r,onSetIdentity:i})}),t[66]=i,t[67]=r,t[68]=o,t[69]=K):K=t[69];let te;return t[70]!==O||t[71]!==G||t[72]!==K?(te=(0,$.jsxs)(O,{children:[G,K]}),t[70]=O,t[71]=G,t[72]=K,t[73]=te):te=t[73],te}var Wr=`npx @inkeep/open-knowledge cowork`,Gr=`https://openknowledge.ai/docs/integrations/claude-code`;function Kr(){return typeof window<`u`&&typeof window.okDesktop?.skill==`object`}function qr(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 font-mono text-[0.85em]`,children:n}),t[0]=n,t[1]=r),r}function Jr(e){let t=(0,Z.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=p(`font-mono tracking-wide uppercase text-primary font-medium text-xs`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,$.jsx)(`p`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Yr(e){let t=(0,Z.c)(4),{n}=e,r;t[0]===n?r=t[1]:(r=n.toString().padStart(2,`0`),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-5 w-5 shrink-0 items-center justify-center text-xs font-medium text-muted-foreground font-mono tabular-nums`,children:r}),t[2]=r,t[3]=i),i}function Xr(){let e=(0,Z.c)(8),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Jr,{children:(0,$.jsx)(s,{id:`cIptmH`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Yr,{n:1}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`li`,{className:`flex gap-3`,children:[n,(0,$.jsx)(`span`,{children:(0,$.jsx)(s,{id:`pHYP6v`,components:{0:(0,$.jsx)(`strong`,{className:`font-medium`}),1:(0,$.jsx)(fe,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),2:(0,$.jsx)(`strong`,{className:`font-medium`})}})})]}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(Yr,{n:2}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsxs)(`li`,{className:`flex gap-3`,children:[i,(0,$.jsx)(`span`,{children:(0,$.jsx)(s,{id:`gGVP4q`,components:{0:(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center font-medium border h-5 w-5 rounded-md text-xs`}),1:(0,$.jsx)(fe,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),2:(0,$.jsx)(`strong`,{className:`font-medium`}),3:(0,$.jsx)(fe,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),4:(0,$.jsx)(`strong`,{className:`font-medium`})}})})]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(Yr,{n:3}),e[5]=o):o=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsxs)(`ol`,{className:`flex flex-col gap-4 text-sm`,children:[r,a,(0,$.jsxs)(`li`,{className:`flex gap-3`,children:[o,(0,$.jsx)(`span`,{children:(0,$.jsx)(s,{id:`COr1Y7`,components:{0:(0,$.jsx)(qr,{}),1:(0,$.jsx)(`strong`,{className:`font-medium`})}})})]})]}),e[6]=c):c=e[6];let l;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t,c,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground mt-4`,children:(0,$.jsx)(s,{id:`kV2YZv`,components:{0:(0,$.jsx)(`strong`,{className:`font-medium`}),1:(0,$.jsx)(`strong`,{className:`font-medium`}),2:(0,$.jsx)(fe,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),3:(0,$.jsx)(fe,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`})}})})]}),e[7]=l):l=e[7],l}function Zr(e){let t=(0,Z.c)(74),{open:n,onOpenChange:r,reinstall:i}=e,a=i===void 0?!1:i,{_:o}=c(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={kind:`idle`},t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(!1),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{n||(d({kind:`idle`}),p(!1))},h=[n],t[1]=n,t[2]=m,t[3]=h),(0,Q.useEffect)(m,h);let g;t[4]===o?g=t[5]:(g=async function(){d({kind:`downloading`});let e=window.okDesktop?.skill;if(!e){d({kind:`error`,message:o({id:`y46m5r`})});return}let t=await e.buildAndOpen();if(t.ok)d({kind:`handed-off`,path:t.path});else{let e=t.message??t.reason;ne.error(o({id:`hSySVc`,values:{msg:e}})),d({kind:`error`,message:t.reason===`open-failed`?o({id:`IA1wNb`,values:{msg:e}}):`${t.reason}: ${e}`})}},t[4]=o,t[5]=g);let v=g,y;t[6]===o?y=t[7]:(y=async function(){try{await navigator.clipboard.writeText(Wr),p(!0),setTimeout(()=>p(!1),2e3)}catch(e){let t=e,n=t instanceof Error?t.message:String(t);ne.error(o({id:`Uw6ERJ`,values:{detail:n}}))}},t[6]=o,t[7]=y);let b=y,O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=Kr(),t[8]=O):O=t[8];let k=O,A;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(_e,{"aria-hidden":`true`,className:`h-4 w-4`}),t[9]=A):A=t[9];let j;t[10]===a?j=t[11]:(j=(0,$.jsxs)(S,{className:`flex items-center gap-2`,children:[A,a?(0,$.jsx)(s,{id:`xNyj3h`}):(0,$.jsx)(s,{id:`7qRHf0`})]}),t[10]=a,t[11]=j);let M;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(x,{children:(0,$.jsx)(s,{id:`9V0W-R`,components:{0:(0,$.jsx)(`strong`,{className:`font-medium text-foreground`})}})}),t[12]=M):M=t[12];let N;t[13]===j?N=t[14]:(N=(0,$.jsxs)(E,{children:[j,M]}),t[13]=j,t[14]=N);let P;t[15]===u.kind?P=t[16]:(P=u.kind===`idle`&&k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(Jr,{className:`text-muted-foreground`,children:(0,$.jsx)(s,{id:`Dnn2XG`})}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`RN62Q8`,components:{0:(0,$.jsx)(qr,{}),1:(0,$.jsx)(qr,{})}})})]}),(0,$.jsx)(Xr,{})]}),t[15]=u.kind,t[16]=P);let F;t[17]!==o||t[18]!==f||t[19]!==b||t[20]!==u.kind?(F=u.kind===`idle`&&!k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(Jr,{children:(0,$.jsx)(s,{id:`L8fKuc`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border bg-muted/40 p-2`,children:[(0,$.jsx)(`code`,{className:`flex-1 font-mono text-xs`,children:Wr}),(0,$.jsx)(_,{variant:`ghost`,size:`sm`,onClick:b,"aria-label":o({id:`Oos8fo`}),className:`h-7 gap-1`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ge,{"aria-hidden":`true`,className:`h-3 w-3`}),(0,$.jsx)(s,{id:`6V3Ea3`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(he,{"aria-hidden":`true`,className:`h-3 w-3`}),(0,$.jsx)(s,{id:`he3ygx`})]})})]}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`z60Lgn`,components:{0:(0,$.jsx)(qr,{})}})})]}),(0,$.jsx)(Xr,{})]}),t[17]=o,t[18]=f,t[19]=b,t[20]=u.kind,t[21]=F):F=t[21];let I;t[22]===u.kind?I=t[23]:(I=u.kind===`downloading`&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.jsx)(xe,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,$.jsx)(s,{id:`bwil08`,components:{0:(0,$.jsx)(qr,{})}})]}),t[22]=u.kind,t[23]=I);let L;t[24]!==u.kind||t[25]!==u.path?(L=u.kind===`handed-off`&&k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,$.jsx)(ge,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(s,{id:`r51jLC`})}),(0,$.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground`,children:u.path??`~/Downloads/openknowledge.skill`})]})]}),(0,$.jsx)(Xr,{})]}),t[24]=u.kind,t[25]=u.path,t[26]=L):L=t[26];let R;t[27]===u.kind?R=t[28]:(R=u.kind===`handed-off`&&!k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,$.jsx)(ge,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(s,{id:`hynz2K`})}),(0,$.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`qXg5W9`,components:{0:(0,$.jsx)(qr,{})}})})]})]}),(0,$.jsx)(Xr,{})]}),t[27]=u.kind,t[28]=R);let z;t[29]!==u.kind||t[30]!==u.message?(z=u.kind===`error`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`text-destructive`,children:u.message}),(0,$.jsx)(`a`,{href:Gr,target:`_blank`,rel:`noopener noreferrer`,onClick:ti,onAuxClick:ei,className:`text-xs underline underline-offset-2 hover:text-foreground`,children:(0,$.jsx)(s,{id:`mGaZwZ`})})]}),t[29]=u.kind,t[30]=u.message,t[31]=z):z=t[31];let B;t[32]!==P||t[33]!==F||t[34]!==I||t[35]!==L||t[36]!==R||t[37]!==z?(B=(0,$.jsx)(w,{children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-6 py-2`,children:[P,F,I,L,R,z]})}),t[32]=P,t[33]=F,t[34]=I,t[35]=L,t[36]=R,t[37]=z,t[38]=B):B=t[38];let V;t[39]===u.kind?V=t[40]:(V=u.kind!==`error`&&(0,$.jsxs)(`a`,{href:Gr,target:`_blank`,rel:`noopener noreferrer`,onClick:$r,onAuxClick:Qr,className:`inline-flex items-center gap-1 self-center text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground sm:mr-auto font-mono tracking-wide uppercase`,children:[(0,$.jsx)(s,{id:`U3IvM5`}),(0,$.jsx)(Ke,{"aria-hidden":`true`,className:`h-3 w-3`})]}),t[39]=u.kind,t[40]=V);let ee;t[41]!==v||t[42]!==r||t[43]!==u.kind||t[44]!==a?(ee=u.kind===`idle`&&k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_,{className:`uppercase font-mono`,variant:`outline`,onClick:()=>r(!1),children:(0,$.jsx)(s,{id:`dEgA5A`})}),(0,$.jsxs)(_,{onClick:v,children:[(0,$.jsx)(_e,{"aria-hidden":`true`,className:`h-4 w-4`}),a?(0,$.jsx)(s,{id:`YGIi_c`}):(0,$.jsx)(s,{id:`TKQ7K-`})]})]}),t[41]=v,t[42]=r,t[43]=u.kind,t[44]=a,t[45]=ee):ee=t[45];let H;t[46]!==r||t[47]!==u.kind?(H=u.kind===`idle`&&!k&&(0,$.jsx)(_,{className:`uppercase font-mono`,variant:`outline`,onClick:()=>r(!1),children:(0,$.jsx)(s,{id:`yz7wBu`})}),t[46]=r,t[47]=u.kind,t[48]=H):H=t[48];let U;t[49]!==v||t[50]!==r||t[51]!==u.kind?(U=u.kind===`error`&&k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_,{className:`uppercase font-mono`,variant:`outline`,onClick:()=>r(!1),children:(0,$.jsx)(s,{id:`dEgA5A`})}),(0,$.jsxs)(_,{onClick:v,children:[(0,$.jsx)(_e,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,$.jsx)(s,{id:`KDw4GX`})]})]}),t[49]=v,t[50]=r,t[51]=u.kind,t[52]=U):U=t[52];let W;t[53]!==u.kind||t[54]!==a?(W=u.kind===`downloading`&&(0,$.jsxs)(_,{disabled:!0,children:[(0,$.jsx)(xe,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),a?(0,$.jsx)(s,{id:`fIgqfQ`}):(0,$.jsx)(s,{id:`Wtw22s`})]}),t[53]=u.kind,t[54]=a,t[55]=W):W=t[55];let G;t[56]!==r||t[57]!==u.kind?(G=u.kind===`handed-off`&&(0,$.jsx)(_,{onClick:()=>r(!1),children:(0,$.jsx)(s,{id:`DPfwMq`})}),t[56]=r,t[57]=u.kind,t[58]=G):G=t[58];let K;t[59]!==V||t[60]!==ee||t[61]!==H||t[62]!==U||t[63]!==W||t[64]!==G?(K=(0,$.jsxs)(T,{children:[V,ee,H,U,W,G]}),t[59]=V,t[60]=ee,t[61]=H,t[62]=U,t[63]=W,t[64]=G,t[65]=K):K=t[65];let q;t[66]!==N||t[67]!==B||t[68]!==K?(q=(0,$.jsxs)(C,{className:`sm:max-w-lg`,"data-ok-layer-spawned":``,children:[N,B,K]}),t[66]=N,t[67]=B,t[68]=K,t[69]=q):q=t[69];let te;return t[70]!==r||t[71]!==n||t[72]!==q?(te=(0,$.jsx)(D,{open:n,onOpenChange:r,children:q}),t[70]=r,t[71]=n,t[72]=q,t[73]=te):te=t[73],te}function Qr(e){return ze(e,Gr)}function $r(e){return ze(e,Gr)}function ei(e){return ze(e,Gr)}function ti(e){return ze(e,Gr)}var ni=new Set;function ri(e){for(let t of ni)try{t(e)}catch(e){console.warn(`[config-ignore-nested-error-events] listener threw:`,e)}}function ii(e){return ni.add(e),()=>{ni.delete(e)}}var ai=new Set;function oi(e){for(let t of ai)try{t(e)}catch(e){console.warn(`[config-validation-events] listener threw:`,e)}}function si(e){return ai.add(e),()=>{ai.delete(e)}}var ci=null;function li(){return ci}function ui(e){ci=e}export{$t as A,et as B,Wn as C,In as D,Ln as E,wt as F,We as H,gt as I,pt as L,Zt as M,Jt as N,Rn as O,At as P,mt as R,Xn as S,Bn as T,Ye as V,Jn as _,ri as a,Un as b,Ur as c,Br as d,vr as f,Kn as g,rr as h,si as i,Qt as j,Nn as k,Nr as l,er as m,ui as n,ii as o,$n as p,oi as r,Zr as s,li as t,Fr as u,qn as v,Vn as w,Yn as x,Gn as y,at as z};
@@ -1,5 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./messages-C1QZwdEx.js","./chunk-CYidjpOJ.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{$o as o,$r as s,Da as c,Ea as l,Eo as u,Lr as d,Nr as f,Oa as ee,Po as te,Ta as p,Yr as ne,en as re,nn as ie,ns as ae,po as oe}from"./dist-Cy5lktAQ2.js";import{t as se}from"./dist-DoS8xGN6.js";import{n as ce}from"./dist-Bkx5dDHT2.js";import{f as le,p as ue,r as de,s as fe}from"./use-apply-config-color-theme-DLZre1dS.js";import"./i18n-CC8DkJXO.js";import{r as pe}from"./client-version-B0MkkJjB.js";var me=a(),m=e(r(),1),he=null,h=new Set;function ge(){return he}function _e(e){let t=e!==null&&e.length>0?e:null;if(t!==he){he=t;for(let e of h)try{e()}catch(e){console.warn(`[server-instance-store] subscriber threw:`,e)}}}function ve(e){return h.add(e),()=>{h.delete(e)}}function ye(){return(0,m.useSyncExternalStore)(ve,ge,ge)}var g=()=>new Map,be=e=>{let t=g();return e.forEach((e,n)=>{t.set(n,e)}),t},_=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},xe=(e,t)=>{let n=[];for(let[r,i]of e)n.push(t(i,r));return n},Se=(e,t)=>{for(let[n,r]of e)if(t(r,n))return!0;return!1},v=()=>new Set,Ce=e=>e[e.length-1],we=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},y=Array.from,Te=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},Ee=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},De=(e,t)=>{let n=Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},b=Array.isArray,Oe=class{constructor(){this._observers=g()}on(e,t){return _(this._observers,e,v).add(t),t}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return y((this._observers.get(e)||g()).values()).forEach(e=>e(...t))}destroy(){this._observers=g()}},ke=class{constructor(){this._observers=g()}on(e,t){_(this._observers,e,v).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return y((this._observers.get(e)||g()).values()).forEach(e=>e(...t))}destroy(){this._observers=g()}},x=Math.floor,Ae=Math.abs,je=(e,t)=>e<t?e:t,Me=(e,t)=>e>t?e:t;Number.isNaN;var Ne=e=>e===0?1/e<0:e<0,Pe=1<<17,Fe=1<<18,Ie=1<<19,Le=1<<20,Re=1<<21,ze=1<<22,Be=1<<23,Ve=1<<24,He=1<<25,Ue=1<<26,We=1<<27,Ge=1<<28,Ke=1<<29;Pe-1,Fe-1,Ie-1,Le-1,Re-1,ze-1,Be-1,Ve-1,He-1,Ue-1,We-1,Ge-1,Ke-1;var qe=2**53-1,Je=-(2**53-1),Ye=Number.isInteger||(e=>typeof e==`number`&&isFinite(e)&&x(e)===e);Number.isNaN,Number.parseInt;var Xe=String.fromCharCode;String.fromCodePoint,Xe(65535);var Ze=e=>e.toLowerCase(),Qe=/^\s*/g,$e=e=>e.replace(Qe,``),et=/([A-Z])/g,tt=(e,t)=>$e(e.replace(et,e=>`${t}${Ze(e)}`)),nt=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},rt=typeof TextEncoder<`u`?new TextEncoder:null,it=rt?e=>rt.encode(e):nt,at=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});at&&at.decode(new Uint8Array).length===1&&(at=null);var ot=(e,t)=>De(t,()=>e).join(``),st=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},ct=()=>new st,lt=e=>{let t=ct();return e(t),S(t)},ut=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},S=e=>{let t=new Uint8Array(ut(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},dt=(e,t)=>{let n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Me(n,t)*2),e.cpos=0)},C=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},ft=C,w=(e,t)=>{for(;t>127;)C(e,128|127&t),t=x(t/128);C(e,127&t)},pt=(e,t)=>{let n=Ne(t);for(n&&(t=-t),C(e,(t>63?128:0)|(n?64:0)|63&t),t=x(t/64);t>0;)C(e,(t>127?128:0)|127&t),t=x(t/128)},mt=new Uint8Array(3e4),ht=mt.length/3,gt=rt&&rt.encodeInto?(e,t)=>{if(t.length<ht){let n=rt.encodeInto(t,mt).written||0;w(e,n);for(let t=0;t<n;t++)C(e,mt[t])}else T(e,it(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;w(e,r);for(let t=0;t<r;t++)C(e,n.codePointAt(t))},_t=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=je(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Me(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},T=(e,t)=>{w(e,t.byteLength),_t(e,t)},vt=(e,t)=>{dt(e,t);let n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},yt=(e,t)=>vt(e,4).setFloat32(0,t,!1),bt=(e,t)=>vt(e,8).setFloat64(0,t,!1),xt=(e,t)=>vt(e,8).setBigInt64(0,t,!1),St=new DataView(new ArrayBuffer(4)),Ct=e=>(St.setFloat32(0,e),St.getFloat32(0)===e),wt=(e,t)=>{switch(typeof t){case`string`:C(e,119),gt(e,t);break;case`number`:Ye(t)&&Ae(t)<=2147483647?(C(e,125),pt(e,t)):Ct(t)?(C(e,124),yt(e,t)):(C(e,123),bt(e,t));break;case`bigint`:C(e,122),xt(e,t);break;case`object`:if(t===null)C(e,126);else if(b(t)){C(e,117),w(e,t.length);for(let n=0;n<t.length;n++)wt(e,t[n])}else if(t instanceof Uint8Array)C(e,116),T(e,t);else{C(e,118);let n=Object.keys(t);w(e,n.length);for(let r=0;r<n.length;r++){let i=n[r];gt(e,i),wt(e,t[i])}}break;case`boolean`:C(e,t?120:121);break;default:C(e,127)}},Tt=class extends st{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&w(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},Et=e=>{e.count>0&&(pt(e.encoder,e.count===1?e.s:-e.s),e.count>1&&w(e.encoder,e.count-2))},Dt=class{constructor(){this.encoder=new st,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Et(this),this.count=1,this.s=e)}toUint8Array(){return Et(this),S(this.encoder)}},Ot=e=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);pt(e.encoder,t),e.count>1&&w(e.encoder,e.count-2)}},kt=class{constructor(){this.encoder=new st,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Ot(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Ot(this),S(this.encoder)}},At=class{constructor(){this.sarr=[],this.s=``,this.lensE=new Dt}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=``),this.lensE.write(e.length)}toUint8Array(){let e=new st;return this.sarr.push(this.s),this.s=``,gt(e,this.sarr.join(``)),_t(e,this.lensE.toUint8Array()),S(e)}},E=e=>Error(e),D=()=>{throw E(`Method unimplemented`)},O=()=>{throw E(`Unexpected case`)},jt=E(`Unexpected end of array`),Mt=E(`Integer out of Range`),Nt=class{constructor(e){this.arr=e,this.pos=0}},Pt=e=>new Nt(e),Ft=e=>e.pos!==e.arr.length,It=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},k=e=>It(e,A(e)),Lt=e=>e.arr[e.pos++],A=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&127)*n,n*=128,r<128)return t;if(t>qe)throw Mt}throw jt},Rt=e=>{let t=e.arr[e.pos++],n=t&63,r=64,i=(t&64)>0?-1:1;if(!(t&128))return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&127)*r,r*=128,t<128)return i*n;if(n>qe)throw Mt}throw jt},zt=at?e=>at.decode(k(e)):e=>{let t=A(e);if(t===0)return``;{let n=String.fromCodePoint(Lt(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Lt(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},Bt=(e,t)=>{let n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},Vt=[e=>void 0,e=>null,Rt,e=>Bt(e,4).getFloat32(0,!1),e=>Bt(e,8).getFloat64(0,!1),e=>Bt(e,8).getBigInt64(0,!1),e=>!1,e=>!0,zt,e=>{let t=A(e),n={};for(let r=0;r<t;r++){let t=zt(e);n[t]=Ht(e)}return n},e=>{let t=A(e),n=[];for(let r=0;r<t;r++)n.push(Ht(e));return n},k],Ht=e=>Vt[127-Lt(e)](e),Ut=class extends Nt{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),Ft(this)?this.count=A(this)+1:this.count=-1),this.count--,this.s}},Wt=class extends Nt{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=Rt(this);let e=Ne(this.s);this.count=1,e&&(this.s=-this.s,this.count=A(this)+2)}return this.count--,this.s}},Gt=class extends Nt{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=Rt(this),t=e&1;this.diff=x(e/2),this.count=1,t&&(this.count=A(this)+2)}return this.s+=this.diff,this.count--,this.s}},Kt=class{constructor(e){this.decoder=new Wt(e),this.str=zt(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}};crypto.subtle;var qt=crypto.getRandomValues.bind(crypto),Jt=Math.random,Yt=()=>qt(new Uint32Array(1))[0],Xt=e=>e[x(Jt()*e.length)],Zt=`10000000-1000-4000-8000-100000000000`,Qt=()=>Zt.replace(/[018]/g,e=>(e^Yt()&15>>e/4).toString(16)),$t=Date.now,en=e=>new Promise(e);Promise.all.bind(Promise);var tn=e=>e===void 0?null:e,nn=new class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}};try{typeof localStorage<`u`&&localStorage&&(nn=localStorage)}catch{}var rn=nn,an=Symbol(`Equality`),on=(e,t)=>e===t||!!e?.[an]?.(t)||!1,sn=e=>typeof e==`object`,cn=Object.assign,ln=Object.keys,un=(e,t)=>{for(let n in e)t(e[n],n)},dn=e=>ln(e).length,fn=e=>{for(let t in e)return!1;return!0},pn=(e,t)=>{for(let n in e)if(!t(e[n],n))return!1;return!0},mn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),hn=(e,t)=>e===t||dn(e)===dn(t)&&pn(e,(e,n)=>(e!==void 0||mn(t,n))&&on(t[n],e)),gn=Object.freeze,_n=e=>{for(let t in e){let n=e[t];(typeof n==`object`||typeof n==`function`)&&_n(e[t])}return gn(e)},vn=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&vn(e,t,n+1)}},yn=e=>e,bn=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[an]!=null)return e[an](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!bn(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(dn(e)!==dn(t))return!1;for(let n in e)if(!mn(e,n)||!bn(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!bn(e[n],t[n]))return!1;break;default:return!1}return!0},xn=(e,t)=>t.includes(e),Sn=typeof process<`u`&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`,Cn=typeof window<`u`&&typeof document<`u`&&!Sn;typeof navigator<`u`&&/Mac/.test(navigator.platform);var j,wn=[],Tn=()=>{if(j===void 0)if(Sn){j=g();let e=process.argv,t=null;for(let n=0;n<e.length;n++){let r=e[n];r[0]===`-`?(t!==null&&j.set(t,``),t=r):t===null?wn.push(r):(j.set(t,r),t=null)}t!==null&&j.set(t,``)}else typeof location==`object`?(j=g(),(location.search||`?`).slice(1).split(`&`).forEach(e=>{if(e.length!==0){let[t,n]=e.split(`=`);j.set(`--${tt(t,`-`)}`,n),j.set(`-${tt(t,`-`)}`,n)}})):j=g();return j},En=e=>Tn().has(e),Dn=e=>tn(Sn?{}[e.toUpperCase().replaceAll(`-`,`_`)]:rn.getItem(e)),On=e=>En(`--`+e)||Dn(e)!==null,kn=On(`production`),An=Sn&&xn({}.FORCE_COLOR,[`true`,`1`,`2`])||!En(`--no-colors`)&&!On(`no-color`)&&(!Sn||process.stdout.isTTY)&&(!Sn||En(`--color`)||Dn(`COLORTERM`)!==null||(Dn(`TERM`)||``).includes(`color`)),jn=e=>new Uint8Array(e),Mn=Cn?e=>{let t=``;for(let n=0;n<e.byteLength;n++)t+=Xe(e[n]);return btoa(t)}:e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString(`base64`),Nn=e=>{let t=jn(e.byteLength);return t.set(e),t},Pn=e=>lt(t=>wt(t,e)),Fn=class{constructor(e,t){this.left=e,this.right=t}},M=(e,t)=>new Fn(e,t),In=(e,t)=>e.forEach(e=>t(e.left,e.right)),Ln=e=>e.next()>=.5,Rn=(e,t,n)=>x(e.next()*(n+1-t)+t),zn=(e,t,n)=>x(e.next()*(n+1-t)+t),Bn=(e,t,n)=>zn(e,t,n),Vn=e=>Xe(Bn(e,97,122)),Hn=(e,t=0,n=20)=>{let r=Bn(e,t,n),i=``;for(let t=0;t<r;t++)i+=Vn(e);return i},Un=(e,t)=>t[Bn(e,0,t.length-1)],Wn=Symbol(`0schema`),Gn=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let n=this._rerrs[t];e.push(ot(` `,(this._rerrs.length-t)*2)+`${n.path==null?``:`[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
3
- `)}},Kn=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[an]?on(e,t):b(e)?Te(e,e=>Ee(t,t=>Kn(e,t))):sn(e)?pn(e,(e,n)=>Kn(e,t[n])):!1,N=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),Kn(t,n)}equals(e){return this.constructor===e.constructor&&bn(this.shape,e.shape)}[Wn](){return!0}[an](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){D()}get nullable(){return Cr(this,Rr)}get optional(){return new tr(this)}cast(e){return Hr(e,this),e}expect(e){return Hr(e,this),e}},qn=class extends N{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){let n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor===this.shape?`Check failed`:`Constructor match failed`),n}},P=(e,t=null)=>new qn(e,t);P(qn);var Jn=class extends N{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape(e);return!n&&t?.extend(null,`custom prop`,e?.constructor.name,`failed to check custom prop`),n}},F=e=>new Jn(e);P(Jn);var Yn=class extends N{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape.some(t=>t===e);return!n&&t?.extend(null,this.shape.join(` | `),e.toString()),n}},Xn=(...e)=>new Yn(e),Zn=P(Yn),Qn=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,e=>`\\`+e)),$n=e=>{if(Nr.check(e))return[Qn(e)];if(Zn.check(e))return e.shape.map(e=>e+``);if(Mr.check(e))return[`[+-]?\\d+.?\\d*`];if(Pr.check(e))return[`.*`];if(wr.check(e))return e.shape.map($n).flat(1);O()};P(class extends N{constructor(e){super(),this.shape=e,this._r=RegExp(`^`+e.map($n).map(e=>`(${e.join(`|`)})`).join(``)+`$`)}check(e,t){let n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),`String doesn't match string template.`),n}});var er=Symbol(`optional`),tr=class extends N{constructor(e){super(),this.shape=e}check(e,t){let n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,`undefined (optional)`,`()`),n}get[er](){return!0}},nr=P(tr),rr=class extends N{check(e,t){return t?.extend(null,`never`,typeof e),!1}};new rr,P(rr);var ir=class e extends N{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new e(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,`object`,`null`),!1):pn(this.shape,(n,r)=>{let i=this._isPartial&&!mn(e,r)||n.check(e[r],t);return!i&&t?.extend(r.toString(),n.toString(),typeof e[r],`Object property does not match`),i})}},ar=e=>new ir(e),or=P(ir),sr=F(e=>e!=null&&(e.constructor===Object||e.constructor==null)),cr=class extends N{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&pn(e,(n,r)=>{let i=this.shape.keys.check(r,t);return!i&&t?.extend(r+``,`Record`,typeof e,i?`Key doesn't match schema`:`Value doesn't match value`),i&&this.shape.values.check(n,t)})}},lr=(e,t)=>new cr(e,t),ur=P(cr),dr=class extends N{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&pn(this.shape,(n,r)=>{let i=n.check(e[r],t);return!i&&t?.extend(r.toString(),`Tuple`,typeof n),i})}},fr=(...e)=>new dr(e);P(dr);var pr=class extends N{constructor(e){super(),this.shape=e.length===1?e[0]:new Sr(e)}check(e,t){let n=b(e)&&Te(e,e=>this.shape.check(e));return!n&&t?.extend(null,`Array`,``),n}},mr=(...e)=>new pr(e),hr=P(pr),gr=F(e=>b(e)),_r=class extends N{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}},vr=(e,t=null)=>new _r(e,t);P(_r);var yr=vr(N),br=P(class extends N{constructor(e){super(),this.len=e.length-1,this.args=fr(...e.slice(-1)),this.res=e[this.len]}check(e,t){let n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,`function`,typeof e),n}}),xr=F(e=>typeof e==`function`);P(class extends N{constructor(e){super(),this.shape=e}check(e,t){let n=Te(this.shape,n=>n.check(e,t));return!n&&t?.extend(null,`Intersectinon`,typeof e),n}},e=>e.shape.length>0);var Sr=class extends N{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let n=Ee(this.shape,n=>n.check(e,t));return t?.extend(null,`Union`,typeof e),n}},Cr=(...e)=>e.findIndex(e=>wr.check(e))>=0?Cr(...e.map(e=>Vr(e)).map(e=>wr.check(e)?e.shape:[e]).flat(1)):e.length===1?e[0]:new Sr(e),wr=P(Sr),Tr=()=>!0,Er=F(Tr),Dr=P(Jn,e=>e.shape===Tr),Or=F(e=>typeof e==`bigint`),kr=F(e=>e===Or),Ar=F(e=>typeof e==`symbol`);F(e=>e===Ar);var jr=F(e=>typeof e==`number`),Mr=F(e=>e===jr),Nr=F(e=>typeof e==`string`),Pr=F(e=>e===Nr),Fr=F(e=>typeof e==`boolean`),Ir=F(e=>e===Fr),Lr=Xn(void 0);P(Yn,e=>e.shape.length===1&&e.shape[0]===void 0),Xn(void 0);var Rr=Xn(null),zr=P(Yn,e=>e.shape.length===1&&e.shape[0]===null);P(Uint8Array),P(qn,e=>e.shape===Uint8Array);var Br=Cr(jr,Nr,Rr,Lr,Or,Fr,Ar);(()=>{let e=mr(Er),t=lr(Nr,Er),n=Cr(jr,Nr,Rr,Fr,e,t);return e.shape=n,t.shape.values=n,n})();var Vr=e=>{if(yr.check(e))return e;if(sr.check(e)){let t={};for(let n in e)t[n]=Vr(e[n]);return ar(t)}else if(gr.check(e))return Cr(...e.map(Vr));else if(Br.check(e))return Xn(e);else if(xr.check(e))return P(e);O()},Hr=kn?()=>{}:(e,t)=>{let n=new Gn;if(!t.check(e,n))throw E(`Expected value to be of type ${t.constructor.name}.\n${n.toString()}`)},Ur=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Vr(e),h:t}),this}else(e){return this.if(Er,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){let r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw E(`Unhandled pattern`)}}},Wr=(e=>new Ur(e))(Er).if(Mr,(e,t)=>Rn(t,Je,qe)).if(Pr,(e,t)=>Hn(t)).if(Ir,(e,t)=>Ln(t)).if(kr,(e,t)=>BigInt(Rn(t,Je,qe))).if(wr,(e,t)=>Gr(t,Un(t,e.shape))).if(or,(e,t)=>{let n={};for(let r in e.shape){let i=e.shape[r];if(nr.check(i)){if(Ln(t))continue;i=i.shape}n[r]=Wr(i,t)}return n}).if(hr,(e,t)=>{let n=[],r=zn(t,0,42);for(let i=0;i<r;i++)n.push(Gr(t,e.shape));return n}).if(Zn,(e,t)=>Un(t,e.shape)).if(zr,(e,t)=>null).if(br,(e,t)=>{let n=Gr(t,e.res);return()=>n}).if(Dr,(e,t)=>Gr(t,Un(t,[jr,Nr,Rr,Lr,Or,Fr,mr(jr),lr(Cr(`a`,`b`,`c`),jr)]))).if(ur,(e,t)=>{let n={},r=Rn(t,0,3);for(let i=0;i<r;i++){let r=Gr(t,e.shape.keys);n[r]=Gr(t,e.shape.values)}return n}).done(),Gr=(e,t)=>Wr(Vr(t),e),I=typeof document<`u`?document:{},Kr=e=>I.createElement(e),qr=()=>I.createDocumentFragment();F(e=>e.nodeType===ai);var Jr=e=>I.createTextNode(e);typeof DOMParser<`u`&&new DOMParser;var Yr=(e,t)=>(In(t,(t,n)=>{n===!1?e.removeAttribute(t):n===!0?e.setAttribute(t,``):e.setAttribute(t,n)}),e),Xr=e=>{let t=qr();for(let n=0;n<e.length;n++)ti(t,e[n]);return t},Zr=(e,t)=>(ti(e,Xr(t)),e),Qr=(e,t=[],n=[])=>Zr(Yr(Kr(e),t),n);F(e=>e.nodeType===ni);var $r=Jr;F(e=>e.nodeType===ri);var ei=e=>xe(e,(e,t)=>`${t}:${e};`).join(``),ti=(e,t)=>e.appendChild(t),ni=I.ELEMENT_NODE,ri=I.TEXT_NODE;I.CDATA_SECTION_NODE,I.COMMENT_NODE;var ii=I.DOCUMENT_NODE;I.DOCUMENT_TYPE_NODE;var ai=I.DOCUMENT_FRAGMENT_NODE;F(e=>e.nodeType===ii);var oi=(e=>class{constructor(e){this._=e}destroy(){e(this._)}})(clearTimeout),si=(e,t)=>new oi(setTimeout(t,e)),L=Symbol,ci=L(),li=L(),ui=L(),di=L(),fi=L(),pi=L(),mi=L(),hi=L(),gi=L(),_i=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=0;for(;r<e.length;r++){let n=e[r];if(n===void 0)break;if(n.constructor===String||n.constructor===Number)t.push(n);else if(n.constructor===Object)break}for(r>0&&n.push(t.join(``));r<e.length;r++){let t=e[r];t instanceof Symbol||n.push(t)}return n};$t();var vi={[ci]:M(`font-weight`,`bold`),[li]:M(`font-weight`,`normal`),[ui]:M(`color`,`blue`),[fi]:M(`color`,`green`),[di]:M(`color`,`grey`),[pi]:M(`color`,`red`),[mi]:M(`color`,`purple`),[hi]:M(`color`,`orange`),[gi]:M(`color`,`black`)},yi=An?e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=g(),i=[],a=0;for(;a<e.length;a++){let i=e[a],o=vi[i];if(o!==void 0)r.set(o.left,o.right);else{if(i===void 0)break;if(i.constructor===String||i.constructor===Number){let e=ei(r);a>0||e.length>0?(t.push(`%c`+i),n.push(e)):t.push(i)}else break}}for(a>0&&(i=n,i.unshift(t.join(``)));a<e.length;a++){let t=e[a];t instanceof Symbol||i.push(t)}return i}:_i,bi=(...e)=>{console.log(...yi(e)),Si.forEach(t=>t.print(e))},xi=(...e)=>{console.warn(...yi(e)),e.unshift(hi),Si.forEach(t=>t.print(e))},Si=v(),Ci=e=>({[Symbol.iterator](){return this},next:e}),wi=(e,t)=>Ci(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),Ti=(e,t)=>Ci(()=>{let{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),Ei=class{constructor(e,t){this.clock=e,this.len=t}},Di=class{constructor(){this.clients=new Map}},Oi=(e,t,n)=>t.clients.forEach((t,r)=>{let i=e.doc.store.clients.get(r);if(i!=null){let r=i[i.length-1],a=r.id.clock+r.length;for(let r=0,o=t[r];r<t.length&&o.clock<a;o=t[++r])Ua(e,i,o.clock,o.len,n)}}),ki=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=x((n+r)/2),a=e[i],o=a.clock;if(o<=t){if(t<o+a.len)return i;n=i+1}else r=i-1}return null},Ai=(e,t)=>{let n=e.clients.get(t.client);return n!==void 0&&ki(n,t.clock)!==null},ji=e=>{e.clients.forEach(e=>{e.sort((e,t)=>e.clock-t.clock);let t,n;for(t=1,n=1;t<e.length;t++){let r=e[n-1],i=e[t];r.clock+r.len>=i.clock?e[n-1]=new Ei(r.clock,Me(r.len,i.clock+i.len-r.clock)):(n<t&&(e[n]=i),n++)}e.length=n})},Mi=e=>{let t=new Di;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,i)=>{if(!t.clients.has(i)){let a=r.slice();for(let t=n+1;t<e.length;t++)we(a,e[t].clients.get(i)||[]);t.clients.set(i,a)}});return ji(t),t},Ni=(e,t,n,r)=>{_(e.clients,t,()=>[]).push(new Ei(n,r))},Pi=()=>new Di,Fi=e=>{let t=Pi();return e.clients.forEach((e,n)=>{let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(n.deleted){let i=n.id.clock,a=n.length;if(t+1<e.length)for(let n=e[t+1];t+1<e.length&&n.deleted;n=e[++t+1])a+=n.length;r.push(new Ei(i,a))}}r.length>0&&t.clients.set(n,r)}),t},Ii=(e,t)=>{w(e.restEncoder,t.clients.size),y(t.clients.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{e.resetDsCurVal(),w(e.restEncoder,t);let r=n.length;w(e.restEncoder,r);for(let t=0;t<r;t++){let r=n[t];e.writeDsClock(r.clock),e.writeDsLen(r.len)}})},Li=e=>{let t=new Di,n=A(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();let n=A(e.restDecoder),r=A(e.restDecoder);if(r>0){let i=_(t.clients,n,()=>[]);for(let t=0;t<r;t++)i.push(new Ei(e.readDsClock(),e.readDsLen()))}}return t},Ri=(e,t,n)=>{let r=new Di,i=A(e.restDecoder);for(let a=0;a<i;a++){e.resetDsCurVal();let i=A(e.restDecoder),a=A(e.restDecoder),o=n.clients.get(i)||[],s=z(n,i);for(let n=0;n<a;n++){let n=e.readDsClock(),a=n+e.readDsLen();if(n<s){s<a&&Ni(r,i,s,a-s);let e=B(o,n),c=o[e];for(!c.deleted&&c.id.clock<n&&(o.splice(e+1,0,tc(t,c,n-c.id.clock)),e++);e<o.length&&(c=o[e++],c.id.clock<a);)c.deleted||(a<c.id.clock+c.length&&o.splice(e,0,tc(t,c,a-c.id.clock)),c.delete(t))}else Ni(r,i,n,a-n)}}if(r.clients.size>0){let e=new Ji;return w(e.restEncoder,0),Ii(e,r),e.toUint8Array()}return null},zi=Yt,Bi=class e extends Oe{constructor({guid:e=Qt(),collectionid:t=null,gc:n=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:a=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=zi(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new Ia,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=a,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=en(e=>{this.on(`load`,()=>{this.isLoaded=!0,e(this)})});let s=()=>en(e=>{let t=n=>{(n===void 0||n===!0)&&(this.off(`sync`,t),e())};this.on(`sync`,t)});this.on(`sync`,e=>{e===!1&&this.isSynced&&(this.whenSynced=s()),this.isSynced=e===void 0||e===!0,this.isSynced&&!this.isLoaded&&this.emit(`load`,[this])}),this.whenSynced=s()}load(){let e=this._item;e!==null&&!this.shouldLoad&&H(e.parent.doc,e=>{e.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(y(this.subdocs).map(e=>e.guid))}transact(e,t=null){return H(this,e,t)}get(e,t=W){let n=_(this.share,e,()=>{let e=new t;return e._integrate(this,null),e}),r=n.constructor;if(t!==W&&r!==t)if(r===W){let r=new t;r._map=n._map,n._map.forEach(e=>{for(;e!==null;e=e.left)e.parent=r}),r._start=n._start;for(let e=r._start;e!==null;e=e.right)e.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}else throw Error(`Type with the name ${e} has already been defined with a different constructor`);return n}getArray(e=``){return this.get(e,Ko)}getText(e=``){return this.get(e,ps)}getMap(e=``){return this.get(e,Yo)}getXmlElement(e=``){return this.get(e,vs)}getXmlFragment(e=``){return this.get(e,gs)}toJSON(){let e={};return this.share.forEach((t,n)=>{e[n]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,y(this.subdocs).forEach(e=>e.destroy());let t=this._item;if(t!==null){this._item=null;let n=t.content;n.doc=new e({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,H(t.parent.doc,e=>{let r=n.doc;t.deleted||e.subdocsAdded.add(r),e.subdocsRemoved.add(this)},null,!0)}this.emit(`destroyed`,[!0]),this.emit(`destroy`,[this]),super.destroy()}},Vi=class{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return A(this.restDecoder)}readDsLen(){return A(this.restDecoder)}},Hi=class extends Vi{readLeftID(){return R(A(this.restDecoder),A(this.restDecoder))}readRightID(){return R(A(this.restDecoder),A(this.restDecoder))}readClient(){return A(this.restDecoder)}readInfo(){return Lt(this.restDecoder)}readString(){return zt(this.restDecoder)}readParentInfo(){return A(this.restDecoder)===1}readTypeRef(){return A(this.restDecoder)}readLen(){return A(this.restDecoder)}readAny(){return Ht(this.restDecoder)}readBuf(){return Nn(k(this.restDecoder))}readJSON(){return JSON.parse(zt(this.restDecoder))}readKey(){return zt(this.restDecoder)}},Ui=class{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=A(this.restDecoder),this.dsCurrVal}readDsLen(){let e=A(this.restDecoder)+1;return this.dsCurrVal+=e,e}},Wi=class extends Ui{constructor(e){super(e),this.keys=[],A(e),this.keyClockDecoder=new Gt(k(e)),this.clientDecoder=new Wt(k(e)),this.leftClockDecoder=new Gt(k(e)),this.rightClockDecoder=new Gt(k(e)),this.infoDecoder=new Ut(k(e),Lt),this.stringDecoder=new Kt(k(e)),this.parentInfoDecoder=new Ut(k(e),Lt),this.typeRefDecoder=new Wt(k(e)),this.lenDecoder=new Wt(k(e))}readLeftID(){return new _a(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new _a(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Ht(this.restDecoder)}readBuf(){return k(this.restDecoder)}readJSON(){return Ht(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let e=this.stringDecoder.read();return this.keys.push(e),e}}},Gi=class{constructor(){this.restEncoder=ct()}toUint8Array(){return S(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){w(this.restEncoder,e)}writeDsLen(e){w(this.restEncoder,e)}},Ki=class extends Gi{writeLeftID(e){w(this.restEncoder,e.client),w(this.restEncoder,e.clock)}writeRightID(e){w(this.restEncoder,e.client),w(this.restEncoder,e.clock)}writeClient(e){w(this.restEncoder,e)}writeInfo(e){ft(this.restEncoder,e)}writeString(e){gt(this.restEncoder,e)}writeParentInfo(e){w(this.restEncoder,+!!e)}writeTypeRef(e){w(this.restEncoder,e)}writeLen(e){w(this.restEncoder,e)}writeAny(e){wt(this.restEncoder,e)}writeBuf(e){T(this.restEncoder,e)}writeJSON(e){gt(this.restEncoder,JSON.stringify(e))}writeKey(e){gt(this.restEncoder,e)}},qi=class{constructor(){this.restEncoder=ct(),this.dsCurrVal=0}toUint8Array(){return S(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let t=e-this.dsCurrVal;this.dsCurrVal=e,w(this.restEncoder,t)}writeDsLen(e){e===0&&O(),w(this.restEncoder,e-1),this.dsCurrVal+=e}},Ji=class extends qi{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new kt,this.clientEncoder=new Dt,this.leftClockEncoder=new kt,this.rightClockEncoder=new kt,this.infoEncoder=new Tt(ft),this.stringEncoder=new At,this.parentInfoEncoder=new Tt(ft),this.typeRefEncoder=new Dt,this.lenEncoder=new Dt}toUint8Array(){let e=ct();return w(e,0),T(e,this.keyClockEncoder.toUint8Array()),T(e,this.clientEncoder.toUint8Array()),T(e,this.leftClockEncoder.toUint8Array()),T(e,this.rightClockEncoder.toUint8Array()),T(e,S(this.infoEncoder)),T(e,this.stringEncoder.toUint8Array()),T(e,S(this.parentInfoEncoder)),T(e,this.typeRefEncoder.toUint8Array()),T(e,this.lenEncoder.toUint8Array()),_t(e,S(this.restEncoder)),S(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(+!!e)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){wt(this.restEncoder,e)}writeBuf(e){T(this.restEncoder,e)}writeJSON(e){wt(this.restEncoder,e)}writeKey(e){let t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}},Yi=(e,t,n,r)=>{r=Me(r,t[0].id.clock);let i=B(t,r);w(e.restEncoder,t.length-i),e.writeClient(n),w(e.restEncoder,r);let a=t[i];a.write(e,r-a.id.clock);for(let n=i+1;n<t.length;n++)t[n].write(e,0)},Xi=(e,t,n)=>{let r=new Map;n.forEach((e,n)=>{z(t,n)>e&&r.set(n,e)}),La(t).forEach((e,t)=>{n.has(t)||r.set(t,0)}),w(e.restEncoder,r.size),y(r.entries()).sort((e,t)=>t[0]-e[0]).forEach(([n,r])=>{Yi(e,t.clients.get(n),n,r)})},Zi=(e,t)=>{let n=g(),r=A(e.restDecoder);for(let i=0;i<r;i++){let r=A(e.restDecoder),i=Array(r),a=e.readClient(),o=A(e.restDecoder);n.set(a,{i:0,refs:i});for(let n=0;n<r;n++){let r=e.readInfo();switch(31&r){case 0:{let t=e.readLen();i[n]=new G(R(a,o),t),o+=t;break}case 10:{let t=A(e.restDecoder);i[n]=new Y(R(a,o),t),o+=t;break}default:{let s=(r&192)==0,c=new J(R(a,o),null,(r&128)==128?e.readLeftID():null,null,(r&64)==64?e.readRightID():null,s?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,s&&(r&32)==32?e.readString():null,ic(e,r));i[n]=c,o+=c.length}}}}return n},Qi=(e,t,n)=>{let r=[],i=y(n.keys()).sort((e,t)=>e-t);if(i.length===0)return null;let a=()=>{if(i.length===0)return null;let e=n.get(i[i.length-1]);for(;e.refs.length===e.i;)if(i.pop(),i.length>0)e=n.get(i[i.length-1]);else return null;return e},o=a();if(o===null)return null;let s=new Ia,c=new Map,l=(e,t)=>{let n=c.get(e);(n==null||n>t)&&c.set(e,t)},u=o.refs[o.i++],d=new Map,f=()=>{for(let e of r){let t=e.id.client,r=n.get(t);r?(r.i--,s.clients.set(t,r.refs.slice(r.i)),n.delete(t),r.i=0,r.refs=[]):s.clients.set(t,[e]),i=i.filter(e=>e!==t)}r.length=0};for(;;){if(u.constructor!==Y){let i=_(d,u.id.client,()=>z(t,u.id.client))-u.id.clock;if(i<0)r.push(u),l(u.id.client,u.id.clock-1),f();else{let a=u.getMissing(e,t);if(a!==null){r.push(u);let e=n.get(a)||{refs:[],i:0};if(e.refs.length===e.i)l(a,z(t,a)),f();else{u=e.refs[e.i++];continue}}else (i===0||i<u.length)&&(u.integrate(e,i),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(o!==null&&o.i<o.refs.length)u=o.refs[o.i++];else{if(o=a(),o===null)break;u=o.refs[o.i++]}}if(s.clients.size>0){let e=new Ji;return Xi(e,s,new Map),w(e.restEncoder,0),{missing:c,update:e.toUint8Array()}}return null},$i=(e,t)=>Xi(e,t.doc.store,t.beforeState),ea=(e,t,n,r=new Wi(e))=>H(t,e=>{e.local=!1;let t=!1,n=e.doc,i=n.store,a=Qi(e,i,Zi(r,n)),o=i.pendingStructs;if(o){for(let[e,n]of o.missing)if(n<z(i,e)){t=!0;break}if(a){for(let[e,t]of a.missing){let n=o.missing.get(e);(n==null||n>t)&&o.missing.set(e,t)}o.update=oo([o.update,a.update])}}else i.pendingStructs=a;let s=Ri(r,e,i);if(i.pendingDs){let t=new Wi(Pt(i.pendingDs));A(t.restDecoder);let n=Ri(t,e,i);s&&n?i.pendingDs=oo([s,n]):i.pendingDs=s||n}else i.pendingDs=s;if(t){let t=i.pendingStructs.update;i.pendingStructs=null,ta(e.doc,t)}},n,!1),ta=(e,t,n,r=Wi)=>{let i=Pt(t);ea(i,e,n,new r(i))},na=(e,t,n)=>ta(e,t,n,Hi),ra=(e,t,n=new Map)=>{Xi(e,t.store,n),Ii(e,Fi(t.store))},ia=(e,t=new Uint8Array([0]),n=new Ji)=>{ra(n,e,sa(t));let r=[n.toUint8Array()];if(e.store.pendingDs&&r.push(e.store.pendingDs),e.store.pendingStructs&&r.push(so(e.store.pendingStructs.update,t)),r.length>1){if(n.constructor===Ki)return io(r.map((e,t)=>t===0?e:po(e)));if(n.constructor===Ji)return oo(r)}return r[0]},aa=(e,t)=>ia(e,t,new Ki),oa=e=>{let t=new Map,n=A(e.restDecoder);for(let r=0;r<n;r++){let n=A(e.restDecoder),r=A(e.restDecoder);t.set(n,r)}return t},sa=e=>oa(new Vi(Pt(e))),ca=(e,t)=>(w(e.restEncoder,t.size),y(t.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{w(e.restEncoder,t),w(e.restEncoder,n)}),e),la=(e,t)=>ca(e,La(t.store)),ua=(e,t=new qi)=>(e instanceof Map?ca(t,e):la(t,e),t.toUint8Array()),da=e=>ua(e,new Gi),fa=class{constructor(){this.l=[]}},pa=()=>new fa,ma=(e,t)=>e.l.push(t),ha=(e,t)=>{let n=e.l,r=n.length;e.l=n.filter(e=>t!==e),r===e.l.length&&console.error(`[yjs] Tried to remove event handler that doesn't exist.`)},ga=(e,t,n)=>vn(e.l,[t,n]),_a=class{constructor(e,t){this.client=e,this.clock=t}},va=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,R=(e,t)=>new _a(e,t),ya=e=>{for(let[t,n]of e.doc.share.entries())if(n===e)return t;throw O()},ba=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1},xa=class{constructor(e,t,n,r=0){this.type=e,this.tname=t,this.item=n,this.assoc=r}},Sa=e=>{let t={};return e.type&&(t.type=e.type),e.tname&&(t.tname=e.tname),e.item&&(t.item=e.item),e.assoc!=null&&(t.assoc=e.assoc),t},Ca=e=>new xa(e.type==null?null:R(e.type.client,e.type.clock),e.tname??null,e.item==null?null:R(e.item.client,e.item.clock),e.assoc==null?0:e.assoc),wa=class{constructor(e,t,n=0){this.type=e,this.index=t,this.assoc=n}},Ta=(e,t,n=0)=>new wa(e,t,n),Ea=(e,t,n)=>{let r=null,i=null;return e._item===null?i=ya(e):r=R(e._item.id.client,e._item.id.clock),new xa(r,i,t,n)},Da=(e,t,n=0)=>{let r=e._start;if(n<0){if(t===0)return Ea(e,null,n);t--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>t)return Ea(e,R(r.id.client,r.id.clock+t),n);t-=r.length}if(r.right===null&&n<0)return Ea(e,r.lastId,n);r=r.right}return Ea(e,null,n)},Oa=(e,t)=>{let n=za(e,t);return{item:n,diff:t.clock-n.id.clock}},ka=(e,t,n=!0)=>{let r=t.store,i=e.item,a=e.type,o=e.tname,s=e.assoc,c=null,l=0;if(i!==null){if(z(r,i.client)<=i.clock)return null;let e=n?$s(r,i):Oa(r,i),t=e.item;if(!(t instanceof J))return null;if(c=t.parent,c._item===null||!c._item.deleted){l=t.deleted||!t.countable?0:e.diff+(s>=0?0:1);let n=t.left;for(;n!==null;)!n.deleted&&n.countable&&(l+=n.length),n=n.left}}else{if(o!==null)c=t.get(o);else if(a!==null){if(z(r,a.client)<=a.clock)return null;let{item:e}=n?$s(r,a):{item:za(r,a)};if(e instanceof J&&e.content instanceof q)c=e.content.type;else return null}else throw O();l=s>=0?c._length:0}return Ta(c,l,e.assoc)},Aa=(e,t)=>e===t||e!==null&&t!==null&&e.tname===t.tname&&va(e.item,t.item)&&va(e.type,t.type)&&e.assoc===t.assoc,ja=class{constructor(e,t){this.ds=e,this.sv=t}},Ma=(e,t)=>new ja(e,t);Ma(Pi(),new Map);var Na=e=>Ma(Fi(e.store),La(e.store)),Pa=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!Ai(t.ds,e.id),Fa=(e,t)=>{let n=_(e.meta,Fa,v),r=e.doc.store;n.has(t)||(t.sv.forEach((t,n)=>{t<z(r,n)&&V(e,R(n,t))}),Oi(e,t.ds,e=>{}),n.add(t))},Ia=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},La=e=>{let t=new Map;return e.clients.forEach((e,n)=>{let r=e[e.length-1];t.set(n,r.id.clock+r.length)}),t},z=(e,t)=>{let n=e.clients.get(t);if(n===void 0)return 0;let r=n[n.length-1];return r.id.clock+r.length},Ra=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{let e=n[n.length-1];if(e.id.clock+e.length!==t.id.clock)throw O()}n.push(t)},B=(e,t)=>{let n=0,r=e.length-1,i=e[r],a=i.id.clock;if(a===t)return r;let o=x(t/(a+i.length-1)*r);for(;n<=r;){if(i=e[o],a=i.id.clock,a<=t){if(t<a+i.length)return o;n=o+1}else r=o-1;o=x((n+r)/2)}throw O()},za=(e,t)=>{let n=e.clients.get(t.client);return n[B(n,t.clock)]},Ba=(e,t,n)=>{let r=B(t,n),i=t[r];return i.id.clock<n&&i instanceof J?(t.splice(r+1,0,tc(e,i,n-i.id.clock)),r+1):r},V=(e,t)=>{let n=e.doc.store.clients.get(t.client);return n[Ba(e,n,t.clock)]},Va=(e,t,n)=>{let r=t.clients.get(n.client),i=B(r,n.clock),a=r[i];return n.clock!==a.id.clock+a.length-1&&a.constructor!==G&&r.splice(i+1,0,tc(e,a,n.clock-a.id.clock+1)),a},Ha=(e,t,n)=>{let r=e.clients.get(t.id.client);r[B(r,t.id.clock)]=n},Ua=(e,t,n,r,i)=>{if(r===0)return;let a=n+r,o=Ba(e,t,n),s;do s=t[o++],a<s.id.clock+s.length&&Ba(e,t,a),i(s);while(o<t.length&&t[o].id.clock<a)},Wa=class{constructor(e,t,n){this.doc=e,this.deleteSet=new Di,this.beforeState=La(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},Ga=(e,t)=>t.deleteSet.clients.size===0&&!Se(t.afterState,(e,n)=>t.beforeState.get(n)!==e)?!1:(ji(t.deleteSet),$i(e,t),Ii(e,t.deleteSet),!0),Ka=(e,t,n)=>{let r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&_(e.changed,t,v).add(n)},qa=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0;n=r,r=e[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof J&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}let a=t-i;return a&&e.splice(t+1-a,a),a},Ja=(e,t,n)=>{for(let[r,i]of e.clients.entries()){let e=t.clients.get(r);for(let r=i.length-1;r>=0;r--){let a=i[r],o=a.clock+a.len;for(let r=B(e,a.clock),i=e[r];r<e.length&&i.id.clock<o;i=e[++r]){let i=e[r];if(a.clock+a.len<=i.id.clock)break;i instanceof J&&i.deleted&&!i.keep&&n(i)&&i.gc(t,!1)}}}},Ya=(e,t)=>{e.clients.forEach((e,n)=>{let r=t.clients.get(n);for(let t=e.length-1;t>=0;t--){let n=e[t],i=je(r.length-1,1+B(r,n.clock+n.len-1));for(let e=i,t=r[e];e>0&&t.id.clock>=n.clock;t=r[e])e-=1+qa(r,e)}})},Xa=(e,t)=>{if(t<e.length){let n=e[t],r=n.doc,i=r.store,a=n.deleteSet,o=n._mergeStructs;try{ji(a),n.afterState=La(n.doc.store),r.emit(`beforeObserverCalls`,[n,r]);let e=[];n.changed.forEach((t,r)=>e.push(()=>{(r._item===null||!r._item.deleted)&&r._callObserver(n,t)})),e.push(()=>{n.changedParentTypes.forEach((t,r)=>{r._dEH.l.length>0&&(r._item===null||!r._item.deleted)&&(t=t.filter(e=>e.target._item===null||!e.target._item.deleted),t.forEach(e=>{e.currentTarget=r,e._path=null}),t.sort((e,t)=>e.path.length-t.path.length),e.push(()=>{ga(r._dEH,t,n)}))}),e.push(()=>r.emit(`afterTransaction`,[n,r])),e.push(()=>{n._needFormattingCleanup&&us(n)})}),vn(e,[])}finally{r.gc&&Ja(a,i,r.gcFilter),Ya(a,i),n.afterState.forEach((e,t)=>{let r=n.beforeState.get(t)||0;if(r!==e){let e=i.clients.get(t),n=Me(B(e,r),1);for(let t=e.length-1;t>=n;)t-=1+qa(e,t)}});for(let e=o.length-1;e>=0;e--){let{client:t,clock:n}=o[e].id,r=i.clients.get(t),a=B(r,n);a+1<r.length&&qa(r,a+1)>1||a>0&&qa(r,a)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(bi(hi,ci,`[yjs] `,li,pi,`Changed the client-id because another client seems to be using it.`),r.clientID=zi()),r.emit(`afterTransactionCleanup`,[n,r]),r._observers.has(`update`)){let e=new Ki;Ga(e,n)&&r.emit(`update`,[e.toUint8Array(),n.origin,r,n])}if(r._observers.has(`updateV2`)){let e=new Ji;Ga(e,n)&&r.emit(`updateV2`,[e.toUint8Array(),n.origin,r,n])}let{subdocsAdded:s,subdocsLoaded:c,subdocsRemoved:l}=n;(s.size>0||l.size>0||c.size>0)&&(s.forEach(e=>{e.clientID=r.clientID,e.collectionid??=r.collectionid,r.subdocs.add(e)}),l.forEach(e=>r.subdocs.delete(e)),r.emit(`subdocs`,[{loaded:c,added:s,removed:l},r,n]),l.forEach(e=>e.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit(`afterAllTransactions`,[r,e])):Xa(e,t+1)}}},H=(e,t,n=null,r=!0)=>{let i=e._transactionCleanups,a=!1,o=null;e._transaction===null&&(a=!0,e._transaction=new Wa(e,n,r),i.push(e._transaction),i.length===1&&e.emit(`beforeAllTransactions`,[e]),e.emit(`beforeTransaction`,[e._transaction,e]));try{o=t(e._transaction)}finally{if(a){let t=e._transaction===i[0];e._transaction=null,t&&Xa(i,0)}}return o},Za=class{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}},Qa=(e,t,n)=>{Oi(e,n.deletions,n=>{n instanceof J&&t.scope.some(t=>t===e.doc||ba(t,n))&&ec(n,!1)})},$a=(e,t,n)=>{let r=null,i=e.doc,a=e.scope;H(i,n=>{for(;t.length>0&&e.currStackItem===null;){let r=i.store,o=t.pop(),s=new Set,c=[],l=!1;Oi(n,o.insertions,e=>{if(e instanceof J){if(e.redone!==null){let{item:t,diff:i}=$s(r,e.id);i>0&&(t=V(n,R(t.id.client,t.id.clock+i))),e=t}!e.deleted&&a.some(t=>t===n.doc||ba(t,e))&&c.push(e)}}),Oi(n,o.deletions,e=>{e instanceof J&&a.some(t=>t===n.doc||ba(t,e))&&!Ai(o.insertions,e.id)&&s.add(e)}),s.forEach(t=>{l=rc(n,t,s,o.insertions,e.ignoreRemoteMapChanges,e)!==null||l});for(let t=c.length-1;t>=0;t--){let r=c[t];e.deleteFilter(r)&&(r.delete(n),l=!0)}e.currStackItem=l?o:null}n.changed.forEach((e,t)=>{e.has(null)&&t._searchMarker&&(t._searchMarker.length=0)}),r=n},e);let o=e.currStackItem;if(o!=null){let t=r.changedParentTypes;e.emit(`stack-item-popped`,[{stackItem:o,type:n,changedParentTypes:t,origin:e},e]),e.currStackItem=null}return o},eo=class extends Oe{constructor(e,{captureTimeout:t=500,captureTransaction:n=e=>!0,deleteFilter:r=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:a=!1,doc:o=b(e)?e[0].doc:e instanceof Bi?e:e.doc}={}){super(),this.scope=[],this.doc=o,this.addToScope(e),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=a,this.captureTimeout=t,this.afterTransactionHandler=e=>{if(!this.captureTransaction(e)||!this.scope.some(t=>e.changedParentTypes.has(t)||t===this.doc)||!this.trackedOrigins.has(e.origin)&&(!e.origin||!this.trackedOrigins.has(e.origin.constructor)))return;let t=this.undoing,n=this.redoing,r=t?this.redoStack:this.undoStack;t?this.stopCapturing():n||this.clear(!1,!0);let i=new Di;e.afterState.forEach((t,n)=>{let r=e.beforeState.get(n)||0,a=t-r;a>0&&Ni(i,n,r,a)});let a=$t(),o=!1;if(this.lastChange>0&&a-this.lastChange<this.captureTimeout&&r.length>0&&!t&&!n){let t=r[r.length-1];t.deletions=Mi([t.deletions,e.deleteSet]),t.insertions=Mi([t.insertions,i])}else r.push(new Za(e.deleteSet,i)),o=!0;!t&&!n&&(this.lastChange=a),Oi(e,e.deleteSet,t=>{t instanceof J&&this.scope.some(n=>n===e.doc||ba(n,t))&&ec(t,!0)});let s=[{stackItem:r[r.length-1],origin:e.origin,type:t?`redo`:`undo`,changedParentTypes:e.changedParentTypes},this];o?this.emit(`stack-item-added`,s):this.emit(`stack-item-updated`,s)},this.doc.on(`afterTransaction`,this.afterTransactionHandler),this.doc.on(`destroy`,()=>{this.destroy()})}addToScope(e){let t=new Set(this.scope);e=b(e)?e:[e],e.forEach(e=>{t.has(e)||(t.add(e),(e instanceof W?e.doc!==this.doc:e!==this.doc)&&xi(`[yjs#509] Not same Y.Doc`),this.scope.push(e))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,t=!0){(e&&this.canUndo()||t&&this.canRedo())&&this.doc.transact(n=>{e&&(this.undoStack.forEach(e=>Qa(n,this,e)),this.undoStack=[]),t&&(this.redoStack.forEach(e=>Qa(n,this,e)),this.redoStack=[]),this.emit(`stack-cleared`,[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=$a(this,this.undoStack,`undo`)}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=$a(this,this.redoStack,`redo`)}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off(`afterTransaction`,this.afterTransactionHandler),super.destroy()}};function*to(e){let t=A(e.restDecoder);for(let n=0;n<t;n++){let t=A(e.restDecoder),n=e.readClient(),r=A(e.restDecoder);for(let i=0;i<t;i++){let t=e.readInfo();if(t===10){let t=A(e.restDecoder);yield new Y(R(n,r),t),r+=t}else if(31&t){let i=(t&192)==0,a=new J(R(n,r),null,(t&128)==128?e.readLeftID():null,null,(t&64)==64?e.readRightID():null,i?e.readParentInfo()?e.readString():e.readLeftID():null,i&&(t&32)==32?e.readString():null,ic(e,t));yield a,r+=a.length}else{let t=e.readLen();yield new G(R(n,r),t),r+=t}}}}var no=class{constructor(e,t){this.gen=to(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===Y);return this.curr}},ro=class{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}},io=e=>oo(e,Hi,Ki),ao=(e,t)=>{if(e.constructor===G){let{client:n,clock:r}=e.id;return new G(R(n,r+t),e.length-t)}else if(e.constructor===Y){let{client:n,clock:r}=e.id;return new Y(R(n,r+t),e.length-t)}else{let n=e,{client:r,clock:i}=n.id;return new J(R(r,i+t),null,R(r,i+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},oo=(e,t=Wi,n=Ji)=>{if(e.length===1)return e[0];let r=e.map(e=>new t(Pt(e))),i=r.map(e=>new no(e,!0)),a=null,o=new n,s=new ro(o);for(;i=i.filter(e=>e.curr!==null),i.sort((e,t)=>{if(e.curr.id.client===t.curr.id.client){let n=e.curr.id.clock-t.curr.id.clock;return n===0?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===Y?1:-1:n}else return t.curr.id.client-e.curr.id.client}),i.length!==0;){let e=i[0],t=e.curr.id.client;if(a!==null){let n=e.curr,r=!1;for(;n!==null&&n.id.clock+n.length<=a.struct.id.clock+a.struct.length&&n.id.client>=a.struct.id.client;)n=e.next(),r=!0;if(n===null||n.id.client!==t||r&&n.id.clock>a.struct.id.clock+a.struct.length)continue;if(t!==a.struct.id.client)lo(s,a.struct,a.offset),a={struct:n,offset:0},e.next();else if(a.struct.id.clock+a.struct.length<n.id.clock)if(a.struct.constructor===Y)a.struct.length=n.id.clock+n.length-a.struct.id.clock;else{lo(s,a.struct,a.offset);let e=n.id.clock-a.struct.id.clock-a.struct.length;a={struct:new Y(R(t,a.struct.id.clock+a.struct.length),e),offset:0}}else{let t=a.struct.id.clock+a.struct.length-n.id.clock;t>0&&(a.struct.constructor===Y?a.struct.length-=t:n=ao(n,t)),a.struct.mergeWith(n)||(lo(s,a.struct,a.offset),a={struct:n,offset:0},e.next())}}else a={struct:e.curr,offset:0},e.next();for(let n=e.curr;n!==null&&n.id.client===t&&n.id.clock===a.struct.id.clock+a.struct.length&&n.constructor!==Y;n=e.next())lo(s,a.struct,a.offset),a={struct:n,offset:0}}return a!==null&&(lo(s,a.struct,a.offset),a=null),uo(s),Ii(o,Mi(r.map(e=>Li(e)))),o.toUint8Array()},so=(e,t,n=Wi,r=Ji)=>{let i=sa(t),a=new r,o=new ro(a),s=new n(Pt(e)),c=new no(s,!1);for(;c.curr;){let e=c.curr,t=e.id.client,n=i.get(t)||0;if(c.curr.constructor===Y){c.next();continue}if(e.id.clock+e.length>n)for(lo(o,e,Me(n-e.id.clock,0)),c.next();c.curr&&c.curr.id.client===t;)lo(o,c.curr,0),c.next();else for(;c.curr&&c.curr.id.client===t&&c.curr.id.clock+c.curr.length<=n;)c.next()}return uo(o),Ii(a,Li(s)),a.toUint8Array()},co=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:S(e.encoder.restEncoder)}),e.encoder.restEncoder=ct(),e.written=0)},lo=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&co(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),w(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},uo=e=>{co(e);let t=e.encoder.restEncoder;w(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){let r=e.clientStructs[n];w(t,r.written),_t(t,r.restEncoder)}},fo=(e,t,n,r)=>{let i=new n(Pt(e)),a=new no(i,!1),o=new r,s=new ro(o);for(let e=a.curr;e!==null;e=a.next())lo(s,t(e),0);return uo(s),Ii(o,Li(i)),o.toUint8Array()},po=e=>fo(e,yn,Wi,Ki),mo=`You must not compute changes after the event-handler fired.`,ho=class{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||=go(this.currentTarget,this.target)}deletes(e){return Ai(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw E(mo);let e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){let r=t._map.get(n),i,a;if(this.adds(r)){let e=r.left;for(;e!==null&&this.adds(e);)e=e.left;if(this.deletes(r))if(e!==null&&this.deletes(e))i=`delete`,a=Ce(e.content.getContent());else return;else e!==null&&this.deletes(e)?(i=`update`,a=Ce(e.content.getContent())):(i=`add`,a=void 0)}else if(this.deletes(r))i=`delete`,a=Ce(r.content.getContent());else return;e.set(n,{action:i,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw E(mo);let t=this.target,n=v(),r=v(),i=[];if(e={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(t).has(null)){let e=null,a=()=>{e&&i.push(e)};for(let i=t._start;i!==null;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&((e===null||e.delete===void 0)&&(a(),e={delete:0}),e.delete+=i.length,r.add(i)):this.adds(i)?((e===null||e.insert===void 0)&&(a(),e={insert:[]}),e.insert=e.insert.concat(i.content.getContent()),n.add(i)):((e===null||e.retain===void 0)&&(a(),e={retain:0}),e.retain+=i.length);e!==null&&e.retain===void 0&&a()}this._changes=e}return e}},go=(e,t)=>{let n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let e=0,r=t._item.parent._start;for(;r!==t._item&&r!==null;)!r.deleted&&r.countable&&(e+=r.length),r=r.right;n.unshift(e)}t=t._item.parent}return n},U=()=>{xi(`Invalid access: Add Yjs type to a document before reading data.`)},_o=80,vo=0,yo=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=vo++}},bo=e=>{e.timestamp=vo++},xo=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=vo++},So=(e,t,n)=>{if(e.length>=_o){let r=e.reduce((e,t)=>e.timestamp<t.timestamp?e:t);return xo(r,t,n),r}else{let r=new yo(t,n);return e.push(r),r}},Co=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;let n=e._searchMarker.length===0?null:e._searchMarker.reduce((e,n)=>Ae(t-e.index)<Ae(t-n.index)?e:n),r=e._start,i=0;for(n!==null&&(r=n.p,i=n.index,bo(n));r.right!==null&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>t;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&Ae(n.index-i)<r.parent.length/_o?(xo(n,r,i),n):So(e._searchMarker,r,i)},wo=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){let i=e[r];if(n>0){let t=i.p;for(t.marker=!1;t&&(t.deleted||!t.countable);)t=t.left,t&&!t.deleted&&t.countable&&(i.index-=t.length);if(t===null||t.marker===!0){e.splice(r,1);continue}i.p=t,t.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=Me(t,i.index+n))}},To=(e,t,n)=>{let r=e,i=t.changedParentTypes;for(;_(i,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;ga(r._eH,n,t)},W=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=pa(),this._dEH=pa(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw D()}clone(){throw D()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){ma(this._eH,e)}observeDeep(e){ma(this._dEH,e)}unobserve(e){ha(this._eH,e)}unobserveDeep(e){ha(this._dEH,e)}toJSON(){}},Eo=(e,t,n)=>{e.doc??U(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t,i=[],a=e._start;for(;a!==null&&r>0;){if(a.countable&&!a.deleted){let e=a.content.getContent();if(e.length<=t)t-=e.length;else{for(let n=t;n<e.length&&r>0;n++)i.push(e[n]),r--;t=0}}a=a.right}return i},Do=e=>{e.doc??U();let t=[],n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){let e=n.content.getContent();for(let n=0;n<e.length;n++)t.push(e[n])}n=n.right}return t},Oo=(e,t)=>{let n=[],r=e._start;for(;r!==null;){if(r.countable&&Pa(r,t)){let e=r.content.getContent();for(let t=0;t<e.length;t++)n.push(e[t])}r=r.right}return n},ko=(e,t)=>{let n=0,r=e._start;for(e.doc??U();r!==null;){if(r.countable&&!r.deleted){let i=r.content.getContent();for(let r=0;r<i.length;r++)t(i[r],n++,e)}r=r.right}},Ao=(e,t)=>{let n=[];return ko(e,(r,i)=>{n.push(t(r,i,e))}),n},jo=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}let e=n[r++];return n.length<=r&&(n=null),{done:!1,value:e}}}},Mo=(e,t)=>{e.doc??U();let n=Co(e,t),r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},No=(e,t,n,r)=>{let i=n,a=e.doc,o=a.clientID,s=a.store,c=n===null?t._start:n.right,l=[],u=()=>{l.length>0&&(i=new J(R(o,z(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Bs(l)),i.integrate(e,0),l=[])};r.forEach(n=>{if(n===null)l.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(n);break;default:switch(u(),n.constructor){case Uint8Array:case ArrayBuffer:i=new J(R(o,z(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Ds(new Uint8Array(n))),i.integrate(e,0);break;case Bi:i=new J(R(o,z(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Ms(n)),i.integrate(e,0);break;default:if(n instanceof W)i=new J(R(o,z(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new q(n)),i.integrate(e,0);else throw Error(`Unexpected content type in insert operation`)}}}),u()},Po=()=>E(`Length exceeded!`),Fo=(e,t,n,r)=>{if(n>t._length)throw Po();if(n===0)return t._searchMarker&&wo(t._searchMarker,n,r.length),No(e,t,null,r);let i=n,a=Co(t,n),o=t._start;for(a!==null&&(o=a.p,n-=a.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&V(e,R(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&wo(t._searchMarker,i,r.length),No(e,t,o,r)},Io=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((e,t)=>t.index>e.index?t:e,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return No(e,t,r,n)},Lo=(e,t,n,r)=>{if(r===0)return;let i=n,a=r,o=Co(t,n),s=t._start;for(o!==null&&(s=o.p,n-=o.index);s!==null&&n>0;s=s.right)!s.deleted&&s.countable&&(n<s.length&&V(e,R(s.id.client,s.id.clock+n)),n-=s.length);for(;r>0&&s!==null;)s.deleted||(r<s.length&&V(e,R(s.id.client,s.id.clock+r)),s.delete(e),r-=s.length),s=s.right;if(r>0)throw Po();t._searchMarker&&wo(t._searchMarker,i,-a+r)},Ro=(e,t,n)=>{let r=t._map.get(n);r!==void 0&&r.delete(e)},zo=(e,t,n,r)=>{let i=t._map.get(n)||null,a=e.doc,o=a.clientID,s;if(r==null)s=new Bs([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:s=new Bs([r]);break;case Uint8Array:s=new Ds(r);break;case Bi:s=new Ms(r);break;default:if(r instanceof W)s=new q(r);else throw Error(`Unexpected content type`)}new J(R(o,z(a.store,o)),i,i&&i.lastId,null,null,t,n,s).integrate(e,0)},Bo=(e,t)=>{e.doc??U();let n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},Vo=e=>{let t={};return e.doc??U(),e._map.forEach((e,n)=>{e.deleted||(t[n]=e.content.getContent()[e.length-1])}),t},Ho=(e,t)=>{e.doc??U();let n=e._map.get(t);return n!==void 0&&!n.deleted},Uo=(e,t)=>{let n={};return e._map.forEach((e,r)=>{let i=e;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&Pa(i,t)&&(n[r]=i.content.getContent()[i.length-1])}),n},Wo=e=>(e.doc??U(),wi(e._map.entries(),e=>!e[1].deleted)),Go=class extends ho{},Ko=class e extends W{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let n=new e;return n.push(t),n}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof W?e.clone():e)),t}get length(){return this.doc??U(),this._length}_callObserver(e,t){super._callObserver(e,t),To(this,e,new Go(this,e))}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):H(this.doc,n=>{Fo(n,this,e,t)})}push(e){this.doc===null?this._prelimContent.push(...e):H(this.doc,t=>{Io(t,this,e)})}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):H(this.doc,n=>{Lo(n,this,e,t)})}get(e){return Mo(this,e)}toArray(){return Do(this)}slice(e=0,t=this.length){return Eo(this,e,t)}toJSON(){return this.map(e=>e instanceof W?e.toJSON():e)}map(e){return Ao(this,e)}forEach(e){ko(this,e)}[Symbol.iterator](){return jo(this)}_write(e){e.writeTypeRef(Gs)}},qo=e=>new Ko,Jo=class extends ho{constructor(e,t,n){super(e,t),this.keysChanged=n}},Yo=class e extends W{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((e,t)=>{this.set(t,e)}),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return this.forEach((e,n)=>{t.set(n,e instanceof W?e.clone():e)}),t}_callObserver(e,t){To(this,e,new Jo(this,e,t))}toJSON(){this.doc??U();let e={};return this._map.forEach((t,n)=>{if(!t.deleted){let r=t.content.getContent()[t.length-1];e[n]=r instanceof W?r.toJSON():r}}),e}get size(){return[...Wo(this)].length}keys(){return Ti(Wo(this),e=>e[0])}values(){return Ti(Wo(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Ti(Wo(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??U(),this._map.forEach((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc===null?this._prelimContent.delete(e):H(this.doc,t=>{Ro(t,this,e)})}set(e,t){return this.doc===null?this._prelimContent.set(e,t):H(this.doc,n=>{zo(n,this,e,t)}),t}get(e){return Bo(this,e)}has(e){return Ho(this,e)}clear(){this.doc===null?this._prelimContent.clear():H(this.doc,e=>{this.forEach(function(t,n,r){Ro(e,r,n)})})}_write(e){e.writeTypeRef(Ks)}},Xo=e=>new Yo,Zo=(e,t)=>e===t||typeof e==`object`&&typeof t==`object`&&e&&t&&hn(e,t),Qo=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){switch(this.right===null&&O(),this.right.content.constructor){case K:this.right.deleted||ns(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}},$o=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case K:t.right.deleted||ns(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&V(e,R(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length);break}t.left=t.right,t.right=t.right.right}return t},es=(e,t,n,r)=>{let i=new Map,a=r?Co(t,n):null;return a?$o(e,new Qo(a.p.left,a.p,a.index,i),n-a.index):$o(e,new Qo(null,t._start,0,i),n)},ts=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===K&&Zo(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();let i=e.doc,a=i.clientID;r.forEach((r,o)=>{let s=n.left,c=n.right,l=new J(R(a,z(i.store,a)),s,s&&s.lastId,c,c&&c.id,t,null,new K(o,r));l.integrate(e,0),n.right=l,n.forward()})},ns=(e,t)=>{let{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},rs=(e,t)=>{for(;e.right!==null&&(e.right.deleted||e.right.content.constructor===K&&Zo(t[e.right.content.key]??null,e.right.content.value));)e.forward()},is=(e,t,n,r)=>{let i=e.doc,a=i.clientID,o=new Map;for(let s in r){let c=r[s],l=n.currentAttributes.get(s)??null;if(!Zo(l,c)){o.set(s,l);let{left:r,right:u}=n;n.right=new J(R(a,z(i.store,a)),r,r&&r.lastId,u,u&&u.id,t,null,new K(s,c)),n.right.integrate(e,0),n.forward()}}return o},as=(e,t,n,r,i)=>{n.currentAttributes.forEach((e,t)=>{i[t]===void 0&&(i[t]=null)});let a=e.doc,o=a.clientID;rs(n,i);let s=is(e,t,n,i),c=r.constructor===String?new Hs(r):r instanceof W?new q(r):new Ps(r),{left:l,right:u,index:d}=n;t._searchMarker&&wo(t._searchMarker,n.index,c.getLength()),u=new J(R(o,z(a.store,o)),l,l&&l.lastId,u,u&&u.id,t,null,c),u.integrate(e,0),n.right=u,n.index=d,n.forward(),ts(e,t,n,s)},os=(e,t,n,r,i)=>{let a=e.doc,o=a.clientID;rs(n,i);let s=is(e,t,n,i);iterationLoop:for(;n.right!==null&&(r>0||s.size>0&&(n.right.deleted||n.right.content.constructor===K));){if(!n.right.deleted)switch(n.right.content.constructor){case K:{let{key:t,value:a}=n.right.content,o=i[t];if(o!==void 0){if(Zo(o,a))s.delete(t);else{if(r===0)break iterationLoop;s.set(t,a)}n.right.delete(e)}else n.currentAttributes.set(t,a);break}default:r<n.right.length&&V(e,R(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let i=``;for(;r>0;r--)i+=`
4
- `;n.right=new J(R(o,z(a.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new Hs(i)),n.right.integrate(e,0),n.forward()}ts(e,t,n,s)},ss=(e,t,n,r,i)=>{let a=t,o=g();for(;a&&(!a.countable||a.deleted);){if(!a.deleted&&a.content.constructor===K){let e=a.content;o.set(e.key,e)}a=a.right}let s=0,c=!1;for(;t!==a;){if(n===t&&(c=!0),!t.deleted){let n=t.content;switch(n.constructor){case K:{let{key:a,value:l}=n,u=r.get(a)??null;(o.get(a)!==n||u===l)&&(t.delete(e),s++,!c&&(i.get(a)??null)===l&&u!==l&&(u===null?i.delete(a):i.set(a,u))),!c&&!t.deleted&&ns(i,n);break}}}t=t.right}return s},cs=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;let n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===K){let r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},ls=e=>{let t=0;return H(e.doc,n=>{let r=e._start,i=e._start,a=g(),o=be(a);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case K:ns(o,i.content);break;default:t+=ss(n,r,i,a,o),a=be(o),r=i;break}i=i.right}}),t},us=e=>{let t=new Set,n=e.doc;for(let[r,i]of e.afterState.entries()){let a=e.beforeState.get(r)||0;i!==a&&Ua(e,n.store.clients.get(r),a,i,e=>{!e.deleted&&e.content.constructor===K&&e.constructor!==G&&t.add(e.parent)})}H(n,n=>{Oi(e,e.deleteSet,e=>{if(e instanceof G||!e.parent._hasFormatting||t.has(e.parent))return;let r=e.parent;e.content.constructor===K?t.add(r):cs(n,e)});for(let e of t)ls(e)})},ds=(e,t,n)=>{let r=n,i=be(t.currentAttributes),a=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case q:case Ps:case Hs:n<t.right.length&&V(e,R(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}a&&ss(e,a,t.right,i,t.currentAttributes);let o=(t.left||t.right).parent;return o._searchMarker&&wo(o._searchMarker,t.index,-r+n),t},fs=class extends ho{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(e=>{e===null?this.childListChanged=!0:this.keysChanged.add(e)})}get changes(){return this._changes===null&&(this._changes={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set}),this._changes}get delta(){if(this._delta===null){let e=this.target.doc,t=[];H(e,e=>{let n=new Map,r=new Map,i=this.target._start,a=null,o={},s=``,c=0,l=0,u=()=>{if(a!==null){let e=null;switch(a){case`delete`:l>0&&(e={delete:l}),l=0;break;case`insert`:(typeof s==`object`||s.length>0)&&(e={insert:s},n.size>0&&(e.attributes={},n.forEach((t,n)=>{t!==null&&(e.attributes[n]=t)}))),s=``;break;case`retain`:c>0&&(e={retain:c},fn(o)||(e.attributes=cn({},o))),c=0;break}e&&t.push(e),a=null}};for(;i!==null;){switch(i.content.constructor){case q:case Ps:this.adds(i)?this.deletes(i)||(u(),a=`insert`,s=i.content.getContent()[0],u()):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=1):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=1);break;case Hs:this.adds(i)?this.deletes(i)||(a!==`insert`&&(u(),a=`insert`),s+=i.content.str):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=i.length):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=i.length);break;case K:{let{key:t,value:s}=i.content;if(this.adds(i))this.deletes(i)||(Zo(n.get(t)??null,s)?s!==null&&i.delete(e):(a===`retain`&&u(),Zo(s,r.get(t)??null)?delete o[t]:o[t]=s));else if(this.deletes(i)){r.set(t,s);let e=n.get(t)??null;Zo(e,s)||(a===`retain`&&u(),o[t]=e)}else if(!i.deleted){r.set(t,s);let n=o[t];n!==void 0&&(Zo(n,s)?n!==null&&i.delete(e):(a===`retain`&&u(),s===null?delete o[t]:o[t]=s))}i.deleted||(a===`insert`&&u(),ns(n,i.content));break}}i=i.right}for(u();t.length>0;){let e=t[t.length-1];if(e.retain!==void 0&&e.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},ps=class e extends W{constructor(e){super(),this._pending=e===void 0?[]:[()=>this.insert(0,e)],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??U(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(e=>e())}catch(e){console.error(e)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(e,t){super._callObserver(e,t);let n=new fs(this,e,t);To(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??U();let e=``,t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===Hs&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc===null?this._pending.push(()=>this.applyDelta(e)):H(this.doc,n=>{let r=new Qo(null,this._start,0,new Map);for(let i=0;i<e.length;i++){let a=e[i];if(a.insert!==void 0){let o=!t&&typeof a.insert==`string`&&i===e.length-1&&r.right===null&&a.insert.slice(-1)===`
5
- `?a.insert.slice(0,-1):a.insert;(typeof o!=`string`||o.length>0)&&as(n,this,r,o,a.attributes||{})}else a.retain===void 0?a.delete!==void 0&&ds(n,r,a.delete):os(n,this,r,a.retain,a.attributes||{})}})}toDelta(e,t,n){this.doc??U();let r=[],i=new Map,a=this.doc,o=``,s=this._start;function c(){if(o.length>0){let e={},t=!1;i.forEach((n,r)=>{t=!0,e[r]=n});let n={insert:o};t&&(n.attributes=e),r.push(n),o=``}}let l=()=>{for(;s!==null;){if(Pa(s,e)||t!==void 0&&Pa(s,t))switch(s.content.constructor){case Hs:{let r=i.get(`ychange`);e!==void 0&&!Pa(s,e)?(r===void 0||r.user!==s.id.client||r.type!==`removed`)&&(c(),i.set(`ychange`,n?n(`removed`,s.id):{type:`removed`})):t!==void 0&&!Pa(s,t)?(r===void 0||r.user!==s.id.client||r.type!==`added`)&&(c(),i.set(`ychange`,n?n(`added`,s.id):{type:`added`})):r!==void 0&&(c(),i.delete(`ychange`)),o+=s.content.str;break}case q:case Ps:{c();let e={insert:s.content.getContent()[0]};if(i.size>0){let t={};e.attributes=t,i.forEach((e,n)=>{t[n]=e})}r.push(e);break}case K:Pa(s,e)&&(c(),ns(i,s.content));break}s=s.right}c()};return e||t?H(a,n=>{e&&Fa(n,e),t&&Fa(n,t),l()},`cleanup`):l(),r}insert(e,t,n){if(t.length<=0)return;let r=this.doc;r===null?this._pending.push(()=>this.insert(e,t,n)):H(r,r=>{let i=es(r,this,e,!n);n||(n={},i.currentAttributes.forEach((e,t)=>{n[t]=e})),as(r,this,i,t,n)})}insertEmbed(e,t,n){let r=this.doc;r===null?this._pending.push(()=>this.insertEmbed(e,t,n||{})):H(r,r=>{let i=es(r,this,e,!n);as(r,this,i,t,n||{})})}delete(e,t){if(t===0)return;let n=this.doc;n===null?this._pending.push(()=>this.delete(e,t)):H(n,n=>{ds(n,es(n,this,e,!0),t)})}format(e,t,n){if(t===0)return;let r=this.doc;r===null?this._pending.push(()=>this.format(e,t,n)):H(r,r=>{let i=es(r,this,e,!1);i.right!==null&&os(r,this,i,t,n)})}removeAttribute(e){this.doc===null?this._pending.push(()=>this.removeAttribute(e)):H(this.doc,t=>{Ro(t,this,e)})}setAttribute(e,t){this.doc===null?this._pending.push(()=>this.setAttribute(e,t)):H(this.doc,n=>{zo(n,this,e,t)})}getAttribute(e){return Bo(this,e)}getAttributes(){return Vo(this)}_write(e){e.writeTypeRef(qs)}},ms=e=>new ps,hs=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??U()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===vs||t.constructor===gs)&&t._start!==null)e=t._start;else for(;e!==null;){let t=e.next;if(t!==null){e=t;break}else e=e.parent===this._root?null:e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},gs=class e extends W{constructor(){super(),this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof W?e.clone():e)),t}get length(){return this.doc??U(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new hs(this,e)}querySelector(e){e=e.toUpperCase();let t=new hs(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),y(new hs(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){To(this,e,new bs(this,t,e))}toString(){return Ao(this,e=>e.toString()).join(``)}toJSON(){return this.toString()}toDOM(e=document,t={},n){let r=e.createDocumentFragment();return n!==void 0&&n._createAssociation(r,this),ko(this,i=>{r.insertBefore(i.toDOM(e,t,n),null)}),r}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):H(this.doc,n=>{Fo(n,this,e,t)})}insertAfter(e,t){if(this.doc!==null)H(this.doc,n=>{let r=e&&e instanceof W?e._item:e;No(n,this,r,t)});else{let n=this._prelimContent,r=e===null?0:n.findIndex(t=>t===e)+1;if(r===0&&e!==null)throw E(`Reference item not found`);n.splice(r,0,...t)}}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):H(this.doc,n=>{Lo(n,this,e,t)})}toArray(){return Do(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Mo(this,e)}slice(e=0,t=this.length){return Eo(this,e,t)}forEach(e){ko(this,e)}_write(e){e.writeTypeRef(Ys)}},_s=e=>new gs,vs=class e extends gs{constructor(e=`UNDEFINED`){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((e,t)=>{this.setAttribute(t,e)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName);return un(this.getAttributes(),(e,n)=>{t.setAttribute(n,e)}),t.insert(0,this.toArray().map(e=>e instanceof W?e.clone():e)),t}toString(){let e=this.getAttributes(),t=[],n=[];for(let t in e)n.push(t);n.sort();let r=n.length;for(let i=0;i<r;i++){let r=n[i];t.push(r+`="`+e[r]+`"`)}let i=this.nodeName.toLocaleLowerCase();return`<${i}${t.length>0?` `+t.join(` `):``}>${super.toString()}</${i}>`}removeAttribute(e){this.doc===null?this._prelimAttrs.delete(e):H(this.doc,t=>{Ro(t,this,e)})}setAttribute(e,t){this.doc===null?this._prelimAttrs.set(e,t):H(this.doc,n=>{zo(n,this,e,t)})}getAttribute(e){return Bo(this,e)}hasAttribute(e){return Ho(this,e)}getAttributes(e){return e?Uo(this,e):Vo(this)}toDOM(e=document,t={},n){let r=e.createElement(this.nodeName),i=this.getAttributes();for(let e in i){let t=i[e];typeof t==`string`&&r.setAttribute(e,t)}return ko(this,i=>{r.appendChild(i.toDOM(e,t,n))}),n!==void 0&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(Js),e.writeKey(this.nodeName)}},ys=e=>new vs(e.readKey()),bs=class extends ho{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(e=>{e===null?this.childListChanged=!0:this.attributesChanged.add(e)})}},xs=class e extends Yo{constructor(e){super(),this.hookName=e}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((e,n)=>{t.set(n,e)}),t}toDOM(e=document,t={},n){let r=t[this.hookName],i;return i=r===void 0?document.createElement(this.hookName):r.createDom(this),i.setAttribute(`data-yjs-hook`,this.hookName),n!==void 0&&n._createAssociation(i,this),i}_write(e){e.writeTypeRef(Xs),e.writeKey(this.hookName)}},Ss=e=>new xs(e.readKey()),Cs=class e extends ps{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(e=document,t,n){let r=e.createTextNode(this.toString());return n!==void 0&&n._createAssociation(r,this),r}toString(){return this.toDelta().map(e=>{let t=[];for(let n in e.attributes){let r=[];for(let t in e.attributes[n])r.push({key:t,value:e.attributes[n][t]});r.sort((e,t)=>e.key<t.key?-1:1),t.push({nodeName:n,attrs:r})}t.sort((e,t)=>e.nodeName<t.nodeName?-1:1);let n=``;for(let e=0;e<t.length;e++){let r=t[e];n+=`<${r.nodeName}`;for(let e=0;e<r.attrs.length;e++){let t=r.attrs[e];n+=` ${t.key}="${t.value}"`}n+=`>`}n+=e.insert;for(let e=t.length-1;e>=0;e--)n+=`</${t[e].nodeName}>`;return n}).join(``)}toJSON(){return this.toString()}_write(e){e.writeTypeRef(Zs)}},ws=e=>new Cs,Ts=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw D()}mergeWith(e){return!1}write(e,t,n){throw D()}integrate(e,t){throw D()}},Es=0,G=class extends Ts{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor?(this.length+=e.length,!0):!1}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),Ra(e.doc.store,this)}write(e,t){e.writeInfo(Es),e.writeLen(this.length-t)}getMissing(e,t){return null}},Ds=class e{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(e){throw D()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}},Os=e=>new Ds(e.readBuf()),ks=class e{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let n=new e(this.len-t);return this.len=t,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){Ni(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}},As=e=>new ks(e.readLen()),js=(e,t)=>new Bi({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),Ms=class e{constructor(e){e._item&&console.error(`This document was already integrated as a sub-document. You should create a second instance instead with the same guid.`),this.doc=e;let t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new e(js(this.doc.guid,this.opts))}splice(e){throw D()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}},Ns=e=>new Ms(js(e.readString(),e.readAny())),Ps=class e{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(e){throw D()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}},Fs=e=>new Ps(e.readJSON()),K=class e{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(e){throw D()}mergeWith(e){return!1}integrate(e,t){let n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}},Is=e=>new K(e.readKey(),e.readJSON()),Ls=class e{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeString(t===void 0?`undefined`:JSON.stringify(t))}}getRef(){return 2}},Rs=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++){let t=e.readString();t===`undefined`?n.push(void 0):n.push(JSON.parse(t))}return new Ls(n)},zs=Dn(`node_env`)===`development`,Bs=class e{constructor(e){this.arr=e,zs&&_n(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeAny(t)}}getRef(){return 8}},Vs=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new Bs(n)},Hs=class e{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split(``)}isCountable(){return!0}copy(){return new e(this.str)}splice(t){let n=new e(this.str.slice(t));this.str=this.str.slice(0,t);let r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+`�`,n.str=`�`+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}},Us=e=>new Hs(e.readString()),Ws=[qo,Xo,ms,ys,_s,Ss,ws],Gs=0,Ks=1,qs=2,Js=3,Ys=4,Xs=5,Zs=6,q=class e{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(e){throw D()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(t=>{for(;t!==null;)t.gc(e,!0),t=t.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}},Qs=e=>new q(Ws[e.readTypeRef()](e)),$s=(e,t)=>{let n=t,r=0,i;do r>0&&(n=R(n.client,n.clock+r)),i=za(e,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof J);return{item:i,diff:r}},ec=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},tc=(e,t,n)=>{let{client:r,clock:i}=t.id,a=new J(R(r,i+n),t,R(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&a.markDeleted(),t.keep&&(a.keep=!0),t.redone!==null&&(a.redone=R(t.redone.client,t.redone.clock+n)),t.right=a,a.right!==null&&(a.right.left=a),e._mergeStructs.push(a),a.parentSub!==null&&a.right===null&&a.parent._map.set(a.parentSub,a),t.length=n,a},nc=(e,t)=>Ee(e,e=>Ai(e.deletions,t)),rc=(e,t,n,r,i,a)=>{let o=e.doc,s=o.store,c=o.clientID,l=t.redone;if(l!==null)return V(e,l);let u=t.parent._item,d=null,f;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||rc(e,u,n,r,i,a)===null))return null;for(;u.redone!==null;)u=V(e,u.redone)}let ee=u===null?t.parent:u.content.type;if(t.parentSub===null){for(d=t.left,f=t;d!==null;){let t=d;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:V(e,t.redone);if(t!==null&&t.parent._item===u){d=t;break}d=d.left}for(;f!==null;){let t=f;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:V(e,t.redone);if(t!==null&&t.parent._item===u){f=t;break}f=f.right}}else{if(f=null,t.right&&!i){for(d=t;d!==null&&d.right!==null&&(d.right.redone||Ai(r,d.right.id)||nc(a.undoStack,d.right.id)||nc(a.redoStack,d.right.id));)for(d=d.right;d.redone;)d=V(e,d.redone);if(d&&d.right!==null)return null}else d=ee._map.get(t.parentSub)||null;d!==null&&d.parent._item!==u&&(d=ee._map.get(t.parentSub)||null)}let te=R(c,z(s,c)),p=new J(te,d,d&&d.lastId,f,f&&f.id,ee,t.parentSub,t.content.copy());return t.redone=te,ec(p,!0),p.integrate(e,0),p},J=class e extends Ts{constructor(e,t,n,r,i,a,o,s){super(e,s.getLength()),this.origin=n,this.left=t,this.right=r,this.rightOrigin=i,this.parent=a,this.parentSub=o,this.redone=null,this.content=s,this.info=this.content.isCountable()?2:0}set marker(e){(this.info&8)>0!==e&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=z(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=z(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===_a&&this.id.client!==this.parent.client&&this.parent.clock>=z(n,this.parent.client))return this.parent.client;if(this.origin&&=(this.left=Va(t,n,this.origin),this.left.lastId),this.rightOrigin&&=(this.right=V(t,this.rightOrigin),this.right.id),this.left&&this.left.constructor===G||this.right&&this.right.constructor===G)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===e?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===e&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===_a){let e=za(n,this.parent);e.constructor===G?this.parent=null:this.parent=e.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=Va(e,e.doc.store,R(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let t=this.left,n;if(t!==null)n=t.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,i=new Set;for(;n!==null&&n!==this.right;){if(i.add(n),r.add(n),va(this.origin,n.origin)){if(n.id.client<this.id.client)t=n,r.clear();else if(va(this.rightOrigin,n.rightOrigin))break}else if(n.origin!==null&&i.has(za(e.doc.store,n.origin)))r.has(za(e.doc.store,n.origin))||(t=n,r.clear());else break;n=n.right}this.left=t}if(this.left!==null)this.right=this.left.right,this.left.right=this;else{let e;if(this.parentSub!==null)for(e=this.parent._map.get(this.parentSub)||null;e!==null&&e.left!==null;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e}this.right===null?this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)):this.right.left=this,this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Ra(e.doc.store,this),this.content.integrate(e,this),Ka(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new G(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:R(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&va(e.origin,this.lastId)&&this.right===e&&va(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){let t=this.parent._searchMarker;return t&&t.forEach(t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){let t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),Ni(e.deleteSet,this.id.client,this.id.clock,this.length),Ka(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw O();this.content.gc(e),t?Ha(e,this,new G(this.id,this.length)):this.content=new ks(this.length)}write(e,t){let n=t>0?R(this.id.client,this.id.clock+t-1):this.origin,r=this.rightOrigin,i=this.parentSub,a=this.content.getRef()&31|(n===null?0:128)|(r===null?0:64)|(i===null?0:32);if(e.writeInfo(a),n!==null&&e.writeLeftID(n),r!==null&&e.writeRightID(r),n===null&&r===null){let t=this.parent;if(t._item!==void 0){let n=t._item;if(n===null){let n=ya(t);e.writeParentInfo(!0),e.writeString(n)}else e.writeParentInfo(!1),e.writeLeftID(n.id)}else t.constructor===String?(e.writeParentInfo(!0),e.writeString(t)):t.constructor===_a?(e.writeParentInfo(!1),e.writeLeftID(t)):O();i!==null&&e.writeString(i)}this.content.write(e,t)}},ic=(e,t)=>ac[t&31](e),ac=[()=>{O()},As,Rs,Os,Us,Fs,Is,Qs,Vs,Ns,()=>{O()}],oc=10,Y=class extends Ts{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor?(this.length+=e.length,!0):!1}integrate(e,t){O()}write(e,t){e.writeInfo(oc),w(e.restEncoder,this.length-t)}getMissing(e,t){return null}},sc=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:{},cc=`__ $YJS$ __`;sc[cc]===!0&&console.error(`Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438`),sc[cc]=!0;var lc=function(e){return e[e.Token=0]=`Token`,e[e.PermissionDenied=1]=`PermissionDenied`,e[e.Authenticated=2]=`Authenticated`,e}({}),uc=(e,t)=>{w(e,lc.Token),gt(e,t)},dc=(e,t,n,r)=>{switch(A(e)){case lc.Token:t();break;case lc.PermissionDenied:n(zt(e));break;case lc.Authenticated:r(zt(e));break;default:}},fc=e=>Array.from(e.entries()).map(([e,t])=>({clientId:e,...t})),pc=`\0`;function mc(e,t){return e+pc+t}function hc(e){let t=e.indexOf(pc);return t===-1?{documentName:e,sessionId:null}:{documentName:e.substring(0,t),sessionId:e.substring(t+1)}}var gc=function(e){return e[e.Connecting=0]=`Connecting`,e[e.Open=1]=`Open`,e[e.Closing=2]=`Closing`,e[e.Closed=3]=`Closed`,e}({});function _c(e){return e||={},{delay:e.delay===void 0?200:e.delay,initialDelay:e.initialDelay===void 0?0:e.initialDelay,minDelay:e.minDelay===void 0?0:e.minDelay,maxDelay:e.maxDelay===void 0?0:e.maxDelay,factor:e.factor===void 0?0:e.factor,maxAttempts:e.maxAttempts===void 0?3:e.maxAttempts,timeout:e.timeout===void 0?0:e.timeout,jitter:e.jitter===!0,initialJitter:e.initialJitter===!0,handleError:e.handleError===void 0?null:e.handleError,handleTimeout:e.handleTimeout===void 0?null:e.handleTimeout,beforeAttempt:e.beforeAttempt===void 0?null:e.beforeAttempt,calculateDelay:e.calculateDelay===void 0?null:e.calculateDelay}}async function vc(e){return new Promise(t=>setTimeout(t,e))}function yc(e,t){let n=t.delay;if(n===0)return 0;if(t.factor&&(n*=t.factor**(e.attemptNum-1),t.maxDelay!==0&&(n=Math.min(n,t.maxDelay))),t.jitter){let e=Math.ceil(t.minDelay);n=Math.floor(Math.random()*(Math.floor(n)-e+1))+e}return Math.round(n)}async function bc(e,t){let n=_c(t);for(let e of[`delay`,`initialDelay`,`minDelay`,`maxDelay`,`maxAttempts`,`timeout`]){let t=n[e];if(!Number.isInteger(t)||t<0)throw Error(`Value for ${e} must be an integer greater than or equal to 0`)}if(n.factor.constructor!==Number||n.factor<0)throw Error(`Value for factor must be a number greater than or equal to 0`);if(n.delay<n.minDelay)throw Error(`delay cannot be less than minDelay (delay: ${n.delay}, minDelay: ${n.minDelay}`);let r={attemptNum:0,attemptsRemaining:n.maxAttempts?n.maxAttempts:-1,aborted:!1,abort(){r.aborted=!0}},i=n.calculateDelay||yc;async function a(){if(n.beforeAttempt&&n.beforeAttempt(r,n),r.aborted){let e=Error(`Attempt aborted`);throw e.code=`ATTEMPT_ABORTED`,e}let t=async e=>{if(n.handleError&&await n.handleError(e,r,n),r.aborted||r.attemptsRemaining===0)throw e;r.attemptNum++;let t=i(r,n);return t&&await vc(t),a()};return r.attemptsRemaining>0&&r.attemptsRemaining--,n.timeout?new Promise((i,a)=>{let o=setTimeout(()=>{if(n.handleTimeout)try{i(n.handleTimeout(r,n))}catch(e){a(e)}else{let e=Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${n.timeout})`);e.code=`ATTEMPT_TIMEOUT`,a(e)}},n.timeout);e(r,n).then(e=>{clearTimeout(o),i(e)}).catch(e=>{clearTimeout(o),t(e).then(i).catch(a)})}):e(r,n).catch(t)}let o=n.calculateDelay?n.calculateDelay(r,n):n.initialDelay;if(o&&await vc(o),r.attemptNum<1&&n.initialJitter){let e=i(r,n);e&&await vc(e)}return a()}var xc=Math.floor,Sc=(e,t)=>e<t?e:t,Cc=(e,t)=>e>t?e:t;Number.isNaN;var wc=64,Tc=128,Ec=1<<17,Dc=1<<18,Oc=1<<19,kc=1<<20,Ac=1<<21,jc=1<<22,Mc=1<<23,Nc=1<<24,Pc=1<<25,Fc=1<<26,Ic=1<<27,Lc=1<<28,Rc=1<<29,zc=1<<30,Bc=63,Vc=127;Ec-1,Dc-1,Oc-1,kc-1,Ac-1,jc-1,Mc-1,Nc-1,Pc-1,Fc-1,Ic-1,Lc-1,Rc-1,zc-1;var Hc=2**53-1;Number.isInteger,Number.isNaN,Number.parseInt;var Uc=()=>new Set,Wc=Array.from;Array.isArray;var Gc=String.fromCharCode;String.fromCodePoint,Gc(65535);var Kc=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},qc=typeof TextEncoder<`u`?new TextEncoder:null,Jc=qc?e=>qc.encode(e):Kc,Yc=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});Yc&&Yc.decode(new Uint8Array).length===1&&(Yc=null);var Xc=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},Zc=()=>new Xc,Qc=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},$c=e=>{let t=new Uint8Array(Qc(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},el=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},X=(e,t)=>{for(;t>Vc;)el(e,Tc|Vc&t),t=xc(t/128);el(e,Vc&t)},tl=new Uint8Array(3e4),nl=tl.length/3,Z=qc&&qc.encodeInto?(e,t)=>{if(t.length<nl){let n=qc.encodeInto(t,tl).written||0;X(e,n);for(let t=0;t<n;t++)el(e,tl[t])}else il(e,Jc(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;X(e,r);for(let t=0;t<r;t++)el(e,n.codePointAt(t))},rl=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=Sc(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Cc(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},il=(e,t)=>{X(e,t.byteLength),rl(e,t)},al=e=>Error(e),ol=al(`Unexpected end of array`),sl=al(`Integer out of Range`),cl=class{constructor(e){this.arr=e,this.pos=0}},ll=e=>new cl(e),ul=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},dl=e=>ul(e,pl(e)),fl=e=>e.arr[e.pos++],pl=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&Vc)*n,n*=128,r<Tc)return t;if(t>Hc)throw sl}throw ol},ml=e=>{let t=e.arr[e.pos++],n=t&Bc,r=64,i=(t&wc)>0?-1:1;if((t&Tc)===0)return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&Vc)*r,r*=128,t<Tc)return i*n;if(n>Hc)throw sl}throw ol},hl=Yc?e=>Yc.decode(dl(e)):e=>{let t=pl(e);if(t===0)return``;{let n=String.fromCodePoint(fl(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(fl(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},gl=e=>{let t=e.pos,n=hl(e);return e.pos=t,n},_l=Date.now,vl=()=>new Map,yl=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},bl=class{constructor(){this._observers=vl()}on(e,t){yl(this._observers,e,Uc).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return Wc((this._observers.get(e)||vl()).values()).forEach(e=>e(...t))}destroy(){this._observers=vl()}},xl=Symbol(`Equality`),Sl=Object.keys,Cl=e=>Sl(e).length,wl=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Tl=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[xl]!=null)return e[xl](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!Tl(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Cl(e)!==Cl(t))return!1;for(let n in e)if(!wl(e,n)||!Tl(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Tl(e[n],t[n]))return!1;break;default:return!1}return!0},El=3e4,Dl=class extends bl{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let e=_l();this.getLocalState()!==null&&El/2<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());let t=[];this.meta.forEach((n,r)=>{r!==this.clientID&&El<=e-n.lastUpdated&&this.states.has(r)&&t.push(r)}),t.length>0&&Ol(this,t,`timeout`)},xc(El/10)),e.on(`destroy`,()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit(`destroy`,[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){let t=this.clientID,n=this.meta.get(t),r=n===void 0?0:n.clock+1,i=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:r,lastUpdated:_l()});let a=[],o=[],s=[],c=[];e===null?c.push(t):i==null?e!=null&&a.push(t):(o.push(t),Tl(i,e)||s.push(t)),(a.length>0||s.length>0||c.length>0)&&this.emit(`change`,[{added:a,updated:s,removed:c},`local`]),this.emit(`update`,[{added:a,updated:o,removed:c},`local`])}setLocalStateField(e,t){let n=this.getLocalState();n!==null&&this.setLocalState({...n,[e]:t})}getStates(){return this.states}},Ol=(e,t,n)=>{let r=[];for(let n=0;n<t.length;n++){let i=t[n];if(e.states.has(i)){if(e.states.delete(i),i===e.clientID){let t=e.meta.get(i);e.meta.set(i,{clock:t.clock+1,lastUpdated:_l()})}r.push(i)}}r.length>0&&(e.emit(`change`,[{added:[],updated:[],removed:r},n]),e.emit(`update`,[{added:[],updated:[],removed:r},n]))},kl=(e,t,n=e.states)=>{let r=t.length,i=Zc();X(i,r);for(let a=0;a<r;a++){let r=t[a],o=n.get(r)||null,s=e.meta.get(r).clock;X(i,r),X(i,s),Z(i,JSON.stringify(o))}return $c(i)},Al=(e,t,n)=>{let r=ll(t),i=_l(),a=[],o=[],s=[],c=[],l=pl(r);for(let t=0;t<l;t++){let t=pl(r),n=pl(r),l=JSON.parse(hl(r)),u=e.meta.get(t),d=e.states.get(t),f=u===void 0?0:u.clock;(f<n||f===n&&l===null&&e.states.has(t))&&(l===null?t===e.clientID&&e.getLocalState()!=null?n++:e.states.delete(t):e.states.set(t,l),e.meta.set(t,{clock:n,lastUpdated:i}),u===void 0&&l!==null?a.push(t):u!==void 0&&l===null?c.push(t):l!==null&&(Tl(l,d)||s.push(t),o.push(t)))}(a.length>0||s.length>0||c.length>0)&&e.emit(`change`,[{added:a,updated:s,removed:c},n]),(a.length>0||o.length>0||c.length>0)&&e.emit(`update`,[{added:a,updated:o,removed:c},n])},jl=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}},Ml=class{constructor(e){this.data=e,this.encoder=Zc(),this.decoder=ll(new Uint8Array(this.data))}peekVarString(){return gl(this.decoder)}readVarUint(){return pl(this.decoder)}readVarString(){return hl(this.decoder)}readVarUint8Array(){return dl(this.decoder)}writeVarUint(e){return X(this.encoder,e)}writeVarString(e){return Z(this.encoder,e)}writeVarUint8Array(e){return il(this.encoder,e)}length(){return Qc(this.encoder)}},Q=function(e){return e[e.Sync=0]=`Sync`,e[e.Awareness=1]=`Awareness`,e[e.Auth=2]=`Auth`,e[e.QueryAwareness=3]=`QueryAwareness`,e[e.Stateless=5]=`Stateless`,e[e.CLOSE=7]=`CLOSE`,e[e.SyncStatus=8]=`SyncStatus`,e[e.Ping=9]=`Ping`,e[e.Pong=10]=`Pong`,e}({}),$=function(e){return e.Connecting=`connecting`,e.Connected=`connected`,e.Disconnected=`disconnected`,e}({}),Nl=class{constructor(){this.encoder=Zc()}get(e){return e.encoder}toUint8Array(){return $c(this.encoder)}},Pl=class extends Nl{constructor(...e){super(...e),this.type=Q.CLOSE,this.description=`Ask the server to close the connection`}get(e){return Z(this.encoder,e.documentName),X(this.encoder,this.type),this.encoder}},Fl=class e extends jl{static{this.DEDUPLICATABLE_TYPES=new Set([Q.Awareness,Q.QueryAwareness])}constructor(e){super(),this.messageQueue=[],this.configuration={url:``,autoConnect:!0,preserveTrailingSlash:!1,document:void 0,WebSocketPolyfill:void 0,messageReconnectTimeout:3e4,delay:1e3,initialDelay:0,factor:2,maxAttempts:0,minDelay:1e3,maxDelay:3e4,jitter:!0,timeout:0,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,handleTimeout:null,providerMap:new Map},this.webSocket=null,this.webSocketHandlers={},this.shouldConnect=!0,this.status=$.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=void 0,this.closeTries=0,this.setConfiguration(e),this.configuration.WebSocketPolyfill=e.WebSocketPolyfill?e.WebSocketPolyfill:WebSocket,this.on(`open`,this.configuration.onOpen),this.on(`open`,this.onOpen.bind(this)),this.on(`connect`,this.configuration.onConnect),this.on(`message`,this.configuration.onMessage),this.on(`outgoingMessage`,this.configuration.onOutgoingMessage),this.on(`status`,this.configuration.onStatus),this.on(`disconnect`,this.configuration.onDisconnect),this.on(`close`,this.configuration.onClose),this.on(`destroy`,this.configuration.onDestroy),this.on(`awarenessUpdate`,this.configuration.onAwarenessUpdate),this.on(`awarenessChange`,this.configuration.onAwarenessChange),this.on(`close`,this.onClose.bind(this)),this.on(`message`,this.onMessage.bind(this)),this.intervals.connectionChecker=setInterval(this.checkConnection.bind(this),this.configuration.messageReconnectTimeout/10),this.shouldConnect&&this.connect()}async onOpen(e){this.status=$.Connected,this.emit(`status`,{status:$.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=e}attach(e){let t=e.effectiveName,n=this.configuration.providerMap.get(t);if(n&&n!==e&&n.isAuthenticated)throw Error(`Cannot attach two providers with the same effective name "${t}". Use sessionAwareness: true to multiplex providers with the same document name.`);this.configuration.providerMap.set(t,e),this.status===$.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===$.Connected&&e.onOpen(this.receivedOnOpenPayload)}detach(e){let t=e.effectiveName;this.configuration.providerMap.has(t)&&(e.send(Pl,{documentName:t}),this.configuration.providerMap.delete(t))}setConfiguration(e={}){this.configuration={...this.configuration,...e},this.configuration.autoConnect||(this.shouldConnect=!1)}async connect(){if(this.status===$.Connected)return;this.cancelWebsocketRetry&&=(this.cancelWebsocketRetry(),void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;let{retryPromise:e,cancelFunc:t}=(()=>{let e=!1;return{retryPromise:bc(this.createWebSocketConnection.bind(this),{delay:this.configuration.delay,initialDelay:this.configuration.initialDelay,factor:this.configuration.factor,maxAttempts:this.configuration.maxAttempts,minDelay:this.configuration.minDelay,maxDelay:this.configuration.maxDelay,jitter:this.configuration.jitter,timeout:this.configuration.timeout,handleTimeout:this.configuration.handleTimeout,beforeAttempt:t=>{(!this.shouldConnect||e)&&t.abort()}}).catch(e=>{if(e&&e.code!==`ATTEMPT_ABORTED`)throw e}),cancelFunc:()=>{e=!0}}})();return this.cancelWebsocketRetry=t,e}attachWebSocketListeners(e,t){let{identifier:n}=e,r=e=>this.emit(`message`,e),i=e=>this.emit(`close`,{event:e}),a=e=>this.emit(`open`,e),o=e=>{t(e)};this.webSocketHandlers[n]={message:r,close:i,open:a,error:o};let s=this.webSocketHandlers[e.identifier];Object.keys(s).forEach(t=>{e.addEventListener(t,s[t])})}cleanupWebSocket(){if(!this.webSocket)return;let{identifier:e}=this.webSocket,t=this.webSocketHandlers[e];Object.keys(t).forEach(n=>{this.webSocket?.removeEventListener(n,t[n]),delete this.webSocketHandlers[e]}),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise((e,t)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;let n=new this.configuration.WebSocketPolyfill(this.url);n.binaryType=`arraybuffer`,n.identifier=this.identifier,this.attachWebSocketListeners(n,t),this.webSocket=n,this.status=$.Connecting,this.emit(`status`,{status:$.Connecting}),this.connectionAttempt={resolve:e,reject:t}})}onMessage(e){this.resolveConnectionAttempt(),this.lastMessageReceived=_l();let t=new Uint8Array(e.data);if(t.length===1&&t[0]===Q.Ping){this.sendPong();return}let n=new Ml(t).peekVarString();this.configuration.providerMap.get(n)?.onMessage(e)}sendPong(){let e=Zc();X(e,Q.Pong),this.send($c(e))}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=$.Connected,this.emit(`status`,{status:$.Connected}),this.emit(`connect`),this.messageQueue.forEach(e=>this.send(e)),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){this.connectionAttempt?.reject(),this.connectionAttempt=null}checkConnection(){this.status===$.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=_l()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:`forced`}}),this.closeTries=0):(this.webSocket?.close(),this.messageQueue=[])))}get serverUrl(){if(this.configuration.preserveTrailingSlash)return this.configuration.url;let e=this.configuration.url;for(;e[e.length-1]===`/`;)e=e.slice(0,e.length-1);return e}get url(){return this.serverUrl}disconnect(){if(this.shouldConnect=!1,this.webSocket!==null)try{this.webSocket.close(),this.messageQueue=[]}catch(e){console.error(e)}}parseQueuedMessage(e){try{let t=ll(e);return{documentName:hl(t),messageType:pl(t)}}catch{return null}}addToQueue(t){if(t instanceof Uint8Array){let n=this.parseQueuedMessage(t);n&&e.DEDUPLICATABLE_TYPES.has(n.messageType)&&(this.messageQueue=this.messageQueue.filter(e=>{if(!(e instanceof Uint8Array))return!0;let t=this.parseQueuedMessage(e);return t?!(t.documentName===n.documentName&&t.messageType===n.messageType):!0}))}this.messageQueue.push(t)}send(e){this.webSocket?.readyState===gc.Open?this.webSocket.send(e):this.addToQueue(e)}onClose({event:e}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=$.Disconnected,this.emit(`status`,{status:$.Disconnected}),this.emit(`disconnect`,{event:e}),!this.cancelWebsocketRetry&&this.shouldConnect&&setTimeout(()=>{this.connect()},this.configuration.delay)}destroy(){this.emit(`destroy`),clearInterval(this.intervals.connectionChecker),this.stopConnectionAttempt(),this.disconnect(),this.removeAllListeners(),this.cleanupWebSocket()}},Il=0,Ll=1,Rl=2,zl=(e,t)=>{X(e,Il),il(e,da(t))},Bl=(e,t,n)=>{X(e,Ll),il(e,aa(t,n))},Vl=(e,t,n)=>Bl(t,n,dl(e)),Hl=(e,t,n,r)=>{try{na(t,dl(e),n)}catch(e){r?.(e),console.error(`Caught error while handling a Yjs update`,e)}},Ul=(e,t)=>{X(e,Rl),il(e,t)},Wl=Hl,Gl=(e,t,n,r,i)=>{let a=pl(e);switch(a){case Il:Vl(e,t,n);break;case Ll:Hl(e,n,r,i);break;case Rl:Wl(e,n,r,i);break;default:throw Error(`Unknown message type`)}return a},Kl=class{constructor(e){this.message=e}apply(e,t){let{message:n}=this,r=n.readVarUint(),i=n.length();switch(r){case Q.Sync:this.applySyncMessage(e,t);break;case Q.Awareness:this.applyAwarenessMessage(e);break;case Q.Auth:this.applyAuthMessage(e);break;case Q.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case Q.Stateless:e.receiveStateless(hl(n.decoder));break;case Q.SyncStatus:this.applySyncStatusMessage(e,ml(n.decoder)===1);break;case Q.CLOSE:let i={code:1e3,reason:hl(n.decoder)};e.onClose(),e.configuration.onClose({event:i}),e.forwardClose({event:i});break;default:console.error(`Can’t apply message of unknown type: ${r}`)}n.length()>i+1&&e.send(Nl,{encoder:n.encoder})}applySyncMessage(e,t){let{message:n}=this;n.writeVarUint(Q.Sync);let r=Gl(n.decoder,n.encoder,e.document,e);t&&r===Ll&&(e.synced=!0)}applySyncStatusMessage(e,t){t&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;let{message:t}=this;Al(e.awareness,t.readVarUint8Array(),e)}applyAuthMessage(e){let{message:t}=this;dc(t.decoder,e.sendToken.bind(e),e.permissionDeniedHandler.bind(e),e.authenticatedHandler.bind(e))}applyQueryAwarenessMessage(e){if(!e.awareness)return;let{message:t}=this;t.writeVarUint(Q.Awareness),t.writeVarUint8Array(kl(e.awareness,Array.from(e.awareness.getStates().keys())))}},ql=class{constructor(e,t={}){this.message=new e,this.encoder=this.message.get(t)}create(){return $c(this.encoder)}send(e){e?.send(this.create())}},Jl=`4.0.0-rc.1`,Yl=class extends Nl{constructor(...e){super(...e),this.type=Q.Auth,this.description=`Authentication`}get(e){if(e.token===void 0)throw Error("The authentication message requires `token` as an argument.");return Z(this.encoder,e.documentName),X(this.encoder,this.type),uc(this.encoder,e.token),Z(this.encoder,Jl),this.encoder}},Xl=class extends Nl{constructor(...e){super(...e),this.type=Q.Awareness,this.description=`Awareness states update`}get(e){if(e.awareness===void 0)throw Error(`The awareness message requires awareness as an argument`);if(e.clients===void 0)throw Error(`The awareness message requires clients as an argument`);Z(this.encoder,e.documentName),X(this.encoder,this.type);let t;return t=e.states===void 0?kl(e.awareness,e.clients):kl(e.awareness,e.clients,e.states),il(this.encoder,t),this.encoder}},Zl=class extends Nl{constructor(...e){super(...e),this.type=Q.Stateless,this.description=`A stateless message`}get(e){return Z(this.encoder,e.documentName),X(this.encoder,this.type),Z(this.encoder,e.payload??``),this.encoder}},Ql=class extends Nl{constructor(...e){super(...e),this.type=Q.Sync,this.description=`First sync step`}get(e){if(e.document===void 0)throw Error(`The sync step one message requires document as an argument`);return Z(this.encoder,e.documentName),X(this.encoder,this.type),zl(this.encoder,e.document),this.encoder}},$l=class extends Nl{constructor(...e){super(...e),this.type=Q.Sync,this.description=`A document update`}get(e){return Z(this.encoder,e.documentName),X(this.encoder,this.type),Ul(this.encoder,e.update),this.encoder}},eu=class extends Error{constructor(...e){super(...e),this.code=1001}},tu=class extends jl{get effectiveName(){return this.configuration.sessionAwareness?mc(this.configuration.name,this.sessionId):this.configuration.name}constructor(e){super(),this.configuration={name:``,document:void 0,awareness:void 0,token:null,sessionAwareness:!0,forceSyncInterval:!1,onAuthenticated:()=>null,onAuthenticationFailed:()=>null,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onSynced:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,onStateless:()=>null,onUnsyncedChanges:()=>null},this.isSynced=!1,this.unsyncedChanges=0,this.isAuthenticated=!1,this.authorizedScope=void 0,this.manageSocket=!1,this._isAttached=!1,this.sessionId=Math.random().toString(36).slice(2),this.intervals={forceSync:null},this.boundDocumentUpdateHandler=this.documentUpdateHandler.bind(this),this.boundAwarenessUpdateHandler=this.awarenessUpdateHandler.bind(this),this.boundPageHide=this.pageHide.bind(this),this.boundOnOpen=this.onOpen.bind(this),this.boundOnClose=this.onClose.bind(this),this.forwardConnect=()=>this.emit(`connect`),this.forwardStatus=e=>this.emit(`status`,e),this.forwardClose=e=>this.emit(`close`,e),this.forwardDisconnect=e=>this.emit(`disconnect`,e),this.forwardDestroy=()=>this.emit(`destroy`),this.setConfiguration(e),this.configuration.document=e.document?e.document:new Bi,this.configuration.awareness=e.awareness===void 0?new Dl(this.document):e.awareness,this.on(`open`,this.configuration.onOpen),this.on(`message`,this.configuration.onMessage),this.on(`outgoingMessage`,this.configuration.onOutgoingMessage),this.on(`synced`,this.configuration.onSynced),this.on(`destroy`,this.configuration.onDestroy),this.on(`awarenessUpdate`,this.configuration.onAwarenessUpdate),this.on(`awarenessChange`,this.configuration.onAwarenessChange),this.on(`stateless`,this.configuration.onStateless),this.on(`unsyncedChanges`,this.configuration.onUnsyncedChanges),this.on(`authenticated`,this.configuration.onAuthenticated),this.on(`authenticationFailed`,this.configuration.onAuthenticationFailed),this.awareness?.on(`update`,()=>{this.emit(`awarenessUpdate`,{states:fc(this.awareness.getStates())})}),this.awareness?.on(`change`,()=>{this.emit(`awarenessChange`,{states:fc(this.awareness.getStates())})}),this.document.on(`update`,this.boundDocumentUpdateHandler),this.awareness?.on(`update`,this.boundAwarenessUpdateHandler),this.registerEventListeners(),this.configuration.forceSyncInterval&&typeof this.configuration.forceSyncInterval==`number`&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.manageSocket&&this.attach()}setConfiguration(e={}){e.websocketProvider||(this.manageSocket=!0,this.configuration.websocketProvider=new Fl(e)),this.configuration={...this.configuration,...e}}get document(){return this.configuration.document}get isAttached(){return this._isAttached}get awareness(){return this.configuration.awareness}get hasUnsyncedChanges(){return this.unsyncedChanges>0}resetUnsyncedChanges(){this.unsyncedChanges=1,this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}incrementUnsyncedChanges(){this.unsyncedChanges+=1,this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}decrementUnsyncedChanges(){this.unsyncedChanges>0&&--this.unsyncedChanges,this.unsyncedChanges===0&&(this.synced=!0),this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}forceSync(){this.resetUnsyncedChanges(),this.send(Ql,{document:this.document,documentName:this.effectiveName})}pageHide(){this.awareness&&Ol(this.awareness,[this.document.clientID],`page hide`)}registerEventListeners(){typeof window>`u`||!(`addEventListener`in window)||window.addEventListener(`pagehide`,this.boundPageHide)}sendStateless(e){this.send(Zl,{documentName:this.effectiveName,payload:e})}async sendToken(){let e;try{e=await this.getToken()}catch(e){this.permissionDeniedHandler(`Failed to get token during sendToken(): ${e}`);return}this.send(Yl,{token:e??``,documentName:this.effectiveName})}documentUpdateHandler(e,t){t!==this&&(this.incrementUnsyncedChanges(),this.send($l,{update:e,documentName:this.effectiveName}))}awarenessUpdateHandler({added:e,updated:t,removed:n},r){let i=e.concat(t).concat(n);this.send(Xl,{awareness:this.awareness,clients:i,documentName:this.effectiveName})}get synced(){return this.isSynced}set synced(e){this.isSynced!==e&&(this.isSynced=e,e&&this.emit(`synced`,{state:e}))}receiveStateless(e){this.emit(`stateless`,{payload:e})}async connect(){if(this.manageSocket)return this.configuration.websocketProvider.connect();console.warn(`HocuspocusProvider::connect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.`)}disconnect(){if(this.manageSocket)return this.configuration.websocketProvider.disconnect();console.warn(`HocuspocusProvider::disconnect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.`)}async onOpen(e){this.isAuthenticated=!1,this.emit(`open`,{event:e}),await this.sendToken(),this.startSync()}async getToken(){return typeof this.configuration.token==`function`?await this.configuration.token():this.configuration.token}startSync(){this.resetUnsyncedChanges(),this.send(Ql,{document:this.document,documentName:this.effectiveName}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(Xl,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.effectiveName})}send(e,t){if(!this._isAttached)return;let n=new ql(e,t);this.emit(`outgoingMessage`,{message:n.message}),n.send(this.configuration.websocketProvider)}onMessage(e){let t=new Ml(e.data),{documentName:n}=hc(t.readVarString());t.writeVarString(this.effectiveName),this.emit(`message`,{event:e,message:new Ml(e.data)}),new Kl(t).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&Ol(this.awareness,Array.from(this.awareness.getStates().keys()).filter(e=>e!==this.document.clientID),this)}destroy(){this.emit(`destroy`),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&(Ol(this.awareness,[this.document.clientID],`provider destroy`),this.awareness.off(`update`,this.boundAwarenessUpdateHandler),this.awareness.destroy()),this.document.off(`update`,this.boundDocumentUpdateHandler),this.removeAllListeners(),this.detach(),this.manageSocket&&this.configuration.websocketProvider.destroy(),!(typeof window>`u`||!(`removeEventListener`in window))&&window.removeEventListener(`pagehide`,this.boundPageHide)}detach(){this.configuration.websocketProvider.off(`connect`,this.configuration.onConnect),this.configuration.websocketProvider.off(`connect`,this.forwardConnect),this.configuration.websocketProvider.off(`status`,this.forwardStatus),this.configuration.websocketProvider.off(`status`,this.configuration.onStatus),this.configuration.websocketProvider.off(`open`,this.boundOnOpen),this.configuration.websocketProvider.off(`close`,this.boundOnClose),this.configuration.websocketProvider.off(`close`,this.configuration.onClose),this.configuration.websocketProvider.off(`close`,this.forwardClose),this.configuration.websocketProvider.off(`disconnect`,this.configuration.onDisconnect),this.configuration.websocketProvider.off(`disconnect`,this.forwardDisconnect),this.configuration.websocketProvider.off(`destroy`,this.configuration.onDestroy),this.configuration.websocketProvider.off(`destroy`,this.forwardDestroy),this.configuration.websocketProvider.detach(this),this._isAttached=!1}attach(){this._isAttached||=(this.configuration.websocketProvider.on(`connect`,this.configuration.onConnect),this.configuration.websocketProvider.on(`connect`,this.forwardConnect),this.configuration.websocketProvider.on(`status`,this.configuration.onStatus),this.configuration.websocketProvider.on(`status`,this.forwardStatus),this.configuration.websocketProvider.on(`open`,this.boundOnOpen),this.configuration.websocketProvider.on(`close`,this.boundOnClose),this.configuration.websocketProvider.on(`close`,this.configuration.onClose),this.configuration.websocketProvider.on(`close`,this.forwardClose),this.configuration.websocketProvider.on(`disconnect`,this.configuration.onDisconnect),this.configuration.websocketProvider.on(`disconnect`,this.forwardDisconnect),this.configuration.websocketProvider.on(`destroy`,this.configuration.onDestroy),this.configuration.websocketProvider.on(`destroy`,this.forwardDestroy),this.configuration.websocketProvider.attach(this),!0)}permissionDeniedHandler(e){this.emit(`authenticationFailed`,{reason:e}),this.isAuthenticated=!1}authenticatedHandler(e){this.isAuthenticated=!0,this.authorizedScope=e,this.emit(`authenticated`,{scope:e})}setAwarenessField(e,t){if(!this.awareness)throw new eu(`Cannot set awareness field "${e}" to ${JSON.stringify(t)}. You have disabled Awareness for this provider by explicitly passing awareness: null in the provider configuration.`);this.awareness.setLocalStateField(e,t)}};function nu(e,t,n=null,r=null){let i={...pe()};return e!==null&&(i.principalId=e.principalId,i.tabSessionId=e.tabSessionId),t!==null&&t.length>0&&(i.expectedServerInstanceId=t),n!==null&&n.length>0&&(i.expectedBranch=n),r!==null&&r.length>0&&(i.expectedDocLineageEpoch=r),JSON.stringify(i)}function ru(e,t,n){let r=(0,me.c)(5),i,a;r[0]!==e||r[1]!==t||r[2]!==n?(i=()=>{!e||!n||typeof e.setLanguagePreference==`function`&&e.setLanguagePreference(t??`system`).catch(e=>{console.warn(JSON.stringify({event:`language-preference-push-failed`,preference:t??`system`,error:e instanceof Error?e.message:String(e)}))})},a=[e,t,n],r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a):(i=r[3],a=r[4]),(0,m.useEffect)(i,a)}function iu(e){let t=/^rgba?\(([^)]*)\)$/i.exec(e.trim())?.[1];if(t===void 0)return null;let n=t.split(/[\s,/]+/).filter(Boolean);if(n.length<3)return null;let r=`#`;for(let e=0;e<3;e++){let t=Math.round(Number(n[e]));if(!Number.isFinite(t)||t<0||t>255)return null;r+=t.toString(16).padStart(2,`0`)}return r}function au(e){if(typeof document>`u`)return null;let t=document.createElement(`canvas`).getContext(`2d`);if(!t)return null;t.fillStyle=`#000000`,t.fillStyle=e;let n=t.fillStyle;return t.fillStyle=`#ffffff`,t.fillStyle=e,t.fillStyle===n&&typeof n==`string`&&/^#[0-9a-f]{6}$/i.test(n)?n.toLowerCase():null}function ou(e){return au(e)??iu(e)}function su(e){let t=document.createElement(`span`);t.style.display=`none`,t.style.backgroundColor=`var(${e})`,document.body.appendChild(t);try{let e=getComputedStyle(t).backgroundColor;return!e||e===`rgba(0, 0, 0, 0)`||e.includes(`var(`)?null:ou(e)}finally{t.remove()}}function cu(){if(!(typeof document>`u`))try{let e=su(`--sidebar`),t=su(`--sidebar-foreground`);return!e||!t?void 0:{bg:e,symbol:t}}catch{return}}function lu(e,t,n){let r=(0,me.c)(10),i;r[0]!==e||r[1]!==t?(i=()=>{if(t!==`light`&&t!==`dark`&&t!==`system`||!e)return;let n=!1;return e.setThemeSource(t).catch(e=>{console.warn(JSON.stringify({event:`theme-source-set-failed`,themeValue:t,error:e instanceof Error?e.message:String(e)}))}).finally(()=>{if(n)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`).matches;e.signalThemeApplied({reducedTransparency:t,chrome:cu()})}),()=>{n=!0}},r[0]=e,r[1]=t,r[2]=i):i=r[2];let a;r[3]!==e||r[4]!==n||r[5]!==t?(a=[e,t,n],r[3]=e,r[4]=n,r[5]=t,r[6]=a):a=r[6],(0,m.useEffect)(i,a);let o,s;r[7]===e?(o=r[8],s=r[9]):(o=()=>{if(!e)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`),n=t=>{e.signalThemeApplied({reducedTransparency:t.matches,chrome:cu()})};return t.addEventListener(`change`,n),()=>{t.removeEventListener(`change`,n)}},s=[e],r[7]=e,r[8]=o,r[9]=s),(0,m.useEffect)(o,s)}var uu={en:()=>t(()=>import(`./messages-C1QZwdEx.js`).then(e=>e.n),__vite__mapDeps([0,1]),import.meta.url),"zh-Hans":()=>t(()=>import(`./messages-DTRz3g9F.js`),[],import.meta.url),"zh-Hant":()=>t(()=>import(`./messages-XzeH2iOB.js`),[],import.meta.url),hi:()=>t(()=>import(`./messages-Cv5HHzZF.js`),[],import.meta.url),es:()=>t(()=>import(`./messages-CIxg-v3C.js`),[],import.meta.url),ar:()=>t(()=>import(`./messages-CKi8pZ4Q.js`),[],import.meta.url),fr:()=>t(()=>import(`./messages-bBtIkGs7.js`),[],import.meta.url),bn:()=>t(()=>import(`./messages-CG-GHBB9.js`),[],import.meta.url),"pt-BR":()=>t(()=>import(`./messages-CAevTmZQ.js`),[],import.meta.url),id:()=>t(()=>import(`./messages-DWBpIisU.js`),[],import.meta.url),ur:()=>t(()=>import(`./messages-BNq0JS1I.js`),[],import.meta.url)},du=new Set([`en`]),fu=`en`;async function pu(e){if(fu=e,!du.has(e)){let{default:t}=await uu[e]();se.load(e,t.messages),du.add(e)}fu===e&&se.activate(e)}function mu(){return!1}async function hu(){}var gu=`ok-locale-load-failed`;function _u(){window.location.reload()}function vu({locale:e,reload:t=_u}){let n=new Intl.DisplayNames([se.locale],{type:`language`}).of(e)??e;ce.error(se._({id:`loE6tM`,values:{language:n}}),{id:gu,description:se._({id:`GtPGNJ`}),duration:1/0,action:{label:se._({id:`HpK_8d`}),onClick:t}})}function yu(){ce.dismiss(gu)}var bu=`ok-language-v1`;function xu({preference:e,locale:t}){if(typeof document>`u`)return;let n=f(t),r=document.documentElement;r.lang=t,r.dir=n;try{localStorage.setItem(bu,JSON.stringify({pref:e,locale:t,dir:n}))}catch{}}function Su(e){return e===`system`?`system`:u.includes(e)?e:void 0}function Cu(){if(!(typeof localStorage>`u`))try{let e=localStorage.getItem(bu);return e===null?void 0:Su(JSON.parse(e).pref)}catch{return}}function wu(e){let t=(0,me.c)(4),{preference:n,userConfigSynced:r}=e,i,a;t[0]!==n||t[1]!==r?(i=()=>{if(mu()){hu().catch(Tu);return}if(!r)return;let{locale:e}=s({override:void 0,storedPreference:n,preferenceList:ne(),supportedLocales:u,autoDetectableLocales:oe}),t=!1;return pu(e).then(()=>{t||(yu(),xu({preference:n??`system`,locale:e}))}).catch(n=>{console.warn(JSON.stringify({event:`ok-locale-activate-failed`,locale:e,error:String(n)})),!t&&vu({locale:e})}),()=>{t=!0}},a=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,m.useEffect)(i,a)}function Tu(e){console.warn(JSON.stringify({event:`ok-pseudo-locale-activate-failed`,error:String(e)}))}function Eu(e){let t=(0,me.c)(5),{setTheme:n}=i(),r;t[0]!==n||t[1]!==e?(r=()=>{(e===`light`||e===`dark`||e===`system`)&&n(e)},t[0]=n,t[1]=e,t[2]=r):r=t[2];let a;t[3]===e?a=t[4]:(a=[e],t[3]=e,t[4]=a),(0,m.useEffect)(r,a)}var Du=n();function Ou(e,t,n,r){console.warn(JSON.stringify({event:`ok-${e}-${n}`,docName:t,code:r?.code,reason:r?.reason??void 0}))}function ku(e,t,n,r){let i=new Bi,a=new tu({url:e,name:t,document:i,token:nu(null,r,null),onDisconnect:({event:e})=>Ou(`config-provider`,t,`disconnect`,e),onClose:({event:e})=>Ou(`config-provider`,t,`close`,e)}),o=re(a,n);return{binding:o,config:o.current(),cleanup:()=>{o.dispose(),a.destroy(),i.destroy()}}}function Au(e,t){let n=new Bi,r=new tu({url:e,name:p,document:n,token:nu(null,t,null),onDisconnect:({event:e})=>Ou(`okignore-provider`,p,`disconnect`,e),onClose:({event:e})=>Ou(`okignore-provider`,p,`close`,e)}),i=ie(r);return{binding:i,provider:r,cleanup:()=>{i.dispose(),r.destroy(),n.destroy()}}}function ju(e){let t=(0,me.c)(20),{collabUrl:n,children:r}=e,a=ye(),{systemTheme:s}=i(),u=s===`dark`,[f,p]=(0,m.useState)(null),[ne,re]=(0,m.useState)(null),[ie,oe]=(0,m.useState)(null),[se,ce]=(0,m.useState)(null),pe,he;t[0]!==n||t[1]!==a?(pe=()=>{if(n===null)return;let e=ku(n,ee,`user`,a),t=ku(n,l,`project`,a),r=ku(n,c,`project-local`,a),i=Au(n,a);p({binding:e.binding,config:e.config,synced:e.binding.hasSynced()}),re({binding:t.binding,config:t.config,synced:t.binding.hasSynced()}),oe({binding:r.binding,config:r.config,synced:r.binding.hasSynced()}),ce({binding:i.binding,synced:!1});let o=e.binding.subscribe(t=>{p(n=>n?.binding===e.binding?{...n,config:t}:n)}),s=e.binding.subscribeSynced(()=>{p(t=>t?.binding===e.binding?{...t,synced:!0}:t)}),u=t.binding.subscribe(e=>{re(n=>n?.binding===t.binding?{...n,config:e}:n)}),d=t.binding.subscribeSynced(()=>{re(e=>e?.binding===t.binding?{...e,synced:!0}:e)}),f=r.binding.subscribe(e=>{oe(t=>t?.binding===r.binding?{...t,config:e}:t)}),te=r.binding.subscribeSynced(()=>{oe(e=>e?.binding===r.binding?{...e,synced:!0}:e)}),ne=()=>{ce(e=>e?.binding===i.binding?{...e,synced:!0}:e)};return i.provider.on(`synced`,ne),()=>{o(),s(),u(),d(),f(),te(),i.provider.off(`synced`,ne);for(let n of[e,t,r,i])try{n.cleanup()}catch(e){console.warn(JSON.stringify({event:`ok-config-provider-cleanup-error`,error:String(e)}))}p(t=>t?.binding===e.binding?null:t),re(e=>e?.binding===t.binding?null:e),oe(e=>e?.binding===r.binding?null:e),ce(e=>e?.binding===i.binding?null:e)}},he=[n,a],t[0]=n,t[1]=a,t[2]=pe,t[3]=he):(pe=t[2],he=t[3]),(0,m.useEffect)(pe,he);let h=f&&ne?d(f.config,ne.config,ie?.config):null,ge=h?.appearance?.theme,_e=h?.appearance?.customTheme,ve=h?.appearance?.colorThemeEnabled!==!1,g=o(h?.appearance),be=ae(ge,u),_=ve?g[be]:`default`,xe=_===`custom`?fe(le(_e)):te(_)??ge;Eu(xe),de({selection:g,modePreference:ge,slotMode:be,customSeed:_e,enabled:ve}),wu({preference:h?.appearance?.language,userConfigSynced:f?.synced??!1}),ru(typeof window<`u`?window.okDesktop:void 0,h?.appearance?.language,f?.synced??!1),lu(typeof window<`u`?window.okDesktop:void 0,xe??`system`,`${_}:${_===`custom`?JSON.stringify(_e??null):``}`);let Se=f?.binding??null,v=f?.synced??!1,Ce=ne?.binding??null,we=ie?.binding??null,y=se?.binding??null,Te=se?.synced??!1,Ee=f?.config??null,De=ne?.config??null,b=ne?.synced??!1,Oe=ie?.config??null,ke=ie?.synced??!1,x;t[4]!==h||t[5]!==De||t[6]!==b||t[7]!==Oe||t[8]!==ke||t[9]!==Se||t[10]!==v||t[11]!==Ce||t[12]!==we||t[13]!==y||t[14]!==Te||t[15]!==Ee?(x={userBinding:Se,userSynced:v,projectBinding:Ce,projectLocalBinding:we,okignoreBinding:y,okignoreSynced:Te,userConfig:Ee,projectConfig:De,projectSynced:b,projectLocalConfig:Oe,projectLocalSynced:ke,merged:h},t[4]=h,t[5]=De,t[6]=b,t[7]=Oe,t[8]=ke,t[9]=Se,t[10]=v,t[11]=Ce,t[12]=we,t[13]=y,t[14]=Te,t[15]=Ee,t[16]=x):x=t[16];let Ae=x,je;return t[17]!==r||t[18]!==Ae?(je=(0,Du.jsx)(ue,{value:Ae,children:r}),t[17]=r,t[18]=Ae,t[19]=je):je=t[19],je}export{D as $,da as A,si as B,Pi as C,Ma as D,Da as E,Oi as F,Pn as G,Qr as H,Sa as I,pn as J,Mn as K,Na as L,ya as M,Ai as N,sa as O,ba as P,E as Q,H as R,ka as S,Ca as T,$r as U,I as V,M as W,en as X,ln as Y,Xt as Z,vs as _,lu as a,v as at,ta as b,K as c,_e as ct,Bi as d,O as et,J as f,ps as g,eo as h,wu as i,ke as it,B as j,aa as k,Hs as l,ja as m,Su as n,Me as nt,nu as o,g as ot,xa as p,Cn as q,Cu as r,je as rt,tu as s,_ as st,ju as t,Ke as tt,q as u,Cs as v,R as w,Aa as x,na as y,Oo as z};