@inkeep/open-knowledge 0.83.0-beta.3 → 0.83.0-beta.5

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 (133) hide show
  1. package/dist/assets/skills/project/SKILL.md +1 -1
  2. package/dist/assets/skills/project/references/linking.md +1 -1
  3. package/dist/cli.mjs +6 -6
  4. package/dist/constants-DPhkbJXs.mjs +1 -0
  5. package/dist/{dist-j8UC9eCg.mjs → dist-BHg9XI3A.mjs} +495 -495
  6. package/dist/{dist-BmqovPWv.mjs → dist-ByQ8IZXo.mjs} +1 -1
  7. package/dist/index.mjs +3 -3
  8. package/dist/{init-CPkcxT1D.mjs → init-CrjTf1pi.mjs} +2 -2
  9. package/dist/init-Kw-TosnB.mjs +1 -0
  10. package/dist/{launch-json-removal-D27TJa_-.mjs → launch-json-removal-BEKplNGY.mjs} +1 -1
  11. package/dist/{loader-PJBV7Q5j.mjs → loader-CrmSAWIW.mjs} +1 -1
  12. package/dist/loader-CwZvWeL0.mjs +1 -0
  13. package/dist/{md-manager-BGnqyqi1-IqwoPmS1.mjs → md-manager-BGnqyqi1-DsBy1Dky.mjs} +1 -1
  14. package/dist/{open-browser-E29fOzP7.mjs → open-browser-CJogphTe.mjs} +1 -1
  15. package/dist/parse-worker.mjs +1 -1
  16. package/dist/preview-AWnyLtzP.mjs +1 -0
  17. package/dist/{preview-BnvPea6p.mjs → preview-B2beHnfh.mjs} +1 -1
  18. package/dist/public/assets/{AccountSection-BRBXF1vN.js → AccountSection-Droiytue.js} +1 -1
  19. package/dist/public/assets/{ActivityModeContent-CJJP9rF8.js → ActivityModeContent-CbnLPTIH.js} +1 -1
  20. package/dist/public/assets/{AddPropertiesButton-D3pJsHJb.js → AddPropertiesButton-KfKILXo9.js} +2 -2
  21. package/dist/public/assets/{AgentConnectionsSection-CmOmHMSc.js → AgentConnectionsSection-CJhM0Oqw.js} +1 -1
  22. package/dist/public/assets/{AgentDiffPane-tNG4XT0X.js → AgentDiffPane-B0odJ1aT.js} +1 -1
  23. package/dist/public/assets/{AttachmentsSection-JCBkP1bH.js → AttachmentsSection-Mw0-ZVyb.js} +1 -1
  24. package/dist/public/assets/{AuthModal-D1eciNeA.js → AuthModal-DcixDUcD.js} +1 -1
  25. package/dist/public/assets/{CodeMirrorPropInput-a3VwRUQz.js → CodeMirrorPropInput-CJK_-B_x.js} +1 -1
  26. package/dist/public/assets/{ContentRulesSection-D5HpfzEM.js → ContentRulesSection-Bss4zUDP.js} +1 -1
  27. package/dist/public/assets/{DiffViewBoundary-DnPwZD0g.js → DiffViewBoundary-B5VRWFoq.js} +1 -1
  28. package/dist/public/assets/{DocumentContext-mYOuQjoP.js → DocumentContext-Bsl186nT.js} +1 -1
  29. package/dist/public/assets/{EditorModeToggle-CzpyTCmQ.js → EditorModeToggle-DPAypJvm.js} +1 -1
  30. package/dist/public/assets/{ExcalidrawDocEditor-DOGkm6OY.js → ExcalidrawDocEditor-C_j2ekRK.js} +1 -1
  31. package/dist/public/assets/FeedbackForm-CQ0MZzAX.js +1 -0
  32. package/dist/public/assets/{GraphPanel-CpJ-EZeA.js → GraphPanel-ZgCaGJ14.js} +1 -1
  33. package/dist/public/assets/{ImportSkillDialog-DnFzketi.js → ImportSkillDialog-CYgy5v1q.js} +1 -1
  34. package/dist/public/assets/{LinkPreviewsSection-DoydKz8c.js → LinkPreviewsSection-uXIP-dp3.js} +1 -1
  35. package/dist/public/assets/{LintConfigEditor-CRNgDVC9.js → LintConfigEditor-BFYDnPot.js} +1 -1
  36. package/dist/public/assets/{LintingSection-6XJ9IDh1.js → LintingSection-CKk0R2XV.js} +1 -1
  37. package/dist/public/assets/ManagedArtifactProperties-D4nKksLq.js +1 -0
  38. package/dist/public/assets/{ManagedArtifactProperties-KZga5-nk.js → ManagedArtifactProperties-oK6vCr7C.js} +1 -1
  39. package/dist/public/assets/{MermaidDocEditor-Db30lOly.js → MermaidDocEditor-7zbWvNHd.js} +1 -1
  40. package/dist/public/assets/{NetworkAccessSection-Br-oNBym.js → NetworkAccessSection-Bn8H6wuf.js} +1 -1
  41. package/dist/public/assets/{ProjectTemplatesSection-BgjUl8Rv.js → ProjectTemplatesSection-Cf5bgyHk.js} +1 -1
  42. package/dist/public/assets/{PropertyDisplayRow-D6hboSk0.js → PropertyDisplayRow-DtQD10NU.js} +1 -1
  43. package/dist/public/assets/{PublishToGitHubDialog-CwKAOyMe.js → PublishToGitHubDialog-Bi_yfoyq.js} +1 -1
  44. package/dist/public/assets/{RegisteredAgentIcon-DHzxArZN.js → RegisteredAgentIcon-jysj1Acv.js} +1 -1
  45. package/dist/public/assets/{SchemaConfigEditor-DB6DsLhh.js → SchemaConfigEditor-CmvHbYD0.js} +1 -1
  46. package/dist/public/assets/{SearchSection-Dk-yosmd.js → SearchSection-NRyXWfQ3.js} +1 -1
  47. package/dist/public/assets/{SessionsHost-hUeKJj7l.js → SessionsHost-Cc2oV3dV.js} +2 -2
  48. package/dist/public/assets/{SettingsDialogBody-De0p1s3_.js → SettingsDialogBody-CWnpUal4.js} +2 -2
  49. package/dist/public/assets/{ShareReceiveMissDialog-hMFYD5AW.js → ShareReceiveMissDialog-ChcdZosR.js} +1 -1
  50. package/dist/public/assets/{SkillCostValue-DC_VaXgy.js → SkillCostValue-Bgy3wkjV.js} +1 -1
  51. package/dist/public/assets/{SkillForkDialog-DeoTv3wY.js → SkillForkDialog-CwCSC6Z0.js} +1 -1
  52. package/dist/public/assets/{SkillInstallMenu-1E0cH5_q.js → SkillInstallMenu-BIs2wAUZ.js} +1 -1
  53. package/dist/public/assets/{SkillOriginInline-CLKoMHNo.js → SkillOriginInline-Dr1zcAGa.js} +1 -1
  54. package/dist/public/assets/{SkillToolbarControls-nnJTYYrn.js → SkillToolbarControls-BXSkUGmd.js} +1 -1
  55. package/dist/public/assets/{SkillsManagerSection-DKedsWHo.js → SkillsManagerSection-CiaThXM_.js} +1 -1
  56. package/dist/public/assets/{SlidesToolbarControls-BSKDSVIG.js → SlidesToolbarControls-BpGxFSJu.js} +1 -1
  57. package/dist/public/assets/{SourceEditor-BCeRHOW_.js → SourceEditor-AolrPcnF.js} +1 -1
  58. package/dist/public/assets/{SpellingSettings-Cmy-eBih.js → SpellingSettings-Bp5WJ0V7.js} +1 -1
  59. package/dist/public/assets/{SyncSection-Ctc1ZAYE.js → SyncSection-DN4BNjYi.js} +1 -1
  60. package/dist/public/assets/{SyncStatusBadge-CykVps4K.js → SyncStatusBadge-BO6CFavL.js} +1 -1
  61. package/dist/public/assets/{TemplateRow-B2jVmQlY.js → TemplateRow-Bj4hpJ-E.js} +1 -1
  62. package/dist/public/assets/{TerminalLaunchContext-BReEuF5W.js → TerminalLaunchContext-kR8NUVFa.js} +1 -1
  63. package/dist/public/assets/{TerminalPanel-DQg3L4EK.js → TerminalPanel-CBpH9VnO.js} +1 -1
  64. package/dist/public/assets/{TerminalSection-CcQc7fKK.js → TerminalSection-DnexOFJv.js} +1 -1
  65. package/dist/public/assets/{TerminalWindowApp-a7QkAGXd.js → TerminalWindowApp-CYOc89Z0.js} +1 -1
  66. package/dist/public/assets/{TextDocEditor-CdGAdSor.js → TextDocEditor-DcTmh_sa.js} +1 -1
  67. package/dist/public/assets/{ThemePluginSection-B4oIayEG.js → ThemePluginSection-DOCAYKOj.js} +1 -1
  68. package/dist/public/assets/{ThreadView-Cu22t-sf.js → ThreadView-H4YeUz_6.js} +1 -1
  69. package/dist/public/assets/{TimelineDiffPane-CcFwzBDW.js → TimelineDiffPane-DBRzt5of.js} +1 -1
  70. package/dist/public/assets/{agent-connections-D-XX-7tC.js → agent-connections-BmjcmCOh.js} +1 -1
  71. package/dist/public/assets/{agent-registry-CC-eSzdu.js → agent-registry--47SG0kt.js} +1 -1
  72. package/dist/public/assets/{bridge-1xVdv27q.js → bridge-njD5PB6P.js} +1 -1
  73. package/dist/public/assets/{card-CUu_Dbtf.js → card-BsBNZHzU.js} +1 -1
  74. package/dist/public/assets/{catalog-DQ0C9DYn.js → catalog-DtlAjcAT.js} +1 -1
  75. package/dist/public/assets/{comment-chips-ucdDq5Q3.js → comment-chips-CO_v36hx.js} +1 -1
  76. package/dist/public/assets/{config-provider-BDWGnun_.js → config-provider-DYjwca1V.js} +1 -1
  77. package/dist/public/assets/config-schema-CjObvyCB.js +1 -0
  78. package/dist/public/assets/{css-color-to-hex-Ds26W_X-.js → css-color-to-hex-vFOfC-Pa.js} +1 -1
  79. package/dist/public/assets/{doc-undo-manager-CdteDFL9.js → doc-undo-manager-Dn9t2Iwn.js} +1 -1
  80. package/dist/public/assets/field-controls-23rf_c2g.js +1 -0
  81. package/dist/public/assets/{field-controls-CFLl9l2A.js → field-controls-CAjZIoxe.js} +1 -1
  82. package/dist/public/assets/{frontmatter-tags-BIkfDL6K.js → frontmatter-tags-B-pVcI4P.js} +1 -1
  83. package/dist/public/assets/{index-X6cytEL5.js → index-jj7AN3ys.js} +7 -7
  84. package/dist/public/assets/{lint-config-client-DgV9TE2y.js → lint-config-client-DRl_GTbs.js} +1 -1
  85. package/dist/public/assets/{lint-plugins-DmlA1sEu.js → lint-plugins-DQC4DG_-.js} +1 -1
  86. package/dist/public/assets/{markdown-lint-CfRH6CjV.js → markdown-lint-C_9h2J3z.js} +1 -1
  87. package/dist/public/assets/{markdownlint-rule-browser-CN1TwJhU.js → markdownlint-rule-browser-BShldaY9.js} +1 -1
  88. package/dist/public/assets/{pending-receive-nav-store-NYViaTsT.js → pending-receive-nav-store-DIU-Po1C.js} +1 -1
  89. package/dist/public/assets/{preferred-session-events-78C4kXpL.js → preferred-session-events-Ayg96deM.js} +1 -1
  90. package/dist/public/assets/{progress-C_Q7qzuf.js → progress-BpdOUTnu.js} +1 -1
  91. package/dist/public/assets/{saved-themes-client-D5M6AESh.js → saved-themes-client-BdzXiLZg.js} +1 -1
  92. package/dist/public/assets/{schema-section-Cn4ovS7A.js → schema-section-AjQemGau.js} +1 -1
  93. package/dist/public/assets/{schemas-api-KjBzkxAy.js → schemas-api-C4CP1G39.js} +1 -1
  94. package/dist/public/assets/{selection-context-C9FxlvvI.js → selection-context-Dj_iPBku.js} +1 -1
  95. package/dist/public/assets/{skills-api-DfXaxEkX.js → skills-api-BUVVp6gv.js} +1 -1
  96. package/dist/public/assets/{src-zjRc3l1B.js → src-CS5ZPUzW.js} +1 -1
  97. package/dist/public/assets/storage-scope-DRWogX35.js +1 -0
  98. package/dist/public/assets/{tag-pill-input-D_82NbMi.js → tag-pill-input-BoyxN9pC.js} +1 -1
  99. package/dist/public/assets/{terminal-launch-events-BBXwmVEO.js → terminal-launch-events-Cy8GAcTt.js} +1 -1
  100. package/dist/public/assets/{typing-burst-detector-Ba4T0Jvq.js → typing-burst-detector-Clq1sSnx.js} +1 -1
  101. package/dist/public/assets/{use-activity-panel-DgFEYoQD.js → use-activity-panel-I5AELaRz.js} +1 -1
  102. package/dist/public/assets/{use-apply-config-color-theme-DyzsFMYv.js → use-apply-config-color-theme-lLFWDFMc.js} +1 -1
  103. package/dist/public/assets/{use-conflicts-B9eHyj9o.js → use-conflicts-B0yvUiLf.js} +1 -1
  104. package/dist/public/assets/{use-live-xterm-theme-D9OrOkx3.js → use-live-xterm-theme-BIzA-mu0.js} +1 -1
  105. package/dist/public/assets/{use-open-skill-DX2J-XUP.js → use-open-skill-Bro5-8rY.js} +1 -1
  106. package/dist/public/assets/{use-semantic-search-status-BGdqXgED.js → use-semantic-search-status-CGPJyDjj.js} +1 -1
  107. package/dist/public/assets/{use-skill-origin-BqSrJPU6.js → use-skill-origin-Cv_S5gSq.js} +1 -1
  108. package/dist/public/assets/{use-skill-targets-oy2zvORL.js → use-skill-targets-D-Tfz8TQ.js} +1 -1
  109. package/dist/public/assets/{use-skills-CV4zn3OT.js → use-skills-CRuEYkjM.js} +1 -1
  110. package/dist/public/assets/{use-terminal-enabled-MKxsix4h.js → use-terminal-enabled-DASwB3kR.js} +1 -1
  111. package/dist/public/assets/{use-timeline-entry-diff-DsZ2Vu7B.js → use-timeline-entry-diff-DePScbzI.js} +1 -1
  112. package/dist/public/assets/{use-workspace-Co3BqTgM.js → use-workspace-Bf2VHQrp.js} +1 -1
  113. package/dist/public/index.html +45 -45
  114. package/dist/{registry-probes-D5dvF5_p.mjs → registry-probes-CtY_1ly1.mjs} +1 -1
  115. package/dist/{removal-file-path-DS6d6rXv.mjs → removal-file-path-CNIqq13J.mjs} +1 -1
  116. package/dist/{repair-launch-json-DeeUYie-.mjs → repair-launch-json-CJpZgLgO.mjs} +1 -1
  117. package/dist/{repair-mcp-configs-BiaDq6t6.mjs → repair-mcp-configs-DlqDZ1Q-.mjs} +1 -1
  118. package/dist/{src-C6PcAkFe.mjs → src-CnRhVti_.mjs} +1 -1
  119. package/dist/src-lCnJgf0p.mjs +1 -0
  120. package/dist/start-CIrEb03P.mjs +1 -0
  121. package/dist/{start-BnlUHtZ0.mjs → start-UcVINga1.mjs} +3 -3
  122. package/package.json +4 -4
  123. package/dist/constants-BVdP6G-L.mjs +0 -1
  124. package/dist/init-CntqniVj.mjs +0 -1
  125. package/dist/loader-CMCaawsV.mjs +0 -1
  126. package/dist/preview-D7TWcjiE.mjs +0 -1
  127. package/dist/public/assets/FeedbackForm-CAstgJmN.js +0 -1
  128. package/dist/public/assets/ManagedArtifactProperties-DccpG1E9.js +0 -1
  129. package/dist/public/assets/config-schema-mXZFcyl-.js +0 -1
  130. package/dist/public/assets/field-controls-k0sTXrth.js +0 -1
  131. package/dist/public/assets/storage-scope-BVU9p11A.js +0 -1
  132. package/dist/src-DK3TyWH9.mjs +0 -1
  133. package/dist/start-CqqRLZzb.mjs +0 -1
