@inkeep/open-knowledge 0.8.0-beta.2 → 0.8.0-beta.3
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.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +4 -4
- package/dist/constants-VKoRHLJA.mjs +2 -0
- package/dist/{dist-BxVp6JIv.mjs → dist-2MBFtu5K.mjs} +1 -1
- package/dist/{dist-DFP-WbfQ.mjs → dist-BPLmZd1q.mjs} +4 -4
- package/dist/index.mjs +1 -1
- package/dist/{init-bgyN3HLJ.mjs → init-CRoSG2y6.mjs} +4 -4
- package/dist/init-Tv8mSRun.mjs +1 -0
- package/dist/loader-D-TleArK.mjs +1 -0
- package/dist/{loader-D9F5yVlI.mjs → loader-Dw5FfKPU.mjs} +2 -2
- package/dist/preview-BQyNv--I.mjs +1 -0
- package/dist/{preview-DqUI_X4G.mjs → preview-Bi1tKilT.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-CLzCdKdg.js → ActivityModeContent-BW7QsRiP.js} +1 -1
- package/dist/public/assets/{DocumentContext-BfLWnO6s.js → DocumentContext-CmeanKIC.js} +22 -22
- package/dist/public/assets/{GraphPanel-2MS3c4y6.js → GraphPanel-BFaqVg_B.js} +3 -3
- package/dist/public/assets/{SettingsDialogBody-CzUg03U2.js → SettingsDialogBody-CQ2K5eu4.js} +1 -1
- package/dist/public/assets/{SourceEditor-7hCRIAcU.js → SourceEditor-CX33VkOP.js} +1 -1
- package/dist/public/assets/{config-validation-events-DLsmZqhI.js → config-validation-events-DYqTE3X_.js} +1 -1
- package/dist/public/assets/{dist-CsQUs6_U.js → dist-DBy4lTCM.js} +1 -1
- package/dist/public/assets/{dropdown-menu-BN0Skxs2.js → dropdown-menu-CXLGX1-h.js} +1 -1
- package/dist/public/assets/{index-DXjfKeHO.js → index-DDgC3bxb.js} +6 -6
- package/dist/public/assets/{prop-types-QKyZDG8a.js → prop-types-B9tF15NO.js} +2 -2
- package/dist/public/assets/{target-navigation-intent-Cq1y7EPM.js → target-navigation-intent-BJncQo3K.js} +1 -1
- package/dist/public/assets/{toggle-group-WGIvc49e.js → toggle-group-Bn1EVq3y.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-D9L7VXBt.js → typing-burst-detector-CJo4jOvj.js} +1 -1
- package/dist/public/index.html +9 -9
- package/dist/{repair-launch-json-NZrFa4j9.mjs → repair-launch-json-D5DbaOCD.mjs} +2 -2
- package/dist/{repair-mcp-configs-h6zWAU5x.mjs → repair-mcp-configs-DSFRe6WN.mjs} +2 -2
- package/dist/{src-Ddva26mD.mjs → src-DmVkpI35.mjs} +2 -2
- package/dist/{start-BQeItSLM.mjs → start-BoVa175r.mjs} +2 -2
- package/dist/start-D1xZddCO.mjs +1 -0
- package/package.json +1 -1
- package/dist/constants-BdnW1I6_.mjs +0 -2
- package/dist/init-SvT0DYzi.mjs +0 -1
- package/dist/loader-CkywmL6Y.mjs +0 -1
- package/dist/preview-CYfPdASu.mjs +0 -1
- package/dist/start-2Banq22i.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e}from"./prop-types-
|
|
1
|
+
import{m as e}from"./prop-types-B9tF15NO.js";function t(e){switch(e.kind){case`doc`:case`large-file`:return`doc`;case`folder`:case`folder-index`:return`folder`;case`missing`:case`asset`:return`missing`}}function n(n,r){let i=e(n,r);return{resolvedTarget:i,hashDocName:i.target,displayState:t(i)}}export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,o as n,t as r}from"./compiler-runtime-Cs91PcD2.js";import{X as i}from"./prop-types-
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,o as n,t as r}from"./compiler-runtime-Cs91PcD2.js";import{X as i}from"./prop-types-B9tF15NO.js";import{C as a,S as o,d as s,l as c,m as l,p as u,x as d}from"./button-DenIdY-r.js";import{n as f,r as p,t as m}from"./dist-DBy4lTCM.js";var h=a(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),g=e(t(),1),_=n(),v=`Toggle`,y=g.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,u]=c({prop:n,onChange:i,defaultProp:r??!1,caller:v});return(0,_.jsx)(l.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:s(e.onClick,()=>{e.disabled||u(!o)})})});y.displayName=v;var b=y,x=`ToggleGroup`,[S,C]=u(x,[p]),w=p(),T=g.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,_.jsx)(O,{...r,ref:t});if(n===`multiple`)return(0,_.jsx)(k,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${x}\``)});T.displayName=x;var[E,D]=S(x),O=g.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=c({prop:n,defaultProp:r??``,onChange:i,caller:x});return(0,_.jsx)(E,{scope:e.__scopeToggleGroup,type:`single`,value:g.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:g.useCallback(()=>s(``),[s]),children:(0,_.jsx)(M,{...a,ref:t})})}),k=g.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=c({prop:n,defaultProp:r??[],onChange:i,caller:x}),l=g.useCallback(e=>s((t=[])=>[...t,e]),[s]),u=g.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,_.jsx)(E,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:l,onItemDeactivate:u,children:(0,_.jsx)(M,{...a,ref:t})})});T.displayName=x;var[A,j]=S(x),M=g.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:a=!0,orientation:o,dir:s,loop:c=!0,...u}=e,d=w(n),p=i(s),m={role:`group`,dir:p,...u};return(0,_.jsx)(A,{scope:n,rovingFocus:a,disabled:r,children:a?(0,_.jsx)(f,{asChild:!0,...d,orientation:o,dir:p,loop:c,children:(0,_.jsx)(l.div,{...m,ref:t})}):(0,_.jsx)(l.div,{...m,ref:t})})}),N=`ToggleGroupItem`,P=g.forwardRef((e,t)=>{let n=D(N,e.__scopeToggleGroup),r=j(N,e.__scopeToggleGroup),i=w(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=g.useRef(null);return r.rovingFocus?(0,_.jsx)(m,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,_.jsx)(F,{...s,ref:t})}):(0,_.jsx)(F,{...s,ref:t})});P.displayName=N;var F=g.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=D(N,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,_.jsx)(y,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),I=T,L=P,R=r(),z=d(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`,segmented:`text-muted-foreground hover:bg-muted-foreground/10 data-[state=on]:bg-background data-[state=on]:shadow-sm data-[state=on]:text-foreground dark:data-[state=on]:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}});function B(e){let t=(0,R.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let s=i===void 0?`default`:i,c=a===void 0?`default`:a,l;t[5]!==n||t[6]!==c||t[7]!==s?(l=o(z({variant:s,size:c,className:n})),t[5]=n,t[6]=c,t[7]=s,t[8]=l):l=t[8];let u;return t[9]!==r||t[10]!==c||t[11]!==l||t[12]!==s?(u=(0,_.jsx)(b,{"data-slot":`toggle`,"data-variant":s,"data-size":c,className:l,...r}),t[9]=r,t[10]=c,t[11]=l,t[12]=s,t[13]=u):u=t[13],u}var V=g.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function H(e){let t=(0,R.c)(29),n,r,i,a,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],l=t[7]):({className:r,variant:l,size:a,spacing:s,orientation:c,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=l);let u=s===void 0?0:s,d=c===void 0?`horizontal`:c,f;t[8]===u?f=t[9]:(f={"--gap":u},t[8]=u,t[9]=f);let p=f,m;t[10]===r?m=t[11]:(m=o(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,r),t[10]=r,t[11]=m);let h;t[12]!==d||t[13]!==a||t[14]!==u||t[15]!==l?(h={variant:l,size:a,spacing:u,orientation:d},t[12]=d,t[13]=a,t[14]=u,t[15]=l,t[16]=h):h=t[16];let g;t[17]!==n||t[18]!==h?(g=(0,_.jsx)(V.Provider,{value:h,children:n}),t[17]=n,t[18]=h,t[19]=g):g=t[19];let v;return t[20]!==d||t[21]!==i||t[22]!==a||t[23]!==u||t[24]!==p||t[25]!==m||t[26]!==g||t[27]!==l?(v=(0,_.jsx)(I,{"data-slot":`toggle-group`,"data-variant":l,"data-size":a,"data-spacing":u,"data-orientation":d,style:p,className:m,...i,children:g}),t[20]=d,t[21]=i,t[22]=a,t[23]=u,t[24]=p,t[25]=m,t[26]=g,t[27]=l,t[28]=v):v=t[28],v}function U(e){let t=(0,R.c)(19),n,r,i,a,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5]):({className:r,children:n,variant:a,size:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s);let c=a===void 0?`default`:a,l=s===void 0?`default`:s,u=g.use(V),d=u.variant||c,f=u.size||l,p=u.spacing,m;t[6]!==r||t[7]!==u.size||t[8]!==u.variant||t[9]!==l||t[10]!==c?(m=o(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t text-muted-foreground data-[state=on]:text-foreground`,z({variant:u.variant||c,size:u.size||l}),r),t[6]=r,t[7]=u.size,t[8]=u.variant,t[9]=l,t[10]=c,t[11]=m):m=t[11];let h;return t[12]!==n||t[13]!==u.spacing||t[14]!==i||t[15]!==d||t[16]!==f||t[17]!==m?(h=(0,_.jsx)(L,{"data-slot":`toggle-group-item`,"data-variant":d,"data-size":f,"data-spacing":p,className:m,...i,children:n}),t[12]=n,t[13]=u.spacing,t[14]=i,t[15]=d,t[16]=f,t[17]=m,t[18]=h):h=t[18],h}export{h as i,U as n,B as r,H as t};
|
package/dist/public/assets/{typing-burst-detector-D9L7VXBt.js → typing-burst-detector-CJo4jOvj.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,i as n,o as r,r as i,t as a}from"./compiler-runtime-Cs91PcD2.js";import{A as o,Dn as s,O as c,On as l,Sn as u,Tn as d,X as f,k as p,lt as m,n as h,rt as g}from"./DocumentContext-BfLWnO6s.js";import{a as _,c as v,i as y,n as b,o as x,r as S,s as C,t as w,u as ee}from"./panel-BNBODYwB.js";import{$ as T,A as E,An as D,Di as O,Mi as k,On as A,Sn as j,Xt as te,bn as M,et as ne,jn as N,kn as re,qt as P,u as ie,xn as ae,yn as oe}from"./prop-types-QKyZDG8a.js";import{S as se,t as ce}from"./button-DenIdY-r.js";import{x as F}from"./dialog-C1dBa8-m.js";import{i as le}from"./collapsible-BhpeB6tu.js";import{i as I,n as L,t as R}from"./cursor-f-dht0b0.js";import{a as z,c as ue,d as de,i as fe,l as pe,u as me}from"./dropdown-menu-BN0Skxs2.js";import{$ as he,At as ge,Bt as _e,Dt as ve,E as ye,Et as B,Ft as be,Ht as xe,J as V,Mt as Se,N as Ce,Ot as we,Pt as H,Q as Te,Rt as Ee,Ut as De,X as U,_ as Oe,_t as ke,ct as Ae,dt as je,et as Me,f as Ne,gt as Pe,ht as Fe,l as Ie,lt as Le,mt as Re,nt as ze,ot as Be,rt as Ve,st as He,tt as Ue,ut as We,wt as W,y as Ge,yt as G,zt as Ke}from"./dist-DDdDbjlC.js";import{i as qe,n as Je,o as Ye,r as Xe}from"./dist-C7UlNfyl.js";var K=r(),q=e(t(),1),J=a(),Ze=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Conversational pairing in Claude Desktop's Cowork tab.`},{id:`claude-code`,displayName:`Claude`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Agentic coding in Claude Desktop's Code tab.`},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`,tagline:`OpenAI's coding agent, terminal-native.`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`,tagline:`AI-first VS Code fork with multi-file edits.`}],Qe=Ze.filter(e=>e.id!==`claude-cowork`);function $e(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 et(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=E(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 tt(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?$e(e):et()}var nt=`ok:skill:cowork:installed`,rt=`1`,it=250,at=`/api/skill/install-state`;function ot(e){return`${nt}:v${e}`}var st=new Map;async function ct(e={},t={}){let n=t.force?`__force__`:`__default__`,r=st.get(n);if(r)return r;let i=lt(e,t);return st.set(n,i),i.finally(()=>{st.get(n)===i&&st.delete(n)}),i}async function lt(e,t){let n=e.installer===void 0?tt():e.installer,r=ut(e.storage),i=e.fetchSnapshot??ft,a=e.serverTimeoutMs??it,o=null;if(!t.force){try{o=await pt(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=ot(o?.currentVersion??e.fallbackSkillVersion??dt());if(!t.force&&r?.getItem(s)===rt)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,rt)}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 ut(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function dt(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function ft(){let e;try{e=await fetch(at,{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 pt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function mt(e){return ct({},e)}function ht(){return ct({},{force:!0})}async function gt(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 _t(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return gt({target:`claude-cowork`,url:M({mode:`cowork`},e)},n);case`claude-code`:return gt({target:`claude-code`,url:M({mode:`code`},e)},n);case`codex`:return gt({target:`codex`,url:ae(e)},n);case`cursor`:return gt({target:`cursor`,url:j(e),workspacePath:e.projectDir},n);default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function vt(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:yt(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:yt(e)}}}function yt(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}async function bt(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)}`)}}function xt(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function St(e){return`${e}.md`}function Ct(e){if(!e.docName||!e.workspace)return null;let t=St(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:xt(n,t,r)}}function wt(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function Tt(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function Et(e){if(!e.docName||!e.workspace||!e.selectionMarkdown)return null;let t=St(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:null,selection:{relativePath:t,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown},projectDir:n,docPath:xt(n,t,r)}}function Dt(e){return vt(e.installUrl).then(()=>void 0)}function Ot(e){return`Opened in ${e}.`}function kt(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 At(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function jt(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 Mt(e,t){return e.selection?N({...e.selection,target:t}):e.docContext===null?e.folderRelativePath?D(e.folderRelativePath):A():re(e.docContext.relativePath)}async function Nt(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 Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`Open Knowledge 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 Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:Mt(t,e)},a=await n.dispatchHandoff(i),o=jt(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString(),t.selection?`selection`:void 0);await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(Ot(s));else{let i=At(r),a=kt(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Nt(e,t,n,r+1)}}})}return a}function Pt(e){return Ze.find(t=>t.id===e)?.displayName??e}function Ft(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function It(){return{dispatchHandoff:_t,recordHandoff:bt,toast:{success:e=>{F.success(e)},error:(e,t)=>{F.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Ft(),getDisplayName:Pt,ensureCoworkSkillInstalled:mt}}function Lt(){return{dispatch:(e,t)=>Nt(e,t,It()),reinstallCoworkSkill:ht}}var Rt=[...new Set(Ze.flatMap(e=>e.schemes))];function zt(e,t){let n=t.now?.()??Date.now(),r={};for(let t of Ze){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 Bt(e){return zt({},e)}async function Vt(e){let t=e.schemes??Rt,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 Ht=Object.fromEntries(Rt.map(e=>[e,{installed:!1}]));async function Ut(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 Ht}if(!t.ok)return Ht;let n;try{n=await t.json()}catch{return Ht}if(typeof n!=`object`||!n||Array.isArray(n))return Ht;let r=n,i={};for(let e of Rt)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Wt(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 Gt(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Bt({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=zt(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=!Wt(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 Kt(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function qt(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Vt({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>Ut({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Jt(){let e=(0,J.c)(5),[t,n]=(0,q.useState)(Yt),r=(0,q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Gt(qt());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 Yt(){return Bt({isElectronHost:Kt(),now:Date.now})}var Xt=new Map;function Zt(e,t){Xt.set(e,t)}function Qt(e){let t=Xt.get(e)??null;return Xt.delete(e),t}function $t(e){Xt.delete(e)}function en(e,t){let n=(0,J.c)(4),r=t===void 0?!1:t,[i,a]=(0,q.useState)(void 0),o=(0,q.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,q.useEffect)(s,c),i}var tn=300;async function nn(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new m(O._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=te.safeParse(n);throw e.success?Error(e.data.title):new m(O._({id:`zlErBl`}),{status:t.status})}let r=P.safeParse(n);if(!r.success)throw new m(O._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var rn=32,an=12,on=6,sn=`open-knowledge:outline-nav`;function cn(e){let t=(0,J.c)(2),n;return t[0]===e?n=t[1]:(n=(0,K.jsx)(u,{name:`outline-panel`,children:(0,K.jsx)(ln,{...e})}),t[0]=e,t[1]=n),n}function ln(e){let t=(0,J.c)(50),{docName:r,isSourceMode:a,className:o}=e,s=o===void 0?``:o,{_:c}=n(),{pages:l,loading:u}=ie(),d=ee(),{activeProvider:f,activeDocName:p}=h(),m,g;t[0]===r?(m=t[1],g=t[2]):(m=[`page-headings`,r],g=()=>nn(r),t[0]=r,t[1]=m,t[2]=g);let T;t[3]!==r||t[4]!==u||t[5]!==l?(T=!u&&l.has(r),t[3]=r,t[4]=u,t[5]=l,t[6]=T):T=t[6];let E;t[7]!==m||t[8]!==g||t[9]!==T?(E={queryKey:m,queryFn:g,enabled:T,staleTime:1/0},t[7]=m,t[8]=g,t[9]=T,t[10]=E):E=t[10];let{data:D,isLoading:O,error:k}=v(E),A;t[11]===D?A=t[12]:(A=D===void 0?[]:D,t[11]=D,t[12]=A);let j=A,te,M;t[13]!==p||t[14]!==f||t[15]!==r||t[16]!==d?(te=()=>{if(!f||p!==r)return;let e=f.document,t=null,n=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,d.invalidateQueries({queryKey:[`page-headings`,r]})},tn)};return e.on(`update`,n),()=>{e.off(`update`,n),t!==null&&clearTimeout(t)}},M=[f,p,r,d],t[13]=p,t[14]=f,t[15]=r,t[16]=d,t[17]=te,t[18]=M):(te=t[17],M=t[18]),(0,q.useEffect)(te,M);let ne;t[19]===j?ne=t[20]:(ne=j.map(un),t[19]=j,t[20]=ne);let N=en(ne,a),re;t[21]!==N||t[22]!==j?(re=N?j.findIndex(e=>e.slug===N):-1,t[21]=N,t[22]=j,t[23]=re):re=t[23];let P=re,ae;t[24]!==r||t[25]!==a?(ae=function(e,t){let n={index:e,slug:t,mode:a?`source`:`wysiwyg`};n.mode===`source`&&Zt(r,{kind:`outline`,detail:n}),window.dispatchEvent(new CustomEvent(sn,{detail:n}))},t[24]=r,t[25]=a,t[26]=ae):ae=t[26];let oe=ae,ce=((P>=0?j[P].level:1)-1)*an+(an-on)/2,F=P*rn+(rn-on)/2,le;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,K.jsx)(C,{children:(0,K.jsx)(i,{id:`dD7NPy`})}),t[27]=le):le=t[27];let I;t[28]!==j.length||t[29]!==O?(I=!O&&(0,K.jsx)(S,{children:j.length}),t[28]=j.length,t[29]=O,t[30]=I):I=t[30];let L;t[31]===I?L=t[32]:(L=(0,K.jsxs)(x,{children:[le,I]}),t[31]=I,t[32]=L);let R;t[33]!==c||t[34]!==P||t[35]!==N||t[36]!==k||t[37]!==oe||t[38]!==j||t[39]!==O||t[40]!==ce||t[41]!==F?(R=k?(0,K.jsx)(_,{className:`px-2`,children:k instanceof Error?k.message:c({id:`GuqOb1`})}):j.length===0&&!O?(0,K.jsx)(y,{className:`px-2`,children:(0,K.jsx)(i,{id:`0BB9ID`})}):(0,K.jsxs)(`nav`,{"aria-label":c({id:`BymzO4`}),className:`relative`,children:[P>=0&&(0,K.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:on,height:on,transform:`translate(${ce}px, ${F}px)`}}),j.map((e,t)=>{let n=e.slug===N;return(0,K.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>oe(t,e.slug),className:se(`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)*an+20}px`},title:e.text,children:e.text},t)})]}),t[33]=c,t[34]=P,t[35]=N,t[36]=k,t[37]=oe,t[38]=j,t[39]=O,t[40]=ce,t[41]=F,t[42]=R):R=t[42];let z;t[43]!==O||t[44]!==R?(z=(0,K.jsx)(b,{className:`px-3 py-2`,"aria-busy":O,children:R}),t[43]=O,t[44]=R,t[45]=z):z=t[45];let ue;return t[46]!==s||t[47]!==L||t[48]!==z?(ue=(0,K.jsxs)(w,{className:s,children:[L,z]}),t[46]=s,t[47]=L,t[48]=z,t[49]=ue):ue=t[49],ue}function un(e){return e.slug}var dn=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,Y=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(dn(e)):dn,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ee(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=De(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Ke(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(Y.prototype[Symbol.iterator]=function(){return this});var fn={from:-1,to:-1,match:/.*/.exec(``)},pn=`gm`+(/x/.unicode==null?``:`u`),mn=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=fn,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new _n(e,t,n,r,i);this.re=new RegExp(t,pn+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=yn(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=yn(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},hn=new WeakMap,gn=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=hn.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return hn.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),hn.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},_n=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=fn,this.matchPos=yn(e,r),this.re=new RegExp(t,pn+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=gn.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=yn(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=gn.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(mn.prototype[Symbol.iterator]=_n.prototype[Symbol.iterator]=function(){return this});function vn(e){try{return new RegExp(e,pn),!0}catch{return!1}}function yn(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var bn=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=Pe(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),d=Math.round(t.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,d))),p=B.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[r,U.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},xn={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Sn=we.define({combine(e){return _e(e,xn,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Cn(e){let t=[kn,On];return e&&t.push(Sn.of(e)),t}var wn=V.mark({class:`cm-selectionMatch`}),Tn=V.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function En(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=W.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=W.Word)}function Dn(e,t,n,r){return e(t.sliceDoc(n,n+1))==W.Word&&e(t.sliceDoc(r-1,r))==W.Word}var On=Te.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Sn),{state:n}=e,r=n.selection;if(r.ranges.length>1)return V.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return V.none;let e=n.wordAt(i.head);if(!e)return V.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return V.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(En(o,n,i.from,i.to)&&Dn(o,n,i.from,i.to)))return V.none}else if(a=n.sliceDoc(i.from,i.to),!a)return V.none}let s=[];for(let r of e.visibleRanges){let e=new Y(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||En(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(Tn.range(r,a)):(r>=i.to||a<=i.from)&&s.push(wn.range(r,a)),s.length>t.maxMatches))return V.none}}return V.set(s)}},{decorations:e=>e.decorations}),kn=U.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),An=({state:e,dispatch:t})=>{let{selection:n}=e,r=B.create(n.ranges.map(t=>e.wordAt(t.head)||B.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function jn(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new Y(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new Y(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Mn=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return An({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=jn(e,r);return i?(t(e.update({selection:e.selection.addRange(B.range(i.from,i.to),!1),effects:U.scrollIntoView(i.to)})),!0):!1},Nn=we.define({combine(e){return _e(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new fr(e),scrollToMatch:e=>U.scrollIntoView(e)})}}),Pn=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||vn(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,i as n,o as r,r as i,t as a}from"./compiler-runtime-Cs91PcD2.js";import{A as o,Dn as s,O as c,On as l,Sn as u,Tn as d,X as f,k as p,lt as m,n as h,rt as g}from"./DocumentContext-CmeanKIC.js";import{a as _,c as v,i as y,n as b,o as x,r as S,s as C,t as w,u as ee}from"./panel-BNBODYwB.js";import{$ as T,A as E,An as D,Di as O,Mi as k,On as A,Sn as j,Xt as te,bn as M,et as ne,jn as N,kn as re,qt as P,u as ie,xn as ae,yn as oe}from"./prop-types-B9tF15NO.js";import{S as se,t as ce}from"./button-DenIdY-r.js";import{x as F}from"./dialog-C1dBa8-m.js";import{i as le}from"./collapsible-BhpeB6tu.js";import{i as I,n as L,t as R}from"./cursor-f-dht0b0.js";import{a as z,c as ue,d as de,i as fe,l as pe,u as me}from"./dropdown-menu-CXLGX1-h.js";import{$ as he,At as ge,Bt as _e,Dt as ve,E as ye,Et as B,Ft as be,Ht as xe,J as V,Mt as Se,N as Ce,Ot as we,Pt as H,Q as Te,Rt as Ee,Ut as De,X as U,_ as Oe,_t as ke,ct as Ae,dt as je,et as Me,f as Ne,gt as Pe,ht as Fe,l as Ie,lt as Le,mt as Re,nt as ze,ot as Be,rt as Ve,st as He,tt as Ue,ut as We,wt as W,y as Ge,yt as G,zt as Ke}from"./dist-DDdDbjlC.js";import{i as qe,n as Je,o as Ye,r as Xe}from"./dist-C7UlNfyl.js";var K=r(),q=e(t(),1),J=a(),Ze=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Conversational pairing in Claude Desktop's Cowork tab.`},{id:`claude-code`,displayName:`Claude`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Agentic coding in Claude Desktop's Code tab.`},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`,tagline:`OpenAI's coding agent, terminal-native.`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`,tagline:`AI-first VS Code fork with multi-file edits.`}],Qe=Ze.filter(e=>e.id!==`claude-cowork`);function $e(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 et(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=E(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 tt(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?$e(e):et()}var nt=`ok:skill:cowork:installed`,rt=`1`,it=250,at=`/api/skill/install-state`;function ot(e){return`${nt}:v${e}`}var st=new Map;async function ct(e={},t={}){let n=t.force?`__force__`:`__default__`,r=st.get(n);if(r)return r;let i=lt(e,t);return st.set(n,i),i.finally(()=>{st.get(n)===i&&st.delete(n)}),i}async function lt(e,t){let n=e.installer===void 0?tt():e.installer,r=ut(e.storage),i=e.fetchSnapshot??ft,a=e.serverTimeoutMs??it,o=null;if(!t.force){try{o=await pt(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=ot(o?.currentVersion??e.fallbackSkillVersion??dt());if(!t.force&&r?.getItem(s)===rt)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,rt)}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 ut(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function dt(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function ft(){let e;try{e=await fetch(at,{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 pt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function mt(e){return ct({},e)}function ht(){return ct({},{force:!0})}async function gt(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 _t(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return gt({target:`claude-cowork`,url:M({mode:`cowork`},e)},n);case`claude-code`:return gt({target:`claude-code`,url:M({mode:`code`},e)},n);case`codex`:return gt({target:`codex`,url:ae(e)},n);case`cursor`:return gt({target:`cursor`,url:j(e),workspacePath:e.projectDir},n);default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function vt(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:yt(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:yt(e)}}}function yt(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}async function bt(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)}`)}}function xt(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function St(e){return`${e}.md`}function Ct(e){if(!e.docName||!e.workspace)return null;let t=St(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:xt(n,t,r)}}function wt(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function Tt(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function Et(e){if(!e.docName||!e.workspace||!e.selectionMarkdown)return null;let t=St(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:null,selection:{relativePath:t,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown},projectDir:n,docPath:xt(n,t,r)}}function Dt(e){return vt(e.installUrl).then(()=>void 0)}function Ot(e){return`Opened in ${e}.`}function kt(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 At(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function jt(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 Mt(e,t){return e.selection?N({...e.selection,target:t}):e.docContext===null?e.folderRelativePath?D(e.folderRelativePath):A():re(e.docContext.relativePath)}async function Nt(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 Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`Open Knowledge 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 Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:Mt(t,e)},a=await n.dispatchHandoff(i),o=jt(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString(),t.selection?`selection`:void 0);await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(Ot(s));else{let i=At(r),a=kt(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Nt(e,t,n,r+1)}}})}return a}function Pt(e){return Ze.find(t=>t.id===e)?.displayName??e}function Ft(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function It(){return{dispatchHandoff:_t,recordHandoff:bt,toast:{success:e=>{F.success(e)},error:(e,t)=>{F.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Ft(),getDisplayName:Pt,ensureCoworkSkillInstalled:mt}}function Lt(){return{dispatch:(e,t)=>Nt(e,t,It()),reinstallCoworkSkill:ht}}var Rt=[...new Set(Ze.flatMap(e=>e.schemes))];function zt(e,t){let n=t.now?.()??Date.now(),r={};for(let t of Ze){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 Bt(e){return zt({},e)}async function Vt(e){let t=e.schemes??Rt,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 Ht=Object.fromEntries(Rt.map(e=>[e,{installed:!1}]));async function Ut(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 Ht}if(!t.ok)return Ht;let n;try{n=await t.json()}catch{return Ht}if(typeof n!=`object`||!n||Array.isArray(n))return Ht;let r=n,i={};for(let e of Rt)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Wt(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 Gt(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Bt({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=zt(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=!Wt(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 Kt(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function qt(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Vt({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>Ut({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Jt(){let e=(0,J.c)(5),[t,n]=(0,q.useState)(Yt),r=(0,q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Gt(qt());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 Yt(){return Bt({isElectronHost:Kt(),now:Date.now})}var Xt=new Map;function Zt(e,t){Xt.set(e,t)}function Qt(e){let t=Xt.get(e)??null;return Xt.delete(e),t}function $t(e){Xt.delete(e)}function en(e,t){let n=(0,J.c)(4),r=t===void 0?!1:t,[i,a]=(0,q.useState)(void 0),o=(0,q.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,q.useEffect)(s,c),i}var tn=300;async function nn(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new m(O._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=te.safeParse(n);throw e.success?Error(e.data.title):new m(O._({id:`zlErBl`}),{status:t.status})}let r=P.safeParse(n);if(!r.success)throw new m(O._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var rn=32,an=12,on=6,sn=`open-knowledge:outline-nav`;function cn(e){let t=(0,J.c)(2),n;return t[0]===e?n=t[1]:(n=(0,K.jsx)(u,{name:`outline-panel`,children:(0,K.jsx)(ln,{...e})}),t[0]=e,t[1]=n),n}function ln(e){let t=(0,J.c)(50),{docName:r,isSourceMode:a,className:o}=e,s=o===void 0?``:o,{_:c}=n(),{pages:l,loading:u}=ie(),d=ee(),{activeProvider:f,activeDocName:p}=h(),m,g;t[0]===r?(m=t[1],g=t[2]):(m=[`page-headings`,r],g=()=>nn(r),t[0]=r,t[1]=m,t[2]=g);let T;t[3]!==r||t[4]!==u||t[5]!==l?(T=!u&&l.has(r),t[3]=r,t[4]=u,t[5]=l,t[6]=T):T=t[6];let E;t[7]!==m||t[8]!==g||t[9]!==T?(E={queryKey:m,queryFn:g,enabled:T,staleTime:1/0},t[7]=m,t[8]=g,t[9]=T,t[10]=E):E=t[10];let{data:D,isLoading:O,error:k}=v(E),A;t[11]===D?A=t[12]:(A=D===void 0?[]:D,t[11]=D,t[12]=A);let j=A,te,M;t[13]!==p||t[14]!==f||t[15]!==r||t[16]!==d?(te=()=>{if(!f||p!==r)return;let e=f.document,t=null,n=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,d.invalidateQueries({queryKey:[`page-headings`,r]})},tn)};return e.on(`update`,n),()=>{e.off(`update`,n),t!==null&&clearTimeout(t)}},M=[f,p,r,d],t[13]=p,t[14]=f,t[15]=r,t[16]=d,t[17]=te,t[18]=M):(te=t[17],M=t[18]),(0,q.useEffect)(te,M);let ne;t[19]===j?ne=t[20]:(ne=j.map(un),t[19]=j,t[20]=ne);let N=en(ne,a),re;t[21]!==N||t[22]!==j?(re=N?j.findIndex(e=>e.slug===N):-1,t[21]=N,t[22]=j,t[23]=re):re=t[23];let P=re,ae;t[24]!==r||t[25]!==a?(ae=function(e,t){let n={index:e,slug:t,mode:a?`source`:`wysiwyg`};n.mode===`source`&&Zt(r,{kind:`outline`,detail:n}),window.dispatchEvent(new CustomEvent(sn,{detail:n}))},t[24]=r,t[25]=a,t[26]=ae):ae=t[26];let oe=ae,ce=((P>=0?j[P].level:1)-1)*an+(an-on)/2,F=P*rn+(rn-on)/2,le;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,K.jsx)(C,{children:(0,K.jsx)(i,{id:`dD7NPy`})}),t[27]=le):le=t[27];let I;t[28]!==j.length||t[29]!==O?(I=!O&&(0,K.jsx)(S,{children:j.length}),t[28]=j.length,t[29]=O,t[30]=I):I=t[30];let L;t[31]===I?L=t[32]:(L=(0,K.jsxs)(x,{children:[le,I]}),t[31]=I,t[32]=L);let R;t[33]!==c||t[34]!==P||t[35]!==N||t[36]!==k||t[37]!==oe||t[38]!==j||t[39]!==O||t[40]!==ce||t[41]!==F?(R=k?(0,K.jsx)(_,{className:`px-2`,children:k instanceof Error?k.message:c({id:`GuqOb1`})}):j.length===0&&!O?(0,K.jsx)(y,{className:`px-2`,children:(0,K.jsx)(i,{id:`0BB9ID`})}):(0,K.jsxs)(`nav`,{"aria-label":c({id:`BymzO4`}),className:`relative`,children:[P>=0&&(0,K.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:on,height:on,transform:`translate(${ce}px, ${F}px)`}}),j.map((e,t)=>{let n=e.slug===N;return(0,K.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>oe(t,e.slug),className:se(`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)*an+20}px`},title:e.text,children:e.text},t)})]}),t[33]=c,t[34]=P,t[35]=N,t[36]=k,t[37]=oe,t[38]=j,t[39]=O,t[40]=ce,t[41]=F,t[42]=R):R=t[42];let z;t[43]!==O||t[44]!==R?(z=(0,K.jsx)(b,{className:`px-3 py-2`,"aria-busy":O,children:R}),t[43]=O,t[44]=R,t[45]=z):z=t[45];let ue;return t[46]!==s||t[47]!==L||t[48]!==z?(ue=(0,K.jsxs)(w,{className:s,children:[L,z]}),t[46]=s,t[47]=L,t[48]=z,t[49]=ue):ue=t[49],ue}function un(e){return e.slug}var dn=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,Y=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(dn(e)):dn,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ee(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=De(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Ke(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(Y.prototype[Symbol.iterator]=function(){return this});var fn={from:-1,to:-1,match:/.*/.exec(``)},pn=`gm`+(/x/.unicode==null?``:`u`),mn=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=fn,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new _n(e,t,n,r,i);this.re=new RegExp(t,pn+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=yn(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=yn(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},hn=new WeakMap,gn=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=hn.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return hn.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),hn.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},_n=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=fn,this.matchPos=yn(e,r),this.re=new RegExp(t,pn+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=gn.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=yn(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=gn.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(mn.prototype[Symbol.iterator]=_n.prototype[Symbol.iterator]=function(){return this});function vn(e){try{return new RegExp(e,pn),!0}catch{return!1}}function yn(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var bn=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=Pe(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),d=Math.round(t.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,d))),p=B.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[r,U.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},xn={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Sn=we.define({combine(e){return _e(e,xn,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Cn(e){let t=[kn,On];return e&&t.push(Sn.of(e)),t}var wn=V.mark({class:`cm-selectionMatch`}),Tn=V.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function En(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=W.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=W.Word)}function Dn(e,t,n,r){return e(t.sliceDoc(n,n+1))==W.Word&&e(t.sliceDoc(r-1,r))==W.Word}var On=Te.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Sn),{state:n}=e,r=n.selection;if(r.ranges.length>1)return V.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return V.none;let e=n.wordAt(i.head);if(!e)return V.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return V.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(En(o,n,i.from,i.to)&&Dn(o,n,i.from,i.to)))return V.none}else if(a=n.sliceDoc(i.from,i.to),!a)return V.none}let s=[];for(let r of e.visibleRanges){let e=new Y(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||En(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(Tn.range(r,a)):(r>=i.to||a<=i.from)&&s.push(wn.range(r,a)),s.length>t.maxMatches))return V.none}}return V.set(s)}},{decorations:e=>e.decorations}),kn=U.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),An=({state:e,dispatch:t})=>{let{selection:n}=e,r=B.create(n.ranges.map(t=>e.wordAt(t.head)||B.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function jn(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new Y(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new Y(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Mn=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return An({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=jn(e,r);return i?(t(e.update({selection:e.selection.addRange(B.range(i.from,i.to),!1),effects:U.scrollIntoView(i.to)})),!0):!1},Nn=we.define({combine(e){return _e(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new fr(e),scrollToMatch:e=>U.scrollIntoView(e)})}}),Pn=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||vn(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
2
2
|
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Gn(this):new zn(this)}getCursor(e,t=0,n){let r=e.doc?e:ve.create({doc:e});return n??=r.doc.length,this.regexp?Vn(this,r,t,n):Ln(this,r,t,n)}},Fn=class{constructor(e){this.spec=e}};function In(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function Ln(e,t,n,r){let i;return e.wholeWord&&(i=Rn(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=In(e.test,t,i)),new Y(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function Rn(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(Hn(i,n-a))!=W.Word||t(Un(i,n-a))!=W.Word)&&(t(Un(i,r-a))!=W.Word||t(Hn(i,r-a))!=W.Word))}var zn=class extends Fn{constructor(e){super(e)}nextMatch(e,t,n){let r=Ln(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=Ln(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=Ln(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=Ln(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=Ln(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function Bn(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function Vn(e,t,n,r){let i;return e.wholeWord&&(i=Wn(t.charCategorizer(t.selection.main.head))),e.test&&(i=Bn(e.test,t,i)),new mn(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function Hn(e,t){return e.slice(xe(e,t,!1),t)}function Un(e,t){return e.slice(t,xe(e,t))}function Wn(e){return(t,n,r)=>!r[0].length||(e(Hn(r.input,r.index))!=W.Word||e(Un(r.input,r.index))!=W.Word)&&(e(Un(r.input,r.index+r[0].length))!=W.Word||e(Hn(r.input,r.index+r[0].length))!=W.Word)}var Gn=class extends Fn{nextMatch(e,t,n){let r=Vn(this.spec,e,n,e.doc.length).next();return r.done&&(r=Vn(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=Vn(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=Vn(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=Vn(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},Kn=H.define(),qn=H.define(),X=be.define({create(e){return new Jn(or(e).create(),null)},update(e,t){for(let n of t.effects)n.is(Kn)?e=new Jn(n.value.create(),e.panel):n.is(qn)&&(e=new Jn(e.query,n.value?ar:null));return e},provide:e=>ke.from(e,e=>e.panel)}),Jn=class{constructor(e,t){this.query=e,this.panel=t}},Yn=V.mark({class:`cm-searchMatch`}),Xn=V.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Zn=Te.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(X))}update(e){let t=e.state.field(X);(t!=e.startState.field(X)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return V.none;let{view:n}=this,r=new Se;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Xn:Yn)})}return r.finish()}},{decorations:e=>e.decorations});function Qn(e){return t=>{let n=t.state.field(X,!1);return n&&n.query.spec.valid?e(t,n):lr(t)}}var $n=Qn((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=B.single(r.from,r.to),a=e.state.facet(Nn);return e.dispatch({selection:i,effects:[hr(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),cr(e),!0}),er=Qn((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=B.single(i.from,i.to),o=e.state.facet(Nn);return e.dispatch({selection:a,effects:[hr(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),cr(e),!0}),tr=Qn((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:B.create(n.map(e=>B.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),nr=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new Y(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(B.range(t.value.from,t.value.to))}return t(e.update({selection:B.create(a,o),userEvent:`select.search.matches`})),!0},rr=Qn((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(U.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let d=e.state.changes(s);return o&&(c=B.single(o.from,o.to).map(d),u.push(hr(e,o)),u.push(n.facet(Nn).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),ir=Qn((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:U.announce.of(r),userEvent:`input.replace.all`}),!0});function ar(e){return e.state.facet(Nn).createPanel(e)}function or(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(Nn);return new Pn({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function sr(e){let t=Ve(e,ar);return t&&t.dom.querySelector(`[main-field]`)}function cr(e){let t=sr(e);t&&t==e.root.activeElement&&t.select()}var lr=e=>{let t=e.state.field(X,!1);if(t&&t.panel){let n=sr(e);if(n&&n!=e.root.activeElement){let r=or(e.state,t.query.spec);r.valid&&e.dispatch({effects:Kn.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[qn.of(!0),t?Kn.of(or(e.state,t.query.spec)):H.appendConfig.of(_r)]});return!0},ur=e=>{let t=e.state.field(X,!1);if(!t||!t.panel)return!1;let n=Ve(e,ar);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:qn.of(!1)}),!0},dr=[{key:`Mod-f`,run:lr,scope:`editor search-panel`},{key:`F3`,run:$n,shift:er,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:$n,shift:er,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:ur,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:nr},{key:`Mod-Alt-g`,run:bn},{key:`Mod-d`,run:Mn,preventDefault:!0}],fr=class{constructor(e){this.view=e;let t=this.query=e.state.field(X).query.spec;this.commit=this.commit.bind(this),this.searchField=G(`input`,{value:t.search,placeholder:Z(e,`Find`),"aria-label":Z(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=G(`input`,{value:t.replace,placeholder:Z(e,`Replace`),"aria-label":Z(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=G(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=G(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=G(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return G(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=G(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>$n(e),[Z(e,`next`)]),n(`prev`,()=>er(e),[Z(e,`previous`)]),n(`select`,()=>tr(e),[Z(e,`all`)]),G(`label`,null,[this.caseField,Z(e,`match case`)]),G(`label`,null,[this.reField,Z(e,`regexp`)]),G(`label`,null,[this.wordField,Z(e,`by word`)]),...e.state.readOnly?[]:[G(`br`),this.replaceField,n(`replace`,()=>rr(e),[Z(e,`replace`)]),n(`replaceAll`,()=>ir(e),[Z(e,`replace all`)])],G(`button`,{name:`close`,onclick:()=>ur(e),"aria-label":Z(e,`close`),type:`button`},[`×`])])}commit(){let e=new Pn({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Kn.of(e)}))}keydown(e){Fe(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?er:$n)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),rr(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(Kn)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Nn).top}};function Z(e,t){return e.state.phrase(t)}var pr=30,mr=/[\s\.,:;?!]/;function hr(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-pr),o=Math.min(i,n+pr),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<pr;e++)if(!mr.test(s[e+1])&&mr.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-pr;e--)if(!mr.test(s[e-1])&&mr.test(s[e])){s=s.slice(0,e);break}}return U.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var gr=U.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),_r=[X,ge.low(Zn),gr],vr=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},yr=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(jr).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new Se,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=Hr(s);if(i)o.add(n,n,V.widget({widget:new Fr(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,V.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,Q(f))}};function Q(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new vr(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new vr(r.from,n,r.diagnostic)}),r}function br(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(jr).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(Sr))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function xr(e,t){return e.field($,!1)?t:t.concat(H.appendConfig.of(Ur))}var Sr=H.define(),Cr=H.define(),wr=H.define(),$=be.define({create(){return new yr(V.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=Q(n,e.selected.diagnostic,i)||Q(n,null,i)}!n.size&&i&&t.state.facet(jr).autoPanel&&(i=null),e=new yr(n,i,r)}for(let n of t.effects)if(n.is(Sr)){let r=t.state.facet(jr).autoPanel?n.value.length?Lr.open:null:e.panel;e=yr.init(n.value,r,t.state)}else n.is(Cr)?e=new yr(e.diagnostics,n.value?Lr.open:null,e.selected):n.is(wr)&&(e=new yr(e.diagnostics,e.panel,n.value));return e},provide:e=>[ke.from(e,e=>e.panel),U.decorations.from(e,e=>e.diagnostics)]}),Tr=V.mark({class:`cm-lintRange cm-lintRange-active`});function Er(e,t,n){let{diagnostics:r}=e.state.field($),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(jr).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:Dr(e,i)}}}:null}function Dr(e,t){return G(`ul`,{class:`cm-tooltip-lint`},t.map(t=>Pr(e,t,!1)))}var Or=e=>{let t=e.state.field($,!1);(!t||!t.panel)&&e.dispatch({effects:xr(e.state,[Cr.of(!0)])});let n=Ve(e,Lr.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},kr=e=>{let t=e.state.field($,!1);return!t||!t.panel?!1:(e.dispatch({effects:Cr.of(!1)}),!0)},Ar=[{key:`Mod-Shift-m`,run:Or,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field($,!1);if(!t)return!1;let n=e.state.selection.main,r=Q(t.diagnostics,null,n.to+1);return!r&&(r=Q(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],jr=we.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),..._e(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Mr,tooltipFilter:Mr,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function Mr(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Nr(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function Pr(e,t,n){let r=n?Nr(t.actions):[];return G(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},G(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=Q(e.state.field($).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),G(`u`,s.slice(c,c+1)),s.slice(c+1)];return G(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&G(`div`,{class:`cm-diagnosticSource`},t.source))}var Fr=class extends he{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return G(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},Ir=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=Pr(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},Lr=class e{constructor(e){this.view=e,this.items=[],this.list=G(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)kr(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=Nr(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=Q(this.view.state.field($).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=G(`div`,{class:`cm-panel-lint`},this.list,G(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>kr(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field($).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field($),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new Ir(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new Ir(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Q(this.view.state.field($).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:wr.of(t)})}static open(t){return new e(t)}};function Rr(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function zr(e){return Rr(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var Br=U.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:zr(`#d11`)},".cm-lintRange-warning":{backgroundImage:zr(`orange`)},".cm-lintRange-info":{backgroundImage:zr(`#999`)},".cm-lintRange-hint":{backgroundImage:zr(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function Vr(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function Hr(e){let t=`hint`,n=1;for(let r of e){let e=Vr(r.severity);e>n&&(n=e,t=r.severity)}return t}var Ur=[$,U.decorations.compute([$],e=>{let{selected:t,panel:n}=e.field($);return!t||!n||t.from==t.to?V.none:V.set([Tr.range(t.from,t.to)])}),Le(Er,{hideOn:br}),Br],Wr=[je(),He(),Ae(),p(),Oe(),Ue(),ze(),ve.allowMultipleSelections.of(!0),ye(),Ce(Ne,{fallback:!0}),Ie(),Xe(),Je(),Re(),Me(),Be(),Cn(),We.of([...qe,...c,...dr,...o,...Ge,...Ye,...Ar])];Ae(),p(),Ue(),Ce(Ne,{fallback:!0}),We.of([...c,...o]);var Gr={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Kr(e){let t=(0,J.c)(23),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,style:a,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{resolvedTheme:o}=k(),s=Gr[r],c=s?(o===`dark`?ne[s]:void 0)??T[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let u=l,d=c&&`[&_*]:![color:var(--ok-brand-color)]`,f;t[8]!==n||t[9]!==d?(f=se(d,n),t[8]=n,t[9]=d,t[10]=f):f=t[10];let p=f;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==p||t[12]!==u||t[13]!==i?(e=(0,K.jsx)(I,{style:u,className:p,...i}),t[11]=p,t[12]=u,t[13]=i,t[14]=e):e=t[14],e}if(r===`codex`){let e;return t[15]!==p||t[16]!==u||t[17]!==i?(e=(0,K.jsx)(L,{style:u,className:p,...i}),t[15]=p,t[16]=u,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==p||t[20]!==u||t[21]!==i?(e=(0,K.jsx)(R,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function qr(e){let{installState:t}=e;return t.installed===null?O._({id:`IA6JW2`}):t.installed===!1?O._({id:`5SwVv1`}):null}function Jr(e){let{target:t,installState:n}=e;if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:O._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:O._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl},...t.hasWebFallback?{webFallback:{label:O._({id:`0S9PW_`}),url:``}}:{}}}}return{enabled:!0,tooltip:null}}function Yr(e){return oe(e)}function Xr(e){return O._({id:`h_HYHD`,values:{displayName:e}})}var Zr=`claude.ai`;async function Qr(e,t=vt){(await t(oe(e))).ok?F.success(Xr(Zr)):F.error(O._({id:`9NC_MT`,values:{CLAUDE_WEB_FALLBACK_LABEL:Zr}}))}function $r(e){let t=(0,J.c)(68),{_:r}=n(),{target:i,installState:a,isElectronHost:o,prompt:s,onSelect:c}=e,l=e.openExternal??vt,u=e.onWebFallbackSuccess??ti,d=e.onWebFallbackError??ei,{displayName:f}=i,p,m,h,g,_,v,y,b,x,S;if(t[0]!==r||t[1]!==a||t[2]!==o||t[3]!==c||t[4]!==d||t[5]!==u||t[6]!==l||t[7]!==s||t[8]!==i||t[9]!==f){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Jr({target:i,installState:a,isElectronHost:o}),n=qr({target:i,installState:a,isElectronHost:o}),C=()=>{e.tooltip&&l(e.tooltip.installAction.url)},w;t[20]!==d||t[21]!==u||t[22]!==l||t[23]!==s||t[24]!==i?(w=()=>{(async()=>{let e=await l(Yr(s));e.ok?u(i):d(i,e.detail??e.reason)})()},t[20]=d,t[21]=u,t[22]=l,t[23]=s,t[24]=i,t[25]=w):w=t[25];let ee=w;if(e.enabled){let e=`open-in-agent-item-${i.id}`,n;t[26]!==r||t[27]!==f?(n=r({id:`NnQapF`,values:{targetDisplayName:f}}),t[26]=r,t[27]=f,t[28]=n):n=t[28];let a;t[29]===i.id?a=t[30]:(a=(0,K.jsx)(Kr,{id:i.id,"aria-hidden":`true`}),t[29]=i.id,t[30]=a);let o;t[31]===i.displayName?o=t[32]:(o=(0,K.jsx)(`span`,{children:i.displayName}),t[31]=i.displayName,t[32]=o);let s;t[33]!==c||t[34]!==n||t[35]!==a||t[36]!==o||t[37]!==e?(s=(0,K.jsxs)(fe,{onSelect:c,"data-testid":e,"aria-label":n,children:[a,o]}),t[33]=c,t[34]=n,t[35]=a,t[36]=o,t[37]=e,t[38]=s):s=t[38],S=s;break bb0}if(!e.tooltip){let e=r(n?{id:`If0crP`,values:{targetDisplayName:f,hint:n}}:{id:`NnQapF`,values:{targetDisplayName:f}}),a;t[39]===i.id?a=t[40]:(a=(0,K.jsx)(Kr,{id:i.id,"aria-hidden":`true`}),t[39]=i.id,t[40]=a);let o;t[41]===i.displayName?o=t[42]:(o=(0,K.jsx)(`span`,{className:`flex-1`,children:i.displayName}),t[41]=i.displayName,t[42]=o),S=(0,K.jsxs)(fe,{disabled:!0,"data-testid":`open-in-agent-item-${i.id}`,"aria-label":e,children:[a,o,n?(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:n}):null]});break bb0}let T=r(n?{id:`If0crP`,values:{targetDisplayName:f,hint:n}}:{id:`NnQapF`,values:{targetDisplayName:f}}),E=e.tooltip.webFallback?.label??``;m=pe;let D=`open-in-agent-item-${i.id}`,O;t[43]===i.id?O=t[44]:(O=(0,K.jsx)(Kr,{id:i.id,"aria-hidden":`true`,className:`mr-2`}),t[43]=i.id,t[44]=O);let k;t[45]===i.displayName?k=t[46]:(k=(0,K.jsx)(`span`,{className:`flex-1`,children:i.displayName}),t[45]=i.displayName,t[46]=k);let A;t[47]===n?A=t[48]:(A=n?(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:n}):null,t[47]=n,t[48]=A),t[49]!==T||t[50]!==O||t[51]!==k||t[52]!==A||t[53]!==D?(x=(0,K.jsxs)(de,{"data-testid":D,"data-row-disabled":``,"aria-label":T,children:[O,k,A]}),t[49]=T,t[50]=O,t[51]=k,t[52]=A,t[53]=D,t[54]=x):x=t[54],p=me,h=`min-w-[260px]`,g=`open-in-agent-submenu-${i.id}`,_=(0,K.jsx)(z,{className:`font-normal text-muted-foreground text-xs`,"data-testid":`open-in-agent-message-${i.id}`,children:e.tooltip.message}),t[55]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,K.jsx)(ue,{}),t[55]=v):v=t[55],y=(0,K.jsx)(fe,{onSelect:C,"data-testid":`open-in-agent-install-${i.id}`,children:(0,K.jsx)(`span`,{children:e.tooltip.installAction.label})}),b=e.tooltip.webFallback?(0,K.jsxs)(fe,{onSelect:ee,"data-testid":`open-in-agent-web-fallback-${i.id}`,"aria-label":r({id:`lsOFZR`,values:{webFallbackLabel:E}}),children:[(0,K.jsx)(`span`,{className:`flex-1`,children:e.tooltip.webFallback.label}),(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:r({id:`Z9BoIy`})})]}):null}t[0]=r,t[1]=a,t[2]=o,t[3]=c,t[4]=d,t[5]=u,t[6]=l,t[7]=s,t[8]=i,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S}else p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18],S=t[19];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let C;t[56]!==p||t[57]!==h||t[58]!==g||t[59]!==_||t[60]!==v||t[61]!==y||t[62]!==b?(C=(0,K.jsxs)(p,{className:h,"data-testid":g,children:[_,v,y,b]}),t[56]=p,t[57]=h,t[58]=g,t[59]=_,t[60]=v,t[61]=y,t[62]=b,t[63]=C):C=t[63];let w;return t[64]!==m||t[65]!==x||t[66]!==C?(w=(0,K.jsxs)(m,{children:[x,C]}),t[64]=m,t[65]=x,t[66]=C,t[67]=w):w=t[67],w}function ei(){}function ti(){}function ni(e){let t=(0,J.c)(17),{installStates:r,onPick:a}=e,{_:o}=n(),[s,c]=(0,q.useState)(``),l;if(t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==a){let e;t[5]===r?e=t[6]:(e=e=>r[e.id]?.installed===!0,t[5]=r,t[6]=e);let n=Qe.filter(e),u=Qe.some(e=>r[e.id]?.installed==null),d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(`div`,{className:`font-mono text-xs uppercase tracking-wide text-muted-foreground`,children:(0,K.jsx)(i,{id:`EVnzPs`})}),t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>c(e.target.value),t[8]=f):f=t[8];let p;t[9]===o?p=t[10]:(p=o({id:`Rah7yq`}),t[9]=o,t[10]=p);let m;t[11]===o?m=t[12]:(m=o({id:`ZBt4rI`}),t[11]=o,t[12]=m);let h;t[13]!==s||t[14]!==p||t[15]!==m?(h=(0,K.jsx)(le,{value:s,onChange:f,placeholder:p,"aria-label":m,"data-testid":`edit-with-ai-instruction`}),t[13]=s,t[14]=p,t[15]=m,t[16]=h):h=t[16],l=(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,h,n.length>0?(0,K.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:n.map(e=>(0,K.jsxs)(ce,{type:`button`,variant:`ghost`,className:`w-full justify-start gap-2`,"data-testid":`edit-with-ai-target-${e.id}`,onClick:()=>a(e,s),children:[(0,K.jsx)(Kr,{id:e.id,"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:e.displayName})]},e.id))}):(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`edit-with-ai-empty`,"aria-live":`polite`,children:u?(0,K.jsx)(i,{id:`EcR0fl`}):(0,K.jsx)(i,{id:`l6OXqI`})})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=a,t[4]=l}else l=t[4];return l}function ri(e){let t=(0,J.c)(23),{resolveSelection:r,children:i}=e,{_:a}=n(),{states:o,refresh:c}=Jt(),{dispatch:u}=Lt(),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(null),g;t[0]!==a||t[1]!==c||t[2]!==r?(g=e=>{if(e){let e;try{e=r()}catch(e){console.error(`Edit with AI: could not read the selection`,e),F.error(a({id:`-RXIMO`}));return}h(e),c()}p(e)},t[0]=a,t[1]=c,t[2]=r,t[3]=g):g=t[3];let _=g,v;t[4]!==a||t[5]!==u||t[6]!==m?(v=(e,t)=>{if(m!==null){let n=Et({docName:m.docName,workspace:m.workspace,instruction:t,selectionMarkdown:m.selectionMarkdown});n===null?F.error(a({id:`_VRtd7`})):u(e.id,n)}p(!1)},t[4]=a,t[5]=u,t[6]=m,t[7]=v):v=t[7];let y=v,b;t[8]===i?b=t[9]:(b=(0,K.jsx)(l,{asChild:!0,children:i}),t[8]=i,t[9]=b);let x;t[10]===a?x=t[11]:(x=a({id:`EVnzPs`}),t[10]=a,t[11]=x);let S;t[12]!==y||t[13]!==o?(S=(0,K.jsx)(ni,{installStates:o,onPick:y}),t[12]=y,t[13]=o,t[14]=S):S=t[14];let C;t[15]!==x||t[16]!==S?(C=(0,K.jsx)(s,{align:`start`,"aria-label":x,"data-testid":`edit-with-ai-popover`,children:S}),t[15]=x,t[16]=S,t[17]=C):C=t[17];let w;return t[18]!==_||t[19]!==f||t[20]!==b||t[21]!==C?(w=(0,K.jsxs)(d,{open:f,onOpenChange:_,children:[b,C]}),t[18]=_,t[19]=f,t[20]=b,t[21]=C,t[22]=w):w=t[22],w}function ii(e){let t=f(e.state.selection.content(),e.state.schema);return g().serialize(t).trim()}function ai(e){let{from:t,to:n}=e.selection.main;return e.sliceDoc(t,n)}export{Dt as _,Kr as a,xt as b,sn as c,Qt as d,Zt as f,wt as g,Ct as h,$r as i,cn as l,Tt as m,ii as n,Qr as o,Jt as p,ri as r,Wr as s,ai as t,$t as u,Lt as v,Qe as x,St as y};
|
package/dist/public/index.html
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
-->
|
|
49
49
|
<script>(() => { let t = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (r === 'light' || r === 'dark' || r === 'system') t = r; } catch {} let dark = t === 'dark'; if (t === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } if (dark) document.documentElement.classList.add('dark'); if (window.okDesktop) document.documentElement.classList.add('electron-mode'); })();</script>
|
|
50
50
|
<style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
|
|
51
|
-
<script type="module" crossorigin src="./assets/index-
|
|
51
|
+
<script type="module" crossorigin src="./assets/index-DDgC3bxb.js"></script>
|
|
52
52
|
<link rel="modulepreload" crossorigin href="./assets/chunk-CFjPhJqf.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-2ej06EnG.js">
|
|
54
54
|
<link rel="modulepreload" crossorigin href="./assets/w3c-keyname-BSTW6KzM.js">
|
|
@@ -61,23 +61,23 @@
|
|
|
61
61
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-Cs91PcD2.js">
|
|
62
62
|
<link rel="modulepreload" crossorigin href="./assets/trace-api-3dczfLSc.js">
|
|
63
63
|
<link rel="modulepreload" crossorigin href="./assets/button-DenIdY-r.js">
|
|
64
|
-
<link rel="modulepreload" crossorigin href="./assets/prop-types-
|
|
64
|
+
<link rel="modulepreload" crossorigin href="./assets/prop-types-B9tF15NO.js">
|
|
65
65
|
<link rel="modulepreload" crossorigin href="./assets/propagation-api-CobBjsTC.js">
|
|
66
66
|
<link rel="modulepreload" crossorigin href="./assets/collapsible-BhpeB6tu.js">
|
|
67
67
|
<link rel="modulepreload" crossorigin href="./assets/dialog-C1dBa8-m.js">
|
|
68
|
-
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-
|
|
69
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="./assets/dropdown-menu-
|
|
68
|
+
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-CmeanKIC.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-DBy4lTCM.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="./assets/dropdown-menu-CXLGX1-h.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/panel-BNBODYwB.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/cursor-f-dht0b0.js">
|
|
73
|
-
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-
|
|
73
|
+
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-CJo4jOvj.js">
|
|
74
74
|
<link rel="modulepreload" crossorigin href="./assets/checkbox-BPCXBJai.js">
|
|
75
75
|
<link rel="modulepreload" crossorigin href="./assets/label-XH11jREQ.js">
|
|
76
|
-
<link rel="modulepreload" crossorigin href="./assets/toggle-group-
|
|
76
|
+
<link rel="modulepreload" crossorigin href="./assets/toggle-group-Bn1EVq3y.js">
|
|
77
77
|
<link rel="modulepreload" crossorigin href="./assets/textarea-Bt3y5Hxz.js">
|
|
78
|
-
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-
|
|
78
|
+
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-DYqTE3X_.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="./assets/agent-presence-4UV17fwS.js">
|
|
80
|
-
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-
|
|
80
|
+
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-BJncQo3K.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="./assets/project-paths-CsGHlmFh.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-CijO54Jd.js">
|
|
83
83
|
<link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,u as t}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-launch-json-
|
|
1
|
+
import{n as e,u as t}from"./init-CRoSG2y6.mjs";import{t as n}from"./is-object-C-4FJ0rP.mjs";import{join as r}from"node:path";import{existsSync as i,readFileSync as a}from"node:fs";const o=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`]];function s(t){if(t.runtimeExecutable!==`npx`||!Array.isArray(t.runtimeArgs))return`preserved`;if(c(t.runtimeArgs,e))return`canonical`;for(let e of o)if(c(t.runtimeArgs,e))return`legacy-bare`;return`preserved`}function c(e,t){if(e.length!==t.length)return!1;for(let n=0;n<t.length;n++)if(e[n]!==t[n])return!1;return!0}function l(e){let o=e.logger??u,c=r(e.projectDir,`.claude`,`launch.json`);if(!i(c))return{outcome:{configPath:c,outcome:`no-file`},repairedCount:0};let l;try{let e=a(c,`utf-8`).trim();l=e?JSON.parse(e):{}}catch(e){let t=e instanceof Error?e.message:String(e);return o({event:`launch-json-repair-read-failed`,configPath:c,error:t}),{outcome:{configPath:c,outcome:`read-failed`,error:t},repairedCount:0}}if(!n(l)){let e=`launch.json root is not an object`;return o({event:`launch-json-repair-read-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`read-failed`,error:e},repairedCount:0}}let d=l.configurations;if(!Array.isArray(d))return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let f=d.find(e=>n(e)&&e.name===`open-knowledge-ui`);if(!f)return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let p=s(f);if(p===`canonical`)return{outcome:{configPath:c,outcome:`canonical`},repairedCount:0};if(p===`preserved`)return{outcome:{configPath:c,outcome:`preserved`},repairedCount:0};let m=t(e.projectDir,{mode:`published`});if(m.action===`failed`){let e=m.error??`unknown write failure`;return o({event:`launch-json-repair-write-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`write-failed`,error:e},repairedCount:0}}return o({event:`launch-json-repair-applied`,configPath:c}),{outcome:{configPath:c,outcome:`repaired`},repairedCount:1}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{l as repairLaunchJson};
|
|
2
|
+
//# sourceMappingURL=repair-launch-json-D5DbaOCD.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,d as t,g as n,m as r,s as i}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-mcp-configs-
|
|
1
|
+
import{_ as e,d as t,g as n,m as r,s as i}from"./init-CRoSG2y6.mjs";import{homedir as a}from"node:os";function o(t){return t.command===`npx`&&Array.isArray(t.args)&&s(t.args,e)?`canonical`:`needs-rewrite`}function s(e,t){if(e.length!==t.length)return!1;for(let n=0;n<t.length;n++)if(e[n]!==t[n])return!1;return!0}function c(e){let t=e.logger??f,i=e.home??a(),o=[];for(let a of r){let r=n[a],s=l(()=>r.configPath(``,i));if(s!==null&&o.push(u({scope:`user`,editorId:a,target:r,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:t})),r.projectConfigPath){let n=r.projectConfigPath,i=l(()=>n(e.projectDir));i!==null&&o.push(u({scope:`project`,editorId:a,target:r,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:t}))}}return{outcomes:o,repairedCount:o.filter(e=>e.outcome===`repaired`).length}}function l(e){try{return e()}catch{return null}}function u(e){let n={scope:e.scope,editorId:e.editorId,configPath:e.configPath},r=i(e.target,e.cwd,e.home,e.configPathOverride);if(r===null)return{...n,outcome:`no-entry`};if(o(r)===`canonical`)return{...n,outcome:`canonical`};let a=d(r),s=t(e.target,e.cwd,{mode:`published`,skipAvailabilityCheck:!0},e.home,e.configPathOverride);if(s.action===`failed`){let t=s.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:t}),{...n,outcome:`write-failed`,error:t}}return e.logger({event:`mcp-config-reclaim`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,priorCommand:a.priorCommand,priorArgs:a.priorArgs}),{...n,outcome:`repaired`}}function d(e){return{priorCommand:typeof e.command==`string`?e.command.slice(0,200):null,priorArgs:Array.isArray(e.args)?e.args.slice(0,10).map(e=>typeof e==`string`?e.slice(0,200):e):null}}function f(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{c as repairMcpConfigs};
|
|
2
|
+
//# sourceMappingURL=repair-mcp-configs-DSFRe6WN.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as e,g as t,u as n,v as r}from"./init-
|
|
2
|
-
//# sourceMappingURL=src-
|
|
1
|
+
import{d as e,g as t,u as n,v as r}from"./init-CRoSG2y6.mjs";import"./loader-Dw5FfKPU.mjs";import"./preview-Bi1tKilT.mjs";import{dirname as i,isAbsolute as a,join as o,relative as s,resolve as c}from"node:path";import{statSync as l}from"node:fs";import{readFile as u,realpath as d}from"node:fs/promises";function f(e){return e.replace(/:\d+$/,``)}function p(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:f(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:f(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:f(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function m(e){let t;try{t=new URL(e)}catch{return null}if(t.hostname!==`github.com`&&t.hostname!==`www.github.com`)return null;let n=t.pathname.split(`/`).filter(e=>e.length>0);if(n.length<5||n[2]!==`blob`)return null;let r,i,a,o;try{r=decodeURIComponent(n[0]),i=decodeURIComponent(n[1]),a=decodeURIComponent(n[3]),o=n.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!r||!i||!a||o.length===0||o.some(e=>e.length===0)?null:{owner:r,repo:i,branch:a,path:o.join(`/`)}}async function h(e,t){let n,r;try{n=await d(c(e)),r=await d(c(i(e)))}catch{return{kind:`not-git`}}if(!g(n,r))return{kind:`symlink-escape`};let s=o(n,`.git`),f;try{f=l(s)}catch{return{kind:`not-git`}}let m;if(f.isDirectory()){let e;try{e=await d(s)}catch{return{kind:`not-git`}}if(!g(e,n))return{kind:`symlink-escape`};m=e}else if(f.isFile()){let e;try{e=await u(s,`utf-8`)}catch{return{kind:`not-git`}}let t=/^gitdir:\s*(.+)$/m.exec(e.trim());if(!t)return{kind:`not-git`};let r=t[1].trim(),i=a(r)?r:c(n,r);try{m=await d(i)}catch{return{kind:`not-git`}}}else return{kind:`not-git`};let h=o(m,`config`),_;try{_=await u(h,`utf-8`)}catch{return{kind:`not-git`}}let y=v(_);if(y===null)return{kind:`no-origin`};let b=p(y);if(b===null||b.hostname!==`github.com`)return{kind:`non-github`};let x=b.owner.toLowerCase()===t.owner.toLowerCase(),S=b.name.toLowerCase()===t.repo.toLowerCase();return!x||!S?{kind:`wrong-repo`,actualOwner:b.owner,actualRepo:b.name}:{kind:`ok`,gitRemoteUrl:`https://github.com/${b.owner}/${b.name}.git`}}function g(e,t){if(e===t)return!0;let n=s(t,e);return n.length>0&&!n.startsWith(`..`)&&!a(n)}function _(e){let t=e.indexOf(`#`),n=e.indexOf(`;`),r=-1;return t>=0&&n>=0?r=Math.min(t,n):t>=0?r=t:n>=0&&(r=n),(r===-1?e:e.slice(0,r)).trim()}function v(e){let t=!1;for(let n of e.split(/\r?\n/)){let e=_(n);if(e.length===0)continue;if(e.startsWith(`[`)){t=/^\[\s*remote\s+["']origin["']\s*\]$/.test(e);continue}if(!t)continue;let r=/^url\s*=\s*(.+)$/.exec(e);if(r)return y(r[1])}return null}function y(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}const b=[{id:`mcp-config`,write(t,n,r){let i=t.projectConfigPath?.(n);if(!i)return{integration:`mcp-config`,editorId:t.id,action:`skipped-unsupported`};try{let a=e(t,n,r,void 0,i);return a.action===`written`||a.action===`overwritten`?{integration:`mcp-config`,editorId:t.id,action:a.action,path:a.configPath}:a.action===`failed`?{integration:`mcp-config`,editorId:t.id,action:`failed`,path:a.configPath,error:a.error??`unknown failure`}:{integration:`mcp-config`,editorId:t.id,action:`failed`,path:a.configPath,error:`unexpected project-scope action: ${a.action}`}}catch(e){return{integration:`mcp-config`,editorId:t.id,action:`failed`,path:i,error:e instanceof Error?e.message:String(e)}}}},{id:`project-skill`,write(e,t,n){try{let n=r(e,t);return{integration:`project-skill`,editorId:e.id,action:n.action,...n.path?{path:n.path}:{},...n.error?{error:n.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function x(e,n,r={},i=b){let a=[];for(let o of n){let n=t[o];for(let t of i)a.push(t.write(n,e,r))}return a}function S(e,t,r={}){return{integrations:x(e,t,r),claudeLaunchJson:t.includes(`claude`)?n(e,r):void 0}}export{p as i,h as n,m as r,S as t};
|
|
2
|
+
//# sourceMappingURL=src-DmVkpI35.mjs.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e,t}from"./esm-CEs3LWY3.mjs";import{fn as n,oi as r,pi as i}from"./dist-DFP-WbfQ.mjs";import{n as a}from"./constants-BdnW1I6_.mjs";import{spawn as o}from"node:child_process";import{basename as s,join as c}from"node:path";import{closeSync as l,existsSync as u,mkdirSync as d,openSync as f,statSync as p}from"node:fs";import{homedir as m}from"node:os";import{setTimeout as h}from"node:timers/promises";const g=`Open Knowledge.app`,_=`/Applications/${g}`;function v(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return p(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function y(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(b(e,_))return _;let t=c(e.homeDir??m(),`Applications`,g);return b(e,t)?t:null}function b(e,t){try{let n=c(t,`Contents`,`MacOS`,`Open Knowledge`),r=e.statSync(n);return r&&typeof r.isFile==`function`?r.isFile():!1}catch{return!1}}function x(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`)return{available:!1,reason:`darwin-only`};let t;try{t=y(e)}catch{return{available:!1,reason:`stat-error`}}return t?e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,bundlePath:t}:e.isTTY!==!0||e.env.SSH_CONNECTION||e.env.SSH_TTY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function S(e){(e.log??(e=>console.error(e)))("Launching Open Knowledge desktop (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)");let t={...process.env};delete t.ELECTRON_RUN_AS_NODE,e.spawn(`open`,[`-b`,`com.inkeep.open-knowledge`],{detached:!0,stdio:`ignore`,env:t}).unref()}function C(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found at ${_}. Install via DMG, or omit --mode for browser mode.`;case`darwin-only`:return`Desktop app is macOS-only on this release. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect desktop bundle at ${_} (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available at ${_} but launch dispatch did not fire (caller bug).`}}function w(){let e=process.execPath,t=process.argv[1];return t?{command:e,prefixArgs:[t]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx -y @inkeep/open-knowledge@latest\`. This re-introduces the registry-fetch surface that re-exec was fixing. Observed argv: ${JSON.stringify(process.argv)}`),{command:`npx`,prefixArgs:[`-y`,`@inkeep/open-knowledge@latest`]})}function T(e,t){return e.host??t.HOST??`localhost`}function E(e){let t=s(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var D=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}};function O(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function k(e){u(e.lockDir)||d(e.lockDir,{recursive:!0});let t=f(c(e.lockDir,i),`w`),n=e.spawn??o,{PORT:r,...a}=process.env,s=w();try{let r=n(s.command,[...s.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:a});return r.unref(),r}finally{try{l(t)}catch{}}}async function A(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}const j=r;function M(e){let t=e.sigtermGraceMs??j,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>h(e));return async()=>{try{let i=e.readUiLock();if(i&&e.isAlive(i.pid))try{e.killPid(i.pid,`SIGTERM`),e.log?.info({pid:i.pid,port:i.port},`idle-shutdown: SIGTERM UI sibling`);let a=Date.now()+t;for(;Date.now()<a&&e.isAlive(i.pid);)await r(n);if(e.isAlive(i.pid))try{e.killPid(i.pid,`SIGKILL`),e.log?.warn({pid:i.pid,graceMs:t},`idle-shutdown: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: SIGKILL failed`)}}catch(t){e.log?.warn({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t instanceof Error?t.message:String(t)},`idle-shutdown: UI lookup failed; proceeding with destroy`)}await e.destroy()}}async function N(e){let{config:t,cwd:r,host:i}=e,a=e.skipAutoInit??!1,o=e.skipUiAutoSpawn??!1,s=e.idleThresholdMs??18e5,{existsSync:c,mkdirSync:l}=await import(`node:fs`),{bootServer:u,getLogger:d,isProcessAlive:f,readUiLock:p,resolveContentDir:m}=await import(`./dist-BxVp6JIv.mjs`),g=e.log??d(`start`);if(!a&&!n(r))throw new D(r);try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-h6zWAU5x.mjs`)).repairMcpConfigs)({projectDir:r})}catch(e){g.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-NZrFa4j9.mjs`)).repairLaunchJson)({projectDir:r})}catch(e){g.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}let _=m(t,r);c(_)||(l(_,{recursive:!0}),g.info({contentDir:_},`Created content directory`));let v=null,y=async({lockDir:t})=>{if(v=O({uiLock:p(t),isAlive:f}),v.action===`spawn`&&!o)try{k({lockDir:t,cwd:r,spawn:e.spawn}),g.info({reason:v.reason},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else v.action===`skip`&&g.info({port:v.port,pid:v.pid},`UI already running at port ${v.port}`)},b=e.reactShellDistDir===void 0,x=await u({config:t,contentDir:_,projectDir:r,contentRoot:t.content.dir,port:e.port,host:i,quiet:!1,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:b,idleShutdownMs:s,skipAutoInit:!0,...b?{spawnUiSiblingFn:y}:{},idleShutdownHandler:e=>M({readUiLock:()=>p(x.lockDir),isAlive:f,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:g}),log:g,...e.serveContentAssets?{serveContentAssets:!0}:{},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});v||={action:`skip`,reason:`alive`,pid:0,port:0};let S=v,C=null;if(S.action===`skip`)C=S.port>0?S.port:null;else if(!o){let t=e.uiBindTimeoutMs??3e3;C=await A({readUiLock:()=>p(x.lockDir),now:Date.now,sleep:e=>h(e),timeoutMs:t,pollIntervalMs:50}),C===null&&g.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:x.httpServer,destroy:x.destroy,lockDir:x.lockDir,contentDir:_,port:x.port,ready:x.ready,degraded:x.degraded,uiSpawnDecision:v,resolvedUiPort:C}}function P(t){if(t===`browser`||t===`app`)return t;throw new e(`--mode must be 'browser' or 'app'`)}async function F(e,t){let{renderBanner:n}=await import(`./banner-COfNQySC.mjs`),{dim:r,error:i,warning:o}=await import(`./colors-BCE2jNgl.mjs`),s=process.cwd(),c=e;process.title=E(s);let l=T(t,process.env),u=t.port===void 0?void 0:Number(t.port),d=process.env.PORT?Number(process.env.PORT):void 0,f=u??d,p;try{p=await N({config:c,cwd:s,host:l,port:f,...t.serveContentAssets?{serveContentAssets:!0}:{},...t.reactShellDistDir?{reactShellDistDir:t.reactShellDistDir}:{}})}catch(e){e instanceof D&&(console.error(i(e.message)),process.exit(1));let t=I(e,s,await import(`./dist-BxVp6JIv.mjs`));t!==null&&(console.error(i(t)),process.exit(1)),console.error(`${i(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let m=!1,h=async e=>{if(!m){m=!0,console.log(r(`\nShutting down (${e})`));try{await p.destroy()}catch(e){console.error(`${i(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{h(`SIGINT`)}),process.once(`SIGTERM`,()=>{h(`SIGTERM`)});let g=`http://${l}:${p.port}`,_=l===`0.0.0.0`||l===`::`?`http://0.0.0.0:${p.port}`:void 0,v=p.resolvedUiPort,y=v!==null&&v>0?`http://${l}:${v}`:g;console.log(n({name:`open-knowledge`,version:a,localUrl:y,apiUrl:y===g?void 0:g,networkUrl:_}));let b={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};p.ready.then(async()=>{if(p.degraded.length>0){console.log();for(let e of p.degraded){let t=b[e]??`${e} (check server logs for details)`;console.warn(` ${o(`⚠`)} ${o(e)}: ${r(t)}`)}console.log()}if(t.open){let{openBrowser:e}=await import(`./open-browser-Be-7qaQ9.mjs`);e(y)}}).catch(e=>{console.error(` ${i(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function I(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=c(t,`.ok`),r=n.readServerLock(e);return r?r.kind===`interactive`?`Open Knowledge desktop is currently running on this project. Quit it or use --cwd to point elsewhere.`:r.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function L(e){return new t(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,P).option(`--serve-content-assets`,`Serve content assets from this server`).option(`--react-shell-dist-dir <path>`,`Serve React shell from <path> (suppresses ok ui sibling)`).action(async t=>{let n=e();if(t.mode===`app`){t.open&&(process.stderr.write(`error: option '--mode=app' cannot be combined with '--open' (--open opens a browser tab against the local server, which app mode does not boot)
|
|
1
|
+
import{n as e,t}from"./esm-CEs3LWY3.mjs";import{fn as n,oi as r,pi as i}from"./dist-BPLmZd1q.mjs";import{n as a}from"./constants-VKoRHLJA.mjs";import{spawn as o}from"node:child_process";import{basename as s,join as c}from"node:path";import{closeSync as l,existsSync as u,mkdirSync as d,openSync as f,statSync as p}from"node:fs";import{homedir as m}from"node:os";import{setTimeout as h}from"node:timers/promises";const g=`Open Knowledge.app`,_=`/Applications/${g}`;function v(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return p(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function y(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(b(e,_))return _;let t=c(e.homeDir??m(),`Applications`,g);return b(e,t)?t:null}function b(e,t){try{let n=c(t,`Contents`,`MacOS`,`Open Knowledge`),r=e.statSync(n);return r&&typeof r.isFile==`function`?r.isFile():!1}catch{return!1}}function x(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`)return{available:!1,reason:`darwin-only`};let t;try{t=y(e)}catch{return{available:!1,reason:`stat-error`}}return t?e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,bundlePath:t}:e.isTTY!==!0||e.env.SSH_CONNECTION||e.env.SSH_TTY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function S(e){(e.log??(e=>console.error(e)))("Launching Open Knowledge desktop (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)");let t={...process.env};delete t.ELECTRON_RUN_AS_NODE,e.spawn(`open`,[`-b`,`com.inkeep.open-knowledge`],{detached:!0,stdio:`ignore`,env:t}).unref()}function C(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found at ${_}. Install via DMG, or omit --mode for browser mode.`;case`darwin-only`:return`Desktop app is macOS-only on this release. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect desktop bundle at ${_} (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available at ${_} but launch dispatch did not fire (caller bug).`}}function w(){let e=process.execPath,t=process.argv[1];return t?{command:e,prefixArgs:[t]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx -y @inkeep/open-knowledge@latest\`. This re-introduces the registry-fetch surface that re-exec was fixing. Observed argv: ${JSON.stringify(process.argv)}`),{command:`npx`,prefixArgs:[`-y`,`@inkeep/open-knowledge@latest`]})}function T(e,t){return e.host??t.HOST??`localhost`}function E(e){let t=s(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var D=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}};function O(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function k(e){u(e.lockDir)||d(e.lockDir,{recursive:!0});let t=f(c(e.lockDir,i),`w`),n=e.spawn??o,{PORT:r,...a}=process.env,s=w();try{let r=n(s.command,[...s.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:a});return r.unref(),r}finally{try{l(t)}catch{}}}async function A(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}const j=r;function M(e){let t=e.sigtermGraceMs??j,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>h(e));return async()=>{try{let i=e.readUiLock();if(i&&e.isAlive(i.pid))try{e.killPid(i.pid,`SIGTERM`),e.log?.info({pid:i.pid,port:i.port},`idle-shutdown: SIGTERM UI sibling`);let a=Date.now()+t;for(;Date.now()<a&&e.isAlive(i.pid);)await r(n);if(e.isAlive(i.pid))try{e.killPid(i.pid,`SIGKILL`),e.log?.warn({pid:i.pid,graceMs:t},`idle-shutdown: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: SIGKILL failed`)}}catch(t){e.log?.warn({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t instanceof Error?t.message:String(t)},`idle-shutdown: UI lookup failed; proceeding with destroy`)}await e.destroy()}}async function N(e){let{config:t,cwd:r,host:i}=e,a=e.skipAutoInit??!1,o=e.skipUiAutoSpawn??!1,s=e.idleThresholdMs??18e5,{existsSync:c,mkdirSync:l}=await import(`node:fs`),{bootServer:u,getLogger:d,isProcessAlive:f,readUiLock:p,resolveContentDir:m}=await import(`./dist-2MBFtu5K.mjs`),g=e.log??d(`start`);if(!a&&!n(r))throw new D(r);try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-DSFRe6WN.mjs`)).repairMcpConfigs)({projectDir:r})}catch(e){g.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-D5DbaOCD.mjs`)).repairLaunchJson)({projectDir:r})}catch(e){g.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}let _=m(t,r);c(_)||(l(_,{recursive:!0}),g.info({contentDir:_},`Created content directory`));let v=null,y=async({lockDir:t})=>{if(v=O({uiLock:p(t),isAlive:f}),v.action===`spawn`&&!o)try{k({lockDir:t,cwd:r,spawn:e.spawn}),g.info({reason:v.reason},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else v.action===`skip`&&g.info({port:v.port,pid:v.pid},`UI already running at port ${v.port}`)},b=e.reactShellDistDir===void 0,x=await u({config:t,contentDir:_,projectDir:r,contentRoot:t.content.dir,port:e.port,host:i,quiet:!1,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:b,idleShutdownMs:s,skipAutoInit:!0,...b?{spawnUiSiblingFn:y}:{},idleShutdownHandler:e=>M({readUiLock:()=>p(x.lockDir),isAlive:f,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:g}),log:g,...e.serveContentAssets?{serveContentAssets:!0}:{},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});v||={action:`skip`,reason:`alive`,pid:0,port:0};let S=v,C=null;if(S.action===`skip`)C=S.port>0?S.port:null;else if(!o){let t=e.uiBindTimeoutMs??3e3;C=await A({readUiLock:()=>p(x.lockDir),now:Date.now,sleep:e=>h(e),timeoutMs:t,pollIntervalMs:50}),C===null&&g.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:x.httpServer,destroy:x.destroy,lockDir:x.lockDir,contentDir:_,port:x.port,ready:x.ready,degraded:x.degraded,uiSpawnDecision:v,resolvedUiPort:C}}function P(t){if(t===`browser`||t===`app`)return t;throw new e(`--mode must be 'browser' or 'app'`)}async function F(e,t){let{renderBanner:n}=await import(`./banner-COfNQySC.mjs`),{dim:r,error:i,warning:o}=await import(`./colors-BCE2jNgl.mjs`),s=process.cwd(),c=e;process.title=E(s);let l=T(t,process.env),u=t.port===void 0?void 0:Number(t.port),d=process.env.PORT?Number(process.env.PORT):void 0,f=u??d,p;try{p=await N({config:c,cwd:s,host:l,port:f,...t.serveContentAssets?{serveContentAssets:!0}:{},...t.reactShellDistDir?{reactShellDistDir:t.reactShellDistDir}:{}})}catch(e){e instanceof D&&(console.error(i(e.message)),process.exit(1));let t=I(e,s,await import(`./dist-2MBFtu5K.mjs`));t!==null&&(console.error(i(t)),process.exit(1)),console.error(`${i(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let m=!1,h=async e=>{if(!m){m=!0,console.log(r(`\nShutting down (${e})`));try{await p.destroy()}catch(e){console.error(`${i(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{h(`SIGINT`)}),process.once(`SIGTERM`,()=>{h(`SIGTERM`)});let g=`http://${l}:${p.port}`,_=l===`0.0.0.0`||l===`::`?`http://0.0.0.0:${p.port}`:void 0,v=p.resolvedUiPort,y=v!==null&&v>0?`http://${l}:${v}`:g;console.log(n({name:`open-knowledge`,version:a,localUrl:y,apiUrl:y===g?void 0:g,networkUrl:_}));let b={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};p.ready.then(async()=>{if(p.degraded.length>0){console.log();for(let e of p.degraded){let t=b[e]??`${e} (check server logs for details)`;console.warn(` ${o(`⚠`)} ${o(e)}: ${r(t)}`)}console.log()}if(t.open){let{openBrowser:e}=await import(`./open-browser-Be-7qaQ9.mjs`);e(y)}}).catch(e=>{console.error(` ${i(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function I(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=c(t,`.ok`),r=n.readServerLock(e);return r?r.kind===`interactive`?`Open Knowledge desktop is currently running on this project. Quit it or use --cwd to point elsewhere.`:r.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function L(e){return new t(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,P).option(`--serve-content-assets`,`Serve content assets from this server`).option(`--react-shell-dist-dir <path>`,`Serve React shell from <path> (suppresses ok ui sibling)`).action(async t=>{let n=e();if(t.mode===`app`){t.open&&(process.stderr.write(`error: option '--mode=app' cannot be combined with '--open' (--open opens a browser tab against the local server, which app mode does not boot)
|
|
2
2
|
`),process.exit(2));let e=[];if(t.port!==void 0&&e.push(`--port`),t.host!==void 0&&e.push(`--host`),e.length>0){let t=process.env.OK_LOG_LEVEL??`info`;(t===`debug`||t===`trace`)&&console.error(`--mode=app: ignoring ${e.join(`, `)}`)}let n=x(v());if(n.available){S({spawn:o});return}console.error(C(n.reason)),process.exit(1)}await F(n,t)})}export{O as a,F as c,I as d,w as f,S as h,M as i,k as l,x as m,A as n,E as o,v as p,N as r,T as s,D as t,L as u};
|
|
3
|
-
//# sourceMappingURL=start-
|
|
3
|
+
//# sourceMappingURL=start-BoVa175r.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as e}from"./start-BoVa175r.mjs";export{e as startCommand};
|
package/package.json
CHANGED
package/dist/init-SvT0DYzi.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as e}from"./init-bgyN3HLJ.mjs";export{e as runInit};
|
package/dist/loader-CkywmL6Y.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./loader-D9F5yVlI.mjs";export{e as loadConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./preview-DqUI_X4G.mjs";export{t as formatPreviewBlock,e as previewContent};
|
package/dist/start-2Banq22i.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as e}from"./start-BQeItSLM.mjs";export{e as startCommand};
|