@inkeep/open-knowledge 0.55.0-beta.1 → 0.55.0-beta.2

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 (90) hide show
  1. package/dist/{acp-harness-probe-lDuLp4Qa.mjs → acp-harness-probe-B5rtK70W.mjs} +2 -2
  2. package/dist/cli.mjs +56 -56
  3. package/dist/constants-B1bYUkjR.mjs +2 -0
  4. package/dist/{git-handle-rOWtim7I.mjs → git-handle-Cxzb3Q66.mjs} +2 -2
  5. package/dist/git-handle-d6WEz7EB.mjs +1 -0
  6. package/dist/index.d.mts +17 -17
  7. package/dist/index.mjs +2 -2
  8. package/dist/init-B3P9VctC.mjs +1 -0
  9. package/dist/{init-v0VPPFiM.mjs → init-wVvnzgvD.mjs} +5 -5
  10. package/dist/{launch-json-removal-Sf0RFBoy.mjs → launch-json-removal-BYTN6Sc2.mjs} +2 -2
  11. package/dist/{loader-CS3RrJij.mjs → loader-C4h6uhjM.mjs} +2 -2
  12. package/dist/loader-TjpZM8lN.mjs +1 -0
  13. package/dist/md-manager-BTfp7oZf.mjs +2 -0
  14. package/dist/{open-browser-BW-Hew_r.mjs → open-browser-C-3LfEro.mjs} +2 -2
  15. package/dist/parse-worker.mjs +1 -1
  16. package/dist/preview-DN-ocexN.mjs +1 -0
  17. package/dist/{preview-BqrrYUm3.mjs → preview-Ip56ObXW.mjs} +2 -2
  18. package/dist/public/assets/{ActivityModeContent-DcZcuYAJ.js → ActivityModeContent-C8KnF0Dn.js} +1 -1
  19. package/dist/public/assets/{AgentDiffPane-2uGghQOt.js → AgentDiffPane-CWrkiRj0.js} +1 -1
  20. package/dist/public/assets/{ChangedOutsideBadge-BLRjUkdG.js → ChangedOutsideBadge-CWPuWvsE.js} +1 -1
  21. package/dist/public/assets/{CodeMirrorPropInput-C3sOo6SV.js → CodeMirrorPropInput-kYmUy2HP.js} +1 -1
  22. package/dist/public/assets/{DocumentContext-B1SDm4sQ.js → DocumentContext-D_2wOhha.js} +3 -3
  23. package/dist/public/assets/FeedbackForm-BByPub6J.js +1 -0
  24. package/dist/public/assets/{GraphPanel-VR9VuXcj.js → GraphPanel-B4kFUyMu.js} +1 -1
  25. package/dist/public/assets/{ImportSkillDialog-NmQXfZnX.js → ImportSkillDialog-DGwmO7Q3.js} +1 -1
  26. package/dist/public/assets/ManagedArtifactProperties-B9_Kx9se.js +1 -0
  27. package/dist/public/assets/{ManagedArtifactProperties-Jtr80jr6.js → ManagedArtifactProperties-CjjHctKu.js} +1 -1
  28. package/dist/public/assets/{MermaidDocEditor-C_n10hEd.js → MermaidDocEditor-DGOy104A.js} +1 -1
  29. package/dist/public/assets/{PropertyDisplayRow-ChdBi9zJ.js → PropertyDisplayRow-DINMH11H.js} +1 -1
  30. package/dist/public/assets/{SessionsHost-DvcIZ54i.js → SessionsHost-4cnLdmEw.js} +2 -2
  31. package/dist/public/assets/{SettingsDialogBody-Dey6WBp3.js → SettingsDialogBody-DXoj3udk.js} +1 -1
  32. package/dist/public/assets/{ShareReceiveMissDialog-gMsNFMtB.js → ShareReceiveMissDialog-DLMuufSC.js} +1 -1
  33. package/dist/public/assets/{SkillToolbarControls-CCqPpOJB.js → SkillToolbarControls-C2rVk5xS.js} +1 -1
  34. package/dist/public/assets/{SourceEditor-DiCv2Gw6.js → SourceEditor-DK4pY0UD.js} +1 -1
  35. package/dist/public/assets/{TerminalPanel-ClYDHgTw.js → TerminalPanel-ClKSEy6h.js} +1 -1
  36. package/dist/public/assets/{TerminalWindowApp-BOaDKQOa.js → TerminalWindowApp-Fu8Eilw5.js} +1 -1
  37. package/dist/public/assets/{TextDocEditor-s16UdZ4S.js → TextDocEditor-BvSxU2Yl.js} +1 -1
  38. package/dist/public/assets/{ThreadView-wcmHTABo.js → ThreadView-BDL34M4I.js} +1 -1
  39. package/dist/public/assets/{TimelineDiffPane-DJ7VTz8w.js → TimelineDiffPane-CP27akfa.js} +1 -1
  40. package/dist/public/assets/{agent-diff-store-ghjPPIo8.js → agent-diff-store-DDILVUc3.js} +1 -1
  41. package/dist/public/assets/{auth-state-cache-qeM__dy4.js → auth-state-cache-CFUBUH-O.js} +1 -1
  42. package/dist/public/assets/{comment-chips-CXbTEiUh.js → comment-chips-CQFlHEHc.js} +1 -1
  43. package/dist/public/assets/{doc-paths-D4mBEiVg.js → doc-paths-D-8nN6rk.js} +1 -1
  44. package/dist/public/assets/{file-tree-adapter-BPyupSyB.js → file-tree-adapter-CmaR01Z2.js} +1 -1
  45. package/dist/public/assets/{follow-file-DpSK6FTB.js → follow-file-DdxR5CX9.js} +1 -1
  46. package/dist/public/assets/{index-CxA0FfEI.js → index-rhq_PNJh.js} +107 -107
  47. package/dist/public/assets/{navigation-targets-2ieFyUYm.js → navigation-targets-C5LikiXa.js} +1 -1
  48. package/dist/public/assets/{open-managed-artifact-tab-yTCCkm3Q.js → open-managed-artifact-tab-5kXC71Ov.js} +1 -1
  49. package/dist/public/assets/{pending-receive-nav-store-CPWqhWlW.js → pending-receive-nav-store-C1a0zwF2.js} +1 -1
  50. package/dist/public/assets/{prop-types-B-pqwsrL.js → prop-types-DQ8_DMD-.js} +1 -1
  51. package/dist/public/assets/{selection-context-Df863KxU.js → selection-context-0itcYYoc.js} +1 -1
  52. package/dist/public/assets/{skill-actions-CfoGHC_r.js → skill-actions-Bw-u8dKL.js} +1 -1
  53. package/dist/public/assets/{src-BMyHeF9k.js → src-D2Yu3JW2.js} +1 -1
  54. package/dist/public/assets/{target-navigation-intent-BBuo58_u.js → target-navigation-intent-BSmFCamP.js} +1 -1
  55. package/dist/public/assets/{typing-burst-detector-AjqiozYb.js → typing-burst-detector-iFuSe_aJ.js} +1 -1
  56. package/dist/public/assets/{use-activity-panel-D5UdYvLX.js → use-activity-panel-Dk2sZPO3.js} +1 -1
  57. package/dist/public/assets/{use-open-skill-DBZEtMhw.js → use-open-skill-y5aC1A4U.js} +1 -1
  58. package/dist/public/assets/{use-popular-skills-DXtBalgU.js → use-popular-skills-CeXELxu9.js} +1 -1
  59. package/dist/public/assets/{use-timeline-entry-diff-8DxGofLT.js → use-timeline-entry-diff-DjOTB-ve.js} +1 -1
  60. package/dist/public/index.html +22 -22
  61. package/dist/{repair-launch-json-BYMJ3AKd.mjs → repair-launch-json-DwXITtG1.mjs} +2 -2
  62. package/dist/{repair-mcp-configs-CR_J002W.mjs → repair-mcp-configs-BjFWsFoV.mjs} +2 -2
  63. package/dist/repair-skills-CgfEN5Nv.mjs +1 -0
  64. package/dist/{repair-skills-BS2KTmkf.mjs → repair-skills-D7r4rSXg.mjs} +2 -2
  65. package/dist/server-lock-B9Wxz8Oa.mjs +1 -0
  66. package/dist/{server-lock-Df6KzkHc.mjs → server-lock-BUD-3RhR.mjs} +2 -2
  67. package/dist/{skill-teardown-C98gqE3y.mjs → skill-teardown-CnQN-8Yk.mjs} +2 -2
  68. package/dist/{src-0pFsBNfd.mjs → src-B7h_FH7E.mjs} +4 -4
  69. package/dist/{src-DgQEuS4u.mjs → src-C5a7IXFc.mjs} +123 -118
  70. package/dist/{src-ChXrJ-t-.mjs → src-C7X28-oJ.mjs} +370 -370
  71. package/dist/{src-IYcHWRNt.mjs → src-Cx6jmm8e.mjs} +1 -1
  72. package/dist/src-DGX9vKPp.mjs +1 -0
  73. package/dist/start-B3Pk-_m5.mjs +12 -0
  74. package/dist/start-D6LVVtKi.mjs +1 -0
  75. package/dist/{ui-BgeM7Ixs.mjs → ui-BMqKR40d.mjs} +3 -3
  76. package/dist/{write-project-skill-CXlAGClh.mjs → write-project-skill-0B2V9BEJ.mjs} +4 -4
  77. package/package.json +5 -5
  78. package/dist/constants-BT3cSU-5.mjs +0 -2
  79. package/dist/git-handle-Bhi37DC5.mjs +0 -1
  80. package/dist/init-Bx06t22F.mjs +0 -1
  81. package/dist/loader-Cae18c7e.mjs +0 -1
  82. package/dist/md-manager-CFxg-xpz.mjs +0 -2
  83. package/dist/preview-CjVjSoZH.mjs +0 -1
  84. package/dist/public/assets/FeedbackForm-Ce-flwYe.js +0 -1
  85. package/dist/public/assets/ManagedArtifactProperties-DHNzG_p_.js +0 -1
  86. package/dist/repair-skills-DKo3pviC.mjs +0 -1
  87. package/dist/server-lock-B_7-s4Ni.mjs +0 -1
  88. package/dist/src-WkC0qgSS.mjs +0 -1
  89. package/dist/start-m_nE7mqB.mjs +0 -1
  90. package/dist/start-zYoyrUyD.mjs +0 -12
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./code-highlighter-impl-DcDH82_f.js","./lib-C0Wr4O8I.js","./html-void-elements-C35FEqss.js","./chunk-CYidjpOJ.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{An as r,En as i,Ln as a,On as o,Sn as s,a as c,kn as l,tr as u,vr as d}from"./DocumentContext-B1SDm4sQ.js";import{t as f}from"./react-f2sANaYj.js";import{n as p,r as m}from"./dist-Nvb76hAm.js";import{t as h}from"./compiler-runtime-BfE3aGVn.js";import{c as g,l as _}from"./local-menu-action-bus-Cypryz6Z.js";import{t as v}from"./utils-CPqDy6Hr.js";import{t as y}from"./mascot-outline-CtS592mc.js";import{t as b}from"./button-CA0dewJJ.js";import{i as x,n as S,t as C}from"./tooltip-DHXgxWLL.js";import{c as w,i as T,t as E}from"./dialog-HdfR4WGm.js";import{ot as D}from"./CodeMirrorPropInput-C3sOo6SV.js";import{t as O}from"./checkbox-hfBCQ901.js";import{a as k,c as A,d as j,f as M,l as N,m as P,n as F,o as ee,p as I,r as te,t as L}from"./dropdown-menu-CLgDYkh1.js";import{t as ne}from"./progress-BdSO2c_8.js";import{n as R}from"./separator-vdmCepR4.js";import{t as re}from"./switch-B2sF5R0q.js";import{lt as ie,zr as z}from"./dist-C771h__g.js";import{t as B}from"./dist-DUfEoSbR.js";import{n as ae}from"./dist-B6jB2qbD2.js";import{i as oe,t as V}from"./history-B1SZDFzE.js";import{t as H}from"./use-workspace-DeC16-uw.js";import{t as U}from"./createLucideIcon-Bhw2PmPp.js";import{l as W,o as se}from"./Mermaid-ukCAxO5k.js";import{t as ce}from"./RegisteredAgentIcon-CP1iDML-.js";import{t as G}from"./check-CGfmW4da.js";import{t as K}from"./chevron-down-DabHDQTe.js";import{t as le}from"./chevron-right-Diamp-K_.js";import{o as q,r as ue,s as de}from"./prop-types-B-pqwsrL.js";import{t as fe}from"./download-Dn5ulvxm.js";import{t as pe}from"./list-plus-CT84Vd_h.js";import{t as me}from"./spinner-BxJv3FRl.js";import{c as he,n as ge,o as J,s as _e,t as ve}from"./comment-chips-CXbTEiUh.js";import{a as ye,b as be,c as xe,d as Se,f as Ce,i as we,l as Te,n as Ee,o as De,p as Oe,r as ke,s as Ae,t as je,u as Me,v as Ne,y as Pe}from"./follow-file-DpSK6FTB.js";import{t as Fe}from"./square-pen-NShYDQ74.js";import{t as Ie}from"./terminal-DbJygh5J.js";import{t as Le}from"./trash-2-Co21mefL.js";import{t as Re}from"./wrench-Pum_Z20m.js";import{t as ze}from"./x-DddVxTPq.js";import{f as Be,s as Ve}from"./doc-paths-D4mBEiVg.js";import{t as He}from"./badge-I_vhU4ix.js";import{t as Ue}from"./skeleton-D4wPMdlV.js";import{t as We}from"./textarea-dRxJ8TN6.js";import{n as Ge}from"./agent-presence-DGcZkmSh.js";import{i as Ke,n as qe}from"./chunk-BO2N2NFS-BG8bvliu.js";import{n as Je}from"./libesm-Bf6KoNgP.js";import{a as Ye,d as Xe,f as Ze,n as Qe,p as $e,r as et,s as tt,u as nt}from"./thread-client-CvSFIaay.js";import{n as rt}from"./thread-draft-staging-D5ZThmoH.js";var it=U(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),at=U(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),ot=U(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),st=U(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Y=h(),ct=new RegExp([`bypass`,`acceptedits`,`fullaccess`,`autoedit`,`yolo`,`danger`,`fullauto`,`autoaccept`,`autoapprove`,`autorun`,`skippermission`,`noconfirm`,`noprompt`,`unrestricted`,`allowall`].join(`|`)),lt=new Set([`auto`]);function ut(e){return e.toLowerCase().replace(/[^a-z]/g,``)}function dt(e){let t=ut(e.id),n=ut(e.name??``);return lt.has(t)||lt.has(n)?!0:ct.test(t)||ct.test(n)}var ft={"claude-acp":`asks`,"codex-acp":`self-managed`,cursor:`self-managed`,"pi-acp":`autonomous`};function pt(e,t,n){let r=n??(t==null?null:t.availableModes.find(e=>e.id===t.currentModeId)??null),i=ft[e];return i===void 0?t!=null&&t.availableModes.length>0?`self-managed`:`unknown`:i===`asks`&&r!==null&&dt(r)?`self-managed`:i}var X=e(f(),1),Z=n();function mt({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=ht(gt(r,i),t);if(!n)return X.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!X.isValidElement(n))return null;let o=n.props,s={...ht(a,o),ref:yt(a.ref,o.ref)};return X.cloneElement(n,s)}function ht(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];n===`className`?t[n]=[i,r].filter(Boolean).join(` `):n===`style`?t[n]={...i,...r}:n===`ref`?t[n]=yt(i,r):vt(n)&&typeof i==`function`&&typeof r==`function`?t[n]=_t(r,i):t[n]=r}}return t}function gt(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function _t(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function vt(e){return/^on[A-Z]/.test(e)}function yt(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var bt=8,xt=64,St=0,Ct=.5,wt=180,Tt=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),Et={start:!1,end:!1},Dt={currentAnchorId:null,visibleMessageIds:[]};function Ot({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return Et;let i=Bt({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function kt({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return Dt;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of At(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+Ct&&(u=e)}return l.length===0&&u===null?Dt:{currentAnchorId:u,visibleMessageIds:l}}function At(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function jt(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function Mt(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function Nt(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function Pt(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function Ft({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of At(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function It({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=Lt(t,i),o=t.getBoundingClientRect().height,s=Ut(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function Lt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Rt(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function zt({content:e,scrollTop:t,spacer:n,viewport:r}){let i=Bt({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function Bt({content:e,spacer:t,viewport:n}){let r=At(e,t),i=Ht(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function Vt(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Ht(e){let t=window.getComputedStyle(e);return{end:Gt(t.paddingBlockEnd||t.paddingBottom),start:Gt(t.paddingBlockStart||t.paddingTop)}}function Ut(e){let t=e?.parentElement;return t?Ht(t):{end:0,start:0}}function Wt(e){if(!e)return 0;let t=window.getComputedStyle(e);return Gt(t.rowGap===`normal`?t.gap:t.rowGap)}function Gt(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Kt({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,defaultScrollPositionAppliedRef:l,itemCountRef:u,messageElementsRef:d,modeRef:f,pendingScrollToMessageRef:p,prependRestoreRef:m,scrollMarginRef:h,scrollPreviousItemPeekRef:g,spacerGapRef:_,spacerHeightRef:v,spacerRef:y,viewportRef:b}=e,x=X.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},wt))},[t]),S=X.useCallback(e=>{let t=y.current;if(!t)return;let n=Math.max(0,Math.ceil(e));v.current!==n&&(v.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-_.current}px`:``)},[]),C=X.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=b.current;if(!a)return;let o=Math.max(0,e);if(Math.abs(a.scrollTop-o)<=Ct){a.scrollTop=o,t();return}i&&x(!0),a.scrollTo({top:o,behavior:r}),n()},[t,n,x]),w=X.useCallback(({behavior:e=`auto`}={})=>b.current?(S(0),i.current=null,f.current=`free-scrolling`,C(0,{behavior:e}),r(),!0):!1,[r,C,S]),T=X.useCallback(({behavior:e=`auto`}={})=>{let t=b.current;return t?(S(0),i.current=null,f.current=a.current?`following-bottom`:`free-scrolling`,C(Vt(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,C,S]),E=X.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=h.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=b.current;if(!s||!l||!s.contains(e))return!1;let u=It({align:t,element:e,scrollMargin:o?a+g.current:a,spacer:y.current,viewport:l});return S(zt({content:s,scrollTop:u,spacer:y.current,viewport:l})),m.current={element:e,viewportTop:Rt(e,l)},f.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,C(u,{behavior:n}),r(),!0},[r,C,S]),D=X.useCallback(()=>{let e=i.current;return!e||!e.isConnected||f.current!==`anchored-to-message`?!1:E(e,{align:`start`},{keepPreviousPeek:!0})},[E]),O=X.useCallback((e,t)=>{let n=d.current.get(e);return n?(l.current=!0,E(n,t)?(p.current=null,!0):(p.current={messageId:e,options:t},!0)):u.current===0?(p.current={messageId:e,options:t},l.current=!0,!0):!1},[E]);return{flushPendingScrollToMessage:X.useCallback(()=>{let e=p.current;if(!e)return!1;let t=d.current.get(e.messageId);return!t||!E(t,e.options)?!1:(p.current=null,l.current=!0,!0)},[E]),reanchorToAnchoredMessage:D,scrollToElement:E,scrollToEnd:T,scrollToMessage:O,scrollToStart:w}}function qt(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function Jt(e,t){return qt(e,t)}function Yt(){return qt(Dt,Zt)}function Xt(e,t){return e.start===t.start&&e.end===t.end}function Zt(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function Qt({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let i=X.useRef(e),a=X.useRef(!1),o=X.useRef(null),s=X.useRef(!1),c=X.useRef(t),l=X.useRef(0),u=X.useRef(null),d=X.useRef(0),f=X.useRef(e?`following-bottom`:`free-scrolling`),p=X.useRef(new Map),m=X.useRef(null),h=X.useRef(null),g=X.useRef(null),_=X.useRef(r),v=X.useRef(!0),y=X.useRef(null),b=X.useRef(n),x=X.useRef(null),S=X.useRef(0),C=X.useRef(0),w=X.useRef(null),T=X.useRef(null),E=X.useRef(null),D=X.useRef(null),O=X.useRef(null),k=X.useRef(null),A=X.useRef(null),j=X.useRef(null),M=X.useRef(new Set),N=X.useRef(new WeakSet);return E.current===null&&(E.current=Jt(Et,Xt)),j.current===null&&(j.current=Yt()),i.current=e,c.current=t,b.current=n,_.current=r,{autoScrollRef:i,autoscrollingRef:a,autoscrollingTimeoutRef:D,streamingTurnRef:g,contentRef:o,defaultScrollPositionAppliedRef:s,firstItemRef:u,itemCountRef:l,lastScrollTopRef:d,messageElementsRef:p,modeRef:f,pendingScrollFrameRef:x,pendingScrollToMessageRef:m,prependRestoreRef:h,preserveScrollOnPrependRef:v,rootRef:y,scrollEdgeThresholdRef:c,scrollMarginRef:b,scrollPreviousItemPeekRef:_,spacerGapRef:S,spacerHeightRef:C,spacerRef:w,stateFrameRef:T,stateStore:E.current,viewportRef:O,visibilityFrameRef:k,visibilityObserverRef:A,visibilityStore:j.current,visibleMessageIdsRef:M,handledScrollAnchorsRef:N}}function $t(e,t){return X.useCallback(n=>{e.current=n,n&&t()},[e,t])}function en({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=bt,scrollPreviousItemPeek:r=xt,scrollMargin:i=St}){let a=Qt({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:v,prependRestoreRef:y,preserveScrollOnPrependRef:b,rootRef:x,scrollEdgeThresholdRef:S,scrollMarginRef:C,scrollPreviousItemPeekRef:w,spacerGapRef:T,spacerHeightRef:E,spacerRef:D,stateFrameRef:O,stateStore:k,viewportRef:A,visibilityFrameRef:j,visibilityObserverRef:M,visibilityStore:N,visibleMessageIdsRef:P,handledScrollAnchorsRef:F}=a,ee=X.useRef(t);ee.current!==t&&(ee.current=t,d.current=!1);let I=X.useCallback(e=>{let t=x.current,n=A.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),te=X.useCallback(e=>{let t=A.current?.scrollTop??0,n=t<m.current-Ct;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),L=X.useCallback(()=>{let e=Ot({content:u.current,scrollEdgeThreshold:S.current,spacer:D.current,viewport:A.current});te(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;I(t),k.setSnapshot(t)},[te,k,I]),ne=X.useCallback(()=>{O.current===null&&(O.current=window.requestAnimationFrame(()=>{O.current=null,L()}))},[L]),R=X.useCallback(()=>{N.hasListeners()&&j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null,N.hasListeners()&&N.setSnapshot(kt({content:u.current,scrollMargin:C.current,scrollPreviousItemPeek:w.current,spacer:D.current,viewport:A.current,visibleMessageIds:P.current}))}))},[N]),{flushPendingScrollToMessage:re,reanchorToAnchoredMessage:ie,scrollToElement:z,scrollToEnd:B,scrollToMessage:ae,scrollToStart:oe}=Kt({refs:a,commitScrollState:L,scheduleStateCommit:ne,scheduleVisibilitySync:R}),V=X.useCallback(()=>{let e=y.current,t=A.current;if(!e||!t||!e.element.isConnected)return!1;let n=Rt(e.element,t)-e.viewportTop;return Math.abs(n)<=Ct?!1:(t.scrollTop+=n,e.viewportTop=Rt(e.element,t),ne(),R(),!0)},[ne,R]),H=X.useCallback(()=>{let e=u.current,t=A.current;if(!e||!t){y.current=null;return}let n=Ft({content:e,spacer:D.current,viewport:t});y.current=n?{element:n,viewportTop:Rt(n,t)}:null},[]),U=X.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,re()&&H()}))},[H,re]),W=X.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=A.current,r=t&&n?Pt(At(t,D.current)):null;if(!t||!n||!r)e=B({behavior:`auto`});else{let i=Lt(r,n);e=Bt({content:t,spacer:D.current,viewport:n})-i<=n.clientHeight?B({behavior:`auto`}):z(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?B({behavior:`auto`}):oe({behavior:`auto`});return e?(d.current=!0,!0):!1},[t,z,B,oe]),se=X.useCallback(()=>{let e=u.current;if(!e)return;let t=At(e,D.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(re())return;if(n===0){if(W()||t.length>0&&s.current&&B({behavior:`auto`}))return;L(),R();return}let e=r?t.indexOf(r):-1;if(b.current&&e>0){V();return}if(t.length>n){let e=jt(t,n);if(e){if(s.current&&g.current===`following-bottom`&&Nt(t,n)){B({behavior:`auto`});return}z(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}if(t.length===n){let e=Mt(t,F.current);if(e){z(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}g.current===`following-bottom`&&s.current?B({behavior:`auto`}):(L(),R())})(),H()},[W,H,L,re,V,R,z,B]),ce=X.useCallback(()=>{if(g.current===`following-bottom`&&s.current){B({behavior:`auto`});return}let e=E.current;if(ie()){s.current&&e>0&&E.current===0&&B({behavior:`auto`});return}ne(),R()},[ie,ne,R,B]),G=X.useCallback(()=>{let e=A.current;if(!(!e||!N.hasListeners())){if(typeof IntersectionObserver>`u`){R();return}M.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?P.current.add(e):P.current.delete(e))}R()},{root:e,rootMargin:`${-(C.current+w.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{M.current?.observe(e)}),R()}},[R,N]),K=X.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),M.current?.disconnect(),M.current=null,P.current.clear(),N.setSnapshot(Dt)},[N]),le=X.useCallback((e,t,n)=>{if(t){h.current.set(e,t),M.current?.observe(t),R(),v.current?.messageId===e&&U();return}n&&h.current.get(e)===n&&(h.current.delete(e),P.current.delete(e),M.current?.unobserve(n),R())},[U,R]),q=X.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),ue=X.useCallback(()=>I(k.getSnapshot()),[k,I]),de=$t(x,ue),fe=$t(A,ue),pe=X.useCallback(e=>{u.current=e},[]),me=X.useCallback(e=>{D.current=e,T.current=Wt(e?.parentElement??null)},[]),he=X.useCallback(()=>{L(),R(),H()},[H,L,R]),ge=X.useMemo(()=>({handleContentChange:se,handleResize:ce,observeVisibility:G,preserveScrollOnPrependRef:b,scrollToEnd:B,scrollToMessage:ae,scrollToStart:oe,setContentElement:pe,setRootElement:de,setSpacerElement:me,setViewportElement:fe,stateStore:k,syncAfterScroll:he,unobserveVisibility:K,userScrollIntent:q,viewportRef:A,visibilityStore:N}),[se,ce,G,B,ae,oe,pe,de,me,fe,k,he,K,q,N]);return X.useLayoutEffect(()=>{W()},[W]),X.useEffect(()=>()=>{O.current!==null&&(window.cancelAnimationFrame(O.current),O.current=null),j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),M.current?.disconnect(),M.current=null},[]),X.useLayoutEffect(()=>{if(e&&g.current===`following-bottom`&&p.current>0){B({behavior:`auto`});return}L()},[e,L,B]),{context:ge,registerMessage:le}}function tn(e){let t=X.useRef(e);return t.current=e,t}var nn=X.createContext(null),rn=X.createContext(null);function an(){let e=X.useContext(nn);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function on(){let e=X.useContext(rn);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function sn(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=an();return X.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function cn({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=en({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,Z.jsx)(nn.Provider,{value:o,children:(0,Z.jsx)(rn.Provider,{value:s,children:t})})}function ln({children:e,...t}){let{setRootElement:n}=an();return(0,Z.jsx)(`div`,{ref:n,...t,children:e})}function un({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=an();f.current=o;let _=X.useCallback(e=>{p(e),yt(s)?.(e)},[s,p]);function v(e){m(),r?.(e)}function y(e){h(),a?.(e)}function b(e){h(),i?.(e)}function x(e){Tt.has(e.key)&&h(),n?.(e)}return X.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,Z.jsx)(`div`,{ref:_,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:x,onScroll:v,onTouchMove:b,onWheel:y,...u,children:t})}function dn({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=an(),u=X.useRef(null),d=X.useCallback(e=>{u.current=e,c(e),yt(n)?.(e)},[n,c]);return X.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),X.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,Z.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,Z.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function fn({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=on(),a=X.useRef(null);return(0,Z.jsx)(`div`,{ref:X.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),yt(t)?.(n)},[e,t,i]),"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function pn({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=an(),d=tn(r),f=X.useCallback(e=>u.subscribe(e),[u]),p=X.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=X.useSyncExternalStore(f,p,p),h=X.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return mt({defaultTagName:`button`,props:ht({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,Z.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var mn={Provider:cn,Root:ln,Viewport:un,Content:dn,Item:fn,Button:pn};function hn(e){let t=(0,Y.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(mn.Provider,{...e}),t[0]=e,t[1]=n),n}function gn(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(mn.Root,{"data-slot":`message-scroller`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _n(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`size-full min-h-0 min-w-0 scrollbar-thin overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(mn.Viewport,{"data-slot":`message-scroller-viewport`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vn(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`flex h-max min-h-full flex-col gap-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(mn.Content,{"data-slot":`message-scroller-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yn(e){let t=(0,Y.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scrollAnchor:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?!1:i,o;t[4]===n?o=t[5]:(o=v(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(mn.Item,{"data-slot":`message-scroller-item`,scrollAnchor:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function bn(e){let t=(0,Y.c)(25),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({direction:o,className:r,children:n,render:a,variant:s,size:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?`end`:o,u=s===void 0?`secondary`:s,d=c===void 0?`icon-sm`:c,f;t[8]===r?f=t[9]:(f=v(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,r),t[8]=r,t[9]=f);let m;t[10]!==a||t[11]!==d||t[12]!==u?(m=a??(0,Z.jsx)(b,{variant:u,size:d}),t[10]=a,t[11]=d,t[12]=u,t[13]=m):m=t[13];let h;t[14]!==n||t[15]!==l?(h=n??(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(W,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:l===`end`?(0,Z.jsx)(p,{id:`EQXPXf`}):(0,Z.jsx)(p,{id:`b1FDss`})})]}),t[14]=n,t[15]=l,t[16]=h):h=t[16];let g;return t[17]!==l||t[18]!==i||t[19]!==d||t[20]!==f||t[21]!==m||t[22]!==h||t[23]!==u?(g=(0,Z.jsx)(mn.Button,{"data-slot":`message-scroller-button`,"data-direction":l,"data-variant":u,"data-size":d,direction:l,className:f,render:m,...i,children:h}),t[17]=l,t[18]=i,t[19]=d,t[20]=f,t[21]=m,t[22]=h,t[23]=u,t[24]=g):g=t[24],g}var xn=new Map,Sn=0;function Cn(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function wn(){let e=Cn();for(let[t,n]of xn)t((e-n)/1e3);if(xn.size===0){Sn=0;return}Sn=requestAnimationFrame(wn)}function Tn(e){return xn.set(e,Cn()),Sn===0&&typeof requestAnimationFrame==`function`&&(Sn=requestAnimationFrame(wn)),()=>{xn.delete(e),xn.size===0&&Sn!==0&&(cancelAnimationFrame(Sn),Sn=0)}}var Q=40,En=15,Dn=15,$=12.4,On={blobby:0,triangle:1,square:2,sparkle:3,pentagon:4,hexagon:5,dot:6,star5:7,clover:8,star6:9,scallop:10,comma:11,diamond:12,cloud:13},kn=`M15.34 2.91C15.96 2.77 16.69 2.65 17.33 2.63C17.97 2.62 18.72 2.71 19.36 2.84C20.00 2.97 20.79 3.10 21.33 3.44C21.88 3.79 22.38 4.46 22.75 5.01C23.12 5.56 23.42 6.30 23.66 6.89C23.90 7.49 24.06 8.18 24.26 8.73C24.45 9.28 24.66 9.84 24.89 10.34C25.12 10.84 25.39 11.36 25.68 11.85C25.97 12.34 26.46 12.87 26.71 13.41C26.96 13.94 27.12 14.61 27.26 15.21C27.39 15.80 27.54 16.52 27.55 17.14C27.56 17.76 27.43 18.47 27.30 19.09C27.16 19.71 26.99 20.43 26.72 21.01C26.46 21.58 26.05 22.20 25.64 22.69C25.22 23.17 24.65 23.63 24.15 24.02C23.66 24.41 23.09 24.82 22.55 25.14C22.02 25.45 21.39 25.74 20.84 25.99C20.28 26.25 19.65 26.52 19.08 26.70C18.50 26.89 17.83 27.05 17.23 27.15C16.63 27.26 15.95 27.34 15.34 27.37C14.73 27.39 14.03 27.40 13.42 27.33C12.81 27.26 12.12 27.10 11.54 26.92C10.95 26.73 10.30 26.47 9.75 26.18C9.20 25.90 8.62 25.51 8.11 25.15C7.61 24.80 7.06 24.37 6.60 23.94C6.15 23.52 5.68 23.00 5.28 22.52C4.89 22.03 4.47 21.45 4.13 20.92C3.79 20.38 3.41 19.75 3.16 19.16C2.91 18.57 2.68 17.86 2.56 17.23C2.45 16.60 2.42 15.85 2.45 15.21C2.48 14.56 2.60 13.83 2.76 13.22C2.93 12.60 3.18 11.91 3.47 11.35C3.77 10.80 4.24 10.23 4.63 9.75C5.01 9.27 5.45 8.74 5.89 8.34C6.34 7.95 6.93 7.61 7.40 7.27C7.88 6.94 8.38 6.57 8.83 6.25C9.29 5.93 9.79 5.56 10.27 5.25C10.75 4.95 11.29 4.61 11.81 4.33C12.32 4.05 12.92 3.74 13.49 3.52C14.05 3.29 14.73 3.05 15.34 2.91Z`,An=2.26,jn=`M76.4805 11.041C99.1124 7.04848 118.186 8.33731 134.31 14.4102C150.369 20.4588 164.177 31.5065 175.929 48.1846L176.446 48.9199C187.179 64.5695 195.653 90.2797 191.323 112.539C186.344 138.13 169.219 160.474 150.105 178.107C131.113 195.629 111.037 207.691 101.728 212.842C98.3779 214.693 93.3915 217.316 88.0508 217.316C85.74 217.316 83.6583 216.814 81.7607 215.855L81.3838 215.658C75.1451 212.251 73.9381 205.91 73.376 198.68L73.2705 197.222C72.953 192.5 72.5095 188.039 71.1416 184.247C69.5395 179.806 66.852 176.673 63.1406 174.227L63.1377 174.225C41.2846 159.832 21.8495 144.226 13.3828 121.439L13.3818 121.438L13.0146 120.427C5.46004 99.1404 7.95139 74.5467 20.4404 52.7568L20.4414 52.7549C33.2945 30.3176 54.4303 14.925 76.4785 11.041H76.4805Z`;function Mn(e){let t=t=>{let n=e[(t-1+Q)%Q],r=e[(t+1)%Q];return[(r[0]-n[0])*.16,(r[1]-n[1])*.16]},n=`M${e[0][0].toFixed(2)} ${e[0][1].toFixed(2)}`;for(let r=0;r<Q;r++){let i=e[r],a=e[(r+1)%Q],o=t(r),s=t((r+1)%Q);n+=`C${(i[0]+o[0]).toFixed(2)} ${(i[1]+o[1]).toFixed(2)} ${(a[0]-s[0]).toFixed(2)} ${(a[1]-s[1]).toFixed(2)} ${a[0].toFixed(2)} ${a[1].toFixed(2)}`}return`${n}Z`}function Nn(e,t){let n=e.map(e=>e[0]),r=e.map(e=>e[1]),i=Math.min(...n),a=Math.max(...n),o=Math.min(...r),s=Math.max(...r),c=t*2/Math.max(a-i,s-o);return e.map(e=>[En+(e[0]-(i+a)/2)*c,Dn+(e[1]-(o+s)/2)*c])}function Pn(e,t,n){let r=e;for(let e=0;e<t;e++){let e=r;r=e.map((t,r)=>{let i=e[(r-1+Q)%Q],a=e[(r+1)%Q];return[t[0]*(1-n)+(i[0]+a[0])/2*n,t[1]*(1-n)+(i[1]+a[1])/2*n]})}return r}function Fn(){if(typeof document>`u`)return null;let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`width`,`0`),e.setAttribute(`height`,`0`),e.style.position=`absolute`,e.style.visibility=`hidden`;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);if(e.appendChild(t),document.body.appendChild(e),typeof t.getTotalLength!=`function`||typeof t.getPointAtLength!=`function`)return e.remove(),null;try{t.setAttribute(`d`,`M0 0L1 0`),t.getPointAtLength(0)}catch{return e.remove(),null}return t}function In(e){function t(t,n){e.setAttribute(`d`,t);let r=e.getTotalLength(),i=[];for(let t=0;t<n;t++){let a=e.getPointAtLength(r*t/n);i.push([a.x,a.y])}return i}function n(e){let t=0,n=0;for(let r of e)t+=r[0],n+=r[1];t/=e.length,n/=e.length;let r=Array(Q).fill(0),i=Array(Q).fill(1/0);for(let a of e){let e=Math.atan2(a[1]-n,a[0]-t),o=Math.hypot(a[0]-t,a[1]-n),s=Math.round((e+Math.PI/2)/(2*Math.PI)*Q);s=(s%Q+Q)%Q,o>r[s]&&(r[s]=o),o<i[s]&&(i[s]=o)}return{cx:t,cy:n,hi:r,lo:i}}function r(e,t,n){return e.map((e,r)=>{let i=-Math.PI/2+r*2*Math.PI/Q;return[t+Math.cos(i)*e,n+Math.sin(i)*e]})}function i(e,i){let{cx:a,cy:o,hi:s,lo:c}=n(t(e,1080)),l=s.map((e,t)=>(e+c[t])/2),u=s.reduce((e,t,n)=>e+(t-c[n]),0)/Q,d=r(l,a,o),f=d.map(e=>e[0]),p=d.map(e=>e[1]),m=i*2/Math.max(Math.max(...f)-Math.min(...f),Math.max(...p)-Math.min(...p));return{path:Mn(Nn(d,i)),strokeWidth:u*m}}function a(e,i){let{cx:a,cy:o,hi:s}=n(t(e,1400));return Mn(Nn(r(s.map((e,t)=>s[t]*.86+(s[(t-1+Q)%Q]+s[(t+1)%Q])*.07),a,o),i))}function o(e,n){return Mn(Nn(t(e,Q),n))}function s(e,n,r){return Mn(Pn(t(e,Q),n,r))}function c(e,n,r){return Mn(t(e,Q).map(e=>[En+(e[0]-En)*n,Dn+(e[1]-Dn)*r]))}function l(e,n,r=1){return Mn(t(e,Q).map((e,t)=>{let i=t*2*Math.PI/Q,a=1+r*(.035*Math.sin(i*3+n)+.025*Math.sin(i*5+n*2)+.018*Math.sin(i*2-n));return[En+(e[0]-En)*a,Dn+(e[1]-Dn)*a]}))}function u(e,t,n,r=0){let i=[];for(let n=0;n<e;n++){let a=-Math.PI/2+n*2*Math.PI/e+r;i.push([En+Math.cos(a)*t,Dn+Math.sin(a)*t])}let a=(e,t)=>{let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r);return[n/i,r/i]},o=``;for(let t=0;t<e;t++){let r=i[t],s=a(r,i[(t-1+e)%e]),c=a(r,i[(t+1)%e]),l=[r[0]+s[0]*n,r[1]+s[1]*n],u=[r[0]+c[0]*n,r[1]+c[1]*n];o+=`${t?`L`:`M`}${l[0].toFixed(2)} ${l[1].toFixed(2)}A${n} ${n} 0 0 1 ${u[0].toFixed(2)} ${u[1].toFixed(2)}`}return`${o}Z`}function d(e,n,r,i){let a=``;for(let t=0;t<e*2;t++){let i=-Math.PI/2+t*Math.PI/e,o=t%2?r:n;a+=`${t?`L`:`M`}${(En+Math.cos(i)*o).toFixed(2)} ${(Dn+Math.sin(i)*o).toFixed(2)}`}return Mn(Nn(Pn(t(`${a}Z`,Q),i,.3),n))}function f(e,n,r){let i=t=>{let n=-Math.PI/2+t*Math.PI/2;return[En+Math.cos(n)*e,Dn+Math.sin(n)*e]},a=`M${i(0)[0].toFixed(2)} ${i(0)[1].toFixed(2)}`;for(let e=0;e<4;e++){let t=-Math.PI/2+(e+.5)*Math.PI/2,r=[En+Math.cos(t)*n,Dn+Math.sin(t)*n],o=i((e+1)%4);a+=`Q${r[0].toFixed(2)} ${r[1].toFixed(2)} ${o[0].toFixed(2)} ${o[1].toFixed(2)}`}return Mn(Nn(Pn(t(`${a}Z`,Q),r,.34),e))}function p(e,t,n,r){let i=[];for(let a=0;a<Q;a++){let o=-Math.PI/2+a*2*Math.PI/Q,s=(1+Math.cos(e*(o+Math.PI/2)))/2,c=n+(t-n)*s**r;i.push([En+Math.cos(o)*c,Dn+Math.sin(o)*c])}return Mn(i)}function m(e){let t=[];for(let n=0;n<Q;n++){let r=-Math.PI/2+n*2*Math.PI/Q;t.push([En+Math.cos(r)*e,Dn+Math.sin(r)*e])}return Mn(t)}return{silhouette:i,hull:a,fit:o,soften:s,squeeze:c,wobble:l,poly:u,star:d,sparkle:f,lobed:p,dot:m,circle:(e,t,n)=>`M${e-n} ${t}a${n} ${n} 0 1 0 ${n*2} 0a${n} ${n} 0 1 0 ${-n*2} 0`}}function Ln(){let e=Fn();if(e===null)return null;try{let t=In(e),n=t.silhouette(y,12.55);return{paths:[n.path,t.wobble(t.poly(3,$*1.16,$*.5,.1),1.1),t.wobble(t.poly(4,$*1.02,$*.44),2.3),t.wobble(t.sparkle($*1.24,$*.1,3),3.7),t.wobble(t.poly(5,$*1,$*.38),4.9),t.wobble(t.poly(6,$*.98,$*.34),6.2),t.wobble(t.dot($*.34),2.8),t.wobble(t.star(5,$*1.14,$*.68,6),7.4),t.wobble(t.soften(t.lobed(4,$*1.16,$*.46,.5),3,.3),8.1),t.wobble(t.star(6,$*1.2,$*.42,4),9.3),t.wobble(t.lobed(8,$*1.06,$*.74,.6),10.5),t.wobble(t.soften(t.fit(jn,$*1.12),3,.22),11.7,.3),t.wobble(t.squeeze(t.poly(4,$*1.3,$*.2),.84,1),12.9),t.wobble(t.hull(t.circle(10.2,16,4.3)+t.circle(15,12,5.5)+t.circle(20,15.4,4.4)+t.circle(15,17.4,5.2),12.4),13.6)],strokeWidth:n.strokeWidth}}finally{e.ownerSVGElement?.remove()}}var Rn;function zn(){return Rn===void 0&&(Rn=Ln()),Rn}var Bn=/-?\d+(?:\.\d+)?/g;function Vn(e){return{fragments:e[0].split(Bn),numbers:e.map(e=>(e.match(Bn)??[]).map(Number))}}function Hn(e,t){let n=``;for(let r=0;r<t.length;r++)n+=e[r]+t[r].toFixed(2);return n+e[t.length]}function Un(e){return e<.5?2*e*e:1-2*(1-e)**2}var Wn=.58;function Gn(e,t,n,r){let i=t-1,a=n/i,o=e%n,s=Math.max(0,Math.min(i-1,Math.floor(o/a))),c=o%a/a;return{from:s,to:s+1,t:Un(r?Math.min(1,c/Wn):c)}}var Kn=On,qn=[Kn.blobby,Kn.triangle,Kn.square,Kn.sparkle,Kn.comma,Kn.pentagon,Kn.hexagon,Kn.blobby],Jn={[Kn.comma]:-2.9},Yn={leftCx:10.9,rightCx:18.1,cy:16,rx:1.25,ry:1.9},Xn=20,Zn=8.4;function Qn(e){let t=(0,Y.c)(22),{status:n,className:r,testId:i}=e,{_:a}=m(),o=(0,X.useRef)(null),s=(0,X.useRef)(null),c=Me(),l,u;t[0]===c?(l=t[1],u=t[2]):(l=()=>{let e=o.current;if(e===null)return;if(c){e.setAttribute(`d`,kn),e.setAttribute(`stroke-width`,String(An)),s.current?.removeAttribute(`transform`);return}let t=zn();if(t===null)return;e.setAttribute(`stroke-width`,t.strokeWidth.toFixed(2));let n=Vn(t.paths),r=NaN,i=``;return Tn(t=>{let{from:a,to:o,t:c}=Gn(t,qn.length,Zn,!0),l=n.numbers[qn[a]],u=n.numbers[qn[o]],d=l.map((e,t)=>e+(u[t]-e)*c),f=Hn(n.fragments,d);f!==i&&(i=f,e.setAttribute(`d`,f));let p=s.current;if(p===null)return;let m=Jn[qn[a]]??0,h=m+((Jn[qn[o]]??0)-m)*c;h!==r&&(r=h,p.setAttribute(`transform`,`translate(0 ${h.toFixed(2)})`))})},u=[c],t[0]=c,t[1]=l,t[2]=u),(0,X.useEffect)(l,u);let[d,f]=(0,X.useState)(``),p,h;t[3]===a?(p=t[4],h=t[5]):(p=()=>{f(a({id:`DCSSZt`}))},h=[a],t[3]=a,t[4]=p,t[5]=h),(0,X.useEffect)(p,h);let g;t[6]===r?g=t[7]:(g=v(`ok-working-enter flex items-center gap-2`,r),t[6]=r,t[7]=g);let _;t[8]===d?_=t[9]:(_=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,role:`status`,children:d}),t[8]=d,t[9]=_);let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`path`,{ref:o,d:kn,fill:`none`,stroke:`currentColor`,strokeWidth:An,strokeLinejoin:`round`,strokeLinecap:`round`}),t[10]=y):y=t[10];let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(`span`,{className:`grid shrink-0 place-items-center text-muted-foreground/80`,children:(0,Z.jsx)(`svg`,{width:Xn,height:Xn,viewBox:`0 0 30 30`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`ok-working-pop ok-working-squint block shrink-0 overflow-visible`,children:(0,Z.jsxs)(`g`,{className:`ok-working-group`,children:[y,(0,Z.jsxs)(`g`,{ref:s,children:[(0,Z.jsx)(`ellipse`,{className:`ok-working-eye`,cx:Yn.leftCx,cy:Yn.cy,rx:Yn.rx,ry:Yn.ry,fill:`currentColor`}),(0,Z.jsx)(`ellipse`,{className:`ok-working-eye`,cx:Yn.rightCx,cy:Yn.cy,rx:Yn.rx,ry:Yn.ry,fill:`currentColor`})]})]})})}),t[11]=b):b=t[11];let x;t[12]===n?x=t[13]:(x=(0,Z.jsx)(`span`,{className:`shimmer`,children:n}),t[12]=n,t[13]=x);let S;t[14]!==n||t[15]!==x?(S=(0,Z.jsx)(`span`,{className:`ok-working-status text-sm`,children:x},n),t[14]=n,t[15]=x,t[16]=S):S=t[16];let C;return t[17]!==S||t[18]!==g||t[19]!==_||t[20]!==i?(C=(0,Z.jsxs)(`div`,{className:g,"data-testid":i,children:[_,b,S]}),t[17]=S,t[18]=g,t[19]=_,t[20]=i,t[21]=C):C=t[21],C}function $n(e){let t=[];for(let n of e.options)`value`in n?t.push(n):t.push(...n.options);return t}function er(e){let t=$n(e),n=t.find(t=>t.value===e.currentValue);if(n===void 0||n.value!==`default`||!n.description)return null;let r=t.find(e=>e.value!==n.value&&e.description===n.description);return r===void 0?null:B._({id:`GK5Ft_`,values:{0:r.name}})}function tr(e,t,n){return e===`claude-acp`&&t===`effort`&&n===`default`?B._({id:`3SWNP8`}):e===`codex-acp`&&t===`collaboration_mode`&&n===`default`?B._({id:`R6ABfU`}):null}var nr=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),rr=700*1024;function ir(e){if(e.kind===`unsupported-type`)return e.mimeType.startsWith(`image/`)?`Only PNG, JPEG, GIF, and WebP images are supported (got ${e.mimeType}).`:`Unsupported file type: ${e.mimeType||`unknown`}.`;if(e.kind===`outside-workspace`)return`${e.name} is outside the workspace. Move it into your project first.`;if(e.kind===`unknown-path`)return`${e.name} has no resolvable path — the agent can only read files inside the workspace.`;let t=(e.limitBytes/(1024*1024)).toFixed(1);return`File is too large (${(e.sizeBytes/(1024*1024)).toFixed(1)} MB) — max ${t} MB per attachment.`}async function ar(e){let t=await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`FileReader failed`)),r.onload=()=>{let e=r.result;if(typeof e!=`string`){n(Error(`FileReader returned non-string result`));return}t(e)},r.readAsDataURL(e)}),n=t.indexOf(`,`);return{data:n>=0?t.slice(n+1):t,mimeType:e.type||`application/octet-stream`,name:e.name||`image`,sizeBytes:e.size}}async function or(e){let t=e.type||``;if(!nr.has(t))return{ok:!1,error:{kind:`unsupported-type`,mimeType:t}};if(e.size>716800)return{ok:!1,error:{kind:`too-large`,sizeBytes:e.size,limitBytes:rr}};let n=await ar(e);return{ok:!0,part:{kind:`image`,data:n.data,mimeType:n.mimeType,name:n.name,sizeBytes:n.sizeBytes}}}function sr(e){return lr(e,e=>e.type.startsWith(`image/`))}function cr(e){return lr(e,e=>e.size>0)}function lr(e,t){if(e===null)return[];let n=new Set,r=[],i=e=>{if(e===null||!t(e))return;let i=`${e.name}|${e.size}|${e.lastModified??0}`;n.has(i)||(n.add(i),r.push(e))},a=e.items;if(a)for(let e=0;e<a.length;e+=1){let t=a[e];t&&t.kind===`file`&&i(t.getAsFile())}let o=e.files;if(o)for(let e=0;e<o.length;e+=1)i(o[e]??null);return r}function ur(e,t,n){let r=n===`\\`?e.toLowerCase():e,i=n===`\\`?t.toLowerCase():t,a=i.endsWith(n)?i:`${i}${n}`;if(r===i)return``;if(!r.startsWith(a))return null;let o=e.slice(a.length);return n===`\\`?o.replaceAll(`\\`,`/`):o}async function dr(e,t={}){if((e.type||``).startsWith(`image/`))return or(e);let n=t.absPathOf,r=t.workspaceContentDir,i=t.pathSeparator??`/`,a=e.name||`attachment`;if(n===void 0||r===void 0||r===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let o=n(e);if(o===null||o===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let s=ur(o,r,i);return s===null?{ok:!1,error:{kind:`outside-workspace`,name:a}}:{ok:!0,part:{kind:`file`,path:s,name:a}}}var fr=3,pr=fr*2+2;function mr(e){let t=e.split(`
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{An as r,En as i,Ln as a,On as o,Sn as s,a as c,kn as l,tr as u,vr as d}from"./DocumentContext-D_2wOhha.js";import{t as f}from"./react-f2sANaYj.js";import{n as p,r as m}from"./dist-Nvb76hAm.js";import{t as h}from"./compiler-runtime-BfE3aGVn.js";import{c as g,l as _}from"./local-menu-action-bus-Cypryz6Z.js";import{t as v}from"./utils-CPqDy6Hr.js";import{t as y}from"./mascot-outline-CtS592mc.js";import{t as b}from"./button-CA0dewJJ.js";import{i as x,n as S,t as C}from"./tooltip-DHXgxWLL.js";import{c as w,i as T,t as E}from"./dialog-HdfR4WGm.js";import{ot as D}from"./CodeMirrorPropInput-kYmUy2HP.js";import{t as O}from"./checkbox-hfBCQ901.js";import{a as k,c as A,d as j,f as M,l as N,m as P,n as F,o as ee,p as I,r as te,t as L}from"./dropdown-menu-CLgDYkh1.js";import{t as ne}from"./progress-BdSO2c_8.js";import{n as R}from"./separator-vdmCepR4.js";import{t as re}from"./switch-B2sF5R0q.js";import{lt as ie,zr as z}from"./dist-C771h__g.js";import{t as B}from"./dist-DUfEoSbR.js";import{n as ae}from"./dist-B6jB2qbD2.js";import{i as oe,t as V}from"./history-B1SZDFzE.js";import{t as H}from"./use-workspace-DeC16-uw.js";import{t as U}from"./createLucideIcon-Bhw2PmPp.js";import{l as W,o as se}from"./Mermaid-ukCAxO5k.js";import{t as ce}from"./RegisteredAgentIcon-CP1iDML-.js";import{t as G}from"./check-CGfmW4da.js";import{t as K}from"./chevron-down-DabHDQTe.js";import{t as le}from"./chevron-right-Diamp-K_.js";import{o as q,r as ue,s as de}from"./prop-types-DQ8_DMD-.js";import{t as fe}from"./download-Dn5ulvxm.js";import{t as pe}from"./list-plus-CT84Vd_h.js";import{t as me}from"./spinner-BxJv3FRl.js";import{c as he,n as ge,o as J,s as _e,t as ve}from"./comment-chips-CQFlHEHc.js";import{a as ye,b as be,c as xe,d as Se,f as Ce,i as we,l as Te,n as Ee,o as De,p as Oe,r as ke,s as Ae,t as je,u as Me,v as Ne,y as Pe}from"./follow-file-DdxR5CX9.js";import{t as Fe}from"./square-pen-NShYDQ74.js";import{t as Ie}from"./terminal-DbJygh5J.js";import{t as Le}from"./trash-2-Co21mefL.js";import{t as Re}from"./wrench-Pum_Z20m.js";import{t as ze}from"./x-DddVxTPq.js";import{f as Be,s as Ve}from"./doc-paths-D-8nN6rk.js";import{t as He}from"./badge-I_vhU4ix.js";import{t as Ue}from"./skeleton-D4wPMdlV.js";import{t as We}from"./textarea-dRxJ8TN6.js";import{n as Ge}from"./agent-presence-DGcZkmSh.js";import{i as Ke,n as qe}from"./chunk-BO2N2NFS-BG8bvliu.js";import{n as Je}from"./libesm-Bf6KoNgP.js";import{a as Ye,d as Xe,f as Ze,n as Qe,p as $e,r as et,s as tt,u as nt}from"./thread-client-CvSFIaay.js";import{n as rt}from"./thread-draft-staging-D5ZThmoH.js";var it=U(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),at=U(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),ot=U(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),st=U(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Y=h(),ct=new RegExp([`bypass`,`acceptedits`,`fullaccess`,`autoedit`,`yolo`,`danger`,`fullauto`,`autoaccept`,`autoapprove`,`autorun`,`skippermission`,`noconfirm`,`noprompt`,`unrestricted`,`allowall`].join(`|`)),lt=new Set([`auto`]);function ut(e){return e.toLowerCase().replace(/[^a-z]/g,``)}function dt(e){let t=ut(e.id),n=ut(e.name??``);return lt.has(t)||lt.has(n)?!0:ct.test(t)||ct.test(n)}var ft={"claude-acp":`asks`,"codex-acp":`self-managed`,cursor:`self-managed`,"pi-acp":`autonomous`};function pt(e,t,n){let r=n??(t==null?null:t.availableModes.find(e=>e.id===t.currentModeId)??null),i=ft[e];return i===void 0?t!=null&&t.availableModes.length>0?`self-managed`:`unknown`:i===`asks`&&r!==null&&dt(r)?`self-managed`:i}var X=e(f(),1),Z=n();function mt({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=ht(gt(r,i),t);if(!n)return X.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!X.isValidElement(n))return null;let o=n.props,s={...ht(a,o),ref:yt(a.ref,o.ref)};return X.cloneElement(n,s)}function ht(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];n===`className`?t[n]=[i,r].filter(Boolean).join(` `):n===`style`?t[n]={...i,...r}:n===`ref`?t[n]=yt(i,r):vt(n)&&typeof i==`function`&&typeof r==`function`?t[n]=_t(r,i):t[n]=r}}return t}function gt(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function _t(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function vt(e){return/^on[A-Z]/.test(e)}function yt(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var bt=8,xt=64,St=0,Ct=.5,wt=180,Tt=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),Et={start:!1,end:!1},Dt={currentAnchorId:null,visibleMessageIds:[]};function Ot({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return Et;let i=Bt({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function kt({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return Dt;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of At(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+Ct&&(u=e)}return l.length===0&&u===null?Dt:{currentAnchorId:u,visibleMessageIds:l}}function At(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function jt(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function Mt(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function Nt(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function Pt(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function Ft({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of At(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function It({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=Lt(t,i),o=t.getBoundingClientRect().height,s=Ut(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function Lt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Rt(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function zt({content:e,scrollTop:t,spacer:n,viewport:r}){let i=Bt({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function Bt({content:e,spacer:t,viewport:n}){let r=At(e,t),i=Ht(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function Vt(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Ht(e){let t=window.getComputedStyle(e);return{end:Gt(t.paddingBlockEnd||t.paddingBottom),start:Gt(t.paddingBlockStart||t.paddingTop)}}function Ut(e){let t=e?.parentElement;return t?Ht(t):{end:0,start:0}}function Wt(e){if(!e)return 0;let t=window.getComputedStyle(e);return Gt(t.rowGap===`normal`?t.gap:t.rowGap)}function Gt(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Kt({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,defaultScrollPositionAppliedRef:l,itemCountRef:u,messageElementsRef:d,modeRef:f,pendingScrollToMessageRef:p,prependRestoreRef:m,scrollMarginRef:h,scrollPreviousItemPeekRef:g,spacerGapRef:_,spacerHeightRef:v,spacerRef:y,viewportRef:b}=e,x=X.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},wt))},[t]),S=X.useCallback(e=>{let t=y.current;if(!t)return;let n=Math.max(0,Math.ceil(e));v.current!==n&&(v.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-_.current}px`:``)},[]),C=X.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=b.current;if(!a)return;let o=Math.max(0,e);if(Math.abs(a.scrollTop-o)<=Ct){a.scrollTop=o,t();return}i&&x(!0),a.scrollTo({top:o,behavior:r}),n()},[t,n,x]),w=X.useCallback(({behavior:e=`auto`}={})=>b.current?(S(0),i.current=null,f.current=`free-scrolling`,C(0,{behavior:e}),r(),!0):!1,[r,C,S]),T=X.useCallback(({behavior:e=`auto`}={})=>{let t=b.current;return t?(S(0),i.current=null,f.current=a.current?`following-bottom`:`free-scrolling`,C(Vt(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,C,S]),E=X.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=h.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=b.current;if(!s||!l||!s.contains(e))return!1;let u=It({align:t,element:e,scrollMargin:o?a+g.current:a,spacer:y.current,viewport:l});return S(zt({content:s,scrollTop:u,spacer:y.current,viewport:l})),m.current={element:e,viewportTop:Rt(e,l)},f.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,C(u,{behavior:n}),r(),!0},[r,C,S]),D=X.useCallback(()=>{let e=i.current;return!e||!e.isConnected||f.current!==`anchored-to-message`?!1:E(e,{align:`start`},{keepPreviousPeek:!0})},[E]),O=X.useCallback((e,t)=>{let n=d.current.get(e);return n?(l.current=!0,E(n,t)?(p.current=null,!0):(p.current={messageId:e,options:t},!0)):u.current===0?(p.current={messageId:e,options:t},l.current=!0,!0):!1},[E]);return{flushPendingScrollToMessage:X.useCallback(()=>{let e=p.current;if(!e)return!1;let t=d.current.get(e.messageId);return!t||!E(t,e.options)?!1:(p.current=null,l.current=!0,!0)},[E]),reanchorToAnchoredMessage:D,scrollToElement:E,scrollToEnd:T,scrollToMessage:O,scrollToStart:w}}function qt(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function Jt(e,t){return qt(e,t)}function Yt(){return qt(Dt,Zt)}function Xt(e,t){return e.start===t.start&&e.end===t.end}function Zt(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function Qt({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let i=X.useRef(e),a=X.useRef(!1),o=X.useRef(null),s=X.useRef(!1),c=X.useRef(t),l=X.useRef(0),u=X.useRef(null),d=X.useRef(0),f=X.useRef(e?`following-bottom`:`free-scrolling`),p=X.useRef(new Map),m=X.useRef(null),h=X.useRef(null),g=X.useRef(null),_=X.useRef(r),v=X.useRef(!0),y=X.useRef(null),b=X.useRef(n),x=X.useRef(null),S=X.useRef(0),C=X.useRef(0),w=X.useRef(null),T=X.useRef(null),E=X.useRef(null),D=X.useRef(null),O=X.useRef(null),k=X.useRef(null),A=X.useRef(null),j=X.useRef(null),M=X.useRef(new Set),N=X.useRef(new WeakSet);return E.current===null&&(E.current=Jt(Et,Xt)),j.current===null&&(j.current=Yt()),i.current=e,c.current=t,b.current=n,_.current=r,{autoScrollRef:i,autoscrollingRef:a,autoscrollingTimeoutRef:D,streamingTurnRef:g,contentRef:o,defaultScrollPositionAppliedRef:s,firstItemRef:u,itemCountRef:l,lastScrollTopRef:d,messageElementsRef:p,modeRef:f,pendingScrollFrameRef:x,pendingScrollToMessageRef:m,prependRestoreRef:h,preserveScrollOnPrependRef:v,rootRef:y,scrollEdgeThresholdRef:c,scrollMarginRef:b,scrollPreviousItemPeekRef:_,spacerGapRef:S,spacerHeightRef:C,spacerRef:w,stateFrameRef:T,stateStore:E.current,viewportRef:O,visibilityFrameRef:k,visibilityObserverRef:A,visibilityStore:j.current,visibleMessageIdsRef:M,handledScrollAnchorsRef:N}}function $t(e,t){return X.useCallback(n=>{e.current=n,n&&t()},[e,t])}function en({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=bt,scrollPreviousItemPeek:r=xt,scrollMargin:i=St}){let a=Qt({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:v,prependRestoreRef:y,preserveScrollOnPrependRef:b,rootRef:x,scrollEdgeThresholdRef:S,scrollMarginRef:C,scrollPreviousItemPeekRef:w,spacerGapRef:T,spacerHeightRef:E,spacerRef:D,stateFrameRef:O,stateStore:k,viewportRef:A,visibilityFrameRef:j,visibilityObserverRef:M,visibilityStore:N,visibleMessageIdsRef:P,handledScrollAnchorsRef:F}=a,ee=X.useRef(t);ee.current!==t&&(ee.current=t,d.current=!1);let I=X.useCallback(e=>{let t=x.current,n=A.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),te=X.useCallback(e=>{let t=A.current?.scrollTop??0,n=t<m.current-Ct;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),L=X.useCallback(()=>{let e=Ot({content:u.current,scrollEdgeThreshold:S.current,spacer:D.current,viewport:A.current});te(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;I(t),k.setSnapshot(t)},[te,k,I]),ne=X.useCallback(()=>{O.current===null&&(O.current=window.requestAnimationFrame(()=>{O.current=null,L()}))},[L]),R=X.useCallback(()=>{N.hasListeners()&&j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null,N.hasListeners()&&N.setSnapshot(kt({content:u.current,scrollMargin:C.current,scrollPreviousItemPeek:w.current,spacer:D.current,viewport:A.current,visibleMessageIds:P.current}))}))},[N]),{flushPendingScrollToMessage:re,reanchorToAnchoredMessage:ie,scrollToElement:z,scrollToEnd:B,scrollToMessage:ae,scrollToStart:oe}=Kt({refs:a,commitScrollState:L,scheduleStateCommit:ne,scheduleVisibilitySync:R}),V=X.useCallback(()=>{let e=y.current,t=A.current;if(!e||!t||!e.element.isConnected)return!1;let n=Rt(e.element,t)-e.viewportTop;return Math.abs(n)<=Ct?!1:(t.scrollTop+=n,e.viewportTop=Rt(e.element,t),ne(),R(),!0)},[ne,R]),H=X.useCallback(()=>{let e=u.current,t=A.current;if(!e||!t){y.current=null;return}let n=Ft({content:e,spacer:D.current,viewport:t});y.current=n?{element:n,viewportTop:Rt(n,t)}:null},[]),U=X.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,re()&&H()}))},[H,re]),W=X.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=A.current,r=t&&n?Pt(At(t,D.current)):null;if(!t||!n||!r)e=B({behavior:`auto`});else{let i=Lt(r,n);e=Bt({content:t,spacer:D.current,viewport:n})-i<=n.clientHeight?B({behavior:`auto`}):z(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?B({behavior:`auto`}):oe({behavior:`auto`});return e?(d.current=!0,!0):!1},[t,z,B,oe]),se=X.useCallback(()=>{let e=u.current;if(!e)return;let t=At(e,D.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(re())return;if(n===0){if(W()||t.length>0&&s.current&&B({behavior:`auto`}))return;L(),R();return}let e=r?t.indexOf(r):-1;if(b.current&&e>0){V();return}if(t.length>n){let e=jt(t,n);if(e){if(s.current&&g.current===`following-bottom`&&Nt(t,n)){B({behavior:`auto`});return}z(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}if(t.length===n){let e=Mt(t,F.current);if(e){z(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}g.current===`following-bottom`&&s.current?B({behavior:`auto`}):(L(),R())})(),H()},[W,H,L,re,V,R,z,B]),ce=X.useCallback(()=>{if(g.current===`following-bottom`&&s.current){B({behavior:`auto`});return}let e=E.current;if(ie()){s.current&&e>0&&E.current===0&&B({behavior:`auto`});return}ne(),R()},[ie,ne,R,B]),G=X.useCallback(()=>{let e=A.current;if(!(!e||!N.hasListeners())){if(typeof IntersectionObserver>`u`){R();return}M.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?P.current.add(e):P.current.delete(e))}R()},{root:e,rootMargin:`${-(C.current+w.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{M.current?.observe(e)}),R()}},[R,N]),K=X.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),M.current?.disconnect(),M.current=null,P.current.clear(),N.setSnapshot(Dt)},[N]),le=X.useCallback((e,t,n)=>{if(t){h.current.set(e,t),M.current?.observe(t),R(),v.current?.messageId===e&&U();return}n&&h.current.get(e)===n&&(h.current.delete(e),P.current.delete(e),M.current?.unobserve(n),R())},[U,R]),q=X.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),ue=X.useCallback(()=>I(k.getSnapshot()),[k,I]),de=$t(x,ue),fe=$t(A,ue),pe=X.useCallback(e=>{u.current=e},[]),me=X.useCallback(e=>{D.current=e,T.current=Wt(e?.parentElement??null)},[]),he=X.useCallback(()=>{L(),R(),H()},[H,L,R]),ge=X.useMemo(()=>({handleContentChange:se,handleResize:ce,observeVisibility:G,preserveScrollOnPrependRef:b,scrollToEnd:B,scrollToMessage:ae,scrollToStart:oe,setContentElement:pe,setRootElement:de,setSpacerElement:me,setViewportElement:fe,stateStore:k,syncAfterScroll:he,unobserveVisibility:K,userScrollIntent:q,viewportRef:A,visibilityStore:N}),[se,ce,G,B,ae,oe,pe,de,me,fe,k,he,K,q,N]);return X.useLayoutEffect(()=>{W()},[W]),X.useEffect(()=>()=>{O.current!==null&&(window.cancelAnimationFrame(O.current),O.current=null),j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),M.current?.disconnect(),M.current=null},[]),X.useLayoutEffect(()=>{if(e&&g.current===`following-bottom`&&p.current>0){B({behavior:`auto`});return}L()},[e,L,B]),{context:ge,registerMessage:le}}function tn(e){let t=X.useRef(e);return t.current=e,t}var nn=X.createContext(null),rn=X.createContext(null);function an(){let e=X.useContext(nn);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function on(){let e=X.useContext(rn);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function sn(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=an();return X.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function cn({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=en({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,Z.jsx)(nn.Provider,{value:o,children:(0,Z.jsx)(rn.Provider,{value:s,children:t})})}function ln({children:e,...t}){let{setRootElement:n}=an();return(0,Z.jsx)(`div`,{ref:n,...t,children:e})}function un({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=an();f.current=o;let _=X.useCallback(e=>{p(e),yt(s)?.(e)},[s,p]);function v(e){m(),r?.(e)}function y(e){h(),a?.(e)}function b(e){h(),i?.(e)}function x(e){Tt.has(e.key)&&h(),n?.(e)}return X.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,Z.jsx)(`div`,{ref:_,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:x,onScroll:v,onTouchMove:b,onWheel:y,...u,children:t})}function dn({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=an(),u=X.useRef(null),d=X.useCallback(e=>{u.current=e,c(e),yt(n)?.(e)},[n,c]);return X.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),X.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,Z.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,Z.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function fn({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=on(),a=X.useRef(null);return(0,Z.jsx)(`div`,{ref:X.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),yt(t)?.(n)},[e,t,i]),"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function pn({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=an(),d=tn(r),f=X.useCallback(e=>u.subscribe(e),[u]),p=X.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=X.useSyncExternalStore(f,p,p),h=X.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return mt({defaultTagName:`button`,props:ht({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,Z.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var mn={Provider:cn,Root:ln,Viewport:un,Content:dn,Item:fn,Button:pn};function hn(e){let t=(0,Y.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(mn.Provider,{...e}),t[0]=e,t[1]=n),n}function gn(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(mn.Root,{"data-slot":`message-scroller`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _n(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`size-full min-h-0 min-w-0 scrollbar-thin overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(mn.Viewport,{"data-slot":`message-scroller-viewport`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vn(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`flex h-max min-h-full flex-col gap-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(mn.Content,{"data-slot":`message-scroller-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yn(e){let t=(0,Y.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scrollAnchor:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?!1:i,o;t[4]===n?o=t[5]:(o=v(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(mn.Item,{"data-slot":`message-scroller-item`,scrollAnchor:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function bn(e){let t=(0,Y.c)(25),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({direction:o,className:r,children:n,render:a,variant:s,size:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?`end`:o,u=s===void 0?`secondary`:s,d=c===void 0?`icon-sm`:c,f;t[8]===r?f=t[9]:(f=v(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,r),t[8]=r,t[9]=f);let m;t[10]!==a||t[11]!==d||t[12]!==u?(m=a??(0,Z.jsx)(b,{variant:u,size:d}),t[10]=a,t[11]=d,t[12]=u,t[13]=m):m=t[13];let h;t[14]!==n||t[15]!==l?(h=n??(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(W,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:l===`end`?(0,Z.jsx)(p,{id:`EQXPXf`}):(0,Z.jsx)(p,{id:`b1FDss`})})]}),t[14]=n,t[15]=l,t[16]=h):h=t[16];let g;return t[17]!==l||t[18]!==i||t[19]!==d||t[20]!==f||t[21]!==m||t[22]!==h||t[23]!==u?(g=(0,Z.jsx)(mn.Button,{"data-slot":`message-scroller-button`,"data-direction":l,"data-variant":u,"data-size":d,direction:l,className:f,render:m,...i,children:h}),t[17]=l,t[18]=i,t[19]=d,t[20]=f,t[21]=m,t[22]=h,t[23]=u,t[24]=g):g=t[24],g}var xn=new Map,Sn=0;function Cn(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function wn(){let e=Cn();for(let[t,n]of xn)t((e-n)/1e3);if(xn.size===0){Sn=0;return}Sn=requestAnimationFrame(wn)}function Tn(e){return xn.set(e,Cn()),Sn===0&&typeof requestAnimationFrame==`function`&&(Sn=requestAnimationFrame(wn)),()=>{xn.delete(e),xn.size===0&&Sn!==0&&(cancelAnimationFrame(Sn),Sn=0)}}var Q=40,En=15,Dn=15,$=12.4,On={blobby:0,triangle:1,square:2,sparkle:3,pentagon:4,hexagon:5,dot:6,star5:7,clover:8,star6:9,scallop:10,comma:11,diamond:12,cloud:13},kn=`M15.34 2.91C15.96 2.77 16.69 2.65 17.33 2.63C17.97 2.62 18.72 2.71 19.36 2.84C20.00 2.97 20.79 3.10 21.33 3.44C21.88 3.79 22.38 4.46 22.75 5.01C23.12 5.56 23.42 6.30 23.66 6.89C23.90 7.49 24.06 8.18 24.26 8.73C24.45 9.28 24.66 9.84 24.89 10.34C25.12 10.84 25.39 11.36 25.68 11.85C25.97 12.34 26.46 12.87 26.71 13.41C26.96 13.94 27.12 14.61 27.26 15.21C27.39 15.80 27.54 16.52 27.55 17.14C27.56 17.76 27.43 18.47 27.30 19.09C27.16 19.71 26.99 20.43 26.72 21.01C26.46 21.58 26.05 22.20 25.64 22.69C25.22 23.17 24.65 23.63 24.15 24.02C23.66 24.41 23.09 24.82 22.55 25.14C22.02 25.45 21.39 25.74 20.84 25.99C20.28 26.25 19.65 26.52 19.08 26.70C18.50 26.89 17.83 27.05 17.23 27.15C16.63 27.26 15.95 27.34 15.34 27.37C14.73 27.39 14.03 27.40 13.42 27.33C12.81 27.26 12.12 27.10 11.54 26.92C10.95 26.73 10.30 26.47 9.75 26.18C9.20 25.90 8.62 25.51 8.11 25.15C7.61 24.80 7.06 24.37 6.60 23.94C6.15 23.52 5.68 23.00 5.28 22.52C4.89 22.03 4.47 21.45 4.13 20.92C3.79 20.38 3.41 19.75 3.16 19.16C2.91 18.57 2.68 17.86 2.56 17.23C2.45 16.60 2.42 15.85 2.45 15.21C2.48 14.56 2.60 13.83 2.76 13.22C2.93 12.60 3.18 11.91 3.47 11.35C3.77 10.80 4.24 10.23 4.63 9.75C5.01 9.27 5.45 8.74 5.89 8.34C6.34 7.95 6.93 7.61 7.40 7.27C7.88 6.94 8.38 6.57 8.83 6.25C9.29 5.93 9.79 5.56 10.27 5.25C10.75 4.95 11.29 4.61 11.81 4.33C12.32 4.05 12.92 3.74 13.49 3.52C14.05 3.29 14.73 3.05 15.34 2.91Z`,An=2.26,jn=`M76.4805 11.041C99.1124 7.04848 118.186 8.33731 134.31 14.4102C150.369 20.4588 164.177 31.5065 175.929 48.1846L176.446 48.9199C187.179 64.5695 195.653 90.2797 191.323 112.539C186.344 138.13 169.219 160.474 150.105 178.107C131.113 195.629 111.037 207.691 101.728 212.842C98.3779 214.693 93.3915 217.316 88.0508 217.316C85.74 217.316 83.6583 216.814 81.7607 215.855L81.3838 215.658C75.1451 212.251 73.9381 205.91 73.376 198.68L73.2705 197.222C72.953 192.5 72.5095 188.039 71.1416 184.247C69.5395 179.806 66.852 176.673 63.1406 174.227L63.1377 174.225C41.2846 159.832 21.8495 144.226 13.3828 121.439L13.3818 121.438L13.0146 120.427C5.46004 99.1404 7.95139 74.5467 20.4404 52.7568L20.4414 52.7549C33.2945 30.3176 54.4303 14.925 76.4785 11.041H76.4805Z`;function Mn(e){let t=t=>{let n=e[(t-1+Q)%Q],r=e[(t+1)%Q];return[(r[0]-n[0])*.16,(r[1]-n[1])*.16]},n=`M${e[0][0].toFixed(2)} ${e[0][1].toFixed(2)}`;for(let r=0;r<Q;r++){let i=e[r],a=e[(r+1)%Q],o=t(r),s=t((r+1)%Q);n+=`C${(i[0]+o[0]).toFixed(2)} ${(i[1]+o[1]).toFixed(2)} ${(a[0]-s[0]).toFixed(2)} ${(a[1]-s[1]).toFixed(2)} ${a[0].toFixed(2)} ${a[1].toFixed(2)}`}return`${n}Z`}function Nn(e,t){let n=e.map(e=>e[0]),r=e.map(e=>e[1]),i=Math.min(...n),a=Math.max(...n),o=Math.min(...r),s=Math.max(...r),c=t*2/Math.max(a-i,s-o);return e.map(e=>[En+(e[0]-(i+a)/2)*c,Dn+(e[1]-(o+s)/2)*c])}function Pn(e,t,n){let r=e;for(let e=0;e<t;e++){let e=r;r=e.map((t,r)=>{let i=e[(r-1+Q)%Q],a=e[(r+1)%Q];return[t[0]*(1-n)+(i[0]+a[0])/2*n,t[1]*(1-n)+(i[1]+a[1])/2*n]})}return r}function Fn(){if(typeof document>`u`)return null;let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`width`,`0`),e.setAttribute(`height`,`0`),e.style.position=`absolute`,e.style.visibility=`hidden`;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);if(e.appendChild(t),document.body.appendChild(e),typeof t.getTotalLength!=`function`||typeof t.getPointAtLength!=`function`)return e.remove(),null;try{t.setAttribute(`d`,`M0 0L1 0`),t.getPointAtLength(0)}catch{return e.remove(),null}return t}function In(e){function t(t,n){e.setAttribute(`d`,t);let r=e.getTotalLength(),i=[];for(let t=0;t<n;t++){let a=e.getPointAtLength(r*t/n);i.push([a.x,a.y])}return i}function n(e){let t=0,n=0;for(let r of e)t+=r[0],n+=r[1];t/=e.length,n/=e.length;let r=Array(Q).fill(0),i=Array(Q).fill(1/0);for(let a of e){let e=Math.atan2(a[1]-n,a[0]-t),o=Math.hypot(a[0]-t,a[1]-n),s=Math.round((e+Math.PI/2)/(2*Math.PI)*Q);s=(s%Q+Q)%Q,o>r[s]&&(r[s]=o),o<i[s]&&(i[s]=o)}return{cx:t,cy:n,hi:r,lo:i}}function r(e,t,n){return e.map((e,r)=>{let i=-Math.PI/2+r*2*Math.PI/Q;return[t+Math.cos(i)*e,n+Math.sin(i)*e]})}function i(e,i){let{cx:a,cy:o,hi:s,lo:c}=n(t(e,1080)),l=s.map((e,t)=>(e+c[t])/2),u=s.reduce((e,t,n)=>e+(t-c[n]),0)/Q,d=r(l,a,o),f=d.map(e=>e[0]),p=d.map(e=>e[1]),m=i*2/Math.max(Math.max(...f)-Math.min(...f),Math.max(...p)-Math.min(...p));return{path:Mn(Nn(d,i)),strokeWidth:u*m}}function a(e,i){let{cx:a,cy:o,hi:s}=n(t(e,1400));return Mn(Nn(r(s.map((e,t)=>s[t]*.86+(s[(t-1+Q)%Q]+s[(t+1)%Q])*.07),a,o),i))}function o(e,n){return Mn(Nn(t(e,Q),n))}function s(e,n,r){return Mn(Pn(t(e,Q),n,r))}function c(e,n,r){return Mn(t(e,Q).map(e=>[En+(e[0]-En)*n,Dn+(e[1]-Dn)*r]))}function l(e,n,r=1){return Mn(t(e,Q).map((e,t)=>{let i=t*2*Math.PI/Q,a=1+r*(.035*Math.sin(i*3+n)+.025*Math.sin(i*5+n*2)+.018*Math.sin(i*2-n));return[En+(e[0]-En)*a,Dn+(e[1]-Dn)*a]}))}function u(e,t,n,r=0){let i=[];for(let n=0;n<e;n++){let a=-Math.PI/2+n*2*Math.PI/e+r;i.push([En+Math.cos(a)*t,Dn+Math.sin(a)*t])}let a=(e,t)=>{let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r);return[n/i,r/i]},o=``;for(let t=0;t<e;t++){let r=i[t],s=a(r,i[(t-1+e)%e]),c=a(r,i[(t+1)%e]),l=[r[0]+s[0]*n,r[1]+s[1]*n],u=[r[0]+c[0]*n,r[1]+c[1]*n];o+=`${t?`L`:`M`}${l[0].toFixed(2)} ${l[1].toFixed(2)}A${n} ${n} 0 0 1 ${u[0].toFixed(2)} ${u[1].toFixed(2)}`}return`${o}Z`}function d(e,n,r,i){let a=``;for(let t=0;t<e*2;t++){let i=-Math.PI/2+t*Math.PI/e,o=t%2?r:n;a+=`${t?`L`:`M`}${(En+Math.cos(i)*o).toFixed(2)} ${(Dn+Math.sin(i)*o).toFixed(2)}`}return Mn(Nn(Pn(t(`${a}Z`,Q),i,.3),n))}function f(e,n,r){let i=t=>{let n=-Math.PI/2+t*Math.PI/2;return[En+Math.cos(n)*e,Dn+Math.sin(n)*e]},a=`M${i(0)[0].toFixed(2)} ${i(0)[1].toFixed(2)}`;for(let e=0;e<4;e++){let t=-Math.PI/2+(e+.5)*Math.PI/2,r=[En+Math.cos(t)*n,Dn+Math.sin(t)*n],o=i((e+1)%4);a+=`Q${r[0].toFixed(2)} ${r[1].toFixed(2)} ${o[0].toFixed(2)} ${o[1].toFixed(2)}`}return Mn(Nn(Pn(t(`${a}Z`,Q),r,.34),e))}function p(e,t,n,r){let i=[];for(let a=0;a<Q;a++){let o=-Math.PI/2+a*2*Math.PI/Q,s=(1+Math.cos(e*(o+Math.PI/2)))/2,c=n+(t-n)*s**r;i.push([En+Math.cos(o)*c,Dn+Math.sin(o)*c])}return Mn(i)}function m(e){let t=[];for(let n=0;n<Q;n++){let r=-Math.PI/2+n*2*Math.PI/Q;t.push([En+Math.cos(r)*e,Dn+Math.sin(r)*e])}return Mn(t)}return{silhouette:i,hull:a,fit:o,soften:s,squeeze:c,wobble:l,poly:u,star:d,sparkle:f,lobed:p,dot:m,circle:(e,t,n)=>`M${e-n} ${t}a${n} ${n} 0 1 0 ${n*2} 0a${n} ${n} 0 1 0 ${-n*2} 0`}}function Ln(){let e=Fn();if(e===null)return null;try{let t=In(e),n=t.silhouette(y,12.55);return{paths:[n.path,t.wobble(t.poly(3,$*1.16,$*.5,.1),1.1),t.wobble(t.poly(4,$*1.02,$*.44),2.3),t.wobble(t.sparkle($*1.24,$*.1,3),3.7),t.wobble(t.poly(5,$*1,$*.38),4.9),t.wobble(t.poly(6,$*.98,$*.34),6.2),t.wobble(t.dot($*.34),2.8),t.wobble(t.star(5,$*1.14,$*.68,6),7.4),t.wobble(t.soften(t.lobed(4,$*1.16,$*.46,.5),3,.3),8.1),t.wobble(t.star(6,$*1.2,$*.42,4),9.3),t.wobble(t.lobed(8,$*1.06,$*.74,.6),10.5),t.wobble(t.soften(t.fit(jn,$*1.12),3,.22),11.7,.3),t.wobble(t.squeeze(t.poly(4,$*1.3,$*.2),.84,1),12.9),t.wobble(t.hull(t.circle(10.2,16,4.3)+t.circle(15,12,5.5)+t.circle(20,15.4,4.4)+t.circle(15,17.4,5.2),12.4),13.6)],strokeWidth:n.strokeWidth}}finally{e.ownerSVGElement?.remove()}}var Rn;function zn(){return Rn===void 0&&(Rn=Ln()),Rn}var Bn=/-?\d+(?:\.\d+)?/g;function Vn(e){return{fragments:e[0].split(Bn),numbers:e.map(e=>(e.match(Bn)??[]).map(Number))}}function Hn(e,t){let n=``;for(let r=0;r<t.length;r++)n+=e[r]+t[r].toFixed(2);return n+e[t.length]}function Un(e){return e<.5?2*e*e:1-2*(1-e)**2}var Wn=.58;function Gn(e,t,n,r){let i=t-1,a=n/i,o=e%n,s=Math.max(0,Math.min(i-1,Math.floor(o/a))),c=o%a/a;return{from:s,to:s+1,t:Un(r?Math.min(1,c/Wn):c)}}var Kn=On,qn=[Kn.blobby,Kn.triangle,Kn.square,Kn.sparkle,Kn.comma,Kn.pentagon,Kn.hexagon,Kn.blobby],Jn={[Kn.comma]:-2.9},Yn={leftCx:10.9,rightCx:18.1,cy:16,rx:1.25,ry:1.9},Xn=20,Zn=8.4;function Qn(e){let t=(0,Y.c)(22),{status:n,className:r,testId:i}=e,{_:a}=m(),o=(0,X.useRef)(null),s=(0,X.useRef)(null),c=Me(),l,u;t[0]===c?(l=t[1],u=t[2]):(l=()=>{let e=o.current;if(e===null)return;if(c){e.setAttribute(`d`,kn),e.setAttribute(`stroke-width`,String(An)),s.current?.removeAttribute(`transform`);return}let t=zn();if(t===null)return;e.setAttribute(`stroke-width`,t.strokeWidth.toFixed(2));let n=Vn(t.paths),r=NaN,i=``;return Tn(t=>{let{from:a,to:o,t:c}=Gn(t,qn.length,Zn,!0),l=n.numbers[qn[a]],u=n.numbers[qn[o]],d=l.map((e,t)=>e+(u[t]-e)*c),f=Hn(n.fragments,d);f!==i&&(i=f,e.setAttribute(`d`,f));let p=s.current;if(p===null)return;let m=Jn[qn[a]]??0,h=m+((Jn[qn[o]]??0)-m)*c;h!==r&&(r=h,p.setAttribute(`transform`,`translate(0 ${h.toFixed(2)})`))})},u=[c],t[0]=c,t[1]=l,t[2]=u),(0,X.useEffect)(l,u);let[d,f]=(0,X.useState)(``),p,h;t[3]===a?(p=t[4],h=t[5]):(p=()=>{f(a({id:`DCSSZt`}))},h=[a],t[3]=a,t[4]=p,t[5]=h),(0,X.useEffect)(p,h);let g;t[6]===r?g=t[7]:(g=v(`ok-working-enter flex items-center gap-2`,r),t[6]=r,t[7]=g);let _;t[8]===d?_=t[9]:(_=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,role:`status`,children:d}),t[8]=d,t[9]=_);let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`path`,{ref:o,d:kn,fill:`none`,stroke:`currentColor`,strokeWidth:An,strokeLinejoin:`round`,strokeLinecap:`round`}),t[10]=y):y=t[10];let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(`span`,{className:`grid shrink-0 place-items-center text-muted-foreground/80`,children:(0,Z.jsx)(`svg`,{width:Xn,height:Xn,viewBox:`0 0 30 30`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`ok-working-pop ok-working-squint block shrink-0 overflow-visible`,children:(0,Z.jsxs)(`g`,{className:`ok-working-group`,children:[y,(0,Z.jsxs)(`g`,{ref:s,children:[(0,Z.jsx)(`ellipse`,{className:`ok-working-eye`,cx:Yn.leftCx,cy:Yn.cy,rx:Yn.rx,ry:Yn.ry,fill:`currentColor`}),(0,Z.jsx)(`ellipse`,{className:`ok-working-eye`,cx:Yn.rightCx,cy:Yn.cy,rx:Yn.rx,ry:Yn.ry,fill:`currentColor`})]})]})})}),t[11]=b):b=t[11];let x;t[12]===n?x=t[13]:(x=(0,Z.jsx)(`span`,{className:`shimmer`,children:n}),t[12]=n,t[13]=x);let S;t[14]!==n||t[15]!==x?(S=(0,Z.jsx)(`span`,{className:`ok-working-status text-sm`,children:x},n),t[14]=n,t[15]=x,t[16]=S):S=t[16];let C;return t[17]!==S||t[18]!==g||t[19]!==_||t[20]!==i?(C=(0,Z.jsxs)(`div`,{className:g,"data-testid":i,children:[_,b,S]}),t[17]=S,t[18]=g,t[19]=_,t[20]=i,t[21]=C):C=t[21],C}function $n(e){let t=[];for(let n of e.options)`value`in n?t.push(n):t.push(...n.options);return t}function er(e){let t=$n(e),n=t.find(t=>t.value===e.currentValue);if(n===void 0||n.value!==`default`||!n.description)return null;let r=t.find(e=>e.value!==n.value&&e.description===n.description);return r===void 0?null:B._({id:`GK5Ft_`,values:{0:r.name}})}function tr(e,t,n){return e===`claude-acp`&&t===`effort`&&n===`default`?B._({id:`3SWNP8`}):e===`codex-acp`&&t===`collaboration_mode`&&n===`default`?B._({id:`R6ABfU`}):null}var nr=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),rr=700*1024;function ir(e){if(e.kind===`unsupported-type`)return e.mimeType.startsWith(`image/`)?`Only PNG, JPEG, GIF, and WebP images are supported (got ${e.mimeType}).`:`Unsupported file type: ${e.mimeType||`unknown`}.`;if(e.kind===`outside-workspace`)return`${e.name} is outside the workspace. Move it into your project first.`;if(e.kind===`unknown-path`)return`${e.name} has no resolvable path — the agent can only read files inside the workspace.`;let t=(e.limitBytes/(1024*1024)).toFixed(1);return`File is too large (${(e.sizeBytes/(1024*1024)).toFixed(1)} MB) — max ${t} MB per attachment.`}async function ar(e){let t=await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`FileReader failed`)),r.onload=()=>{let e=r.result;if(typeof e!=`string`){n(Error(`FileReader returned non-string result`));return}t(e)},r.readAsDataURL(e)}),n=t.indexOf(`,`);return{data:n>=0?t.slice(n+1):t,mimeType:e.type||`application/octet-stream`,name:e.name||`image`,sizeBytes:e.size}}async function or(e){let t=e.type||``;if(!nr.has(t))return{ok:!1,error:{kind:`unsupported-type`,mimeType:t}};if(e.size>716800)return{ok:!1,error:{kind:`too-large`,sizeBytes:e.size,limitBytes:rr}};let n=await ar(e);return{ok:!0,part:{kind:`image`,data:n.data,mimeType:n.mimeType,name:n.name,sizeBytes:n.sizeBytes}}}function sr(e){return lr(e,e=>e.type.startsWith(`image/`))}function cr(e){return lr(e,e=>e.size>0)}function lr(e,t){if(e===null)return[];let n=new Set,r=[],i=e=>{if(e===null||!t(e))return;let i=`${e.name}|${e.size}|${e.lastModified??0}`;n.has(i)||(n.add(i),r.push(e))},a=e.items;if(a)for(let e=0;e<a.length;e+=1){let t=a[e];t&&t.kind===`file`&&i(t.getAsFile())}let o=e.files;if(o)for(let e=0;e<o.length;e+=1)i(o[e]??null);return r}function ur(e,t,n){let r=n===`\\`?e.toLowerCase():e,i=n===`\\`?t.toLowerCase():t,a=i.endsWith(n)?i:`${i}${n}`;if(r===i)return``;if(!r.startsWith(a))return null;let o=e.slice(a.length);return n===`\\`?o.replaceAll(`\\`,`/`):o}async function dr(e,t={}){if((e.type||``).startsWith(`image/`))return or(e);let n=t.absPathOf,r=t.workspaceContentDir,i=t.pathSeparator??`/`,a=e.name||`attachment`;if(n===void 0||r===void 0||r===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let o=n(e);if(o===null||o===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let s=ur(o,r,i);return s===null?{ok:!1,error:{kind:`outside-workspace`,name:a}}:{ok:!0,part:{kind:`file`,path:s,name:a}}}var fr=3,pr=fr*2+2;function mr(e){let t=e.split(`
3
3
  `);return t[t.length-1]===``&&t.pop(),t}function hr(e,t){if(e===null)return mr(t).map(e=>({type:`add`,text:e}));let n=[],r=Je(e,t);for(let[e,t]of r.entries()){let i=mr(t.value);if(t.added){for(let e of i)n.push({type:`add`,text:e});continue}if(t.removed){for(let e of i)n.push({type:`del`,text:e});continue}if(i.length<=pr){for(let e of i)n.push({type:`ctx`,text:e});continue}let a=e>0?i.slice(0,fr):[],o=e<r.length-1?i.slice(-fr):[];for(let e of a)n.push({type:`ctx`,text:e});n.push({type:`gap`,count:i.length-a.length-o.length});for(let e of o)n.push({type:`ctx`,text:e})}return n}var gr=/\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-Z\\-_]/g;function _r(e){return e.replace(gr,``)}function vr(e){return _r(e).split(`
4
4
  `).map(e=>{let t=e.replace(/\r+$/,``),n=t.lastIndexOf(`\r`);return n===-1?t:t.slice(n+1)}).join(`
5
5
  `)}var yr=new Set(ie),br=/^(?:open[-_ ]?knowledge|ok)$/,xr=/^(?:mcp[^a-z0-9]+)?(?:open[-_ ]?knowledge|ok)[^a-z0-9]+([a-z_]+)$/;function Sr(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Cr(e){return xr.exec(e.trim().toLowerCase())?.[1]??null}function wr(e,t){let n=xe(Sr(t),`server`);if(n!==null&&!br.test(n.toLowerCase()))return null;let r=Te(t),i=[Cr(e),r?.tool??null].find(e=>e!==null&&yr.has(e));return i===void 0?null:{tool:i,args:r?.args??{}}}function Tr(e){return typeof e==`string`?e.trim()===``?[]:[e.trim()]:Array.isArray(e)?e.flatMap(Tr):typeof e==`object`&&e?Tr(e.path):[]}var Er=[`document`,`documents`,`folder`,`file`,`template`,`asset`,`path`,`from`,`name`];function Dr(e){for(let t of Er){let n=Tr(e[t]);if(n.length>0)return n}return[]}function Or(e){return e.replace(/\.mdx?$/i,``)}var kr=120;function Ar(e){if(typeof e!=`string`)return null;let t=e.replace(/\s+/g,` `).trim();return t===``?null:t.length>kr?`${t.slice(0,kr-1)}…`:t}function jr(e,t){let n=Dr(t),r=n[0],i=n.length>1?B._({id:`C7waqI`,values:{0:n.length}}):r===void 0?null:Or(r);switch(e){case`write`:return{glyph:`edit`,text:i===null?B._({id:`tLX6LY`}):B._({id:`MvWBwz`,values:{subject:i}})};case`edit`:return{glyph:`edit`,text:i===null?B._({id:`Fx9aOF`}):B._({id:`7aNk5D`,values:{subject:i}})};case`delete`:return{glyph:`delete`,text:i===null?B._({id:`DcFr-y`}):B._({id:`Gb_h4G`,values:{subject:i}})};case`move`:{let e=Tr(t.to)[0];if(i===null||e===void 0)return{glyph:`move`,text:B._({id:`RGptDW`})};let n=Or(e);return{glyph:`move`,text:B._({id:`pbyEp3`,values:{subject:i,destination:n}})}}case`search`:{let e=Ar(t.query);return{glyph:`search`,text:e===null?B._({id:`EvXKHE`}):B._({id:`yWfjqS`,values:{query:e}})}}case`exec`:{let e=Ar(t.command);return{glyph:`execute`,text:e===null?B._({id:`FS4Udk`}):B._({id:`a5gwRt`,values:{command:e}})}}case`lint`:case`audit`:return{glyph:`check`,text:i===null?B._({id:`7S7FNA`}):B._({id:`TEJiKw`,values:{subject:i}})};case`links`:return{glyph:`link`,text:i===null?B._({id:`vallqD`}):B._({id:`KDrbNG`,values:{subject:i}})};case`history`:return{glyph:`history`,text:i===null?B._({id:`Ug2xzC`}):B._({id:`90-wKT`,values:{subject:i}})};case`config`:{let e=Ar(t.key);return{glyph:`settings`,text:e===null?B._({id:`ZwpggY`}):B._({id:`-oHckY`,values:{key:e}})}}case`skills`:return{glyph:`read`,text:B._({id:`4mp6Tv`})};case`install`:return{glyph:`install`,text:i===null?B._({id:`4ErgAf`}):B._({id:`WbWtif`,values:{subject:i}})};case`import`:{let e=Ar(t.skill)??Ar(t.source);return{glyph:`install`,text:e===null?B._({id:`DhT_PK`}):B._({id:`hCattk`,values:{source:e}})}}case`palette`:return{glyph:`read`,text:B._({id:`7czmD1`})};case`preview_url`:return{glyph:`fetch`,text:B._({id:`UL-9ej`})};case`share_link`:return{glyph:`share`,text:i===null?B._({id:`ABq-cq`}):B._({id:`ibE3-O`,values:{subject:i}})};case`checkpoint`:return{glyph:`history`,text:B._({id:`5b3WD-`})};case`conflicts`:return{glyph:`check`,text:B._({id:`i94lQe`})};case`resolve_conflict`:return{glyph:`edit`,text:i===null?B._({id:`_YWqV2`}):B._({id:`AeLo3p`,values:{subject:i}})};case`restore_version`:return{glyph:`restore`,text:i===null?B._({id:`caiyaU`}):B._({id:`hS0wC4`,values:{subject:i}})};default:return{glyph:`other`,text:B._({id:`vhGTWU`,values:{tool:e}})}}}var Mr={read:`read`,edit:`edit`,delete:`delete`,move:`move`,search:`search`,execute:`execute`,think:`think`,fetch:`fetch`,switch_mode:`switch_mode`};function Nr(e){let t=wr(e.title,e.rawInput);return t===null?{text:e.title,glyph:Mr[e.toolKind]??`other`}:jr(t.tool,t.args)}var Pr=new Map([{id:`shellscript`,aliases:[`bash`,`sh`,`shell`,`zsh`]},{id:`tsx`,aliases:[`typescript`,`ts`,`jsx`]},{id:`javascript`,aliases:[`js`]},{id:`json`,aliases:[`jsonc`]},{id:`python`,aliases:[`py`]},{id:`rust`,aliases:[`rs`]},{id:`go`,aliases:[]},{id:`css`,aliases:[]},{id:`html`,aliases:[]},{id:`markdown`,aliases:[`md`]},{id:`yaml`,aliases:[`yml`]},{id:`toml`,aliases:[]},{id:`sql`,aliases:[]},{id:`diff`,aliases:[]},{id:`dockerfile`,aliases:[`docker`]}].flatMap(e=>[[e.id,e.id],...e.aliases.map(t=>[t,e.id])])),Fr=[`github-light`,`github-dark`],Ir=400,Lr=new Map,Rr=new Map;function zr(e,t){return`${t}:${e.length}:${e.slice(0,100)}:${e.length>100?e.slice(-100):``}`}var Br={name:`shiki`,type:`code-highlighter`,getSupportedLanguages:()=>Array.from(Pr.keys()),supportsLanguage:e=>Pr.has(e),getThemes:()=>Fr,highlight(e,n){let r=Pr.get(e.language)??`text`,i=zr(e.code,r),a=Lr.get(i);if(a!==void 0)return a;if(n!==void 0){let e=Rr.get(i)??new Set;e.add(n),Rr.set(i,e)}return t(async()=>{let{tokenize:e}=await import(`./code-highlighter-impl-DcDH82_f.js`);return{tokenize:e}},__vite__mapDeps([0,1,2,3]),import.meta.url).then(async({tokenize:t})=>{let n=await t(e.code,r);if(Lr.size>=Ir){let e=Math.floor(Lr.size/2);for(let t of Lr.keys()){if(e===0)break;Lr.delete(t),--e}}Lr.set(i,n);let a=Rr.get(i);if(a!==void 0){Rr.delete(i);for(let e of a)e(n)}}).catch(e=>{Rr.delete(i),console.warn(`[code-highlighter] highlight failed, leaving plain text`,e)}),null}};function Vr(){return e=>{Hr(e)}}function Hr(e){let t=e.children;if(t===void 0)return;let n=[];for(let e of t){if(e.type===`text`&&e.value!==void 0&&e.value.includes(`
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActivityPanelDiffView-Cf2VzcQR.js","./chunk-CYidjpOJ.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./compiler-runtime-BfE3aGVn.js","./ActivityPanelDiffView-legcy4jI.css"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as ee}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as te}from"./overlay-layers-Bj-TVfKw.js";import{t as o}from"./button-CA0dewJJ.js";import{i as ne,n as re,t as ie}from"./tooltip-DHXgxWLL.js";import{a as ae,c as oe,i as se,o as ce,s as le,t as ue}from"./dialog-HdfR4WGm.js";import{n as de,t as fe}from"./toggle-group-CZcn-1gX.js";import{yt as pe}from"./dist-C771h__g.js";import{n as me}from"./dist-B6jB2qbD2.js";import{t as he}from"./chevron-down-DabHDQTe.js";import{t as ge}from"./chevron-up-BNZIobnQ.js";import{t as _e}from"./spinner-BxJv3FRl.js";import{n as ve,t as ye}from"./panel-right-open-DjTdbkpr.js";import{t as be}from"./undo-2-DAbhEXY-.js";import{t as xe}from"./x-DddVxTPq.js";import{t as Se}from"./timeline-diff-store-DnRthkM7.js";import{t as s}from"./lru-string-cache-BPCBM2V6.js";import{a as Ce,c as we,i as Te,l as Ee,n as De,o as Oe,r as ke,s as Ae,u as je}from"./use-timeline-entry-diff-8DxGofLT.js";var Me=a(),c=e(r(),1),l=n(),Ne=(0,c.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-Cf2VzcQR.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ActivityPanelDiffView}));function u(e){let t=(0,Me.c)(161),{view:n,isPanelCollapsed:r,onTogglePanel:a}=e,{_:s}=ee(),{docName:u,sha:Ie,parentSha:Le,laterEdits:d,authorName:Re,relativeTime:ze}=n,[Be]=(0,c.useState)(Fe),[f,Ve]=(0,c.useState)(`rendered`),[p,He]=(0,c.useState)(!1),[m,Ue]=(0,c.useState)(!1),We=(0,c.useRef)(null),Ge=(0,c.useRef)(null),[Ke,qe]=(0,c.useState)(0),[Je,Ye]=(0,c.useState)(!0),h=De(Ie,u,Be,`vs-parent`,Le),g,_,v,y,Xe,b;t[0]!==f||t[1]!==h.after||t[2]!==h.before||t[3]!==h.diff||t[4]!==h.properties||t[5]!==h.status?(y=h.status===`ready`?Ae(h.before,h.after):null,b=f===`rendered`&&y?.ok===!0,_=h.status===`ready`?h.properties:null,v=_?.changes.length??0,g=_!==null&&(_.changes.length>0||_.unparseable!==null),Xe=h.status===`ready`?b&&y?.ok?Ee(y):Ce(h.diff):0,t[0]=f,t[1]=h.after,t[2]=h.before,t[3]=h.diff,t[4]=h.properties,t[5]=h.status,t[6]=g,t[7]=_,t[8]=v,t[9]=y,t[10]=Xe,t[11]=b):(g=t[6],_=t[7],v=t[8],y=t[9],Xe=t[10],b=t[11]);let Ze=Xe+(_===null?0:_.unparseable===null?Je?Math.min(v,50):0:1),Qe;t[12]===b?Qe=t[13]:(Qe=function(e){let t=Ge.current;if(!t)return;let n=[...t.querySelectorAll(ke),...b?Array.from(t.querySelectorAll(we)):Te(t)];if(n.length===0)return;let r=(e+n.length)%n.length;qe(r),n[r]?.scrollIntoView({block:`center`,behavior:`smooth`})},t[12]=b,t[13]=Qe);let $e=Qe,et,tt;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>()=>We.current?.abort(),tt=[],t[14]=et,t[15]=tt):(et=t[14],tt=t[15]),(0,c.useEffect)(et,tt);let nt=h.status===`ready`?`${f}:${h.diff}`:``,rt,it;t[16]===nt?(rt=t[17],it=t[18]):(rt=()=>{let e=Ge.current;if(nt===``||!e)return;qe(0);let t=!1,n=null,r,i,ee=()=>{if(t)return;let r=e.querySelector(`[data-property-change]`)??e.querySelector(`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`)??Te(e)[0];if(!r)return;t=!0,n?.disconnect();let i=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView({block:`center`,behavior:i?`auto`:`smooth`})},a=()=>{t||(r!==void 0&&clearTimeout(r),r=setTimeout(()=>{i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=requestAnimationFrame(ee)})},120))};n=new MutationObserver(a),n.observe(e,{childList:!0,subtree:!0}),a();let te=setTimeout(()=>n?.disconnect(),5e3);return()=>{n?.disconnect(),r!==void 0&&clearTimeout(r),i!==void 0&&cancelAnimationFrame(i),clearTimeout(te)}},it=[nt],t[16]=nt,t[17]=rt,t[18]=it),(0,c.useEffect)(rt,it);let at,ot;t[19]===p?(at=t[20],ot=t[21]):(at=()=>{let e=e=>{e.key===`Escape`&&(p||te()||Se())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ot=[p],t[19]=p,t[20]=at,t[21]=ot),(0,c.useEffect)(at,ot);let st;t[22]!==s||t[23]!==u||t[24]!==Ie?(st=async function(){Ue(!0);let e=new AbortController;We.current=e;let t=function(){e.signal.aborted||Ue(!1),We.current===e&&(We.current=null)},n;try{n=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:u,commitSha:Ie}),signal:e.signal})}catch(n){let r=n;!e.signal.aborted&&!(r instanceof DOMException&&r.name===`AbortError`)&&me.error(s({id:`NkXEFS`}),{duration:4e3}),t();return}if(e.signal.aborted){t();return}if(n.ok){t(),He(!1),Se();return}let r=`HTTP ${n.status}`;try{let e=pe.safeParse(await n.json());e.success&&(r=e.data.title)}catch{}me.error(s({id:`uM6jnS`}),{description:r,duration:6e3}),t()},t[22]=s,t[23]=u,t[24]=Ie,t[25]=st):st=t[25];let x=st,ct=h.status===`ready`&&(h.additions>0||h.deletions>0),S;t[26]===s?S=t[27]:(S=s({id:`b18t0_`}),t[26]=s,t[27]=S);let lt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,l.jsx)(xe,{className:`size-4`}),t[28]=lt):lt=t[28];let C;t[29]===S?C=t[30]:(C=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-close`,"aria-label":S,onClick:Pe,children:lt})}),t[29]=S,t[30]=C);let w;t[31]===s?w=t[32]:(w=s({id:`b18t0_`}),t[31]=s,t[32]=w);let T;t[33]===w?T=t[34]:(T=(0,l.jsx)(re,{side:`bottom`,children:w}),t[33]=w,t[34]=T);let E;t[35]!==C||t[36]!==T?(E=(0,l.jsxs)(ie,{children:[C,T]}),t[35]=C,t[36]=T,t[37]=E):E=t[37];let D;t[38]===u?D=t[39]:(D=(0,l.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:u}),t[38]=u,t[39]=D);let O;t[40]!==Re||t[41]!==ze?(O=(0,l.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[Re,` · `,ze]}),t[40]=Re,t[41]=ze,t[42]=O):O=t[42];let k;t[43]!==D||t[44]!==O?(k=(0,l.jsxs)(`div`,{className:`min-w-[8rem] flex-1`,children:[D,O]}),t[43]=D,t[44]=O,t[45]=k):k=t[45];let A;t[46]===v?A=t[47]:(A=v>0&&(0,l.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,"data-testid":`timeline-diff-property-stat`,children:(0,l.jsx)(i,{id:`UI0WPT`,values:{propertyCount:v}})}),t[46]=v,t[47]=A);let j;t[48]!==s||t[49]!==h.additions||t[50]!==h.deletions||t[51]!==h.status||t[52]!==ct?(j=ct&&h.status===`ready`&&(0,l.jsxs)(`span`,{role:`img`,className:`shrink-0 text-xs tabular-nums`,"data-testid":`timeline-diff-stat`,"aria-label":s({id:`8lwQlE`,values:{0:h.additions,1:h.deletions}}),children:[(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-emerald-600 dark:text-emerald-500`,children:[`+`,h.additions]}),` `,(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-red-600 dark:text-red-500`,children:[`−`,h.deletions]})]}),t[48]=s,t[49]=h.additions,t[50]=h.deletions,t[51]=h.status,t[52]=ct,t[53]=j):j=t[53];let ut;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ut=e=>{(e===`rendered`||e===`source`)&&Ve(e)},t[54]=ut):ut=t[54];let M;t[55]===s?M=t[56]:(M=s({id:`ZW3mlR`}),t[55]=s,t[56]=M);let dt;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,l.jsx)(de,{value:`rendered`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-rendered`,children:(0,l.jsx)(i,{id:`4z_1j2`})}),t[57]=dt):dt=t[57];let ft;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,l.jsx)(de,{value:`source`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-source`,children:(0,l.jsx)(i,{id:`wdxz7K`})}),t[58]=ft):ft=t[58];let N;t[59]!==f||t[60]!==M?(N=(0,l.jsxs)(fe,{type:`single`,value:f,onValueChange:ut,"aria-label":M,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 rounded-md bg-muted p-0.5 dark:bg-background`,children:[dt,ft]}),t[59]=f,t[60]=M,t[61]=N):N=t[61];let P;t[62]!==s||t[63]!==Ze||t[64]!==Ke||t[65]!==$e?(P=Ze>1&&(0,l.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 rounded-md border border-border bg-muted/40 p-0.5 dark:bg-background`,children:[(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`_azghp`}),"data-testid":`timeline-diff-prev`,onClick:()=>$e(Ke-1),children:(0,l.jsx)(ge,{className:`size-3.5`})}),(0,l.jsxs)(`span`,{className:`px-0.5 text-xs tabular-nums text-muted-foreground`,"aria-live":`polite`,children:[Ke+1,` / `,Ze]}),(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`-bFGPF`}),"data-testid":`timeline-diff-next`,onClick:()=>$e(Ke+1),children:(0,l.jsx)(he,{className:`size-3.5`})})]}),t[62]=s,t[63]=Ze,t[64]=Ke,t[65]=$e,t[66]=P):P=t[66];let pt;t[67]!==x||t[68]!==d?(pt=()=>d>0?He(!0):x(),t[67]=x,t[68]=d,t[69]=pt):pt=t[69];let F;t[70]===m?F=t[71]:(F=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-1.5 size-3.5`}):(0,l.jsx)(be,{className:`mr-1.5 size-3.5`}),t[70]=m,t[71]=F);let mt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,l.jsx)(i,{id:`yKu_3Y`}),t[72]=mt):mt=t[72];let I;t[73]!==m||t[74]!==pt||t[75]!==F?(I=(0,l.jsxs)(o,{variant:`outline`,size:`sm`,className:`h-7 shrink-0`,"data-testid":`timeline-diff-restore`,disabled:m,onClick:pt,children:[F,mt]}),t[73]=m,t[74]=pt,t[75]=F,t[76]=I):I=t[76];let L;t[77]!==s||t[78]!==r?(L=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[77]=s,t[78]=r,t[79]=L):L=t[79];let ht=!r,R;t[80]===r?R=t[81]:(R=r?(0,l.jsx)(ye,{className:`size-4`}):(0,l.jsx)(ve,{className:`size-4`}),t[80]=r,t[81]=R);let z;t[82]!==a||t[83]!==L||t[84]!==ht||t[85]!==R?(z=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-toggle-panel`,"aria-label":L,"aria-expanded":ht,onClick:a,children:R})}),t[82]=a,t[83]=L,t[84]=ht,t[85]=R,t[86]=z):z=t[86];let B;t[87]!==s||t[88]!==r?(B=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[87]=s,t[88]=r,t[89]=B):B=t[89];let V;t[90]===B?V=t[91]:(V=(0,l.jsx)(re,{side:`bottom`,children:B}),t[90]=B,t[91]=V);let H;t[92]!==z||t[93]!==V?(H=(0,l.jsxs)(ie,{children:[z,V]}),t[92]=z,t[93]=V,t[94]=H):H=t[94];let U;t[95]!==A||t[96]!==j||t[97]!==N||t[98]!==P||t[99]!==I||t[100]!==H?(U=(0,l.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-2`,children:[A,j,N,P,I,H]}),t[95]=A,t[96]=j,t[97]=N,t[98]=P,t[99]=I,t[100]=H,t[101]=U):U=t[101];let W;t[102]!==E||t[103]!==k||t[104]!==U?(W=(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 border-b border-border px-3 py-2`,children:[E,k,U]}),t[102]=E,t[103]=k,t[104]=U,t[105]=W):W=t[105];let G;t[106]===h.status?G=t[107]:(G=h.status===`loading`&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`38foVZ`})]}),t[106]=h.status,t[107]=G);let K;t[108]===h.status?K=t[109]:(K=h.status===`error`&&(0,l.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:(0,l.jsx)(i,{id:`vvWZnu`})}),t[108]=h.status,t[109]=K);let q;t[110]!==_||t[111]!==Je||t[112]!==h.status?(q=h.status===`ready`&&_!==null&&(0,l.jsx)(je,{delta:_,open:Je,onOpenChange:e=>{Ye(e),qe(0)}}),t[110]=_,t[111]=Je,t[112]=h.status,t[113]=q):q=t[113];let J;t[114]!==g||t[115]!==f||t[116]!==y||t[117]!==h.after||t[118]!==h.diff||t[119]!==h.status?(J=h.status===`ready`&&(f===`rendered`&&y?.ok?(0,l.jsx)(Oe,{diff:y}):h.diff===``?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`border-b border-border px-4 py-2 text-xs text-muted-foreground italic`,children:g?(0,l.jsx)(i,{id:`oCO0pe`}):(0,l.jsx)(i,{id:`3YWddZ`})}),(0,l.jsx)(`pre`,{className:`whitespace-pre-wrap px-4 py-3 font-mono text-xs text-foreground/90`,children:h.after})]}):(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`EDm3wJ`})]}),children:(0,l.jsx)(Ne,{diff:h.diff,viewType:`unified`})})),t[114]=g,t[115]=f,t[116]=y,t[117]=h.after,t[118]=h.diff,t[119]=h.status,t[120]=J):J=t[120];let Y;t[121]!==G||t[122]!==K||t[123]!==q||t[124]!==J?(Y=(0,l.jsxs)(`div`,{ref:Ge,className:`min-h-0 flex-1 overflow-auto subtle-scrollbar`,children:[G,K,q,J]}),t[121]=G,t[122]=K,t[123]=q,t[124]=J,t[125]=Y):Y=t[125];let X;t[126]===m?X=t[127]:(X=e=>{!e&&!m?He(!1):e&&He(!0)},t[126]=m,t[127]=X);let Z;t[128]===s?Z=t[129]:(Z=s({id:`n3wx1q`}),t[128]=s,t[129]=Z);let Q;t[130]===Z?Q=t[131]:(Q=(0,l.jsx)(oe,{children:Z}),t[130]=Z,t[131]=Q);let gt;t[132]===d?gt=t[133]:(gt=(0,l.jsx)(i,{id:`nfPccR`,values:{laterEdits:d}}),t[132]=d,t[133]=gt);let _t;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,l.jsx)(i,{id:`5ZbJFS`}),t[134]=_t):_t=t[134];let vt;t[135]===gt?vt=t[136]:(vt=(0,l.jsxs)(ae,{children:[gt,` `,_t]}),t[135]=gt,t[136]=vt);let yt;t[137]!==Q||t[138]!==vt?(yt=(0,l.jsxs)(le,{children:[Q,vt]}),t[137]=Q,t[138]=vt,t[139]=yt):yt=t[139];let bt;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,l.jsx)(o,{variant:`outline`,"data-testid":`timeline-diff-restore-cancel`,onClick:()=>He(!1),children:(0,l.jsx)(i,{id:`dEgA5A`})}),t[140]=bt):bt=t[140];let xt;t[141]===x?xt=t[142]:(xt=()=>x(),t[141]=x,t[142]=xt);let St;t[143]===m?St=t[144]:(St=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-2 size-4`}):null,t[143]=m,t[144]=St);let Ct;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,l.jsx)(i,{id:`yKu_3Y`}),t[145]=Ct):Ct=t[145];let wt;t[146]!==m||t[147]!==xt||t[148]!==St?(wt=(0,l.jsxs)(ce,{children:[bt,(0,l.jsxs)(o,{variant:`destructive`,"data-testid":`timeline-diff-restore-confirm`,disabled:m,onClick:xt,children:[St,Ct]})]}),t[146]=m,t[147]=xt,t[148]=St,t[149]=wt):wt=t[149];let Tt;t[150]!==yt||t[151]!==wt?(Tt=(0,l.jsxs)(se,{children:[yt,wt]}),t[150]=yt,t[151]=wt,t[152]=Tt):Tt=t[152];let $;t[153]!==p||t[154]!==X||t[155]!==Tt?($=(0,l.jsx)(ue,{open:p,onOpenChange:X,children:Tt}),t[153]=p,t[154]=X,t[155]=Tt,t[156]=$):$=t[156];let Et;return t[157]!==W||t[158]!==Y||t[159]!==$?(Et=(0,l.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col bg-background`,"data-testid":`timeline-diff-pane`,children:[W,Y,$]}),t[157]=W,t[158]=Y,t[159]=$,t[160]=Et):Et=t[160],Et}function Pe(){return Se()}function Fe(){return new s(32)}export{u as TimelineDiffPane};
2
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as ee}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as te}from"./overlay-layers-Bj-TVfKw.js";import{t as o}from"./button-CA0dewJJ.js";import{i as ne,n as re,t as ie}from"./tooltip-DHXgxWLL.js";import{a as ae,c as oe,i as se,o as ce,s as le,t as ue}from"./dialog-HdfR4WGm.js";import{n as de,t as fe}from"./toggle-group-CZcn-1gX.js";import{yt as pe}from"./dist-C771h__g.js";import{n as me}from"./dist-B6jB2qbD2.js";import{t as he}from"./chevron-down-DabHDQTe.js";import{t as ge}from"./chevron-up-BNZIobnQ.js";import{t as _e}from"./spinner-BxJv3FRl.js";import{n as ve,t as ye}from"./panel-right-open-DjTdbkpr.js";import{t as be}from"./undo-2-DAbhEXY-.js";import{t as xe}from"./x-DddVxTPq.js";import{t as Se}from"./timeline-diff-store-DnRthkM7.js";import{t as s}from"./lru-string-cache-BPCBM2V6.js";import{a as Ce,c as we,i as Te,l as Ee,n as De,o as Oe,r as ke,s as Ae,u as je}from"./use-timeline-entry-diff-DjOTB-ve.js";var Me=a(),c=e(r(),1),l=n(),Ne=(0,c.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-Cf2VzcQR.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ActivityPanelDiffView}));function u(e){let t=(0,Me.c)(161),{view:n,isPanelCollapsed:r,onTogglePanel:a}=e,{_:s}=ee(),{docName:u,sha:Ie,parentSha:Le,laterEdits:d,authorName:Re,relativeTime:ze}=n,[Be]=(0,c.useState)(Fe),[f,Ve]=(0,c.useState)(`rendered`),[p,He]=(0,c.useState)(!1),[m,Ue]=(0,c.useState)(!1),We=(0,c.useRef)(null),Ge=(0,c.useRef)(null),[Ke,qe]=(0,c.useState)(0),[Je,Ye]=(0,c.useState)(!0),h=De(Ie,u,Be,`vs-parent`,Le),g,_,v,y,Xe,b;t[0]!==f||t[1]!==h.after||t[2]!==h.before||t[3]!==h.diff||t[4]!==h.properties||t[5]!==h.status?(y=h.status===`ready`?Ae(h.before,h.after):null,b=f===`rendered`&&y?.ok===!0,_=h.status===`ready`?h.properties:null,v=_?.changes.length??0,g=_!==null&&(_.changes.length>0||_.unparseable!==null),Xe=h.status===`ready`?b&&y?.ok?Ee(y):Ce(h.diff):0,t[0]=f,t[1]=h.after,t[2]=h.before,t[3]=h.diff,t[4]=h.properties,t[5]=h.status,t[6]=g,t[7]=_,t[8]=v,t[9]=y,t[10]=Xe,t[11]=b):(g=t[6],_=t[7],v=t[8],y=t[9],Xe=t[10],b=t[11]);let Ze=Xe+(_===null?0:_.unparseable===null?Je?Math.min(v,50):0:1),Qe;t[12]===b?Qe=t[13]:(Qe=function(e){let t=Ge.current;if(!t)return;let n=[...t.querySelectorAll(ke),...b?Array.from(t.querySelectorAll(we)):Te(t)];if(n.length===0)return;let r=(e+n.length)%n.length;qe(r),n[r]?.scrollIntoView({block:`center`,behavior:`smooth`})},t[12]=b,t[13]=Qe);let $e=Qe,et,tt;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>()=>We.current?.abort(),tt=[],t[14]=et,t[15]=tt):(et=t[14],tt=t[15]),(0,c.useEffect)(et,tt);let nt=h.status===`ready`?`${f}:${h.diff}`:``,rt,it;t[16]===nt?(rt=t[17],it=t[18]):(rt=()=>{let e=Ge.current;if(nt===``||!e)return;qe(0);let t=!1,n=null,r,i,ee=()=>{if(t)return;let r=e.querySelector(`[data-property-change]`)??e.querySelector(`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`)??Te(e)[0];if(!r)return;t=!0,n?.disconnect();let i=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView({block:`center`,behavior:i?`auto`:`smooth`})},a=()=>{t||(r!==void 0&&clearTimeout(r),r=setTimeout(()=>{i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=requestAnimationFrame(ee)})},120))};n=new MutationObserver(a),n.observe(e,{childList:!0,subtree:!0}),a();let te=setTimeout(()=>n?.disconnect(),5e3);return()=>{n?.disconnect(),r!==void 0&&clearTimeout(r),i!==void 0&&cancelAnimationFrame(i),clearTimeout(te)}},it=[nt],t[16]=nt,t[17]=rt,t[18]=it),(0,c.useEffect)(rt,it);let at,ot;t[19]===p?(at=t[20],ot=t[21]):(at=()=>{let e=e=>{e.key===`Escape`&&(p||te()||Se())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ot=[p],t[19]=p,t[20]=at,t[21]=ot),(0,c.useEffect)(at,ot);let st;t[22]!==s||t[23]!==u||t[24]!==Ie?(st=async function(){Ue(!0);let e=new AbortController;We.current=e;let t=function(){e.signal.aborted||Ue(!1),We.current===e&&(We.current=null)},n;try{n=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:u,commitSha:Ie}),signal:e.signal})}catch(n){let r=n;!e.signal.aborted&&!(r instanceof DOMException&&r.name===`AbortError`)&&me.error(s({id:`NkXEFS`}),{duration:4e3}),t();return}if(e.signal.aborted){t();return}if(n.ok){t(),He(!1),Se();return}let r=`HTTP ${n.status}`;try{let e=pe.safeParse(await n.json());e.success&&(r=e.data.title)}catch{}me.error(s({id:`uM6jnS`}),{description:r,duration:6e3}),t()},t[22]=s,t[23]=u,t[24]=Ie,t[25]=st):st=t[25];let x=st,ct=h.status===`ready`&&(h.additions>0||h.deletions>0),S;t[26]===s?S=t[27]:(S=s({id:`b18t0_`}),t[26]=s,t[27]=S);let lt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,l.jsx)(xe,{className:`size-4`}),t[28]=lt):lt=t[28];let C;t[29]===S?C=t[30]:(C=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-close`,"aria-label":S,onClick:Pe,children:lt})}),t[29]=S,t[30]=C);let w;t[31]===s?w=t[32]:(w=s({id:`b18t0_`}),t[31]=s,t[32]=w);let T;t[33]===w?T=t[34]:(T=(0,l.jsx)(re,{side:`bottom`,children:w}),t[33]=w,t[34]=T);let E;t[35]!==C||t[36]!==T?(E=(0,l.jsxs)(ie,{children:[C,T]}),t[35]=C,t[36]=T,t[37]=E):E=t[37];let D;t[38]===u?D=t[39]:(D=(0,l.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:u}),t[38]=u,t[39]=D);let O;t[40]!==Re||t[41]!==ze?(O=(0,l.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[Re,` · `,ze]}),t[40]=Re,t[41]=ze,t[42]=O):O=t[42];let k;t[43]!==D||t[44]!==O?(k=(0,l.jsxs)(`div`,{className:`min-w-[8rem] flex-1`,children:[D,O]}),t[43]=D,t[44]=O,t[45]=k):k=t[45];let A;t[46]===v?A=t[47]:(A=v>0&&(0,l.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,"data-testid":`timeline-diff-property-stat`,children:(0,l.jsx)(i,{id:`UI0WPT`,values:{propertyCount:v}})}),t[46]=v,t[47]=A);let j;t[48]!==s||t[49]!==h.additions||t[50]!==h.deletions||t[51]!==h.status||t[52]!==ct?(j=ct&&h.status===`ready`&&(0,l.jsxs)(`span`,{role:`img`,className:`shrink-0 text-xs tabular-nums`,"data-testid":`timeline-diff-stat`,"aria-label":s({id:`8lwQlE`,values:{0:h.additions,1:h.deletions}}),children:[(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-emerald-600 dark:text-emerald-500`,children:[`+`,h.additions]}),` `,(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-red-600 dark:text-red-500`,children:[`−`,h.deletions]})]}),t[48]=s,t[49]=h.additions,t[50]=h.deletions,t[51]=h.status,t[52]=ct,t[53]=j):j=t[53];let ut;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ut=e=>{(e===`rendered`||e===`source`)&&Ve(e)},t[54]=ut):ut=t[54];let M;t[55]===s?M=t[56]:(M=s({id:`ZW3mlR`}),t[55]=s,t[56]=M);let dt;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,l.jsx)(de,{value:`rendered`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-rendered`,children:(0,l.jsx)(i,{id:`4z_1j2`})}),t[57]=dt):dt=t[57];let ft;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,l.jsx)(de,{value:`source`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-source`,children:(0,l.jsx)(i,{id:`wdxz7K`})}),t[58]=ft):ft=t[58];let N;t[59]!==f||t[60]!==M?(N=(0,l.jsxs)(fe,{type:`single`,value:f,onValueChange:ut,"aria-label":M,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 rounded-md bg-muted p-0.5 dark:bg-background`,children:[dt,ft]}),t[59]=f,t[60]=M,t[61]=N):N=t[61];let P;t[62]!==s||t[63]!==Ze||t[64]!==Ke||t[65]!==$e?(P=Ze>1&&(0,l.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 rounded-md border border-border bg-muted/40 p-0.5 dark:bg-background`,children:[(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`_azghp`}),"data-testid":`timeline-diff-prev`,onClick:()=>$e(Ke-1),children:(0,l.jsx)(ge,{className:`size-3.5`})}),(0,l.jsxs)(`span`,{className:`px-0.5 text-xs tabular-nums text-muted-foreground`,"aria-live":`polite`,children:[Ke+1,` / `,Ze]}),(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`-bFGPF`}),"data-testid":`timeline-diff-next`,onClick:()=>$e(Ke+1),children:(0,l.jsx)(he,{className:`size-3.5`})})]}),t[62]=s,t[63]=Ze,t[64]=Ke,t[65]=$e,t[66]=P):P=t[66];let pt;t[67]!==x||t[68]!==d?(pt=()=>d>0?He(!0):x(),t[67]=x,t[68]=d,t[69]=pt):pt=t[69];let F;t[70]===m?F=t[71]:(F=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-1.5 size-3.5`}):(0,l.jsx)(be,{className:`mr-1.5 size-3.5`}),t[70]=m,t[71]=F);let mt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,l.jsx)(i,{id:`yKu_3Y`}),t[72]=mt):mt=t[72];let I;t[73]!==m||t[74]!==pt||t[75]!==F?(I=(0,l.jsxs)(o,{variant:`outline`,size:`sm`,className:`h-7 shrink-0`,"data-testid":`timeline-diff-restore`,disabled:m,onClick:pt,children:[F,mt]}),t[73]=m,t[74]=pt,t[75]=F,t[76]=I):I=t[76];let L;t[77]!==s||t[78]!==r?(L=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[77]=s,t[78]=r,t[79]=L):L=t[79];let ht=!r,R;t[80]===r?R=t[81]:(R=r?(0,l.jsx)(ye,{className:`size-4`}):(0,l.jsx)(ve,{className:`size-4`}),t[80]=r,t[81]=R);let z;t[82]!==a||t[83]!==L||t[84]!==ht||t[85]!==R?(z=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-toggle-panel`,"aria-label":L,"aria-expanded":ht,onClick:a,children:R})}),t[82]=a,t[83]=L,t[84]=ht,t[85]=R,t[86]=z):z=t[86];let B;t[87]!==s||t[88]!==r?(B=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[87]=s,t[88]=r,t[89]=B):B=t[89];let V;t[90]===B?V=t[91]:(V=(0,l.jsx)(re,{side:`bottom`,children:B}),t[90]=B,t[91]=V);let H;t[92]!==z||t[93]!==V?(H=(0,l.jsxs)(ie,{children:[z,V]}),t[92]=z,t[93]=V,t[94]=H):H=t[94];let U;t[95]!==A||t[96]!==j||t[97]!==N||t[98]!==P||t[99]!==I||t[100]!==H?(U=(0,l.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-2`,children:[A,j,N,P,I,H]}),t[95]=A,t[96]=j,t[97]=N,t[98]=P,t[99]=I,t[100]=H,t[101]=U):U=t[101];let W;t[102]!==E||t[103]!==k||t[104]!==U?(W=(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 border-b border-border px-3 py-2`,children:[E,k,U]}),t[102]=E,t[103]=k,t[104]=U,t[105]=W):W=t[105];let G;t[106]===h.status?G=t[107]:(G=h.status===`loading`&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`38foVZ`})]}),t[106]=h.status,t[107]=G);let K;t[108]===h.status?K=t[109]:(K=h.status===`error`&&(0,l.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:(0,l.jsx)(i,{id:`vvWZnu`})}),t[108]=h.status,t[109]=K);let q;t[110]!==_||t[111]!==Je||t[112]!==h.status?(q=h.status===`ready`&&_!==null&&(0,l.jsx)(je,{delta:_,open:Je,onOpenChange:e=>{Ye(e),qe(0)}}),t[110]=_,t[111]=Je,t[112]=h.status,t[113]=q):q=t[113];let J;t[114]!==g||t[115]!==f||t[116]!==y||t[117]!==h.after||t[118]!==h.diff||t[119]!==h.status?(J=h.status===`ready`&&(f===`rendered`&&y?.ok?(0,l.jsx)(Oe,{diff:y}):h.diff===``?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`border-b border-border px-4 py-2 text-xs text-muted-foreground italic`,children:g?(0,l.jsx)(i,{id:`oCO0pe`}):(0,l.jsx)(i,{id:`3YWddZ`})}),(0,l.jsx)(`pre`,{className:`whitespace-pre-wrap px-4 py-3 font-mono text-xs text-foreground/90`,children:h.after})]}):(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`EDm3wJ`})]}),children:(0,l.jsx)(Ne,{diff:h.diff,viewType:`unified`})})),t[114]=g,t[115]=f,t[116]=y,t[117]=h.after,t[118]=h.diff,t[119]=h.status,t[120]=J):J=t[120];let Y;t[121]!==G||t[122]!==K||t[123]!==q||t[124]!==J?(Y=(0,l.jsxs)(`div`,{ref:Ge,className:`min-h-0 flex-1 overflow-auto subtle-scrollbar`,children:[G,K,q,J]}),t[121]=G,t[122]=K,t[123]=q,t[124]=J,t[125]=Y):Y=t[125];let X;t[126]===m?X=t[127]:(X=e=>{!e&&!m?He(!1):e&&He(!0)},t[126]=m,t[127]=X);let Z;t[128]===s?Z=t[129]:(Z=s({id:`n3wx1q`}),t[128]=s,t[129]=Z);let Q;t[130]===Z?Q=t[131]:(Q=(0,l.jsx)(oe,{children:Z}),t[130]=Z,t[131]=Q);let gt;t[132]===d?gt=t[133]:(gt=(0,l.jsx)(i,{id:`nfPccR`,values:{laterEdits:d}}),t[132]=d,t[133]=gt);let _t;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,l.jsx)(i,{id:`5ZbJFS`}),t[134]=_t):_t=t[134];let vt;t[135]===gt?vt=t[136]:(vt=(0,l.jsxs)(ae,{children:[gt,` `,_t]}),t[135]=gt,t[136]=vt);let yt;t[137]!==Q||t[138]!==vt?(yt=(0,l.jsxs)(le,{children:[Q,vt]}),t[137]=Q,t[138]=vt,t[139]=yt):yt=t[139];let bt;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,l.jsx)(o,{variant:`outline`,"data-testid":`timeline-diff-restore-cancel`,onClick:()=>He(!1),children:(0,l.jsx)(i,{id:`dEgA5A`})}),t[140]=bt):bt=t[140];let xt;t[141]===x?xt=t[142]:(xt=()=>x(),t[141]=x,t[142]=xt);let St;t[143]===m?St=t[144]:(St=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-2 size-4`}):null,t[143]=m,t[144]=St);let Ct;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,l.jsx)(i,{id:`yKu_3Y`}),t[145]=Ct):Ct=t[145];let wt;t[146]!==m||t[147]!==xt||t[148]!==St?(wt=(0,l.jsxs)(ce,{children:[bt,(0,l.jsxs)(o,{variant:`destructive`,"data-testid":`timeline-diff-restore-confirm`,disabled:m,onClick:xt,children:[St,Ct]})]}),t[146]=m,t[147]=xt,t[148]=St,t[149]=wt):wt=t[149];let Tt;t[150]!==yt||t[151]!==wt?(Tt=(0,l.jsxs)(se,{children:[yt,wt]}),t[150]=yt,t[151]=wt,t[152]=Tt):Tt=t[152];let $;t[153]!==p||t[154]!==X||t[155]!==Tt?($=(0,l.jsx)(ue,{open:p,onOpenChange:X,children:Tt}),t[153]=p,t[154]=X,t[155]=Tt,t[156]=$):$=t[156];let Et;return t[157]!==W||t[158]!==Y||t[159]!==$?(Et=(0,l.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col bg-background`,"data-testid":`timeline-diff-pane`,children:[W,Y,$]}),t[157]=W,t[158]=Y,t[159]=$,t[160]=Et):Et=t[160],Et}function Pe(){return Se()}function Fe(){return new s(32)}export{u as TimelineDiffPane};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{En as n}from"./DocumentContext-B1SDm4sQ.js";import{t as r}from"./react-f2sANaYj.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{i as a,r as o,t as s}from"./cursor-Dp3I7a4x.js";import{t as c}from"./copilot-yXSa3JY-.js";var l=i(),u=t();function d(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Cline icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Cline icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 466.73 487.04`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function f(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Windsurf icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M21.3192 4.9697H21.1203C20.0734 4.96806 19.2238 5.81589 19.2238 6.86264V11.0961C19.2238 11.9415 18.525 12.6263 17.6934 12.6263C17.1993 12.6263 16.706 12.3777 16.4133 11.9603L12.0896 5.78492C11.7308 5.27214 11.1471 4.96643 10.5152 4.96643C9.52943 4.96643 8.64234 5.80448 8.64234 6.83902V11.0969C8.64234 11.9423 7.94932 12.6271 7.11197 12.6271C6.61625 12.6271 6.12376 12.3785 5.83105 11.9611L0.992853 5.0504C0.883594 4.89387 0.638184 4.97133 0.638184 5.1621V8.85424C0.638184 9.04094 0.695264 9.22193 0.802059 9.37517L5.56362 16.175C5.84492 16.5769 6.25994 16.8753 6.73852 16.9837C7.93627 17.256 9.03861 16.334 9.03861 15.1592V10.9037C9.03861 10.0583 9.7235 9.37354 10.569 9.37354H10.5714C11.081 9.37354 11.5588 9.62219 11.8515 10.0396L16.1761 16.2141C16.5356 16.7277 17.0892 17.0326 17.7497 17.0326C18.7574 17.0326 19.6209 16.1937 19.6209 15.16V10.9029C19.6209 10.0575 20.3058 9.37273 21.1512 9.37273H21.32C21.426 9.37273 21.5116 9.28713 21.5116 9.18116V5.16127C21.5116 5.05531 21.426 4.9697 21.32 4.9697H21.3192Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Windsurf icon`,xmlns:`http://www.w3.org/2000/svg`,width:22,height:22,viewBox:`0 0 22 22`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function p(e){let t=(0,l.c)(17),r,i;if(t[0]===e?(r=t[1],i=t[2]):({icon:r,...i}=e,t[0]=e,t[1]=r,t[2]=i),r===`claude`){let e;return t[3]===i?e=t[4]:(e=(0,u.jsx)(a,{...i}),t[3]=i,t[4]=e),e}if(r===`cursor`){let e;return t[5]===i?e=t[6]:(e=(0,u.jsx)(s,{...i}),t[5]=i,t[6]=e),e}if(r===`windsurf`){let e;return t[7]===i?e=t[8]:(e=(0,u.jsx)(f,{...i}),t[7]=i,t[8]=e),e}if(r===`openai`){let e;return t[9]===i?e=t[10]:(e=(0,u.jsx)(o,{...i}),t[9]=i,t[10]=e),e}if(r===`cline`){let e;return t[11]===i?e=t[12]:(e=(0,u.jsx)(d,{...i}),t[11]=i,t[12]=e),e}if(r===`github`){let e;return t[13]===i?e=t[14]:(e=(0,u.jsx)(c,{...i}),t[13]=i,t[14]=e),e}let p=i,m;return t[15]===p?m=t[16]:(m=(0,u.jsx)(n,{strokeWidth:1.5,...p}),t[15]=p,t[16]=m),m}var m=e(r(),1),h=null,g=new Set;function _(){for(let e of g)e()}function v(e){h=e,_()}function y(e){if(h===null)return;let t=Math.max(0,Math.min(e,h.maxVersions));t!==h.keptCount&&(h={...h,keptCount:t},_())}function b(e,t,n){if(h===null||h.agentId!==e||h.docName!==t||h.maxVersions===n)return;let r=h.keptCount===h.maxVersions?n:Math.min(h.keptCount,n);h={...h,maxVersions:n,keptCount:r},_()}function x(){h!==null&&(h=null,_())}function S(e){return g.add(e),()=>{g.delete(e)}}function C(){return h}function w(){return(0,m.useSyncExternalStore)(S,C,C)}export{w as a,b as i,v as n,p as o,y as r,x as t};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{En as n}from"./DocumentContext-D_2wOhha.js";import{t as r}from"./react-f2sANaYj.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{i as a,r as o,t as s}from"./cursor-Dp3I7a4x.js";import{t as c}from"./copilot-yXSa3JY-.js";var l=i(),u=t();function d(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Cline icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Cline icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 466.73 487.04`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function f(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Windsurf icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M21.3192 4.9697H21.1203C20.0734 4.96806 19.2238 5.81589 19.2238 6.86264V11.0961C19.2238 11.9415 18.525 12.6263 17.6934 12.6263C17.1993 12.6263 16.706 12.3777 16.4133 11.9603L12.0896 5.78492C11.7308 5.27214 11.1471 4.96643 10.5152 4.96643C9.52943 4.96643 8.64234 5.80448 8.64234 6.83902V11.0969C8.64234 11.9423 7.94932 12.6271 7.11197 12.6271C6.61625 12.6271 6.12376 12.3785 5.83105 11.9611L0.992853 5.0504C0.883594 4.89387 0.638184 4.97133 0.638184 5.1621V8.85424C0.638184 9.04094 0.695264 9.22193 0.802059 9.37517L5.56362 16.175C5.84492 16.5769 6.25994 16.8753 6.73852 16.9837C7.93627 17.256 9.03861 16.334 9.03861 15.1592V10.9037C9.03861 10.0583 9.7235 9.37354 10.569 9.37354H10.5714C11.081 9.37354 11.5588 9.62219 11.8515 10.0396L16.1761 16.2141C16.5356 16.7277 17.0892 17.0326 17.7497 17.0326C18.7574 17.0326 19.6209 16.1937 19.6209 15.16V10.9029C19.6209 10.0575 20.3058 9.37273 21.1512 9.37273H21.32C21.426 9.37273 21.5116 9.28713 21.5116 9.18116V5.16127C21.5116 5.05531 21.426 4.9697 21.32 4.9697H21.3192Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Windsurf icon`,xmlns:`http://www.w3.org/2000/svg`,width:22,height:22,viewBox:`0 0 22 22`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function p(e){let t=(0,l.c)(17),r,i;if(t[0]===e?(r=t[1],i=t[2]):({icon:r,...i}=e,t[0]=e,t[1]=r,t[2]=i),r===`claude`){let e;return t[3]===i?e=t[4]:(e=(0,u.jsx)(a,{...i}),t[3]=i,t[4]=e),e}if(r===`cursor`){let e;return t[5]===i?e=t[6]:(e=(0,u.jsx)(s,{...i}),t[5]=i,t[6]=e),e}if(r===`windsurf`){let e;return t[7]===i?e=t[8]:(e=(0,u.jsx)(f,{...i}),t[7]=i,t[8]=e),e}if(r===`openai`){let e;return t[9]===i?e=t[10]:(e=(0,u.jsx)(o,{...i}),t[9]=i,t[10]=e),e}if(r===`cline`){let e;return t[11]===i?e=t[12]:(e=(0,u.jsx)(d,{...i}),t[11]=i,t[12]=e),e}if(r===`github`){let e;return t[13]===i?e=t[14]:(e=(0,u.jsx)(c,{...i}),t[13]=i,t[14]=e),e}let p=i,m;return t[15]===p?m=t[16]:(m=(0,u.jsx)(n,{strokeWidth:1.5,...p}),t[15]=p,t[16]=m),m}var m=e(r(),1),h=null,g=new Set;function _(){for(let e of g)e()}function v(e){h=e,_()}function y(e){if(h===null)return;let t=Math.max(0,Math.min(e,h.maxVersions));t!==h.keptCount&&(h={...h,keptCount:t},_())}function b(e,t,n){if(h===null||h.agentId!==e||h.docName!==t||h.maxVersions===n)return;let r=h.keptCount===h.maxVersions?n:Math.min(h.keptCount,n);h={...h,maxVersions:n,keptCount:r},_()}function x(){h!==null&&(h=null,_())}function S(e){return g.add(e),()=>{g.delete(e)}}function C(){return h}function w(){return(0,m.useSyncExternalStore)(S,C,C)}export{w as a,b as i,v as n,p as o,y as r,x as t};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Mn as n,Wn as r,a as i,qn as a}from"./DocumentContext-B1SDm4sQ.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./compiler-runtime-BfE3aGVn.js";import{a as u,o as d,r as f}from"./local-menu-action-bus-Cypryz6Z.js";import{t as p}from"./utils-CPqDy6Hr.js";import{_ as m,a as h,g,i as _}from"./ChangedOutsideBadge-BLRjUkdG.js";import{t as v}from"./button-CA0dewJJ.js";import{i as y,n as b,t as x}from"./tooltip-DHXgxWLL.js";import{a as S,c as C,i as w,n as T,o as E,s as D,t as O}from"./dialog-HdfR4WGm.js";import{a as k,m as A,r as j,t as M}from"./dropdown-menu-CLgDYkh1.js";import{t as N}from"./label-B5yNUINo.js";import{n as P,t as F}from"./radio-group-BSCe7mNt.js";import{t as I}from"./switch-B2sF5R0q.js";import{n as L,t as R}from"./toggle-group-CZcn-1gX.js";import{Ao as z,Bt as B,Cs as ee,Do as V,Ht as H,Lt as U,Rt as W,Yt as G,fs as te,us as K,yt as q,zt as ne}from"./dist-C771h__g.js";import{t as J}from"./dist-DUfEoSbR.js";import{n as re}from"./dist-B6jB2qbD2.js";import{_ as ie,s as Y,y as ae}from"./documents-events-Bb6poN70.js";import{h as oe}from"./use-apply-config-color-theme-loDqT2Gp.js";import{t as X}from"./parse-api-error-DfesE4Y7.js";import{t as se}from"./use-workspace-DeC16-uw.js";import{t as ce}from"./createLucideIcon-Bhw2PmPp.js";import{f as le,n as ue,r as de,t as fe}from"./EnableSyncConfirmDialog-Bw4F9X5A.js";import{s as pe}from"./Mermaid-ukCAxO5k.js";import{t as me}from"./arrow-up-right-CGe6dTck.js";import{t as he}from"./check-CGfmW4da.js";import{n as ge}from"./CopyButton-CKyZY1PL.js";import{s as _e}from"./prop-types-B-pqwsrL.js";import{t as ve}from"./download-Dn5ulvxm.js";import{a as ye,r as be,t as xe}from"./folder-config-api-CwUBSjSc.js";import{t as Se}from"./spinner-BxJv3FRl.js";import{t as Ce}from"./refresh-cw-CcQnr_fh.js";import{t as we}from"./trash-2-Co21mefL.js";import{t as Te}from"./triangle-alert-CRXAJBn4.js";import{t as Ee}from"./x-DddVxTPq.js";import{f as De,n as Oe,u as ke,v as Ae}from"./doc-paths-D4mBEiVg.js";import{t as je}from"./input-lp6-d0mX.js";import{a as Me,i as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./field-DpnmTdW9.js";import"./config-provider-DAb1AnMo.js";import{x as ze}from"./skills-api-4MJqui79.js";import{t as Be}from"./external-link-DGqXfQJy.js";import{n as Ve,t as He}from"./clipboard-adapter-DqemxSWT.js";import{t as Ue}from"./textarea-dRxJ8TN6.js";var We=ce(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ge=ce(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Ke=ce(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),qe=ce(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),Je=ce(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Ye=ce(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=l(),Q=e(o(),1);function Xe(e){let t=(0,Z.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return ae(()=>{o(et)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,Q.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(Qe).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:J._({id:`_ci9Bj`})});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,Q.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(Ze),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function Ze(e){return e+1}async function Qe(e){if(!e.ok){let t=await e.json().catch($e);throw Error(X(t)??`HTTP ${e.status}`)}return e.json()}function $e(){return null}function et(e){return e+1}function tt(){let e=(0,Z.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>ae(()=>{a(it)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,Q.useEffect)(o,s);let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/templates`).then(nt).then(t=>{if(e)return;let n=G.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:J._({id:`RLNIgv`})});return}r({status:`ready`,data:n.data.templates})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let l;return e[4]===i?l=e[5]:(l=[i],e[4]=i,e[5]=l),(0,Q.useEffect)(c,l),n}async function nt(e){if(!e.ok){let t=await e.json().catch(rt);throw Error(X(t)??`HTTP ${e.status}`)}return e.json()}function rt(){return null}function it(e){return e+1}async function at(){try{let e=await fetch(`/api/semantic-status`);return e.ok?await e.json():(console.debug(`[semantic-status] probe returned`,e.status),null)}catch(e){return console.debug(`[semantic-status] probe failed`,e),null}}function ot(e){let t=(0,Z.c)(16),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n.enabled??!0,[i,a]=(0,Q.useState)(null),o;t[2]===r?o=t[3]:(o=function(){r&&at().then(e=>{e&&a(e)})},t[2]=r,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=()=>{s()},t[4]=s,t[5]=c);let l;t[6]===r?l=t[7]:(l=[r],t[6]=r,t[7]=l),(0,Q.useEffect)(c,l);let u;t[8]!==r||t[9]!==s?(u=()=>{if(r)return ie(e=>{e.includes(`files`)&&s()})},t[8]=r,t[9]=s,t[10]=u):u=t[10];let d;t[11]===r?d=t[12]:(d=[r],t[11]=r,t[12]=d),(0,Q.useEffect)(u,d);let f;return t[13]!==s||t[14]!==i?(f={status:i,refresh:s},t[13]=s,t[14]=i,t[15]=f):f=t[15],f}var $=t(),st=`github.com`,ct=new Map;async function lt(e){try{let t=await e.json(),n=q.safeParse(t);if(n.success)return n.data.title}catch{}}async function ut(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function dt(e){let t=e?.host??st,n=await ut(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await lt(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t,a=r.ghAvailable===!0;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0,ghAvailable:a}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0,ghAvailable:a}}function ft(e){let t=e?.host??st,n=ct.get(t);if(n)return n;let r=dt(e).finally(()=>{ct.delete(t)});return ct.set(t,r),r}function pt(e){let t=e.split(`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Mn as n,Wn as r,a as i,qn as a}from"./DocumentContext-D_2wOhha.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./compiler-runtime-BfE3aGVn.js";import{a as u,o as d,r as f}from"./local-menu-action-bus-Cypryz6Z.js";import{t as p}from"./utils-CPqDy6Hr.js";import{_ as m,a as h,g,i as _}from"./ChangedOutsideBadge-CWPuWvsE.js";import{t as v}from"./button-CA0dewJJ.js";import{i as y,n as b,t as x}from"./tooltip-DHXgxWLL.js";import{a as S,c as C,i as w,n as T,o as E,s as D,t as O}from"./dialog-HdfR4WGm.js";import{a as k,m as A,r as j,t as M}from"./dropdown-menu-CLgDYkh1.js";import{t as N}from"./label-B5yNUINo.js";import{n as P,t as F}from"./radio-group-BSCe7mNt.js";import{t as I}from"./switch-B2sF5R0q.js";import{n as L,t as R}from"./toggle-group-CZcn-1gX.js";import{Ao as z,Bt as B,Cs as ee,Do as V,Ht as H,Lt as U,Rt as W,Yt as G,fs as te,us as K,yt as q,zt as ne}from"./dist-C771h__g.js";import{t as J}from"./dist-DUfEoSbR.js";import{n as re}from"./dist-B6jB2qbD2.js";import{_ as ie,s as Y,y as ae}from"./documents-events-Bb6poN70.js";import{h as oe}from"./use-apply-config-color-theme-loDqT2Gp.js";import{t as X}from"./parse-api-error-DfesE4Y7.js";import{t as se}from"./use-workspace-DeC16-uw.js";import{t as ce}from"./createLucideIcon-Bhw2PmPp.js";import{f as le,n as ue,r as de,t as fe}from"./EnableSyncConfirmDialog-Bw4F9X5A.js";import{s as pe}from"./Mermaid-ukCAxO5k.js";import{t as me}from"./arrow-up-right-CGe6dTck.js";import{t as he}from"./check-CGfmW4da.js";import{n as ge}from"./CopyButton-CKyZY1PL.js";import{s as _e}from"./prop-types-DQ8_DMD-.js";import{t as ve}from"./download-Dn5ulvxm.js";import{a as ye,r as be,t as xe}from"./folder-config-api-CwUBSjSc.js";import{t as Se}from"./spinner-BxJv3FRl.js";import{t as Ce}from"./refresh-cw-CcQnr_fh.js";import{t as we}from"./trash-2-Co21mefL.js";import{t as Te}from"./triangle-alert-CRXAJBn4.js";import{t as Ee}from"./x-DddVxTPq.js";import{f as De,n as Oe,u as ke,y as Ae}from"./doc-paths-D-8nN6rk.js";import{t as je}from"./input-lp6-d0mX.js";import{a as Me,i as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./field-DpnmTdW9.js";import"./config-provider-DAb1AnMo.js";import{x as ze}from"./skills-api-4MJqui79.js";import{t as Be}from"./external-link-DGqXfQJy.js";import{n as Ve,t as He}from"./clipboard-adapter-DqemxSWT.js";import{t as Ue}from"./textarea-dRxJ8TN6.js";var We=ce(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ge=ce(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Ke=ce(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),qe=ce(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),Je=ce(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Ye=ce(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=l(),Q=e(o(),1);function Xe(e){let t=(0,Z.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return ae(()=>{o(et)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,Q.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(Qe).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:J._({id:`_ci9Bj`})});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,Q.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(Ze),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function Ze(e){return e+1}async function Qe(e){if(!e.ok){let t=await e.json().catch($e);throw Error(X(t)??`HTTP ${e.status}`)}return e.json()}function $e(){return null}function et(e){return e+1}function tt(){let e=(0,Z.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>ae(()=>{a(it)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,Q.useEffect)(o,s);let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/templates`).then(nt).then(t=>{if(e)return;let n=G.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:J._({id:`RLNIgv`})});return}r({status:`ready`,data:n.data.templates})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let l;return e[4]===i?l=e[5]:(l=[i],e[4]=i,e[5]=l),(0,Q.useEffect)(c,l),n}async function nt(e){if(!e.ok){let t=await e.json().catch(rt);throw Error(X(t)??`HTTP ${e.status}`)}return e.json()}function rt(){return null}function it(e){return e+1}async function at(){try{let e=await fetch(`/api/semantic-status`);return e.ok?await e.json():(console.debug(`[semantic-status] probe returned`,e.status),null)}catch(e){return console.debug(`[semantic-status] probe failed`,e),null}}function ot(e){let t=(0,Z.c)(16),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n.enabled??!0,[i,a]=(0,Q.useState)(null),o;t[2]===r?o=t[3]:(o=function(){r&&at().then(e=>{e&&a(e)})},t[2]=r,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=()=>{s()},t[4]=s,t[5]=c);let l;t[6]===r?l=t[7]:(l=[r],t[6]=r,t[7]=l),(0,Q.useEffect)(c,l);let u;t[8]!==r||t[9]!==s?(u=()=>{if(r)return ie(e=>{e.includes(`files`)&&s()})},t[8]=r,t[9]=s,t[10]=u):u=t[10];let d;t[11]===r?d=t[12]:(d=[r],t[11]=r,t[12]=d),(0,Q.useEffect)(u,d);let f;return t[13]!==s||t[14]!==i?(f={status:i,refresh:s},t[13]=s,t[14]=i,t[15]=f):f=t[15],f}var $=t(),st=`github.com`,ct=new Map;async function lt(e){try{let t=await e.json(),n=q.safeParse(t);if(n.success)return n.data.title}catch{}}async function ut(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function dt(e){let t=e?.host??st,n=await ut(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await lt(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t,a=r.ghAvailable===!0;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0,ghAvailable:a}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0,ghAvailable:a}}function ft(e){let t=e?.host??st,n=ct.get(t);if(n)return n;let r=dt(e).finally(()=>{ct.delete(t)});return ct.set(t,r),r}function pt(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 mt(){return{status:ft,async repos(e){let t=e?.host??`github.com`,n=await ut(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:await lt(n)??J._({id:`sGZLfB`})};let r=pt(await n.text());if(r&&r.type===`error`&&r.problem&&typeof r.problem==`object`){let e=r.problem;return{ok:!1,error:e.detail||e.title||J._({id:`sGZLfB`})}}if(!r||!Array.isArray(r.repos))return{ok:!1,error:J._({id:`sGZLfB`})};let i=[];for(let e of r.repos){let t=e;typeof t?.full_name==`string`&&typeof t.clone_url==`string`&&i.push({full_name:t.full_name,clone_url:t.clone_url,private:t.private===!0})}return{ok:!0,host:typeof r.host==`string`?r.host:t,repos:i}},async signout(e){let t=await ut(`/api/local-op/auth/signout`,e);return t.ok?{ok:!0}:{ok:!1,error:await lt(t)}}}}function ht(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function gt(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 _t(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 vt=2e3,yt=1e4;function bt(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 xt(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 St(e,t,n,r){let i=mt(),a=vt;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 bt(a,t),a=Math.min(a*1.5,yt)}t.aborted||e({type:`error`,message:J._({id:`ve8vEM`})})}function Ct(e,t,n){let r=!1,i=_t((n,i)=>{let a=e=>{(e.type===`complete`||e.type===`error`)&&(r=!0),n(e)};(async()=>{let n=null;try{let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:i});if(!r.ok){let e=J._({id:`LnVIW4`});try{let t=q.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}a({type:`error`,message:e});return}if(!r.body){a({type:`error`,message:J._({id:`LnVIW4`})});return}if(await gt(r.body,e=>{let t;try{t=JSON.parse(e)}catch{return console.warn(`[auth-transport] Dropped unparseable NDJSON line:`,e.slice(0,100)),`continue`}if(t&&typeof t==`object`&&t.type===`error`&&`problem`in t){let e=t.problem;return a({type:`error`,message:e?.detail||e?.title||J._({id:`29VNqC`})}),`terminal`}if(t.type===`ping`)return`continue`;let r=t;return r.type===`verification`&&(n=Date.now()+r.expires_in*1e3),a(r),r.type===`complete`||r.type===`error`?`terminal`:`continue`})||i.aborted)return;if(n===null){a({type:`error`,message:J._({id:`DskIkK`})});return}await St(a,i,n,t.host)}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;if(n!==null){await St(a,i,n,t.host);return}a({type:`error`,message:J._({id:`Q5fqMz`})})}})()});return{events:i.events,cancel:()=>{r||xt(n),i.cancel()}}}function wt(){return{start(){return Ct(`/api/local-op/auth/login`,{json:!0},`login`)},ghLogin(e){return Ct(`/api/local-op/auth/gh-login`,{host:e,json:!0},`gh-login`)},async pat(e,t){try{let n=await fetch(`/api/local-op/auth/pat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({host:e,token:t})});if(n.ok){let e=await n.json();return{ok:!0,login:typeof e.login==`string`?e.login:``}}let r=J._({id:`sNeKjP`});try{let e=q.safeParse(await n.json());e.success&&(r=e.data.detail||e.data.title)}catch{}return{ok:!1,error:r}}catch{return{ok:!1,error:J._({id:`Q5fqMz`})}}}}}function Tt(e){return{start(){return e.localOp.auth.start()}}}async function Et(e){try{await navigator.clipboard.writeText(e)}catch{}}function Dt(e){let t=(0,Z.c)(25),{onSuccess:n,startFlow:r}=e,{_:i}=c(),[a,o]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(`https://github.com/login/device`),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,y]=(0,Q.useState)(0),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S;t[0]!==i||t[1]!==n||t[2]!==r?(S=async function(){m(null);try{let e=r();b.current=e.cancel;let t=e.events[Symbol.asyncIterator](),a=!1,s=await t.next();for(;!s.done;){let e=s.value;if(e.type===`verification`)o(e.user_code),u(e.verification_uri),g(Date.now()+e.expires_in*1e3),y(e.expires_in*1e3),Et(e.user_code).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)});else if(e.type===`complete`){a=!0,n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){a=!0,m(e.message);break}s=await t.next()}a||m(i({id:`DskIkK`}))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&m(i({id:`Q5fqMz`}))}},t[0]=i,t[1]=n,t[2]=r,t[3]=S):S=t[3];let C=S,w;t[4]===C?w=t[5]:(w=()=>{let e=!1;return queueMicrotask(()=>{e||C()}),()=>{e=!0,b.current?.(),b.current=null,x.current&&clearInterval(x.current)}},t[4]=C,t[5]=w);let T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[6]=T):T=t[6],(0,Q.useEffect)(w,T);let E,D;t[7]!==i||t[8]!==h?(E=()=>{if(h!==null)return x.current=setInterval(()=>{let e=h-Date.now();e<=0?(y(0),x.current&&clearInterval(x.current),m(i({id:`ve8vEM`}))):y(e)},1e3),()=>{x.current&&clearInterval(x.current)}},D=[h,i],t[7]=i,t[8]=h,t[9]=E,t[10]=D):(E=t[9],D=t[10]),(0,Q.useEffect)(E,D);let O=Math.floor(_/6e4),k=Math.floor(_%6e4/1e3),A;t[11]===k?A=t[12]:(A=k.toString().padStart(2,`0`),t[11]=k,t[12]=A);let j=`${O}:${A}`,M;t[13]!==i||t[14]!==d||t[15]!==p||t[16]!==j||t[17]!==a||t[18]!==l?(M=a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`eVPynQ`,values:{verificationUri:l},components:{0:(0,$.jsx)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Be(e,l),onAuxClick:e=>Be(e,l),className:`inline-flex items-center gap-0.5 text-foreground hover:text-primary hover:underline`}),1:(0,$.jsx)(`span`,{}),2:(0,$.jsx)(me,{className:`inline size-3.5`,"aria-hidden":!0})}})}),(0,$.jsxs)(v,{type:`button`,variant:`outline`,"aria-label":i({id:`nCzR-G`,values:{userCode:a}}),onClick:()=>void Et(a).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)}),className:`relative h-auto w-full justify-center rounded-md bg-muted px-12 py-3 hover:bg-muted/80`,children:[(0,$.jsx)(`code`,{className:`font-mono text-2xl font-bold tracking-widest`,children:a}),(0,$.jsx)(`span`,{className:`absolute right-3 text-muted-foreground`,"aria-hidden":`true`,children:d?(0,$.jsx)(he,{className:`size-4`}):(0,$.jsx)(ge,{className:`size-4`})})]}),(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:d?(0,$.jsx)(s,{id:`80c4-P`}):null}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),(0,$.jsx)(s,{id:`5y_9lO`})]}),(0,$.jsx)(`span`,{children:(0,$.jsx)(s,{id:`gYz2ep`,values:{timeLabel:j}})})]})]}):(0,$.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:p?null:(0,$.jsx)(s,{id:`aWlJai`})}),t[13]=i,t[14]=d,t[15]=p,t[16]=j,t[17]=a,t[18]=l,t[19]=M):M=t[19];let N;t[20]===p?N=t[21]:(N=p&&(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,children:p}),t[20]=p,t[21]=N);let P;return t[22]!==M||t[23]!==N?(P=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[M,N]}),t[22]=M,t[23]=N,t[24]=P):P=t[24],P}function Ot(e){let t=(0,Z.c)(30),{login:n,name:r,onNameChange:i,email:a,onEmailChange:o}=e,{_:l}=c(),u;t[0]===n?u=t[1]:(u=(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:(0,$.jsx)(s,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=u);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`gp3I7-`})}),t[2]=d):d=t[2];let f;t[3]===l?f=t[4]:(f=l({id:`6YtxFj`}),t[3]=l,t[4]=f);let p;t[5]!==l||t[6]!==n?(p=l({id:`J2Mv98`,values:{login:n}}),t[5]=l,t[6]=n,t[7]=p):p=t[7];let m;t[8]===i?m=t[9]:(m=e=>i(e.target.value),t[8]=i,t[9]=m);let h;t[10]!==r||t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,$.jsx)(je,{"aria-label":f,placeholder:p,value:r,onChange:m}),t[10]=r,t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===l?g=t[16]:(g=l({id:`O3oNi5`}),t[15]=l,t[16]=g);let _;t[17]===l?_=t[18]:(_=l({id:`O3oNi5`}),t[17]=l,t[18]=_);let v;t[19]===o?v=t[20]:(v=e=>o(e.target.value),t[19]=o,t[20]=v);let y;t[21]!==a||t[22]!==g||t[23]!==_||t[24]!==v?(y=(0,$.jsx)(je,{type:`email`,"aria-label":g,placeholder:_,value:a,onChange:v}),t[21]=a,t[22]=g,t[23]=_,t[24]=v,t[25]=y):y=t[25];let b;return t[26]!==u||t[27]!==y||t[28]!==h?(b=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u,d,h,y]}),t[26]=u,t[27]=y,t[28]=h,t[29]=b):b=t[29],b}function kt(e){let t=(0,Z.c)(37),{host:n,token:r,onTokenChange:i,error:a,onSubmit:o,showGhOption:l,onGhSignIn:u}=e,{_:d}=c(),f=`https://${n}/settings/tokens/new?scopes=repo,read:user&description=OpenKnowledge`,p;t[0]!==n||t[1]!==u||t[2]!==l?(p=l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(v,{type:`button`,onClick:u,children:(0,$.jsx)(s,{id:`_SDGzH`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,$.jsx)(s,{id:`8L0EPw`}),(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`})]})]}):(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`8k6INX`,values:{host:n},components:{0:(0,$.jsx)(`span`,{className:`font-medium text-foreground`})}})}),t[0]=n,t[1]=u,t[2]=l,t[3]=p):p=t[3];let m,h;t[4]===f?(m=t[5],h=t[6]):(m=e=>Be(e,f),h=e=>Be(e,f),t[4]=f,t[5]=m,t[6]=h);let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(s,{id:`6hYjww`,values:{host:n}}),t[7]=n,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(me,{className:`inline size-3.5`,"aria-hidden":!0}),t[9]=_):_=t[9];let y;t[10]!==f||t[11]!==m||t[12]!==h||t[13]!==g?(y=(0,$.jsxs)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,onClick:m,onAuxClick:h,className:`inline-flex w-fit items-center gap-0.5 text-sm text-foreground hover:text-primary hover:underline`,children:[g,_]}),t[10]=f,t[11]=m,t[12]=h,t[13]=g,t[14]=y):y=t[14];let b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(s,{id:`Xg-Ntj`})}),t[15]=b):b=t[15];let x;t[16]===d?x=t[17]:(x=d({id:`p2LEhJ`}),t[16]=d,t[17]=x);let S;t[18]===i?S=t[19]:(S=e=>i(e.target.value),t[18]=i,t[19]=S);let C;t[20]===o?C=t[21]:(C=e=>{e.key===`Enter`&&o()},t[20]=o,t[21]=C);let w;t[22]!==C||t[23]!==x||t[24]!==S||t[25]!==r?(w=(0,$.jsx)(je,{type:`password`,"aria-label":x,placeholder:`ghp_`,value:r,onChange:S,onKeyDown:C}),t[22]=C,t[23]=x,t[24]=S,t[25]=r,t[26]=w):w=t[26];let T;t[27]===a?T=t[28]:(T=a&&(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,children:a}),t[27]=a,t[28]=T);let E;t[29]===l?E=t[30]:(E=!l&&(0,$.jsxs)(`div`,{className:`mt-1 rounded-md border border-border/60 bg-muted/40 p-3 text-sm text-muted-foreground`,children:[(0,$.jsx)(`p`,{children:(0,$.jsx)(s,{id:`qX-ABr`})}),(0,$.jsxs)(`ol`,{className:`mt-1.5 list-decimal space-y-0.5 pl-5`,children:[(0,$.jsx)(`li`,{children:(0,$.jsx)(s,{id:`jxtXZI`})}),(0,$.jsx)(`li`,{children:(0,$.jsx)(s,{id:`9Vh9Jf`})})]})]}),t[29]=l,t[30]=E);let D;return t[31]!==p||t[32]!==w||t[33]!==T||t[34]!==E||t[35]!==y?(D=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[p,y,b,w,T,E]}),t[31]=p,t[32]=w,t[33]=T,t[34]=E,t[35]=y,t[36]=D):D=t[36],D}var At=1e4;function jt(e){let t=(0,Z.c)(92),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:l,queryTransport:u,host:d,ghAvailable:f}=e,{_:p}=c(),m;t[0]===l?m=t[1]:(m=l??wt(),t[0]=l,t[1]=m);let h=m,g;t[2]===u?g=t[3]:(g=u??mt(),t[2]=u,t[3]=g);let _=g,[y,b]=(0,Q.useState)(`auth`),[x,S]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(``),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(void 0),[ee,V]=(0,Q.useState)(void 0),H=d??z,U=!!H&&H!==`github.com`&&!!(f??ee)&&typeof h.ghLogin==`function`,W=!a&&d===void 0,G,te;t[4]!==d||t[5]!==a||t[6]!==W||t[7]!==n?(G=()=>{n&&(S(null),A(``),M(``),P(``),I(null),R(!1),B(void 0),V(void 0),b(a||W?`checking`:d&&d!==`github.com`?`pat`:`auth`))},te=[n,a,d,W],t[4]=d,t[5]=a,t[6]=W,t[7]=n,t[8]=G,t[9]=te):(G=t[8],te=t[9]),(0,Q.useLayoutEffect)(G,te);let K;t[10]!==a||t[11]!==n||t[12]!==_?(K=()=>{if(!n||!a)return;let e=!1,t=t=>{e||(e=!0,b(t))},r=setTimeout(()=>t(`auth`),At);return _.status().then(n=>{e||(n.authenticated?(S({login:n.login,name:n.name,email:n.email}),A(n.name??``),M(n.email??``),t(`identity`)):t(`auth`))}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[10]=a,t[11]=n,t[12]=_,t[13]=K):K=t[13];let q;t[14]!==a||t[15]!==n?(q=[n,a],t[14]=a,t[15]=n,t[16]=q):q=t[16],(0,Q.useEffect)(K,q);let ne;t[17]!==W||t[18]!==n||t[19]!==_?(ne=()=>{if(!n||!W)return;let e=!1,t=t=>{e||(e=!0,b(t))},r=setTimeout(()=>t(`auth`),At);return _.status().then(n=>{if(e)return;let r=!!n.host&&n.host!==`github.com`;B(n.host),V(n.ghAvailable),t(r?`pat`:`auth`)}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[17]=W,t[18]=n,t[19]=_,t[20]=ne):ne=t[20];let J;t[21]!==W||t[22]!==n?(J=[n,W],t[21]=W,t[22]=n,t[23]=J):J=t[23],(0,Q.useEffect)(ne,J);let ie;t[24]!==p||t[25]!==a||t[26]!==r||t[27]!==i?(ie=function(e){if(S(e),a)A(e.name??``),M(e.email??``),b(`identity`);else{b(`done`),i?.(e),r(!1);let t=e.login;re.success(p(t?{id:`E_tNGD`,values:{login:t}}:{id:`cgl-gn`}))}},t[24]=p,t[25]=a,t[26]=r,t[27]=i,t[28]=ie):ie=t[28];let Y=ie,ae;t[29]!==p||t[30]!==H||t[31]!==Y||t[32]!==L||t[33]!==N||t[34]!==h?(ae=async function(){let e=N.trim();if(!e||!H||L)return;if(!h.pat){I(p({id:`iMYFJM`}));return}R(!0),I(null);let t=await h.pat(H,e);R(!1),t.ok?Y({login:t.login??``}):I(t.error??p({id:`sNeKjP`}))},t[29]=p,t[30]=H,t[31]=Y,t[32]=L,t[33]=N,t[34]=h,t[35]=ae):ae=t[35];let oe=ae,X;t[36]!==p||t[37]!==x||t[38]!==r||t[39]!==i?(X=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(Mt);let n={...x??{login:``},name:e,email:t};b(`done`),i?.(n),r(!1);let a=n.login;re.success(p(a?{id:`E_tNGD`,values:{login:a}}:{id:`cgl-gn`}))},t[36]=p,t[37]=x,t[38]=r,t[39]=i,t[40]=X):X=t[40];let se=X,ce;t[41]!==p||t[42]!==x||t[43]!==r||t[44]!==i?(ce=function(){if(!x)return;b(`done`),i?.(x),r(!1);let e=x.login;re.success(p(e?{id:`E_tNGD`,values:{login:e}}:{id:`cgl-gn`}))},t[41]=p,t[42]=x,t[43]=r,t[44]=i,t[45]=ce):ce=t[45];let le=ce,ue;t[46]===r?ue=t[47]:(ue=function(){r(!1)},t[46]=r,t[47]=ue);let de=ue,fe;t[48]!==a||t[49]!==o||t[50]!==y?(fe=(0,$.jsx)(D,{children:(0,$.jsx)(C,{children:o&&(y===`pat`||y===`gh-device`)?(0,$.jsx)(s,{id:`DUWgfT`}):o?(0,$.jsx)(s,{id:`X8kjQX`}):y===`pat`||y===`gh-device`?(0,$.jsx)(s,{id:`tzZ6ha`}):a&&y!==`auth`?(0,$.jsx)(s,{id:`29XZXN`}):(0,$.jsx)(s,{id:`3jod3l`})})}),t[48]=a,t[49]=o,t[50]=y,t[51]=fe):fe=t[51];let pe;t[52]===y?pe=t[53]:(pe=y===`checking`&&(0,$.jsx)(T,{children:(0,$.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`gBbxn_`})})}),t[52]=y,t[53]=pe);let me;t[54]!==Y||t[55]!==de||t[56]!==h||t[57]!==y?(me=y===`auth`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{children:(0,$.jsx)(Dt,{onSuccess:Y,startFlow:()=>h.start()})}),(0,$.jsx)(E,{children:(0,$.jsx)(v,{variant:`outline`,className:`font-mono uppercase`,onClick:de,children:(0,$.jsx)(s,{id:`dEgA5A`})})})]}),t[54]=Y,t[55]=de,t[56]=h,t[57]=y,t[58]=me):me=t[58];let he;t[59]!==U||t[60]!==H||t[61]!==de||t[62]!==oe||t[63]!==F||t[64]!==L||t[65]!==N||t[66]!==y?(he=y===`pat`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{children:(0,$.jsx)(kt,{host:H??``,token:N,onTokenChange:P,error:F,onSubmit:oe,showGhOption:U,onGhSignIn:()=>b(`gh-device`)})}),(0,$.jsxs)(E,{children:[(0,$.jsx)(v,{variant:`outline`,className:`font-mono uppercase`,onClick:de,children:(0,$.jsx)(s,{id:`dEgA5A`})}),(0,$.jsx)(v,{onClick:oe,disabled:!N.trim()||L,children:L?(0,$.jsx)(s,{id:`9zb2WA`}):(0,$.jsx)(s,{id:`iSLIjg`})})]})]}),t[59]=U,t[60]=H,t[61]=de,t[62]=oe,t[63]=F,t[64]=L,t[65]=N,t[66]=y,t[67]=he):he=t[67];let ge;t[68]!==H||t[69]!==Y||t[70]!==de||t[71]!==h||t[72]!==y?(ge=y===`gh-device`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{children:(0,$.jsx)(Dt,{onSuccess:Y,startFlow:()=>h.ghLogin?.(H??``)??h.start()})}),(0,$.jsxs)(E,{children:[(0,$.jsx)(v,{variant:`ghost`,onClick:()=>b(`pat`),children:(0,$.jsx)(s,{id:`hLKfZe`})}),(0,$.jsx)(v,{variant:`outline`,className:`font-mono uppercase`,onClick:de,children:(0,$.jsx)(s,{id:`dEgA5A`})})]})]}),t[68]=H,t[69]=Y,t[70]=de,t[71]=h,t[72]=y,t[73]=ge):ge=t[73];let _e;t[74]!==x||t[75]!==se||t[76]!==le||t[77]!==j||t[78]!==k||t[79]!==y?(_e=y===`identity`&&x&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{children:(0,$.jsx)(Ot,{login:x.login,name:k,onNameChange:A,email:j,onEmailChange:M})}),(0,$.jsxs)(E,{children:[(0,$.jsx)(v,{variant:`ghost`,onClick:le,children:(0,$.jsx)(s,{id:`6Uau97`})}),(0,$.jsx)(v,{onClick:()=>se(k.trim(),j.trim()),disabled:!k.trim()||!j.trim(),children:(0,$.jsx)(s,{id:`tfDRzk`})})]})]}),t[74]=x,t[75]=se,t[76]=le,t[77]=j,t[78]=k,t[79]=y,t[80]=_e):_e=t[80];let ve;t[81]!==fe||t[82]!==pe||t[83]!==me||t[84]!==he||t[85]!==ge||t[86]!==_e?(ve=(0,$.jsxs)(w,{className:`sm:max-w-md`,children:[fe,pe,me,he,ge,_e]}),t[81]=fe,t[82]=pe,t[83]=me,t[84]=he,t[85]=ge,t[86]=_e,t[87]=ve):ve=t[87];let ye;return t[88]!==r||t[89]!==n||t[90]!==ve?(ye=(0,$.jsx)(O,{open:n,onOpenChange:r,children:ve}),t[88]=r,t[89]=n,t[90]=ve,t[91]=ye):ye=t[91],ye}function Mt(){}function Nt(e){let t=(0,Z.c)(16),{value:n,onChange:r,disabled:i,placeholder:a,rows:o}=e,c=i===void 0?!1:i,l=o===void 0?12:o,u=(0,Q.useId)(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(s,{id:`3o3tur`}),t[0]=d):d=t[0];let f;t[1]===u?f=t[2]:(f=(0,$.jsx)(Fe,{htmlFor:u,children:d}),t[1]=u,t[2]=f);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(Ie,{children:(0,$.jsx)(s,{id:`5gr_ev`,values:{dateToken:`{{date}}`,userToken:`{{user}}`},components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}),t[3]=p):p=t[3];let m;t[4]===r?m=t[5]:(m=e=>r(e.target.value),t[4]=r,t[5]=m);let h;t[6]!==c||t[7]!==u||t[8]!==a||t[9]!==l||t[10]!==m||t[11]!==n?(h=(0,$.jsx)(Ue,{id:u,value:n,onChange:m,disabled:c,rows:l,spellCheck:!1,placeholder:a,className:`font-mono text-xs leading-relaxed min-h-72`}),t[6]=c,t[7]=u,t[8]=a,t[9]=l,t[10]=m,t[11]=n,t[12]=h):h=t[12];let g;return t[13]!==f||t[14]!==h?(g=(0,$.jsxs)(Re,{children:[f,p,h]}),t[13]=f,t[14]=h,t[15]=g):g=t[15],g}var Pt=/^[A-Za-z0-9_-]+$/;function Ft(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function It(e){let t={},n=e.title.trim();n&&(t.title=n);let r=e.description.trim();return r&&(t.description=r),t}var Lt=0;function Rt(){return Lt+=1,`prop-${Lt}`}function zt(e){let{frontmatter:t,body:n}=V(e);if(t===``)return{type:``,properties:[],markdown:e};let r=[];for(let e of z(t).split(`
4
4
  `)){if(e.trim()===``)continue;let t=e.indexOf(`:`);if((/^\s/.test(e)||t===-1)&&r.length>0){let t=r[r.length-1];t&&(t.value+=`\n${e}`);continue}t!==-1&&r.push({key:e.slice(0,t).trim(),value:e.slice(t+1).replace(/^ /,``)})}let i=``,a=[];for(let e of r){if(e.key===`type`&&i===``){i=e.value.trim();continue}a.push({id:Rt(),key:e.key,value:e.value})}return{type:i,properties:a,markdown:n}}function Bt(e){let t=[],n=e.type.trim();n&&t.push(`type: ${n}`);for(let n of e.properties){let e=n.key.trim();e===``||e===`type`||t.push(n.value===``?`${e}:`:`${e}: ${n.value}`)}if(t.length===0)return e.markdown.replace(/^\n+/,``);let r=e.markdown.startsWith(`
@@ -1,4 +1,4 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{Er as t,Or as n,bn as r,cn as i,ir as a,jr as o,lr as s,nn as c,rr as l,vn as u}from"./DocumentContext-B1SDm4sQ.js";import{n as d,r as f}from"./dist-Nvb76hAm.js";import{t as p}from"./compiler-runtime-BfE3aGVn.js";import{c as m}from"./local-menu-action-bus-Cypryz6Z.js";import{t as h}from"./utils-CPqDy6Hr.js";import{t as g}from"./button-CA0dewJJ.js";import{i as _,n as ee,t as te}from"./tooltip-DHXgxWLL.js";import{nt as v}from"./CodeMirrorPropInput-C3sOo6SV.js";import{Dn as y,On as b,Un as x,Wn as S,bi as C,or as w}from"./dist-C771h__g.js";import{t as T}from"./dist-DUfEoSbR.js";import{n as E}from"./dist-B6jB2qbD2.js";import{t as ne}from"./createLucideIcon-Bhw2PmPp.js";import{t as re}from"./x-DddVxTPq.js";import{f as ie}from"./doc-paths-D4mBEiVg.js";var D=ne(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),O=p(),k=`245,158,11`,ae=k,oe={fill:.22,line:.7},A={fill:.45,line:1},se=.45;function ce(e,t){let n=ae,{fill:r,line:i}=t?A:oe;return[`border-radius:2px`,`padding-bottom:1px`,...e.id===null?[]:[`cursor:pointer`],`background-color:rgba(${n},${r})`,`box-shadow:inset 0 -2px 0 rgba(${n},${i})`,``].join(`;`)}function j(e){return e.map(e=>e.id??`·`).join(`|`)}function le(e){let t=null;for(let n of e)n.id!==null&&(t===null||n.to-n.from<t.to-t.from)&&(t=n);return t?.id??null}function ue(e,t){return e.id===null||e.id===t}function de(e,t=null){let n=[...e].filter(e=>e.from<e.to).sort((e,t)=>e.from-t.from||e.to-t.to||(e.id??``).localeCompare(t.id??``));if(n.length===0)return[];let r=[...new Set(n.flatMap(e=>[e.from,e.to]))].sort((e,t)=>e-t),i=[],a=null,o=()=>{if(a===null)return;let e=a.covering.find(e=>ue(e,t));i.push({from:a.from,to:a.to,style:ce(e??a.covering[0],e!==void 0),threadId:le(a.covering)}),a=null};for(let e=0;e<r.length-1;e++){let t=r[e],i=r[e+1],s=n.filter(e=>e.from<=t&&e.to>=i);if(s.length===0){o();continue}if(a!==null&&a.to===t&&j(a.covering)===j(s)){a.to=i;continue}o(),a={from:t,to:i,covering:s}}return o(),i}var M=`data-comment-reveal`;function N(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e}function P(e){return e===``?null:document.querySelector(`[data-testid="property-row"][data-key="${N(e)}"]`)}function fe(e){let t=P(e);if(t===null)return null;let n=t.getBoundingClientRect();return n.height===0&&n.width===0?null:n}function pe(e){P(e)?.scrollIntoView({block:`center`,behavior:`smooth`})}function F(e){if(e.quote===``)return!1;let t=e.path.length===0?e.key:e.path[e.path.length-1],n=Array.from(document.querySelectorAll(`[data-testid="property-row"][data-key="${N(String(t))}"]`)),r=Array.from(document.querySelectorAll(`[data-testid="property-row"]`));for(let t of[...n,...r]){let n=t.querySelector(`textarea, input`);if(n===null)continue;let r=I(n.value,e.quote,e.start,e.end);if(r!==null)return t.scrollIntoView({block:`center`,behavior:`smooth`}),n.focus(),n.setSelectionRange(r.start,r.end),me(n),!0}return!1}function I(e,t,n,r){if(n!==void 0&&r!==void 0&&e.slice(n,r)===t)return{start:n,end:r};let i=e.indexOf(t);return i<0?null:{start:i,end:i+t.length}}function me(e){e.style.setProperty(`--comment-reveal-fill`,`rgba(${k},${se})`),e.setAttribute(M,`true`);let t=()=>{e.removeAttribute(M),e.style.removeProperty(`--comment-reveal-fill`)};e.addEventListener(`blur`,t,{once:!0}),e.addEventListener(`pointerdown`,t,{once:!0}),e.addEventListener(`keydown`,t,{once:!0})}function L(e,{includeBlockComponents:t=!1}={}){let n=``,r=[];return e.descendants((e,i)=>{if(e.isText&&e.text){for(let t=0;t<e.text.length;t++)n+=e.text[t],r.push(i+t);return!0}if(e.isBlock&&!t)return!0;let a=y(e);if(a.length>0){let t=i+e.nodeSize-1;for(let e=0;e<a.length;e++)n+=a[e],r.push(e===a.length-1?t:i)}return!0}),{text:n,positions:r}}function R(e,t){let n=[];if(t===``)return n;let r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1);return n}function z(e,t,n){let r=n?.prefix??``,i=n?.suffix??``;if(r===``&&i===``)return null;let a=r===``?[0]:w(e,r,{syntaxIn:`needle`}).map(e=>e.end),o=i===``?[e.length]:w(e,i,{syntaxIn:`needle`}).map(e=>e.start);if(a.length!==1||o.length!==1)return null;let s=a[0],c=o[0];for(;s<c&&/\s/.test(e[s]??``);)s+=1;for(;c>s&&/\s/.test(e[c-1]??``);)--c;if(c<=s)return null;let l=C(t.length);return c-s>l?null:{start:s,end:c}}function B(e,t){let n=e.positions[t.start],r=e.positions[t.end-1];return n==null||r==null?null:{from:n,to:r+1}}function V(e,t,n){if(t.length===0)return null;let r=R(e.text,t).map(e=>({start:e,end:e+t.length}));if(r.length===0&&(r=w(e.text,t,{syntaxIn:`needle`})),r.length===0){let r=z(e.text,t,n);return r===null?null:B(e,r)}let i=n?.prefix??``,a=n?.suffix??``,o=t=>e.text.includes(t)||w(e.text,t,{syntaxIn:`needle`}).length>0;if(i!==``&&a!==``&&!o(i+t+a)&&o(i+a))return null;let s=x({prefix:i,suffix:a},{syntaxInContext:!0}),c=t=>s===0||S(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`,syntaxInContext:!0})>=s;if(r.length===1){if(!c(r[0])){let r=z(e.text,t,n);return r===null?null:B(e,r)}return B(e,r[0])}let l=[],u=-1;for(let t of r){let n=S(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`,syntaxInContext:!0});n>u?(u=n,l=[t]):n===u&&l.push(t)}if(!c(l[0])){let r=z(e.text,t,n);return r===null?null:B(e,r)}return B(e,l[0])}var H=64;function he(e,t,n){return{prefix:b(e,Math.max(0,t-H),t),suffix:b(e,n,Math.min(e.content.size,n+H))}}function U(e,t,n){return W(e)(t,n)}function W(e){let t=L(e),n=null;return(r,i)=>{let a=V(t,r,i);return a===null?(n??=L(e,{includeBlockComponents:!0}),V(n,r,i)):a}}var ge=220,_e=24,ve=600;function G(e,t){return i(e,()=>{let n=c(e);t(),window.setTimeout(()=>n.release(),ve)})}function ye(e){let t=e.viewTop+e.insetTop,n=e.viewBottom-ge;return e.anchorTop>=t&&e.anchorBottom<=n?0:e.anchorTop-(t+_e)}function K(e){let t=e?.parentElement??null;for(;t;){let e=getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)return t;t=t.parentElement}return null}function q(e){let t=Number.parseFloat(getComputedStyle(e).scrollPaddingTop);return Number.isFinite(t)?t:0}function J(e,t,n,r){let i=v(e);if(!i)return!1;let a=K(i.dom);if(!a)return G(n,()=>e.commands.scrollIntoView());let o,s;try{o=i.coordsAtPos(t.from),s=i.coordsAtPos(t.to)}catch{return!1}let c=a.getBoundingClientRect(),l=ye({anchorTop:o.top,anchorBottom:Math.max(o.bottom,s.bottom),viewTop:c.top,viewBottom:c.bottom,insetTop:q(a)});if(l===0)return!0;let u=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;return G(n,()=>a.scrollTo({top:a.scrollTop+l,behavior:r?.instant||u?`auto`:`smooth`}))}var be=1e4,xe=80,Se=1500,Y=[`wheel`,`touchstart`,`mousedown`,`keydown`];function Ce(e){let t=!1,n=null,i=null,s=-1,c=()=>{let r=u(e.docName);if(!r||r.isDestroyed)return!1;if(t||(t=!0,l(e.threadId)),e.quote===``)return n===null&&(n=Date.now(),a(e.threadId)),!0;let o=r.state.doc.content.size;return(i===null||o!==s)&&(i=U(r.state.doc,e.quote,e.context),s=o),!i||!J(r,i,e.docName,{instant:!0})?!1:(n===null&&(n=Date.now(),a(e.threadId)),!0)};o(`comments`),c(),u(e.docName)===null&&window.location.assign(ie(e.docName));let d=!1,f=()=>{if(!d){d=!0,h(),window.clearInterval(g),window.clearTimeout(_);for(let e of Y)window.removeEventListener(e,p,!0)}},p=()=>f(),m=()=>{c()&&n!==null&&Date.now()-n>=Se&&f()},h=r(m),g=window.setInterval(m,xe),_=window.setTimeout(()=>{n===null&&E.error(t?T._({id:`KeXgA-`}):T._({id:`JDQ5I5`})),f()},be);for(let e of Y)window.addEventListener(e,p,!0);m()}var X=e();function we(){return t().length}function Te(){let e=(0,O.c)(4),n=t(),r;if(e[0]!==n){r=new Map;for(let e of n){let t=s(e)?.docName;t!==void 0&&r.set(t,(r.get(t)??0)+1)}e[0]=n,e[1]=r}else r=e[1];let i;return e[2]===r?i=e[3]:(i=[...r].map(Ee),e[2]=r,e[3]=i),i}function Ee(e){let[t,n]=e;return{docName:t,count:n}}function De(e){let t=(0,O.c)(34),{count:n,docs:r,attached:i,onAttach:a,onDismiss:o}=e,s;t[0]===r?s=t[1]:(s=r===void 0?[]:r,t[0]=r,t[1]=s);let c=s,{_:l}=f();if(n===0)return null;if(!i){let e;t[2]===l?e=t[3]:(e=l({id:`UpOct_`}),t[2]=l,t[3]=e);let n,r,i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=h(`h-auto min-h-0 gap-1 rounded-md border border-dashed bg-transparent px-1.5 py-0.5`,`text-xs font-normal text-muted-foreground hover:bg-muted/60 hover:text-foreground`),r=(0,X.jsx)(m,{className:`size-3`}),i=(0,X.jsx)(d,{id:`VbyRUy`}),t[4]=n,t[5]=r,t[6]=i):(n=t[4],r=t[5],i=t[6]);let o;return t[7]!==a||t[8]!==e?(o=(0,X.jsxs)(g,{type:`button`,size:`sm`,variant:`ghost`,"aria-pressed":!1,"aria-label":e,onClick:a,"data-testid":`composer-context-chip-comments`,className:n,children:[r,i]}),t[7]=a,t[8]=e,t[9]=o):o=t[9],o}let u;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=h(`inline-flex items-center gap-1 rounded-md border bg-muted/60 py-0.5 pr-0.5 pl-1.5`,`text-xs text-muted-foreground`),t[10]=u):u=t[10];let p;t[11]===l?p=t[12]:(p=l({id:`2zvUIK`}),t[11]=l,t[12]=p);let v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(D,{className:`size-3`}),t[13]=v):v=t[13];let y;t[14]!==n||t[15]!==c.length?(y=c.length>1?(0,X.jsx)(d,{id:`5TmrYN`,values:{0:c.length,count:n}}):(0,X.jsx)(d,{id:`eiUA4k`,values:{count:n}}),t[14]=n,t[15]=c.length,t[16]=y):y=t[16];let b;t[17]!==p||t[18]!==y?(b=(0,X.jsx)(_,{asChild:!0,children:(0,X.jsxs)(g,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":p,onClick:ke,"data-testid":`composer-comments-open-panel`,className:`h-auto min-h-0 gap-1 px-0.5 py-0 text-xs font-normal text-muted-foreground hover:text-foreground`,children:[v,y]})}),t[17]=p,t[18]=y,t[19]=b):b=t[19];let x;t[20]===c?x=t[21]:(x=(0,X.jsx)(ee,{className:`max-w-64`,children:c.length>1?(0,X.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:c.map(Oe)}):(0,X.jsx)(d,{id:`2zvUIK`})}),t[20]=c,t[21]=x);let S;t[22]!==b||t[23]!==x?(S=(0,X.jsxs)(te,{children:[b,x]}),t[22]=b,t[23]=x,t[24]=S):S=t[24];let C;t[25]===l?C=t[26]:(C=l({id:`pFRz_E`}),t[25]=l,t[26]=C);let w;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,X.jsx)(re,{className:`size-3`}),t[27]=w):w=t[27];let T;t[28]!==o||t[29]!==C?(T=(0,X.jsx)(g,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":C,onClick:o,className:`size-4 p-0 text-muted-foreground hover:text-foreground`,children:w}),t[28]=o,t[29]=C,t[30]=T):T=t[30];let E;return t[31]!==T||t[32]!==S?(E=(0,X.jsxs)(`span`,{"data-testid":`composer-context-chip-comments`,className:u,children:[S,T]}),t[31]=T,t[32]=S,t[33]=E):E=t[33],E}function Oe(e){return(0,X.jsxs)(`li`,{className:`flex items-baseline gap-1.5`,children:[(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.count}),(0,X.jsx)(`span`,{className:`truncate`,children:Z(e.docName)})]},e.docName)}function ke(){return n()}function Z(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function Ae(e,t){let n=e;for(let e of t)n+=typeof e==`number`?`[${e}]`:`.${e}`;return n}function je(e){Ce({docName:e.docName,quote:e.target.kind===`property`?``:e.anchor?.quote??``,threadId:e.id,context:e.anchor??void 0});let{target:t,anchor:n}=e;if(t.kind!==`property`||n===null)return;let r=0,i=()=>{F({key:t.key,path:t.path,quote:n.quote,start:n.start,end:n.end})||(r+=1,!(r>=Q)&&requestAnimationFrame(i))};requestAnimationFrame(i)}var Q=30;function Me(e){return{docName:e.docName,body:e.instruction,propertyKey:e.property,quote:e.passage?.exact??``,anchorLost:e.anchorLost,prefix:e.passage?.prefix??``,suffix:e.passage?.suffix??``,repeats:e.passageRepeats}}var $=48;function Ne(e){let t=e.replace(/\s+/g,` `).trimStart();return t.length>$?`…${t.slice(-$)}`:t}function Pe(e){let t=e.replace(/\s+/g,` `).trimEnd();return t.length>$?`${t.slice(0,$)}…`:t}function Fe(e){if(!e.repeats)return null;let t=Ne(e.prefix),n=Pe(e.suffix);return t===``&&n===``?null:`(This text appears more than once in the file. The one meant is ${t===``?`at the start of the file, followed by "${n}"`:n===``?`at the end of the file, preceded by "${t}"`:`between "${t}" and "${n}"`} — match that context rather than the first occurrence.)`}function Ie(e,t,n){let r=t.trim(),i=[];if(i.push(r.length>0?r:`Address the following review comments by editing the documents directly.`),i.push(``),i.push(e.length===1?`The comment:`:`The ${e.length} comments:`),e.forEach((e,t)=>{if(i.push(``),e.propertyKey){let n=e.quote.trim();if(n===``)i.push(`${t+1}. In \`${e.docName}\`, on the \`${e.propertyKey}\` property (frontmatter):`),i.push(``),i.push(` ${e.body.trim()}`);else{i.push(`${t+1}. In \`${e.docName}\`, on this text within the \`${e.propertyKey}\` property (frontmatter):`),i.push(``);for(let e of n.split(`
1
+ import{t as e}from"./jsx-runtime-BUgB2tll.js";import{Er as t,Or as n,bn as r,cn as i,ir as a,jr as o,lr as s,nn as c,rr as l,vn as u}from"./DocumentContext-D_2wOhha.js";import{n as d,r as f}from"./dist-Nvb76hAm.js";import{t as p}from"./compiler-runtime-BfE3aGVn.js";import{c as m}from"./local-menu-action-bus-Cypryz6Z.js";import{t as h}from"./utils-CPqDy6Hr.js";import{t as g}from"./button-CA0dewJJ.js";import{i as _,n as ee,t as te}from"./tooltip-DHXgxWLL.js";import{nt as v}from"./CodeMirrorPropInput-kYmUy2HP.js";import{Dn as y,On as b,Un as x,Wn as S,bi as C,or as w}from"./dist-C771h__g.js";import{t as T}from"./dist-DUfEoSbR.js";import{n as E}from"./dist-B6jB2qbD2.js";import{t as ne}from"./createLucideIcon-Bhw2PmPp.js";import{t as re}from"./x-DddVxTPq.js";import{f as ie}from"./doc-paths-D-8nN6rk.js";var D=ne(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),O=p(),k=`245,158,11`,ae=k,oe={fill:.22,line:.7},A={fill:.45,line:1},se=.45;function ce(e,t){let n=ae,{fill:r,line:i}=t?A:oe;return[`border-radius:2px`,`padding-bottom:1px`,...e.id===null?[]:[`cursor:pointer`],`background-color:rgba(${n},${r})`,`box-shadow:inset 0 -2px 0 rgba(${n},${i})`,``].join(`;`)}function j(e){return e.map(e=>e.id??`·`).join(`|`)}function le(e){let t=null;for(let n of e)n.id!==null&&(t===null||n.to-n.from<t.to-t.from)&&(t=n);return t?.id??null}function ue(e,t){return e.id===null||e.id===t}function de(e,t=null){let n=[...e].filter(e=>e.from<e.to).sort((e,t)=>e.from-t.from||e.to-t.to||(e.id??``).localeCompare(t.id??``));if(n.length===0)return[];let r=[...new Set(n.flatMap(e=>[e.from,e.to]))].sort((e,t)=>e-t),i=[],a=null,o=()=>{if(a===null)return;let e=a.covering.find(e=>ue(e,t));i.push({from:a.from,to:a.to,style:ce(e??a.covering[0],e!==void 0),threadId:le(a.covering)}),a=null};for(let e=0;e<r.length-1;e++){let t=r[e],i=r[e+1],s=n.filter(e=>e.from<=t&&e.to>=i);if(s.length===0){o();continue}if(a!==null&&a.to===t&&j(a.covering)===j(s)){a.to=i;continue}o(),a={from:t,to:i,covering:s}}return o(),i}var M=`data-comment-reveal`;function N(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e}function P(e){return e===``?null:document.querySelector(`[data-testid="property-row"][data-key="${N(e)}"]`)}function fe(e){let t=P(e);if(t===null)return null;let n=t.getBoundingClientRect();return n.height===0&&n.width===0?null:n}function pe(e){P(e)?.scrollIntoView({block:`center`,behavior:`smooth`})}function F(e){if(e.quote===``)return!1;let t=e.path.length===0?e.key:e.path[e.path.length-1],n=Array.from(document.querySelectorAll(`[data-testid="property-row"][data-key="${N(String(t))}"]`)),r=Array.from(document.querySelectorAll(`[data-testid="property-row"]`));for(let t of[...n,...r]){let n=t.querySelector(`textarea, input`);if(n===null)continue;let r=I(n.value,e.quote,e.start,e.end);if(r!==null)return t.scrollIntoView({block:`center`,behavior:`smooth`}),n.focus(),n.setSelectionRange(r.start,r.end),me(n),!0}return!1}function I(e,t,n,r){if(n!==void 0&&r!==void 0&&e.slice(n,r)===t)return{start:n,end:r};let i=e.indexOf(t);return i<0?null:{start:i,end:i+t.length}}function me(e){e.style.setProperty(`--comment-reveal-fill`,`rgba(${k},${se})`),e.setAttribute(M,`true`);let t=()=>{e.removeAttribute(M),e.style.removeProperty(`--comment-reveal-fill`)};e.addEventListener(`blur`,t,{once:!0}),e.addEventListener(`pointerdown`,t,{once:!0}),e.addEventListener(`keydown`,t,{once:!0})}function L(e,{includeBlockComponents:t=!1}={}){let n=``,r=[];return e.descendants((e,i)=>{if(e.isText&&e.text){for(let t=0;t<e.text.length;t++)n+=e.text[t],r.push(i+t);return!0}if(e.isBlock&&!t)return!0;let a=y(e);if(a.length>0){let t=i+e.nodeSize-1;for(let e=0;e<a.length;e++)n+=a[e],r.push(e===a.length-1?t:i)}return!0}),{text:n,positions:r}}function R(e,t){let n=[];if(t===``)return n;let r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1);return n}function z(e,t,n){let r=n?.prefix??``,i=n?.suffix??``;if(r===``&&i===``)return null;let a=r===``?[0]:w(e,r,{syntaxIn:`needle`}).map(e=>e.end),o=i===``?[e.length]:w(e,i,{syntaxIn:`needle`}).map(e=>e.start);if(a.length!==1||o.length!==1)return null;let s=a[0],c=o[0];for(;s<c&&/\s/.test(e[s]??``);)s+=1;for(;c>s&&/\s/.test(e[c-1]??``);)--c;if(c<=s)return null;let l=C(t.length);return c-s>l?null:{start:s,end:c}}function B(e,t){let n=e.positions[t.start],r=e.positions[t.end-1];return n==null||r==null?null:{from:n,to:r+1}}function V(e,t,n){if(t.length===0)return null;let r=R(e.text,t).map(e=>({start:e,end:e+t.length}));if(r.length===0&&(r=w(e.text,t,{syntaxIn:`needle`})),r.length===0){let r=z(e.text,t,n);return r===null?null:B(e,r)}let i=n?.prefix??``,a=n?.suffix??``,o=t=>e.text.includes(t)||w(e.text,t,{syntaxIn:`needle`}).length>0;if(i!==``&&a!==``&&!o(i+t+a)&&o(i+a))return null;let s=x({prefix:i,suffix:a},{syntaxInContext:!0}),c=t=>s===0||S(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`,syntaxInContext:!0})>=s;if(r.length===1){if(!c(r[0])){let r=z(e.text,t,n);return r===null?null:B(e,r)}return B(e,r[0])}let l=[],u=-1;for(let t of r){let n=S(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`,syntaxInContext:!0});n>u?(u=n,l=[t]):n===u&&l.push(t)}if(!c(l[0])){let r=z(e.text,t,n);return r===null?null:B(e,r)}return B(e,l[0])}var H=64;function he(e,t,n){return{prefix:b(e,Math.max(0,t-H),t),suffix:b(e,n,Math.min(e.content.size,n+H))}}function U(e,t,n){return W(e)(t,n)}function W(e){let t=L(e),n=null;return(r,i)=>{let a=V(t,r,i);return a===null?(n??=L(e,{includeBlockComponents:!0}),V(n,r,i)):a}}var ge=220,_e=24,ve=600;function G(e,t){return i(e,()=>{let n=c(e);t(),window.setTimeout(()=>n.release(),ve)})}function ye(e){let t=e.viewTop+e.insetTop,n=e.viewBottom-ge;return e.anchorTop>=t&&e.anchorBottom<=n?0:e.anchorTop-(t+_e)}function K(e){let t=e?.parentElement??null;for(;t;){let e=getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)return t;t=t.parentElement}return null}function q(e){let t=Number.parseFloat(getComputedStyle(e).scrollPaddingTop);return Number.isFinite(t)?t:0}function J(e,t,n,r){let i=v(e);if(!i)return!1;let a=K(i.dom);if(!a)return G(n,()=>e.commands.scrollIntoView());let o,s;try{o=i.coordsAtPos(t.from),s=i.coordsAtPos(t.to)}catch{return!1}let c=a.getBoundingClientRect(),l=ye({anchorTop:o.top,anchorBottom:Math.max(o.bottom,s.bottom),viewTop:c.top,viewBottom:c.bottom,insetTop:q(a)});if(l===0)return!0;let u=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;return G(n,()=>a.scrollTo({top:a.scrollTop+l,behavior:r?.instant||u?`auto`:`smooth`}))}var be=1e4,xe=80,Se=1500,Y=[`wheel`,`touchstart`,`mousedown`,`keydown`];function Ce(e){let t=!1,n=null,i=null,s=-1,c=()=>{let r=u(e.docName);if(!r||r.isDestroyed)return!1;if(t||(t=!0,l(e.threadId)),e.quote===``)return n===null&&(n=Date.now(),a(e.threadId)),!0;let o=r.state.doc.content.size;return(i===null||o!==s)&&(i=U(r.state.doc,e.quote,e.context),s=o),!i||!J(r,i,e.docName,{instant:!0})?!1:(n===null&&(n=Date.now(),a(e.threadId)),!0)};o(`comments`),c(),u(e.docName)===null&&window.location.assign(ie(e.docName));let d=!1,f=()=>{if(!d){d=!0,h(),window.clearInterval(g),window.clearTimeout(_);for(let e of Y)window.removeEventListener(e,p,!0)}},p=()=>f(),m=()=>{c()&&n!==null&&Date.now()-n>=Se&&f()},h=r(m),g=window.setInterval(m,xe),_=window.setTimeout(()=>{n===null&&E.error(t?T._({id:`KeXgA-`}):T._({id:`JDQ5I5`})),f()},be);for(let e of Y)window.addEventListener(e,p,!0);m()}var X=e();function we(){return t().length}function Te(){let e=(0,O.c)(4),n=t(),r;if(e[0]!==n){r=new Map;for(let e of n){let t=s(e)?.docName;t!==void 0&&r.set(t,(r.get(t)??0)+1)}e[0]=n,e[1]=r}else r=e[1];let i;return e[2]===r?i=e[3]:(i=[...r].map(Ee),e[2]=r,e[3]=i),i}function Ee(e){let[t,n]=e;return{docName:t,count:n}}function De(e){let t=(0,O.c)(34),{count:n,docs:r,attached:i,onAttach:a,onDismiss:o}=e,s;t[0]===r?s=t[1]:(s=r===void 0?[]:r,t[0]=r,t[1]=s);let c=s,{_:l}=f();if(n===0)return null;if(!i){let e;t[2]===l?e=t[3]:(e=l({id:`UpOct_`}),t[2]=l,t[3]=e);let n,r,i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=h(`h-auto min-h-0 gap-1 rounded-md border border-dashed bg-transparent px-1.5 py-0.5`,`text-xs font-normal text-muted-foreground hover:bg-muted/60 hover:text-foreground`),r=(0,X.jsx)(m,{className:`size-3`}),i=(0,X.jsx)(d,{id:`VbyRUy`}),t[4]=n,t[5]=r,t[6]=i):(n=t[4],r=t[5],i=t[6]);let o;return t[7]!==a||t[8]!==e?(o=(0,X.jsxs)(g,{type:`button`,size:`sm`,variant:`ghost`,"aria-pressed":!1,"aria-label":e,onClick:a,"data-testid":`composer-context-chip-comments`,className:n,children:[r,i]}),t[7]=a,t[8]=e,t[9]=o):o=t[9],o}let u;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=h(`inline-flex items-center gap-1 rounded-md border bg-muted/60 py-0.5 pr-0.5 pl-1.5`,`text-xs text-muted-foreground`),t[10]=u):u=t[10];let p;t[11]===l?p=t[12]:(p=l({id:`2zvUIK`}),t[11]=l,t[12]=p);let v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(D,{className:`size-3`}),t[13]=v):v=t[13];let y;t[14]!==n||t[15]!==c.length?(y=c.length>1?(0,X.jsx)(d,{id:`5TmrYN`,values:{0:c.length,count:n}}):(0,X.jsx)(d,{id:`eiUA4k`,values:{count:n}}),t[14]=n,t[15]=c.length,t[16]=y):y=t[16];let b;t[17]!==p||t[18]!==y?(b=(0,X.jsx)(_,{asChild:!0,children:(0,X.jsxs)(g,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":p,onClick:ke,"data-testid":`composer-comments-open-panel`,className:`h-auto min-h-0 gap-1 px-0.5 py-0 text-xs font-normal text-muted-foreground hover:text-foreground`,children:[v,y]})}),t[17]=p,t[18]=y,t[19]=b):b=t[19];let x;t[20]===c?x=t[21]:(x=(0,X.jsx)(ee,{className:`max-w-64`,children:c.length>1?(0,X.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:c.map(Oe)}):(0,X.jsx)(d,{id:`2zvUIK`})}),t[20]=c,t[21]=x);let S;t[22]!==b||t[23]!==x?(S=(0,X.jsxs)(te,{children:[b,x]}),t[22]=b,t[23]=x,t[24]=S):S=t[24];let C;t[25]===l?C=t[26]:(C=l({id:`pFRz_E`}),t[25]=l,t[26]=C);let w;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,X.jsx)(re,{className:`size-3`}),t[27]=w):w=t[27];let T;t[28]!==o||t[29]!==C?(T=(0,X.jsx)(g,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":C,onClick:o,className:`size-4 p-0 text-muted-foreground hover:text-foreground`,children:w}),t[28]=o,t[29]=C,t[30]=T):T=t[30];let E;return t[31]!==T||t[32]!==S?(E=(0,X.jsxs)(`span`,{"data-testid":`composer-context-chip-comments`,className:u,children:[S,T]}),t[31]=T,t[32]=S,t[33]=E):E=t[33],E}function Oe(e){return(0,X.jsxs)(`li`,{className:`flex items-baseline gap-1.5`,children:[(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.count}),(0,X.jsx)(`span`,{className:`truncate`,children:Z(e.docName)})]},e.docName)}function ke(){return n()}function Z(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function Ae(e,t){let n=e;for(let e of t)n+=typeof e==`number`?`[${e}]`:`.${e}`;return n}function je(e){Ce({docName:e.docName,quote:e.target.kind===`property`?``:e.anchor?.quote??``,threadId:e.id,context:e.anchor??void 0});let{target:t,anchor:n}=e;if(t.kind!==`property`||n===null)return;let r=0,i=()=>{F({key:t.key,path:t.path,quote:n.quote,start:n.start,end:n.end})||(r+=1,!(r>=Q)&&requestAnimationFrame(i))};requestAnimationFrame(i)}var Q=30;function Me(e){return{docName:e.docName,body:e.instruction,propertyKey:e.property,quote:e.passage?.exact??``,anchorLost:e.anchorLost,prefix:e.passage?.prefix??``,suffix:e.passage?.suffix??``,repeats:e.passageRepeats}}var $=48;function Ne(e){let t=e.replace(/\s+/g,` `).trimStart();return t.length>$?`…${t.slice(-$)}`:t}function Pe(e){let t=e.replace(/\s+/g,` `).trimEnd();return t.length>$?`${t.slice(0,$)}…`:t}function Fe(e){if(!e.repeats)return null;let t=Ne(e.prefix),n=Pe(e.suffix);return t===``&&n===``?null:`(This text appears more than once in the file. The one meant is ${t===``?`at the start of the file, followed by "${n}"`:n===``?`at the end of the file, preceded by "${t}"`:`between "${t}" and "${n}"`} — match that context rather than the first occurrence.)`}function Ie(e,t,n){let r=t.trim(),i=[];if(i.push(r.length>0?r:`Address the following review comments by editing the documents directly.`),i.push(``),i.push(e.length===1?`The comment:`:`The ${e.length} comments:`),e.forEach((e,t)=>{if(i.push(``),e.propertyKey){let n=e.quote.trim();if(n===``)i.push(`${t+1}. In \`${e.docName}\`, on the \`${e.propertyKey}\` property (frontmatter):`),i.push(``),i.push(` ${e.body.trim()}`);else{i.push(`${t+1}. In \`${e.docName}\`, on this text within the \`${e.propertyKey}\` property (frontmatter):`),i.push(``);for(let e of n.split(`
2
2
  `))i.push(` > ${e}`);i.push(``),i.push(` ${e.body.trim()}`)}e.anchorLost&&(i.push(``),i.push(n===``?` (Note: \`${e.propertyKey}\` is no longer in this document's frontmatter — it was renamed or removed since the comment was written. Do not apply this to a different property; if you cannot tell what it now refers to, say so instead of guessing.)`:` (Note: that text is no longer in \`${e.propertyKey}\` — the value was edited, reshaped, or removed since the comment was written. Do not apply this to a different property or a different part of the value; if you cannot tell what it now refers to, say so instead of guessing.)`));return}i.push(`${t+1}. In \`${e.docName}\`, on this passage:`),i.push(``);for(let t of e.quote.split(`
3
3
  `))i.push(` > ${t}`);i.push(``),i.push(` ${e.body.trim()}`);let n=Fe(e);n!==null&&(i.push(``),i.push(` ${n}`)),e.anchorLost&&(i.push(``),i.push(` (Note: this passage is no longer in the document — it was edited or removed since the comment was written. Do not apply this to a different passage; if you cannot tell what it now refers to, say so instead of guessing.)`))}),n&&n.markdown.trim().length>0){i.push(``),i.push(`Also in scope, selected in \`${n.docName}\` (not a comment):`),i.push(``);for(let e of n.markdown.trim().split(`
4
4
  `))i.push(`> ${e}`)}return i.join(`
@@ -1 +1 @@
1
- import{to as e}from"./dist-C771h__g.js";function t(t){return e.includes(t)}function n(e){if(e.startsWith(_)||e.startsWith(x)||e.startsWith(S)||e.startsWith(T)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=v(t),r=n>=0?t.slice(0,n):t;if(!r)return null;try{return r.split(`/`).map(decodeURIComponent).join(`/`)}catch{return r}}function r(e){if(e.startsWith(_)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=t.indexOf(`#`);if(n<0)return null;let r=t.slice(n+1);if(!r)return null;try{return decodeURIComponent(r)}catch{return r}}function i(e,t){let n=`#/${e}`;return t?`${n}#${encodeURIComponent(t)}`:n}function a(e,t){return e===t||o(e)===o(t)}function o(e){try{return decodeURIComponent(e)}catch{return e}}var s=`__okHashHistoryEntry`;function c(e){return{...typeof e==`object`&&e?e:{},[s]:!0}}function l(e){return typeof e==`object`&&!!e&&e[s]===!0}function u(){l(window.history.state)||window.history.replaceState(c(window.history.state),``)}function d(e){let{pathname:t,search:n}=window.location;window.history.replaceState(c(window.history.state),``,`${t}${n}${e}`)}function f(e){if(a(window.location.hash,e))return;let{pathname:t,search:n}=window.location;window.history.pushState(c(window.history.state),``,`${t}${n}${e}`)}function p(e){return e.endsWith(`.mdx`)?e.slice(0,-4):e.endsWith(`.md`)?e.slice(0,-3):e}function m(e,t){let n=e.replace(/^\/+|\/+$/g,``),r=n?`#/${n}/`:`#/`;return t?`${r}#${encodeURIComponent(t)}`:r}function h(e,t,n){if(e===`folder`)return m(t);let r=`#/${encodeURIComponent(t)}`;return n==null||n===``?r:`${r}?branch=${encodeURIComponent(n)}`}function g(e){if(e===`#/`)return!0;if(!e.startsWith(`#/`))return!1;let t=e.slice(2);return t.length>0&&t[0]===`?`}var _=`#/__asset__/`;function v(e){let t=e.indexOf(`?`),n=e.indexOf(`#`);return t<0?n:n<0?t:Math.min(t,n)}function y(e){if(!e.startsWith(_))return null;let t=e.slice(12);if(!t)return null;try{return t.split(`/`).map(decodeURIComponent).join(`/`)}catch{return t}}function b(e){return`${_}${e.split(`/`).map(encodeURIComponent).join(`/`)}`}var x=`#/__skill-file__/`,S=`#/__skills__`;function C(){return S}function w(e){return e===S||e.startsWith(`${S}/`)}var T=`#/__skill-preview__/`,E=[`explore`,`detected`,`builtin`,`foreign`];function D(e){return e!==void 0&&E.includes(e)}var O=`project`;function k(e){return[e.flavor,e.source,e.name,e.subtitle,e.level??O].map(encodeURIComponent).join(`/`)}function A(e){if(!e)return null;let n;try{n=e.split(`/`).map(decodeURIComponent)}catch{return null}if(n.length<4||n.length>6)return null;let[r,i,a,o,s,c]=n;return!D(r)||!i||!a?null:{flavor:r,source:i,name:a,subtitle:o??``,...s&&t(s)?{level:s}:{},...c?{path:c}:{}}}function j(e){let t=k(e);return e.path&&(t+=`/${encodeURIComponent(e.path)}`),`${T}${t}`}function M(e){return e.startsWith(T)?A(e.slice(20)):null}var N=`:`;function P(e){let t=e.host===void 0?e.name:`${e.name}${N}${e.host}`;return`${x}${[e.scope,t].map(encodeURIComponent).join(`/`)}/${e.path.split(`/`).map(encodeURIComponent).join(`/`)}`}function F(e){if(!e.startsWith(x))return null;let n=e.slice(17);if(!n)return null;let r;try{r=n.split(`/`).map(decodeURIComponent)}catch{return null}if(r.length<3)return null;let[i,a,...o]=r,s=o.join(`/`);if(!i||!a||!s||!t(i))return null;let c=a.indexOf(N),l=c===-1?a:a.slice(0,c),u=c===-1?void 0:a.slice(c+1);return l?{scope:i,name:l,path:s,...u?{host:u}:{}}:null}var I=/\.(md|mdx)$/i;function L(e){return e.trim().replace(/^\.\/+/,``).replace(/^\/+/,``)}function R(e){return L(e).replace(I,``)}function z(e){let t=L(e);return t?I.test(t)?t:`${t}.md`:`untitled.md`}function B(e){let t=R(e),n=t.lastIndexOf(`/`);return{initialDir:n>0?t.slice(0,n):``,suggestedName:`${n>=0?t.slice(n+1):t||`untitled`}.md`}}export{M as C,F as S,g as _,y as a,f as b,h as c,b as d,i as f,C as g,j as h,r as i,k as l,P as m,z as n,A as o,m as p,R as r,n as s,B as t,p as u,a as v,w,d as x,u as y};
1
+ import{to as e}from"./dist-C771h__g.js";function t(t){return e.includes(t)}function n(e){if(e.startsWith(_)||e.startsWith(x)||e.startsWith(S)||e.startsWith(T)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=v(t),r=n>=0?t.slice(0,n):t;if(!r)return null;try{return r.split(`/`).map(decodeURIComponent).join(`/`)}catch{return r}}function r(e){if(e.startsWith(_)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=t.indexOf(`#`);if(n<0)return null;let r=t.slice(n+1);if(!r)return null;try{return decodeURIComponent(r)}catch{return r}}function i(e,t){let n=`#/${e}`;return t?`${n}#${encodeURIComponent(t)}`:n}function a(e,t){return e===t||o(e)===o(t)}function o(e){try{return decodeURIComponent(e)}catch{return e}}var s=`__okHashHistoryEntry`;function c(e){return{...typeof e==`object`&&e?e:{},[s]:!0}}function l(e){return typeof e==`object`&&!!e&&e[s]===!0}function u(){l(window.history.state)||window.history.replaceState(c(window.history.state),``)}function d(e){let{pathname:t,search:n}=window.location;window.history.replaceState(c(window.history.state),``,`${t}${n}${e}`)}function f(e){if(a(window.location.hash,e))return;let{pathname:t,search:n}=window.location;window.history.pushState(c(window.history.state),``,`${t}${n}${e}`)}function p(e){return e.endsWith(`.mdx`)?e.slice(0,-4):e.endsWith(`.md`)?e.slice(0,-3):e}function m(e,t){let n=e.replace(/^\/+|\/+$/g,``),r=n?`#/${n}/`:`#/`;return t?`${r}#${encodeURIComponent(t)}`:r}function h(e,t,n){if(e===`folder`)return m(t);let r=`#/${encodeURIComponent(t)}`;return n==null||n===``?r:`${r}?branch=${encodeURIComponent(n)}`}function g(e){if(e===`#/`)return!0;if(!e.startsWith(`#/`))return!1;let t=e.slice(2);return t.length>0&&t[0]===`?`}var _=`#/__asset__/`;function v(e){let t=e.indexOf(`?`),n=e.indexOf(`#`);return t<0?n:n<0?t:Math.min(t,n)}function y(e){if(!e.startsWith(_))return null;let t=e.slice(12);if(!t)return null;try{return t.split(`/`).map(decodeURIComponent).join(`/`)}catch{return t}}function b(e){return`${_}${e.split(`/`).map(encodeURIComponent).join(`/`)}`}var x=`#/__skill-file__/`,S=`#/__skills__`;function C(){return S}function w(e){return e===S||e.startsWith(`${S}/`)}var T=`#/__skill-preview__/`,E=[`explore`,`detected`,`builtin`,`foreign`];function D(e){return e!==void 0&&E.includes(e)}var O=`project`;function k(e){return[e.flavor,e.source,e.name,e.subtitle,e.level??O].map(encodeURIComponent).join(`/`)}function A(e){if(!e)return null;let n;try{n=e.split(`/`).map(decodeURIComponent)}catch{return null}if(n.length<4||n.length>6)return null;let[r,i,a,o,s,c]=n;return!D(r)||!i||!a?null:{flavor:r,source:i,name:a,subtitle:o??``,...s&&t(s)?{level:s}:{},...c?{path:c}:{}}}function j(e){let t=k(e);return e.path&&(t+=`/${encodeURIComponent(e.path)}`),`${T}${t}`}function M(e){return e.startsWith(T)?A(e.slice(20)):null}var N=`:`;function P(e){let t=e.host===void 0?e.name:`${e.name}${N}${e.host}`;return`${x}${[e.scope,t].map(encodeURIComponent).join(`/`)}/${e.path.split(`/`).map(encodeURIComponent).join(`/`)}`}function F(e){if(!e.startsWith(x))return null;let n=e.slice(17);if(!n)return null;let r;try{r=n.split(`/`).map(decodeURIComponent)}catch{return null}if(r.length<3)return null;let[i,a,...o]=r,s=o.join(`/`);if(!i||!a||!s||!t(i))return null;let c=a.indexOf(N),l=c===-1?a:a.slice(0,c),u=c===-1?void 0:a.slice(c+1);return l?{scope:i,name:l,path:s,...u?{host:u}:{}}:null}var I=/\.(md|mdx)$/i;function L(e){return e.trim().replace(/^\.\/+/,``).replace(/^\/+/,``)}function R(e){return L(e).replace(I,``)}function z(e){let t=L(e);return t?I.test(t)?t:`${t}.md`:`untitled.md`}function B(e){let t=R(e),n=t.lastIndexOf(`/`);return{initialDir:n>0?t.slice(0,n):``,suggestedName:`${n>=0?t.slice(n+1):t||`untitled`}.md`}}export{F as C,d as S,w as T,g as _,y as a,u as b,h as c,b as d,i as f,C as g,j as h,r as i,k as l,P as m,z as n,A as o,m as p,R as r,n as s,B as t,p as u,l as v,M as w,f as x,a as y};
@@ -1 +1 @@
1
- import{ls as e,ps as t,ss as n}from"./dist-C771h__g.js";import{d as r,f as i,p as a}from"./doc-paths-D4mBEiVg.js";import{t as o}from"./file-tree-rename-validation-Dnm9G3PU.js";import{c as s,l as c,s as l}from"./file-tree-utils-DH9xQnZk.js";import{a as u}from"./navigation-targets-2ieFyUYm.js";var d=`application/x-open-knowledge-sidebar-item+json`,f={image:!0,video:!0,audio:!0,pdf:!0,text:!0,mermaid:!0};function p(e){return JSON.stringify(e)}function m(e){return e?Array.from(e.types).includes(d):!1}function ee(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:a(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:r(e.assetPath)}:{target:u(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:i(e.docName)}}function h(e){if(!e||!m(e))return null;let t=e.getData(d);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!g(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!_(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _(e){return typeof e==`string`&&Object.hasOwn(f,e)}var v=`.md`,y=/\.(md|mdx)$/i;function b(t,r=v){return y.test(t)||e(t)||n(t)?t:`${t}${r}`}function x(e){return $(e).replace(y,``)}function S(e,t){let n=$(e),r=k(t),i=t.find(e=>s(e)&&A(e,r)===n)??t.find(e=>s(e)&&w(e)===n);if(i)return i.docName;let a=x(n);return t.find(e=>{let t=w(e);return t!==n&&y.test(t)&&x(t)===a})&&y.test(n)?n:a}function C(e,t){let n=k(t);return t.find(t=>A(t,n)===e)??t.find(t=>w(t)===e)}function w(e){return c(e)?D(e.path):l(e)?e.path:b(e.docName,e.docExt)}function T(e){let t=$(e).match(y);return t?`.${t[1].toLowerCase()}`:void 0}function E(e){return $(e)}function D(e){let t=$(e.trim());return t?`${t}/`:``}function O(e){return e.endsWith(`/`)?E(e):x(e)}function k(e){let t=new Map;for(let n of e){if(!s(n))continue;let e=n.docName.match(y);if(!e)continue;let r=n.docName.slice(0,-e[0].length),i=t.get(r);i?i.add(e[0]):t.set(r,new Set([e[0]]))}return t}function A(e,t){let n=w(e);if(!s(e))return n;let r=e.docName.match(y);if(!r)return n;let i=e.docName.slice(0,-r[0].length);return(t.get(i)?.size??0)>1?n:`${e.docName}${e.docExt??v}`}function j(e){let t=k(e),n=new Set,r=[];for(let i of e){let e=A(i,t);n.has(e)||(n.add(e),r.push(e))}return r}function M(e){return[...e].sort().join(`\0`)}function N(e){return M(j(e))}function P(e,t={}){let n=new Set;for(let r of e){let e=(c(r)||l(r)?r.path:r.docName).split(`/`).filter(Boolean);if(!t.includeOkFolders&&e.includes(`.ok`))continue;if(c(r)){let e=D(r.path);e&&n.add(e)}let i=c(r)?e.length:e.length-1;for(let t=1;t<=i;t++)n.add(`${e.slice(0,t).join(`/`)}/`)}return[...n].sort()}function F(e){if(!e)return[];let t=$(e.replace(y,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function I(e,t,n){let r=T(e);if(r)return r;let i=n.find(e=>s(e)&&e.docName===t);return i?i.docExt??v:Q(e).includes(`.`)?void 0:v}function L(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!l(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function R(e,t,n){if(T(e))return null;let r=n.find(e=>l(e)&&e.path===t);return r?r.path:Q(e).includes(`.`)?t:L(t,n)}function z(e,t){let n=e.kind===`directory`,r=n?E(e.path):S(e.path,t);if(n)return{kind:`folder`,name:$(Q(e.path)).replace(y,``),path:r,treePath:V(e.path,!0)};let i=R(e.path,r,t);if(i)return{kind:`asset`,name:$(Q(i)),path:i,treePath:i};let a=I(e.path,r,t);return{kind:`file`,name:$(Q(e.path)).replace(y,``),path:r,treePath:V(e.path,!1),docExt:a}}function B(e){return e.kind===`directory`?E(e.path):e.path}function V(e,t){return t?D(e):y.test(e)?e:`${e}${v}`}function H(e,t,n){let r=D(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${v}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function U(e,t){return e===`file`?V(t,!1):`${E(t)}/index${v}`}function W(e,t){return t.kind===`root`||t.directoryPath==null?Q(e):`${t.directoryPath}${Q(e)}`}function G(e,t){if(t)return E(D(e));let n=x(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function K(e,t){let n=E(D(e));return n?`${n}/${t}`:t}function q(e,t,n){e.append(`parentDocName`,K(t,n)),e.append(`placement`,`parent-dir`)}function J(e,t){return(t.path??K(e,t.src)).replace(/^\/+/,``)}function Y(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function X(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function Z(e,n){let r=o(e).toLowerCase();if(r===``)return null;let i=new Date().toISOString();if(r===`.md`||r===`.mdx`)return{kind:`document`,docName:x(e),docExt:r,modified:i,size:n.size};let a=r.startsWith(`.`)?r.slice(1):r;return{kind:`asset`,path:e,assetExt:a,mediaKind:t(a),modified:i,size:n.size}}function Q(e){let t=$(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function $(e){return e.endsWith(`/`)?e.slice(0,-1):e}export{h as A,z as C,d as D,J as E,m as O,S,O as T,G as _,U as a,E as b,j as c,w as d,X as f,V as g,Y as h,W as i,p as j,ee as k,N as l,D as m,P as n,H as o,C as p,F as r,b as s,q as t,Z as u,B as v,M as w,x,L as y};
1
+ import{ls as e,ps as t,ss as n}from"./dist-C771h__g.js";import{d as r,f as i,p as a}from"./doc-paths-D-8nN6rk.js";import{t as o}from"./file-tree-rename-validation-Dnm9G3PU.js";import{c as s,l as c,s as l}from"./file-tree-utils-DH9xQnZk.js";import{a as u}from"./navigation-targets-C5LikiXa.js";var d=`application/x-open-knowledge-sidebar-item+json`,f={image:!0,video:!0,audio:!0,pdf:!0,text:!0,mermaid:!0};function p(e){return JSON.stringify(e)}function m(e){return e?Array.from(e.types).includes(d):!1}function ee(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:a(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:r(e.assetPath)}:{target:u(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:i(e.docName)}}function h(e){if(!e||!m(e))return null;let t=e.getData(d);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!g(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!_(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _(e){return typeof e==`string`&&Object.hasOwn(f,e)}var v=`.md`,y=/\.(md|mdx)$/i;function b(t,r=v){return y.test(t)||e(t)||n(t)?t:`${t}${r}`}function x(e){return $(e).replace(y,``)}function S(e,t){let n=$(e),r=k(t),i=t.find(e=>s(e)&&A(e,r)===n)??t.find(e=>s(e)&&w(e)===n);if(i)return i.docName;let a=x(n);return t.find(e=>{let t=w(e);return t!==n&&y.test(t)&&x(t)===a})&&y.test(n)?n:a}function C(e,t){let n=k(t);return t.find(t=>A(t,n)===e)??t.find(t=>w(t)===e)}function w(e){return c(e)?D(e.path):l(e)?e.path:b(e.docName,e.docExt)}function T(e){let t=$(e).match(y);return t?`.${t[1].toLowerCase()}`:void 0}function E(e){return $(e)}function D(e){let t=$(e.trim());return t?`${t}/`:``}function O(e){return e.endsWith(`/`)?E(e):x(e)}function k(e){let t=new Map;for(let n of e){if(!s(n))continue;let e=n.docName.match(y);if(!e)continue;let r=n.docName.slice(0,-e[0].length),i=t.get(r);i?i.add(e[0]):t.set(r,new Set([e[0]]))}return t}function A(e,t){let n=w(e);if(!s(e))return n;let r=e.docName.match(y);if(!r)return n;let i=e.docName.slice(0,-r[0].length);return(t.get(i)?.size??0)>1?n:`${e.docName}${e.docExt??v}`}function j(e){let t=k(e),n=new Set,r=[];for(let i of e){let e=A(i,t);n.has(e)||(n.add(e),r.push(e))}return r}function M(e){return[...e].sort().join(`\0`)}function N(e){return M(j(e))}function P(e,t={}){let n=new Set;for(let r of e){let e=(c(r)||l(r)?r.path:r.docName).split(`/`).filter(Boolean);if(!t.includeOkFolders&&e.includes(`.ok`))continue;if(c(r)){let e=D(r.path);e&&n.add(e)}let i=c(r)?e.length:e.length-1;for(let t=1;t<=i;t++)n.add(`${e.slice(0,t).join(`/`)}/`)}return[...n].sort()}function F(e){if(!e)return[];let t=$(e.replace(y,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function I(e,t,n){let r=T(e);if(r)return r;let i=n.find(e=>s(e)&&e.docName===t);return i?i.docExt??v:Q(e).includes(`.`)?void 0:v}function L(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!l(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function R(e,t,n){if(T(e))return null;let r=n.find(e=>l(e)&&e.path===t);return r?r.path:Q(e).includes(`.`)?t:L(t,n)}function z(e,t){let n=e.kind===`directory`,r=n?E(e.path):S(e.path,t);if(n)return{kind:`folder`,name:$(Q(e.path)).replace(y,``),path:r,treePath:V(e.path,!0)};let i=R(e.path,r,t);if(i)return{kind:`asset`,name:$(Q(i)),path:i,treePath:i};let a=I(e.path,r,t);return{kind:`file`,name:$(Q(e.path)).replace(y,``),path:r,treePath:V(e.path,!1),docExt:a}}function B(e){return e.kind===`directory`?E(e.path):e.path}function V(e,t){return t?D(e):y.test(e)?e:`${e}${v}`}function H(e,t,n){let r=D(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${v}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function U(e,t){return e===`file`?V(t,!1):`${E(t)}/index${v}`}function W(e,t){return t.kind===`root`||t.directoryPath==null?Q(e):`${t.directoryPath}${Q(e)}`}function G(e,t){if(t)return E(D(e));let n=x(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function K(e,t){let n=E(D(e));return n?`${n}/${t}`:t}function q(e,t,n){e.append(`parentDocName`,K(t,n)),e.append(`placement`,`parent-dir`)}function J(e,t){return(t.path??K(e,t.src)).replace(/^\/+/,``)}function Y(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function X(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function Z(e,n){let r=o(e).toLowerCase();if(r===``)return null;let i=new Date().toISOString();if(r===`.md`||r===`.mdx`)return{kind:`document`,docName:x(e),docExt:r,modified:i,size:n.size};let a=r.startsWith(`.`)?r.slice(1):r;return{kind:`asset`,path:e,assetExt:a,mediaKind:t(a),modified:i,size:n.size}}function Q(e){let t=$(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function $(e){return e.endsWith(`/`)?e.slice(0,-1):e}export{h as A,z as C,d as D,J as E,m as O,S,O as T,G as _,U as a,E as b,j as c,w as d,X as f,V as g,Y as h,W as i,p as j,ee as k,N as l,D as m,P as n,H as o,C as p,F as r,b as s,q as t,Z as u,B as v,M as w,x,L as y};