@@ -1,3 +1,3 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-DzgjsZzC.js";import{n as s}from"./dist-BGzUo_18.js";import{t as c}from"./dist-C_FzPxEX2.js";import{u as l,v as u}from"./schemas-B93JY9Ef.js";import"./schemas-api-KjBzkxAy.js";import{n as d}from"./_envelope-Dwl6i2K9-DPqJ_Q4W.js";import{t as f}from"./arrow-up-right-nJaICi16.js";import{t as p}from"./check-B2OLRY33.js";import{t as m}from"./copy-DpWa6i2v.js";import{c as h,i as g,n as _,o as v,s as y,t as b}from"./dialog-BJEjKJjL.js";import{t as x}from"./input-C-Qm8YDT.js";import{t as S}from"./external-link-CldCnbtR.js";var C=e(n(),1),ee=a(),w=`github.com`,T=new Map,E=d.extend({type:l(`urn:ok:error:non-github-origin`),host:u().min(1).nullish().catch(null)});async function D(e){try{return await e.json()}catch{return}}async function O(e){return d.safeParse(await D(e)).data}async function k(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function A(e){let t=e?.host??w,n=await k(`/api/local-op/auth/status`,e);if(!n.ok){let e=await D(n),r=E.safeParse(e);if(r.success){let e=r.data.host??null;return{authenticated:!1,host:e??t,error:r.data.title,unsupportedOrigin:{host:e}}}return{authenticated:!1,host:t,error:d.safeParse(e).data?.title}}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 j(e){let t=e?.host??w,n=T.get(t);if(n)return n;let r=A(e).finally(()=>{T.delete(t)});return T.set(t,r),r}function M(e){let t=e.split(`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-DzgjsZzC.js";import{n as s}from"./dist-BGzUo_18.js";import{t as c}from"./dist-C_FzPxEX2.js";import{u as l,v as u}from"./schemas-B93JY9Ef.js";import"./schemas-api-C4CP1G39.js";import{n as d}from"./_envelope-Dwl6i2K9-DPqJ_Q4W.js";import{t as f}from"./arrow-up-right-nJaICi16.js";import{t as p}from"./check-B2OLRY33.js";import{t as m}from"./copy-DpWa6i2v.js";import{c as h,i as g,n as _,o as v,s as y,t as b}from"./dialog-BJEjKJjL.js";import{t as x}from"./input-C-Qm8YDT.js";import{t as S}from"./external-link-CldCnbtR.js";var C=e(n(),1),ee=a(),w=`github.com`,T=new Map,E=d.extend({type:l(`urn:ok:error:non-github-origin`),host:u().min(1).nullish().catch(null)});async function D(e){try{return await e.json()}catch{return}}async function O(e){return d.safeParse(await D(e)).data}async function k(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function A(e){let t=e?.host??w,n=await k(`/api/local-op/auth/status`,e);if(!n.ok){let e=await D(n),r=E.safeParse(e);if(r.success){let e=r.data.host??null;return{authenticated:!1,host:e??t,error:r.data.title,unsupportedOrigin:{host:e}}}return{authenticated:!1,host:t,error:d.safeParse(e).data?.title}}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 j(e){let t=e?.host??w,n=T.get(t);if(n)return n;let r=A(e).finally(()=>{T.delete(t)});return T.set(t,r),r}function M(e){let t=e.split(`
2
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 N(){return{status:j,async repos(e){let t=e?.host??`github.com`,n=await k(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:(await O(n))?.title??c._({id:`sGZLfB`})};let r=M(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||c._({id:`sGZLfB`})}}if(!r||!Array.isArray(r.repos))return{ok:!1,error:c._({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 k(`/api/local-op/auth/signout`,e);return t.ok?{ok:!0}:{ok:!1,error:(await O(t))?.title}}}}function P(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function F(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
3
  `);i=o.pop()??``;for(let e of o)if(e.trim()&&t(e)===`terminal`)return!0}}function I(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 L=2e3,R=1e4;function z(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 B(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 V(e,t,n,r){let i=N(),a=L;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 z(a,t),a=Math.min(a*1.5,R)}t.aborted||e({type:`error`,message:c._({id:`ve8vEM`})})}function te(e,t,n){let r=!1,i=I((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=c._({id:`LnVIW4`});try{let t=d.safeParse(await r.json());t.success&&(e=t.data.detail||t.data.title)}catch{}a({type:`error`,message:e});return}if(!r.body){a({type:`error`,message:c._({id:`LnVIW4`})});return}if(await F(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||c._({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:c._({id:`DskIkK`})});return}await V(a,i,n,t.host)}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;if(n!==null){await V(a,i,n,t.host);return}a({type:`error`,message:c._({id:`Q5fqMz`})})}})()});return{events:i.events,cancel:()=>{r||B(n),i.cancel()}}}function ne(){return{start(){return te(`/api/local-op/auth/login`,{json:!0},`login`)},ghLogin(e){return te(`/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=c._({id:`sNeKjP`});try{let e=d.safeParse(await n.json());e.success&&(r=e.data.detail||e.data.title)}catch{}return{ok:!1,error:r}}catch{return{ok:!1,error:c._({id:`Q5fqMz`})}}},async hostToken(e,t,n){try{let r=await fetch(`/api/local-op/auth/token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({host:e,username:t,token:n})});if(r.ok){let e=await r.json();return{ok:!0,login:typeof e.login==`string`?e.login:``}}let i=c._({id:`sNeKjP`});try{let e=d.safeParse(await r.json());e.success&&(i=e.data.detail||e.data.title)}catch{}return{ok:!1,error:i}}catch{return{ok:!1,error:c._({id:`Q5fqMz`})}}}}}function re(e){return{start(){return e.localOp.auth.start()}}}var H=t();async function ie(e){try{await navigator.clipboard.writeText(e)}catch{}}function ae(e){let t=(0,ee.c)(25),{onSuccess:n,startFlow:a}=e,{_:s}=i(),[c,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(`https://github.com/login/device`),[h,g]=(0,C.useState)(!1),[_,v]=(0,C.useState)(null),[y,b]=(0,C.useState)(null),[x,w]=(0,C.useState)(0),T=(0,C.useRef)(null),E=(0,C.useRef)(null),D;t[0]!==s||t[1]!==n||t[2]!==a?(D=async function(){v(null);try{let e=a();T.current=e.cancel;let t=e.events[Symbol.asyncIterator](),r=!1,i=await t.next();for(;!i.done;){let e=i.value;if(e.type===`verification`)l(e.user_code),d(e.verification_uri),b(Date.now()+e.expires_in*1e3),w(e.expires_in*1e3),ie(e.user_code).then(()=>{g(!0),setTimeout(()=>g(!1),2e3)});else if(e.type===`complete`){r=!0,n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){r=!0,v(e.message);break}i=await t.next()}r||v(s({id:`DskIkK`}))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&v(s({id:`Q5fqMz`}))}},t[0]=s,t[1]=n,t[2]=a,t[3]=D):D=t[3];let O=D,k;t[4]===O?k=t[5]:(k=()=>{let e=!1;return queueMicrotask(()=>{e||O()}),()=>{e=!0,T.current?.(),T.current=null,E.current&&clearInterval(E.current)}},t[4]=O,t[5]=k);let A;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(A=[],t[6]=A):A=t[6],(0,C.useEffect)(k,A);let j,M;t[7]!==s||t[8]!==y?(j=()=>{if(y!==null)return E.current=setInterval(()=>{let e=y-Date.now();e<=0?(w(0),E.current&&clearInterval(E.current),v(s({id:`ve8vEM`}))):w(e)},1e3),()=>{E.current&&clearInterval(E.current)}},M=[y,s],t[7]=s,t[8]=y,t[9]=j,t[10]=M):(j=t[9],M=t[10]),(0,C.useEffect)(j,M);let N=Math.floor(x/6e4),P=Math.floor(x%6e4/1e3),F;t[11]===P?F=t[12]:(F=P.toString().padStart(2,`0`),t[11]=P,t[12]=F);let I=`${N}:${F}`,L;t[13]!==s||t[14]!==h||t[15]!==_||t[16]!==I||t[17]!==c||t[18]!==u?(L=c?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,H.jsx)(r,{id:`eVPynQ`,values:{verificationUri:u},components:{0:(0,H.jsx)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>S(e,u),onAuxClick:e=>S(e,u),className:`inline-flex items-center gap-0.5 text-foreground hover:text-primary hover:underline`}),1:(0,H.jsx)(`span`,{}),2:(0,H.jsx)(f,{className:`inline size-3.5`,"aria-hidden":!0})}})}),(0,H.jsxs)(o,{type:`button`,variant:`outline`,"aria-label":s({id:`nCzR-G`,values:{userCode:c}}),onClick:()=>void ie(c).then(()=>{g(!0),setTimeout(()=>g(!1),2e3)}),className:`relative h-auto w-full justify-center rounded-md bg-muted px-12 py-3 hover:bg-muted/80`,children:[(0,H.jsx)(`code`,{className:`font-mono text-2xl font-bold tracking-widest`,children:c}),(0,H.jsx)(`span`,{className:`absolute right-3 text-muted-foreground`,"aria-hidden":`true`,children:h?(0,H.jsx)(p,{className:`size-4`}):(0,H.jsx)(m,{className:`size-4`})})]}),(0,H.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:h?(0,H.jsx)(r,{id:`80c4-P`}):null}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),(0,H.jsx)(r,{id:`5y_9lO`})]}),(0,H.jsx)(`span`,{children:(0,H.jsx)(r,{id:`gYz2ep`,values:{timeLabel:I}})})]})]}):(0,H.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:_?null:(0,H.jsx)(r,{id:`aWlJai`})}),t[13]=s,t[14]=h,t[15]=_,t[16]=I,t[17]=c,t[18]=u,t[19]=L):L=t[19];let R;t[20]===_?R=t[21]:(R=_&&(0,H.jsx)(`p`,{className:`text-1sm text-destructive`,children:_}),t[20]=_,t[21]=R);let z;return t[22]!==L||t[23]!==R?(z=(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[L,R]}),t[22]=L,t[23]=R,t[24]=z):z=t[24],z}function oe(e){let t=(0,ee.c)(30),{login:n,name:a,onNameChange:o,email:s,onEmailChange:c}=e,{_:l}=i(),u;t[0]===n?u=t[1]:(u=(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:(0,H.jsx)(r,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=u);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,H.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,H.jsx)(r,{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]===o?m=t[9]:(m=e=>o(e.target.value),t[8]=o,t[9]=m);let h;t[10]!==a||t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,H.jsx)(x,{"aria-label":f,placeholder:p,value:a,onChange:m}),t[10]=a,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]===c?v=t[20]:(v=e=>c(e.target.value),t[19]=c,t[20]=v);let y;t[21]!==s||t[22]!==g||t[23]!==_||t[24]!==v?(y=(0,H.jsx)(x,{type:`email`,"aria-label":g,placeholder:_,value:s,onChange:v}),t[21]=s,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,H.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 se(e){let t=(0,ee.c)(37),{host:n,token:a,onTokenChange:s,error:c,onSubmit:l,showGhOption:u,onGhSignIn:d}=e,{_:p}=i(),m=`https://${n}/settings/tokens/new?scopes=repo,read:user&description=OpenKnowledge`,h;t[0]!==n||t[1]!==d||t[2]!==u?(h=u?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(o,{type:`button`,onClick:d,children:(0,H.jsx)(r,{id:`_SDGzH`})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,H.jsx)(r,{id:`8L0EPw`}),(0,H.jsx)(`span`,{className:`h-px flex-1 bg-border`})]})]}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,H.jsx)(r,{id:`8k6INX`,values:{host:n},components:{0:(0,H.jsx)(`span`,{className:`font-medium text-foreground`})}})}),t[0]=n,t[1]=d,t[2]=u,t[3]=h):h=t[3];let g,_;t[4]===m?(g=t[5],_=t[6]):(g=e=>S(e,m),_=e=>S(e,m),t[4]=m,t[5]=g,t[6]=_);let v;t[7]===n?v=t[8]:(v=(0,H.jsx)(r,{id:`6hYjww`,values:{host:n}}),t[7]=n,t[8]=v);let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,H.jsx)(f,{className:`inline size-3.5`,"aria-hidden":!0}),t[9]=y):y=t[9];let b;t[10]!==m||t[11]!==g||t[12]!==_||t[13]!==v?(b=(0,H.jsxs)(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,onClick:g,onAuxClick:_,className:`inline-flex w-fit items-center gap-0.5 text-sm text-foreground hover:text-primary hover:underline`,children:[v,y]}),t[10]=m,t[11]=g,t[12]=_,t[13]=v,t[14]=b):b=t[14];let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,H.jsx)(r,{id:`Xg-Ntj`})}),t[15]=C):C=t[15];let w;t[16]===p?w=t[17]:(w=p({id:`p2LEhJ`}),t[16]=p,t[17]=w);let T;t[18]===s?T=t[19]:(T=e=>s(e.target.value),t[18]=s,t[19]=T);let E;t[20]===l?E=t[21]:(E=e=>{e.key===`Enter`&&l()},t[20]=l,t[21]=E);let D;t[22]!==E||t[23]!==w||t[24]!==T||t[25]!==a?(D=(0,H.jsx)(x,{type:`password`,"aria-label":w,placeholder:`ghp_`,value:a,onChange:T,onKeyDown:E}),t[22]=E,t[23]=w,t[24]=T,t[25]=a,t[26]=D):D=t[26];let O;t[27]===c?O=t[28]:(O=c&&(0,H.jsx)(`p`,{className:`text-1sm text-destructive`,children:c}),t[27]=c,t[28]=O);let k;t[29]===u?k=t[30]:(k=!u&&(0,H.jsxs)(`div`,{className:`mt-1 rounded-md border border-border/60 bg-muted/40 p-3 text-sm text-muted-foreground`,children:[(0,H.jsx)(`p`,{children:(0,H.jsx)(r,{id:`qX-ABr`})}),(0,H.jsxs)(`ol`,{className:`mt-1.5 list-decimal space-y-0.5 pl-5`,children:[(0,H.jsx)(`li`,{children:(0,H.jsx)(r,{id:`jxtXZI`})}),(0,H.jsx)(`li`,{children:(0,H.jsx)(r,{id:`9Vh9Jf`})})]})]}),t[29]=u,t[30]=k);let A;return t[31]!==h||t[32]!==D||t[33]!==O||t[34]!==k||t[35]!==b?(A=(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,b,C,D,O,k]}),t[31]=h,t[32]=D,t[33]=O,t[34]=k,t[35]=b,t[36]=A):A=t[36],A}var ce=1e4;function le(e){let t=(0,ee.c)(94),{open:n,onOpenChange:a,onSuccess:c,identityPrompt:l,reauth:u,transport:d,queryTransport:f,host:p,ghAvailable:m}=e,{_:x}=i(),S;t[0]===d?S=t[1]:(S=d??ne(),t[0]=d,t[1]=S);let w=S,T;t[2]===f?T=t[3]:(T=f??N(),t[2]=f,t[3]=T);let E=T,[D,O]=(0,C.useState)(`auth`),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(``),[P,F]=(0,C.useState)(``),[I,L]=(0,C.useState)(``),[R,z]=(0,C.useState)(null),[B,V]=(0,C.useState)(!1),[te,re]=(0,C.useState)(void 0),[ie,le]=(0,C.useState)(void 0),U=p??te,de=!!U&&U!==`github.com`&&!!(m??ie)&&typeof w.ghLogin==`function`,W=!l&&p===void 0,fe,pe;t[4]!==p||t[5]!==l||t[6]!==W||t[7]!==n?(fe=()=>{n&&(A(null),M(``),F(``),L(``),z(null),V(!1),re(void 0),le(void 0),O(l||W?`checking`:p&&p!==`github.com`?`pat`:`auth`))},pe=[n,l,p,W],t[4]=p,t[5]=l,t[6]=W,t[7]=n,t[8]=fe,t[9]=pe):(fe=t[8],pe=t[9]),(0,C.useLayoutEffect)(fe,pe);let me;t[10]!==l||t[11]!==n||t[12]!==E?(me=()=>{if(!n||!l)return;let e=!1,t=t=>{e||(e=!0,O(t))},r=setTimeout(()=>t(`auth`),ce);return E.status().then(n=>{e||(n.authenticated?(A({login:n.login,name:n.name,email:n.email}),M(n.name??``),F(n.email??``),t(`identity`)):t(`auth`))}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[10]=l,t[11]=n,t[12]=E,t[13]=me):me=t[13];let he;t[14]!==l||t[15]!==n?(he=[n,l],t[14]=l,t[15]=n,t[16]=he):he=t[16],(0,C.useEffect)(me,he);let ge;t[17]!==x||t[18]!==W||t[19]!==a||t[20]!==n||t[21]!==E?(ge=()=>{if(!n||!W)return;let e=!1,t=t=>{e||(e=!0,O(t))},r=setTimeout(()=>t(`auth`),ce),i=t=>{e||(e=!0,s.error(t),a(!1))};return E.status().then(n=>{if(e)return;if(!n.authenticated&&n.unsupportedOrigin!==void 0){i(n.error??x({id:`qimTXH`}));return}let r=!!n.host&&n.host!==`github.com`;re(n.host),le(n.ghAvailable),t(r?`pat`:`auth`)}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[17]=x,t[18]=W,t[19]=a,t[20]=n,t[21]=E,t[22]=ge):ge=t[22];let _e;t[23]!==W||t[24]!==n?(_e=[n,W],t[23]=W,t[24]=n,t[25]=_e):_e=t[25],(0,C.useEffect)(ge,_e);let ve;t[26]!==x||t[27]!==l||t[28]!==a||t[29]!==c?(ve=function(e){if(A(e),l)M(e.name??``),F(e.email??``),O(`identity`);else{O(`done`),c?.(e),a(!1);let t=e.login;s.success(x(t?{id:`E_tNGD`,values:{login:t}}:{id:`cgl-gn`}))}},t[26]=x,t[27]=l,t[28]=a,t[29]=c,t[30]=ve):ve=t[30];let G=ve,ye;t[31]!==x||t[32]!==U||t[33]!==G||t[34]!==B||t[35]!==I||t[36]!==w?(ye=async function(){let e=I.trim();if(!e||!U||B)return;if(!w.pat){z(x({id:`iMYFJM`}));return}V(!0),z(null);let t=await w.pat(U,e);V(!1),t.ok?G({login:t.login??``}):z(t.error??x({id:`sNeKjP`}))},t[31]=x,t[32]=U,t[33]=G,t[34]=B,t[35]=I,t[36]=w,t[37]=ye):ye=t[37];let be=ye,xe;t[38]!==x||t[39]!==k||t[40]!==a||t[41]!==c?(xe=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(ue);let n={...k??{login:``},name:e,email:t};O(`done`),c?.(n),a(!1);let r=n.login;s.success(x(r?{id:`E_tNGD`,values:{login:r}}:{id:`cgl-gn`}))},t[38]=x,t[39]=k,t[40]=a,t[41]=c,t[42]=xe):xe=t[42];let Se=xe,Ce;t[43]!==x||t[44]!==k||t[45]!==a||t[46]!==c?(Ce=function(){if(!k)return;O(`done`),c?.(k),a(!1);let e=k.login;s.success(x(e?{id:`E_tNGD`,values:{login:e}}:{id:`cgl-gn`}))},t[43]=x,t[44]=k,t[45]=a,t[46]=c,t[47]=Ce):Ce=t[47];let we=Ce,Te;t[48]===a?Te=t[49]:(Te=function(){a(!1)},t[48]=a,t[49]=Te);let K=Te,q;t[50]!==l||t[51]!==u||t[52]!==D?(q=(0,H.jsx)(y,{children:(0,H.jsx)(h,{children:u&&(D===`pat`||D===`gh-device`)?(0,H.jsx)(r,{id:`DUWgfT`}):u?(0,H.jsx)(r,{id:`X8kjQX`}):D===`pat`||D===`gh-device`?(0,H.jsx)(r,{id:`tzZ6ha`}):l&&D!==`auth`?(0,H.jsx)(r,{id:`29XZXN`}):(0,H.jsx)(r,{id:`3jod3l`})})}),t[50]=l,t[51]=u,t[52]=D,t[53]=q):q=t[53];let J;t[54]===D?J=t[55]:(J=D===`checking`&&(0,H.jsx)(_,{children:(0,H.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:(0,H.jsx)(r,{id:`gBbxn_`})})}),t[54]=D,t[55]=J);let Y;t[56]!==G||t[57]!==K||t[58]!==w||t[59]!==D?(Y=D===`auth`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{children:(0,H.jsx)(ae,{onSuccess:G,startFlow:()=>w.start()})}),(0,H.jsx)(v,{children:(0,H.jsx)(o,{variant:`outline`,onClick:K,children:(0,H.jsx)(r,{id:`dEgA5A`})})})]}),t[56]=G,t[57]=K,t[58]=w,t[59]=D,t[60]=Y):Y=t[60];let X;t[61]!==de||t[62]!==U||t[63]!==K||t[64]!==be||t[65]!==R||t[66]!==B||t[67]!==I||t[68]!==D?(X=D===`pat`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{children:(0,H.jsx)(se,{host:U??``,token:I,onTokenChange:L,error:R,onSubmit:be,showGhOption:de,onGhSignIn:()=>O(`gh-device`)})}),(0,H.jsxs)(v,{children:[(0,H.jsx)(o,{variant:`outline`,onClick:K,children:(0,H.jsx)(r,{id:`dEgA5A`})}),(0,H.jsx)(o,{onClick:be,disabled:!I.trim()||B,children:B?(0,H.jsx)(r,{id:`9zb2WA`}):(0,H.jsx)(r,{id:`iSLIjg`})})]})]}),t[61]=de,t[62]=U,t[63]=K,t[64]=be,t[65]=R,t[66]=B,t[67]=I,t[68]=D,t[69]=X):X=t[69];let Z;t[70]!==U||t[71]!==G||t[72]!==K||t[73]!==w||t[74]!==D?(Z=D===`gh-device`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{children:(0,H.jsx)(ae,{onSuccess:G,startFlow:()=>w.ghLogin?.(U??``)??w.start()})}),(0,H.jsxs)(v,{children:[(0,H.jsx)(o,{variant:`ghost`,onClick:()=>O(`pat`),children:(0,H.jsx)(r,{id:`hLKfZe`})}),(0,H.jsx)(o,{variant:`outline`,onClick:K,children:(0,H.jsx)(r,{id:`dEgA5A`})})]})]}),t[70]=U,t[71]=G,t[72]=K,t[73]=w,t[74]=D,t[75]=Z):Z=t[75];let Q;t[76]!==k||t[77]!==Se||t[78]!==we||t[79]!==P||t[80]!==j||t[81]!==D?(Q=D===`identity`&&k&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{children:(0,H.jsx)(oe,{login:k.login,name:j,onNameChange:M,email:P,onEmailChange:F})}),(0,H.jsxs)(v,{children:[(0,H.jsx)(o,{variant:`ghost`,onClick:we,children:(0,H.jsx)(r,{id:`6Uau97`})}),(0,H.jsx)(o,{onClick:()=>Se(j.trim(),P.trim()),disabled:!j.trim()||!P.trim(),children:(0,H.jsx)(r,{id:`tfDRzk`})})]})]}),t[76]=k,t[77]=Se,t[78]=we,t[79]=P,t[80]=j,t[81]=D,t[82]=Q):Q=t[82];let $;t[83]!==q||t[84]!==J||t[85]!==Y||t[86]!==X||t[87]!==Z||t[88]!==Q?($=(0,H.jsxs)(g,{className:`sm:max-w-md`,children:[q,J,Y,X,Z,Q]}),t[83]=q,t[84]=J,t[85]=Y,t[86]=X,t[87]=Z,t[88]=Q,t[89]=$):$=t[89];let Ee;return t[90]!==a||t[91]!==n||t[92]!==$?(Ee=(0,H.jsx)(b,{open:n,onOpenChange:a,children:$}),t[90]=a,t[91]=n,t[92]=$,t[93]=Ee):Ee=t[93],Ee}function ue(){}export{N as a,I as i,ne as n,P as o,re as r,le as t};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-D5mDCusD.js","./chunk-CYidjpOJ.js","./dist-D2SphF3p.js","./w3c-keyname-C7Rznu6R.js","./dist-BxTTaZ5o.js","./dist-BkE9d74i.js","./dist-DLvJCXqg.js","./dist-DKYEqMZn.js","./dist-D0SVNMDP.js","./stex-CUzil_LB.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{r as i}from"./dist-Nvb76hAm.js";import{n as a}from"./dist-PQ5KMVDh.js";import{t as o}from"./react-dom-DPxgxlDT.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{n as c,t as l}from"./with-selector-zVo3Fruj.js";import{a as u,d,i as f,l as p,r as m,u as h}from"./floating-ui.dom-DkPPH5vF.js";import{d as g,g as _,i as v,l as y,n as b,o as x,r as S,t as C,u as w}from"./constants-upload-CVKO8P4d.js";import{$ as T,A as ee,B as E,C as te,F as ne,G as re,K as ie,L as D,N as O,P as ae,Q as oe,R as se,S as ce,T as le,U as ue,V as de,W as fe,X as pe,Y as me,_ as he,a as ge,at as k,b as _e,bt as A,c as ve,ct as j,d as ye,et as be,f as xe,g as Se,gt as Ce,h as we,ht as Te,it as M,k as Ee,l as N,mt as De,n as Oe,nt as ke,o as P,ot as Ae,p as je,q as Me,r as Ne,rt as Pe,s as Fe,st as Ie,t as Le,tt as Re,u as ze,ut as Be,v as Ve,vt as F,w as He,x as Ue,y as We,z as I}from"./dist-Dc8tD1th.js";import{t as Ge}from"./dist-C_FzPxEX2.js";import{C as Ke,a as qe,g as Je,w as Ye}from"./schemas-api-KjBzkxAy.js";import{t as Xe}from"./util-doc-name-D-_o-n0R.js";import{n as Ze}from"./_envelope-Dwl6i2K9-DPqJ_Q4W.js";import{t as Qe}from"./note-window-mode-CI3Yju9B.js";import{i as $e}from"./use-apply-config-theme-CYFG76sS.js";import{t as et}from"./createLucideIcon-DdBzwsHe.js";import{t as tt}from"./folder-open-COGOeTzI.js";import{t as nt}from"./trash-2-CchZ0T47.js";import{n as rt,r as it}from"./structural-freshness-CIbkMFA3-CWi_lyiW.js";import{c as at,d as ot,l as st}from"./doc-hash-BJkweiX9.js";import{O as ct,_ as lt,b as ut,d as dt,f as ft,g as pt,h as mt,o as ht,p as gt,v as _t,w as vt,x as yt}from"./navigation-targets-BVafzc0v.js";import{t as bt}from"./doc-paths-cEiFVCxr.js";import{$ as xt,A as St,C as Ct,G as wt,H as Tt,I as Et,J as Dt,K as Ot,L as kt,M as At,O as jt,P as Mt,Q as Nt,R as Pt,S as Ft,U as It,W as Lt,X as Rt,Z as zt,_ as Bt,a as Vt,b as Ht,c as Ut,d as Wt,et as Gt,f as Kt,h as qt,it as Jt,j as Yt,k as Xt,l as Zt,m as Qt,nt as $t,o as en,p as tn,rt as nn,s as rn,u as an,v as on,w as sn,x as cn,y as ln}from"./config-provider-BDWGnun_.js";import{At as un,Ct as dn,E as fn,F as pn,G as mn,I as L,J as hn,K as gn,M as _n,Mt as vn,Nt as yn,P as R,Tt as bn,X as xn,a as z,c as Sn,f as Cn,l as wn,lt as Tn,o as En,r as Dn,t as On,ut as kn}from"./dist-D2SphF3p.js";import{A as An,C as jn,E as Mn,H as Nn,I as Pn,L as Fn,M as In,N as Ln,O as Rn,P as zn,R as B,S as Bn,T as Vn,_ as Hn,a as Un,b as Wn,c as Gn,h as Kn,k as qn,m as Jn,o as Yn,t as Xn,x as Zn,y as Qn,z as $n}from"./lib-QQS1Brzc.js";import{t as er}from"./ccount-BoHE53_k.js";import{n as tr,r as nr}from"./lib-DlDYgFfS.js";import{c as rr,f as ir,n as ar,r as or,t as sr,u as cr}from"./trim-lines-DfV8CCf7.js";import{u as lr}from"./space-separated-tokens-l9yufOSK.js";import{n as ur,t as dr}from"./syntax-CKL08zSk.js";import{n as fr,r as pr,t as mr}from"./cm-theme-Cvtw80TE.js";import{i as hr,n as gr}from"./page-list-cache-s0lTSAFU.js";import{t as _r}from"./documents-fetch-Y7Dt9_Tn.js";import{i as vr,n as yr,r as br,t as xr}from"./dist-DseqKdAU.js";import{n as Sr,r as Cr,t as wr}from"./dist-BxTTaZ5o.js";import{t as Tr}from"./dist-CjyZozAk.js";import{n as Er}from"./dist-C2Kstufe.js";import{n as Dr}from"./dist-BvhrN0Uj.js";import{n as Or}from"./dist-D5mDCusD.js";import{i as kr,n as Ar,r as jr}from"./dist-BpU-J2LR.js";import{n as Mr}from"./dist-BkE9d74i.js";import{t as Nr}from"./stex-CUzil_LB.js";import{n as Pr,r as Fr}from"./external-link-CldCnbtR.js";var Ir=et(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),Lr=et(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Rr=et(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),zr=et(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Br=et(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),V=n(),H=e(r(),1),Vr=e(o(),1),Hr=s(),Ur=c();function Wr(e){return e.editorView}var Gr=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function Kr(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function qr(e){let t=Kr(e);return t!==null&&Gr.has(t)}function Jr(e){let t=Kr(e);return t===null?null:Gr.get(t)??null}var Yr=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function Xr(e){Yr.lastIndex=0;let t=e.match(Yr);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=Jr(e);if(t===null)return null;n+=t}return n}var Zr=()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else n!==void 0&&n()}},Qr=/[\uD800-\uDBFF]/,$r=/[\uDC00-\uDFFF]/,ei=(e,t)=>{let n=0,r=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;for(n>0&&Qr.test(e[n-1])&&n--;r+n<e.length&&r+n<t.length&&e[e.length-r-1]===t[t.length-r-1];)r++;return r>0&&$r.test(e[e.length-r])&&r--,{index:n,remove:e.length-n-r,insert:t.slice(n,t.length-r)}},ti=(e,t)=>e>>>t|e<<32-t,ni=e=>ti(e,2)^ti(e,13)^ti(e,22),ri=e=>ti(e,6)^ti(e,11)^ti(e,25),ii=e=>ti(e,7)^ti(e,18)^e>>>3,ai=e=>ti(e,17)^ti(e,19)^e>>>10,oi=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),si=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ci=class{constructor(){let e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(si),this._W=new Uint32Array(e,64,64)}_updateHash(){let e=this._H,t=this._W;for(let e=16;e<64;e++)t[e]=ai(t[e-2])+t[e-7]+ii(t[e-15])+t[e-16];let n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7];for(let e=0,u,d;e<64;e++)u=l+ri(o)+(o&s^~o&c)+oi[e]+t[e]>>>0,d=ni(n)+(n&r^n&i^r&i)>>>0,l=c,c=s,s=o,o=a+u>>>0,a=i,i=r,r=n,n=u+d>>>0;e[0]+=n,e[1]+=r,e[2]+=i,e[3]+=a,e[4]+=o,e[5]+=s,e[6]+=c,e[7]+=l}digest(e){let t=0;for(;t+56<=e.length;){let n=0;for(;n<16&&t+3<e.length;n++)this._W[n]=e[t++]<<24|e[t++]<<16|e[t++]<<8|e[t++];if(t%64!=0){for(this._W.fill(0,n,16);t<e.length;)this._W[n]|=e[t]<<(3-t%4)*8,t++;this._W[n]|=128<<(3-t%4)*8}this._updateHash()}let n=t%64!=0;this._W.fill(0,0,16);let r=0;for(;t<e.length;r++)for(let n=3;n>=0&&t<e.length;n--)this._W[r]|=e[t++]<<n*8;n||(this._W[r-(t%4==0?0:1)]|=128<<(3-t%4)*8),this._W[14]=e.byteLength/Nt,this._W[15]=e.byteLength*8,this._updateHash();let i=new Uint8Array(32);for(let e=0;e<this._H.length;e++)for(let t=0;t<4;t++)i[e*4+t]=this._H[e]>>>(3-t)*8;return i}},li=e=>new ci().digest(e),U=new k(`y-sync`),ui=new k(`y-undo`),di=new k(`yjs-cursor`),fi=e=>{for(let t=6;t<e.length;t++)e[t%6]=e[t%6]^e[t];return e.slice(0,6)},pi=e=>It(fi(li(Tt(e)))),mi=()=>({mapping:new Map,isOMark:new Map}),hi=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&t.sv.get(e.id.client)>e.id.clock&&!St(t.ds,e.id),gi=[{light:`#ecd44433`,dark:`#ecd444`}],_i=(e,t,n)=>{if(!e.has(n)){if(e.size<t.length){let n=$t();e.forEach(e=>n.add(e)),t=t.filter(e=>!n.has(e))}e.set(n,Dt(t))}return e.get(n)},vi=(e,{colors:t=gi,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:a}={})=>{let o=!1,s=new Si(e,a),c=new M({props:{editable:e=>{let t=U.getState(e);return t.snapshot==null&&t.prevSnapshot==null}},key:U,state:{init:(i,a)=>({type:e,doc:e.doc,binding:s,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:t,colorMapping:n,permanentUserData:r}),apply:(e,t)=>{let n=e.getMeta(U);if(n!==void 0){t=Object.assign({},t);for(let e in n)t[e]=n[e]}return t.addToHistory=e.getMeta(`addToHistory`)!==!1,t.isChangeOrigin=n!==void 0&&!!n.isChangeOrigin,t.isUndoRedoOperation=n!==void 0&&!!n.isChangeOrigin&&!!n.isUndoRedoOperation,s.prosemirrorView!==null&&n!==void 0&&(n.snapshot!=null||n.prevSnapshot!=null)&&kt(0,()=>{s.prosemirrorView!=null&&(n.restore==null?s._renderSnapshot(n.snapshot,n.prevSnapshot,t):(s._renderSnapshot(n.snapshot,n.snapshot,t),delete t.restore,delete t.snapshot,delete t.prevSnapshot,s.mux(()=>{s._prosemirrorChanged(s.prosemirrorView.state.doc)})))}),t}},view:e=>(s.initView(e),a??s._forceRerender(),i(),{update:()=>{let t=c.getState(e.state);if(t.snapshot==null&&t.prevSnapshot==null&&(o||e.state.doc.content.findDiffStart(e.state.doc.type.createAndFill().content)!==null)){if(o=!0,t.addToHistory===!1&&!t.isChangeOrigin){let t=ui.getState(e.state),n=t&&t.undoManager;n&&n.stopCapturing()}s.mux(()=>{t.doc.transact(n=>{n.meta.set(`addToHistory`,t.addToHistory),s._prosemirrorChanged(e.state.doc)},U)})}},destroy:()=>{s.destroy()}})});return c},yi=(e,t,n)=>{if(t!==null&&t.anchor!==null&&t.head!==null)if(t.type===`all`)e.setSelection(new ke(e.doc));else if(t.type===`node`){let r=ea(n.doc,n.type,t.anchor,n.mapping);e.setSelection(bi(e,r))}else{let r=ea(n.doc,n.type,t.anchor,n.mapping),i=ea(n.doc,n.type,t.head,n.mapping);r!==null&&i!==null&&e.setSelection(j.between(e.doc.resolve(r),e.doc.resolve(i)))}},bi=(e,t)=>{let n=e.doc.resolve(t);return n.nodeAfter?Pe.create(e.doc,t):j.near(n)},xi=(e,t)=>({type:t.selection.jsonID,anchor:Qi(t.selection.anchor,e.type,e.mapping),head:Qi(t.selection.head,e.type,e.mapping)}),Si=class{constructor(e,t=new Map){this.type=e,this.prosemirrorView=null,this.mux=Zr(),this.mapping=t,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=xi(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta(`addToHistory`,!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(Lt&&this._domSelectionInView===null&&(kt(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){let e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;let t=this.prosemirrorView._root.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.getClientRects().length===0&&t.startContainer&&t.collapsed&&t.selectNodeContents(t.startContainer);let n=t.getBoundingClientRect(),r=Pt.documentElement;return n.bottom>=0&&n.right>=0&&n.left<=(window.innerWidth||r.clientWidth||0)&&n.top<=(window.innerHeight||r.clientHeight||0)}renderSnapshot(e,t){t||=sn(Ht(),new Map),this.prosemirrorView.dispatch(this._tr.setMeta(U,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{let e=this.type.toArray().map(e=>wi(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new A(F.from(e),0,0));t.setMeta(U,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(t)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{let e=this.beforeTransactionSelection===null?this.prosemirrorView.state.selection:null,t=this.type.toArray().map(e=>wi(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new A(F.from(t),0,0));if(e){let t=Gt(xt(e.anchor,0),n.doc.content.size),r=Gt(xt(e.head,0),n.doc.content.size);n.setSelection(j.create(n.doc,t,r))}this.prosemirrorView.dispatch(n.setMeta(U,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,t,n){let r=this.doc,i=this.type;if(e||=Mt(this.doc),e instanceof Uint8Array||t instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(t instanceof Uint8Array))&&zt(),r=new Ut({gc:!1}),Bt(r,t),t=Mt(r),Bt(r,e),e=Mt(r),i._item===null){let e=Array.from(this.doc.share.keys()).find(e=>this.doc.share.get(e)===this.type);i=r.getXmlFragment(e)}else{let e=r.store.clients.get(i._item.id.client)??[];i=e[jt(e,i._item.id.clock)].content.type}this.mapping.clear(),this.mux(()=>{r.transact(r=>{let a=n.permanentUserData;a&&a.dss.forEach(e=>{At(r,e,e=>{})});let o=(e,t)=>{let r=e===`added`?a.getUserByClientId(t.client):a.getUserByDeletedId(t);return{user:r,type:e,color:_i(n.colorMapping,n.colors,r)}},s=Et(i,new Wt(t.ds,e.sv)).map(n=>!n._item.deleted||hi(n._item,e)||hi(n._item,t)?wi(n,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,t,o):null).filter(e=>e!==null),c=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new A(F.from(s),0,0));this.prosemirrorView.dispatch(c.setMeta(U,{isChangeOrigin:!0}))},U)})}_typeChanged(e,t){if(this.prosemirrorView==null)return;let n=U.getState(this.prosemirrorView.state);if(e.length===0||n.snapshot!=null||n.prevSnapshot!=null){this.renderSnapshot(n.snapshot,n.prevSnapshot);return}this.mux(()=>{let e=(e,t)=>this.mapping.delete(t);At(t,t.deleteSet,e=>{if(e.constructor===Zt){let t=e.content.type;t&&this.mapping.delete(t)}}),t.changed.forEach(e),t.changedParentTypes.forEach(e);let n=this.type.toArray().map(e=>Ci(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new A(F.from(n),0,0));yi(r,this.beforeTransactionSelection,this),r=r.setMeta(U,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof Kt}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&r.scrollIntoView(),this.prosemirrorView.dispatch(r)})}_prosemirrorChanged(e){this.doc.transact(()=>{Gi(this.doc,this.type,e,this),this.beforeTransactionSelection=xi(this,this.prosemirrorView.state)},U)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on(`beforeAllTransactions`,this.beforeAllTransactions),this.doc.on(`afterAllTransactions`,this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off(`beforeAllTransactions`,this.beforeAllTransactions),this.doc.off(`afterAllTransactions`,this.afterAllTransactions))}},Ci=(e,t,n,r,i,a)=>{let o=n.mapping.get(e);if(o===void 0){if(e instanceof Qt)return wi(e,t,n,r,i,a);throw Rt()}return o},wi=(e,t,n,r,i,a)=>{let o=[],s=e=>{if(e instanceof Qt){let s=Ci(e,t,n,r,i,a);s!==null&&o.push(s)}else{let s=e._item.right?.content?.type;s instanceof tn&&!s._item.deleted&&s._item.id.client===s.doc.clientID&&(e.applyDelta([{retain:e.length},...s.toDelta()]),s.doc.transact(e=>{s._item.delete(e)}));let c=Ti(e,t,n,r,i,a);c!==null&&c.forEach(e=>{e!==null&&o.push(e)})}};r===void 0||i===void 0?e.toArray().forEach(s):Et(e,new Wt(i.ds,r.sv)).forEach(s);try{let s=e.getAttributes(r);r!==void 0&&(hi(e._item,r)?hi(e._item,i)||(s.ychange=a?a(`added`,e._item.id):{type:`added`}):s.ychange=a?a(`removed`,e._item.id):{type:`removed`});let c=Pi(s),l=Ui(c.marks,t),u=t.node(e.nodeName,c.plain,o,l.length?l:void 0);return n.mapping.set(e,u),u}catch(r){console.warn(`[y-prosemirror] schema.node(`+e.nodeName+`) threw:`,String(r&&r.message||r));let i=globalThis.__okYpsCounters=globalThis.__okYpsCounters||{block:0,inline:0};if(t.nodes[e.nodeName]&&t.nodes[e.nodeName].spec&&t.nodes[e.nodeName].spec.inline)i.inline++;else if(i.block++,t.nodes.rawMdxFallback)try{let i=t.node(`rawMdxFallback`,{reason:String(r&&r.message||r)},[t.text(e.nodeName)]);return n.mapping.set(e,i),i}catch(e){console.warn(`[y-prosemirror] rawMdxFallback substitution also failed:`,String(e&&e.message||e))}return n.mapping.delete(e),null}},Ti=(e,t,n,r,i,a)=>{let o=[],s=e.toDelta(r,i,a);try{for(let e=0;e<s.length;e++){let n=s[e];o.push(t.text(n.insert,Ui(n.attributes,t)))}}catch(e){console.warn(`[y-prosemirror] schema.text() threw:`,String(e&&e.message||e));let t=globalThis.__okYpsCounters=globalThis.__okYpsCounters||{block:0,inline:0};return t.inline++,null}return o},Ei=(e,t)=>{let n=new qt,r=e.map(e=>({insert:e.text,attributes:Wi(e.marks,t)}));return n.applyDelta(r),t.mapping.set(n,e),n},Di=(e,t)=>{let n=new Qt(e.type.name);for(let t in e.attrs){let r=e.attrs[t];r!==null&&t!==`ychange`&&n.setAttribute(t,r)}let r=Wi(e.marks||[],t);for(let e in r)n.setAttribute(Ni+e,{...r[e]});return n.insert(0,ji(e).map(e=>Oi(e,t))),t.mapping.set(n,e),n},Oi=(e,t)=>e instanceof Array?Ei(e,t):Di(e,t),ki=e=>typeof e==`object`&&!!e,Ai=(e,t)=>{let n=Object.keys(e).filter(t=>e[t]!==null),r=n.length===Object.keys(t).filter(e=>t[e]!==null).length;for(let i=0;i<n.length&&r;i++){let a=n[i],o=e[a],s=t[a];r=a===`ychange`||o===s||ki(o)&&ki(s)&&Ai(o,s)}return r},ji=e=>{let t=e.content.content,n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.isText){let r=[];for(let n=t[e];e<t.length&&n.isText;n=t[++e])r.push(n);e--,n.push(r)}else n.push(r)}return n},Mi=(e,t)=>{let n=e.toDelta();return n.length===t.length&&n.every((e,n)=>e.insert===t[n].text&&Ot(e.attributes||{}).length===t[n].marks.length&&wt(e.attributes,(e,r)=>{let i=Hi(r),a=t[n].marks;return a.find(e=>e.type.name===i)?Ai(e,a.find(e=>e.type.name===i)?.attrs):!1}))},Ni=`ymark:`,Pi=e=>{let t={},n={};for(let r in e)r.startsWith(Ni)?n[r.slice(6)]=e[r]:t[r]=e[r];return{plain:t,marks:n}},Fi=(e,t)=>{let n=Object.keys(e);return n.length===t.length?n.every(n=>{let r=Hi(n),i=t.find(e=>e.type.name===r);return i?Ai(e[n],i.attrs):!1}):!1},Ii=(e,t)=>{if(e instanceof Qt&&!(t instanceof Array)&&Ki(e,t)){let n=ji(t),r=Pi(e.getAttributes());return e._length===n.length&&Fi(r.marks,t.marks)&&Ai(r.plain,t.attrs)&&e.toArray().every((e,t)=>Ii(e,n[t]))}return e instanceof qt&&t instanceof Array&&Mi(e,t)},Li=(e,t)=>e===t||e instanceof Array&&t instanceof Array&&e.length===t.length&&e.every((e,n)=>t[n]===e),Ri=(e,t,n)=>{let r=e.toArray(),i=ji(t),a=i.length,o=r.length,s=Gt(o,a),c=0,l=0,u=!1;for(;c<s;c++){let e=r[c],t=i[c];if(Li(n.mapping.get(e),t))u=!0;else if(!Ii(e,t))break}for(;c+l<s;l++){let e=r[o-l-1],t=i[a-l-1];if(Li(n.mapping.get(e),t))u=!0;else if(!Ii(e,t))break}return{equalityFactor:c+l,foundMappedChild:u}},zi=e=>{let t=``,n=e._start,r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof en?t+=n.content.str:n.content instanceof Vt&&(r[n.content.key]=null)),n=n.right;return{str:t,nAttrs:r}},Bi=(e,t,n)=>{n.mapping.set(e,t);let{nAttrs:r,str:i}=zi(e),a=t.map(e=>({insert:e.text,attributes:Object.assign({},r,Wi(e.marks,n))})),{insert:o,remove:s,index:c}=ei(i,a.map(e=>e.insert).join(``));e.delete(c,s),e.insert(c,o),e.applyDelta(a.map(e=>({retain:e.insert.length,attributes:e.attributes})))},Vi=/(.*)(--[a-zA-Z0-9+/=]{8})$/,Hi=e=>Vi.exec(e)?.[1]??e,Ui=(e,t)=>{let n=[];for(let r in e)n.push(t.mark(Hi(r),e[r]));return n},Wi=(e,t)=>{let n={};return e.forEach(e=>{if(e.type.name!==`ychange`){let r=Jt(t.isOMark,e.type,()=>!e.type.excludes(e.type));n[r?`${e.type.name}--${pi(e.toJSON())}`:e.type.name]=e.attrs}}),n},Gi=(e,t,n,r)=>{if(t instanceof Qt&&t.nodeName!==n.type.name)throw Error(`node name mismatch!`);if(r.mapping.set(t,n),t instanceof Qt){let e=t.getAttributes(),i=n.attrs;for(let n in i)i[n]===null?t.removeAttribute(n):e[n]!==i[n]&&n!==`ychange`&&t.setAttribute(n,i[n]);for(let n in e)i[n]===void 0&&!n.startsWith(Ni)&&t.removeAttribute(n);let a=Wi(n.marks||[],r);for(let n in a){let r=e[Ni+n];(r===void 0||!Ai(r,a[n]))&&t.setAttribute(Ni+n,{...a[n]})}for(let n in e)n.startsWith(Ni)&&a[n.slice(6)]===void 0&&t.removeAttribute(n)}let i=ji(n),a=i.length,o=t.toArray(),s=o.length,c=Gt(a,s),l=0,u=0;for(;l<c;l++){let e=o[l],t=i[l];if(!Li(r.mapping.get(e),t))if(Ii(e,t))r.mapping.set(e,t);else break}for(;u+l+1<c;u++){let e=o[s-u-1],t=i[a-u-1];if(!Li(r.mapping.get(e),t))if(Ii(e,t))r.mapping.set(e,t);else break}e.transact(()=>{for(;s-l-u>0&&a-l-u>0;){let n=o[l],c=i[l],d=o[s-u-1],f=i[a-u-1];if(n instanceof qt&&c instanceof Array)Mi(n,c)||Bi(n,c,r),l+=1;else{let i=n instanceof Qt&&Ki(n,c),a=d instanceof Qt&&Ki(d,f);if(i&&a){let e=Ri(n,c,r),t=Ri(d,f,r);e.foundMappedChild&&!t.foundMappedChild?a=!1:!e.foundMappedChild&&t.foundMappedChild||e.equalityFactor<t.equalityFactor?i=!1:a=!1}i?(Gi(e,n,c,r),l+=1):a?(Gi(e,d,f,r),u+=1):(r.mapping.delete(t.get(l)),t.delete(l,1),t.insert(l,[Oi(c,r)]),l+=1)}}let n=s-l-u;if(s===1&&a===0&&o[0]instanceof qt?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):n>0&&(t.slice(l,l+n).forEach(e=>r.mapping.delete(e)),t.delete(l,n)),l+u<a){let e=[];for(let t=l;t<a-u;t++)e.push(Oi(i[t],r));t.insert(l,e)}},U)},Ki=(e,t)=>!(t instanceof Array)&&e.nodeName===t.type.name,qi=null,Ji=class{constructor(e,t,n){this.view=e,this.key=t,this.value=n}apply(){let e=U.getState(this.view.state);if(e&&e.binding&&!e.binding.isDestroyed){let e=this.view.state.tr;e.setMeta(this.key,this.value),this.view.dispatch(e)}}},Yi=class e{constructor(e=[]){this.entries=e}getFirst(){return this.entries[0]}dequeueFirst(){return this.entries.shift()}isEmpty(){return this.entries.length===0}static fromViewsToUpdate(){let t=qi;qi=null;let n=[];return t.forEach((e,t)=>{e.forEach((e,r)=>{n.push(new Ji(t,r,e))})}),new e(n)}},Xi=(e=Yi.fromViewsToUpdate(),t=!1)=>{let n=!0;for(;!e.isEmpty();){let r=e.getFirst();try{r.apply()}catch(r){if(r instanceof RangeError){t&&n&&e.dequeueFirst(),e.isEmpty()||kt(0,()=>Xi(e,!0));return}throw r}n=!1,e.dequeueFirst()}},Zi=(e,t,n)=>{qi||(qi=new Map,kt(0,Xi)),Jt(qi,e,nn).set(t,n)},Qi=(e,t,n)=>{if(e===0)return Ct(t,0,-1);let r=t._first===null?null:t._first.content.type;for(;r!==null&&t!==r;){if(r instanceof qt){if(r._length>=e)return Ct(r,e,-1);if(e-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,e--;while(r!==t&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==t&&(r=r._item===null?null:r._item.next.content.type)}}else{let i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&e<i)r=r._first.content.type,e--;else{if(e===1&&r._length===0&&i>1)return new an(r._item===null?null:r._item.id,r._item===null?Xt(r):null,null);if(e-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(e===0)return r=r._item===null?r:r._item.parent,new an(r._item===null?null:r._item.id,r._item===null?Xt(r):null,null);do r=r._item.parent,e--;while(r!==t&&r._item.next===null);r!==t&&(r=r._item.next.content.type)}}}if(r===null)throw zt();if(e===0&&r.constructor!==qt&&r!==t)return $i(r._item.parent,r._item)}return Ct(t,t._length,-1)},$i=(e,t)=>{let n=null,r=null;return e._item===null?r=Xt(e):n=cn(e._item.id.client,e._item.id.clock),new an(n,r,t.id)},ea=(e,t,n,r)=>{let i=ln(n,e);if(i===null||i.type!==t&&!Yt(t,i.type._item))return null;let a=i.type,o=0;if(a.constructor===qt)o=i.index;else if(a._item===null||!a._item.deleted){let e=a._first,t=0;for(;t<a._length&&t<i.index&&e!==null;){if(!e.deleted){let n=e.content.type;if(t++,n instanceof qt)o+=n._length;else{let e=r.get(n);if(e==null)return null;o+=e.nodeSize}}e=e.right}o+=1}for(;a!==t&&a._item!==null;){let e=a._item.parent;if(e._item===null||!e._item.deleted){o+=1;let t=e._first;for(;t!==null;){let e=t.content.type;if(e===a)break;if(!t.deleted)if(e instanceof qt)o+=e._length;else{let t=r.get(e);if(t==null)return null;o+=t.nodeSize}t=t.right}}a=e}return o-1},ta=(e,t)=>{let n=e.toArray().map(e=>wi(e,t,mi())).filter(e=>e!==null);return F.fromArray(n)},na=(e,t)=>t.topNodeType.create(null,ta(e,t)),ra=(e,t)=>{let n=mi(),r=e.toArray().map(e=>wi(e,t,n)).filter(e=>e!==null);return{doc:t.topNodeType.create(null,F.fromArray(r)),meta:n,mapping:n.mapping}},ia=(e,t,n)=>e!==t,aa=e=>{let t=document.createElement(`span`);t.classList.add(`ProseMirror-yjs-cursor`),t.setAttribute(`style`,`border-color: ${e.color}`);let n=document.createElement(`div`);n.setAttribute(`style`,`background-color: ${e.color}`),n.insertBefore(document.createTextNode(e.name),null);let r=document.createTextNode(`⁠`),i=document.createTextNode(`⁠`);return t.insertBefore(r,null),t.insertBefore(n,null),t.insertBefore(i,null),t},oa=e=>({style:`background-color: ${e.color}70`,class:`ProseMirror-yjs-selection`}),sa=/^#[0-9a-fA-F]{6}$/,ca=(e,t,n,r,i)=>{let a=U.getState(e);if(a==null||a.doc==null||a.binding==null)return pe.create(e.doc,[]);let o=a.doc,s=[];return a.snapshot!=null||a.prevSnapshot!=null||a.binding.mapping.size===0?pe.create(e.doc,[]):(t.getStates().forEach((t,c)=>{if(n(o.clientID,c,t)&&t.cursor!=null){let n=t.user||{};n.color==null?n.color=`#ffa500`:sa.test(n.color)||console.warn(`A user uses an unsupported color format`,n),n.name??=`User: ${c}`;let l=ea(o,a.type,Ft(t.cursor.anchor),a.binding.mapping),u=ea(o,a.type,Ft(t.cursor.head),a.binding.mapping);if(l!==null&&u!==null){let t=xt(e.doc.content.size-1,0);l=Gt(l,t),u=Gt(u,t),s.push(me.widget(u,()=>r(n,c),{key:c+``,side:10}));let a=Gt(l,u),o=xt(l,u);s.push(me.inline(a,o,i(n,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),pe.create(e.doc,s))},la=(e,{awarenessStateFilter:t=ia,cursorBuilder:n=aa,selectionBuilder:r=oa,getSelection:i=e=>e.selection}={},a=`cursor`)=>new M({key:di,state:{init(i,a){return ca(a,e,t,n,r)},apply(i,a,o,s){let c=U.getState(s),l=i.getMeta(di);return c&&c.isChangeOrigin||l&&l.awarenessUpdated?ca(s,e,t,n,r):a.map(i.mapping,i.doc)}},props:{decorations:e=>di.getState(e)},view:t=>{let n=()=>{t.docView&&Zi(t,di,{awarenessUpdated:!0})},r=()=>{let n=U.getState(t.state),r=e.getLocalState()||{};if(t.hasFocus()){let o=i(t.state),s=Qi(o.anchor,n.type,n.binding.mapping),c=Qi(o.head,n.type,n.binding.mapping);(r.cursor==null||!on(Ft(r.cursor.anchor),s)||!on(Ft(r.cursor.head),c))&&e.setLocalStateField(a,{anchor:s,head:c})}else r.cursor!=null&&ea(n.doc,n.type,Ft(r.cursor.anchor),n.binding.mapping)!==null&&e.setLocalStateField(a,null)};return e.on(`change`,n),t.dom.addEventListener(`focusin`,r),t.dom.addEventListener(`focusout`,r),{update:r,destroy:()=>{t.dom.removeEventListener(`focusin`,r),t.dom.removeEventListener(`focusout`,r),e.off(`change`,n),e.setLocalStateField(a,null)}}}}),ua=e=>{let t=ui.getState(e).undoManager;if(t!=null)return t.undo(),!0},da=e=>{let t=ui.getState(e).undoManager;if(t!=null)return t.redo(),!0},fa=new Set([`paragraph`]),pa=(e,t)=>!(e instanceof Zt)||!(e.content instanceof rn)||!(e.content.type instanceof tn||e.content.type instanceof Qt&&t.has(e.content.type.nodeName))||e.content.type._length===0,ma=({protectedNodes:e=fa,trackedOrigins:t=[],undoManager:n=null}={})=>new M({key:ui,state:{init:(r,i)=>{let a=U.getState(i),o=n||new Kt(a.type,{trackedOrigins:new Set([U].concat(t)),deleteFilter:t=>pa(t,e),captureTransaction:e=>e.meta.get(`addToHistory`)!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(e,t,n,r)=>{let i=U.getState(r).binding,a=t.undoManager,o=a.undoStack.length>0,s=a.redoStack.length>0;return i?{undoManager:a,prevSel:xi(i,n),hasUndoOps:o,hasRedoOps:s}:o!==t.hasUndoOps||s!==t.hasRedoOps?Object.assign({},t,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):t}},view:e=>{let t=U.getState(e.state),n=ui.getState(e.state).undoManager;return n.on(`stack-item-added`,({stackItem:n})=>{let r=t.binding;r&&n.meta.set(r,ui.getState(e.state).prevSel)}),n.on(`stack-item-popped`,({stackItem:e})=>{let n=t.binding;n&&(n.beforeTransactionSelection=e.meta.get(n)||n.beforeTransactionSelection)}),{destroy:()=>{n.destroy()}}}}),ha=new Map,ga=new Set;function _a(){for(let e of ga)e()}function va(e,t,n){ha.set(e,{view:t,host:n}),_a()}function ya(e,t){ha.get(e)?.view===t&&(ha.delete(e),_a())}function ba(e){let t=ha.get(e);return t?.host===`sourceEditor`?t.view:null}function xa(e){return ha.get(e)??null}function Sa(e){return ga.add(e),()=>{ga.delete(e)}}var Ca=new WeakMap;function wa(e,t){Ca.set(e,t)}function Ta(e){return Ca.get(e)??!1}function Ea(e){return!Ta(e)}var Da=`autonomousFragmentEdit/swap`;function Oa(e){return e.setMeta(Da,!0)}function ka(e,t,n){return n===t.textContent?Oa(e):e}function Aa(e){return e.getMeta(Da)===!0}function ja(e){return!e.getMeta(U)&&!Aa(e)}var Ma=/^[A-Za-z0-9]{20,}$/,Na=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function Pa(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function Fa(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return Ma.test(n)?n:null}function Ia(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!Pa(t.hostname))return null;let n=Fa(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&Na.test(r)?r:null}}function La(e){return Ia(e)!==null}function Ra(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function za(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:Ra(t.hostname)}var Ba=/^[A-Za-z0-9_-]{11}$/;function Va(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function Ha(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let n=t[1]?Number.parseInt(t[1],10):0,r=t[2]?Number.parseInt(t[2],10):0,i=t[3]?Number.parseInt(t[3],10):0,a=n*3600+r*60+i;return a>0?a:null}function Ua(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return Ba.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return Ba.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function Wa(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!Va(t.hostname))return null;let n=Ua(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?Ha(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}function Ga(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}if(r>=0){let e=n[r];if(e.type===`mdxJsxAttribute`&&e.value!=null&&typeof e.value==`object`&&e.value.type===`mdxJsxAttributeValueExpression`&&Ka(e.value.value,t))continue}let o=qa(e,t);r>=0?n[r]=o:n.push(o)}return n}function Ka(e,t){try{return JSON.stringify(JSON.parse(e))===JSON.stringify(t)}catch{return!1}}function qa(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function Ja(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:Ga(t,r),children:n.all(t),data:{}}}function Ya(e,t,n){let r=t.attrs.props?.children;return{type:`mdxJsxTextElement`,name:e,attributes:Ga(t,n),children:typeof r==`string`&&r!==``?[{type:`text`,value:r}]:[],data:{}}}var Xa=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)",iconPicker:!0},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)",colorPicker:!0},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`,hideWhen:e=>e.collapsible!==!0},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],Za=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:b,autoFocus:!0},{name:`alt`,type:`string`,required:!0,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],Qa=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`,cssLengthInput:!0},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`,cssLengthInput:!0},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],$a=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:v,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(za(e.src)||La(e.src))},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`,accept:b,hideWhen:e=>typeof e.src==`string`&&(za(e.src)||La(e.src))},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`,hideWhen:e=>typeof e.src==`string`&&La(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(za(e.src)||La(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(Wa(e.src)!==null||za(e.src)||La(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],eo=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:C,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],to=[{name:`title`,type:`string`,required:!0,description:`Heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the block renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)",iconPicker:!0},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],no=[Xa[0],Xa[1],Xa[4],Xa[5],Xa[6]],ro=[Za[0],Za[1],Za[7]],io=[to[0],to[1],to[4],to[5]],ao=[{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`,`justify`],required:!1,defaultValue:`center`,description:"Block alignment from the `<div align>` attribute."},{name:`tag`,type:`string`,required:!1,defaultValue:`div`,hidden:!0,description:`Source wrapper tag (div or center).`},{name:`sourceAttrs`,type:`string`,required:!1,defaultValue:``,hidden:!0,description:`Raw opener-tag attribute bytes preserved for round-trip.`}],oo=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],so=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],co=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],lo=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],uo=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],fo=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],po=[fo[0]],mo=[fo[0]],ho=[{name:`chart`,type:`string`,required:!0,hidden:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],go=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],_o=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],vo=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:S,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}],yo=[{name:`src`,type:`string`,required:!0,description:"Path to the `.excalidraw` board this embed renders",autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded board`}],bo=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],xo=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function So(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function Co(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function wo(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=typeof t?.sourceTarget==`string`?t.sourceTarget:null,o=typeof t?.sourceAnchor==`string`?t.sourceAnchor:null,s=typeof t?.sourceAlias==`string`?t.sourceAlias:null,c=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:c,data:{target:n,anchor:i,alias:r,sourceTarget:a,sourceAnchor:o,sourceAlias:s},children:[{type:`text`,value:c}]}}var To=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:Xa,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>Ja(`Callout`,e,t,Xa)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:Za,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>Ja(`img`,e,t,Za)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:$a,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>Ja(`video`,e,t,$a)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:eo,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>Ja(`audio`,e,t,eo)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:vo,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>Ja(`Pdf`,e,t,vo)},{name:`Excalidraw`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:yo,icon:`PenTool`,category:`embed`,displayName:`Excalidraw`,description:"Embedded snapshot of an `.excalidraw` board, linking to its canvas editor",searchTerms:[`excalidraw`,`board`,`whiteboard`,`sketch`,`drawing`,`canvas`],serialize:(e,t)=>Ja(`Excalidraw`,e,t,yo)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:_o,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>Ja(`File`,e,t,_o)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:Qa,icon:`AppWindow`,category:`embed`,displayName:`Embed`,description:'Inline web embed (iframe) — drop a URL, get a resizable preview pane. For YouTube / Vimeo / Loom prefer `<video src="…">` (player props, click-facade); `<Embed>` auto-rewrites watch URLs as a fallback.',searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>Ja(`Embed`,e,t,Qa)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:to,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>Ja(`Accordion`,e,t,to)},{name:`Toggle`,surface:`canonical`,hasChildren:!0,props:to,icon:`ChevronRight`,category:`content`,displayName:`Toggle`,description:"Standalone expand/collapse block (Notion-style). Same render + props as `<Accordion>` — pick whichever vocabulary matches the vault.",searchTerms:[`toggle`,`collapsible`,`expand`,`details`,`disclosure`,`fold`],exampleBody:`Body content revealed when the toggle is expanded.`,serialize:(e,t)=>Ja(`Toggle`,e,t,to)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:lo,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
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{r as i}from"./dist-Nvb76hAm.js";import{n as a}from"./dist-PQ5KMVDh.js";import{t as o}from"./react-dom-DPxgxlDT.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{n as c,t as l}from"./with-selector-zVo3Fruj.js";import{a as u,d,i as f,l as p,r as m,u as h}from"./floating-ui.dom-DkPPH5vF.js";import{d as g,g as _,i as v,l as y,n as b,o as x,r as S,t as C,u as w}from"./constants-upload-CVKO8P4d.js";import{$ as T,A as ee,B as E,C as te,F as ne,G as re,K as ie,L as D,N as O,P as ae,Q as oe,R as se,S as ce,T as le,U as ue,V as de,W as fe,X as pe,Y as me,_ as he,a as ge,at as k,b as _e,bt as A,c as ve,ct as j,d as ye,et as be,f as xe,g as Se,gt as Ce,h as we,ht as Te,it as M,k as Ee,l as N,mt as De,n as Oe,nt as ke,o as P,ot as Ae,p as je,q as Me,r as Ne,rt as Pe,s as Fe,st as Ie,t as Le,tt as Re,u as ze,ut as Be,v as Ve,vt as F,w as He,x as Ue,y as We,z as I}from"./dist-Dc8tD1th.js";import{t as Ge}from"./dist-C_FzPxEX2.js";import{C as Ke,a as qe,g as Je,w as Ye}from"./schemas-api-C4CP1G39.js";import{t as Xe}from"./util-doc-name-D-_o-n0R.js";import{n as Ze}from"./_envelope-Dwl6i2K9-DPqJ_Q4W.js";import{t as Qe}from"./note-window-mode-CI3Yju9B.js";import{i as $e}from"./use-apply-config-theme-CYFG76sS.js";import{t as et}from"./createLucideIcon-DdBzwsHe.js";import{t as tt}from"./folder-open-COGOeTzI.js";import{t as nt}from"./trash-2-CchZ0T47.js";import{n as rt,r as it}from"./structural-freshness-CIbkMFA3-CWi_lyiW.js";import{c as at,d as ot,l as st}from"./doc-hash-BJkweiX9.js";import{O as ct,_ as lt,b as ut,d as dt,f as ft,g as pt,h as mt,o as ht,p as gt,v as _t,w as vt,x as yt}from"./navigation-targets-BVafzc0v.js";import{t as bt}from"./doc-paths-cEiFVCxr.js";import{$ as xt,A as St,C as Ct,G as wt,H as Tt,I as Et,J as Dt,K as Ot,L as kt,M as At,O as jt,P as Mt,Q as Nt,R as Pt,S as Ft,U as It,W as Lt,X as Rt,Z as zt,_ as Bt,a as Vt,b as Ht,c as Ut,d as Wt,et as Gt,f as Kt,h as qt,it as Jt,j as Yt,k as Xt,l as Zt,m as Qt,nt as $t,o as en,p as tn,rt as nn,s as rn,u as an,v as on,w as sn,x as cn,y as ln}from"./config-provider-DYjwca1V.js";import{At as un,Ct as dn,E as fn,F as pn,G as mn,I as L,J as hn,K as gn,M as _n,Mt as vn,Nt as yn,P as R,Tt as bn,X as xn,a as z,c as Sn,f as Cn,l as wn,lt as Tn,o as En,r as Dn,t as On,ut as kn}from"./dist-D2SphF3p.js";import{A as An,C as jn,E as Mn,H as Nn,I as Pn,L as Fn,M as In,N as Ln,O as Rn,P as zn,R as B,S as Bn,T as Vn,_ as Hn,a as Un,b as Wn,c as Gn,h as Kn,k as qn,m as Jn,o as Yn,t as Xn,x as Zn,y as Qn,z as $n}from"./lib-QQS1Brzc.js";import{t as er}from"./ccount-BoHE53_k.js";import{n as tr,r as nr}from"./lib-DlDYgFfS.js";import{c as rr,f as ir,n as ar,r as or,t as sr,u as cr}from"./trim-lines-DfV8CCf7.js";import{u as lr}from"./space-separated-tokens-l9yufOSK.js";import{n as ur,t as dr}from"./syntax-CKL08zSk.js";import{n as fr,r as pr,t as mr}from"./cm-theme-Cvtw80TE.js";import{i as hr,n as gr}from"./page-list-cache-s0lTSAFU.js";import{t as _r}from"./documents-fetch-Y7Dt9_Tn.js";import{i as vr,n as yr,r as br,t as xr}from"./dist-DseqKdAU.js";import{n as Sr,r as Cr,t as wr}from"./dist-BxTTaZ5o.js";import{t as Tr}from"./dist-CjyZozAk.js";import{n as Er}from"./dist-C2Kstufe.js";import{n as Dr}from"./dist-BvhrN0Uj.js";import{n as Or}from"./dist-D5mDCusD.js";import{i as kr,n as Ar,r as jr}from"./dist-BpU-J2LR.js";import{n as Mr}from"./dist-BkE9d74i.js";import{t as Nr}from"./stex-CUzil_LB.js";import{n as Pr,r as Fr}from"./external-link-CldCnbtR.js";var Ir=et(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),Lr=et(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Rr=et(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),zr=et(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Br=et(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),V=n(),H=e(r(),1),Vr=e(o(),1),Hr=s(),Ur=c();function Wr(e){return e.editorView}var Gr=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function Kr(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function qr(e){let t=Kr(e);return t!==null&&Gr.has(t)}function Jr(e){let t=Kr(e);return t===null?null:Gr.get(t)??null}var Yr=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function Xr(e){Yr.lastIndex=0;let t=e.match(Yr);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=Jr(e);if(t===null)return null;n+=t}return n}var Zr=()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else n!==void 0&&n()}},Qr=/[\uD800-\uDBFF]/,$r=/[\uDC00-\uDFFF]/,ei=(e,t)=>{let n=0,r=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;for(n>0&&Qr.test(e[n-1])&&n--;r+n<e.length&&r+n<t.length&&e[e.length-r-1]===t[t.length-r-1];)r++;return r>0&&$r.test(e[e.length-r])&&r--,{index:n,remove:e.length-n-r,insert:t.slice(n,t.length-r)}},ti=(e,t)=>e>>>t|e<<32-t,ni=e=>ti(e,2)^ti(e,13)^ti(e,22),ri=e=>ti(e,6)^ti(e,11)^ti(e,25),ii=e=>ti(e,7)^ti(e,18)^e>>>3,ai=e=>ti(e,17)^ti(e,19)^e>>>10,oi=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),si=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ci=class{constructor(){let e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(si),this._W=new Uint32Array(e,64,64)}_updateHash(){let e=this._H,t=this._W;for(let e=16;e<64;e++)t[e]=ai(t[e-2])+t[e-7]+ii(t[e-15])+t[e-16];let n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7];for(let e=0,u,d;e<64;e++)u=l+ri(o)+(o&s^~o&c)+oi[e]+t[e]>>>0,d=ni(n)+(n&r^n&i^r&i)>>>0,l=c,c=s,s=o,o=a+u>>>0,a=i,i=r,r=n,n=u+d>>>0;e[0]+=n,e[1]+=r,e[2]+=i,e[3]+=a,e[4]+=o,e[5]+=s,e[6]+=c,e[7]+=l}digest(e){let t=0;for(;t+56<=e.length;){let n=0;for(;n<16&&t+3<e.length;n++)this._W[n]=e[t++]<<24|e[t++]<<16|e[t++]<<8|e[t++];if(t%64!=0){for(this._W.fill(0,n,16);t<e.length;)this._W[n]|=e[t]<<(3-t%4)*8,t++;this._W[n]|=128<<(3-t%4)*8}this._updateHash()}let n=t%64!=0;this._W.fill(0,0,16);let r=0;for(;t<e.length;r++)for(let n=3;n>=0&&t<e.length;n--)this._W[r]|=e[t++]<<n*8;n||(this._W[r-(t%4==0?0:1)]|=128<<(3-t%4)*8),this._W[14]=e.byteLength/Nt,this._W[15]=e.byteLength*8,this._updateHash();let i=new Uint8Array(32);for(let e=0;e<this._H.length;e++)for(let t=0;t<4;t++)i[e*4+t]=this._H[e]>>>(3-t)*8;return i}},li=e=>new ci().digest(e),U=new k(`y-sync`),ui=new k(`y-undo`),di=new k(`yjs-cursor`),fi=e=>{for(let t=6;t<e.length;t++)e[t%6]=e[t%6]^e[t];return e.slice(0,6)},pi=e=>It(fi(li(Tt(e)))),mi=()=>({mapping:new Map,isOMark:new Map}),hi=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&t.sv.get(e.id.client)>e.id.clock&&!St(t.ds,e.id),gi=[{light:`#ecd44433`,dark:`#ecd444`}],_i=(e,t,n)=>{if(!e.has(n)){if(e.size<t.length){let n=$t();e.forEach(e=>n.add(e)),t=t.filter(e=>!n.has(e))}e.set(n,Dt(t))}return e.get(n)},vi=(e,{colors:t=gi,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:a}={})=>{let o=!1,s=new Si(e,a),c=new M({props:{editable:e=>{let t=U.getState(e);return t.snapshot==null&&t.prevSnapshot==null}},key:U,state:{init:(i,a)=>({type:e,doc:e.doc,binding:s,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:t,colorMapping:n,permanentUserData:r}),apply:(e,t)=>{let n=e.getMeta(U);if(n!==void 0){t=Object.assign({},t);for(let e in n)t[e]=n[e]}return t.addToHistory=e.getMeta(`addToHistory`)!==!1,t.isChangeOrigin=n!==void 0&&!!n.isChangeOrigin,t.isUndoRedoOperation=n!==void 0&&!!n.isChangeOrigin&&!!n.isUndoRedoOperation,s.prosemirrorView!==null&&n!==void 0&&(n.snapshot!=null||n.prevSnapshot!=null)&&kt(0,()=>{s.prosemirrorView!=null&&(n.restore==null?s._renderSnapshot(n.snapshot,n.prevSnapshot,t):(s._renderSnapshot(n.snapshot,n.snapshot,t),delete t.restore,delete t.snapshot,delete t.prevSnapshot,s.mux(()=>{s._prosemirrorChanged(s.prosemirrorView.state.doc)})))}),t}},view:e=>(s.initView(e),a??s._forceRerender(),i(),{update:()=>{let t=c.getState(e.state);if(t.snapshot==null&&t.prevSnapshot==null&&(o||e.state.doc.content.findDiffStart(e.state.doc.type.createAndFill().content)!==null)){if(o=!0,t.addToHistory===!1&&!t.isChangeOrigin){let t=ui.getState(e.state),n=t&&t.undoManager;n&&n.stopCapturing()}s.mux(()=>{t.doc.transact(n=>{n.meta.set(`addToHistory`,t.addToHistory),s._prosemirrorChanged(e.state.doc)},U)})}},destroy:()=>{s.destroy()}})});return c},yi=(e,t,n)=>{if(t!==null&&t.anchor!==null&&t.head!==null)if(t.type===`all`)e.setSelection(new ke(e.doc));else if(t.type===`node`){let r=ea(n.doc,n.type,t.anchor,n.mapping);e.setSelection(bi(e,r))}else{let r=ea(n.doc,n.type,t.anchor,n.mapping),i=ea(n.doc,n.type,t.head,n.mapping);r!==null&&i!==null&&e.setSelection(j.between(e.doc.resolve(r),e.doc.resolve(i)))}},bi=(e,t)=>{let n=e.doc.resolve(t);return n.nodeAfter?Pe.create(e.doc,t):j.near(n)},xi=(e,t)=>({type:t.selection.jsonID,anchor:Qi(t.selection.anchor,e.type,e.mapping),head:Qi(t.selection.head,e.type,e.mapping)}),Si=class{constructor(e,t=new Map){this.type=e,this.prosemirrorView=null,this.mux=Zr(),this.mapping=t,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=xi(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta(`addToHistory`,!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(Lt&&this._domSelectionInView===null&&(kt(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){let e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;let t=this.prosemirrorView._root.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.getClientRects().length===0&&t.startContainer&&t.collapsed&&t.selectNodeContents(t.startContainer);let n=t.getBoundingClientRect(),r=Pt.documentElement;return n.bottom>=0&&n.right>=0&&n.left<=(window.innerWidth||r.clientWidth||0)&&n.top<=(window.innerHeight||r.clientHeight||0)}renderSnapshot(e,t){t||=sn(Ht(),new Map),this.prosemirrorView.dispatch(this._tr.setMeta(U,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{let e=this.type.toArray().map(e=>wi(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new A(F.from(e),0,0));t.setMeta(U,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(t)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{let e=this.beforeTransactionSelection===null?this.prosemirrorView.state.selection:null,t=this.type.toArray().map(e=>wi(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new A(F.from(t),0,0));if(e){let t=Gt(xt(e.anchor,0),n.doc.content.size),r=Gt(xt(e.head,0),n.doc.content.size);n.setSelection(j.create(n.doc,t,r))}this.prosemirrorView.dispatch(n.setMeta(U,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,t,n){let r=this.doc,i=this.type;if(e||=Mt(this.doc),e instanceof Uint8Array||t instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(t instanceof Uint8Array))&&zt(),r=new Ut({gc:!1}),Bt(r,t),t=Mt(r),Bt(r,e),e=Mt(r),i._item===null){let e=Array.from(this.doc.share.keys()).find(e=>this.doc.share.get(e)===this.type);i=r.getXmlFragment(e)}else{let e=r.store.clients.get(i._item.id.client)??[];i=e[jt(e,i._item.id.clock)].content.type}this.mapping.clear(),this.mux(()=>{r.transact(r=>{let a=n.permanentUserData;a&&a.dss.forEach(e=>{At(r,e,e=>{})});let o=(e,t)=>{let r=e===`added`?a.getUserByClientId(t.client):a.getUserByDeletedId(t);return{user:r,type:e,color:_i(n.colorMapping,n.colors,r)}},s=Et(i,new Wt(t.ds,e.sv)).map(n=>!n._item.deleted||hi(n._item,e)||hi(n._item,t)?wi(n,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,t,o):null).filter(e=>e!==null),c=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new A(F.from(s),0,0));this.prosemirrorView.dispatch(c.setMeta(U,{isChangeOrigin:!0}))},U)})}_typeChanged(e,t){if(this.prosemirrorView==null)return;let n=U.getState(this.prosemirrorView.state);if(e.length===0||n.snapshot!=null||n.prevSnapshot!=null){this.renderSnapshot(n.snapshot,n.prevSnapshot);return}this.mux(()=>{let e=(e,t)=>this.mapping.delete(t);At(t,t.deleteSet,e=>{if(e.constructor===Zt){let t=e.content.type;t&&this.mapping.delete(t)}}),t.changed.forEach(e),t.changedParentTypes.forEach(e);let n=this.type.toArray().map(e=>Ci(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new A(F.from(n),0,0));yi(r,this.beforeTransactionSelection,this),r=r.setMeta(U,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof Kt}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&r.scrollIntoView(),this.prosemirrorView.dispatch(r)})}_prosemirrorChanged(e){this.doc.transact(()=>{Gi(this.doc,this.type,e,this),this.beforeTransactionSelection=xi(this,this.prosemirrorView.state)},U)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on(`beforeAllTransactions`,this.beforeAllTransactions),this.doc.on(`afterAllTransactions`,this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off(`beforeAllTransactions`,this.beforeAllTransactions),this.doc.off(`afterAllTransactions`,this.afterAllTransactions))}},Ci=(e,t,n,r,i,a)=>{let o=n.mapping.get(e);if(o===void 0){if(e instanceof Qt)return wi(e,t,n,r,i,a);throw Rt()}return o},wi=(e,t,n,r,i,a)=>{let o=[],s=e=>{if(e instanceof Qt){let s=Ci(e,t,n,r,i,a);s!==null&&o.push(s)}else{let s=e._item.right?.content?.type;s instanceof tn&&!s._item.deleted&&s._item.id.client===s.doc.clientID&&(e.applyDelta([{retain:e.length},...s.toDelta()]),s.doc.transact(e=>{s._item.delete(e)}));let c=Ti(e,t,n,r,i,a);c!==null&&c.forEach(e=>{e!==null&&o.push(e)})}};r===void 0||i===void 0?e.toArray().forEach(s):Et(e,new Wt(i.ds,r.sv)).forEach(s);try{let s=e.getAttributes(r);r!==void 0&&(hi(e._item,r)?hi(e._item,i)||(s.ychange=a?a(`added`,e._item.id):{type:`added`}):s.ychange=a?a(`removed`,e._item.id):{type:`removed`});let c=Pi(s),l=Ui(c.marks,t),u=t.node(e.nodeName,c.plain,o,l.length?l:void 0);return n.mapping.set(e,u),u}catch(r){console.warn(`[y-prosemirror] schema.node(`+e.nodeName+`) threw:`,String(r&&r.message||r));let i=globalThis.__okYpsCounters=globalThis.__okYpsCounters||{block:0,inline:0};if(t.nodes[e.nodeName]&&t.nodes[e.nodeName].spec&&t.nodes[e.nodeName].spec.inline)i.inline++;else if(i.block++,t.nodes.rawMdxFallback)try{let i=t.node(`rawMdxFallback`,{reason:String(r&&r.message||r)},[t.text(e.nodeName)]);return n.mapping.set(e,i),i}catch(e){console.warn(`[y-prosemirror] rawMdxFallback substitution also failed:`,String(e&&e.message||e))}return n.mapping.delete(e),null}},Ti=(e,t,n,r,i,a)=>{let o=[],s=e.toDelta(r,i,a);try{for(let e=0;e<s.length;e++){let n=s[e];o.push(t.text(n.insert,Ui(n.attributes,t)))}}catch(e){console.warn(`[y-prosemirror] schema.text() threw:`,String(e&&e.message||e));let t=globalThis.__okYpsCounters=globalThis.__okYpsCounters||{block:0,inline:0};return t.inline++,null}return o},Ei=(e,t)=>{let n=new qt,r=e.map(e=>({insert:e.text,attributes:Wi(e.marks,t)}));return n.applyDelta(r),t.mapping.set(n,e),n},Di=(e,t)=>{let n=new Qt(e.type.name);for(let t in e.attrs){let r=e.attrs[t];r!==null&&t!==`ychange`&&n.setAttribute(t,r)}let r=Wi(e.marks||[],t);for(let e in r)n.setAttribute(Ni+e,{...r[e]});return n.insert(0,ji(e).map(e=>Oi(e,t))),t.mapping.set(n,e),n},Oi=(e,t)=>e instanceof Array?Ei(e,t):Di(e,t),ki=e=>typeof e==`object`&&!!e,Ai=(e,t)=>{let n=Object.keys(e).filter(t=>e[t]!==null),r=n.length===Object.keys(t).filter(e=>t[e]!==null).length;for(let i=0;i<n.length&&r;i++){let a=n[i],o=e[a],s=t[a];r=a===`ychange`||o===s||ki(o)&&ki(s)&&Ai(o,s)}return r},ji=e=>{let t=e.content.content,n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.isText){let r=[];for(let n=t[e];e<t.length&&n.isText;n=t[++e])r.push(n);e--,n.push(r)}else n.push(r)}return n},Mi=(e,t)=>{let n=e.toDelta();return n.length===t.length&&n.every((e,n)=>e.insert===t[n].text&&Ot(e.attributes||{}).length===t[n].marks.length&&wt(e.attributes,(e,r)=>{let i=Hi(r),a=t[n].marks;return a.find(e=>e.type.name===i)?Ai(e,a.find(e=>e.type.name===i)?.attrs):!1}))},Ni=`ymark:`,Pi=e=>{let t={},n={};for(let r in e)r.startsWith(Ni)?n[r.slice(6)]=e[r]:t[r]=e[r];return{plain:t,marks:n}},Fi=(e,t)=>{let n=Object.keys(e);return n.length===t.length?n.every(n=>{let r=Hi(n),i=t.find(e=>e.type.name===r);return i?Ai(e[n],i.attrs):!1}):!1},Ii=(e,t)=>{if(e instanceof Qt&&!(t instanceof Array)&&Ki(e,t)){let n=ji(t),r=Pi(e.getAttributes());return e._length===n.length&&Fi(r.marks,t.marks)&&Ai(r.plain,t.attrs)&&e.toArray().every((e,t)=>Ii(e,n[t]))}return e instanceof qt&&t instanceof Array&&Mi(e,t)},Li=(e,t)=>e===t||e instanceof Array&&t instanceof Array&&e.length===t.length&&e.every((e,n)=>t[n]===e),Ri=(e,t,n)=>{let r=e.toArray(),i=ji(t),a=i.length,o=r.length,s=Gt(o,a),c=0,l=0,u=!1;for(;c<s;c++){let e=r[c],t=i[c];if(Li(n.mapping.get(e),t))u=!0;else if(!Ii(e,t))break}for(;c+l<s;l++){let e=r[o-l-1],t=i[a-l-1];if(Li(n.mapping.get(e),t))u=!0;else if(!Ii(e,t))break}return{equalityFactor:c+l,foundMappedChild:u}},zi=e=>{let t=``,n=e._start,r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof en?t+=n.content.str:n.content instanceof Vt&&(r[n.content.key]=null)),n=n.right;return{str:t,nAttrs:r}},Bi=(e,t,n)=>{n.mapping.set(e,t);let{nAttrs:r,str:i}=zi(e),a=t.map(e=>({insert:e.text,attributes:Object.assign({},r,Wi(e.marks,n))})),{insert:o,remove:s,index:c}=ei(i,a.map(e=>e.insert).join(``));e.delete(c,s),e.insert(c,o),e.applyDelta(a.map(e=>({retain:e.insert.length,attributes:e.attributes})))},Vi=/(.*)(--[a-zA-Z0-9+/=]{8})$/,Hi=e=>Vi.exec(e)?.[1]??e,Ui=(e,t)=>{let n=[];for(let r in e)n.push(t.mark(Hi(r),e[r]));return n},Wi=(e,t)=>{let n={};return e.forEach(e=>{if(e.type.name!==`ychange`){let r=Jt(t.isOMark,e.type,()=>!e.type.excludes(e.type));n[r?`${e.type.name}--${pi(e.toJSON())}`:e.type.name]=e.attrs}}),n},Gi=(e,t,n,r)=>{if(t instanceof Qt&&t.nodeName!==n.type.name)throw Error(`node name mismatch!`);if(r.mapping.set(t,n),t instanceof Qt){let e=t.getAttributes(),i=n.attrs;for(let n in i)i[n]===null?t.removeAttribute(n):e[n]!==i[n]&&n!==`ychange`&&t.setAttribute(n,i[n]);for(let n in e)i[n]===void 0&&!n.startsWith(Ni)&&t.removeAttribute(n);let a=Wi(n.marks||[],r);for(let n in a){let r=e[Ni+n];(r===void 0||!Ai(r,a[n]))&&t.setAttribute(Ni+n,{...a[n]})}for(let n in e)n.startsWith(Ni)&&a[n.slice(6)]===void 0&&t.removeAttribute(n)}let i=ji(n),a=i.length,o=t.toArray(),s=o.length,c=Gt(a,s),l=0,u=0;for(;l<c;l++){let e=o[l],t=i[l];if(!Li(r.mapping.get(e),t))if(Ii(e,t))r.mapping.set(e,t);else break}for(;u+l+1<c;u++){let e=o[s-u-1],t=i[a-u-1];if(!Li(r.mapping.get(e),t))if(Ii(e,t))r.mapping.set(e,t);else break}e.transact(()=>{for(;s-l-u>0&&a-l-u>0;){let n=o[l],c=i[l],d=o[s-u-1],f=i[a-u-1];if(n instanceof qt&&c instanceof Array)Mi(n,c)||Bi(n,c,r),l+=1;else{let i=n instanceof Qt&&Ki(n,c),a=d instanceof Qt&&Ki(d,f);if(i&&a){let e=Ri(n,c,r),t=Ri(d,f,r);e.foundMappedChild&&!t.foundMappedChild?a=!1:!e.foundMappedChild&&t.foundMappedChild||e.equalityFactor<t.equalityFactor?i=!1:a=!1}i?(Gi(e,n,c,r),l+=1):a?(Gi(e,d,f,r),u+=1):(r.mapping.delete(t.get(l)),t.delete(l,1),t.insert(l,[Oi(c,r)]),l+=1)}}let n=s-l-u;if(s===1&&a===0&&o[0]instanceof qt?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):n>0&&(t.slice(l,l+n).forEach(e=>r.mapping.delete(e)),t.delete(l,n)),l+u<a){let e=[];for(let t=l;t<a-u;t++)e.push(Oi(i[t],r));t.insert(l,e)}},U)},Ki=(e,t)=>!(t instanceof Array)&&e.nodeName===t.type.name,qi=null,Ji=class{constructor(e,t,n){this.view=e,this.key=t,this.value=n}apply(){let e=U.getState(this.view.state);if(e&&e.binding&&!e.binding.isDestroyed){let e=this.view.state.tr;e.setMeta(this.key,this.value),this.view.dispatch(e)}}},Yi=class e{constructor(e=[]){this.entries=e}getFirst(){return this.entries[0]}dequeueFirst(){return this.entries.shift()}isEmpty(){return this.entries.length===0}static fromViewsToUpdate(){let t=qi;qi=null;let n=[];return t.forEach((e,t)=>{e.forEach((e,r)=>{n.push(new Ji(t,r,e))})}),new e(n)}},Xi=(e=Yi.fromViewsToUpdate(),t=!1)=>{let n=!0;for(;!e.isEmpty();){let r=e.getFirst();try{r.apply()}catch(r){if(r instanceof RangeError){t&&n&&e.dequeueFirst(),e.isEmpty()||kt(0,()=>Xi(e,!0));return}throw r}n=!1,e.dequeueFirst()}},Zi=(e,t,n)=>{qi||(qi=new Map,kt(0,Xi)),Jt(qi,e,nn).set(t,n)},Qi=(e,t,n)=>{if(e===0)return Ct(t,0,-1);let r=t._first===null?null:t._first.content.type;for(;r!==null&&t!==r;){if(r instanceof qt){if(r._length>=e)return Ct(r,e,-1);if(e-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,e--;while(r!==t&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==t&&(r=r._item===null?null:r._item.next.content.type)}}else{let i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&e<i)r=r._first.content.type,e--;else{if(e===1&&r._length===0&&i>1)return new an(r._item===null?null:r._item.id,r._item===null?Xt(r):null,null);if(e-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(e===0)return r=r._item===null?r:r._item.parent,new an(r._item===null?null:r._item.id,r._item===null?Xt(r):null,null);do r=r._item.parent,e--;while(r!==t&&r._item.next===null);r!==t&&(r=r._item.next.content.type)}}}if(r===null)throw zt();if(e===0&&r.constructor!==qt&&r!==t)return $i(r._item.parent,r._item)}return Ct(t,t._length,-1)},$i=(e,t)=>{let n=null,r=null;return e._item===null?r=Xt(e):n=cn(e._item.id.client,e._item.id.clock),new an(n,r,t.id)},ea=(e,t,n,r)=>{let i=ln(n,e);if(i===null||i.type!==t&&!Yt(t,i.type._item))return null;let a=i.type,o=0;if(a.constructor===qt)o=i.index;else if(a._item===null||!a._item.deleted){let e=a._first,t=0;for(;t<a._length&&t<i.index&&e!==null;){if(!e.deleted){let n=e.content.type;if(t++,n instanceof qt)o+=n._length;else{let e=r.get(n);if(e==null)return null;o+=e.nodeSize}}e=e.right}o+=1}for(;a!==t&&a._item!==null;){let e=a._item.parent;if(e._item===null||!e._item.deleted){o+=1;let t=e._first;for(;t!==null;){let e=t.content.type;if(e===a)break;if(!t.deleted)if(e instanceof qt)o+=e._length;else{let t=r.get(e);if(t==null)return null;o+=t.nodeSize}t=t.right}}a=e}return o-1},ta=(e,t)=>{let n=e.toArray().map(e=>wi(e,t,mi())).filter(e=>e!==null);return F.fromArray(n)},na=(e,t)=>t.topNodeType.create(null,ta(e,t)),ra=(e,t)=>{let n=mi(),r=e.toArray().map(e=>wi(e,t,n)).filter(e=>e!==null);return{doc:t.topNodeType.create(null,F.fromArray(r)),meta:n,mapping:n.mapping}},ia=(e,t,n)=>e!==t,aa=e=>{let t=document.createElement(`span`);t.classList.add(`ProseMirror-yjs-cursor`),t.setAttribute(`style`,`border-color: ${e.color}`);let n=document.createElement(`div`);n.setAttribute(`style`,`background-color: ${e.color}`),n.insertBefore(document.createTextNode(e.name),null);let r=document.createTextNode(`⁠`),i=document.createTextNode(`⁠`);return t.insertBefore(r,null),t.insertBefore(n,null),t.insertBefore(i,null),t},oa=e=>({style:`background-color: ${e.color}70`,class:`ProseMirror-yjs-selection`}),sa=/^#[0-9a-fA-F]{6}$/,ca=(e,t,n,r,i)=>{let a=U.getState(e);if(a==null||a.doc==null||a.binding==null)return pe.create(e.doc,[]);let o=a.doc,s=[];return a.snapshot!=null||a.prevSnapshot!=null||a.binding.mapping.size===0?pe.create(e.doc,[]):(t.getStates().forEach((t,c)=>{if(n(o.clientID,c,t)&&t.cursor!=null){let n=t.user||{};n.color==null?n.color=`#ffa500`:sa.test(n.color)||console.warn(`A user uses an unsupported color format`,n),n.name??=`User: ${c}`;let l=ea(o,a.type,Ft(t.cursor.anchor),a.binding.mapping),u=ea(o,a.type,Ft(t.cursor.head),a.binding.mapping);if(l!==null&&u!==null){let t=xt(e.doc.content.size-1,0);l=Gt(l,t),u=Gt(u,t),s.push(me.widget(u,()=>r(n,c),{key:c+``,side:10}));let a=Gt(l,u),o=xt(l,u);s.push(me.inline(a,o,i(n,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),pe.create(e.doc,s))},la=(e,{awarenessStateFilter:t=ia,cursorBuilder:n=aa,selectionBuilder:r=oa,getSelection:i=e=>e.selection}={},a=`cursor`)=>new M({key:di,state:{init(i,a){return ca(a,e,t,n,r)},apply(i,a,o,s){let c=U.getState(s),l=i.getMeta(di);return c&&c.isChangeOrigin||l&&l.awarenessUpdated?ca(s,e,t,n,r):a.map(i.mapping,i.doc)}},props:{decorations:e=>di.getState(e)},view:t=>{let n=()=>{t.docView&&Zi(t,di,{awarenessUpdated:!0})},r=()=>{let n=U.getState(t.state),r=e.getLocalState()||{};if(t.hasFocus()){let o=i(t.state),s=Qi(o.anchor,n.type,n.binding.mapping),c=Qi(o.head,n.type,n.binding.mapping);(r.cursor==null||!on(Ft(r.cursor.anchor),s)||!on(Ft(r.cursor.head),c))&&e.setLocalStateField(a,{anchor:s,head:c})}else r.cursor!=null&&ea(n.doc,n.type,Ft(r.cursor.anchor),n.binding.mapping)!==null&&e.setLocalStateField(a,null)};return e.on(`change`,n),t.dom.addEventListener(`focusin`,r),t.dom.addEventListener(`focusout`,r),{update:r,destroy:()=>{t.dom.removeEventListener(`focusin`,r),t.dom.removeEventListener(`focusout`,r),e.off(`change`,n),e.setLocalStateField(a,null)}}}}),ua=e=>{let t=ui.getState(e).undoManager;if(t!=null)return t.undo(),!0},da=e=>{let t=ui.getState(e).undoManager;if(t!=null)return t.redo(),!0},fa=new Set([`paragraph`]),pa=(e,t)=>!(e instanceof Zt)||!(e.content instanceof rn)||!(e.content.type instanceof tn||e.content.type instanceof Qt&&t.has(e.content.type.nodeName))||e.content.type._length===0,ma=({protectedNodes:e=fa,trackedOrigins:t=[],undoManager:n=null}={})=>new M({key:ui,state:{init:(r,i)=>{let a=U.getState(i),o=n||new Kt(a.type,{trackedOrigins:new Set([U].concat(t)),deleteFilter:t=>pa(t,e),captureTransaction:e=>e.meta.get(`addToHistory`)!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(e,t,n,r)=>{let i=U.getState(r).binding,a=t.undoManager,o=a.undoStack.length>0,s=a.redoStack.length>0;return i?{undoManager:a,prevSel:xi(i,n),hasUndoOps:o,hasRedoOps:s}:o!==t.hasUndoOps||s!==t.hasRedoOps?Object.assign({},t,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):t}},view:e=>{let t=U.getState(e.state),n=ui.getState(e.state).undoManager;return n.on(`stack-item-added`,({stackItem:n})=>{let r=t.binding;r&&n.meta.set(r,ui.getState(e.state).prevSel)}),n.on(`stack-item-popped`,({stackItem:e})=>{let n=t.binding;n&&(n.beforeTransactionSelection=e.meta.get(n)||n.beforeTransactionSelection)}),{destroy:()=>{n.destroy()}}}}),ha=new Map,ga=new Set;function _a(){for(let e of ga)e()}function va(e,t,n){ha.set(e,{view:t,host:n}),_a()}function ya(e,t){ha.get(e)?.view===t&&(ha.delete(e),_a())}function ba(e){let t=ha.get(e);return t?.host===`sourceEditor`?t.view:null}function xa(e){return ha.get(e)??null}function Sa(e){return ga.add(e),()=>{ga.delete(e)}}var Ca=new WeakMap;function wa(e,t){Ca.set(e,t)}function Ta(e){return Ca.get(e)??!1}function Ea(e){return!Ta(e)}var Da=`autonomousFragmentEdit/swap`;function Oa(e){return e.setMeta(Da,!0)}function ka(e,t,n){return n===t.textContent?Oa(e):e}function Aa(e){return e.getMeta(Da)===!0}function ja(e){return!e.getMeta(U)&&!Aa(e)}var Ma=/^[A-Za-z0-9]{20,}$/,Na=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function Pa(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function Fa(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return Ma.test(n)?n:null}function Ia(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!Pa(t.hostname))return null;let n=Fa(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&Na.test(r)?r:null}}function La(e){return Ia(e)!==null}function Ra(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function za(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:Ra(t.hostname)}var Ba=/^[A-Za-z0-9_-]{11}$/;function Va(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function Ha(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let n=t[1]?Number.parseInt(t[1],10):0,r=t[2]?Number.parseInt(t[2],10):0,i=t[3]?Number.parseInt(t[3],10):0,a=n*3600+r*60+i;return a>0?a:null}function Ua(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return Ba.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return Ba.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function Wa(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!Va(t.hostname))return null;let n=Ua(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?Ha(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}function Ga(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}if(r>=0){let e=n[r];if(e.type===`mdxJsxAttribute`&&e.value!=null&&typeof e.value==`object`&&e.value.type===`mdxJsxAttributeValueExpression`&&Ka(e.value.value,t))continue}let o=qa(e,t);r>=0?n[r]=o:n.push(o)}return n}function Ka(e,t){try{return JSON.stringify(JSON.parse(e))===JSON.stringify(t)}catch{return!1}}function qa(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function Ja(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:Ga(t,r),children:n.all(t),data:{}}}function Ya(e,t,n){let r=t.attrs.props?.children;return{type:`mdxJsxTextElement`,name:e,attributes:Ga(t,n),children:typeof r==`string`&&r!==``?[{type:`text`,value:r}]:[],data:{}}}var Xa=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)",iconPicker:!0},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)",colorPicker:!0},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`,hideWhen:e=>e.collapsible!==!0},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],Za=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:b,autoFocus:!0},{name:`alt`,type:`string`,required:!0,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],Qa=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`,cssLengthInput:!0},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`,cssLengthInput:!0},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],$a=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:v,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(za(e.src)||La(e.src))},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`,accept:b,hideWhen:e=>typeof e.src==`string`&&(za(e.src)||La(e.src))},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`,hideWhen:e=>typeof e.src==`string`&&La(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(za(e.src)||La(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(Wa(e.src)!==null||za(e.src)||La(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],eo=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:C,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],to=[{name:`title`,type:`string`,required:!0,description:`Heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the block renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)",iconPicker:!0},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],no=[Xa[0],Xa[1],Xa[4],Xa[5],Xa[6]],ro=[Za[0],Za[1],Za[7]],io=[to[0],to[1],to[4],to[5]],ao=[{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`,`justify`],required:!1,defaultValue:`center`,description:"Block alignment from the `<div align>` attribute."},{name:`tag`,type:`string`,required:!1,defaultValue:`div`,hidden:!0,description:`Source wrapper tag (div or center).`},{name:`sourceAttrs`,type:`string`,required:!1,defaultValue:``,hidden:!0,description:`Raw opener-tag attribute bytes preserved for round-trip.`}],oo=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],so=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],co=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],lo=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],uo=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],fo=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],po=[fo[0]],mo=[fo[0]],ho=[{name:`chart`,type:`string`,required:!0,hidden:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],go=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],_o=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],vo=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:S,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}],yo=[{name:`src`,type:`string`,required:!0,description:"Path to the `.excalidraw` board this embed renders",autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded board`}],bo=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],xo=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function So(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function Co(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function wo(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=typeof t?.sourceTarget==`string`?t.sourceTarget:null,o=typeof t?.sourceAnchor==`string`?t.sourceAnchor:null,s=typeof t?.sourceAlias==`string`?t.sourceAlias:null,c=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:c,data:{target:n,anchor:i,alias:r,sourceTarget:a,sourceAnchor:o,sourceAlias:s},children:[{type:`text`,value:c}]}}var To=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:Xa,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>Ja(`Callout`,e,t,Xa)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:Za,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>Ja(`img`,e,t,Za)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:$a,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>Ja(`video`,e,t,$a)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:eo,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>Ja(`audio`,e,t,eo)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:vo,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>Ja(`Pdf`,e,t,vo)},{name:`Excalidraw`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:yo,icon:`PenTool`,category:`embed`,displayName:`Excalidraw`,description:"Embedded snapshot of an `.excalidraw` board, linking to its canvas editor",searchTerms:[`excalidraw`,`board`,`whiteboard`,`sketch`,`drawing`,`canvas`],serialize:(e,t)=>Ja(`Excalidraw`,e,t,yo)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:_o,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>Ja(`File`,e,t,_o)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:Qa,icon:`AppWindow`,category:`embed`,displayName:`Embed`,description:'Inline web embed (iframe) — drop a URL, get a resizable preview pane. For YouTube / Vimeo / Loom prefer `<video src="…">` (player props, click-facade); `<Embed>` auto-rewrites watch URLs as a fallback.',searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>Ja(`Embed`,e,t,Qa)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:to,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>Ja(`Accordion`,e,t,to)},{name:`Toggle`,surface:`canonical`,hasChildren:!0,props:to,icon:`ChevronRight`,category:`content`,displayName:`Toggle`,description:"Standalone expand/collapse block (Notion-style). Same render + props as `<Accordion>` — pick whichever vocabulary matches the vault.",searchTerms:[`toggle`,`collapsible`,`expand`,`details`,`disclosure`,`fold`],exampleBody:`Body content revealed when the toggle is expanded.`,serialize:(e,t)=>Ja(`Toggle`,e,t,to)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:lo,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
3
3
  <Tab label="Two">Body of the second tab panel.</Tab>`,serialize:(e,t)=>Ja(`Tabs`,e,t,lo)},{name:`Tab`,surface:`canonical`,hasChildren:!0,props:uo,icon:`PanelTop`,category:`content`,displayName:`Tab`,description:"A single tab panel inside a `<Tabs>` container — carries the strip label and the block-content body.",searchTerms:[`tab`,`panel`],exampleBody:"Panel content — must be nested inside a `<Tabs>` parent.",serialize:(e,t)=>Ja(`Tab`,e,t,uo)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:fo,icon:`Sigma`,category:`content`,displayName:`Math`,description:`Block math equation rendered with KaTeX from a LaTeX source string`,searchTerms:[`math`,`latex`,`equation`,`formula`,`katex`,`tex`],serialize:(e,t)=>Ja(`Math`,e,t,fo)},{name:`MermaidFence`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:ho,icon:`Workflow`,category:`content`,displayName:`Mermaid`,placeholder:{label:`Add a Mermaid diagram`},description:"Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie). Authored exclusively as ` ```mermaid ` fenced code.",searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})},{name:`Mirror`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:bo,icon:`CopyPlus`,category:`content`,displayName:`Mirror`,description:"Render a read-only copy of a `<MirrorSource>` block from another doc. Use to keep the same content in sync across multiple docs without copy-paste — edits land at the source, every Mirror reflects the change.",searchTerms:[`mirror`,`sync`,`synced`,`transclude`,`embed`,`reference`,`shared block`],serialize:(e,t)=>Ja(`Mirror`,e,t,bo)},{name:`MirrorSource`,surface:`canonical`,hasChildren:!0,props:xo,icon:`GitBranch`,category:`content`,displayName:`Mirror Source`,description:'Mark a block as the source of truth for content that appears in multiple docs. Wrap any block content; `<Mirror src="…" anchor="<id>">` references render this verbatim read-only at every call-site. Edit here, propagate everywhere.',searchTerms:[`mirror source`,`sync source`,`source block`,`master block`,`shared`],exampleBody:"Authoritative content lives inside this block — edits here propagate to every `<Mirror>` that references this id.",serialize:(e,t)=>Ja(`MirrorSource`,e,t,xo)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:no,icon:`MessageSquareWarning`,category:`content`,displayName:`GFM Callout`,description:"GFM blockquote alert (`> [!NOTE]`) — read-only compat. Preserves `> [!NOTE]` syntax on round-trip; insert a fresh Callout block for the full prop surface.",rendersAs:`Callout`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),i=n?.type??`note`;return{type:`blockquote`,children:[{type:`html`,value:`[!${(r.has(i.toLowerCase())?i:`note`).toUpperCase()}]${n?.collapsible?n.defaultOpen===!1?`-`:`+`:``}${n?.title?` ${n.title}`:``}`},...t.all(e).filter(e=>{if(e.type!==`paragraph`)return!0;let t=e;return Array.isArray(t.children)&&t.children.length>0})]}}},{name:`CommonMarkImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:ro,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (`![alt](src "title")`) — read-only compat. Preserves `![alt](src)` syntax on round-trip; insert a fresh Image block for the full HTML-native attribute surface (srcset, sizes, decoding, etc.).',rendersAs:`img`,translateProps:e=>e,serialize:e=>{let t=e.attrs.props;return{type:`paragraph`,children:[{type:`image`,url:t?.sourceUrl??t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:oo,icon:`ZoomIn`,category:`media`,displayName:`Wiki Embed Image`,description:"Obsidian-style `![[file.png]]` wiki-embed — read-only compat. Edit the alt-text via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`img`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,alt:t??n}},serialize:wo},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:so,icon:`Film`,category:`media`,displayName:`Wiki Embed Video`,description:"Obsidian-style `![[clip.mp4]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`video`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:wo},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:co,icon:`Volume2`,category:`media`,displayName:`Wiki Embed Audio`,description:"Obsidian-style `![[song.mp3]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`audio`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:wo},{name:`WikiEmbedFile`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:go,icon:`Paperclip`,category:`media`,displayName:`Wiki Embed File`,description:"Obsidian-style `![[file.zip]]` wiki-embed — read-only compat for arbitrary downloadable attachments. Renders through the `File` canonical (inline row with file-up icon + bold name + optional dim size). Edit the display name via the alias slot.",rendersAs:`File`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.size==`string`&&e.size.length>0?e.size:null;return{src:e.src,name:t??void 0,size:n??void 0}},serialize:wo},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:io,icon:`ChevronRight`,category:`content`,displayName:`HTML5 Details`,description:"HTML5 `<details><summary>` collapsible — read-only compat. Preserves `<details>` syntax on round-trip; insert a fresh Accordion block for icon / description / group-name props.",rendersAs:`Accordion`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=n?.defaultOpen?` open`:``,i=n?.name?` name="${So(n.name)}"`:``,a=n?.id?` id="${So(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${Co(o)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${r}${i}${a}>\n${s}`,closer:`</details>`}}}}},{name:`HtmlAlignBlock`,surface:`canonical`,hasChildren:!0,props:ao,icon:`AlignCenter`,category:`content`,displayName:`Align block`,description:"GitHub-style `<div align>` wrapper. Children render as normal blocks with the alignment applied; the `<div align>` syntax is preserved on round-trip.",searchTerms:[`align`,`center`,`centered`,`div`],serialize:(e,t)=>{let n=e.attrs.props,r=n?.tag===`center`?`center`:`div`,i=typeof n?.align==`string`&&n.align?n.align:null,a=typeof n?.sourceAttrs==`string`?n.sourceAttrs:``,o=/(\balign\s*=\s*)(?:"[^"]*"|'[^']*'|[^\s"'<>]+)/i;return i!==null&&(r===`div`||i!==`center`)?a=o.test(a)?a.replace(o,`$1"${So(i)}"`):`${a} align="${So(i)}"`:(i===null||r===`center`&&i===`center`)&&(a=a.replace(RegExp(`\\s*${o.source}`,`i`),``)),{type:`mdxJsxFlowElement`,name:`HtmlAlignBlock`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<${r}${a}>`,closer:`</${r}>`}}}}},{name:`DollarMath`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:po,icon:`Sigma`,category:`content`,displayName:`Dollar Math`,description:"Block math via `$$…$$` syntax — read-only compat. Preserves `$$…$$` form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`math`,value:e.attrs.props?.formula??``})},{name:`MathFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:mo,icon:`Sigma`,category:`content`,displayName:`Math Fence`,description:"Block math via ` ```math ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`math`,meta:null,value:e.attrs.props?.formula??``})}],Eo={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>Ja(e.attrs.componentName||`*`,e,t)};function Do(){let e=new Map;e.set(`*`,Eo);for(let t of To)e.set(t.name,t);return{get(t){return e.get(t)},getOrWildcard(t){return e.get(t)??e.get(`*`)},set(t,n){e.set(t,n)},has(t){return e.has(t)},entries(){return e.entries()}}}var Oo=ge.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function ko(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r||Ao(n)===r?!0:Xr(e)===t}function Ao(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}function jo(e,t){let{target:n,anchor:r,alias:i}=e;if(!t.separatorCrossed)return e;if(r!==null){let e=Fo(r);return{target:n,anchor:e.length>0?e:null,alias:i===null?null:Io(i)}}return{target:Fo(n),anchor:null,alias:i===null?null:Io(i)}}function Mo(e,t,n){let r=e.trim();return r===t?!0:n===`alias`?Io(r)===t:Fo(r)===t}function No(e,t,n){return typeof e==`string`&&Mo(e,t,n)?e:t}function Po(e){return Fo(e.trim())===``}function Fo(e){return e.endsWith(`\\`)?e.slice(0,-1):e}function Io(e){return e.replace(/\\\|/g,`|`)}function Lo(e){let t=``,n=0;for(let r of e)r===`\\`?n++:(r===`|`&&n%2==0&&(t+=`\\`),n=0),t+=r;return t}function Ro(e){return e.replace(/\|/g,`\\|`)}function zo(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function Bo(e){return e.includes("`")?`~`:"`"}function Vo(e,t,n=3){let r=RegExp(`^ {0,3}(\\${e}+)[ \\t]*$`),i=Math.max(3,n);for(let e of t.split(`
4
4
  `)){let t=r.exec(e);t&&t[1].length>=i&&(i=t[1].length+1)}return i}var Ho=new Set([`break`,`delete`,`emphasis`,`footnoteReference`,`html`,`image`,`imageReference`,`inlineCode`,`link`,`linkReference`,`strong`,`text`]);function Uo(e){let t=e.children;Array.isArray(t)&&t.forEach((e,n)=>{if(e.type===`break`){t[n]={type:`html`,value:`<br />`};return}Uo(e)})}function Wo(e){let t=e.children;if(Array.isArray(t))for(let e of t)(e.type===`inlineCode`||e.type===`html`)&&(e.value.includes(`
5
5
  `)&&(e.value=e.value.replace(/[ \t]*\n[ \t]*/g,` `)),e.type===`html`&&e.value.includes(`|`)&&(e.value=Ro(e.value))),Wo(e)}function Go(e){B(e,`tableCell`,e=>{e.children.some(e=>!Ho.has(e.type))&&(e.children=Ko(e.children)),Uo(e),Wo(e)})}function Ko(e){let t=[],n=0,r=()=>{t.length>0&&(n+=1)},i=e=>{for(;n>0;)t.push({type:`break`}),--n;t.push(e)},a=e=>{e.split(`
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t,r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{t as i}from"./label-CvMpFFbN.js";import{i as a,n as o,o as s,s as c,t as l}from"./select-Bu4Wm3Rf.js";import{t as u}from"./switch-BKZTXkzu.js";import{n as d}from"./dist-BGzUo_18.js";import{n as f}from"./config-errors-DCSQBhyj.js";import{i as p}from"./use-apply-config-theme-CYFG76sS.js";import"./saved-themes-client-D5M6AESh.js";import"./config-provider-BDWGnun_.js";import"./markdown-lint-CfRH6CjV.js";import{t as m}from"./SettingsSectionHeader-XnGFBVeB.js";var h=r(),g=e();function _(){let e=(0,h.c)(40),{_:r}=n(),{projectConfig:_,projectSynced:v,projectBinding:y}=p(),b=v&&y!==null,x=_?.validation?.links??`warning`,S=_?.validation?.fileTreeIndicators!==!1,C=_?.validation?.suppressLogLinkAdvisories??!0,w;e[0]!==r||e[1]!==y?(w=function(e){if(y===null){d.error(r({id:`dVaXnv`}));return}let t=y.patch({validation:e});t.ok||d.error(r({id:`NrFwux`,values:{0:f(t.error)}}))},e[0]=r,e[1]=y,e[2]=w):w=e[2];let T=w,E;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,g.jsx)(t,{id:`OPOiKn`}),e[3]=E):E=e[3];let D;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,g.jsx)(m,{titleId:`settings-content-rules-title`,title:E,scope:`project`,level:`block`,children:(0,g.jsx)(t,{id:`ge05IJ`})}),e[4]=D):D=e[4];let O;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,g.jsx)(i,{htmlFor:`settings-content-rules-links`,className:`text-sm font-medium`,children:(0,g.jsx)(t,{id:`8ruqQi`})}),e[5]=O):O=e[5];let k;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,g.jsxs)(`div`,{className:`min-w-0`,children:[O,(0,g.jsx)(`p`,{id:`settings-content-rules-links-description`,className:`text-1sm text-muted-foreground`,children:(0,g.jsx)(t,{id:`iqr14Z`})})]}),e[6]=k):k=e[6];let A;e[7]===T?A=e[8]:(A=e=>T({links:e}),e[7]=T,e[8]=A);let j=!b,M;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,g.jsx)(s,{id:`settings-content-rules-links`,"aria-describedby":`settings-content-rules-links-description`,className:`w-36 shrink-0`,"data-testid":`settings-content-rules-links`,children:(0,g.jsx)(c,{})}),e[9]=M):M=e[9];let N;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,g.jsx)(a,{value:`off`,children:(0,g.jsx)(t,{id:`Nwbs0q`})}),e[10]=N):N=e[10];let P;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,g.jsx)(a,{value:`warning`,children:(0,g.jsx)(t,{id:`r6y-jM`})}),e[11]=P):P=e[11];let F;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,g.jsxs)(o,{children:[N,P,(0,g.jsx)(a,{value:`error`,children:(0,g.jsx)(t,{id:`SlfejT`})})]}),e[12]=F):F=e[12];let I;e[13]!==x||e[14]!==A||e[15]!==j?(I=(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-3`,children:[k,(0,g.jsxs)(l,{value:x,onValueChange:A,disabled:j,children:[M,F]})]}),e[13]=x,e[14]=A,e[15]=j,e[16]=I):I=e[16];let L;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,g.jsx)(i,{htmlFor:`settings-content-rules-log-links`,className:`text-sm font-medium`,children:(0,g.jsx)(t,{id:`ea7AYn`})}),e[17]=L):L=e[17];let R;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,g.jsxs)(`div`,{className:`min-w-0`,children:[L,(0,g.jsx)(`p`,{id:`settings-content-rules-log-links-description`,className:`text-1sm text-muted-foreground`,children:(0,g.jsx)(t,{id:`nnhrHd`})})]}),e[18]=R):R=e[18];let z=!b,B;e[19]===T?B=e[20]:(B=e=>T({suppressLogLinkAdvisories:e}),e[19]=T,e[20]=B);let V;e[21]!==C||e[22]!==z||e[23]!==B?(V=(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-3`,children:[R,(0,g.jsx)(u,{id:`settings-content-rules-log-links`,"aria-describedby":`settings-content-rules-log-links-description`,checked:C,disabled:z,onCheckedChange:B,"data-testid":`settings-content-rules-log-links`})]}),e[21]=C,e[22]=z,e[23]=B,e[24]=V):V=e[24];let H;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,g.jsx)(i,{htmlFor:`settings-content-rules-indicators`,className:`text-sm font-medium`,children:(0,g.jsx)(t,{id:`x3kWeu`})}),e[25]=H):H=e[25];let U;e[26]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,g.jsxs)(`div`,{className:`min-w-0`,children:[H,(0,g.jsx)(`p`,{id:`settings-content-rules-indicators-description`,className:`text-1sm text-muted-foreground`,children:(0,g.jsx)(t,{id:`ktspdq`})})]}),e[26]=U):U=e[26];let W=!b,G;e[27]===T?G=e[28]:(G=e=>T({fileTreeIndicators:e}),e[27]=T,e[28]=G);let K;e[29]!==S||e[30]!==W||e[31]!==G?(K=(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-3`,children:[U,(0,g.jsx)(u,{id:`settings-content-rules-indicators`,"aria-describedby":`settings-content-rules-indicators-description`,checked:S,disabled:W,onCheckedChange:G,"data-testid":`settings-content-rules-indicators`})]}),e[29]=S,e[30]=W,e[31]=G,e[32]=K):K=e[32];let q;e[33]!==I||e[34]!==V||e[35]!==K?(q=(0,g.jsxs)(`div`,{className:`divide-y rounded-md border`,children:[I,V,K]}),e[33]=I,e[34]=V,e[35]=K,e[36]=q):q=e[36];let J;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`settings-content-rules-plugins-note`,children:(0,g.jsx)(t,{id:`YDL7N6`})}),e[37]=J):J=e[37];let Y;return e[38]===q?Y=e[39]:(Y=(0,g.jsxs)(`section`,{"aria-labelledby":`settings-content-rules-title`,className:`space-y-4`,"data-testid":`settings-content-rules`,"data-field":`section:content-rules`,children:[D,q,J]}),e[38]=q,e[39]=Y),Y}export{_ as ContentRulesSection};
1
+ import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t,r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{t as i}from"./label-CvMpFFbN.js";import{i as a,n as o,o as s,s as c,t as l}from"./select-Bu4Wm3Rf.js";import{t as u}from"./switch-BKZTXkzu.js";import{n as d}from"./dist-BGzUo_18.js";import{n as f}from"./config-errors-DCSQBhyj.js";import{i as p}from"./use-apply-config-theme-CYFG76sS.js";import"./saved-themes-client-BdzXiLZg.js";import"./config-provider-DYjwca1V.js";import"./markdown-lint-C_9h2J3z.js";import{t as m}from"./SettingsSectionHeader-XnGFBVeB.js";var h=r(),g=e();function _(){let e=(0,h.c)(40),{_:r}=n(),{projectConfig:_,projectSynced:v,projectBinding:y}=p(),b=v&&y!==null,x=_?.validation?.links??`warning`,S=_?.validation?.fileTreeIndicators!==!1,C=_?.validation?.suppressLogLinkAdvisories??!0,w;e[0]!==r||e[1]!==y?(w=function(e){if(y===null){d.error(r({id:`dVaXnv`}));return}let t=y.patch({validation:e});t.ok||d.error(r({id:`NrFwux`,values:{0:f(t.error)}}))},e[0]=r,e[1]=y,e[2]=w):w=e[2];let T=w,E;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,g.jsx)(t,{id:`OPOiKn`}),e[3]=E):E=e[3];let D;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,g.jsx)(m,{titleId:`settings-content-rules-title`,title:E,scope:`project`,level:`block`,children:(0,g.jsx)(t,{id:`ge05IJ`})}),e[4]=D):D=e[4];let O;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,g.jsx)(i,{htmlFor:`settings-content-rules-links`,className:`text-sm font-medium`,children:(0,g.jsx)(t,{id:`8ruqQi`})}),e[5]=O):O=e[5];let k;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,g.jsxs)(`div`,{className:`min-w-0`,children:[O,(0,g.jsx)(`p`,{id:`settings-content-rules-links-description`,className:`text-1sm text-muted-foreground`,children:(0,g.jsx)(t,{id:`iqr14Z`})})]}),e[6]=k):k=e[6];let A;e[7]===T?A=e[8]:(A=e=>T({links:e}),e[7]=T,e[8]=A);let j=!b,M;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,g.jsx)(s,{id:`settings-content-rules-links`,"aria-describedby":`settings-content-rules-links-description`,className:`w-36 shrink-0`,"data-testid":`settings-content-rules-links`,children:(0,g.jsx)(c,{})}),e[9]=M):M=e[9];let N;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,g.jsx)(a,{value:`off`,children:(0,g.jsx)(t,{id:`Nwbs0q`})}),e[10]=N):N=e[10];let P;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,g.jsx)(a,{value:`warning`,children:(0,g.jsx)(t,{id:`r6y-jM`})}),e[11]=P):P=e[11];let F;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,g.jsxs)(o,{children:[N,P,(0,g.jsx)(a,{value:`error`,children:(0,g.jsx)(t,{id:`SlfejT`})})]}),e[12]=F):F=e[12];let I;e[13]!==x||e[14]!==A||e[15]!==j?(I=(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-3`,children:[k,(0,g.jsxs)(l,{value:x,onValueChange:A,disabled:j,children:[M,F]})]}),e[13]=x,e[14]=A,e[15]=j,e[16]=I):I=e[16];let L;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,g.jsx)(i,{htmlFor:`settings-content-rules-log-links`,className:`text-sm font-medium`,children:(0,g.jsx)(t,{id:`ea7AYn`})}),e[17]=L):L=e[17];let R;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,g.jsxs)(`div`,{className:`min-w-0`,children:[L,(0,g.jsx)(`p`,{id:`settings-content-rules-log-links-description`,className:`text-1sm text-muted-foreground`,children:(0,g.jsx)(t,{id:`nnhrHd`})})]}),e[18]=R):R=e[18];let z=!b,B;e[19]===T?B=e[20]:(B=e=>T({suppressLogLinkAdvisories:e}),e[19]=T,e[20]=B);let V;e[21]!==C||e[22]!==z||e[23]!==B?(V=(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-3`,children:[R,(0,g.jsx)(u,{id:`settings-content-rules-log-links`,"aria-describedby":`settings-content-rules-log-links-description`,checked:C,disabled:z,onCheckedChange:B,"data-testid":`settings-content-rules-log-links`})]}),e[21]=C,e[22]=z,e[23]=B,e[24]=V):V=e[24];let H;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,g.jsx)(i,{htmlFor:`settings-content-rules-indicators`,className:`text-sm font-medium`,children:(0,g.jsx)(t,{id:`x3kWeu`})}),e[25]=H):H=e[25];let U;e[26]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,g.jsxs)(`div`,{className:`min-w-0`,children:[H,(0,g.jsx)(`p`,{id:`settings-content-rules-indicators-description`,className:`text-1sm text-muted-foreground`,children:(0,g.jsx)(t,{id:`ktspdq`})})]}),e[26]=U):U=e[26];let W=!b,G;e[27]===T?G=e[28]:(G=e=>T({fileTreeIndicators:e}),e[27]=T,e[28]=G);let K;e[29]!==S||e[30]!==W||e[31]!==G?(K=(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-3`,children:[U,(0,g.jsx)(u,{id:`settings-content-rules-indicators`,"aria-describedby":`settings-content-rules-indicators-description`,checked:S,disabled:W,onCheckedChange:G,"data-testid":`settings-content-rules-indicators`})]}),e[29]=S,e[30]=W,e[31]=G,e[32]=K):K=e[32];let q;e[33]!==I||e[34]!==V||e[35]!==K?(q=(0,g.jsxs)(`div`,{className:`divide-y rounded-md border`,children:[I,V,K]}),e[33]=I,e[34]=V,e[35]=K,e[36]=q):q=e[36];let J;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`settings-content-rules-plugins-note`,children:(0,g.jsx)(t,{id:`YDL7N6`})}),e[37]=J):J=e[37];let Y;return e[38]===q?Y=e[39]:(Y=(0,g.jsxs)(`section`,{"aria-labelledby":`settings-content-rules-title`,className:`space-y-4`,"data-testid":`settings-content-rules`,"data-field":`section:content-rules`,children:[D,q,J]}),e[38]=q,e[39]=Y),Y}export{_ as ContentRulesSection};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./react-dom-DPxgxlDT.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-DzgjsZzC.js";import{n as c}from"./dist-BGzUo_18.js";import"./schemas-api-KjBzkxAy.js";import{a as l}from"./share-D-LUU2aX-DfD-mrg-.js";import{n as u}from"./_envelope-Dwl6i2K9-DPqJ_Q4W.js";import{a as d}from"./bridge-1xVdv27q.js";import{t as f}from"./lib-TFtgHRaJ.js";import{n as p}from"./use-conflicts-B9eHyj9o.js";import{n as m,t as h}from"./alert-BY4HHcfV.js";import{$ as g,A as _,B as v,C as ee,Ct as y,D as b,Dt as x,E as S,Et as C,F as w,L as te,M as T,N as E,O as D,Ot as O,P as k,Q as A,S as j,St as M,T as N,Tt as ne,_ as re,_t as ie,a as ae,at as P,b as oe,bt as F,c as se,ct as ce,d as le,dt as ue,et as de,f as fe,ft as I,g as L,gt as R,h as z,ht as B,it as pe,j as me,k as V,l as H,lt as he,m as ge,mt as U,n as W,nt as G,ot as K,p as q,pt as J,r as Y,rt as X,st as Z,t as _e,tt as ve,u as ye,ut as be,v as xe,vt as Se,w as Ce,x as we,xt as Te,y as Ee,yt as De,z as Oe}from"./pierre-theme-m65RB-UD.js";function ke(e){return ue.hasResolvedThemes(e)}function Ae(e,t){return J(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function je(e){return(e.lang??Z(e.name))===`text`}var Me=10,Ne=13,Pe=4,Fe=40;function Ie(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./react-dom-DPxgxlDT.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-DzgjsZzC.js";import{n as c}from"./dist-BGzUo_18.js";import"./schemas-api-C4CP1G39.js";import{a as l}from"./share-D-LUU2aX-DfD-mrg-.js";import{n as u}from"./_envelope-Dwl6i2K9-DPqJ_Q4W.js";import{a as d}from"./bridge-njD5PB6P.js";import{t as f}from"./lib-TFtgHRaJ.js";import{n as p}from"./use-conflicts-B0yvUiLf.js";import{n as m,t as h}from"./alert-BY4HHcfV.js";import{$ as g,A as _,B as v,C as ee,Ct as y,D as b,Dt as x,E as S,Et as C,F as w,L as te,M as T,N as E,O as D,Ot as O,P as k,Q as A,S as j,St as M,T as N,Tt as ne,_ as re,_t as ie,a as ae,at as P,b as oe,bt as F,c as se,ct as ce,d as le,dt as ue,et as de,f as fe,ft as I,g as L,gt as R,h as z,ht as B,it as pe,j as me,k as V,l as H,lt as he,m as ge,mt as U,n as W,nt as G,ot as K,p as q,pt as J,r as Y,rt as X,st as Z,t as _e,tt as ve,u as ye,ut as be,v as xe,vt as Se,w as Ce,x as we,xt as Te,y as Ee,yt as De,z as Oe}from"./pierre-theme-m65RB-UD.js";function ke(e){return ue.hasResolvedThemes(e)}function Ae(e,t){return J(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function je(e){return(e.lang??Z(e.name))===`text`}var Me=10,Ne=13,Pe=4,Fe=40;function Ie(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
2
2
  `),i=0,a=0;for(;n!==-1||r!==-1;){let o;if(n!==-1&&(r===-1||n<r)?r===n+1?(o=r+1,n=e.indexOf(`\r`,o),r=e.indexOf(`
3
3
  `,o)):(o=n+1,n=e.indexOf(`\r`,o)):(o=r+1,r=e.indexOf(`
4
4
  `,o)),t.push(o),++a===Pe){if(o-i<=Fe){for(let n=o;n<e.length;n++){let r=e.charCodeAt(n);(r===Me||r===Ne)&&(r===Ne&&n+1<e.length&&e.charCodeAt(n+1)===Me&&n++,t.push(n+1))}return t}i=o,a=0}}return t}function Le(e){let t=Ie(e);return Array.from({length:t.length},(n,r)=>{let i=t[r],a=t[r+1]??e.length;return e.slice(i,a)})}var Re={forcePlainText:!1};function ze(e,t,{theme:n=y,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=Re){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=ve(i),f=a?`text`:e.lang??Z(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=g({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let h=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:de(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:de(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},_=A(t.codeToHast(l?Be(c??Le(e.contents),o,s):e.contents,h)),v=l?Array(o):_;return l&&v.push(..._),{code:v,themeStyles:m,baseThemeType:p}}function Be(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length);return e.slice(t,r).join(``)}function Ve(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}var He=-1,Ue=class{options;onRenderUpdate;workerManager;__id=`file-renderer:${++He}`;highlighter;renderCache;computedLang=`text`;lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;constructor(e={theme:y},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=_(e.theme??y)?he():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}beginEditSession(){this.editSessionActive=!0}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0,this.endEditSession(),this.textDocumentCache=new WeakMap}syncEditedContentsToFile(){let{renderCache:e,lineCache:t}=this;e?.isDirty!==!0||t==null||!Ve(t,e.file)||(e.file.contents=t.lines.join(``))}hasUnkeyedFileContentsChanged(e){let{lineCache:t}=this;return e.cacheKey==null&&t!=null&&t.file===e&&t.sourceContents!==e.contents}invalidateChangedUnkeyedFile(e){this.hasUnkeyedFileContentsChanged(e)&&(this.workerManager?.cleanUpTasks(this),this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap)}clearRenderCache(){this.syncEditedContentsToFile(),this.pendingStructuralRows=void 0;let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.file.cacheKey!=null&&this.workerManager?.evictFileFromCache(e.file.cacheKey)}hydrate(e){let{options:t}=this.getRenderOptions(e),n=We(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!Ae(t,r.options)&&(r=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!je(e),result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??Z(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??y}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getFileRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getFileRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{tokenizeMaxLineLength:e=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:e}})(),{renderCache:n}=this;return n?.result==null||!I(e,n.file)||!Ae(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){this.invalidateChangedUnkeyedFile(e);let{lineCache:t}=this;return(t==null||!Ve(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:Le(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){let t=this.getOrCreateLineCache(e);return this.textDocumentCache.get(e)?.lineCount??t.length}updateRenderCache(e,t,n=!1){if(this.pendingStructuralRows=void 0,this.renderCache==null)return;let{file:r,result:i}=this.renderCache;if(i==null)return;let a=n?new Map:void 0;this.pendingStructuralRows=a;let o=this.lineCache!=null&&Ve(this.lineCache,r)?this.lineCache:void 0;for(let[t,n]of e){if(a===void 0&&o!=null&&t<o.lines.length){let e=n.map(e=>e[2]).join(``);o.lines[t]=V(o.lines[t]??``,e)}let e={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};a===void 0?i.code[t]=e:a.set(t,e)}i.baseThemeType=t,this.renderCache.isDirty=!0}applyDocumentChange(e){let t=this.pendingStructuralRows;if(this.pendingStructuralRows=void 0,this.renderCache==null)return;let{file:n,result:r}=this.renderCache;if(r==null)return;let i=this.lineCache!=null&&Ve(this.lineCache,n)?this.lineCache.lines:Le(n.contents),a=Le(e.getText());if(i.length!==a.length){let n=Math.min(i.length,a.length),o=0;for(;o<n&&i[o]===a[o];)o++;let s=0;for(;s<n-o&&i[i.length-1-s]===a[a.length-1-s];)s++;let c=r.code;r.code=Array(a.length);for(let e=0;e<o;e++)r.code[e]=c[e];for(let e=0;e<s;e++)r.code[a.length-1-e]=c[i.length-1-e];if(t!==void 0)for(let[e,n]of t)e<a.length&&(r.code[e]=n);for(let t=o;t<a.length-s;t++)r.code[t]??={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:e.getLineText(t)}]}]};for(let e=0;e<r.code.length;e++){let t=r.code[e];t?.type===`element`&&(t.properties[`data-line`]=e+1,t.properties[`data-line-index`]=e)}this.renderCache.isDirty=!0}this.lineCache={cacheKey:n.cacheKey,file:n,sourceContents:n.contents,lines:a},this.textDocumentCache.set(n,e)}renderFile(e=this.renderCache?.file,t=M){if(e==null)return;this.invalidateChangedUnkeyedFile(e),this.renderCache?.isDirty===!0&&!I(e,this.renderCache.file)&&(this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap);let{options:n,forceHighlight:r}=this.getRenderOptions(e);this.renderCache?.isDirty===!0&&!Ae(n,this.renderCache.options)&&this.clearRenderCache();let i=this.getMatchingWorkerResultCache(e,n);i!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...i},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||je(e)||We(a.length,this.getTokenizeMaxLength()),c=!I(e,this.renderCache.file),l=!T(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0)(s||this.renderCache.result==null||!this.renderCache.highlighted&&(c||l))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||c||l||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??Z(e.name);let t=this.highlighter!=null&&_(n.theme),i=this.highlighter!=null&&me(this.computedLang),a=!s&&i;if(this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=M){let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=We(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Z(e.name);let n=this.highlighter!=null&&ke(ce(this.getLocalHighlightTheme())),r=t||this.highlighter!=null&&me(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:ze(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let a=this.getLineCount(e),{disableFileHeader:o=!1}=this.options,s=[],c=pe(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=Oe(t)?te(this.lineAnnotations):void 0;d!=null&&(c.children.push(G(`context`,`annotation`,1)),s.push(D({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d.map(e=>F(e))})),u++);for(let r=t.startingLine;r<l;r++){let t=r+1,i=n[r];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:r,lineNumber:t}),Error(n)}c.children.push(X(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(G(`context`,`annotation`,1)),s.push(D({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>F(e))})),u++)}return c.properties.style=`grid-row: span ${u}`,{gutterAST:c.children??[],contentAST:s,preAST:this.createPreElement(a),headerAST:o?void 0:this.renderHeader(e),totalLines:a,rowCount:u,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return S({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return f(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(P({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=pe();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,b(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return f(t?P({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await be(Ce(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){if(this.renderCache==null)return;let i=!I(e,this.renderCache.file)||!this.renderCache.highlighted||!Ae(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(!(n==null||!Ae(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&I(e,n.file)&&Ae(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return N({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function We(e,t){return e>t}function Ge(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function Ke(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:ge(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}var qe=[``],Je=-1,Ye=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++Je}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;renderRange;enabled=!0;editor;constructor(e={theme:y},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new Ue(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new E,this.interactionManager=new k(`file`,w(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){!this.enabled||this.file==null||this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}__getCurrentFile(){return this.file}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(w(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!J(this.appliedThemeCSS.theme,this.options.theme??y)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(e){this.code!=null&&(this.code.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`}),this.managersDirty=!1}shouldApplyColumnVariables(e){return e===`scroll`&&this.lineAnnotations.length>0}cleanUp(e=!1){this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n),Xe(this.pre,i,this.options.collapsed)||Ze(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),H(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(Ke(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.file){return e==null?qe:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.file,r=this.lineAnnotations,i=this.renderRange;e!=null&&t!=null&&n!=null&&this.fileRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.file!==n||e.__syncRenderView(a,t,n,r,i)})}attachEditor(e){this.editor?.cleanUp(),this.editor=e,this.fileRenderer.beginEditSession();let t=this.file==null?void 0:e.__prepareFile?.(this.file);return t!==void 0&&t!==this.file?this.renderPreparedFile({file:t,forceRender:!0,preventEmit:!0,renderRange:this.renderRange}):this.fileRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),()=>{this.editor=void 0,this.fileRenderer.endEditSession()}}applyDocumentChange(e,t){this.fileRenderer.applyDocumentChange(e),t!=null&&t!==this.lineAnnotations&&this.file!=null&&(this.setLineAnnotations(t),this.fileRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations())}updateRenderCache(e,t,n){this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render(e){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);let t=this.editor?.__prepareFile?.(e.file)??e.file;return this.renderPreparedFile(t===e.file?e:{...e,file:t})}renderPreparedFile({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.lineAnnotations.length>0)?o!==this.lineAnnotations:!1,m=!I(this.file,e)||this.fileRenderer.hasUnkeyedFileContentsChanged(e);if(!c&&!n&&T(u,this.renderRange)&&!m&&!p&&!f)return this.applyCachedThemeState(l);this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(Ke(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:h=!1,disableFileHeader:g=!1}=this.options;if(g&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let n=this.fileRenderer.renderFile(e,ne);n!=null&&this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n?.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.injectUnsafeCSS()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}try{let r=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f)||!this.applyPartialRender(d,u)){let n=this.fileRenderer.renderFile(e,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.applyFullRender(n,r)}this.applyBuffers(r,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.file){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||je(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(e).length>n||await t.primeFileHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${F(r)}`,a=this.annotationCache.get(i);if(a==null||!Ge(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:we(F(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=oe();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=Ee(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=re(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??y,s=typeof o==`string`?o:{...o},c=xe(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=le({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:L(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=z(this.themeCSSStyle.textContent??``,xe(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&ye()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=q({code:this.code}),r=this.fileRenderer.renderCodeAST(e);this.editor?.__captureFocusForDOMReplacement();let i=()=>{if(n.childElementCount>=2)for(let e=0;e<2;e++){let t=n.children[e],i=r[e];t.innerHTML=f(i.children),t.style.cssText=i.properties.style}else n.innerHTML=f(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?fe(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(e==null||t==null)return!1;let{file:n,code:r}=this,i=r==null?void 0:this.getColumns(r);if(n==null||r==null||i==null)return!1;let a=e.startingLine,o=t.startingLine,s=e.totalLines===1/0?1/0:a+e.totalLines,c=t.totalLines===1/0?1/0:o+t.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l)return!1;if(!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))throw Error(`File.applyPartialRender: failed to trim to overlap`);let{length:d}=i.content.children,f=(e,t)=>{if(!(t<=0))return this.fileRenderer.renderFile(n,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t){let{file:n}=this;if(n==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??f(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Te,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=a?.(n)??void 0,o=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,O,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,C,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,x,o),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:v(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):v(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=ee;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};j(i,this.appliedPreAttributes)||(se(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Xe(e,t,n=!1){return!n&&e==null&&t!=null}function Ze(e,t,n=!1){return e==null&&t!=null&&!n}var Qe=class extends Y{pendingConflictActions=[];pendingMarkerRows=[];injectedRows=new Map;options;constructor(e={theme:y},t,n){super(void 0,t,n),this.options=e}setConflictState(e,t,n){this.pendingConflictActions=e,this.pendingMarkerRows=t,this.syncInjectedRows(e,t,n)}syncInjectedRows(e,t,n){this.injectedRows.clear();for(let t of e){let e=t==null?void 0:B(t,n);if(t==null||e==null)continue;let r={type:`actions`,hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:t.conflictIndex};this.addInjectedRow(r)}for(let e of t)this.addInjectedRow(e)}addInjectedRow(e){let t=`${e.hunkIndex}:${e.lineIndex}`,n=this.injectedRows.get(t);n==null?this.injectedRows.set(t,[e]):n.push(e)}renderDiff(e,t=M){return e!=null&&this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.renderDiff(e,t)}async asyncRender(e,t=M){return this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.asyncRender(e,t)}createPreElement(e,t){return super.createPreElement(e,t,{"data-has-merge-conflict":``})}getUnifiedLineDecoration({type:e,lineType:t}){let n=e===`change`?t===`change-deletion`?`current`:`incoming`:void 0;return{gutterLineType:e===`change`?`context`:t,gutterProperties:$e(n),contentProperties:et(e,n)}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`current`:`incoming`:void 0;return{gutterLineType:t===`change`?`context`:t,gutterProperties:$e(n),contentProperties:et(t,n)}}getUnifiedInjectedRowsForLine=e=>{let t=this.injectedRows.get(`${e.hunkIndex}:${e.lineIndex}`);if(t==null||t.length===0)return;let{mergeConflictActionsType:n}=this.getOptionsWithDefaults(),r=[],i=[];for(let e of t){if(e.type===`actions`){r.push({content:nt({row:e,includeDefaultActions:n===`default`,includeSlot:!0}),gutter:tt(`action`)});continue}(e.type===`marker-end`?i:r).push({content:rt(e),gutter:tt(`marker`,e.type)})}return{before:r.length>0?r:void 0,after:i.length>0?i:void 0}};getOptionsWithDefaults(){let e=super.getOptionsWithDefaults();return e.diffStyle=`unified`,e.lineDiffType=this.options.lineDiffType??`none`,e.mergeConflictActionsType=this.options.mergeConflictActionsType??`default`,e}};function $e(e){return e==null?void 0:{"data-merge-conflict":e}}function et(e,t){if(t!=null){if(e===`change`)return t===`current`||t===`incoming`?{"data-line-type":`context`,"data-merge-conflict":t}:void 0;if(t===`marker-start`||t===`marker-base`||t===`marker-separator`||t===`marker-end`)return{"data-merge-conflict":t}}}function tt(e,t){let n=G(void 0,`annotation`,1);return n.properties[`data-gutter-buffer`]=e===`action`?`merge-conflict-action`:`merge-conflict-${t??`marker`}`,n}function nt({row:e,includeDefaultActions:t,includeSlot:n}){let r=t?it(e.conflictIndex):[];return n&&r.push(P({tagName:`slot`,properties:{name:De({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:e.conflictIndex}),"data-merge-conflict-action-slot":``}})),P({tagName:`div`,properties:{"data-merge-conflict-actions":``},children:[P({tagName:`div`,properties:{"data-merge-conflict-actions-content":``},children:r})]})}function rt(e){return P({tagName:`div`,properties:{"data-merge-conflict":e.type,"data-merge-conflict-marker-row":``},children:[K(e.lineText.replace(/(?:\r\n|\n|\r)$/,``))]})}function it(e){return[at({resolution:`current`,label:`Accept current change`,conflictIndex:e}),ot(),at({resolution:`incoming`,label:`Accept incoming change`,conflictIndex:e}),ot(),at({resolution:`both`,label:`Accept both`,conflictIndex:e})]}function at({resolution:e,label:t,conflictIndex:n}){return P({tagName:`button`,properties:{type:`button`,"data-merge-conflict-action":e,"data-merge-conflict-conflict-index":`${n}`},children:[K(t)]})}function ot(){return P({tagName:`span`,properties:{"data-merge-conflict-action-separator":``},children:[K(`|`)]})}function st(e,t){return e.hunkIndex===t.hunkIndex&&e.startContentIndex===t.startContentIndex&&e.endContentIndex===t.endContentIndex&&e.currentContentIndex===t.currentContentIndex&&e.baseContentIndex===t.baseContentIndex&&e.incomingContentIndex===t.incomingContentIndex&&e.endMarkerContentIndex===t.endMarkerContentIndex&&e.conflictIndex===t.conflictIndex&&ct(e.conflict,t.conflict)}function ct(e,t){return e.conflictIndex===t.conflictIndex&&e.startLineIndex===t.startLineIndex&&e.startLineNumber===t.startLineNumber&&e.separatorLineIndex===t.separatorLineIndex&&e.separatorLineNumber===t.separatorLineNumber&&e.endLineIndex===t.endLineIndex&&e.endLineNumber===t.endLineNumber&&e.baseMarkerLineIndex===t.baseMarkerLineIndex&&e.baseMarkerLineNumber===t.baseMarkerLineNumber}function lt(e){let t=typeof e==`string`?e:e.type;return t===`accept`||t===`incoming`?`additions`:t===`reject`||t===`current`?`deletions`:`both`}function ut(e,t){let{resolution:n,hunkIndex:r,startContentIndex:i,endContentIndex:a,indexesToDelete:o=new Set}=t,s=e.hunks[r];if(s==null)throw console.error({diff:e,hunkIndex:r}),Error(`resolveRegion: Invalid hunk index: ${r}`);if(i<0||a>=s.hunkContent.length||i>a)throw Error(`resolveRegion: Invalid content range, ${i}, ${a}`);let{hunks:c,additionLines:l,deletionLines:u}=e,d={...e,hunks:[],deletionLines:[],additionLines:[],splitLineCount:0,unifiedLineCount:0,cacheKey:e.cacheKey==null?void 0:`${e.cacheKey}:${n[0]}-${r}:${i}-${a}`},f={nextAdditionLineIndex:0,nextDeletionLineIndex:0,nextAdditionStart:1,nextDeletionStart:1,splitLineCount:0,unifiedLineCount:0},p=r===c.length-1&&a===s.hunkContent.length-1,m=!e.isPartial;for(let[t,s]of c.entries()){ft(e,d,f,Se(s.deletionStart,s.deletionCount)-s.collapsedBefore,Se(s.additionStart,s.additionCount)-s.collapsedBefore,s.collapsedBefore,m);let c={...s,hunkContent:[],additionStart:f.nextAdditionStart,deletionStart:f.nextDeletionStart,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex,additionCount:0,deletionCount:0,deletionLines:0,additionLines:0,splitLineStart:f.splitLineCount,unifiedLineStart:f.unifiedLineCount,splitLineCount:0,unifiedLineCount:0};for(let[e,p]of s.hunkContent.entries())if(t!==r||e<i||e>a){pt(p,d,u,l);let e={...p,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex};c.hunkContent.push(e),ht(e,f,c)}else if(o.has(e))c.hunkContent.push({type:`context`,lines:0,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex});else if(p.type===`context`){pt(p,d,u,l);let e={...p,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),ht(e,f,c)}else{mt(n,p,d,u,l);let e={type:`context`,lines:n===`deletions`?p.deletions:n===`additions`?p.additions:p.deletions+p.additions,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),ht(e,f,c)}if(t===r&&p){let e=n===`deletions`?s.noEOFCRDeletions:s.noEOFCRAdditions;c.noEOFCRAdditions=e,c.noEOFCRDeletions=e}c.additionCount===0&&(c.additionStart--,e.isPartial||c.additionLineIndex--),c.deletionCount===0&&(c.deletionStart--,e.isPartial||c.deletionLineIndex--),d.hunks.push(c)}let h=c.at(-1);if(h!=null&&!e.isPartial){let e=ie(h.deletionStart,h.deletionCount),t=ie(h.additionStart,h.additionCount),n=Math.min(u.length-e,l.length-t);dt(d,u,l,e,t,n),f.splitLineCount+=n,f.unifiedLineCount+=n}return d.splitLineCount=f.splitLineCount,d.unifiedLineCount=f.unifiedLineCount,d}function dt(e,t,n,r,i,a){for(let o=0;o<a;o++){let a=t[r+o],s=n[i+o];if(a==null||s==null)throw Error(`pushCollapsedContextLines: missing collapsed context line`);e.deletionLines.push(a),e.additionLines.push(s)}}function ft(e,t,n,r,i,a,o){a<=0||(o&&(dt(t,e.deletionLines,e.additionLines,r,i,a),n.nextAdditionLineIndex+=a,n.nextDeletionLineIndex+=a),n.nextAdditionStart+=a,n.nextDeletionStart+=a,n.splitLineCount+=a,n.unifiedLineCount+=a)}function pt(e,t,n,r){if(e.type===`context`)for(let n=0;n<e.lines;n++){let i=r[e.additionLineIndex+n];if(i==null)throw console.error({additionLines:r,content:e,i:n}),Error(`pushContentLinesToDiff: Context line does not exist`);t.deletionLines.push(i),t.additionLines.push(i)}else{let i=Math.max(e.deletions,e.additions);for(let a=0;a<i;a++){if(a<e.deletions){let r=n[e.deletionLineIndex+a];if(r==null)throw console.error({deletionLines:n,content:e,i:a}),Error(`pushContentLinesToDiff: Deletion line does not exist`);t.deletionLines.push(r)}if(a<e.additions){let n=r[e.additionLineIndex+a];if(n==null)throw console.error({additionLines:r,content:e,i:a}),Error(`pushContentLinesToDiff: Addition line does not exist`);t.additionLines.push(n)}}}}function mt(e,t,n,r,i){if(e===`deletions`||e===`both`)for(let e=0;e<t.deletions;e++){let i=r[t.deletionLineIndex+e];if(i==null)throw console.error({deletionLines:r,content:t,i:e}),Error(`pushResolveLinesToDiff: Deletion line does not exist`);n.deletionLines.push(i),n.additionLines.push(i)}if(e===`additions`||e===`both`)for(let e=0;e<t.additions;e++){let r=i[t.additionLineIndex+e];if(r==null)throw console.error({additionLines:i,content:t,i:e}),Error(`pushResolveLinesToDiff: Addition line does not exist`);n.deletionLines.push(r),n.additionLines.push(r)}}function ht(e,t,n){e.type===`context`?(t.nextAdditionLineIndex+=e.lines,t.nextDeletionLineIndex+=e.lines,t.nextAdditionStart+=e.lines,t.nextDeletionStart+=e.lines,t.splitLineCount+=e.lines,t.unifiedLineCount+=e.lines,n.additionCount+=e.lines,n.deletionCount+=e.lines,n.splitLineCount+=e.lines,n.unifiedLineCount+=e.lines):(t.nextAdditionLineIndex+=e.additions,t.nextDeletionLineIndex+=e.deletions,t.nextAdditionStart+=e.additions,t.nextDeletionStart+=e.deletions,t.splitLineCount+=Math.max(e.deletions,e.additions),t.unifiedLineCount+=e.deletions+e.additions,n.deletionCount+=e.deletions,n.deletionLines+=e.deletions,n.additionCount+=e.additions,n.additionLines+=e.additions,n.splitLineCount+=Math.max(e.deletions,e.additions),n.unifiedLineCount+=e.deletions+e.additions)}function gt(e,t,n){return ut(e,{resolution:lt(n),hunkIndex:t.hunkIndex,startContentIndex:t.startContentIndex,endContentIndex:t.endContentIndex,indexesToDelete:_t(t)})}function _t(e){let t=new Set;return e.baseContentIndex!=null&&t.add(e.baseContentIndex),e.endMarkerContentIndex!==e.endContentIndex&&t.add(e.endMarkerContentIndex),t}var vt=-1,yt=class extends W{options;__id=`unresolved-file:${++vt}`;type=`unresolved-file`;computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0};conflictActions=[];markerRows=[];conflictActionCache=new Map;constructor(e={theme:y},t,n=!1){super(void 0,t,n),this.options=e,this.setOptions(e)}setOptions(e){if(e!=null){if(e.onMergeConflictAction!=null&&e.onMergeConflictResolve!=null)throw Error(`UnresolvedFile: onMergeConflictAction and onMergeConflictResolve are mutually exclusive. Use only one callback.`);this.options=e,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions()}}syncInteractionOptions(){this.interactionManager.setOptions(w(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex,this.handleMergeConflictActionClick))}createHunksRenderer(e){return new Qe(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getHunksRendererOptions(e){return Ot(e,this.options)}applyPreNodeAttributes(e,t){super.applyPreNodeAttributes(e,t,{"data-has-merge-conflict":``})}cleanUp(){this.emitPostRender(!0),this.clearMergeConflictActionCache(),this.computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0},this.conflictActions=[],super.cleanUp()}getOrComputeDiff({file:e,fileDiff:t,actions:n,markerRows:r}){let{maxContextLines:i,onMergeConflictAction:a}=this.options;wrapper:if(a!=null){let a=t!=null;if(a!==(n!=null)||a!==(r!=null))throw Error(`UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together`);if(t!=null&&n!=null&&r!=null){this.computedCache={file:e??this.computedCache.file,fileDiff:t,actions:n,markerRows:r};break wrapper}else if(e!=null||this.computedCache.file!=null){if(e!=null&&this.computedCache.file!=null&&!I(e,this.computedCache.file)&&this.computedCache.fileDiff!=null&&this.computedCache.actions!=null)throw Error(`UnresolvedFile.getOrComputeDiff: file can only be used to initialize unresolved state once. Pass fileDiff and actions for subsequent updates.`);if(e??=this.computedCache.file,e==null)throw Error(`UnresolvedFile.getOrComputeDiff: file is null, should be impossible`);if(!I(e,this.computedCache.file)||this.computedCache.fileDiff==null||this.computedCache.actions==null){let t=R(e,i);this.computedCache={file:e,fileDiff:t.fileDiff,actions:t.actions,markerRows:t.markerRows}}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}else{t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}}else{if(t!=null||n!=null||r!=null)throw Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows are only usable in controlled mode, you must pass in `onMergeConflictAction`");if(e!=null&&this.computedCache.file!=null&&!I(e,this.computedCache.file))throw Error(`UnresolvedFile.getOrComputeDiff: uncontrolled unresolved files parse the file only once. Later updates must come from the cached diff state.`);if(this.computedCache.file??=e,this.computedCache.fileDiff==null&&this.computedCache.file!=null){let e=R(this.computedCache.file,i);this.computedCache.fileDiff=e.fileDiff,this.computedCache.actions=e.actions,this.computedCache.markerRows=e.markerRows}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}if(!(t==null||n==null||r==null))return{fileDiff:t,actions:n,markerRows:r}}hydrate(e){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,fileContainer:o,prerenderedHTML:s,preventEmit:c=!1}=e,l=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});l!=null&&(this.hydrateElements(o,s),this.setActiveMergeConflictState(l.actions,l.markerRows),Et(this.pre,l.fileDiff,this.options.collapsed)||Dt(this.headerElement,l.fileDiff,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):(this.hydrationSetup({fileDiff:l.fileDiff,lineAnnotations:a}),this.pre!=null&&this.renderMergeConflictActionSlots()),c||this.emitPostRender())}rerender(){!this.enabled||this.fileDiff==null||this.render({forceRender:!0,renderRange:this.renderRange})}render(e={}){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,preventEmit:o=!1,...s}=e,c=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});if(c==null)return!1;this.setActiveMergeConflictState(c.actions,c.markerRows);let l=super.render({...s,fileDiff:c.fileDiff,lineAnnotations:a,preventEmit:!0});return l&&(this.renderMergeConflictActionSlots(),o||this.emitPostRender()),l}resolveConflict(e,t,n=this.computedCache.fileDiff){let r=this.conflictActions[e];if(n==null||r==null)return;if(r.conflictIndex!==e)throw console.error({conflictIndex:e,action:r}),Error(`UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match`);let i=gt(n,r,t),a=this.computedCache.file,{file:o,actions:s,markerRows:c}=bt({fileDiff:i,previousActions:this.conflictActions,resolvedConflictIndex:e,previousFile:a,resolution:t});return{file:o,fileDiff:i,actions:s,markerRows:c}}resolveConflictAndRender(e,t){let n=this.conflictActions[e];if(n==null)return;if(n.conflictIndex!==e)throw console.error({conflictIndex:e,action:n}),Error(`UnresolvedFile.resolveConflictAndRender: conflictIndex and conflictAction don't match`);let r={resolution:t,conflict:n.conflict},{file:i,fileDiff:a,actions:o,markerRows:s}=this.resolveConflict(e,t)??{};i==null||a==null||o==null||s==null||(this.computedCache={file:i,fileDiff:a,actions:o,markerRows:s},this.setActiveMergeConflictState(o,s),this.workerManager==null?this.render({forceRender:!0}):this.hunksRenderer.renderDiff(a),this.options.onMergeConflictResolve?.(i,r))}setActiveMergeConflictState(e=this.conflictActions,t=this.markerRows){this.conflictActions=e,this.markerRows=t,this.computedCache.fileDiff!=null&&this.hunksRenderer instanceof Qe&&this.hunksRenderer.setConflictState(this.options.mergeConflictActionsType===`none`?[]:e,t,this.computedCache.fileDiff)}handleMergeConflictActionClick=e=>{let t=this.conflictActions[e.conflictIndex];if(t==null)return;if(t.conflictIndex!==e.conflictIndex)throw console.error({conflictIndex:e.conflictIndex,action:t}),Error(`UnresolvedFile.handleMergeConflictActionClick: conflictIndex and conflictAction don't match`);let n={resolution:e.resolution,conflict:t.conflict};if(this.options.onMergeConflictAction!=null){this.options.onMergeConflictAction(n,this);return}this.resolveConflictAndRender(e.conflictIndex,e.resolution)};renderMergeConflictActionSlots(){let{fileDiff:e}=this.computedCache;if(this.isContainerManaged||this.fileContainer==null||typeof this.options.mergeConflictActionsType!=`function`||this.conflictActions.length===0||e==null){this.clearMergeConflictActionCache();return}let t=new Map(this.conflictActionCache);for(let n=0;n<this.conflictActions.length;n++){let r=this.conflictActions[n];if(r==null)continue;if(r.conflictIndex!==n)throw console.error({conflictIndex:n,action:r}),Error(`UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match`);let i=B(r,e);if(i==null)continue;let a=r.conflictIndex,o=De({hunkIndex:i.hunkIndex,lineIndex:i.lineIndex,conflictIndex:a}),s=`${n}-${o}`,c=this.conflictActionCache.get(s);if(c==null||!st(c.action,r)){c?.element.remove();let e=this.renderMergeConflictAction(r);if(e==null)continue;let t=we(o);t.appendChild(e),this.fileContainer.appendChild(t),c={element:t,action:r},this.conflictActionCache.set(s,c)}t.delete(s)}for(let[e,{element:n}]of t.entries())this.conflictActionCache.delete(e),n.remove()}renderMergeConflictAction(e){if(typeof this.options.mergeConflictActionsType!=`function`)return;let t=this.options.mergeConflictActionsType(e,this);if(t!=null){if(t instanceof HTMLElement)return t;if(typeof DocumentFragment<`u`&&t instanceof DocumentFragment){let e=document.createElement(`div`);return e.style.display=`contents`,e.appendChild(t),e}}}clearMergeConflictActionCache(){for(let{element:e}of this.conflictActionCache.values())e.remove();this.conflictActionCache.clear()}};function bt({fileDiff:e,previousActions:t,resolvedConflictIndex:n,previousFile:r,resolution:i}){let a=t[n];if(a==null)throw Error(`rebuildFileAndActions: missing resolved action for unresolved file rebuild`);let o=Ct(t,n,a,i),s=U(e,o);return{file:xt({fileDiff:e,resolvedAction:a,resolvedConflictIndex:n,previousFile:r,resolution:i}),actions:o,markerRows:s}}function xt({resolvedAction:e,resolvedConflictIndex:t,previousFile:n,fileDiff:r,resolution:i}){let a=ae(n?.contents??``),{conflict:o}=e,s=St(a,o,i),c=[...a.slice(0,o.startLineIndex),...s,...a.slice(o.endLineIndex+1)].join(``);return{name:n?.name??r.name,contents:c,cacheKey:n?.cacheKey==null?void 0:`${n.cacheKey}:mc-${t}-${i}`}}function St(e,t,n){let r=e.slice(t.startLineIndex+1,t.baseMarkerLineIndex??t.separatorLineIndex),i=e.slice(t.separatorLineIndex+1,t.endLineIndex);return n===`current`?r:n===`incoming`?i:[...r,...i]}function Ct(e,t,n,r){let i=wt(n.conflict,r);return e.map((e,r)=>{if(r!==t&&e!=null)return e.conflict.startLineIndex>n.conflict.endLineIndex?{...e,conflict:Tt(e.conflict,i)}:e})}function wt(e,t){let n=(e.baseMarkerLineIndex??e.separatorLineIndex)-e.startLineIndex-1,r=e.endLineIndex-e.separatorLineIndex-1;return(t===`current`?n:t===`incoming`?r:n+r)-(e.endLineIndex-e.startLineIndex+1)}function Tt(e,t){return{...e,startLineIndex:e.startLineIndex+t,startLineNumber:e.startLineNumber+t,separatorLineIndex:e.separatorLineIndex+t,separatorLineNumber:e.separatorLineNumber+t,endLineIndex:e.endLineIndex+t,endLineNumber:e.endLineNumber+t,baseMarkerLineIndex:e.baseMarkerLineIndex==null?void 0:e.baseMarkerLineIndex+t,baseMarkerLineNumber:e.baseMarkerLineNumber==null?void 0:e.baseMarkerLineNumber+t}}function Et(e,t,n=!1){return!n&&e==null&&t!=null}function Dt(e,t,n=!1){return e==null&&t!=null&&!n}function Ot(e,t){let n={...t,...e};return{...n,useTokenTransformer:ge(n),hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,mergeConflictActionsType:typeof e?.mergeConflictActionsType==`function`?`custom`:e?.mergeConflictActionsType}}var kt=o(),Q=e(n(),1),At=null;function jt(e){let t=(0,kt.c)(3),n=(0,Q.useRef)(null),r,i;return t[0]===e?(r=t[1],i=t[2]):(r=()=>{if(!e)return;let t=n.current;if(!t)return;let r={};At=r;let i=document.documentElement,a=null,o=()=>{if(At!==r)return;let e=`${t.offsetHeight}px`;e!==a&&(a=e,i.style.setProperty(`--conflict-footer-height`,e))};o();let s=new ResizeObserver(o);return s.observe(t),()=>{s.disconnect(),At===r&&(At=null,i.style.removeProperty(`--conflict-footer-height`))}},i=[e],t[0]=e,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i),n}var $=t();function Mt(e){let t=(0,kt.c)(9),{filename:n,content:r}=e,{_:a}=i(),o=(0,Q.useRef)(null),s,c;t[0]!==r||t[1]!==n?(s=()=>{let e=o.current;if(!e)return;let t=new Ye({overflow:`wrap`,theme:_e()});return t.render({file:{name:n,contents:r},containerWrapper:e}),()=>{t.cleanUp()}},c=[n,r],t[0]=r,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l;t[4]!==a||t[5]!==n?(l=a({id:`wXFalZ`,values:{filename:n}}),t[4]=a,t[5]=n,t[6]=l):l=t[6];let u;return t[7]===l?u=t[8]:(u=(0,$.jsx)(`section`,{ref:o,tabIndex:0,"aria-label":l,className:`conflict-view h-full overflow-y-auto subtle-scrollbar`}),t[7]=l,t[8]=u),u}var Nt=e(a(),1),Pt=50,Ft=class{stack;idx;constructor(e){this.stack=[e],this.idx=0}get current(){let e=this.stack[this.idx];if(!e)throw Error(`ConflictHistory: stack is empty — invariant violated`);return e}get canUndo(){return this.idx>0}get canRedo(){return this.idx<this.stack.length-1}push(e){this.stack.splice(this.idx+1),this.stack.push(e),this.idx++,this.stack.length>Pt+1&&(this.stack.splice(1,this.stack.length-Pt-1),this.idx=this.stack.length-1)}reset(e){this.stack[0]=e}undo(){return this.canUndo?(this.idx--,this.stack[this.idx]??null):null}redo(){return this.canRedo?(this.idx++,this.stack[this.idx]??null):null}},It=`