@inkeep/open-knowledge 0.39.0-beta.8 → 0.39.0-beta.9

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 (63) hide show
  1. package/dist/{acp-harness-probe-DjTv5e1A.mjs → acp-harness-probe-BrOIuxee.mjs} +2 -2
  2. package/dist/assets/skills/discovery/SKILL.md +1 -1
  3. package/dist/assets/skills/project/SKILL.md +1 -1
  4. package/dist/cli.mjs +6 -6
  5. package/dist/constants-W5X7lzwf.mjs +2 -0
  6. package/dist/index.mjs +1 -1
  7. package/dist/init-CIi-cdDQ.mjs +1 -0
  8. package/dist/{init-B_KvF9QQ.mjs → init-CPNddICq.mjs} +3 -3
  9. package/dist/{launch-json-removal-DaC6MWYi.mjs → launch-json-removal-BfuiPEr_.mjs} +2 -2
  10. package/dist/loader-BWMy7gMr.mjs +1 -0
  11. package/dist/{loader-DkorwqUF.mjs → loader-Dof4y0ze.mjs} +2 -2
  12. package/dist/{preview-Bce8FXXe.mjs → preview-BCbVoSQK.mjs} +2 -2
  13. package/dist/preview-DKku4BY2.mjs +1 -0
  14. package/dist/public/assets/{ActivityModeContent-But5j0lr.js → ActivityModeContent-BQLss-BE.js} +1 -1
  15. package/dist/public/assets/{AgentDiffPane-oydx_GOA.js → AgentDiffPane-B_TmNOOS.js} +1 -1
  16. package/dist/public/assets/{AgentThreadClientBinder-BKKe4a6D.js → AgentThreadClientBinder-Be-VMGZV.js} +1 -1
  17. package/dist/public/assets/{CopyButton-D0gTyMvW.js → CopyButton-Cbumgow3.js} +1 -1
  18. package/dist/public/assets/{DocumentContext-DN3M8p0h.js → DocumentContext-4RBN9Oik.js} +1 -1
  19. package/dist/public/assets/FeedbackForm-D_mXeHle.js +1 -0
  20. package/dist/public/assets/{ManagedArtifactProperties-BB3-9OBw.js → ManagedArtifactProperties-Bd4rE8Ks.js} +1 -1
  21. package/dist/public/assets/{PropertyPanel-CinI1G1g.js → PropertyPanel-BwdCsrPn.js} +1 -1
  22. package/dist/public/assets/{ReportBugDialogBody-BMOl6KV7.js → ReportBugDialogBody-AEXnxadV.js} +1 -1
  23. package/dist/public/assets/SettingsDialogBody-CAkmpKWt.js +7 -0
  24. package/dist/public/assets/{SkillEditorActions-ZkQKiOQc.js → SkillEditorActions-PVnPdxy2.js} +1 -1
  25. package/dist/public/assets/{SourceEditor-4CJXi9kJ.js → SourceEditor-YXhnts5y.js} +1 -1
  26. package/dist/public/assets/{TerminalSessionsHost-CaOjEcgq.js → TerminalSessionsHost-CfucJ1z0.js} +2 -2
  27. package/dist/public/assets/{TerminalWindowApp-C2al62bW.js → TerminalWindowApp-J6-xAbRj.js} +1 -1
  28. package/dist/public/assets/ThreadView-BvgNNafC.js +6 -0
  29. package/dist/public/assets/{TimelineDiffPane-C8Qnc4zA.js → TimelineDiffPane-B9PP3AzZ.js} +1 -1
  30. package/dist/public/assets/{agent-diff-store-D5yp573E.js → agent-diff-store-BDu-qYpS.js} +1 -1
  31. package/dist/public/assets/auth-state-cache-DI5ppoto.js +11 -0
  32. package/dist/public/assets/follow-file-grI1hNx7.js +1 -0
  33. package/dist/public/assets/index-DLWWMHtL.css +1 -0
  34. package/dist/public/assets/{index-Lsv_5pDn.js → index-Q9MYvDYY.js} +98 -98
  35. package/dist/public/assets/{selection-context-TzGfTWCl.js → selection-context-DOeF93Po.js} +1 -1
  36. package/dist/public/assets/separator-Cvkbg_YK.js +1 -0
  37. package/dist/public/assets/{skill-actions-CzuWC1X5.js → skill-actions-D9Vn0ymW.js} +1 -1
  38. package/dist/public/assets/thread-client-DyotU42S.js +1 -0
  39. package/dist/public/assets/{typing-burst-detector-D-Tl1w8f.js → typing-burst-detector-D8mQRP5S.js} +1 -1
  40. package/dist/public/assets/{use-activity-panel-Dth1RWbL.js → use-activity-panel-CasauzqS.js} +1 -1
  41. package/dist/public/assets/{use-timeline-entry-diff-CJ-IHgH7.js → use-timeline-entry-diff-C1lHV9NQ.js} +1 -1
  42. package/dist/public/index.html +22 -22
  43. package/dist/{repair-launch-json-BDfwi9-9.mjs → repair-launch-json-B_QBIfGY.mjs} +2 -2
  44. package/dist/{repair-mcp-configs-kCwuW5Ze.mjs → repair-mcp-configs-DPkRNZjR.mjs} +2 -2
  45. package/dist/{src-BQhUreu4.mjs → src-kjR_dI-1.mjs} +2 -2
  46. package/dist/{start-CmXhmoqo.mjs → start-BzSvov1E.mjs} +2 -2
  47. package/dist/start-REG2U44u.mjs +1 -0
  48. package/package.json +4 -4
  49. package/dist/constants-DtCru_h4.mjs +0 -2
  50. package/dist/init-C_Z3gBHj.mjs +0 -1
  51. package/dist/loader-Aakvd0a9.mjs +0 -1
  52. package/dist/preview-8ufWS_Yg.mjs +0 -1
  53. package/dist/public/assets/FeedbackForm-MFOBrkxc.js +0 -1
  54. package/dist/public/assets/SettingsDialogBody-Gk5e3niv.js +0 -7
  55. package/dist/public/assets/ThreadView-CXI_J3i2.js +0 -4
  56. package/dist/public/assets/auth-state-cache-CPrBjd7m.js +0 -11
  57. package/dist/public/assets/download-wdc_OGNY.js +0 -1
  58. package/dist/public/assets/follow-file-Db721Zx6.js +0 -1
  59. package/dist/public/assets/index-CJ7E0pG6.css +0 -1
  60. package/dist/public/assets/thread-client-BkoRZOHk.js +0 -1
  61. package/dist/start-Dw3sT0mB.mjs +0 -1
  62. /package/dist/public/assets/{copy-Dwat-rG5.js → copy-DmfcimOx.js} +0 -0
  63. /package/dist/public/assets/{workspace-paths-CDfRQ5qH.js → workspace-paths-BKmDPpqj.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{A as e}from"./DocumentContext-DN3M8p0h.js";function t(e){return e.lineCount===1&&e.charLen<100?{kind:`inline`,markdown:e.markdown}:e.surface===`source`&&e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?{kind:`lines`,startLine:e.sourceLineStart,endLine:e.sourceLineEnd}:{kind:`anchor`,markdown:e.markdown}}function n(e,t){return e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?`${t} (${e.sourceLineStart===e.sourceLineEnd?`${e.sourceLineStart}`:`${e.sourceLineStart}-${e.sourceLineEnd}`})`:e.lineCount>1?`${t} (${e.lineCount} lines)`:`${t} (selection)`}function r(e){let t=e.replace(/\r\n/g,`
1
+ import{A as e}from"./DocumentContext-4RBN9Oik.js";function t(e){return e.lineCount===1&&e.charLen<100?{kind:`inline`,markdown:e.markdown}:e.surface===`source`&&e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?{kind:`lines`,startLine:e.sourceLineStart,endLine:e.sourceLineEnd}:{kind:`anchor`,markdown:e.markdown}}function n(e,t){return e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?`${t} (${e.sourceLineStart===e.sourceLineEnd?`${e.sourceLineStart}`:`${e.sourceLineStart}-${e.sourceLineEnd}`})`:e.lineCount>1?`${t} (${e.lineCount} lines)`:`${t} (selection)`}function r(e){let t=e.replace(/\r\n/g,`
2
2
  `).split(`
3
3
  `),n=[],r=!1;for(let e of t){let t=e.trim();if(/^(```|~~~)/.test(t)){r||n.push(`code`),r=!r;continue}if(r||t===``)continue;if(/^\|.*\|?$/.test(t)&&t.includes(`|`)){n[n.length-1]!==`table`&&n.push(`table`);continue}if(/^<\/?[A-Za-z]/.test(t)){n[n.length-1]!==`component`&&n.push(`component`);continue}let i=t.match(/^#{1,6}\s+(.*)$/);if(i){n.push(i[1]??``);continue}let a=t.match(/^[-*+]\s+(.*)$/);if(a){n.push(`• ${a[1]??``}`);continue}let o=t.match(/^\d+\.\s+(.*)$/);if(o){n.push(`• ${o[1]??``}`);continue}let s=t.match(/^>\s?(.*)$/);if(s){n.push(s[1]??``);continue}n.push(t)}return n.join(` `).replace(/\s+/g,` `).trim()}var i=new Map,a=new Set,o=(e,t)=>`${t}:${e}`;function s(){for(let e of a)e()}function c(e,t){return e.markdown===t.markdown&&e.sourceLineStart===t.sourceLineStart&&e.sourceLineEnd===t.sourceLineEnd}function l(e,t,n){let r=o(e,t);if(n===null){i.delete(r)&&s();return}let a=i.get(r);a&&c(a,n)||(i.set(r,n),s())}function u(e,t){return e===null?null:i.get(o(e,t))??null}function d(e){return a.add(e),()=>{a.delete(e)}}function f(t,n){if(t.state.selection.empty)return null;let r=e(t);return r.trim()?{surface:`wysiwyg`,docName:n,markdown:r,charLen:r.trim().length,lineCount:(r.match(/\n/g)?.length??0)+1}:null}function p(e,t){return e.trim()?{surface:`frontmatter`,docName:t,markdown:e,charLen:e.trim().length,lineCount:(e.match(/\n/g)?.length??0)+1}:null}function m(e,t){let n=[],r=1/0,i=-1;for(let t of e.state.selection.ranges)t.empty||(n.push(e.state.sliceDoc(t.from,t.to)),r=Math.min(r,t.from),i=Math.max(i,t.to));if(n.length===0)return null;let a=n.join(`
4
4
  `);if(!a.trim())return null;let o=e.state.doc.lineAt(r).number,s=e.state.doc.lineAt(i).number;return{surface:`source`,docName:t,markdown:a,charLen:a.trim().length,lineCount:s-o+1,sourceLineStart:o,sourceLineEnd:s}}export{p as a,t as c,n as i,d as l,r as n,m as o,l as r,f as s,u as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{t as n}from"./react-JNybMug3.js";import{t as r}from"./compiler-runtime-dQcBxOhn.js";import{s as i,t as a}from"./createLucideIcon-BUb14crZ.js";import{d as o}from"./dist-Bv-DNDka.js";var s=e(n(),1),c=t(),l=`Separator`,u=`horizontal`,d=[`horizontal`,`vertical`],f=s.forwardRef((e,t)=>{let{decorative:n,orientation:r=u,...i}=e,a=p(r)?r:u,s=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,c.jsx)(o.div,{"data-orientation":a,...s,...i,ref:t})});f.displayName=l;function p(e){return d.includes(e)}var m=f,h=a(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),g=r();function _(e){let t=(0,g.c)(12),n,r,a,o;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4]):({className:n,orientation:a,decorative:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o);let s=a===void 0?`horizontal`:a,l=o===void 0?!0:o,u;t[5]===n?u=t[6]:(u=i(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=u);let d;return t[7]!==l||t[8]!==s||t[9]!==r||t[10]!==u?(d=(0,c.jsx)(m,{"data-slot":`separator`,decorative:l,orientation:s,className:u,...r}),t[7]=l,t[8]=s,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}export{h as n,_ as t};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{t as n}from"./react-JNybMug3.js";import{n as r,r as i}from"./dist-DBENJeML.js";import{t as a}from"./compiler-runtime-dQcBxOhn.js";import{t as o}from"./createLucideIcon-BUb14crZ.js";import{t as s}from"./button-DHE6Sx02.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dialog-BLaUGJCd.js";import{a as g,d as _,f as v,i as y,o as b,p as x,u as S}from"./dropdown-menu-CcKe8PiU.js";import{t as C}from"./label-bn6BDr7p.js";import{O as w,a as T,f as E,h as D,m as O,n as k,o as A,p as j,r as M,s as N,t as P,y as F}from"./agent-visibility-BUmsS0vL.js";import{$t as I,Et as L,Ft as R,Kt as z,Lt as B,P as V,Rt as H,Zt as U,ai as W,at as G,bn as K,en as q,fn as J,gn as ee,hn as Y,mn as te,ot as ne,pn as re,vn as ie,xn as ae,yn as oe}from"./dist-CDKZLcnD.js";import{t as se}from"./RegisteredAgentIcon--E1135hW.js";import{a as ce,d as le,l as ue,n as de,r as fe,t as pe,u as me}from"./workspace-paths-CDfRQ5qH.js";import{t as he}from"./copy-Dwat-rG5.js";import{t as ge}from"./folder-open-C-WgQ0Xp.js";import{t as _e}from"./loader-circle-K7Xwpjny.js";import{t as ve}from"./refresh-cw-DSH9Of_0.js";import{t as ye}from"./sliders-horizontal-C9Uy29A1.js";import{t as be}from"./trash-2-DpF__0y9.js";import{n as X}from"./dist-DwCd6eR-.js";import{t as xe}from"./input-CsXmpyZP.js";import{t as Se}from"./dist-BD3698ve.js";import{t as Ce}from"./parse-api-error-DucXvNZh.js";import{o as we,s as Te}from"./documents-events-DNDUkpJM.js";import{n as Ee}from"./config-context-C5AosGyi.js";import{t as De}from"./use-workspace-C1D_I03G.js";import{n as Oe}from"./clipboard-adapter-BGIXxhKQ.js";import{a as ke,d as Ae,f as je,n as Me,s as Ne,t as Pe}from"./skills-api-CGbwE9vp.js";var Fe=o(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),Ie=o(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Le=o(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Re=o(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Z=t(),Q=e(n(),1),$=a();function ze(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function Be(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Ce(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Ve(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?ze(e):Be()}var He=`ok:skill:cowork:installed`,Ue=`1`,We=250,Ge=`/api/skill/install-state`;function Ke(e){return`${He}:v${e}`}var qe=new Map;async function Je(e={},t={}){let n=t.force?`__force__`:`__default__`,r=qe.get(n);if(r)return r;let i=Ye(e,t);return qe.set(n,i),i.finally(()=>{qe.get(n)===i&&qe.delete(n)}),i}async function Ye(e,t){let n=e.installer===void 0?Ve():e.installer,r=Xe(e.storage),i=e.fetchSnapshot??Qe,a=e.serverTimeoutMs??We,o=null;if(!t.force){try{o=await $e(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Ke(o?.currentVersion??e.fallbackSkillVersion??Ze());if(!t.force&&r?.getItem(s)===Ue)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,Ue)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Xe(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Ze(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Qe(){let e;try{e=await fetch(Ge,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function $e(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function et(e){return Je({},e)}function tt(){return Je({},{force:!0})}async function nt(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function rt(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return nt({target:`claude-cowork`,url:U({mode:`cowork`},e)},n);case`claude-code`:return nt({target:`claude-code`,url:U({mode:`code`},e)},n);case`codex`:return nt({target:`codex`,url:I(e)},n);case`cursor`:return nt({target:`cursor`,url:q(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function it(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var at=`open-knowledge:agent-thread-launch`;function ot(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(at,{detail:e}))}function st(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(at,n),()=>t.removeEventListener(at,n)}function ct(e){if(!e.docName||!e.workspace)return null;let t=pe(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:de(n,t,r)}}function lt(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function ut(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function dt(e){return j(e.installUrl).then(()=>void 0)}function ft(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function pt(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function mt(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace;if(e.docName){let r=e.docRelativePath??pe(e.docName),i={scope:`doc`,docRelativePath:r,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?i:{...i,selection:e.selection},projectDir:t,docPath:de(t,r,n)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function ht(e){return`Opened in ${e}.`}function gt(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function _t(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function vt(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function yt(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function bt(e,t,n,r){return e.compose?z(yt(e.compose,t,n,r)):e.selection?ie({...e.selection,target:t,transport:r}):e.skill?oe(e.skill.name,e.skill.scope,n):e.ask?J(e.ask.relativePath,e.ask.instruction,n,t,r):W(e.docContext===null?e.folderRelativePath?ee(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?te(n,e.instruction,r):re(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):Y(e.docContext.relativePath,n,e.instruction,r))}function xt(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${G} ${bt(e,B[t].handoffTarget,!1,`terminal`)}`:K(e.docContext?.relativePath??null)}function St(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${ne} ${bt(e,`claude-code`,!1,`terminal`)}`:ae(e.docContext?.relativePath??null)}function Ct(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function wt(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function Tt(e,t){ot({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:St(e),docName:Ct(e),titleHint:wt(e)})}async function Et(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`OpenKnowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:bt(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=vt(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(ht(u));else{let i=_t(r),a=gt(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Et(e,t,n,r+1)}}})}return a}function Dt(e){return O.find(t=>t.id===e)?.displayName??e}function Ot(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function kt(){return{dispatchHandoff:rt,recordHandoff:it,toast:{success:e=>{X.success(e)},error:(e,t)=>{X.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Ot(),getDisplayName:Dt,ensureCoworkSkillInstalled:et,autoOpen:!0}}function At(){let e=(0,$.c)(2),{merged:t}=Ee(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>Et(e,t,{...kt(),autoOpen:n}),reinstallCoworkSkill:tt},e[0]=n,e[1]=r),r}var jt=[...new Set(O.flatMap(e=>e.schemes))];function Mt(e,t){let n=t.now?.()??Date.now(),r={};for(let t of O){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function Nt(e){return Mt({},e)}async function Pt(e){let t=e.schemes??jt,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var Ft=Object.fromEntries(jt.map(e=>[e,{installed:!1}]));async function It(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return Ft}if(!t.ok)return Ft;let n;try{n=await t.json()}catch{return Ft}if(typeof n!=`object`||!n||Array.isArray(n))return Ft;let r=n,i={};for(let e of jt)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Lt(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function Rt(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Nt({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Mt(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!Lt(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function zt(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Bt(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Pt({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>It({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Vt(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Ht),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Rt(Bt());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function Ht(){return Nt({isElectronHost:zt(),now:Date.now})}var Ut=(0,Q.createContext)(null);function Wt(e){let t=(0,$.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(Ut,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Gt(){return(0,Q.use)(Ut)}function Kt(e){let t=(0,$.c)(48),{itemName:n,isSubmitting:a,onDelete:o,customTitle:h,customDescription:g,customDetail:_,customConfirmLabel:v,customConfirmLabelBusy:y,children:b}=e,{_:x}=i(),S;t[0]!==x||t[1]!==n?(S=n??x({id:`L3CEC1`}),t[0]=x,t[1]=n,t[2]=S):S=t[2];let C=S,w;t[3]!==x||t[4]!==v?(w=v??x({id:`cnGeoo`}),t[3]=x,t[4]=v,t[5]=w):w=t[5];let T=w,E;t[6]!==x||t[7]!==v||t[8]!==y?(E=y??v??x({id:`s3caR3`}),t[6]=x,t[7]=v,t[8]=y,t[9]=E):E=t[9];let D=E,O;t[10]!==x||t[11]!==h||t[12]!==C?(O=h??x({id:`77SdEP`,values:{itemName:C}}),t[10]=x,t[11]=h,t[12]=C,t[13]=O):O=t[13];let k;t[14]===O?k=t[15]:(k=(0,Z.jsx)(l,{children:O}),t[14]=O,t[15]=k);let A;t[16]!==x||t[17]!==g||t[18]!==C?(A=g??x({id:`16D5Zj`,values:{itemName:C}}),t[16]=x,t[17]=g,t[18]=C,t[19]=A):A=t[19];let j;t[20]===A?j=t[21]:(j=(0,Z.jsx)(c,{className:`whitespace-pre-wrap`,children:A}),t[20]=A,t[21]=j);let M;t[22]===_?M=t[23]:(M=_?(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`delete-confirmation-detail`,children:_}):null,t[22]=_,t[23]=M);let N;t[24]!==k||t[25]!==j||t[26]!==M?(N=(0,Z.jsxs)(m,{children:[k,j,M]}),t[24]=k,t[25]=j,t[26]=M,t[27]=N):N=t[27];let P;t[28]===b?P=t[29]:(P=b?(0,Z.jsx)(d,{children:b}):null,t[28]=b,t[29]=P);let F;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(r,{id:`dEgA5A`}),t[30]=F):F=t[30];let I;t[31]===a?I=t[32]:(I=(0,Z.jsx)(p,{asChild:!0,children:(0,Z.jsx)(s,{variant:`outline`,disabled:a,children:F})}),t[31]=a,t[32]=I);let L;t[33]!==T||t[34]!==D||t[35]!==a?(L=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_e,{className:`size-4 animate-spin`}),` `,D]}):T,t[33]=T,t[34]=D,t[35]=a,t[36]=L):L=t[36];let R;t[37]!==a||t[38]!==o||t[39]!==L?(R=(0,Z.jsx)(s,{variant:`destructive`,onClick:o,disabled:a,children:L}),t[37]=a,t[38]=o,t[39]=L,t[40]=R):R=t[40];let z;t[41]!==I||t[42]!==R?(z=(0,Z.jsxs)(f,{children:[I,R]}),t[41]=I,t[42]=R,t[43]=z):z=t[43];let B;return t[44]!==P||t[45]!==z||t[46]!==N?(B=(0,Z.jsxs)(u,{children:[N,P,z]}),t[44]=P,t[45]=z,t[46]=N,t[47]=B):B=t[47],B}function qt(e){return e?Se._({id:`wTcjov`}):null}function Jt(e){let t=(0,$.c)(47),{_:n}=i(),a=fe(),o=Gt(),s=w(),c=E();if(a)return null;let{input:l,installStates:u,dispatch:d,onBeforeLaunch:f}=e,p=l===null,m,h,C,O,j,I,L,R,z,V,U;if(t[0]!==n||t[1]!==d||t[2]!==l||t[3]!==p||t[4]!==u||t[5]!==f||t[6]!==c||t[7]!==s||t[8]!==o){let e=qt(p),i;t[20]===c?i=t[21]:(i=e=>P(c,e.id),t[20]=c,t[21]=i);let a=D.filter(i),w;t[22]===c?w=t[23]:(w=e=>k(c,e.source,e.id,!0,e.supported),t[22]=c,t[23]=w);let E=s.filter(w),F=o?H.filter(e=>M(c,e,o.installedClis)):[];C=a.length>0,O=o!==null&&F.length>0,j=E.length>0,h=_,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsxs)(x,{children:[(0,Z.jsx)(ue,{"aria-hidden":`true`}),(0,Z.jsx)(r,{id:`O7_W_a`})]}),t[24]=U):U=t[24],m=v,I=`max-h-80`,L=j?(0,Z.jsxs)(y,{"aria-label":n({id:`vPKX2i`}),children:[(0,Z.jsxs)(b,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(r,{id:`RXEbZy`}),(0,Z.jsx)(N,{})]}),E.map(t=>{let i=t.name;return(0,Z.jsxs)(g,{onSelect:()=>{l!==null&&(f?.(),Tt(l,{agent:{source:t.source,id:t.id}}))},disabled:p,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":e?n({id:`gtGQ9S`,values:{agentName:i,hint:e}}):void 0,children:[(0,Z.jsx)(se,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(r,{id:`5PrrYw`,values:{agentName:i}})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==C||t[26]!==O||t[27]!==j?(R=j&&(O||C)?(0,Z.jsx)(S,{}):null,t[25]=C,t[26]=O,t[27]=j,t[28]=R):R=t[28],z=O?(0,Z.jsxs)(y,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(b,{children:(0,Z.jsx)(r,{id:`ALhMYW`})}),F.map(t=>{let{displayName:r}=B[t];return(0,Z.jsxs)(g,{onSelect:()=>{l!==null&&(f?.(),o.launchInTerminal(l,t))},disabled:p,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(A,{id:T(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,V=C?(0,Z.jsxs)(Z.Fragment,{children:[O?(0,Z.jsx)(S,{}):null,(0,Z.jsxs)(y,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(b,{children:(0,Z.jsx)(r,{id:`BBqGS9`})}),a.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(g,{disabled:!r,onSelect:()=>{if(l){if(f?.(),u[t.id]?.installed!==!0){dt(t);return}d(t.id,l)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(A,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=d,t[2]=l,t[3]=p,t[4]=u,t[5]=f,t[6]=c,t[7]=s,t[8]=o,t[9]=m,t[10]=h,t[11]=C,t[12]=O,t[13]=j,t[14]=I,t[15]=L,t[16]=R,t[17]=z,t[18]=V,t[19]=U}else m=t[9],h=t[10],C=t[11],O=t[12],j=t[13],I=t[14],L=t[15],R=t[16],z=t[17],V=t[18],U=t[19];let W;t[29]!==C||t[30]!==O||t[31]!==j?(W=j||O||C?(0,Z.jsx)(S,{}):null,t[29]=C,t[30]=O,t[31]=j,t[32]=W):W=t[32];let G;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(ye,{"aria-hidden":`true`}),t[33]=G):G=t[33];let K;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsxs)(g,{onSelect:F,"data-testid":`file-tree-open-in-settings`,children:[G,(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(r,{id:`jRAGrQ`})})]}),t[34]=K):K=t[34];let q;t[35]!==m||t[36]!==I||t[37]!==L||t[38]!==R||t[39]!==z||t[40]!==V||t[41]!==W?(q=(0,Z.jsxs)(m,{className:I,children:[L,R,z,V,W,K]}),t[35]=m,t[36]=I,t[37]=L,t[38]=R,t[39]=z,t[40]=V,t[41]=W,t[42]=q):q=t[42];let J;return t[43]!==h||t[44]!==U||t[45]!==q?(J=(0,Z.jsxs)(h,{children:[U,q]}),t[43]=h,t[44]=U,t[45]=q,t[46]=J):J=t[46],J}function Yt(e){let t=(0,$.c)(8),n=e?.enabled??!0,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`idle`},t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(0),c,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=()=>s($t),t=Te(e),n=we(t=>{t.includes(`files`)&&e()});return()=>{t(),n()}},l=[],t[1]=c,t[2]=l):(c=t[1],l=t[2]),(0,Q.useEffect)(c,l);let u;t[3]===n?u=t[4]:(u=()=>{if(!n)return;let e=!1;return a(Qt),fetch(`/api/skills`).then(Xt).then(t=>{if(e)return;let n=R.safeParse(t);if(!n.success){console.error(`[ok-skills] /api/skills response failed schema validation:`,n.error.issues),a({status:`error`,message:`Server returned an incomplete skills response.`});return}a({status:`ready`,data:n.data.skills})}).catch(t=>{e||a({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},t[3]=n,t[4]=u);let d;return t[5]!==n||t[6]!==o?(d=[o,n],t[5]=n,t[6]=o,t[7]=d):d=t[7],(0,Q.useEffect)(u,d),i}async function Xt(e){if(!e.ok){let t=await e.json().catch(Zt);throw Error(Ce(t)??`HTTP ${e.status}`)}return e.json()}function Zt(){return null}function Qt(e){return e.status===`ready`?e:{status:`loading`}}function $t(e){return e+1}function en(e){let t=(0,$.c)(16),{skill:n,onOpenChange:r,onDeleted:a}=e,{_:o}=i(),[s,c]=(0,Q.useState)(!1),l;t[0]!==o||t[1]!==a||t[2]!==r?(l=async function(e){c(!0);let t=await Pe(e.scope,e.name);if(c(!1),!t.ok){let{error:e}=t;X.error(o({id:`AtBdnD`,values:{error:e}}));return}X.success(o({id:`h9QFb9`,values:{0:e.name}})),a(),r(!1)},t[0]=o,t[1]=a,t[2]=r,t[3]=l):l=t[3];let u=l,d=n!==null,f;t[4]!==s||t[5]!==r?(f=e=>{!e&&!s&&r(!1)},t[4]=s,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==n?(p=n?(0,Z.jsx)(Kt,{itemName:o({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:s,onDelete:()=>u(n),customDescription:o({id:`E1Da_b`,values:{0:n.path}})}):null,t[7]=o,t[8]=s,t[9]=u,t[10]=n,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,Z.jsx)(h,{open:d,onOpenChange:f,children:p}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function tn(e){let t=(0,$.c)(68),{skill:n,existingNames:a,onOpenChange:o,onRenamed:d}=e,{_:p}=i(),g=n!==null,_=(0,Q.useId)(),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(!1),S;t[0]===n?S=t[1]:(S=()=>{n&&y(n.name)},t[0]=n,t[1]=S);let w=n?.scope,T=n?.name,E;if(t[2]!==w||t[3]!==T?(E=[w,T],t[2]=w,t[3]=T,t[4]=E):E=t[4],(0,Q.useEffect)(S,E),!n)return null;let D,O,k,A;t[5]!==a||t[6]!==v||t[7]!==n.name?(k=v.trim(),A=k===n.name,D=k===``||!L.test(k),O=!D&&!A&&a.has(k),t[5]=a,t[6]=v,t[7]=n.name,t[8]=D,t[9]=O,t[10]=k,t[11]=A):(D=t[8],O=t[9],k=t[10],A=t[11]);let j=O,M=!D&&!j&&!A&&!b,N;t[12]!==p||t[13]!==M||t[14]!==o||t[15]!==d||t[16]!==n||t[17]!==k?(N=async function(){if(!n||!M)return;x(!0);let e=await Ne({scope:n.scope,fromName:n.name,toName:k});if(x(!1),!e.ok){X.error(p({id:`zKxoPm`,values:{0:n.name,1:e.error}}));return}X.success(p({id:`dUCQo4`,values:{trimmed:k}})),d?.(k),o(!1)},t[12]=p,t[13]=M,t[14]=o,t[15]=d,t[16]=n,t[17]=k,t[18]=N):N=t[18];let P=N,F;t[19]===o?F=t[20]:(F=e=>e?null:o(!1),t[19]=o,t[20]=F);let I;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(l,{children:(0,Z.jsx)(r,{id:`dw_3cv`})}),t[21]=I):I=t[21];let R;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsxs)(m,{children:[I,(0,Z.jsx)(c,{children:(0,Z.jsx)(r,{id:`R9IDFz`})})]}),t[22]=R):R=t[22];let z;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(r,{id:`6YtxFj`}),t[23]=z):z=t[23];let B;t[24]===_?B=t[25]:(B=(0,Z.jsx)(C,{htmlFor:_,children:z}),t[24]=_,t[25]=B);let V;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(V=e=>y(e.target.value),t[26]=V):V=t[26];let H;t[27]===P?H=t[28]:(H=e=>{e.key===`Enter`&&P()},t[27]=P,t[28]=H);let U=D||j,W=D&&k!==``||j?`${_}-error`:void 0,G;t[29]!==_||t[30]!==v||t[31]!==H||t[32]!==U||t[33]!==W?(G=(0,Z.jsx)(xe,{id:_,value:v,onChange:V,onKeyDown:H,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":U,"aria-describedby":W,className:`font-mono`}),t[29]=_,t[30]=v,t[31]=H,t[32]=U,t[33]=W,t[34]=G):G=t[34];let K;t[35]!==j||t[36]!==_||t[37]!==D||t[38]!==k?(K=D&&k!==``?(0,Z.jsx)(`p`,{id:`${_}-error`,className:`text-xs text-destructive`,children:(0,Z.jsx)(r,{id:`A50vr3`,components:{0:(0,Z.jsx)(`code`,{className:`font-mono`})}})}):j?(0,Z.jsx)(`p`,{id:`${_}-error`,className:`text-xs text-destructive`,children:(0,Z.jsx)(r,{id:`YJ1BTp`})}):null,t[35]=j,t[36]=_,t[37]=D,t[38]=k,t[39]=K):K=t[39];let q;t[40]!==B||t[41]!==G||t[42]!==K?(q=(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[B,G,K]}),t[40]=B,t[41]=G,t[42]=K,t[43]=q):q=t[43];let J;t[44]===o?J=t[45]:(J=()=>o(!1),t[44]=o,t[45]=J);let ee;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(r,{id:`dEgA5A`}),t[46]=ee):ee=t[46];let Y;t[47]!==b||t[48]!==J?(Y=(0,Z.jsx)(s,{variant:`ghost`,onClick:J,disabled:b,children:ee}),t[47]=b,t[48]=J,t[49]=Y):Y=t[49];let te;t[50]===P?te=t[51]:(te=()=>void P(),t[50]=P,t[51]=te);let ne=!M,re;t[52]===b?re=t[53]:(re=b?(0,Z.jsx)(r,{id:`tHKQ6j`}):(0,Z.jsx)(r,{id:`2wxgft`}),t[52]=b,t[53]=re);let ie;t[54]!==te||t[55]!==ne||t[56]!==re?(ie=(0,Z.jsx)(s,{onClick:te,disabled:ne,children:re}),t[54]=te,t[55]=ne,t[56]=re,t[57]=ie):ie=t[57];let ae;t[58]!==Y||t[59]!==ie?(ae=(0,Z.jsxs)(f,{children:[Y,ie]}),t[58]=Y,t[59]=ie,t[60]=ae):ae=t[60];let oe;t[61]!==q||t[62]!==ae?(oe=(0,Z.jsxs)(u,{children:[R,q,ae]}),t[61]=q,t[62]=ae,t[63]=oe):oe=t[63];let se;return t[64]!==g||t[65]!==oe||t[66]!==F?(se=(0,Z.jsx)(h,{open:g,onOpenChange:F,children:oe}),t[64]=g,t[65]=oe,t[66]=F,t[67]=se):se=t[67],se}function nn(e){let t=(0,$.c)(15),{skill:n,onOpenChange:a,onUpdated:o}=e,{_:g}=i(),[_,v]=(0,Q.useState)(!1),y;t[0]!==g||t[1]!==a||t[2]!==o?(y=async function(e){v(!0);let t=await je({scope:e.scope,name:e.name});v(!1);let n=ce(e.name);if(!t.ok){X.error(g({id:`FRqZ9v`,values:{0:t.error}}));return}X.success(t.checkpointRef?g({id:`My9uXI`,values:{0:t.version,display:n}}):g({id:`mPneVR`,values:{0:t.version,display:n}})),o(),a(!1)},t[0]=g,t[1]=a,t[2]=o,t[3]=y):y=t[3];let b=y,x=n!==null,S;t[4]!==a||t[5]!==_?(S=e=>{!e&&!_&&a(!1)},t[4]=a,t[5]=_,t[6]=S):S=t[6];let C;t[7]!==b||t[8]!==n||t[9]!==_?(C=n?(0,Z.jsxs)(u,{className:`sm:max-w-lg`,children:[(0,Z.jsxs)(m,{children:[(0,Z.jsx)(l,{children:(0,Z.jsx)(r,{id:`iAoh55`,values:{0:ce(n.name)}})}),(0,Z.jsx)(c,{children:n.installedVersion?(0,Z.jsx)(r,{id:`47EXvY`,values:{0:n.bundledVersion??``,1:n.installedVersion}}):(0,Z.jsx)(r,{id:`nD7Fx9`,values:{0:n.bundledVersion??``}})})]}),(0,Z.jsx)(d,{}),(0,Z.jsxs)(f,{children:[(0,Z.jsx)(p,{asChild:!0,children:(0,Z.jsx)(s,{variant:`outline`,disabled:_,children:(0,Z.jsx)(r,{id:`dEgA5A`})})}),(0,Z.jsx)(s,{onClick:()=>void b(n),disabled:_,children:_?(0,Z.jsx)(r,{id:`JL3si7`}):(0,Z.jsx)(r,{id:`EkH9pt`})})]})]}):null,t[7]=b,t[8]=n,t[9]=_,t[10]=C):C=t[10];let w;return t[11]!==x||t[12]!==S||t[13]!==C?(w=(0,Z.jsx)(h,{open:x,onOpenChange:S,children:C}),t[11]=x,t[12]=S,t[13]=C,t[14]=w):w=t[14],w}function rn(){let e=(0,$.c)(30),{_:t}=i(),[n,r]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),d;e[0]===t?d=e[1]:(d=async function(e,n){u(e.name);let r=await ke({scope:e.scope,name:e.name,...n?{targets:[...n]}:{}});if(u(null),!r.ok)return X.error(t({id:`Mj8R8K`,values:{0:r.error}})),r;let i=an,a=new Set(r.hosts),o=r.hosts.filter(t=>!e.hosts.includes(t)),s=e.hosts.filter(e=>!a.has(e)),c=e=>{let t=r.warningCodes.indexOf(e);return t>=0?r.warnings[t]:void 0},l=c(`no-targets`);if(l)return X.warning(l),r;if(o.length>0){let e=c(`scripts-present`);e&&X.warning(e)}return r.hosts.length===0?X.success(t({id:`0LBDjY`,values:{0:e.name}})):o.length>0&&s.length===0?X.success(t({id:`PPFQ3o`,values:{0:e.name,1:i(o)}})):s.length>0&&o.length===0?X.success(t({id:`OOIVJo`,values:{0:e.name,1:i(s)}})):o.length>0&&s.length>0?X.success(t({id:`OxplNM`,values:{0:e.name,1:i(o),2:i(s)}})):X.success(t({id:`wDgmsr`,values:{0:e.name,1:i(r.hosts)}})),r},e[0]=t,e[1]=d);let f=d,p;e[2]===t?p=e[3]:(p=async function(e){u(e.name);let n=await Ae({scope:e.scope,name:e.name});return u(null),n.ok?X.success(t({id:`0LBDjY`,values:{0:e.name}})):X.error(t({id:`nJq7et`,values:{0:n.error}})),n},e[2]=t,e[3]=p);let m=p,h;e[4]===t?h=e[5]:(h=async function(e,n){let r=await Me({scope:e.scope,name:e.name,existingNames:n});if(!r.ok){X.error(t({id:`UPjaXD`,values:{0:e.name,1:r.error}}));return}X.success(t({id:`0g7rCZ`,values:{0:r.name}}))},e[4]=t,e[5]=h);let g=h,_,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{e||r(null)},v=()=>r(null),e[6]=_,e[7]=v):(_=e[6],v=e[7]);let y;e[8]===n?y=e[9]:(y=(0,Z.jsx)(en,{skill:n,onOpenChange:_,onDeleted:v}),e[8]=n,e[9]=y);let b=a?.skill??null,x=a?.existingNames??sn,S,C;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{e||o(null)},C=()=>o(null),e[10]=S,e[11]=C):(S=e[10],C=e[11]);let w;e[12]!==b||e[13]!==x?(w=(0,Z.jsx)(tn,{skill:b,existingNames:x,onOpenChange:S,onRenamed:C}),e[12]=b,e[13]=x,e[14]=w):w=e[14];let T,E;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||c(null)},E=()=>c(null),e[15]=T,e[16]=E):(T=e[15],E=e[16]);let D;e[17]===s?D=e[18]:(D=(0,Z.jsx)(nn,{skill:s,onOpenChange:T,onUpdated:E}),e[17]=s,e[18]=D);let O;e[19]!==w||e[20]!==D||e[21]!==y?(O=(0,Z.jsxs)(Z.Fragment,{children:[y,w,D]}),e[19]=w,e[20]=D,e[21]=y,e[22]=O):O=e[22];let k=O,A;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=(e,t)=>o({skill:e,existingNames:t}),e[23]=A):A=e[23];let j;return e[24]!==k||e[25]!==g||e[26]!==f||e[27]!==l||e[28]!==m?(j={installingName:l,install:f,uninstall:m,duplicate:g,requestDelete:r,requestRename:A,requestUpdate:c,dialogs:k},e[24]=k,e[25]=g,e[26]=f,e[27]=l,e[28]=m,e[29]=j):j=e[29],j}function an(e){return e.map(on).join(`, `)}function on(e){return V[e]??e}var sn=new Set;function cn(e){let t=(0,$.c)(19),{skill:n,onEdit:i,onInstall:a,onUninstall:o,onDelete:s}=e,c,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(me,{"aria-hidden":!0}),l=(0,Z.jsx)(r,{id:`ePK91l`}),t[0]=c,t[1]=l):(c=t[0],l=t[1]);let u;t[2]===i?u=t[3]:(u=(0,Z.jsxs)(g,{onSelect:i,children:[c,l]}),t[2]=i,t[3]=u);let d;t[4]!==a||t[5]!==n.installed?(d=a&&!n.installed?(0,Z.jsxs)(g,{onSelect:a,children:[(0,Z.jsx)(Fe,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`TKQ7K-`})]}):null,t[4]=a,t[5]=n.installed,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.installed?(f=n.installed?(0,Z.jsxs)(g,{onSelect:o,children:[(0,Z.jsx)(Re,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`fo0VXg`})]}):null,t[7]=o,t[8]=n.installed,t[9]=f):f=t[9];let p,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(be,{"aria-hidden":!0}),m=(0,Z.jsx)(r,{id:`cnGeoo`}),t[10]=p,t[11]=m):(p=t[10],m=t[11]);let h;t[12]===s?h=t[13]:(h=(0,Z.jsxs)(g,{variant:`destructive`,onSelect:s,children:[p,m]}),t[12]=s,t[13]=h);let _;return t[14]!==u||t[15]!==d||t[16]!==f||t[17]!==h?(_=(0,Z.jsxs)(Z.Fragment,{children:[u,d,f,h]}),t[14]=u,t[15]=d,t[16]=f,t[17]=h,t[18]=_):_=t[18],_}function ln(e){let t=(0,$.c)(94),{skill:n,actions:a,existingNames:o}=e,{_:s}=i(),c=De(),l=Vt().states,{dispatch:u}=At(),d=typeof window<`u`?window.okDesktop:void 0,f=n.absolutePath,p;t[0]===s?p=t[1]:(p=async function(e){try{await Oe(e),X.success(s({id:`SXCSQd`}))}catch{X.error(s({id:`cRHuuI`}))}},t[0]=s,t[1]=p);let m=p;if(n.managed){let e,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(b,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,Z.jsx)(Ie,{className:`size-3`,"aria-hidden":!0}),(0,Z.jsx)(r,{id:`VITWk5`})]}),i=(0,Z.jsx)(S,{}),t[2]=e,t[3]=i):(e=t[2],i=t[3]);let a;t[4]===f?a=t[5]:(a=d&&f?(0,Z.jsxs)(g,{onSelect:()=>void d.shell.showItemInFolder(f),children:[(0,Z.jsx)(ge,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`LtSYdi`})]}):null,t[4]=f,t[5]=a);let o;t[6]!==n.name||t[7]!==n.scope||t[8]!==c?(o=pt({skillName:n.name,scope:n.scope,workspace:c}),t[6]=n.name,t[7]=n.scope,t[8]=c,t[9]=o):o=t[9];let s;t[10]!==u||t[11]!==l||t[12]!==o?(s=(0,Z.jsx)(Jt,{input:o,installStates:l,isElectronHost:d!=null,dispatch:u}),t[10]=u,t[11]=l,t[12]=o,t[13]=s):s=t[13];let p;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(x,{children:[(0,Z.jsx)(he,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`zd00pH`})]}),t[14]=p):p=t[14];let h;t[15]!==f||t[16]!==m?(h=f?(0,Z.jsx)(g,{onSelect:()=>void m(f),children:(0,Z.jsx)(r,{id:`z2funE`})}):null,t[15]=f,t[16]=m,t[17]=h):h=t[17];let y;t[18]!==m||t[19]!==n.path?(y=()=>void m(n.path),t[18]=m,t[19]=n.path,t[20]=y):y=t[20];let C;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(r,{id:`xloBjn`}),t[21]=C):C=t[21];let w;t[22]===y?w=t[23]:(w=(0,Z.jsx)(g,{onSelect:y,children:C}),t[22]=y,t[23]=w);let T;t[24]!==w||t[25]!==h?(T=(0,Z.jsxs)(_,{children:[p,(0,Z.jsxs)(v,{children:[h,w]})]}),t[24]=w,t[25]=h,t[26]=T):T=t[26];let E;return t[27]!==T||t[28]!==a||t[29]!==s?(E=(0,Z.jsxs)(Z.Fragment,{children:[e,i,a,s,T]}),t[27]=T,t[28]=a,t[29]=s,t[30]=E):E=t[30],E}let h;t[31]===f?h=t[32]:(h=d&&f?(0,Z.jsxs)(g,{onSelect:()=>void d.shell.showItemInFolder(f),children:[(0,Z.jsx)(ge,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`LtSYdi`})]}):null,t[31]=f,t[32]=h);let y;t[33]!==n.name||t[34]!==n.scope||t[35]!==c?(y=pt({skillName:n.name,scope:n.scope,workspace:c}),t[33]=n.name,t[34]=n.scope,t[35]=c,t[36]=y):y=t[36];let C;t[37]!==u||t[38]!==l||t[39]!==y?(C=(0,Z.jsx)(Jt,{input:y,installStates:l,isElectronHost:d!=null,dispatch:u}),t[37]=u,t[38]=l,t[39]=y,t[40]=C):C=t[40];let w;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(x,{children:[(0,Z.jsx)(he,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`zd00pH`})]}),t[41]=w):w=t[41];let T;t[42]!==f||t[43]!==m?(T=f?(0,Z.jsx)(g,{onSelect:()=>void m(f),children:(0,Z.jsx)(r,{id:`z2funE`})}):null,t[42]=f,t[43]=m,t[44]=T):T=t[44];let E;t[45]!==m||t[46]!==n.path?(E=()=>void m(n.path),t[45]=m,t[46]=n.path,t[47]=E):E=t[47];let D;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(r,{id:`xloBjn`}),t[48]=D):D=t[48];let O;t[49]===E?O=t[50]:(O=(0,Z.jsx)(g,{onSelect:E,children:D}),t[49]=E,t[50]=O);let k;t[51]!==T||t[52]!==O?(k=(0,Z.jsxs)(_,{children:[w,(0,Z.jsxs)(v,{children:[T,O]})]}),t[51]=T,t[52]=O,t[53]=k):k=t[53];let A;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(S,{}),t[54]=A):A=t[54];let j;t[55]!==a||t[56]!==o||t[57]!==n?(j=()=>void a.duplicate(n,o),t[55]=a,t[56]=o,t[57]=n,t[58]=j):j=t[58];let M,N;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(le,{"aria-hidden":!0}),N=(0,Z.jsx)(r,{id:`euc6Ns`}),t[59]=M,t[60]=N):(M=t[59],N=t[60]);let P;t[61]===j?P=t[62]:(P=(0,Z.jsxs)(g,{onSelect:j,children:[M,N]}),t[61]=j,t[62]=P);let F;t[63]!==a||t[64]!==o||t[65]!==n?(F=()=>a.requestRename(n,o),t[63]=a,t[64]=o,t[65]=n,t[66]=F):F=t[66];let I,L;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Le,{"aria-hidden":!0}),L=(0,Z.jsx)(r,{id:`2wxgft`}),t[67]=I,t[68]=L):(I=t[67],L=t[68]);let R;t[69]===F?R=t[70]:(R=(0,Z.jsxs)(g,{onSelect:F,children:[I,L]}),t[69]=F,t[70]=R);let z;t[71]!==a||t[72]!==n?(z=n.updateAvailable?(0,Z.jsxs)(g,{onSelect:()=>a.requestUpdate(n),children:[(0,Z.jsx)(ve,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`6g2jsp`})]}):null,t[71]=a,t[72]=n,t[73]=z):z=t[73];let B;t[74]!==a||t[75]!==n?(B=n.installed?(0,Z.jsxs)(g,{onSelect:()=>void a.uninstall(n),children:[(0,Z.jsx)(Re,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`fo0VXg`})]}):(0,Z.jsxs)(g,{onSelect:()=>void a.install(n),children:[(0,Z.jsx)(Fe,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`TKQ7K-`})]}),t[74]=a,t[75]=n,t[76]=B):B=t[76];let V;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(S,{}),t[77]=V):V=t[77];let H;t[78]!==a||t[79]!==n?(H=()=>a.requestDelete(n),t[78]=a,t[79]=n,t[80]=H):H=t[80];let U,W;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(be,{"aria-hidden":!0}),W=(0,Z.jsx)(r,{id:`cnGeoo`}),t[81]=U,t[82]=W):(U=t[81],W=t[82]);let G;t[83]===H?G=t[84]:(G=(0,Z.jsxs)(g,{variant:`destructive`,onSelect:H,children:[U,W]}),t[83]=H,t[84]=G);let K;return t[85]!==k||t[86]!==P||t[87]!==R||t[88]!==h||t[89]!==z||t[90]!==B||t[91]!==G||t[92]!==C?(K=(0,Z.jsxs)(Z.Fragment,{children:[h,C,k,A,P,R,z,B,V,G]}),t[85]=k,t[86]=P,t[87]=R,t[88]=h,t[89]=z,t[90]=B,t[91]=G,t[92]=C,t[93]=K):K=t[93],K}export{Fe as C,Ie as S,Dt as _,Jt as a,At as b,Gt as c,ut as d,ft as f,xt as g,pt as h,Yt as i,Vt as l,lt as m,ln as n,Kt as o,ct as p,rn as r,Wt as s,cn as t,mt as u,dt as v,st as x,Tt as y};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{t as n}from"./react-JNybMug3.js";import{n as r,r as i}from"./dist-DBENJeML.js";import{t as a}from"./compiler-runtime-dQcBxOhn.js";import{t as o}from"./createLucideIcon-BUb14crZ.js";import{t as s}from"./button-DHE6Sx02.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dialog-BLaUGJCd.js";import{a as g,d as _,f as v,i as y,o as b,p as x,u as S}from"./dropdown-menu-CcKe8PiU.js";import{t as C}from"./label-bn6BDr7p.js";import{O as w,a as T,f as E,h as D,m as O,n as k,o as A,p as j,r as M,s as N,t as P,y as F}from"./agent-visibility-BUmsS0vL.js";import{$t as I,Et as L,Ft as R,Kt as z,Lt as B,P as V,Rt as H,Zt as U,ai as W,at as G,bn as K,en as q,fn as J,gn as ee,hn as Y,mn as te,ot as ne,pn as re,vn as ie,xn as ae,yn as oe}from"./dist-CDKZLcnD.js";import{t as se}from"./RegisteredAgentIcon--E1135hW.js";import{a as ce,d as le,l as ue,n as de,r as fe,t as pe,u as me}from"./workspace-paths-BKmDPpqj.js";import{t as he}from"./copy-DmfcimOx.js";import{t as ge}from"./folder-open-C-WgQ0Xp.js";import{t as _e}from"./loader-circle-K7Xwpjny.js";import{t as ve}from"./refresh-cw-DSH9Of_0.js";import{t as ye}from"./sliders-horizontal-C9Uy29A1.js";import{t as be}from"./trash-2-DpF__0y9.js";import{n as X}from"./dist-DwCd6eR-.js";import{t as xe}from"./input-CsXmpyZP.js";import{t as Se}from"./dist-BD3698ve.js";import{t as Ce}from"./parse-api-error-DucXvNZh.js";import{o as we,s as Te}from"./documents-events-DNDUkpJM.js";import{n as Ee}from"./config-context-C5AosGyi.js";import{t as De}from"./use-workspace-C1D_I03G.js";import{n as Oe}from"./clipboard-adapter-BGIXxhKQ.js";import{a as ke,d as Ae,f as je,n as Me,s as Ne,t as Pe}from"./skills-api-CGbwE9vp.js";var Fe=o(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),Ie=o(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Le=o(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Re=o(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Z=t(),Q=e(n(),1),$=a();function ze(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function Be(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Ce(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Ve(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?ze(e):Be()}var He=`ok:skill:cowork:installed`,Ue=`1`,We=250,Ge=`/api/skill/install-state`;function Ke(e){return`${He}:v${e}`}var qe=new Map;async function Je(e={},t={}){let n=t.force?`__force__`:`__default__`,r=qe.get(n);if(r)return r;let i=Ye(e,t);return qe.set(n,i),i.finally(()=>{qe.get(n)===i&&qe.delete(n)}),i}async function Ye(e,t){let n=e.installer===void 0?Ve():e.installer,r=Xe(e.storage),i=e.fetchSnapshot??Qe,a=e.serverTimeoutMs??We,o=null;if(!t.force){try{o=await $e(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Ke(o?.currentVersion??e.fallbackSkillVersion??Ze());if(!t.force&&r?.getItem(s)===Ue)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,Ue)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Xe(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Ze(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Qe(){let e;try{e=await fetch(Ge,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function $e(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function et(e){return Je({},e)}function tt(){return Je({},{force:!0})}async function nt(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function rt(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return nt({target:`claude-cowork`,url:U({mode:`cowork`},e)},n);case`claude-code`:return nt({target:`claude-code`,url:U({mode:`code`},e)},n);case`codex`:return nt({target:`codex`,url:I(e)},n);case`cursor`:return nt({target:`cursor`,url:q(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function it(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var at=`open-knowledge:agent-thread-launch`;function ot(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(at,{detail:e}))}function st(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(at,n),()=>t.removeEventListener(at,n)}function ct(e){if(!e.docName||!e.workspace)return null;let t=pe(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:de(n,t,r)}}function lt(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function ut(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function dt(e){return j(e.installUrl).then(()=>void 0)}function ft(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function pt(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function mt(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace;if(e.docName){let r=e.docRelativePath??pe(e.docName),i={scope:`doc`,docRelativePath:r,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?i:{...i,selection:e.selection},projectDir:t,docPath:de(t,r,n)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function ht(e){return`Opened in ${e}.`}function gt(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function _t(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function vt(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function yt(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function bt(e,t,n,r){return e.compose?z(yt(e.compose,t,n,r)):e.selection?ie({...e.selection,target:t,transport:r}):e.skill?oe(e.skill.name,e.skill.scope,n):e.ask?J(e.ask.relativePath,e.ask.instruction,n,t,r):W(e.docContext===null?e.folderRelativePath?ee(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?te(n,e.instruction,r):re(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):Y(e.docContext.relativePath,n,e.instruction,r))}function xt(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${G} ${bt(e,B[t].handoffTarget,!1,`terminal`)}`:K(e.docContext?.relativePath??null)}function St(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${ne} ${bt(e,`claude-code`,!1,`terminal`)}`:ae(e.docContext?.relativePath??null)}function Ct(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function wt(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function Tt(e,t){ot({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:St(e),docName:Ct(e),titleHint:wt(e)})}async function Et(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`OpenKnowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:bt(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=vt(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(ht(u));else{let i=_t(r),a=gt(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Et(e,t,n,r+1)}}})}return a}function Dt(e){return O.find(t=>t.id===e)?.displayName??e}function Ot(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function kt(){return{dispatchHandoff:rt,recordHandoff:it,toast:{success:e=>{X.success(e)},error:(e,t)=>{X.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Ot(),getDisplayName:Dt,ensureCoworkSkillInstalled:et,autoOpen:!0}}function At(){let e=(0,$.c)(2),{merged:t}=Ee(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>Et(e,t,{...kt(),autoOpen:n}),reinstallCoworkSkill:tt},e[0]=n,e[1]=r),r}var jt=[...new Set(O.flatMap(e=>e.schemes))];function Mt(e,t){let n=t.now?.()??Date.now(),r={};for(let t of O){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function Nt(e){return Mt({},e)}async function Pt(e){let t=e.schemes??jt,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var Ft=Object.fromEntries(jt.map(e=>[e,{installed:!1}]));async function It(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return Ft}if(!t.ok)return Ft;let n;try{n=await t.json()}catch{return Ft}if(typeof n!=`object`||!n||Array.isArray(n))return Ft;let r=n,i={};for(let e of jt)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Lt(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function Rt(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Nt({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Mt(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!Lt(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function zt(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Bt(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Pt({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>It({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Vt(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Ht),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Rt(Bt());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function Ht(){return Nt({isElectronHost:zt(),now:Date.now})}var Ut=(0,Q.createContext)(null);function Wt(e){let t=(0,$.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(Ut,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Gt(){return(0,Q.use)(Ut)}function Kt(e){let t=(0,$.c)(48),{itemName:n,isSubmitting:a,onDelete:o,customTitle:h,customDescription:g,customDetail:_,customConfirmLabel:v,customConfirmLabelBusy:y,children:b}=e,{_:x}=i(),S;t[0]!==x||t[1]!==n?(S=n??x({id:`L3CEC1`}),t[0]=x,t[1]=n,t[2]=S):S=t[2];let C=S,w;t[3]!==x||t[4]!==v?(w=v??x({id:`cnGeoo`}),t[3]=x,t[4]=v,t[5]=w):w=t[5];let T=w,E;t[6]!==x||t[7]!==v||t[8]!==y?(E=y??v??x({id:`s3caR3`}),t[6]=x,t[7]=v,t[8]=y,t[9]=E):E=t[9];let D=E,O;t[10]!==x||t[11]!==h||t[12]!==C?(O=h??x({id:`77SdEP`,values:{itemName:C}}),t[10]=x,t[11]=h,t[12]=C,t[13]=O):O=t[13];let k;t[14]===O?k=t[15]:(k=(0,Z.jsx)(l,{children:O}),t[14]=O,t[15]=k);let A;t[16]!==x||t[17]!==g||t[18]!==C?(A=g??x({id:`16D5Zj`,values:{itemName:C}}),t[16]=x,t[17]=g,t[18]=C,t[19]=A):A=t[19];let j;t[20]===A?j=t[21]:(j=(0,Z.jsx)(c,{className:`whitespace-pre-wrap`,children:A}),t[20]=A,t[21]=j);let M;t[22]===_?M=t[23]:(M=_?(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`delete-confirmation-detail`,children:_}):null,t[22]=_,t[23]=M);let N;t[24]!==k||t[25]!==j||t[26]!==M?(N=(0,Z.jsxs)(m,{children:[k,j,M]}),t[24]=k,t[25]=j,t[26]=M,t[27]=N):N=t[27];let P;t[28]===b?P=t[29]:(P=b?(0,Z.jsx)(d,{children:b}):null,t[28]=b,t[29]=P);let F;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(r,{id:`dEgA5A`}),t[30]=F):F=t[30];let I;t[31]===a?I=t[32]:(I=(0,Z.jsx)(p,{asChild:!0,children:(0,Z.jsx)(s,{variant:`outline`,disabled:a,children:F})}),t[31]=a,t[32]=I);let L;t[33]!==T||t[34]!==D||t[35]!==a?(L=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_e,{className:`size-4 animate-spin`}),` `,D]}):T,t[33]=T,t[34]=D,t[35]=a,t[36]=L):L=t[36];let R;t[37]!==a||t[38]!==o||t[39]!==L?(R=(0,Z.jsx)(s,{variant:`destructive`,onClick:o,disabled:a,children:L}),t[37]=a,t[38]=o,t[39]=L,t[40]=R):R=t[40];let z;t[41]!==I||t[42]!==R?(z=(0,Z.jsxs)(f,{children:[I,R]}),t[41]=I,t[42]=R,t[43]=z):z=t[43];let B;return t[44]!==P||t[45]!==z||t[46]!==N?(B=(0,Z.jsxs)(u,{children:[N,P,z]}),t[44]=P,t[45]=z,t[46]=N,t[47]=B):B=t[47],B}function qt(e){return e?Se._({id:`wTcjov`}):null}function Jt(e){let t=(0,$.c)(47),{_:n}=i(),a=fe(),o=Gt(),s=w(),c=E();if(a)return null;let{input:l,installStates:u,dispatch:d,onBeforeLaunch:f}=e,p=l===null,m,h,C,O,j,I,L,R,z,V,U;if(t[0]!==n||t[1]!==d||t[2]!==l||t[3]!==p||t[4]!==u||t[5]!==f||t[6]!==c||t[7]!==s||t[8]!==o){let e=qt(p),i;t[20]===c?i=t[21]:(i=e=>P(c,e.id),t[20]=c,t[21]=i);let a=D.filter(i),w;t[22]===c?w=t[23]:(w=e=>k(c,e.source,e.id,!0,e.supported),t[22]=c,t[23]=w);let E=s.filter(w),F=o?H.filter(e=>M(c,e,o.installedClis)):[];C=a.length>0,O=o!==null&&F.length>0,j=E.length>0,h=_,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsxs)(x,{children:[(0,Z.jsx)(ue,{"aria-hidden":`true`}),(0,Z.jsx)(r,{id:`O7_W_a`})]}),t[24]=U):U=t[24],m=v,I=`max-h-80`,L=j?(0,Z.jsxs)(y,{"aria-label":n({id:`vPKX2i`}),children:[(0,Z.jsxs)(b,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(r,{id:`RXEbZy`}),(0,Z.jsx)(N,{})]}),E.map(t=>{let i=t.name;return(0,Z.jsxs)(g,{onSelect:()=>{l!==null&&(f?.(),Tt(l,{agent:{source:t.source,id:t.id}}))},disabled:p,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":e?n({id:`gtGQ9S`,values:{agentName:i,hint:e}}):void 0,children:[(0,Z.jsx)(se,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(r,{id:`5PrrYw`,values:{agentName:i}})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==C||t[26]!==O||t[27]!==j?(R=j&&(O||C)?(0,Z.jsx)(S,{}):null,t[25]=C,t[26]=O,t[27]=j,t[28]=R):R=t[28],z=O?(0,Z.jsxs)(y,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(b,{children:(0,Z.jsx)(r,{id:`ALhMYW`})}),F.map(t=>{let{displayName:r}=B[t];return(0,Z.jsxs)(g,{onSelect:()=>{l!==null&&(f?.(),o.launchInTerminal(l,t))},disabled:p,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(A,{id:T(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,V=C?(0,Z.jsxs)(Z.Fragment,{children:[O?(0,Z.jsx)(S,{}):null,(0,Z.jsxs)(y,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(b,{children:(0,Z.jsx)(r,{id:`BBqGS9`})}),a.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(g,{disabled:!r,onSelect:()=>{if(l){if(f?.(),u[t.id]?.installed!==!0){dt(t);return}d(t.id,l)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(A,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=d,t[2]=l,t[3]=p,t[4]=u,t[5]=f,t[6]=c,t[7]=s,t[8]=o,t[9]=m,t[10]=h,t[11]=C,t[12]=O,t[13]=j,t[14]=I,t[15]=L,t[16]=R,t[17]=z,t[18]=V,t[19]=U}else m=t[9],h=t[10],C=t[11],O=t[12],j=t[13],I=t[14],L=t[15],R=t[16],z=t[17],V=t[18],U=t[19];let W;t[29]!==C||t[30]!==O||t[31]!==j?(W=j||O||C?(0,Z.jsx)(S,{}):null,t[29]=C,t[30]=O,t[31]=j,t[32]=W):W=t[32];let G;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(ye,{"aria-hidden":`true`}),t[33]=G):G=t[33];let K;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsxs)(g,{onSelect:F,"data-testid":`file-tree-open-in-settings`,children:[G,(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(r,{id:`jRAGrQ`})})]}),t[34]=K):K=t[34];let q;t[35]!==m||t[36]!==I||t[37]!==L||t[38]!==R||t[39]!==z||t[40]!==V||t[41]!==W?(q=(0,Z.jsxs)(m,{className:I,children:[L,R,z,V,W,K]}),t[35]=m,t[36]=I,t[37]=L,t[38]=R,t[39]=z,t[40]=V,t[41]=W,t[42]=q):q=t[42];let J;return t[43]!==h||t[44]!==U||t[45]!==q?(J=(0,Z.jsxs)(h,{children:[U,q]}),t[43]=h,t[44]=U,t[45]=q,t[46]=J):J=t[46],J}function Yt(e){let t=(0,$.c)(8),n=e?.enabled??!0,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`idle`},t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(0),c,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=()=>s($t),t=Te(e),n=we(t=>{t.includes(`files`)&&e()});return()=>{t(),n()}},l=[],t[1]=c,t[2]=l):(c=t[1],l=t[2]),(0,Q.useEffect)(c,l);let u;t[3]===n?u=t[4]:(u=()=>{if(!n)return;let e=!1;return a(Qt),fetch(`/api/skills`).then(Xt).then(t=>{if(e)return;let n=R.safeParse(t);if(!n.success){console.error(`[ok-skills] /api/skills response failed schema validation:`,n.error.issues),a({status:`error`,message:`Server returned an incomplete skills response.`});return}a({status:`ready`,data:n.data.skills})}).catch(t=>{e||a({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},t[3]=n,t[4]=u);let d;return t[5]!==n||t[6]!==o?(d=[o,n],t[5]=n,t[6]=o,t[7]=d):d=t[7],(0,Q.useEffect)(u,d),i}async function Xt(e){if(!e.ok){let t=await e.json().catch(Zt);throw Error(Ce(t)??`HTTP ${e.status}`)}return e.json()}function Zt(){return null}function Qt(e){return e.status===`ready`?e:{status:`loading`}}function $t(e){return e+1}function en(e){let t=(0,$.c)(16),{skill:n,onOpenChange:r,onDeleted:a}=e,{_:o}=i(),[s,c]=(0,Q.useState)(!1),l;t[0]!==o||t[1]!==a||t[2]!==r?(l=async function(e){c(!0);let t=await Pe(e.scope,e.name);if(c(!1),!t.ok){let{error:e}=t;X.error(o({id:`AtBdnD`,values:{error:e}}));return}X.success(o({id:`h9QFb9`,values:{0:e.name}})),a(),r(!1)},t[0]=o,t[1]=a,t[2]=r,t[3]=l):l=t[3];let u=l,d=n!==null,f;t[4]!==s||t[5]!==r?(f=e=>{!e&&!s&&r(!1)},t[4]=s,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==n?(p=n?(0,Z.jsx)(Kt,{itemName:o({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:s,onDelete:()=>u(n),customDescription:o({id:`E1Da_b`,values:{0:n.path}})}):null,t[7]=o,t[8]=s,t[9]=u,t[10]=n,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,Z.jsx)(h,{open:d,onOpenChange:f,children:p}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function tn(e){let t=(0,$.c)(68),{skill:n,existingNames:a,onOpenChange:o,onRenamed:d}=e,{_:p}=i(),g=n!==null,_=(0,Q.useId)(),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(!1),S;t[0]===n?S=t[1]:(S=()=>{n&&y(n.name)},t[0]=n,t[1]=S);let w=n?.scope,T=n?.name,E;if(t[2]!==w||t[3]!==T?(E=[w,T],t[2]=w,t[3]=T,t[4]=E):E=t[4],(0,Q.useEffect)(S,E),!n)return null;let D,O,k,A;t[5]!==a||t[6]!==v||t[7]!==n.name?(k=v.trim(),A=k===n.name,D=k===``||!L.test(k),O=!D&&!A&&a.has(k),t[5]=a,t[6]=v,t[7]=n.name,t[8]=D,t[9]=O,t[10]=k,t[11]=A):(D=t[8],O=t[9],k=t[10],A=t[11]);let j=O,M=!D&&!j&&!A&&!b,N;t[12]!==p||t[13]!==M||t[14]!==o||t[15]!==d||t[16]!==n||t[17]!==k?(N=async function(){if(!n||!M)return;x(!0);let e=await Ne({scope:n.scope,fromName:n.name,toName:k});if(x(!1),!e.ok){X.error(p({id:`zKxoPm`,values:{0:n.name,1:e.error}}));return}X.success(p({id:`dUCQo4`,values:{trimmed:k}})),d?.(k),o(!1)},t[12]=p,t[13]=M,t[14]=o,t[15]=d,t[16]=n,t[17]=k,t[18]=N):N=t[18];let P=N,F;t[19]===o?F=t[20]:(F=e=>e?null:o(!1),t[19]=o,t[20]=F);let I;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(l,{children:(0,Z.jsx)(r,{id:`dw_3cv`})}),t[21]=I):I=t[21];let R;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsxs)(m,{children:[I,(0,Z.jsx)(c,{children:(0,Z.jsx)(r,{id:`R9IDFz`})})]}),t[22]=R):R=t[22];let z;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(r,{id:`6YtxFj`}),t[23]=z):z=t[23];let B;t[24]===_?B=t[25]:(B=(0,Z.jsx)(C,{htmlFor:_,children:z}),t[24]=_,t[25]=B);let V;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(V=e=>y(e.target.value),t[26]=V):V=t[26];let H;t[27]===P?H=t[28]:(H=e=>{e.key===`Enter`&&P()},t[27]=P,t[28]=H);let U=D||j,W=D&&k!==``||j?`${_}-error`:void 0,G;t[29]!==_||t[30]!==v||t[31]!==H||t[32]!==U||t[33]!==W?(G=(0,Z.jsx)(xe,{id:_,value:v,onChange:V,onKeyDown:H,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":U,"aria-describedby":W,className:`font-mono`}),t[29]=_,t[30]=v,t[31]=H,t[32]=U,t[33]=W,t[34]=G):G=t[34];let K;t[35]!==j||t[36]!==_||t[37]!==D||t[38]!==k?(K=D&&k!==``?(0,Z.jsx)(`p`,{id:`${_}-error`,className:`text-xs text-destructive`,children:(0,Z.jsx)(r,{id:`A50vr3`,components:{0:(0,Z.jsx)(`code`,{className:`font-mono`})}})}):j?(0,Z.jsx)(`p`,{id:`${_}-error`,className:`text-xs text-destructive`,children:(0,Z.jsx)(r,{id:`YJ1BTp`})}):null,t[35]=j,t[36]=_,t[37]=D,t[38]=k,t[39]=K):K=t[39];let q;t[40]!==B||t[41]!==G||t[42]!==K?(q=(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[B,G,K]}),t[40]=B,t[41]=G,t[42]=K,t[43]=q):q=t[43];let J;t[44]===o?J=t[45]:(J=()=>o(!1),t[44]=o,t[45]=J);let ee;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(r,{id:`dEgA5A`}),t[46]=ee):ee=t[46];let Y;t[47]!==b||t[48]!==J?(Y=(0,Z.jsx)(s,{variant:`ghost`,onClick:J,disabled:b,children:ee}),t[47]=b,t[48]=J,t[49]=Y):Y=t[49];let te;t[50]===P?te=t[51]:(te=()=>void P(),t[50]=P,t[51]=te);let ne=!M,re;t[52]===b?re=t[53]:(re=b?(0,Z.jsx)(r,{id:`tHKQ6j`}):(0,Z.jsx)(r,{id:`2wxgft`}),t[52]=b,t[53]=re);let ie;t[54]!==te||t[55]!==ne||t[56]!==re?(ie=(0,Z.jsx)(s,{onClick:te,disabled:ne,children:re}),t[54]=te,t[55]=ne,t[56]=re,t[57]=ie):ie=t[57];let ae;t[58]!==Y||t[59]!==ie?(ae=(0,Z.jsxs)(f,{children:[Y,ie]}),t[58]=Y,t[59]=ie,t[60]=ae):ae=t[60];let oe;t[61]!==q||t[62]!==ae?(oe=(0,Z.jsxs)(u,{children:[R,q,ae]}),t[61]=q,t[62]=ae,t[63]=oe):oe=t[63];let se;return t[64]!==g||t[65]!==oe||t[66]!==F?(se=(0,Z.jsx)(h,{open:g,onOpenChange:F,children:oe}),t[64]=g,t[65]=oe,t[66]=F,t[67]=se):se=t[67],se}function nn(e){let t=(0,$.c)(15),{skill:n,onOpenChange:a,onUpdated:o}=e,{_:g}=i(),[_,v]=(0,Q.useState)(!1),y;t[0]!==g||t[1]!==a||t[2]!==o?(y=async function(e){v(!0);let t=await je({scope:e.scope,name:e.name});v(!1);let n=ce(e.name);if(!t.ok){X.error(g({id:`FRqZ9v`,values:{0:t.error}}));return}X.success(t.checkpointRef?g({id:`My9uXI`,values:{0:t.version,display:n}}):g({id:`mPneVR`,values:{0:t.version,display:n}})),o(),a(!1)},t[0]=g,t[1]=a,t[2]=o,t[3]=y):y=t[3];let b=y,x=n!==null,S;t[4]!==a||t[5]!==_?(S=e=>{!e&&!_&&a(!1)},t[4]=a,t[5]=_,t[6]=S):S=t[6];let C;t[7]!==b||t[8]!==n||t[9]!==_?(C=n?(0,Z.jsxs)(u,{className:`sm:max-w-lg`,children:[(0,Z.jsxs)(m,{children:[(0,Z.jsx)(l,{children:(0,Z.jsx)(r,{id:`iAoh55`,values:{0:ce(n.name)}})}),(0,Z.jsx)(c,{children:n.installedVersion?(0,Z.jsx)(r,{id:`47EXvY`,values:{0:n.bundledVersion??``,1:n.installedVersion}}):(0,Z.jsx)(r,{id:`nD7Fx9`,values:{0:n.bundledVersion??``}})})]}),(0,Z.jsx)(d,{}),(0,Z.jsxs)(f,{children:[(0,Z.jsx)(p,{asChild:!0,children:(0,Z.jsx)(s,{variant:`outline`,disabled:_,children:(0,Z.jsx)(r,{id:`dEgA5A`})})}),(0,Z.jsx)(s,{onClick:()=>void b(n),disabled:_,children:_?(0,Z.jsx)(r,{id:`JL3si7`}):(0,Z.jsx)(r,{id:`EkH9pt`})})]})]}):null,t[7]=b,t[8]=n,t[9]=_,t[10]=C):C=t[10];let w;return t[11]!==x||t[12]!==S||t[13]!==C?(w=(0,Z.jsx)(h,{open:x,onOpenChange:S,children:C}),t[11]=x,t[12]=S,t[13]=C,t[14]=w):w=t[14],w}function rn(){let e=(0,$.c)(30),{_:t}=i(),[n,r]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),d;e[0]===t?d=e[1]:(d=async function(e,n){u(e.name);let r=await ke({scope:e.scope,name:e.name,...n?{targets:[...n]}:{}});if(u(null),!r.ok)return X.error(t({id:`Mj8R8K`,values:{0:r.error}})),r;let i=an,a=new Set(r.hosts),o=r.hosts.filter(t=>!e.hosts.includes(t)),s=e.hosts.filter(e=>!a.has(e)),c=e=>{let t=r.warningCodes.indexOf(e);return t>=0?r.warnings[t]:void 0},l=c(`no-targets`);if(l)return X.warning(l),r;if(o.length>0){let e=c(`scripts-present`);e&&X.warning(e)}return r.hosts.length===0?X.success(t({id:`0LBDjY`,values:{0:e.name}})):o.length>0&&s.length===0?X.success(t({id:`PPFQ3o`,values:{0:e.name,1:i(o)}})):s.length>0&&o.length===0?X.success(t({id:`OOIVJo`,values:{0:e.name,1:i(s)}})):o.length>0&&s.length>0?X.success(t({id:`OxplNM`,values:{0:e.name,1:i(o),2:i(s)}})):X.success(t({id:`wDgmsr`,values:{0:e.name,1:i(r.hosts)}})),r},e[0]=t,e[1]=d);let f=d,p;e[2]===t?p=e[3]:(p=async function(e){u(e.name);let n=await Ae({scope:e.scope,name:e.name});return u(null),n.ok?X.success(t({id:`0LBDjY`,values:{0:e.name}})):X.error(t({id:`nJq7et`,values:{0:n.error}})),n},e[2]=t,e[3]=p);let m=p,h;e[4]===t?h=e[5]:(h=async function(e,n){let r=await Me({scope:e.scope,name:e.name,existingNames:n});if(!r.ok){X.error(t({id:`UPjaXD`,values:{0:e.name,1:r.error}}));return}X.success(t({id:`0g7rCZ`,values:{0:r.name}}))},e[4]=t,e[5]=h);let g=h,_,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{e||r(null)},v=()=>r(null),e[6]=_,e[7]=v):(_=e[6],v=e[7]);let y;e[8]===n?y=e[9]:(y=(0,Z.jsx)(en,{skill:n,onOpenChange:_,onDeleted:v}),e[8]=n,e[9]=y);let b=a?.skill??null,x=a?.existingNames??sn,S,C;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{e||o(null)},C=()=>o(null),e[10]=S,e[11]=C):(S=e[10],C=e[11]);let w;e[12]!==b||e[13]!==x?(w=(0,Z.jsx)(tn,{skill:b,existingNames:x,onOpenChange:S,onRenamed:C}),e[12]=b,e[13]=x,e[14]=w):w=e[14];let T,E;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||c(null)},E=()=>c(null),e[15]=T,e[16]=E):(T=e[15],E=e[16]);let D;e[17]===s?D=e[18]:(D=(0,Z.jsx)(nn,{skill:s,onOpenChange:T,onUpdated:E}),e[17]=s,e[18]=D);let O;e[19]!==w||e[20]!==D||e[21]!==y?(O=(0,Z.jsxs)(Z.Fragment,{children:[y,w,D]}),e[19]=w,e[20]=D,e[21]=y,e[22]=O):O=e[22];let k=O,A;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=(e,t)=>o({skill:e,existingNames:t}),e[23]=A):A=e[23];let j;return e[24]!==k||e[25]!==g||e[26]!==f||e[27]!==l||e[28]!==m?(j={installingName:l,install:f,uninstall:m,duplicate:g,requestDelete:r,requestRename:A,requestUpdate:c,dialogs:k},e[24]=k,e[25]=g,e[26]=f,e[27]=l,e[28]=m,e[29]=j):j=e[29],j}function an(e){return e.map(on).join(`, `)}function on(e){return V[e]??e}var sn=new Set;function cn(e){let t=(0,$.c)(19),{skill:n,onEdit:i,onInstall:a,onUninstall:o,onDelete:s}=e,c,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(me,{"aria-hidden":!0}),l=(0,Z.jsx)(r,{id:`ePK91l`}),t[0]=c,t[1]=l):(c=t[0],l=t[1]);let u;t[2]===i?u=t[3]:(u=(0,Z.jsxs)(g,{onSelect:i,children:[c,l]}),t[2]=i,t[3]=u);let d;t[4]!==a||t[5]!==n.installed?(d=a&&!n.installed?(0,Z.jsxs)(g,{onSelect:a,children:[(0,Z.jsx)(Fe,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`TKQ7K-`})]}):null,t[4]=a,t[5]=n.installed,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.installed?(f=n.installed?(0,Z.jsxs)(g,{onSelect:o,children:[(0,Z.jsx)(Re,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`fo0VXg`})]}):null,t[7]=o,t[8]=n.installed,t[9]=f):f=t[9];let p,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(be,{"aria-hidden":!0}),m=(0,Z.jsx)(r,{id:`cnGeoo`}),t[10]=p,t[11]=m):(p=t[10],m=t[11]);let h;t[12]===s?h=t[13]:(h=(0,Z.jsxs)(g,{variant:`destructive`,onSelect:s,children:[p,m]}),t[12]=s,t[13]=h);let _;return t[14]!==u||t[15]!==d||t[16]!==f||t[17]!==h?(_=(0,Z.jsxs)(Z.Fragment,{children:[u,d,f,h]}),t[14]=u,t[15]=d,t[16]=f,t[17]=h,t[18]=_):_=t[18],_}function ln(e){let t=(0,$.c)(94),{skill:n,actions:a,existingNames:o}=e,{_:s}=i(),c=De(),l=Vt().states,{dispatch:u}=At(),d=typeof window<`u`?window.okDesktop:void 0,f=n.absolutePath,p;t[0]===s?p=t[1]:(p=async function(e){try{await Oe(e),X.success(s({id:`SXCSQd`}))}catch{X.error(s({id:`cRHuuI`}))}},t[0]=s,t[1]=p);let m=p;if(n.managed){let e,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(b,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,Z.jsx)(Ie,{className:`size-3`,"aria-hidden":!0}),(0,Z.jsx)(r,{id:`VITWk5`})]}),i=(0,Z.jsx)(S,{}),t[2]=e,t[3]=i):(e=t[2],i=t[3]);let a;t[4]===f?a=t[5]:(a=d&&f?(0,Z.jsxs)(g,{onSelect:()=>void d.shell.showItemInFolder(f),children:[(0,Z.jsx)(ge,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`LtSYdi`})]}):null,t[4]=f,t[5]=a);let o;t[6]!==n.name||t[7]!==n.scope||t[8]!==c?(o=pt({skillName:n.name,scope:n.scope,workspace:c}),t[6]=n.name,t[7]=n.scope,t[8]=c,t[9]=o):o=t[9];let s;t[10]!==u||t[11]!==l||t[12]!==o?(s=(0,Z.jsx)(Jt,{input:o,installStates:l,isElectronHost:d!=null,dispatch:u}),t[10]=u,t[11]=l,t[12]=o,t[13]=s):s=t[13];let p;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(x,{children:[(0,Z.jsx)(he,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`zd00pH`})]}),t[14]=p):p=t[14];let h;t[15]!==f||t[16]!==m?(h=f?(0,Z.jsx)(g,{onSelect:()=>void m(f),children:(0,Z.jsx)(r,{id:`z2funE`})}):null,t[15]=f,t[16]=m,t[17]=h):h=t[17];let y;t[18]!==m||t[19]!==n.path?(y=()=>void m(n.path),t[18]=m,t[19]=n.path,t[20]=y):y=t[20];let C;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(r,{id:`xloBjn`}),t[21]=C):C=t[21];let w;t[22]===y?w=t[23]:(w=(0,Z.jsx)(g,{onSelect:y,children:C}),t[22]=y,t[23]=w);let T;t[24]!==w||t[25]!==h?(T=(0,Z.jsxs)(_,{children:[p,(0,Z.jsxs)(v,{children:[h,w]})]}),t[24]=w,t[25]=h,t[26]=T):T=t[26];let E;return t[27]!==T||t[28]!==a||t[29]!==s?(E=(0,Z.jsxs)(Z.Fragment,{children:[e,i,a,s,T]}),t[27]=T,t[28]=a,t[29]=s,t[30]=E):E=t[30],E}let h;t[31]===f?h=t[32]:(h=d&&f?(0,Z.jsxs)(g,{onSelect:()=>void d.shell.showItemInFolder(f),children:[(0,Z.jsx)(ge,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`LtSYdi`})]}):null,t[31]=f,t[32]=h);let y;t[33]!==n.name||t[34]!==n.scope||t[35]!==c?(y=pt({skillName:n.name,scope:n.scope,workspace:c}),t[33]=n.name,t[34]=n.scope,t[35]=c,t[36]=y):y=t[36];let C;t[37]!==u||t[38]!==l||t[39]!==y?(C=(0,Z.jsx)(Jt,{input:y,installStates:l,isElectronHost:d!=null,dispatch:u}),t[37]=u,t[38]=l,t[39]=y,t[40]=C):C=t[40];let w;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(x,{children:[(0,Z.jsx)(he,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`zd00pH`})]}),t[41]=w):w=t[41];let T;t[42]!==f||t[43]!==m?(T=f?(0,Z.jsx)(g,{onSelect:()=>void m(f),children:(0,Z.jsx)(r,{id:`z2funE`})}):null,t[42]=f,t[43]=m,t[44]=T):T=t[44];let E;t[45]!==m||t[46]!==n.path?(E=()=>void m(n.path),t[45]=m,t[46]=n.path,t[47]=E):E=t[47];let D;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(r,{id:`xloBjn`}),t[48]=D):D=t[48];let O;t[49]===E?O=t[50]:(O=(0,Z.jsx)(g,{onSelect:E,children:D}),t[49]=E,t[50]=O);let k;t[51]!==T||t[52]!==O?(k=(0,Z.jsxs)(_,{children:[w,(0,Z.jsxs)(v,{children:[T,O]})]}),t[51]=T,t[52]=O,t[53]=k):k=t[53];let A;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(S,{}),t[54]=A):A=t[54];let j;t[55]!==a||t[56]!==o||t[57]!==n?(j=()=>void a.duplicate(n,o),t[55]=a,t[56]=o,t[57]=n,t[58]=j):j=t[58];let M,N;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(le,{"aria-hidden":!0}),N=(0,Z.jsx)(r,{id:`euc6Ns`}),t[59]=M,t[60]=N):(M=t[59],N=t[60]);let P;t[61]===j?P=t[62]:(P=(0,Z.jsxs)(g,{onSelect:j,children:[M,N]}),t[61]=j,t[62]=P);let F;t[63]!==a||t[64]!==o||t[65]!==n?(F=()=>a.requestRename(n,o),t[63]=a,t[64]=o,t[65]=n,t[66]=F):F=t[66];let I,L;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Le,{"aria-hidden":!0}),L=(0,Z.jsx)(r,{id:`2wxgft`}),t[67]=I,t[68]=L):(I=t[67],L=t[68]);let R;t[69]===F?R=t[70]:(R=(0,Z.jsxs)(g,{onSelect:F,children:[I,L]}),t[69]=F,t[70]=R);let z;t[71]!==a||t[72]!==n?(z=n.updateAvailable?(0,Z.jsxs)(g,{onSelect:()=>a.requestUpdate(n),children:[(0,Z.jsx)(ve,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`6g2jsp`})]}):null,t[71]=a,t[72]=n,t[73]=z):z=t[73];let B;t[74]!==a||t[75]!==n?(B=n.installed?(0,Z.jsxs)(g,{onSelect:()=>void a.uninstall(n),children:[(0,Z.jsx)(Re,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`fo0VXg`})]}):(0,Z.jsxs)(g,{onSelect:()=>void a.install(n),children:[(0,Z.jsx)(Fe,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`TKQ7K-`})]}),t[74]=a,t[75]=n,t[76]=B):B=t[76];let V;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(S,{}),t[77]=V):V=t[77];let H;t[78]!==a||t[79]!==n?(H=()=>a.requestDelete(n),t[78]=a,t[79]=n,t[80]=H):H=t[80];let U,W;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(be,{"aria-hidden":!0}),W=(0,Z.jsx)(r,{id:`cnGeoo`}),t[81]=U,t[82]=W):(U=t[81],W=t[82]);let G;t[83]===H?G=t[84]:(G=(0,Z.jsxs)(g,{variant:`destructive`,onSelect:H,children:[U,W]}),t[83]=H,t[84]=G);let K;return t[85]!==k||t[86]!==P||t[87]!==R||t[88]!==h||t[89]!==z||t[90]!==B||t[91]!==G||t[92]!==C?(K=(0,Z.jsxs)(Z.Fragment,{children:[h,C,k,A,P,R,z,B,V,G]}),t[85]=k,t[86]=P,t[87]=R,t[88]=h,t[89]=z,t[90]=B,t[91]=G,t[92]=C,t[93]=K):K=t[93],K}export{Fe as C,Ie as S,Dt as _,Jt as a,At as b,Gt as c,ut as d,ft as f,xt as g,pt as h,Yt as i,Vt as l,lt as m,ln as n,Kt as o,ct as p,rn as r,Wt as s,cn as t,mt as u,dt as v,st as x,Tt as y};
@@ -0,0 +1 @@
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./react-JNybMug3.js";import{t as n}from"./compiler-runtime-dQcBxOhn.js";import{n as r}from"./dist-DwCd6eR-.js";import{t as i}from"./dist-BD3698ve.js";var a=e(t(),1),o=n(),s=64e3;function c(e){if(typeof e!=`object`||!e)return null;let t=e;return t.type===`text`&&typeof t.text==`string`?t.text:null}var l=class{items=[];plan=[];turnActive=!1;tokenUsage=null;terminals={};toolCallIndex=new Map;permissionIndex=new Map;permissionByToolCall=new Map;permissionsByToolCall={};messageIndex=new Map;runtimeConsentIndex=new Map;lastConsentIndex=null;appliedCount=0;dirty=!1;snapshot={items:[],plan:[],turnActive:!1,tokenUsage:null,terminals:{},permissionsByToolCall:{}};sync(e){e.length<this.appliedCount&&this.reset();for(let t=this.appliedCount;t<e.length;t++)this.applyEvent(e[t]);return this.appliedCount=e.length,this.dirty&&=(this.snapshot={items:[...this.items],plan:this.plan,turnActive:this.turnActive,tokenUsage:this.tokenUsage,terminals:{...this.terminals},permissionsByToolCall:{...this.permissionsByToolCall}},!1),this.snapshot}reset(){this.items=[],this.plan=[],this.turnActive=!1,this.tokenUsage=null,this.terminals={},this.toolCallIndex=new Map,this.permissionIndex=new Map,this.permissionByToolCall=new Map,this.permissionsByToolCall={},this.messageIndex=new Map,this.runtimeConsentIndex=new Map,this.lastConsentIndex=null,this.appliedCount=0,this.dirty=!0}applyEvent(e){switch(this.dirty=!0,e.kind){case`user_message`:this.items.push({kind:`message`,role:`user`,text:e.content,messageId:`user-${this.items.length}`}),this.messageIndex.clear();break;case`turn_started`:this.turnActive=!0;break;case`turn_ended`:this.turnActive=!1,this.messageIndex.clear();break;case`status`:if(e.status===`exited`&&(this.turnActive=!1),this.lastConsentIndex!==null){let t=this.items[this.lastConsentIndex];t?.kind===`runtime_consent`&&t.install===`running`&&(e.status===`spawning`||e.status===`ready`||e.status===`running`?this.items[this.lastConsentIndex]={...t,install:`done`}:(e.status===`error`||e.status===`exited`)&&(this.items[this.lastConsentIndex]={...t,install:`failed`}))}e.status===`error`&&e.detail?this.items.push({kind:`notice`,text:e.detail,tone:`error`}):e.status===`auth_required`&&e.detail&&this.items.push({kind:`notice`,text:e.detail,tone:`info`});break;case`permission_request`:{let t=e.toolCall.toolCallId??null,n={kind:`permission`,requestId:e.requestId,title:e.toolCall.title??`Permission required`,toolKind:e.toolCall.kind??`other`,options:e.options,resolved:null,toolCallId:t,mergedIntoToolCall:t!==null&&this.toolCallIndex.has(t)};this.permissionIndex.set(e.requestId,this.items.length),t!==null&&(this.permissionByToolCall.set(t,this.items.length),this.permissionsByToolCall[t]=n),this.items.push(n);break}case`permission_resolved`:{let t=this.permissionIndex.get(e.requestId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`permission`)break;let r={...n,resolved:{optionId:e.optionId,auto:e.auto}};this.items[t]=r,r.toolCallId!==null&&(this.permissionsByToolCall[r.toolCallId]=r);break}case`runtime_consent_request`:this.runtimeConsentIndex.set(e.requestId,this.items.length),this.lastConsentIndex=this.items.length,this.items.push({kind:`runtime_consent`,requestId:e.requestId,runtime:e.runtime,displayName:e.displayName,provides:e.provides,version:e.version,approxSizeMB:e.approxSizeMB,sourceHost:e.sourceHost,agentName:e.agentName,resolved:null,install:null,progress:null});break;case`runtime_consent_resolved`:{let t=this.runtimeConsentIndex.get(e.requestId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`runtime_consent`)break;this.items[t]={...n,resolved:e.decision,install:e.decision===`granted`?`running`:null};break}case`runtime_install_progress`:{if(this.lastConsentIndex===null)break;let t=this.items[this.lastConsentIndex];if(t===void 0||t.kind!==`runtime_consent`)break;this.items[this.lastConsentIndex]={...t,progress:{receivedBytes:e.receivedBytes??0,totalBytes:e.totalBytes??null}};break}case`terminal_created`:this.terminals[e.terminalId]={terminalId:e.terminalId,command:e.command,args:e.args,output:``,truncated:!1,exit:null};break;case`terminal_output`:{let t=this.terminals[e.terminalId];if(t===void 0)break;let n=t.output+e.chunk,r=t.truncated;n.length>s&&(n=n.slice(-s),r=!0),this.terminals[e.terminalId]={...t,output:n,truncated:r};break}case`terminal_exit`:{let t=this.terminals[e.terminalId];if(t===void 0)break;this.terminals[e.terminalId]={...t,exit:{exitCode:e.exitCode,signal:e.signal}};break}case`session_update`:this.applyUpdate(e.update);break;default:break}}mergePermissionInto(e){let t=this.permissionByToolCall.get(e);if(t===void 0)return;let n=this.items[t];if(n===void 0||n.kind!==`permission`||n.mergedIntoToolCall)return;let r={...n,mergedIntoToolCall:!0};this.items[t]=r,this.permissionsByToolCall[e]=r}pushMessageChunk(e,t,n){let r=`${e}:${t}`,i=this.messageIndex.get(r);if(i!==void 0&&i===this.items.length-1){let e=this.items[i];this.items[i]={...e,text:e.text+n};return}this.messageIndex.set(r,this.items.length),this.items.push({kind:`message`,role:e,text:n,messageId:t})}applyUpdate(e){switch(e.sessionUpdate){case`agent_message_chunk`:{let t=c(e.content);t!==null&&this.pushMessageChunk(`agent`,d(e),t);break}case`agent_thought_chunk`:{let t=c(e.content);t!==null&&this.pushMessageChunk(`thought`,d(e),t);break}case`user_message_chunk`:{let t=c(e.content);t!==null&&this.pushMessageChunk(`user`,d(e),t);break}case`tool_call`:{let t={kind:`tool_call`,toolCallId:e.toolCallId,title:e.title??`Tool call`,toolKind:e.kind??`other`,status:e.status??`pending`,diffs:[],terminalIds:[],content:[],locations:f(e.locations),rawInput:e.rawInput};p(t,e.content),this.toolCallIndex.set(e.toolCallId,this.items.length),this.items.push(t),this.mergePermissionInto(e.toolCallId);break}case`tool_call_update`:{let t=this.toolCallIndex.get(e.toolCallId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`tool_call`)break;let r={...n,diffs:[...n.diffs],terminalIds:[...n.terminalIds],content:[...n.content]};e.status&&(r.status=e.status),e.title&&(r.title=e.title),e.locations&&(r.locations=f(e.locations));let i=e.rawInput;i!==void 0&&(r.rawInput=i),p(r,e.content),this.items[t]=r;break}case`plan`:{let t=e.entries;Array.isArray(t)&&(this.plan=t.map(e=>e).filter(e=>typeof e.content==`string`).map(e=>({content:e.content,priority:typeof e.priority==`string`?e.priority:void 0,status:typeof e.status==`string`?e.status:void 0})));break}case`usage_update`:{let t=e;this.tokenUsage={used:typeof t.used==`number`?t.used:void 0,size:typeof t.size==`number`?t.size:void 0};break}default:{let t=e.usage;t!==void 0&&(this.tokenUsage={used:t.used,size:t.size});break}}}};function u(e){let t=e.resolved;if(t===null)return null;if(t.optionId===null)return t.auto?{kind:`dismissed`}:{kind:`denied`,auto:!1,optionName:null};let n=e.options.find(e=>e.optionId===t.optionId);if(n===void 0)return{kind:`dismissed`};let r=n.kind.startsWith(`reject`),i=n.kind.startsWith(`allow`);return!r&&!i?{kind:`dismissed`}:{kind:r?`denied`:`approved`,auto:t.auto,optionName:n.name}}function d(e){let t=e.messageId;return typeof t==`string`?t:`default`}function f(e){return Array.isArray(e)?e.map(e=>e).filter(e=>typeof e.path==`string`).map(e=>({path:e.path,line:typeof e.line==`number`?e.line:void 0})):[]}function p(e,t){if(Array.isArray(t))for(let n of t){let t=n;if(t.type===`diff`&&typeof t.path==`string`&&typeof t.newText==`string`)e.diffs.push({path:t.path,oldText:typeof t.oldText==`string`?t.oldText:null,newText:t.newText});else if(t.type===`terminal`&&typeof t.terminalId==`string`)e.terminalIds.includes(t.terminalId)||e.terminalIds.push(t.terminalId);else if(t.type===`content`){let n=c(t.content);n!==null&&e.content.push(n)}else{let n=c(t);n!==null&&e.content.push(n)}}}var m=500,h=15e3,g=3e4,_=9e4,v=8e3,y=class extends Error{code;constructor(e,t){super(t),this.name=`ThreadResumeError`,this.code=e}},b=class extends Error{constructor(){super(`agent-thread channel is not connected`),this.name=`ThreadChannelUnavailableError`}},x=class{url=null;ws=null;reconnectDelay=m;reconnectTimer=null;threads=new Map;listeners=new Set;pendingCreates=new Map;pendingResumes=new Map;openedArchived=new Set;reqCounter=0;status=`idle`;version=0;setUrl(e){e!==this.url&&(this.url=e,this.teardownSocket(),e===null?this.setStatus(`idle`):this.connect())}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));threadsSnapshot=[];threadsSnapshotVersion=-1;getThreads=()=>(this.threadsSnapshotVersion!==this.version&&(this.threadsSnapshot=[...this.threads.values()].map(e=>e.info).sort((e,t)=>e.createdAt-t.createdAt),this.threadsSnapshotVersion=this.version),this.threadsSnapshot);openTabsSnapshot=[];openTabsSnapshotVersion=-1;getOpenTabs=()=>(this.openTabsSnapshotVersion!==this.version&&(this.openTabsSnapshot=[...this.threads.values()].map(e=>e.info).filter(e=>e.archived!==!0||this.openedArchived.has(e.threadId)).sort((e,t)=>e.createdAt-t.createdAt),this.openTabsSnapshotVersion=this.version),this.openTabsSnapshot);archivedSnapshot=[];archivedSnapshotVersion=-1;getArchivedThreads=()=>(this.archivedSnapshotVersion!==this.version&&(this.archivedSnapshot=[...this.threads.values()].map(e=>e.info).filter(e=>e.archived===!0).sort((e,t)=>t.lastActivityAt-e.lastActivityAt),this.archivedSnapshotVersion=this.version),this.archivedSnapshot);getThread=e=>this.threads.get(e)??null;modelBuilders=new Map;getThreadModel=e=>{let t=this.threads.get(e);if(t===void 0)return null;let n=this.modelBuilders.get(e);return n===void 0&&(n=new l,this.modelBuilders.set(e,n)),n.sync(t.events)};getConnectionStatus=()=>this.status;async createThread(e){this.connectNow(),await this.waitForOpen(v),this.reqCounter+=1;let t=`create-${this.reqCounter}`,n=new Promise((e,n)=>{let r=setTimeout(()=>{this.pendingCreates.delete(t),n(Error(`thread creation timed out`))},g);this.pendingCreates.set(t,{resolve:e,reject:n,timer:r})});return this.send({op:`create`,reqId:t,...e}),n}prompt(e,t){this.reqCounter+=1,this.send({op:`prompt`,threadId:e,reqId:`prompt-${this.reqCounter}`,content:t})}respondPermission(e,t,n){this.send({op:`permission_response`,threadId:e,requestId:t,outcome:n})}respondRuntimeConsent(e,t,n){this.send({op:`runtime_consent_response`,threadId:e,requestId:t,outcome:n})}cancel(e){this.send({op:`cancel`,threadId:e})}setMode(e,t){this.send({op:`set_mode`,threadId:e,modeId:t})}renameThread(e,t){let n=t.trim();n!==``&&this.send({op:`rename`,threadId:e,title:n})}setConfigOption(e,t,n){this.send({op:`set_config_option`,threadId:e,configId:t,value:n})}closeThread(e){let t=this.threads.get(e);if(t?.info.archived===!0){this.send({op:`unsubscribe`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.set(e,{info:t.info,events:[],lastSeq:-1}),this.bump();return}this.send({op:`close`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.delete(e)&&this.bump()}openArchivedThread(e){let t=this.threads.get(e);t===void 0||t.info.archived!==!0||this.openedArchived.has(e)||(this.openedArchived.add(e),this.send({op:`subscribe`,threadId:e,sinceSeq:t.lastSeq+1}),this.bump())}deleteThread(e){this.send({op:`delete`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.delete(e)&&this.bump()}async resumeThread(e,t){this.connectNow(),await this.waitForOpen(v),this.reqCounter+=1;let n=`resume-${this.reqCounter}`,r=new Promise((e,t)=>{let r=setTimeout(()=>{this.pendingResumes.delete(n),t(new y(`timeout`,`resume timed out`))},_);this.pendingResumes.set(n,{resolve:e,reject:t,timer:r})});return this.send({op:`resume`,threadId:e,reqId:n,prompt:t}),r}connectNow(){this.url===null||this.ws!==null||(this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnectDelay=m,this.connect())}waitForOpen(e){return this.ws!==null&&this.ws.readyState===WebSocket.OPEN?Promise.resolve():new Promise((t,n)=>{let r=e=>{clearTimeout(a),i(),e?t():n(new b)},i=this.subscribe(()=>{this.ws!==null&&this.ws.readyState===WebSocket.OPEN&&r(!0)}),a=setTimeout(()=>r(!1),e)})}connect(){if(this.url===null)return;this.setStatus(`connecting`);let e;try{e=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws=e,e.onopen=()=>{if(this.ws===e){this.reconnectDelay=m,this.setStatus(`open`),this.send({op:`list`});for(let[e,t]of this.threads)t.info.archived===!0&&!this.openedArchived.has(e)||this.send({op:`subscribe`,threadId:e,sinceSeq:t.lastSeq+1})}},e.onmessage=t=>{if(this.ws!==e||typeof t.data!=`string`)return;let n;try{n=JSON.parse(t.data)}catch{return}this.handleFrame(n)},e.onclose=()=>{this.ws===e&&(this.ws=null,this.setStatus(`closed`),this.scheduleReconnect())},e.onerror=()=>{}}teardownSocket(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);for(let e of this.pendingCreates.values())clearTimeout(e.timer),e.reject(new b);this.pendingCreates.clear();for(let e of this.pendingResumes.values())clearTimeout(e.timer),e.reject(new b);this.pendingResumes.clear();let e=this.ws;if(this.ws=null,e!==null)try{e.close()}catch{}}scheduleReconnect(){if(this.url===null||this.reconnectTimer!==null)return;let e=this.reconnectDelay;this.reconnectDelay=Math.min(this.reconnectDelay*2,h),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}send(e){let t=this.ws;if(!(t===null||t.readyState!==WebSocket.OPEN))try{t.send(JSON.stringify(e))}catch{}}handleFrame(e){switch(e.op){case`created`:{let t=this.pendingCreates.get(e.reqId);t!==void 0&&(this.pendingCreates.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`threads`:{let t=new Set;for(let n of e.threads){t.add(n.threadId);let e=this.threads.has(n.threadId);this.upsertInfo(n),!e&&n.archived!==!0&&this.send({op:`subscribe`,threadId:n.threadId,sinceSeq:0})}let n=!1;for(let e of Array.from(this.threads.keys()))t.has(e)||(this.threads.delete(e),this.modelBuilders.delete(e),this.openedArchived.delete(e),n=!0);n&&this.bump();return}case`resumed`:{let t=this.pendingResumes.get(e.reqId);t!==void 0&&(this.pendingResumes.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`subscribed`:this.upsertInfo(e.info);return;case`info`:this.upsertInfo(e.info);return;case`event`:this.appendEvents(e.threadId,e.seq,[e.event]);return;case`events`:this.appendEvents(e.threadId,e.fromSeq,e.events);return;case`error`:if(e.reqId!==void 0){let t=this.pendingCreates.get(e.reqId);if(t!==void 0){this.pendingCreates.delete(e.reqId),clearTimeout(t.timer),t.reject(Error(e.message));return}let n=this.pendingResumes.get(e.reqId);if(n!==void 0){this.pendingResumes.delete(e.reqId),clearTimeout(n.timer),n.reject(new y(e.code,e.message));return}if(e.reqId.startsWith(`prompt-`)){r.error(i._({id:`XNBGZw`,values:{0:e.message}}));return}}console.warn(`[agent-threads] server error frame:`,e.code,e.message);return;default:return}}appendEvents(e,t,n){let r=this.threads.get(e);if(r===void 0||n.length===0)return;let i=Math.max(r.lastSeq+1-t,0);if(i>=n.length)return;let a=i===0?n:n.slice(i),o=r.info;for(let e of a)o=S(o,e);this.threads.set(e,{info:o,events:[...r.events,...a],lastSeq:t+n.length-1}),this.bump()}upsertInfo(e){let t=this.threads.get(e.threadId);t===void 0?this.threads.set(e.threadId,{info:e,events:[],lastSeq:-1}):e.archived===!0&&t.info.archived!==!0?(this.openedArchived.delete(e.threadId),this.modelBuilders.delete(e.threadId),this.threads.set(e.threadId,{info:e,events:[],lastSeq:-1})):this.threads.set(e.threadId,{...t,info:e}),this.bump()}setStatus(e){this.status!==e&&(this.status=e,this.bump())}bump(){this.version+=1;for(let e of this.listeners)e()}};function S(e,t){switch(t.kind){case`status`:return{...e,status:t.status,lastActivityAt:t.ts};case`title_changed`:return{...e,title:t.title,lastActivityAt:t.ts};default:return{...e,lastActivityAt:t.ts}}}var C=new x;function w(){return C}function T(){return(0,a.useSyncExternalStore)(C.subscribe,C.getOpenTabs,C.getOpenTabs)}function E(){return(0,a.useSyncExternalStore)(C.subscribe,C.getArchivedThreads,C.getArchivedThreads)}function D(e){let t=(0,o.c)(2),n;t[0]===e?n=t[1]:(n=()=>C.getThread(e),t[0]=e,t[1]=n);let r=n;return(0,a.useSyncExternalStore)(C.subscribe,r,r)}function O(e){let t=(0,o.c)(2),n;t[0]===e?n=t[1]:(n=()=>C.getThreadModel(e),t[0]=e,t[1]=n);let r=n;return(0,a.useSyncExternalStore)(C.subscribe,r,r)}function k(){return(0,a.useSyncExternalStore)(C.subscribe,C.getConnectionStatus,C.getConnectionStatus)}function A(e){if(e===null)return null;try{let t=new URL(e);return t.pathname=`/collab/thread`,t.search=``,t.toString()}catch{return null}}export{D as a,E as c,A as i,T as l,y as n,k as o,w as r,O as s,b as t,u};
@@ -1,4 +1,4 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{n}from"./DocumentContext-DN3M8p0h.js";import{t as r}from"./react-JNybMug3.js";import{n as i,r as a}from"./dist-DBENJeML.js";import{r as o,t as s}from"./useQuery-NsPxD6kI.js";import{t as c}from"./compiler-runtime-dQcBxOhn.js";import{s as l}from"./createLucideIcon-BUb14crZ.js";import{t as u}from"./button-DHE6Sx02.js";import{n as d,r as f,t as p}from"./collapsible-BIzY37go.js";import{B as m,I as h}from"./CodeMirrorPropInput-Sjp30pzp.js";import{n as g,t as _}from"./toggle-group-CxrQL99E.js";import{Xr as v,fr as y,gt as b,pt as x}from"./dist-CDKZLcnD.js";import{t as S}from"./chevron-right-zaL9JagC.js";import{n as C}from"./CopyButton-D0gTyMvW.js";import{i as w}from"./prop-types-IOhQSrD8.js";import{l as T}from"./workspace-paths-CDfRQ5qH.js";import{t as E}from"./refresh-cw-DSH9Of_0.js";import{t as D}from"./triangle-alert-DpxK7pzx.js";import{t as O}from"./wrench-BDWKT3wQ.js";import{n as k}from"./dist-DwCd6eR-.js";import{t as A}from"./dist-BD3698ve.js";import{i as j}from"./startup-marks-CytO17UM.js";import{a as M,s as N}from"./doc-hash-r2oc1gt-.js";import{t as P}from"./badge-BDZGi1Ks.js";import{a as ee,i as F,n as te,o as ne,r as re,s as ie,t as ae}from"./panel-DLUMbyPl.js";import{t as I}from"./skeleton-CA6hvjst.js";import{i as L,r as R}from"./lint-config-client-C7TVN28Z.js";var z=e(r(),1),B=c(),V=3e4,H=new Map;function U(e){return e?Date.now()-e.rememberedAt>V?null:e.navigation:null}function W(e,t){H.set(e,{navigation:t,rememberedAt:Date.now()})}function G(e){return U(H.get(e))}function K(e){let t=H.get(e);return H.delete(e),U(t)}function q(e){H.delete(e)}function oe(e,t){let n=(0,B.c)(4),r=t===void 0?!1:t,[i,a]=(0,z.useState)(void 0),o=(0,z.useRef)(null),s,c;return n[0]!==r||n[1]!==e?(s=()=>{if(r||e.length===0){a(void 0);return}let t=function(){let t=window.innerHeight/2,n,r;for(let i of e){let e=document.getElementById(i);if(!e)continue;let a=e.getBoundingClientRect().top;a<0?n=i:r===void 0&&a<t&&(r=i)}a(r??n??e[0])},n=function(){o.current===null&&(o.current=requestAnimationFrame(()=>{o.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),o.current!==null&&(cancelAnimationFrame(o.current),o.current=null)}},c=[e,r],n[0]=r,n[1]=e,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,z.useEffect)(s,c),i}var J=t(),se=300;async function ce(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new m(A._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=b.safeParse(n);throw e.success?Error(e.data.title):new m(A._({id:`zlErBl`}),{status:t.status})}let r=x.safeParse(n);if(!r.success)throw new m(A._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var le=32,Y=12,X=6,ue=`open-knowledge:outline-nav`;function Z(e){let t=(0,B.c)(2),n;return t[0]===e?n=t[1]:(n=(0,J.jsx)(j,{name:`outline-panel`,children:(0,J.jsx)(de,{...e})}),t[0]=e,t[1]=n),n}function de(e){let t=(0,B.c)(50),{docName:r,isSourceMode:c,className:u}=e,d=u===void 0?``:u,{_:f}=a(),{pages:p,loading:m}=w(),h=o(),{activeProvider:g,activeDocName:_}=n(),v,b;t[0]===r?(v=t[1],b=t[2]):(v=[`page-headings`,r],b=()=>ce(r),t[0]=r,t[1]=v,t[2]=b);let x;t[3]!==r||t[4]!==m||t[5]!==p?(x=!m&&(p.has(r)||y(r)),t[3]=r,t[4]=m,t[5]=p,t[6]=x):x=t[6];let S;t[7]!==v||t[8]!==b||t[9]!==x?(S={queryKey:v,queryFn:b,enabled:x,staleTime:1/0},t[7]=v,t[8]=b,t[9]=x,t[10]=S):S=t[10];let{data:C,isLoading:T,error:E}=s(S),D;t[11]===C?D=t[12]:(D=C===void 0?[]:C,t[11]=C,t[12]=D);let O=D,k,A;t[13]!==_||t[14]!==g||t[15]!==r||t[16]!==h?(k=()=>{if(!g||_!==r)return;let e=g.document,t=null,n=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,h.invalidateQueries({queryKey:[`page-headings`,r]})},se)};return e.on(`update`,n),()=>{e.off(`update`,n),t!==null&&clearTimeout(t)}},A=[g,_,r,h],t[13]=_,t[14]=g,t[15]=r,t[16]=h,t[17]=k,t[18]=A):(k=t[17],A=t[18]),(0,z.useEffect)(k,A);let j;t[19]===O?j=t[20]:(j=O.map(fe),t[19]=O,t[20]=j);let M=oe(j,c),N;t[21]!==M||t[22]!==O?(N=M?O.findIndex(e=>e.slug===M):-1,t[21]=M,t[22]=O,t[23]=N):N=t[23];let P=N,I;t[24]!==r||t[25]!==c?(I=function(e,t){let n={index:e,slug:t,mode:c?`source`:`wysiwyg`};n.mode===`source`&&W(r,{kind:`outline`,detail:n}),window.dispatchEvent(new CustomEvent(ue,{detail:n}))},t[24]=r,t[25]=c,t[26]=I):I=t[26];let L=I,R=((P>=0?O[P].level:1)-1)*Y+(Y-X)/2,V=P*le+(le-X)/2,H;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,J.jsx)(ie,{children:(0,J.jsx)(i,{id:`dD7NPy`})}),t[27]=H):H=t[27];let U;t[28]!==O.length||t[29]!==T?(U=!T&&(0,J.jsx)(re,{children:O.length}),t[28]=O.length,t[29]=T,t[30]=U):U=t[30];let G;t[31]===U?G=t[32]:(G=(0,J.jsxs)(ne,{children:[H,U]}),t[31]=U,t[32]=G);let K;t[33]!==f||t[34]!==P||t[35]!==M||t[36]!==E||t[37]!==L||t[38]!==O||t[39]!==T||t[40]!==R||t[41]!==V?(K=E?(0,J.jsx)(ee,{className:`px-2`,children:E instanceof Error?E.message:f({id:`GuqOb1`})}):O.length===0&&!T?(0,J.jsx)(F,{className:`px-2`,children:(0,J.jsx)(i,{id:`0BB9ID`})}):(0,J.jsxs)(`nav`,{"aria-label":f({id:`BymzO4`}),className:`relative`,children:[P>=0&&(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-0 top-0 rounded-full bg-primary motion-safe:[transition:transform_0.25s_var(--ease-out-strong)]`,style:{width:X,height:X,transform:`translate(${R}px, ${V}px)`}}),O.map((e,t)=>{let n=e.slug===M;return(0,J.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>L(t,e.slug),className:l(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*Y+20}px`},title:e.text,children:e.text},t)})]}),t[33]=f,t[34]=P,t[35]=M,t[36]=E,t[37]=L,t[38]=O,t[39]=T,t[40]=R,t[41]=V,t[42]=K):K=t[42];let q;t[43]!==T||t[44]!==K?(q=(0,J.jsx)(te,{className:`px-3 py-2`,"aria-busy":T,children:K}),t[43]=T,t[44]=K,t[45]=q):q=t[45];let Z;return t[46]!==d||t[47]!==G||t[48]!==q?(Z=(0,J.jsxs)(ae,{className:d,children:[G,q]}),t[46]=d,t[47]=G,t[48]=q,t[49]=Z):Z=t[49],Z}function fe(e){return e.slug}function pe(e){let t=(0,B.c)(10),{scope:n,onScopeChange:r}=e,{_:o}=a(),s;t[0]===r?s=t[1]:(s=e=>{e&&r(e)},t[0]=r,t[1]=s);let c;t[2]===o?c=t[3]:(c=o({id:`aBgwis`}),t[2]=o,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,J.jsx)(g,{value:`doc`,className:`flex-1`,"data-testid":`panel-scope-doc`,children:(0,J.jsx)(i,{id:`UpCz01`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsx)(g,{value:`project`,className:`flex-1`,"data-testid":`panel-scope-project`,children:(0,J.jsx)(i,{id:`e0NrBM`})}),t[5]=u):u=t[5];let d;return t[6]!==n||t[7]!==s||t[8]!==c?(d=(0,J.jsx)(`div`,{className:`shrink-0 px-4 pb-2`,children:(0,J.jsxs)(_,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,value:n,onValueChange:s,"aria-label":c,className:`w-full rounded-md bg-muted p-0.5 dark:bg-background`,children:[l,u]})}),t[6]=n,t[7]=s,t[8]=c,t[9]=d):d=t[9],d}var me=`open-knowledge:lint-nav`;function he(e,t){return e.range.start.line-t.range.start.line||e.range.start.character-t.range.start.character}function ge(e){return{line:e.range.start.line+1,column:e.range.start.character+1}}function _e(e){let t=(0,B.c)(19),{diagnostic:n}=e,{_:r}=a(),i=n.severity===`error`?C:D,o=`${n.source}/${n.code}`,s=n.range.start.line+1,c=n.severity===`error`?`text-destructive`:`text-amber-500`,u;t[0]===c?u=t[1]:(u=l(`mt-0.5 size-3.5 shrink-0`,c),t[0]=c,t[1]=u);let d;t[2]!==i||t[3]!==u?(d=(0,J.jsx)(i,{"aria-hidden":`true`,className:u}),t[2]=i,t[3]=u,t[4]=d):d=t[4];let f;t[5]===n.message?f=t[6]:(f=(0,J.jsx)(`span`,{className:`text-foreground`,children:n.message}),t[5]=n.message,t[6]=f);let p;t[7]!==d||t[8]!==f?(p=(0,J.jsxs)(`span`,{className:`flex items-start gap-1.5 text-sm`,children:[d,f]}),t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==s?(m=r({id:`enPTnx`,values:{displayLine:s}}),t[10]=r,t[11]=s,t[12]=m):m=t[12];let h;t[13]!==o||t[14]!==m?(h=(0,J.jsxs)(`span`,{className:`ps-5 font-mono text-xs text-muted-foreground`,children:[o,` · `,m]}),t[13]=o,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==p||t[17]!==h?(g=(0,J.jsxs)(J.Fragment,{children:[p,h]}),t[16]=p,t[17]=h,t[18]=g):g=t[18],g}function ve(e){return`${e.source}/${e.code}-${e.range.start.line}-${e.range.start.character}-${e.message}`}function ye(e){return e.reduce((e,t)=>e+ +((t.fixes?.length??0)>0),0)}function be(e){let t=(0,B.c)(13),{count:n,disabled:r,onClick:o,children:s}=e,{_:c}=a(),l;t[0]!==c||t[1]!==s||t[2]!==n?(l=s===void 0?c({id:`Izb10l`,values:{count:n}}):void 0,t[0]=c,t[1]=s,t[2]=n,t[3]=l):l=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,J.jsx)(O,{"aria-hidden":`true`,className:`size-3`}),t[4]=d):d=t[4];let f;t[5]!==s||t[6]!==n?(f=s??(0,J.jsx)(i,{id:`5_8TCr`,values:{count:n}}),t[5]=s,t[6]=n,t[7]=f):f=t[7];let p;return t[8]!==r||t[9]!==o||t[10]!==l||t[11]!==f?(p=(0,J.jsxs)(u,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:r,onClick:o,"aria-label":l,"data-testid":`problems-fix-all`,children:[d,f]}),t[8]=r,t[9]=o,t[10]=l,t[11]=f,t[12]=p):p=t[12],p}function xe(e){let t=(0,B.c)(21),{docName:n,diagnostics:r,onFix:o,onFixAll:s,onAskAi:c}=e,{_:l}=a(),[d,f]=(0,z.useState)(`doc`),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={status:`idle`},t[0]=p):p=t[0];let[m,h]=(0,z.useState)(p),[g,_]=(0,z.useState)(null),v=(0,z.useRef)(!0),y,b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>(v.current=!0,()=>{v.current=!1}),b=[],t[1]=y,t[2]=b):(y=t[1],b=t[2]),(0,z.useEffect)(y,b);let x;if(t[3]!==l||t[4]!==m||t[5]!==r||t[6]!==n||t[7]!==c||t[8]!==o||t[9]!==s||t[10]!==g||t[11]!==d){let e=[...r].sort(he),a=async function(){h({status:`loading`});let e=await L();v.current&&h(e===null?{status:`failed`}:{status:`loaded`,result:e})},p=m.status===`loaded`?m.result.files.filter(we):[],y=async function(){if(g!==null||p.length===0)return;_({done:0,total:p.length});let e=[];for(let t of p){let n=await R(M(t.file));if(!v.current)return;n.ok||e.push({file:t.file,detail:n.errorDetail}),_(Ce)}if(_(null),e.length>0){let t=e[0];k.error(l({id:`fru3T7`,values:{0:e.length,1:p.length}}),{description:t===void 0?void 0:`${t.file}${t.detail===null?``:` — ${t.detail}`}`})}try{await a()}catch{v.current&&h({status:`failed`})}},b=function(e){f(e),e===`project`&&m.status===`idle`&&a()},S;t[13]===n?S=t[14]:(S=function(e){let t=ge(e);W(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(me,{detail:t}))},t[13]=n,t[14]=S);let C=S,w;t[15]!==n||t[16]!==C?(w=function(e,t){let r=M(e);if(r===n){C(t);return}W(r,{kind:`lint`,detail:ge(t)}),window.location.hash=N(r)},t[15]=n,t[16]=C,t[17]=w):w=t[17];let E=w,D;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,J.jsx)(ie,{children:(0,J.jsx)(i,{id:`OXdGnd`})}),t[18]=D):D=t[18];let A=d===`doc`&&e.length>0&&(0,J.jsx)(re,{children:e.length}),j;t[19]===A?j=t[20]:(j=(0,J.jsxs)(ne,{children:[D,A]}),t[19]=A,t[20]=j),x=(0,J.jsxs)(ae,{children:[j,(0,J.jsx)(pe,{scope:d,onScopeChange:b}),d===`doc`?(0,J.jsx)(te,{className:`px-2 py-2`,children:e.length===0?(0,J.jsx)(F,{className:`px-2`,children:(0,J.jsx)(i,{id:`ZI8uvA`})}):(0,J.jsxs)(J.Fragment,{children:[s!==void 0&&(0,J.jsx)(`div`,{className:`flex items-center justify-end gap-2 px-2 pb-1`,children:(0,J.jsx)(be,{count:ye(e),disabled:ye(e)===0,onClick:s})}),(0,J.jsx)(`ul`,{"aria-label":l({id:`OXdGnd`}),className:`flex flex-col gap-0.5`,children:e.map(e=>{let t=e.range.start.line+1,n=o!==void 0&&(e.fixes?.length??0)>0,r=`${e.source}/${e.code}`;return(0,J.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>C(e),className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left`,title:l({id:`aHPdYV`,values:{displayLine:t}}),children:(0,J.jsx)(_e,{diagnostic:e})}),n||c!==void 0?(0,J.jsxs)(`div`,{className:`absolute bottom-1 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:[n?(0,J.jsxs)(u,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>o?.(e),"aria-label":l({id:`fZj9em`,values:{flatId:r}}),"data-testid":`problems-fix`,children:[(0,J.jsx)(O,{"aria-hidden":`true`,className:`size-3`}),(0,J.jsx)(i,{id:`c4fVUV`})]}):null,c===void 0?null:(0,J.jsxs)(u,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>c(e),"aria-label":l({id:`hh4mVC`,values:{flatId:r}}),"data-testid":`problems-ask-ai`,children:[(0,J.jsx)(T,{"aria-hidden":`true`,className:`size-3`}),(0,J.jsx)(i,{id:`xWEvuo`})]})]}):null]},ve(e))})})]})}):(0,J.jsx)(Ee,{audit:m,onRefresh:()=>void a(),onNavigate:E,fixableCount:p.reduce(Se,0),fixing:g,onFixAll:()=>void y()})]}),t[3]=l,t[4]=m,t[5]=r,t[6]=n,t[7]=c,t[8]=o,t[9]=s,t[10]=g,t[11]=d,t[12]=x}else x=t[12];return x}function Se(e,t){return e+ye(t.diagnostics)}function Ce(e){return e===null?e:{...e,done:e.done+1}}function we(e){return e.diagnostics.some(Te)}function Te(e){return(e.fixes?.length??0)>0}function Ee(e){let t=(0,B.c)(43),{audit:n,onRefresh:r,onNavigate:o,fixableCount:s,fixing:c,onFixAll:l}=e,{_:d}=a(),f=n.status===`loading`||n.status===`idle`,p;t[0]!==n.result||t[1]!==n.status?(p=n.status===`loaded`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(i,{id:`DsDwR-`,values:{0:n.result.errorCount}}),` · `,(0,J.jsx)(i,{id:`W1SI2K`,values:{0:n.result.warningCount}})]}),t[0]=n.result,t[1]=n.status,t[2]=p):p=t[2];let m;t[3]===p?m=t[4]:(m=(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`problems-audit-summary`,children:p}),t[3]=p,t[4]=m);let h;t[5]!==d||t[6]!==c?(h=c===null?null:(0,J.jsx)(`span`,{className:`sr-only`,role:`status`,children:d({id:`gZElfU`,values:{0:c.done,1:c.total}})}),t[5]=d,t[6]=c,t[7]=h):h=t[7];let g=f||c!==null||s===0,_;t[8]===c?_=t[9]:(_=c===null?void 0:(0,J.jsx)(i,{id:`S9t1PI`,values:{0:c.done,1:c.total}}),t[8]=c,t[9]=_);let v;t[10]!==s||t[11]!==l||t[12]!==g||t[13]!==_?(v=(0,J.jsx)(be,{count:s,disabled:g,onClick:l,children:_}),t[10]=s,t[11]=l,t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]===d?y=t[16]:(y=d({id:`WRdYfS`}),t[15]=d,t[16]=y);let b=f||c!==null,x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,J.jsx)(E,{"aria-hidden":`true`,className:`size-3.5`}),t[17]=x):x=t[17];let S;t[18]!==r||t[19]!==y||t[20]!==b?(S=(0,J.jsx)(u,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":y,"data-testid":`problems-audit-refresh`,disabled:b,onClick:r,children:x}),t[18]=r,t[19]=y,t[20]=b,t[21]=S):S=t[21];let C;t[22]!==S||t[23]!==h||t[24]!==v?(C=(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[h,v,S]}),t[22]=S,t[23]=h,t[24]=v,t[25]=C):C=t[25];let w;t[26]!==C||t[27]!==m?(w=(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 pb-1`,children:[m,C]}),t[26]=C,t[27]=m,t[28]=w):w=t[28];let T;t[29]!==d||t[30]!==f?(T=f&&(0,J.jsx)(`div`,{className:`flex flex-col gap-1`,role:`status`,"aria-busy":`true`,"aria-label":d({id:`dx-TwN`}),children:[1,2,3].map(De)}),t[29]=d,t[30]=f,t[31]=T):T=t[31];let D;t[32]===n.status?D=t[33]:(D=n.status===`failed`&&(0,J.jsx)(ee,{className:`px-2 text-xs`,children:(0,J.jsx)(i,{id:`IFezUv`})}),t[32]=n.status,t[33]=D);let O;t[34]!==n.result||t[35]!==n.status||t[36]!==o?(O=n.status===`loaded`&&(0,J.jsx)(Oe,{result:n.result,onNavigate:o}),t[34]=n.result,t[35]=n.status,t[36]=o,t[37]=O):O=t[37];let k;return t[38]!==w||t[39]!==T||t[40]!==D||t[41]!==O?(k=(0,J.jsxs)(te,{className:`px-2 py-2`,"data-testid":`problems-project-scope`,children:[w,T,D,O]}),t[38]=w,t[39]=T,t[40]=D,t[41]=O,t[42]=k):k=t[42],k}function De(e){return(0,J.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded px-2 py-1.5`,children:[(0,J.jsx)(I,{className:`mt-0.5 size-3.5 shrink-0 rounded`}),(0,J.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,J.jsx)(I,{className:`h-3 w-28`}),(0,J.jsx)(I,{className:`h-3 w-40`})]})]},e)}function Oe(e){let t=(0,B.c)(10),{result:n,onNavigate:r}=e,{_:o}=a(),s;t[0]!==o||t[1]!==n.warnings?(s=n.warnings.length>0&&(0,J.jsx)(`ul`,{"aria-label":o({id:`Rsdhj9`}),className:`flex flex-col gap-0.5 pb-1`,children:n.warnings.map(ke)}),t[0]=o,t[1]=n.warnings,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n.fileCount||t[5]!==n.files?(c=n.files.length===0?(0,J.jsx)(F,{className:`px-2`,children:(0,J.jsx)(i,{id:`k_Dqw1`,values:{0:n.fileCount}})}):n.files.map(e=>(0,J.jsx)(Ae,{file:e,onNavigate:r},e.file)),t[3]=r,t[4]=n.fileCount,t[5]=n.files,t[6]=c):c=t[6];let l;return t[7]!==s||t[8]!==c?(l=(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function ke(e,t){return(0,J.jsxs)(`li`,{className:`flex items-start gap-1.5 px-2 text-xs`,children:[(0,J.jsx)(D,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-500`}),(0,J.jsx)(`span`,{className:`min-w-0 text-foreground`,children:e})]},`${t}-${e}`)}function Ae(e){let t=(0,B.c)(37),{file:n,onNavigate:r}=e,{_:i}=a(),o,s,c,l,u,m,h,g,_;if(t[0]!==i||t[1]!==n.diagnostics||t[2]!==n.file||t[3]!==r){let e=[...n.diagnostics].sort(he);s=p,h=!0,g=`problems-audit-group`;let a;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,J.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),t[13]=a):a=t[13];let v;t[14]===n.file?v=t[15]:(v=(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,title:n.file,children:n.file}),t[14]=n.file,t[15]=v),_=(0,J.jsxs)(f,{className:`group flex w-full cursor-pointer items-center gap-1.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:[a,v,(0,J.jsx)(P,{variant:`gray`,"data-testid":`problems-audit-file-count`,className:`shrink-0`,children:e.length})]}),o=d,m=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[16]!==i||t[17]!==n.file?(c=i({id:`zAJzIg`,values:{0:n.file}}),t[16]=i,t[17]=n.file,t[18]=c):c=t[18],l=`flex flex-col gap-0.5 pb-1 ps-3`;let y;t[19]!==i||t[20]!==n.file||t[21]!==r?(y=e=>{let t=e.range.start.line+1;return(0,J.jsx)(`li`,{children:(0,J.jsx)(`button`,{type:`button`,onClick:()=>r(n.file,e),className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,title:i({id:`kDwcbW`,values:{0:n.file,displayLine:t}}),children:(0,J.jsx)(_e,{diagnostic:e})})},ve(e))},t[19]=i,t[20]=n.file,t[21]=r,t[22]=y):y=t[22],u=e.map(y),t[0]=i,t[1]=n.diagnostics,t[2]=n.file,t[3]=r,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=m,t[10]=h,t[11]=g,t[12]=_}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],m=t[9],h=t[10],g=t[11],_=t[12];let v;t[23]!==c||t[24]!==l||t[25]!==u?(v=(0,J.jsx)(`ul`,{"aria-label":c,className:l,children:u}),t[23]=c,t[24]=l,t[25]=u,t[26]=v):v=t[26];let y;t[27]!==o||t[28]!==m||t[29]!==v?(y=(0,J.jsx)(o,{className:m,children:v}),t[27]=o,t[28]=m,t[29]=v,t[30]=y):y=t[30];let b;return t[31]!==s||t[32]!==h||t[33]!==g||t[34]!==_||t[35]!==y?(b=(0,J.jsxs)(s,{defaultOpen:h,"data-testid":g,children:[_,y]}),t[31]=s,t[32]=h,t[33]=g,t[34]=_,t[35]=y,t[36]=b):b=t[36],b}var je={words:0,chars:0,tokens:0},Me=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,Ne=/[\p{L}\p{N}]/u,Pe=new Set([`text`,`inlineCode`,`code`,`tag`]),Fe=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),Ie=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function Le(e,t){if(!e)return;let n=e.type;if(!Fe.has(n)){if(Pe.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{n}from"./DocumentContext-4RBN9Oik.js";import{t as r}from"./react-JNybMug3.js";import{n as i,r as a}from"./dist-DBENJeML.js";import{r as o,t as s}from"./useQuery-NsPxD6kI.js";import{t as c}from"./compiler-runtime-dQcBxOhn.js";import{s as l}from"./createLucideIcon-BUb14crZ.js";import{t as u}from"./button-DHE6Sx02.js";import{n as d,r as f,t as p}from"./collapsible-BIzY37go.js";import{B as m,I as h}from"./CodeMirrorPropInput-Sjp30pzp.js";import{n as g,t as _}from"./toggle-group-CxrQL99E.js";import{Xr as v,fr as y,gt as b,pt as x}from"./dist-CDKZLcnD.js";import{t as S}from"./chevron-right-zaL9JagC.js";import{n as C}from"./CopyButton-Cbumgow3.js";import{i as w}from"./prop-types-IOhQSrD8.js";import{l as T}from"./workspace-paths-BKmDPpqj.js";import{t as E}from"./refresh-cw-DSH9Of_0.js";import{t as D}from"./triangle-alert-DpxK7pzx.js";import{t as O}from"./wrench-BDWKT3wQ.js";import{n as k}from"./dist-DwCd6eR-.js";import{t as A}from"./dist-BD3698ve.js";import{i as j}from"./startup-marks-CytO17UM.js";import{a as M,s as N}from"./doc-hash-r2oc1gt-.js";import{t as P}from"./badge-BDZGi1Ks.js";import{a as ee,i as F,n as te,o as ne,r as re,s as ie,t as ae}from"./panel-DLUMbyPl.js";import{t as I}from"./skeleton-CA6hvjst.js";import{i as L,r as R}from"./lint-config-client-C7TVN28Z.js";var z=e(r(),1),B=c(),V=3e4,H=new Map;function U(e){return e?Date.now()-e.rememberedAt>V?null:e.navigation:null}function W(e,t){H.set(e,{navigation:t,rememberedAt:Date.now()})}function G(e){return U(H.get(e))}function K(e){let t=H.get(e);return H.delete(e),U(t)}function q(e){H.delete(e)}function oe(e,t){let n=(0,B.c)(4),r=t===void 0?!1:t,[i,a]=(0,z.useState)(void 0),o=(0,z.useRef)(null),s,c;return n[0]!==r||n[1]!==e?(s=()=>{if(r||e.length===0){a(void 0);return}let t=function(){let t=window.innerHeight/2,n,r;for(let i of e){let e=document.getElementById(i);if(!e)continue;let a=e.getBoundingClientRect().top;a<0?n=i:r===void 0&&a<t&&(r=i)}a(r??n??e[0])},n=function(){o.current===null&&(o.current=requestAnimationFrame(()=>{o.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),o.current!==null&&(cancelAnimationFrame(o.current),o.current=null)}},c=[e,r],n[0]=r,n[1]=e,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,z.useEffect)(s,c),i}var J=t(),se=300;async function ce(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new m(A._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=b.safeParse(n);throw e.success?Error(e.data.title):new m(A._({id:`zlErBl`}),{status:t.status})}let r=x.safeParse(n);if(!r.success)throw new m(A._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var le=32,Y=12,X=6,ue=`open-knowledge:outline-nav`;function Z(e){let t=(0,B.c)(2),n;return t[0]===e?n=t[1]:(n=(0,J.jsx)(j,{name:`outline-panel`,children:(0,J.jsx)(de,{...e})}),t[0]=e,t[1]=n),n}function de(e){let t=(0,B.c)(50),{docName:r,isSourceMode:c,className:u}=e,d=u===void 0?``:u,{_:f}=a(),{pages:p,loading:m}=w(),h=o(),{activeProvider:g,activeDocName:_}=n(),v,b;t[0]===r?(v=t[1],b=t[2]):(v=[`page-headings`,r],b=()=>ce(r),t[0]=r,t[1]=v,t[2]=b);let x;t[3]!==r||t[4]!==m||t[5]!==p?(x=!m&&(p.has(r)||y(r)),t[3]=r,t[4]=m,t[5]=p,t[6]=x):x=t[6];let S;t[7]!==v||t[8]!==b||t[9]!==x?(S={queryKey:v,queryFn:b,enabled:x,staleTime:1/0},t[7]=v,t[8]=b,t[9]=x,t[10]=S):S=t[10];let{data:C,isLoading:T,error:E}=s(S),D;t[11]===C?D=t[12]:(D=C===void 0?[]:C,t[11]=C,t[12]=D);let O=D,k,A;t[13]!==_||t[14]!==g||t[15]!==r||t[16]!==h?(k=()=>{if(!g||_!==r)return;let e=g.document,t=null,n=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,h.invalidateQueries({queryKey:[`page-headings`,r]})},se)};return e.on(`update`,n),()=>{e.off(`update`,n),t!==null&&clearTimeout(t)}},A=[g,_,r,h],t[13]=_,t[14]=g,t[15]=r,t[16]=h,t[17]=k,t[18]=A):(k=t[17],A=t[18]),(0,z.useEffect)(k,A);let j;t[19]===O?j=t[20]:(j=O.map(fe),t[19]=O,t[20]=j);let M=oe(j,c),N;t[21]!==M||t[22]!==O?(N=M?O.findIndex(e=>e.slug===M):-1,t[21]=M,t[22]=O,t[23]=N):N=t[23];let P=N,I;t[24]!==r||t[25]!==c?(I=function(e,t){let n={index:e,slug:t,mode:c?`source`:`wysiwyg`};n.mode===`source`&&W(r,{kind:`outline`,detail:n}),window.dispatchEvent(new CustomEvent(ue,{detail:n}))},t[24]=r,t[25]=c,t[26]=I):I=t[26];let L=I,R=((P>=0?O[P].level:1)-1)*Y+(Y-X)/2,V=P*le+(le-X)/2,H;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,J.jsx)(ie,{children:(0,J.jsx)(i,{id:`dD7NPy`})}),t[27]=H):H=t[27];let U;t[28]!==O.length||t[29]!==T?(U=!T&&(0,J.jsx)(re,{children:O.length}),t[28]=O.length,t[29]=T,t[30]=U):U=t[30];let G;t[31]===U?G=t[32]:(G=(0,J.jsxs)(ne,{children:[H,U]}),t[31]=U,t[32]=G);let K;t[33]!==f||t[34]!==P||t[35]!==M||t[36]!==E||t[37]!==L||t[38]!==O||t[39]!==T||t[40]!==R||t[41]!==V?(K=E?(0,J.jsx)(ee,{className:`px-2`,children:E instanceof Error?E.message:f({id:`GuqOb1`})}):O.length===0&&!T?(0,J.jsx)(F,{className:`px-2`,children:(0,J.jsx)(i,{id:`0BB9ID`})}):(0,J.jsxs)(`nav`,{"aria-label":f({id:`BymzO4`}),className:`relative`,children:[P>=0&&(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-0 top-0 rounded-full bg-primary motion-safe:[transition:transform_0.25s_var(--ease-out-strong)]`,style:{width:X,height:X,transform:`translate(${R}px, ${V}px)`}}),O.map((e,t)=>{let n=e.slug===M;return(0,J.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>L(t,e.slug),className:l(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*Y+20}px`},title:e.text,children:e.text},t)})]}),t[33]=f,t[34]=P,t[35]=M,t[36]=E,t[37]=L,t[38]=O,t[39]=T,t[40]=R,t[41]=V,t[42]=K):K=t[42];let q;t[43]!==T||t[44]!==K?(q=(0,J.jsx)(te,{className:`px-3 py-2`,"aria-busy":T,children:K}),t[43]=T,t[44]=K,t[45]=q):q=t[45];let Z;return t[46]!==d||t[47]!==G||t[48]!==q?(Z=(0,J.jsxs)(ae,{className:d,children:[G,q]}),t[46]=d,t[47]=G,t[48]=q,t[49]=Z):Z=t[49],Z}function fe(e){return e.slug}function pe(e){let t=(0,B.c)(10),{scope:n,onScopeChange:r}=e,{_:o}=a(),s;t[0]===r?s=t[1]:(s=e=>{e&&r(e)},t[0]=r,t[1]=s);let c;t[2]===o?c=t[3]:(c=o({id:`aBgwis`}),t[2]=o,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,J.jsx)(g,{value:`doc`,className:`flex-1`,"data-testid":`panel-scope-doc`,children:(0,J.jsx)(i,{id:`UpCz01`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsx)(g,{value:`project`,className:`flex-1`,"data-testid":`panel-scope-project`,children:(0,J.jsx)(i,{id:`e0NrBM`})}),t[5]=u):u=t[5];let d;return t[6]!==n||t[7]!==s||t[8]!==c?(d=(0,J.jsx)(`div`,{className:`shrink-0 px-4 pb-2`,children:(0,J.jsxs)(_,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,value:n,onValueChange:s,"aria-label":c,className:`w-full rounded-md bg-muted p-0.5 dark:bg-background`,children:[l,u]})}),t[6]=n,t[7]=s,t[8]=c,t[9]=d):d=t[9],d}var me=`open-knowledge:lint-nav`;function he(e,t){return e.range.start.line-t.range.start.line||e.range.start.character-t.range.start.character}function ge(e){return{line:e.range.start.line+1,column:e.range.start.character+1}}function _e(e){let t=(0,B.c)(19),{diagnostic:n}=e,{_:r}=a(),i=n.severity===`error`?C:D,o=`${n.source}/${n.code}`,s=n.range.start.line+1,c=n.severity===`error`?`text-destructive`:`text-amber-500`,u;t[0]===c?u=t[1]:(u=l(`mt-0.5 size-3.5 shrink-0`,c),t[0]=c,t[1]=u);let d;t[2]!==i||t[3]!==u?(d=(0,J.jsx)(i,{"aria-hidden":`true`,className:u}),t[2]=i,t[3]=u,t[4]=d):d=t[4];let f;t[5]===n.message?f=t[6]:(f=(0,J.jsx)(`span`,{className:`text-foreground`,children:n.message}),t[5]=n.message,t[6]=f);let p;t[7]!==d||t[8]!==f?(p=(0,J.jsxs)(`span`,{className:`flex items-start gap-1.5 text-sm`,children:[d,f]}),t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==s?(m=r({id:`enPTnx`,values:{displayLine:s}}),t[10]=r,t[11]=s,t[12]=m):m=t[12];let h;t[13]!==o||t[14]!==m?(h=(0,J.jsxs)(`span`,{className:`ps-5 font-mono text-xs text-muted-foreground`,children:[o,` · `,m]}),t[13]=o,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==p||t[17]!==h?(g=(0,J.jsxs)(J.Fragment,{children:[p,h]}),t[16]=p,t[17]=h,t[18]=g):g=t[18],g}function ve(e){return`${e.source}/${e.code}-${e.range.start.line}-${e.range.start.character}-${e.message}`}function ye(e){return e.reduce((e,t)=>e+ +((t.fixes?.length??0)>0),0)}function be(e){let t=(0,B.c)(13),{count:n,disabled:r,onClick:o,children:s}=e,{_:c}=a(),l;t[0]!==c||t[1]!==s||t[2]!==n?(l=s===void 0?c({id:`Izb10l`,values:{count:n}}):void 0,t[0]=c,t[1]=s,t[2]=n,t[3]=l):l=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,J.jsx)(O,{"aria-hidden":`true`,className:`size-3`}),t[4]=d):d=t[4];let f;t[5]!==s||t[6]!==n?(f=s??(0,J.jsx)(i,{id:`5_8TCr`,values:{count:n}}),t[5]=s,t[6]=n,t[7]=f):f=t[7];let p;return t[8]!==r||t[9]!==o||t[10]!==l||t[11]!==f?(p=(0,J.jsxs)(u,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:r,onClick:o,"aria-label":l,"data-testid":`problems-fix-all`,children:[d,f]}),t[8]=r,t[9]=o,t[10]=l,t[11]=f,t[12]=p):p=t[12],p}function xe(e){let t=(0,B.c)(21),{docName:n,diagnostics:r,onFix:o,onFixAll:s,onAskAi:c}=e,{_:l}=a(),[d,f]=(0,z.useState)(`doc`),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={status:`idle`},t[0]=p):p=t[0];let[m,h]=(0,z.useState)(p),[g,_]=(0,z.useState)(null),v=(0,z.useRef)(!0),y,b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>(v.current=!0,()=>{v.current=!1}),b=[],t[1]=y,t[2]=b):(y=t[1],b=t[2]),(0,z.useEffect)(y,b);let x;if(t[3]!==l||t[4]!==m||t[5]!==r||t[6]!==n||t[7]!==c||t[8]!==o||t[9]!==s||t[10]!==g||t[11]!==d){let e=[...r].sort(he),a=async function(){h({status:`loading`});let e=await L();v.current&&h(e===null?{status:`failed`}:{status:`loaded`,result:e})},p=m.status===`loaded`?m.result.files.filter(we):[],y=async function(){if(g!==null||p.length===0)return;_({done:0,total:p.length});let e=[];for(let t of p){let n=await R(M(t.file));if(!v.current)return;n.ok||e.push({file:t.file,detail:n.errorDetail}),_(Ce)}if(_(null),e.length>0){let t=e[0];k.error(l({id:`fru3T7`,values:{0:e.length,1:p.length}}),{description:t===void 0?void 0:`${t.file}${t.detail===null?``:` — ${t.detail}`}`})}try{await a()}catch{v.current&&h({status:`failed`})}},b=function(e){f(e),e===`project`&&m.status===`idle`&&a()},S;t[13]===n?S=t[14]:(S=function(e){let t=ge(e);W(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(me,{detail:t}))},t[13]=n,t[14]=S);let C=S,w;t[15]!==n||t[16]!==C?(w=function(e,t){let r=M(e);if(r===n){C(t);return}W(r,{kind:`lint`,detail:ge(t)}),window.location.hash=N(r)},t[15]=n,t[16]=C,t[17]=w):w=t[17];let E=w,D;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,J.jsx)(ie,{children:(0,J.jsx)(i,{id:`OXdGnd`})}),t[18]=D):D=t[18];let A=d===`doc`&&e.length>0&&(0,J.jsx)(re,{children:e.length}),j;t[19]===A?j=t[20]:(j=(0,J.jsxs)(ne,{children:[D,A]}),t[19]=A,t[20]=j),x=(0,J.jsxs)(ae,{children:[j,(0,J.jsx)(pe,{scope:d,onScopeChange:b}),d===`doc`?(0,J.jsx)(te,{className:`px-2 py-2`,children:e.length===0?(0,J.jsx)(F,{className:`px-2`,children:(0,J.jsx)(i,{id:`ZI8uvA`})}):(0,J.jsxs)(J.Fragment,{children:[s!==void 0&&(0,J.jsx)(`div`,{className:`flex items-center justify-end gap-2 px-2 pb-1`,children:(0,J.jsx)(be,{count:ye(e),disabled:ye(e)===0,onClick:s})}),(0,J.jsx)(`ul`,{"aria-label":l({id:`OXdGnd`}),className:`flex flex-col gap-0.5`,children:e.map(e=>{let t=e.range.start.line+1,n=o!==void 0&&(e.fixes?.length??0)>0,r=`${e.source}/${e.code}`;return(0,J.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>C(e),className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left`,title:l({id:`aHPdYV`,values:{displayLine:t}}),children:(0,J.jsx)(_e,{diagnostic:e})}),n||c!==void 0?(0,J.jsxs)(`div`,{className:`absolute bottom-1 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:[n?(0,J.jsxs)(u,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>o?.(e),"aria-label":l({id:`fZj9em`,values:{flatId:r}}),"data-testid":`problems-fix`,children:[(0,J.jsx)(O,{"aria-hidden":`true`,className:`size-3`}),(0,J.jsx)(i,{id:`c4fVUV`})]}):null,c===void 0?null:(0,J.jsxs)(u,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>c(e),"aria-label":l({id:`hh4mVC`,values:{flatId:r}}),"data-testid":`problems-ask-ai`,children:[(0,J.jsx)(T,{"aria-hidden":`true`,className:`size-3`}),(0,J.jsx)(i,{id:`xWEvuo`})]})]}):null]},ve(e))})})]})}):(0,J.jsx)(Ee,{audit:m,onRefresh:()=>void a(),onNavigate:E,fixableCount:p.reduce(Se,0),fixing:g,onFixAll:()=>void y()})]}),t[3]=l,t[4]=m,t[5]=r,t[6]=n,t[7]=c,t[8]=o,t[9]=s,t[10]=g,t[11]=d,t[12]=x}else x=t[12];return x}function Se(e,t){return e+ye(t.diagnostics)}function Ce(e){return e===null?e:{...e,done:e.done+1}}function we(e){return e.diagnostics.some(Te)}function Te(e){return(e.fixes?.length??0)>0}function Ee(e){let t=(0,B.c)(43),{audit:n,onRefresh:r,onNavigate:o,fixableCount:s,fixing:c,onFixAll:l}=e,{_:d}=a(),f=n.status===`loading`||n.status===`idle`,p;t[0]!==n.result||t[1]!==n.status?(p=n.status===`loaded`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(i,{id:`DsDwR-`,values:{0:n.result.errorCount}}),` · `,(0,J.jsx)(i,{id:`W1SI2K`,values:{0:n.result.warningCount}})]}),t[0]=n.result,t[1]=n.status,t[2]=p):p=t[2];let m;t[3]===p?m=t[4]:(m=(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`problems-audit-summary`,children:p}),t[3]=p,t[4]=m);let h;t[5]!==d||t[6]!==c?(h=c===null?null:(0,J.jsx)(`span`,{className:`sr-only`,role:`status`,children:d({id:`gZElfU`,values:{0:c.done,1:c.total}})}),t[5]=d,t[6]=c,t[7]=h):h=t[7];let g=f||c!==null||s===0,_;t[8]===c?_=t[9]:(_=c===null?void 0:(0,J.jsx)(i,{id:`S9t1PI`,values:{0:c.done,1:c.total}}),t[8]=c,t[9]=_);let v;t[10]!==s||t[11]!==l||t[12]!==g||t[13]!==_?(v=(0,J.jsx)(be,{count:s,disabled:g,onClick:l,children:_}),t[10]=s,t[11]=l,t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]===d?y=t[16]:(y=d({id:`WRdYfS`}),t[15]=d,t[16]=y);let b=f||c!==null,x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,J.jsx)(E,{"aria-hidden":`true`,className:`size-3.5`}),t[17]=x):x=t[17];let S;t[18]!==r||t[19]!==y||t[20]!==b?(S=(0,J.jsx)(u,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":y,"data-testid":`problems-audit-refresh`,disabled:b,onClick:r,children:x}),t[18]=r,t[19]=y,t[20]=b,t[21]=S):S=t[21];let C;t[22]!==S||t[23]!==h||t[24]!==v?(C=(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[h,v,S]}),t[22]=S,t[23]=h,t[24]=v,t[25]=C):C=t[25];let w;t[26]!==C||t[27]!==m?(w=(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 pb-1`,children:[m,C]}),t[26]=C,t[27]=m,t[28]=w):w=t[28];let T;t[29]!==d||t[30]!==f?(T=f&&(0,J.jsx)(`div`,{className:`flex flex-col gap-1`,role:`status`,"aria-busy":`true`,"aria-label":d({id:`dx-TwN`}),children:[1,2,3].map(De)}),t[29]=d,t[30]=f,t[31]=T):T=t[31];let D;t[32]===n.status?D=t[33]:(D=n.status===`failed`&&(0,J.jsx)(ee,{className:`px-2 text-xs`,children:(0,J.jsx)(i,{id:`IFezUv`})}),t[32]=n.status,t[33]=D);let O;t[34]!==n.result||t[35]!==n.status||t[36]!==o?(O=n.status===`loaded`&&(0,J.jsx)(Oe,{result:n.result,onNavigate:o}),t[34]=n.result,t[35]=n.status,t[36]=o,t[37]=O):O=t[37];let k;return t[38]!==w||t[39]!==T||t[40]!==D||t[41]!==O?(k=(0,J.jsxs)(te,{className:`px-2 py-2`,"data-testid":`problems-project-scope`,children:[w,T,D,O]}),t[38]=w,t[39]=T,t[40]=D,t[41]=O,t[42]=k):k=t[42],k}function De(e){return(0,J.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded px-2 py-1.5`,children:[(0,J.jsx)(I,{className:`mt-0.5 size-3.5 shrink-0 rounded`}),(0,J.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,J.jsx)(I,{className:`h-3 w-28`}),(0,J.jsx)(I,{className:`h-3 w-40`})]})]},e)}function Oe(e){let t=(0,B.c)(10),{result:n,onNavigate:r}=e,{_:o}=a(),s;t[0]!==o||t[1]!==n.warnings?(s=n.warnings.length>0&&(0,J.jsx)(`ul`,{"aria-label":o({id:`Rsdhj9`}),className:`flex flex-col gap-0.5 pb-1`,children:n.warnings.map(ke)}),t[0]=o,t[1]=n.warnings,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n.fileCount||t[5]!==n.files?(c=n.files.length===0?(0,J.jsx)(F,{className:`px-2`,children:(0,J.jsx)(i,{id:`k_Dqw1`,values:{0:n.fileCount}})}):n.files.map(e=>(0,J.jsx)(Ae,{file:e,onNavigate:r},e.file)),t[3]=r,t[4]=n.fileCount,t[5]=n.files,t[6]=c):c=t[6];let l;return t[7]!==s||t[8]!==c?(l=(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function ke(e,t){return(0,J.jsxs)(`li`,{className:`flex items-start gap-1.5 px-2 text-xs`,children:[(0,J.jsx)(D,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-500`}),(0,J.jsx)(`span`,{className:`min-w-0 text-foreground`,children:e})]},`${t}-${e}`)}function Ae(e){let t=(0,B.c)(37),{file:n,onNavigate:r}=e,{_:i}=a(),o,s,c,l,u,m,h,g,_;if(t[0]!==i||t[1]!==n.diagnostics||t[2]!==n.file||t[3]!==r){let e=[...n.diagnostics].sort(he);s=p,h=!0,g=`problems-audit-group`;let a;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,J.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),t[13]=a):a=t[13];let v;t[14]===n.file?v=t[15]:(v=(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,title:n.file,children:n.file}),t[14]=n.file,t[15]=v),_=(0,J.jsxs)(f,{className:`group flex w-full cursor-pointer items-center gap-1.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:[a,v,(0,J.jsx)(P,{variant:`gray`,"data-testid":`problems-audit-file-count`,className:`shrink-0`,children:e.length})]}),o=d,m=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[16]!==i||t[17]!==n.file?(c=i({id:`zAJzIg`,values:{0:n.file}}),t[16]=i,t[17]=n.file,t[18]=c):c=t[18],l=`flex flex-col gap-0.5 pb-1 ps-3`;let y;t[19]!==i||t[20]!==n.file||t[21]!==r?(y=e=>{let t=e.range.start.line+1;return(0,J.jsx)(`li`,{children:(0,J.jsx)(`button`,{type:`button`,onClick:()=>r(n.file,e),className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,title:i({id:`kDwcbW`,values:{0:n.file,displayLine:t}}),children:(0,J.jsx)(_e,{diagnostic:e})})},ve(e))},t[19]=i,t[20]=n.file,t[21]=r,t[22]=y):y=t[22],u=e.map(y),t[0]=i,t[1]=n.diagnostics,t[2]=n.file,t[3]=r,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=m,t[10]=h,t[11]=g,t[12]=_}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],m=t[9],h=t[10],g=t[11],_=t[12];let v;t[23]!==c||t[24]!==l||t[25]!==u?(v=(0,J.jsx)(`ul`,{"aria-label":c,className:l,children:u}),t[23]=c,t[24]=l,t[25]=u,t[26]=v):v=t[26];let y;t[27]!==o||t[28]!==m||t[29]!==v?(y=(0,J.jsx)(o,{className:m,children:v}),t[27]=o,t[28]=m,t[29]=v,t[30]=y):y=t[30];let b;return t[31]!==s||t[32]!==h||t[33]!==g||t[34]!==_||t[35]!==y?(b=(0,J.jsxs)(s,{defaultOpen:h,"data-testid":g,children:[_,y]}),t[31]=s,t[32]=h,t[33]=g,t[34]=_,t[35]=y,t[36]=b):b=t[36],b}var je={words:0,chars:0,tokens:0},Me=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,Ne=/[\p{L}\p{N}]/u,Pe=new Set([`text`,`inlineCode`,`code`,`tag`]),Fe=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),Ie=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function Le(e,t){if(!e)return;let n=e.type;if(!Fe.has(n)){if(Pe.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
2
2
  `));return}if(n===`wikiLink`||n===`wikiLinkEmbed`){let n=e.data?.alias??e.value??``;n&&t.push(n);return}if(Array.isArray(e.children)){for(let n of e.children)Le(n,t);if(Ie.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
3
3
  `)&&t.push(`
4
4
  `)}}}}function Re(e){try{let t=h().parseToMdast(e),n=[];return Le(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function ze(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))Ne.test(n)&&t++;return t}function Be(e){let t=globalThis.Intl.Segmenter;if(!t)return ze(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function Ve(e){let t=Me.test(e)?1.5:4;return Math.ceil(e.length/t)}function He(e){return e?{words:Me.test(e)?Be(e):ze(e),chars:e.length,tokens:Ve(e)}:{words:0,chars:0,tokens:0}}function Ue(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=v(e);return t.trim()?He(Re(t)):{words:0,chars:0,tokens:0}}function We(e,{isMarkdown:t}){let n=e.trim();return n?He(t?Re(e):n):je}var Q=new Map,$=new Set,Ge=(e,t)=>`${t}:${e}`;function Ke(){for(let e of $)e()}function qe(e,t,n){let r=Ge(e,t);if(n===null){Q.delete(r)&&Ke();return}let i=Q.get(r);i&&i.words===n.words&&i.chars===n.chars&&i.tokens===n.tokens||(Q.set(r,n),Ke())}function Je(e,t){return e===null?null:Q.get(Ge(e,t))??null}function Ye(e){return $.add(e),()=>{$.delete(e)}}function Xe(e){let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{n as t}from"./DocumentContext-DN3M8p0h.js";import{t as n}from"./react-JNybMug3.js";import{t as r}from"./compiler-runtime-dQcBxOhn.js";import{B as i}from"./CodeMirrorPropInput-Sjp30pzp.js";import{a,gt as o,i as s}from"./dist-CDKZLcnD.js";import{o as c}from"./documents-events-DNDUkpJM.js";import{n as l}from"./agent-presence-DdJtLtJ1.js";import{t as u}from"./lru-string-cache-D19dwCKJ.js";var d=r(),f=e(n(),1),p=500,m=64;async function h(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new i(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=o.safeParse(r);throw e.success?Error(e.data.title):new i(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let a=s.safeParse(r);if(!a.success)throw new i(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:a.error,status:n.status});return a.data}async function g(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&keptCount=${n}`,s=await fetch(r),c;try{c=await s.json()}catch(e){throw new i(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:s.status})}if(!s.ok){let e=o.safeParse(c);throw e.success?Error(e.data.title):new i(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:s.status})}let l=a.safeParse(c);if(!l.success)throw new i(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:l.error,status:s.status});let{diff:u,before:d,after:f}=l.data;return{diff:u,before:d,after:f}}function _(e){let n=(0,d.c)(23),{systemProvider:r}=t(),[i,a]=(0,f.useState)(null),[o,s]=(0,f.useState)(`idle`),[l,_]=(0,f.useState)(null),b;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=new u(m),n[0]=b):b=n[0];let x=(0,f.useRef)(b),S=(0,f.useRef)(0),C;n[1]===r?C=n[2]:(C=e=>{let t=S.current+=1;s(`loading`),_(null),h(e).then(n=>{if(S.current!==t)return;let i=y(r,e);a({...n,writingDocs:i}),s(`ready`)}).catch(e=>{S.current===t&&(_(e instanceof Error?e.message:String(e)),s(`error`))})},n[1]=r,n[2]=C);let w=C,T;n[3]!==e||n[4]!==w?(T=()=>{if(!e){S.current+=1,a(null),s(`idle`),_(null),x.current.clear();return}x.current.clear(),w(e);let t=null,n=c(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,w(e)},p))});return()=>{t&&clearTimeout(t),n()}},n[3]=e,n[4]=w,n[5]=T):T=n[5];let E;n[6]===e?E=n[7]:(E=[e],n[6]=e,n[7]=E),(0,f.useEffect)(T,E);let D,O;n[8]!==e||n[9]!==r?(D=()=>{if(!e||!r)return;let t=()=>{if(!r.awareness)return;let t=y(r,e);a(e=>!e||v(e.writingDocs,t)?e:{...e,writingDocs:t})},n=r.awareness;if(!n||typeof n.on!=`function`){t();return}n.on(`update`,t),t();let i=setInterval(t,1e3);return()=>{clearInterval(i),typeof n.off==`function`&&n.off(`update`,t)}},O=[e,r],n[8]=e,n[9]=r,n[10]=D,n[11]=O):(D=n[10],O=n[11]),(0,f.useEffect)(D,O);let k;n[12]===e?k=n[13]:(k=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=x.current.get(r);if(i!==void 0)return i;let{diff:a}=await g(e,t,n);return x.current.set(r,a),a},n[12]=e,n[13]=k);let A=k,j;n[14]!==e||n[15]!==w?(j=()=>{e&&w(e)},n[14]=e,n[15]=w,n[16]=j):j=n[16];let M=j,N;return n[17]!==i||n[18]!==l||n[19]!==A||n[20]!==M||n[21]!==o?(N={data:i,status:o,error:l,reload:M,fetchBurstDiff:A},n[17]=i,n[18]=l,n[19]=A,n[20]=M,n[21]=o,n[22]=N):N=n[22],N}function v(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function y(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!l(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}export{_ as n,g as t};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{n as t}from"./DocumentContext-4RBN9Oik.js";import{t as n}from"./react-JNybMug3.js";import{t as r}from"./compiler-runtime-dQcBxOhn.js";import{B as i}from"./CodeMirrorPropInput-Sjp30pzp.js";import{a,gt as o,i as s}from"./dist-CDKZLcnD.js";import{o as c}from"./documents-events-DNDUkpJM.js";import{n as l}from"./agent-presence-DdJtLtJ1.js";import{t as u}from"./lru-string-cache-D19dwCKJ.js";var d=r(),f=e(n(),1),p=500,m=64;async function h(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new i(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=o.safeParse(r);throw e.success?Error(e.data.title):new i(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let a=s.safeParse(r);if(!a.success)throw new i(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:a.error,status:n.status});return a.data}async function g(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&keptCount=${n}`,s=await fetch(r),c;try{c=await s.json()}catch(e){throw new i(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:s.status})}if(!s.ok){let e=o.safeParse(c);throw e.success?Error(e.data.title):new i(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:s.status})}let l=a.safeParse(c);if(!l.success)throw new i(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:l.error,status:s.status});let{diff:u,before:d,after:f}=l.data;return{diff:u,before:d,after:f}}function _(e){let n=(0,d.c)(23),{systemProvider:r}=t(),[i,a]=(0,f.useState)(null),[o,s]=(0,f.useState)(`idle`),[l,_]=(0,f.useState)(null),b;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=new u(m),n[0]=b):b=n[0];let x=(0,f.useRef)(b),S=(0,f.useRef)(0),C;n[1]===r?C=n[2]:(C=e=>{let t=S.current+=1;s(`loading`),_(null),h(e).then(n=>{if(S.current!==t)return;let i=y(r,e);a({...n,writingDocs:i}),s(`ready`)}).catch(e=>{S.current===t&&(_(e instanceof Error?e.message:String(e)),s(`error`))})},n[1]=r,n[2]=C);let w=C,T;n[3]!==e||n[4]!==w?(T=()=>{if(!e){S.current+=1,a(null),s(`idle`),_(null),x.current.clear();return}x.current.clear(),w(e);let t=null,n=c(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,w(e)},p))});return()=>{t&&clearTimeout(t),n()}},n[3]=e,n[4]=w,n[5]=T):T=n[5];let E;n[6]===e?E=n[7]:(E=[e],n[6]=e,n[7]=E),(0,f.useEffect)(T,E);let D,O;n[8]!==e||n[9]!==r?(D=()=>{if(!e||!r)return;let t=()=>{if(!r.awareness)return;let t=y(r,e);a(e=>!e||v(e.writingDocs,t)?e:{...e,writingDocs:t})},n=r.awareness;if(!n||typeof n.on!=`function`){t();return}n.on(`update`,t),t();let i=setInterval(t,1e3);return()=>{clearInterval(i),typeof n.off==`function`&&n.off(`update`,t)}},O=[e,r],n[8]=e,n[9]=r,n[10]=D,n[11]=O):(D=n[10],O=n[11]),(0,f.useEffect)(D,O);let k;n[12]===e?k=n[13]:(k=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=x.current.get(r);if(i!==void 0)return i;let{diff:a}=await g(e,t,n);return x.current.set(r,a),a},n[12]=e,n[13]=k);let A=k,j;n[14]!==e||n[15]!==w?(j=()=>{e&&w(e)},n[14]=e,n[15]=w,n[16]=j):j=n[16];let M=j,N;return n[17]!==i||n[18]!==l||n[19]!==A||n[20]!==M||n[21]!==o?(N={data:i,status:o,error:l,reload:M,fetchBurstDiff:A},n[17]=i,n[18]=l,n[19]=A,n[20]=M,n[21]=o,n[22]=N):N=n[22],N}function v(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function y(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!l(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}export{_ as n,g as t};
@@ -1,4 +1,4 @@
1
- import{i as e,t}from"./chunk-DseTPa7n.js";import{t as n}from"./jsx-runtime-DyiINK0N.js";import{n as r,p as i}from"./DocumentContext-DN3M8p0h.js";import{t as a}from"./react-JNybMug3.js";import{t as o}from"./react-dom-Db7zF7dM.js";import{t as s}from"./compiler-runtime-dQcBxOhn.js";import{I as c,et as l,st as u}from"./CodeMirrorPropInput-Sjp30pzp.js";import{Ai as d,Hi as f,Ji as p,K as m,Qi as h,Ui as g,Xr as _,_i as v,ea as y,ia as b,na as x,qi as S,ra as C}from"./dist-CDKZLcnD.js";import{t as ee}from"./libesm-BUX1Jc4h.js";var w=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.unescapeToken=t,e.escapeToken=n;function t(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function n(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.Pointer=function(){function e(e){e===void 0&&(e=[``]),this.tokens=e}return e.fromJSON=function(n){var r=n.split(`/`).map(t);if(r[0]!==``)throw Error(`Invalid JSON Pointer: ${n}`);return new e(r)},e.prototype.toString=function(){return this.tokens.map(n).join(`/`)},e.prototype.evaluate=function(e){for(var t=null,n=``,r=e,i=1,a=this.tokens.length;i<a;i++)t=r,n=this.tokens[i],!(n==`__proto__`||n==`constructor`||n==`prototype`)&&(r=(t||{})[n]);return{parent:t,key:n,value:r}},e.prototype.get=function(e){return this.evaluate(e).value},e.prototype.set=function(e,t){var n=this.evaluate(e);n.parent&&(n.parent[n.key]=t)},e.prototype.push=function(e){this.tokens.push(e)},e.prototype.add=function(t){return new e(this.tokens.concat(String(t)))},e.prototype.parent=function(){return new e(this.tokens.length>1?this.tokens.slice(0,-1):[``])},e}()})),T=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hasOwnProperty=void 0,e.objectType=t,e.clone=r,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(e){return e===void 0?`undefined`:e===null?`null`:Array.isArray(e)?`array`:typeof e}function n(e){return typeof e==`object`&&!!e}function r(t){if(!n(t))return t;if(t.constructor==Array){for(var i=t.length,a=Array(i),o=0;o<i;o++)a[o]=r(t[o]);return a}if(t.constructor==Date)return new Date(+t);var s={};for(var c in t)e.hasOwnProperty.call(t,c)&&(s[c]=r(t[c]));return s}})),E=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isDestructive=n,e.subtract=r,e.intersection=i,e.diffArrays=l,e.diffObjects=u,e.diffAny=d;var t=T();function n(e){var t=e.op;return t===`remove`||t===`replace`||t===`copy`||t===`move`}function r(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&!(t.hasOwnProperty.call(n,i)&&n[i]!==void 0)&&r.push(i);return r}function i(e){for(var n=e.length,r={},i=0;i<n;i++){var a=e[i];for(var o in a)t.hasOwnProperty.call(a,o)&&a[o]!==void 0&&(r[o]=(r[o]||0)+1)}for(var o in r)r[o]<n&&delete r[o];return Object.keys(r)}function a(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&t.hasOwnProperty.call(n,i)&&n[i]!==void 0&&r.push(i);return r}function o(e){return e.op===`add`}function s(e){return e.op===`remove`}function c(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function l(e,t,n,r){r===void 0&&(r=d);var i=Math.max(e.length,t.length),a=new Map([[0,{operations:[],cost:0}]]);function l(o,s){var u=o*i+s,d=a.get(u);if(d===void 0){if(o>0&&s>0&&!r(e[o-1],t[s-1],n.add(String(o-1))).length)d=l(o-1,s-1);else{var f=[];if(o>0){var p=l(o-1,s),m={op:`remove`,index:o-1};f.push(c(p,m))}if(s>0){var h=l(o,s-1),g={op:`add`,index:o-1,value:t[s-1]};f.push(c(h,g))}if(o>0&&s>0){var _=l(o-1,s-1),v={op:`replace`,index:o-1,original:e[o-1],value:t[s-1]};f.push(c(_,v))}d=f.sort(function(e,t){return e.cost-t.cost})[0]}a.set(u,d)}return d}var u=isNaN(e.length)||e.length<=0?0:e.length;return l(u,isNaN(t.length)||t.length<=0?0:t.length).operations.reduce(function(e,t){var i=e[0],a=e[1];if(o(t)){var c=t.index+1+a,l=c<u+a?String(c):`-`,d={op:t.op,path:n.add(l).toString(),value:t.value};return[i.concat(d),a+1]}else if(s(t)){var d={op:t.op,path:n.add(String(t.index+a)).toString()};return[i.concat(d),a-1]}else{var f=n.add(String(t.index+a)),p=r(t.original,t.value,f);return[i.concat.apply(i,p),a]}},[[],0])[0]}function u(e,t,n,i){i===void 0&&(i=d);var o=[];return r(e,t).forEach(function(e){o.push({op:`remove`,path:n.add(e).toString()})}),r(t,e).forEach(function(e){o.push({op:`add`,path:n.add(e).toString(),value:t[e]})}),a(e,t).forEach(function(r){o.push.apply(o,i(e[r],t[r],n.add(r)))}),o}function d(e,n,r,i){if(i===void 0&&(i=d),e===n)return[];var a=(0,t.objectType)(e),o=(0,t.objectType)(n);return a==`array`&&o==`array`?l(e,n,r,i):a==`object`&&o==`object`?u(e,n,r,i):[{op:`replace`,path:r.toString(),value:n}]}})),te=t((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.InvalidOperationError=e.TestError=e.MissingError=void 0,e.add=l,e.remove=u,e.replace=d,e.move=f,e.copy=p,e.test=m,e.apply=g;var n=w(),r=T(),i=E(),a=function(e){t(n,e);function n(t){var n=e.call(this,`Value required at path: ${t}`)||this;return n.path=t,n.name=`MissingError`,n}return n}(Error);e.MissingError=a;var o=function(e){t(n,e);function n(t,n){var r=e.call(this,`Test failed: ${t} != ${n}`)||this;return r.actual=t,r.expected=n,r.name=`TestError`,r}return n}(Error);e.TestError=o;function s(e,t,n){if(Array.isArray(e))if(t==`-`)e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function c(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function l(e,t,i){var o=n.Pointer.fromJSON(t.path);if(i?.implicitArrayCreation&&o.tokens[o.tokens.length-1]===`-`){var c=o.parent().evaluate(e);c.value===void 0&&(0,r.objectType)(c.parent)===`object`&&(c.parent[c.key]=[])}var l=o.evaluate(e);return l.parent===void 0||i?.implicitArrayCreation&&l.key===`-`&&!Array.isArray(l.parent)?new a(t.path):(s(l.parent,l.key,(0,r.clone)(t.value)),null)}function u(e,t,r){var i=n.Pointer.fromJSON(t.path).evaluate(e);return i.value===void 0?new a(t.path):(c(i.parent,i.key),null)}function d(e,t,i){var o=n.Pointer.fromJSON(t.path).evaluate(e);if(o.parent===null)return new a(t.path);if(Array.isArray(o.parent)){if(parseInt(o.key,10)>=o.parent.length)return new a(t.path)}else if(o.value===void 0)return new a(t.path);return o.parent[o.key]=(0,r.clone)(t.value),null}function f(e,t,r){var i=n.Pointer.fromJSON(t.from).evaluate(e);if(i.value===void 0)return new a(t.from);var o=n.Pointer.fromJSON(t.path).evaluate(e);return o.parent===void 0?new a(t.path):(c(i.parent,i.key),s(o.parent,o.key,i.value),null)}function p(e,t,i){var o=n.Pointer.fromJSON(t.from).evaluate(e);if(o.value===void 0)return new a(t.from);var c=n.Pointer.fromJSON(t.path).evaluate(e);return c.parent===void 0?new a(t.path):(s(c.parent,c.key,(0,r.clone)(o.value)),null)}function m(e,t,r){var a=n.Pointer.fromJSON(t.path).evaluate(e);return(0,i.diffAny)(a.value,t.value,new n.Pointer).length?new o(a.value,t.value):null}var h=function(e){t(n,e);function n(t){var n=e.call(this,`Invalid operation: ${t.op}`)||this;return n.operation=t,n.name=`InvalidOperationError`,n}return n}(Error);e.InvalidOperationError=h;function g(e,t,n){switch(t.op){case`add`:return l(e,t,n);case`remove`:return u(e,t,n);case`replace`:return d(e,t,n);case`move`:return f(e,t,n);case`copy`:return p(e,t,n);case`test`:return m(e,t,n)}return new h(t)}})),ne=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=w();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=te(),r=E();function i(e,t,r){return t.map(function(t){return(0,n.apply)(e,t,r)})}function a(e){function t(n,i,a){var o=e(n,i,a);return Array.isArray(o)?o:(0,r.diffAny)(n,i,a,t)}return t}function o(e,n,i){var o=new t.Pointer;return(i?a(i):r.diffAny)(e,n,o)}})),D=e(a(),1),re=e(o(),1),O=s(),k=ne();function A(){}A.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_){f[n]=void 0;continue}if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(ie(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function ie(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}var j=new A;function ae(e,t,n){return j.diff(e,t,n)}var M=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,N=/\S/,P=new A;P.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!N.test(e)&&!N.test(t)},P.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&M.test(t[n])&&M.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function oe(e,t,n){return P.diff(e,t,n)}var F=new A;F.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
1
+ import{i as e,t}from"./chunk-DseTPa7n.js";import{t as n}from"./jsx-runtime-DyiINK0N.js";import{n as r,p as i}from"./DocumentContext-4RBN9Oik.js";import{t as a}from"./react-JNybMug3.js";import{t as o}from"./react-dom-Db7zF7dM.js";import{t as s}from"./compiler-runtime-dQcBxOhn.js";import{I as c,et as l,st as u}from"./CodeMirrorPropInput-Sjp30pzp.js";import{Ai as d,Hi as f,Ji as p,K as m,Qi as h,Ui as g,Xr as _,_i as v,ea as y,ia as b,na as x,qi as S,ra as C}from"./dist-CDKZLcnD.js";import{t as ee}from"./libesm-BUX1Jc4h.js";var w=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.unescapeToken=t,e.escapeToken=n;function t(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function n(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.Pointer=function(){function e(e){e===void 0&&(e=[``]),this.tokens=e}return e.fromJSON=function(n){var r=n.split(`/`).map(t);if(r[0]!==``)throw Error(`Invalid JSON Pointer: ${n}`);return new e(r)},e.prototype.toString=function(){return this.tokens.map(n).join(`/`)},e.prototype.evaluate=function(e){for(var t=null,n=``,r=e,i=1,a=this.tokens.length;i<a;i++)t=r,n=this.tokens[i],!(n==`__proto__`||n==`constructor`||n==`prototype`)&&(r=(t||{})[n]);return{parent:t,key:n,value:r}},e.prototype.get=function(e){return this.evaluate(e).value},e.prototype.set=function(e,t){var n=this.evaluate(e);n.parent&&(n.parent[n.key]=t)},e.prototype.push=function(e){this.tokens.push(e)},e.prototype.add=function(t){return new e(this.tokens.concat(String(t)))},e.prototype.parent=function(){return new e(this.tokens.length>1?this.tokens.slice(0,-1):[``])},e}()})),T=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hasOwnProperty=void 0,e.objectType=t,e.clone=r,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(e){return e===void 0?`undefined`:e===null?`null`:Array.isArray(e)?`array`:typeof e}function n(e){return typeof e==`object`&&!!e}function r(t){if(!n(t))return t;if(t.constructor==Array){for(var i=t.length,a=Array(i),o=0;o<i;o++)a[o]=r(t[o]);return a}if(t.constructor==Date)return new Date(+t);var s={};for(var c in t)e.hasOwnProperty.call(t,c)&&(s[c]=r(t[c]));return s}})),E=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isDestructive=n,e.subtract=r,e.intersection=i,e.diffArrays=l,e.diffObjects=u,e.diffAny=d;var t=T();function n(e){var t=e.op;return t===`remove`||t===`replace`||t===`copy`||t===`move`}function r(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&!(t.hasOwnProperty.call(n,i)&&n[i]!==void 0)&&r.push(i);return r}function i(e){for(var n=e.length,r={},i=0;i<n;i++){var a=e[i];for(var o in a)t.hasOwnProperty.call(a,o)&&a[o]!==void 0&&(r[o]=(r[o]||0)+1)}for(var o in r)r[o]<n&&delete r[o];return Object.keys(r)}function a(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&t.hasOwnProperty.call(n,i)&&n[i]!==void 0&&r.push(i);return r}function o(e){return e.op===`add`}function s(e){return e.op===`remove`}function c(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function l(e,t,n,r){r===void 0&&(r=d);var i=Math.max(e.length,t.length),a=new Map([[0,{operations:[],cost:0}]]);function l(o,s){var u=o*i+s,d=a.get(u);if(d===void 0){if(o>0&&s>0&&!r(e[o-1],t[s-1],n.add(String(o-1))).length)d=l(o-1,s-1);else{var f=[];if(o>0){var p=l(o-1,s),m={op:`remove`,index:o-1};f.push(c(p,m))}if(s>0){var h=l(o,s-1),g={op:`add`,index:o-1,value:t[s-1]};f.push(c(h,g))}if(o>0&&s>0){var _=l(o-1,s-1),v={op:`replace`,index:o-1,original:e[o-1],value:t[s-1]};f.push(c(_,v))}d=f.sort(function(e,t){return e.cost-t.cost})[0]}a.set(u,d)}return d}var u=isNaN(e.length)||e.length<=0?0:e.length;return l(u,isNaN(t.length)||t.length<=0?0:t.length).operations.reduce(function(e,t){var i=e[0],a=e[1];if(o(t)){var c=t.index+1+a,l=c<u+a?String(c):`-`,d={op:t.op,path:n.add(l).toString(),value:t.value};return[i.concat(d),a+1]}else if(s(t)){var d={op:t.op,path:n.add(String(t.index+a)).toString()};return[i.concat(d),a-1]}else{var f=n.add(String(t.index+a)),p=r(t.original,t.value,f);return[i.concat.apply(i,p),a]}},[[],0])[0]}function u(e,t,n,i){i===void 0&&(i=d);var o=[];return r(e,t).forEach(function(e){o.push({op:`remove`,path:n.add(e).toString()})}),r(t,e).forEach(function(e){o.push({op:`add`,path:n.add(e).toString(),value:t[e]})}),a(e,t).forEach(function(r){o.push.apply(o,i(e[r],t[r],n.add(r)))}),o}function d(e,n,r,i){if(i===void 0&&(i=d),e===n)return[];var a=(0,t.objectType)(e),o=(0,t.objectType)(n);return a==`array`&&o==`array`?l(e,n,r,i):a==`object`&&o==`object`?u(e,n,r,i):[{op:`replace`,path:r.toString(),value:n}]}})),te=t((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.InvalidOperationError=e.TestError=e.MissingError=void 0,e.add=l,e.remove=u,e.replace=d,e.move=f,e.copy=p,e.test=m,e.apply=g;var n=w(),r=T(),i=E(),a=function(e){t(n,e);function n(t){var n=e.call(this,`Value required at path: ${t}`)||this;return n.path=t,n.name=`MissingError`,n}return n}(Error);e.MissingError=a;var o=function(e){t(n,e);function n(t,n){var r=e.call(this,`Test failed: ${t} != ${n}`)||this;return r.actual=t,r.expected=n,r.name=`TestError`,r}return n}(Error);e.TestError=o;function s(e,t,n){if(Array.isArray(e))if(t==`-`)e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function c(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function l(e,t,i){var o=n.Pointer.fromJSON(t.path);if(i?.implicitArrayCreation&&o.tokens[o.tokens.length-1]===`-`){var c=o.parent().evaluate(e);c.value===void 0&&(0,r.objectType)(c.parent)===`object`&&(c.parent[c.key]=[])}var l=o.evaluate(e);return l.parent===void 0||i?.implicitArrayCreation&&l.key===`-`&&!Array.isArray(l.parent)?new a(t.path):(s(l.parent,l.key,(0,r.clone)(t.value)),null)}function u(e,t,r){var i=n.Pointer.fromJSON(t.path).evaluate(e);return i.value===void 0?new a(t.path):(c(i.parent,i.key),null)}function d(e,t,i){var o=n.Pointer.fromJSON(t.path).evaluate(e);if(o.parent===null)return new a(t.path);if(Array.isArray(o.parent)){if(parseInt(o.key,10)>=o.parent.length)return new a(t.path)}else if(o.value===void 0)return new a(t.path);return o.parent[o.key]=(0,r.clone)(t.value),null}function f(e,t,r){var i=n.Pointer.fromJSON(t.from).evaluate(e);if(i.value===void 0)return new a(t.from);var o=n.Pointer.fromJSON(t.path).evaluate(e);return o.parent===void 0?new a(t.path):(c(i.parent,i.key),s(o.parent,o.key,i.value),null)}function p(e,t,i){var o=n.Pointer.fromJSON(t.from).evaluate(e);if(o.value===void 0)return new a(t.from);var c=n.Pointer.fromJSON(t.path).evaluate(e);return c.parent===void 0?new a(t.path):(s(c.parent,c.key,(0,r.clone)(o.value)),null)}function m(e,t,r){var a=n.Pointer.fromJSON(t.path).evaluate(e);return(0,i.diffAny)(a.value,t.value,new n.Pointer).length?new o(a.value,t.value):null}var h=function(e){t(n,e);function n(t){var n=e.call(this,`Invalid operation: ${t.op}`)||this;return n.operation=t,n.name=`InvalidOperationError`,n}return n}(Error);e.InvalidOperationError=h;function g(e,t,n){switch(t.op){case`add`:return l(e,t,n);case`remove`:return u(e,t,n);case`replace`:return d(e,t,n);case`move`:return f(e,t,n);case`copy`:return p(e,t,n);case`test`:return m(e,t,n)}return new h(t)}})),ne=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=w();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=te(),r=E();function i(e,t,r){return t.map(function(t){return(0,n.apply)(e,t,r)})}function a(e){function t(n,i,a){var o=e(n,i,a);return Array.isArray(o)?o:(0,r.diffAny)(n,i,a,t)}return t}function o(e,n,i){var o=new t.Pointer;return(i?a(i):r.diffAny)(e,n,o)}})),D=e(a(),1),re=e(o(),1),O=s(),k=ne();function A(){}A.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_){f[n]=void 0;continue}if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(ie(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function ie(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}var j=new A;function ae(e,t,n){return j.diff(e,t,n)}var M=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,N=/\S/,P=new A;P.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!N.test(e)&&!N.test(t)},P.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&M.test(t[n])&&M.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function oe(e,t,n){return P.diff(e,t,n)}var F=new A;F.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
2
2
  `));var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r<n.length;r++){var i=n[r];r%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};var I=new A;I.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var se=new A;se.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function L(e){"@babel/helpers - typeof";return L=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},L(e)}var ce=Object.prototype.toString,R=new A;R.useLongestToken=!0,R.tokenize=F.tokenize,R.castInput=function(e){var t=this.options,n=t.undefinedReplacement,r=t.stringifyReplacer,i=r===void 0?function(e,t){return t===void 0?n:t}:r;return typeof e==`string`?e:JSON.stringify(z(e,null,null,i),i,` `)},R.equals=function(e,t){return A.prototype.equals.call(R,e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`))};function z(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i,e));var a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];var o;if(ce.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=z(e[a],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),L(e)===`object`&&e!==null){t.push(e),o={},n.push(o);var s=[],c;for(c in e)e.hasOwnProperty(c)&&s.push(c);for(s.sort(),a=0;a<s.length;a+=1)c=s[a],o[c]=z(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var B=new A;B.tokenize=function(e){return e.slice()},B.join=B.removeEmpty=function(e){return e};function V(e,t){let n=t.content.findDiffStart(e.content);if(n===null)return!1;let{a:r,b:i}=t.content.findDiffEnd(e.content),a=n-Math.min(r,i);return a>0&&(e.resolve(n-a).depth<t.resolve(r+a).depth?n-=a:(r+=a,i+=a)),new x(n,i,t.slice(n,r))}function le(e){if(!e.steps.length)return;let t=new C(e.docs[0]),n=e.steps.slice();for(;n.length;){let e=n.shift();for(;n.length&&e.merge(n[0]);){let r=n.shift();e=e instanceof x&&r instanceof x?V(t.doc,r.apply(e.apply(t.doc).doc).doc):e.merge(r)}t.step(e)}return t}function H(e){let t=new C(e);return t.removeMark(0,e.nodeSize-2),t.doc}function U(e,t){let n=t.split(`/`);for(n.shift();n.length;){if(typeof e!=`object`)throw Error();let t=n.shift();e=e[t]}return e}function W(e){return JSON.parse(JSON.stringify(e))}var ue=class{fromDoc;toDoc;complexSteps;wordDiffs;simplifyDiff;schema;tr;currentJSON;finalJSON;ops;constructor(e,t,n={}){let r={complexSteps:!0,wordDiffs:!1,simplifyDiff:!0,...n};this.fromDoc=e,this.toDoc=t,this.complexSteps=r.complexSteps,this.wordDiffs=r.wordDiffs,this.simplifyDiff=r.simplifyDiff,this.schema=e.type.schema,this.tr=new C(e),this.currentJSON={},this.finalJSON={},this.ops=[]}init(){return this.complexSteps?(this.currentJSON=H(this.fromDoc).toJSON(),this.finalJSON=H(this.toDoc).toJSON(),this.ops=(0,k.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps(),this.recreateChangeMarkSteps()):(this.currentJSON=this.fromDoc.toJSON(),this.finalJSON=this.toDoc.toJSON(),this.ops=(0,k.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps()),this.simplifyDiff&&(this.tr=le(this.tr)||this.tr),this.tr}recreateChangeContentSteps(){let e=[];for(;this.ops.length;){let t=this.ops.shift();e.push(t);let n,r=W(this.currentJSON),i=t.path.split(`/`);for(;n==null;){(0,k.applyPatch)(r,[t]);try{n=this.schema.nodeFromJSON(r),n.check()}catch{if(n=null,this.ops.length>0)t=this.ops.shift(),e.push(t);else throw Error(`No valid diff possible applying ${t.path}`)}}this.complexSteps&&e.length===1&&(i.includes(`attrs`)||i.includes(`type`))?(this.addSetNodeMarkup(),e=[]):e.length===1&&t.op===`replace`&&i[i.length-1]===`text`?(this.addReplaceTextSteps(t,r),e=[]):this.addReplaceStep(n,r)&&(e=[])}}addSetNodeMarkup(){let e=this.schema.nodeFromJSON(this.currentJSON),t=this.schema.nodeFromJSON(this.finalJSON),n=t.content.findDiffStart(e.content),r=e.nodeAt(n),i=t.nodeAt(n);if(n!=null){let e=r.type===i.type?null:i.type;try{this.tr.setNodeMarkup(n,e,i.attrs,i.marks)}catch(t){if(e&&t.message.includes(`Invalid content`))this.tr.replaceWith(n,n+r.nodeSize,i);else throw t}return this.currentJSON=H(this.tr.doc).toJSON(),this.ops=(0,k.createPatch)(this.currentJSON,this.finalJSON),!0}return!1}recreateChangeMarkSteps(){this.toDoc.descendants((e,t)=>{if(!e.isInline)return!0;this.tr.doc.nodesBetween(t,t+e.nodeSize,(n,r)=>{if(!n.isInline)return!0;let i=Math.max(t,r),a=Math.min(t+e.nodeSize,r+n.nodeSize);n.marks.forEach(t=>{t.isInSet(e.marks)||this.tr.removeMark(i,a,t)}),e.marks.forEach(e=>{e.isInSet(n.marks)||this.tr.addMark(i,a,e)})})})}addReplaceStep(e,t){let n=V(this.schema.nodeFromJSON(this.currentJSON),e);if(!n)return!1;if(!this.tr.maybeStep(n).failed)return this.currentJSON=t,!0;throw Error(`No valid step found.`)}addReplaceTextSteps(e,t){let n={...e,value:`xx`},r={...e,value:`yy`},i=W(this.currentJSON),a=W(this.currentJSON);(0,k.applyPatch)(i,[n]),(0,k.applyPatch)(a,[r]);let o=this.schema.nodeFromJSON(i),s=this.schema.nodeFromJSON(a),c=e.value,l=U(this.currentJSON,e.path),u=this.wordDiffs?oe(l,c):ae(l,c),d=o.content.findDiffStart(s.content),f=o.resolve(d+1).marks();for(;u.length;){let e=u.shift();if(e.added){let t=this.schema.nodeFromJSON({type:`text`,text:e.value}).mark(f);if(u.length&&u[0].removed){let e=u.shift();this.tr.replaceWith(d,d+e.value.length,t)}else this.tr.insert(d,t);d+=e.value.length}else if(e.removed)if(u.length&&u[0].added){let t=u.shift(),n=this.schema.nodeFromJSON({type:`text`,text:t.value}).mark(f);this.tr.replaceWith(d,d+e.value.length,n),d+=t.value.length}else this.tr.delete(d,d+e.value.length);else d+=e.value.length}this.currentJSON=t}};function de(e,t,n={}){return new ue(e,t,n).init()}var G=new Set([`list`,`bulletList`,`orderedList`,`taskList`]);function K(e){let t=[];return e.forEach((e,n)=>{if(G.has(e.type.name)){let r=n+1,i=0;e.forEach(e=>{let n=r+i;t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`}),i+=e.nodeSize})}else t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`})}),t}function fe(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=n-1;a>=0;a--)for(let n=r-1;n>=0;n--)i[a][n]=e[a].key===t[n].key?i[a+1][n+1]+1:Math.max(i[a+1][n],i[a][n+1]);let a=[],o=0,s=0;for(;o<n&&s<r;)e[o].key===t[s].key?(a.push({type:`same`,b:t[s]}),o++,s++):i[o+1][s]>=i[o][s+1]?(a.push({type:`del`,a:e[o]}),o++):(a.push({type:`ins`,b:t[s]}),s++);for(;o<n;)a.push({type:`del`,a:e[o++]});for(;s<r;)a.push({type:`ins`,b:t[s++]});return a}function pe(e,t){let n=fe(K(e),K(t)),r=[],i=0;for(let e of n)e.type===`same`?i=e.b.to:e.type===`ins`?(r.push({fromA:0,toA:0,fromB:e.b.from,toB:e.b.to}),i=e.b.to):r.push({fromA:e.a.from,toA:e.a.to,fromB:i,toB:i});return r}var me=400;function q(e,t,n){return t.nodeFromJSON(e.parseWithFallback(n))}function he(e,t){let n=t.filter(e=>e.toB>e.fromB),r=[];return e.steps.forEach((t,i)=>{let a=t instanceof h?`add`:t instanceof y?`remove`:null;if(a===null)return;let o=t,s=e.mapping.slice(i+1),c=s.map(o.from,-1),l=s.map(o.to,1);if(l<=c||n.some(e=>e.fromB<=c&&l<=e.toB))return;let u=e.mapping.slice(0,i).invert(),d=u.map(o.from),f=u.map(o.to);f<=d||r.push({fromA:d,toA:f,fromB:c,toB:l,markName:o.mark.type.name,kind:a})}),r}function ge(e,t,n,r){if(e.length>2e5||t.length>2e5)return{ok:!1,reason:`ceiling`};let i,a;try{i=q(r,n,e),a=q(r,n,t)}catch{return{ok:!1,reason:`parse`}}let o=a,s=null;try{s=de(i,a,{complexSteps:!0,wordDiffs:!0,simplifyDiff:!0}),o=s.doc}catch{}let c=pe(i,o),l=s?he(s,c):[];return c.length+l.length>me?{ok:!1,reason:`ceiling`}:{ok:!0,afterDoc:o,beforeDoc:i,changes:c,markChanges:l}}var _e=`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`;function ve(e){return e.changes.length+2*e.markChanges.length}function J(e){let t=!1;return e.forEach(e=>{e.isBlock&&(t=!0)}),t}function ye(e){if(e.childCount===0)return!1;let t=!0;return e.forEach(e=>{e.type.name!==`listItem`&&e.type.name!==`taskItem`&&(t=!1)}),t}function Y(e,t,n){let r=document.createElement(n?`div`:`span`);r.className=n?`ok-diff-del ok-diff-del-block`:`ok-diff-del`,r.setAttribute(`data-diff-deleted`,``);let i=e.serializeFragment(t);if(n&&ye(t)){let e=document.createElement(`ul`);e.appendChild(i),r.appendChild(e)}else r.appendChild(i);return r}function be(e,t,n,r,i){let a=b.fromSchema(i),o=[];for(let e of r){let n=t.slice(e.fromA,e.toA),r=J(n.content);o.push(f.widget(e.fromB,()=>Y(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]})),o.push(f.inline(e.fromB,e.toB,{class:`ok-diff-ins`},{inclusiveEnd:!0}))}for(let e of n)if(e.toB>e.fromB&&o.push(f.node(e.fromB,e.toB,{class:`ok-diff-ins-block`})),e.toA>e.fromA){let n=t.slice(e.fromA,e.toA),r=J(n.content);o.push(f.widget(e.fromB,()=>Y(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]}))}return g.create(e,o)}var xe=new Set([`slashCommand`,`blockDragHandle`,`blockMover`,`tableInsertControls`,`fileHandler`,`gfmAutolink`,`inlineLinkInputRule`,`keyboardNav`,`tiptapFindReplace`,`selectionState`,`sourceDirtyObserver`,`tabFocusTrap`]),X=i.filter(e=>!xe.has(e.name)).map(e=>e.name===`jsxComponent`?m:e),Z=n(),Q=d(X);function Se(e,t){return ge(e,t,Q,c())}var Ce=v.create({name:`renderedDiffDecorations`,addOptions(){return{decorations:g.empty}},addProseMirrorPlugins(){let e=this.options.decorations;return[new S({key:new p(`renderedDiffDecorations`),props:{decorations:()=>e}})]}});function we(e){let t=(0,O.c)(31),{diff:n}=e,r,i,a,o;if(t[0]!==n.afterDoc||t[1]!==n.beforeDoc||t[2]!==n.changes||t[3]!==n.markChanges){let e=be(n.afterDoc,n.beforeDoc,n.changes,n.markChanges,Q);o=u,a=!1,r=X,i=Ce.configure({decorations:e}),t[0]=n.afterDoc,t[1]=n.beforeDoc,t[2]=n.changes,t[3]=n.markChanges,t[4]=r,t[5]=i,t[6]=a,t[7]=o}else r=t[4],i=t[5],a=t[6],o=t[7];let s;t[8]!==r||t[9]!==i?(s=[...r,i],t[8]=r,t[9]=i,t[10]=s):s=t[10];let c;t[11]===n.afterDoc?c=t[12]:(c=n.afterDoc.toJSON(),t[11]=n.afterDoc,t[12]=c);let d;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(d={attributes:{class:`pt-4`}},t[13]=d):d=t[13];let f;t[14]!==a||t[15]!==s||t[16]!==c?(f={editable:a,extensions:s,content:c,editorProps:d},t[14]=a,t[15]=s,t[16]=c,t[17]=f):f=t[17];let p;t[18]===n?p=t[19]:(p=[n],t[18]=n,t[19]=p);let m=o(f,p),[h]=(0,D.useState)(Te),g=(0,D.useRef)(null),_,v;t[20]===h?(_=t[21],v=t[22]):(_=()=>{let e=g.current;if(e)return e.appendChild(h),()=>{h.parentNode===e&&e.removeChild(h)}},v=[h],t[20]=h,t[21]=_,t[22]=v),(0,D.useLayoutEffect)(_,v);let y;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:g,style:{display:`contents`}})}),t[23]=y):y=t[23];let b;t[24]===m?b=t[25]:(b=(0,Z.jsx)(l,{editor:m,className:`tiptap-editor-portal-content`}),t[24]=m,t[25]=b);let x;t[26]!==h||t[27]!==b?(x=(0,re.createPortal)(b,h),t[26]=h,t[27]=b,t[28]=x):x=t[28];let S;return t[29]===x?S=t[30]:(S=(0,Z.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1`,"data-testid":`rendered-diff-view`,children:[y,x]}),t[29]=x,t[30]=S),S}function Te(){let e=document.createElement(`div`);return e.style.display=`contents`,e}function Ee(e){let t=0,n=!1;for(let r of e.split(`
3
3
  `)){let e=r.startsWith(`+`)&&!r.startsWith(`+++`)||r.startsWith(`-`)&&!r.startsWith(`---`);e&&!n&&(t+=1),n=e}return t}function De(e){let t=Array.from(e.querySelectorAll(`.diff-code-insert, .diff-code-delete`)),n=[],r=null;for(let e of t){let t=e.closest(`tr`);t&&((r===null||t.previousElementSibling!==r)&&n.push(e),r=t)}return n}function $(e){let t=0,n=0;for(let r of e.split(`
4
4
  `))r.startsWith(`+`)&&!r.startsWith(`+++`)?t++:r.startsWith(`-`)&&!r.startsWith(`---`)&&n++;return{additions:t,deletions:n}}function Oe(e,t){return`${e}\u0000${t}`}function ke(e,t,n){let r=_(e).body,i=_(t).body;return r===i?``:ee(n,r,i,``,``,{context:Math.max(r.split(`
@@ -58,7 +58,7 @@
58
58
  -->
59
59
  <script>(() => { let t = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (r === 'light' || r === 'dark' || r === 'system') t = r; } catch {} let ct = null; try { const c = localStorage.getItem('ok-color-theme-v1'); if (c && ['dracula', 'catppuccin-frappe', 'catppuccin-latte', 'monokai', 'gruvbox', 'solarized', 'custom'].includes(c)) ct = c; } catch {} let dark = t === 'dark'; if (t === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } let customCss = null; if (ct === 'custom') { try { const raw = localStorage.getItem('ok-custom-theme-v1'); if (raw) { const o = JSON.parse(raw); if (o?.css) { customCss = o.css; dark = !!o.dark; } } } catch {} if (!customCss) ct = null; } else if (ct) { dark = !['catppuccin-latte'].includes(ct); } if (dark) document.documentElement.classList.add('dark'); if (ct) document.documentElement.setAttribute('data-color-theme', ct); if (customCss) { const s = document.createElement('style'); s.id = 'ok-custom-theme'; s.textContent = customCss; document.head.appendChild(s); } if (window.okDesktop) { document.documentElement.classList.add('electron-mode'); document.documentElement.classList.add(`electron-platform-${window.okDesktop.platform}`); } })();</script>
60
60
  <style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
61
- <script type="module" crossorigin src="./assets/index-Lsv_5pDn.js"></script>
61
+ <script type="module" crossorigin src="./assets/index-Q9MYvDYY.js"></script>
62
62
  <link rel="modulepreload" crossorigin href="./assets/chunk-DseTPa7n.js">
63
63
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-2ej06EnG.js">
64
64
  <link rel="modulepreload" crossorigin href="./assets/w3c-keyname-Daddi42S.js">
@@ -116,13 +116,13 @@
116
116
  <link rel="modulepreload" crossorigin href="./assets/check-D3jznJmG.js">
117
117
  <link rel="modulepreload" crossorigin href="./assets/chevron-down-0vl-mPeL.js">
118
118
  <link rel="modulepreload" crossorigin href="./assets/chevron-right-zaL9JagC.js">
119
- <link rel="modulepreload" crossorigin href="./assets/copy-Dwat-rG5.js">
120
- <link rel="modulepreload" crossorigin href="./assets/CopyButton-D0gTyMvW.js">
119
+ <link rel="modulepreload" crossorigin href="./assets/copy-DmfcimOx.js">
120
+ <link rel="modulepreload" crossorigin href="./assets/CopyButton-Cbumgow3.js">
121
121
  <link rel="modulepreload" crossorigin href="./assets/documents-events-DNDUkpJM.js">
122
122
  <link rel="modulepreload" crossorigin href="./assets/parse-api-error-DucXvNZh.js">
123
123
  <link rel="modulepreload" crossorigin href="./assets/startup-marks-CytO17UM.js">
124
124
  <link rel="modulepreload" crossorigin href="./assets/prop-types-IOhQSrD8.js">
125
- <link rel="modulepreload" crossorigin href="./assets/workspace-paths-CDfRQ5qH.js">
125
+ <link rel="modulepreload" crossorigin href="./assets/workspace-paths-BKmDPpqj.js">
126
126
  <link rel="modulepreload" crossorigin href="./assets/eye-CmnH89UE.js">
127
127
  <link rel="modulepreload" crossorigin href="./assets/info-DV3bzhzI.js">
128
128
  <link rel="modulepreload" crossorigin href="./assets/loader-circle-K7Xwpjny.js">
@@ -133,50 +133,50 @@
133
133
  <link rel="modulepreload" crossorigin href="./assets/badge-BDZGi1Ks.js">
134
134
  <link rel="modulepreload" crossorigin href="./assets/input-CsXmpyZP.js">
135
135
  <link rel="modulepreload" crossorigin href="./assets/use-collab-url-Cf1srbbW.js">
136
- <link rel="modulepreload" crossorigin href="./assets/DocumentContext-DN3M8p0h.js">
136
+ <link rel="modulepreload" crossorigin href="./assets/DocumentContext-4RBN9Oik.js">
137
137
  <link rel="modulepreload" crossorigin href="./assets/checkbox-Cn88M3G6.js">
138
138
  <link rel="modulepreload" crossorigin href="./assets/dist-BJxDYUHt.js">
139
139
  <link rel="modulepreload" crossorigin href="./assets/dist-Cx2QCt5k.js">
140
140
  <link rel="modulepreload" crossorigin href="./assets/dropdown-menu-CcKe8PiU.js">
141
141
  <link rel="modulepreload" crossorigin href="./assets/label-bn6BDr7p.js">
142
142
  <link rel="modulepreload" crossorigin href="./assets/radio-group-DW_ypmKx.js">
143
+ <link rel="modulepreload" crossorigin href="./assets/separator-Cvkbg_YK.js">
144
+ <link rel="modulepreload" crossorigin href="./assets/toggle-group-CxrQL99E.js">
145
+ <link rel="modulepreload" crossorigin href="./assets/useQuery-NsPxD6kI.js">
146
+ <link rel="modulepreload" crossorigin href="./assets/format-Dn5VT_ew.js">
147
+ <link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-DokRsPIe.js">
148
+ <link rel="modulepreload" crossorigin href="./assets/selection-context-DOeF93Po.js">
149
+ <link rel="modulepreload" crossorigin href="./assets/PropertyPanel-BwdCsrPn.js">
143
150
  <link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-CbuJxerH.js">
144
151
  <link rel="modulepreload" crossorigin href="./assets/arrow-up-right-BKliW282.js">
152
+ <link rel="modulepreload" crossorigin href="./assets/miss-dialog-store-81J1GwFD.js">
153
+ <link rel="modulepreload" crossorigin href="./assets/refresh-cw-DSH9Of_0.js">
154
+ <link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-DYgvjLiq.js">
145
155
  <link rel="modulepreload" crossorigin href="./assets/cursor-AolWKuZw.js">
146
156
  <link rel="modulepreload" crossorigin href="./assets/RegisteredAgentIcon--E1135hW.js">
147
- <link rel="modulepreload" crossorigin href="./assets/refresh-cw-DSH9Of_0.js">
157
+ <link rel="modulepreload" crossorigin href="./assets/chevron-left-fiDaD9J4.js">
148
158
  <link rel="modulepreload" crossorigin href="./assets/copilot-Be7YOjJF.js">
149
159
  <link rel="modulepreload" crossorigin href="./assets/keyboard-shortcuts-maIyJzSw.js">
150
160
  <link rel="modulepreload" crossorigin href="./assets/agent-visibility-BUmsS0vL.js">
151
161
  <link rel="modulepreload" crossorigin href="./assets/clipboard-adapter-BGIXxhKQ.js">
152
162
  <link rel="modulepreload" crossorigin href="./assets/skills-api-CGbwE9vp.js">
153
163
  <link rel="modulepreload" crossorigin href="./assets/use-workspace-C1D_I03G.js">
154
- <link rel="modulepreload" crossorigin href="./assets/skill-actions-CzuWC1X5.js">
155
- <link rel="modulepreload" crossorigin href="./assets/download-wdc_OGNY.js">
156
- <link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-DokRsPIe.js">
164
+ <link rel="modulepreload" crossorigin href="./assets/skill-actions-D9Vn0ymW.js">
157
165
  <link rel="modulepreload" crossorigin href="./assets/skeleton-CA6hvjst.js">
158
166
  <link rel="modulepreload" crossorigin href="./assets/textarea-DwJR-19i.js">
159
167
  <link rel="modulepreload" crossorigin href="./assets/lint-config-client-C7TVN28Z.js">
160
- <link rel="modulepreload" crossorigin href="./assets/auth-state-cache-CPrBjd7m.js">
161
- <link rel="modulepreload" crossorigin href="./assets/toggle-group-CxrQL99E.js">
162
- <link rel="modulepreload" crossorigin href="./assets/useQuery-NsPxD6kI.js">
163
- <link rel="modulepreload" crossorigin href="./assets/format-Dn5VT_ew.js">
164
- <link rel="modulepreload" crossorigin href="./assets/selection-context-TzGfTWCl.js">
165
- <link rel="modulepreload" crossorigin href="./assets/PropertyPanel-CinI1G1g.js">
166
- <link rel="modulepreload" crossorigin href="./assets/miss-dialog-store-81J1GwFD.js">
167
- <link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-DYgvjLiq.js">
168
- <link rel="modulepreload" crossorigin href="./assets/chevron-left-fiDaD9J4.js">
168
+ <link rel="modulepreload" crossorigin href="./assets/auth-state-cache-DI5ppoto.js">
169
169
  <link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-C2tfnQr1.js">
170
170
  <link rel="modulepreload" crossorigin href="./assets/panel-right-open-CBweAP43.js">
171
- <link rel="modulepreload" crossorigin href="./assets/follow-file-Db721Zx6.js">
171
+ <link rel="modulepreload" crossorigin href="./assets/follow-file-grI1hNx7.js">
172
172
  <link rel="modulepreload" crossorigin href="./assets/timeline-diff-store-dt1fl2gd.js">
173
173
  <link rel="modulepreload" crossorigin href="./assets/form-CTttIps7.js">
174
174
  <link rel="modulepreload" crossorigin href="./assets/wrench-BDWKT3wQ.js">
175
175
  <link rel="modulepreload" crossorigin href="./assets/panel-DLUMbyPl.js">
176
- <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-D-Tl1w8f.js">
176
+ <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-D8mQRP5S.js">
177
177
  <link rel="modulepreload" crossorigin href="./assets/project-paths-DcJ4HDNl.js">
178
178
  <link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-DOr3Nip1.js">
179
- <link rel="modulepreload" crossorigin href="./assets/agent-diff-store-D5yp573E.js">
179
+ <link rel="modulepreload" crossorigin href="./assets/agent-diff-store-BDu-qYpS.js">
180
180
  <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-Beex9QTj.js">
181
181
  <link rel="modulepreload" crossorigin href="./assets/use-live-xterm-theme-BpGfJKio.js">
182
182
  <link rel="modulepreload" crossorigin href="./assets/use-installed-clis-DmVWBoog.js">
@@ -186,7 +186,7 @@
186
186
  <link rel="modulepreload" crossorigin href="./assets/receive-store-BwEPjiP1.js">
187
187
  <link rel="modulepreload" crossorigin href="./assets/worktree-store-1tC864Do.js">
188
188
  <link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
189
- <link rel="stylesheet" crossorigin href="./assets/index-CJ7E0pG6.css">
189
+ <link rel="stylesheet" crossorigin href="./assets/index-DLWWMHtL.css">
190
190
  </head>
191
191
 
192
192
  <body class="antialiased">
@@ -1,2 +1,2 @@
1
- import{t as e}from"./launch-json-removal-DaC6MWYi.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`||o.kind===`removed-file`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
2
- //# sourceMappingURL=repair-launch-json-BDfwi9-9.mjs.map
1
+ import{t as e}from"./launch-json-removal-BfuiPEr_.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`||o.kind===`removed-file`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
2
+ //# sourceMappingURL=repair-launch-json-B_QBIfGY.mjs.map