@inkeep/open-knowledge 0.30.0-beta.2 → 0.30.0-beta.4
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 +11 -11
- package/dist/config-schema.json +24 -0
- package/dist/config.project-local.schema.json +24 -0
- package/dist/constants-UBjBavXu.mjs +2 -0
- package/dist/{dist-DJ0wJimx.mjs → dist-B5JbDwWb.mjs} +1 -1
- package/dist/{dist-DAVo_TRx.mjs → dist-DXIG2Jyg.mjs} +7 -7
- package/dist/{gh-detect-BxDh8M_E.mjs → gh-detect-BMbpd_Yj.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{init-E8FDYW-D.mjs → init-CkBE_apM.mjs} +3 -3
- package/dist/init-CoL8N4la.mjs +1 -0
- package/dist/{launch-json-removal-ByWYRF7W.mjs → launch-json-removal-YtOryh7V.mjs} +2 -2
- package/dist/{loader-Bi7zAoyk.mjs → loader-BOmEZv00.mjs} +2 -2
- package/dist/loader-eceKqMkc.mjs +1 -0
- package/dist/{open-browser-6ztGUs93.mjs → open-browser-gwoFcjXN.mjs} +2 -2
- package/dist/{preview-hq0cdoZw.mjs → preview-CJm1A1UQ.mjs} +2 -2
- package/dist/preview-DHkr2cX1.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-D1snXuNs.js → ActivityModeContent-C0_GSBuC.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-C3FZ7AWB.js → CodeMirrorPropInput-C2VECyjO.js} +2 -2
- package/dist/public/assets/{DocumentContext-CPgyt-fa.js → DocumentContext-f6XQqg_y.js} +7 -7
- package/dist/public/assets/{EnableSyncConfirmDialog-a1BAa003.js → EnableSyncConfirmDialog-BhwhYBFL.js} +1 -1
- package/dist/public/assets/{GraphPanel-Dqn1R3FA.js → GraphPanel-ByzLo6-b.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-D9gtQzwY.js → ManagedArtifactProperties-DAzdDsOt.js} +1 -1
- package/dist/public/assets/{McpConsentDialogBody-B3eYpOil.js → McpConsentDialogBody-BwDo5LSJ.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-CZKy1wMI.js → MermaidDocEditor-BpnOw4CA.js} +1 -1
- package/dist/public/assets/{PropertyPanel-k3LSAy4u.js → PropertyPanel-B3wmhQBT.js} +1 -1
- package/dist/public/assets/SettingsDialogBody-DVvKGL9J.js +7 -0
- package/dist/public/assets/{ShareBranchSwitchDialog-OJA4wjqQ.js → ShareBranchSwitchDialog-i35Gg8js.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-7EizE4VA.js → ShareReceiveDialog-LrK6Us6O.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-D8Up16fz.js → ShareReceiveMissDialog-CEV0ExUm.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-B25PfvD1.js → SkillEditorActions-BoEoI6NN.js} +1 -1
- package/dist/public/assets/{SourceEditor-D_fZ07fz.js → SourceEditor-DuPpY_T6.js} +1 -1
- package/dist/public/assets/{TerminalPanel-Dw3H1oil.js → TerminalPanel-Di7sR9_K.js} +1 -1
- package/dist/public/assets/{agent-presence-c_qxeP7e.js → agent-presence-DOgDiPgh.js} +1 -1
- package/dist/public/assets/{auth-state-cache-D4z3eiMF.js → auth-state-cache-CZRVpVW6.js} +3 -3
- package/dist/public/assets/{config-provider-BONo47Qc.js → config-provider-BnOnKhga.js} +1 -1
- package/dist/public/assets/{dist-CJfVM-iJ.js → dist-D7PDymSy.js} +3 -3
- package/dist/public/assets/{dist-BDGd7UYM.js → dist-xdRBzARh.js} +1 -1
- package/dist/public/assets/{doc-hash-BLS3MEoj.js → doc-hash-i5oNLfum.js} +1 -1
- package/dist/public/assets/{documents-events-H4-z8Qjp.js → documents-events-D26lhbOZ.js} +1 -1
- package/dist/public/assets/file-tree-adapter-N1FVhfKw.js +1 -0
- package/dist/public/assets/index-KSKNKDpJ.js +2003 -0
- package/dist/public/assets/{keyboard-shortcuts-DnJWzgZ1.js → keyboard-shortcuts-Bgozgsx2.js} +1 -1
- package/dist/public/assets/navigation-targets-D_wZddL9.js +1 -0
- package/dist/public/assets/{open-managed-artifact-tab-NBmHUyDy.js → open-managed-artifact-tab-kOn8WHrp.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-D7JjzV1n.js → pending-receive-nav-store-CDyGvnwD.js} +1 -1
- package/dist/public/assets/{prop-types-Cl1SYZho.js → prop-types-BK5m4zFC.js} +1 -1
- package/dist/public/assets/{receive-store-DWC9dc5j.js → receive-store-Jc3PEGIh.js} +1 -1
- package/dist/public/assets/{selection-context-DALYXIVY.js → selection-context-72mLve4s.js} +1 -1
- package/dist/public/assets/{skill-actions-BV30AE89.js → skill-actions-CeU8Dbpm.js} +1 -1
- package/dist/public/assets/{skills-api-B0z9Mw2W.js → skills-api-k47WvkqQ.js} +1 -1
- package/dist/public/assets/{src-DZ97WDxX.js → src-B6vksAtW.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-CpKCAQDV.js → target-navigation-intent-DEwTup1R.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-ko_Nb-fG.js → typing-burst-detector-BC1YUpwK.js} +1 -1
- package/dist/public/assets/{workspace-paths-CMbeqczX.js → workspace-paths-D4weWrbA.js} +1 -1
- package/dist/public/index.html +25 -25
- package/dist/{repair-launch-json-BdfDMobg.mjs → repair-launch-json-DO2QDHDR.mjs} +2 -2
- package/dist/{repair-mcp-configs-DZMxi-7M.mjs → repair-mcp-configs-RYSmTXdj.mjs} +2 -2
- package/dist/{repair-skills-zutt1is6.mjs → repair-skills-BrAdfxB-.mjs} +2 -2
- package/dist/repair-skills-NtsjF26d.mjs +1 -0
- package/dist/schemas/v0/config.project-local.schema.json +24 -0
- package/dist/server-lock-GuuouVft-CXM0Fdz7.mjs +1 -0
- package/dist/{server-lock-iLcBw_q0-RDMfTH6b.mjs → server-lock-iLcBw_q0-DB1Ahu2b.mjs} +3 -3
- package/dist/{src-Bi9Si6vM.mjs → src-2ZRymDy2.mjs} +2 -2
- package/dist/{start-DqcZAaBv.mjs → start-CR2-ryWz.mjs} +2 -2
- package/dist/start-D2aYJnFK.mjs +1 -0
- package/dist/{write-project-skill-BzVHToYO.mjs → write-project-skill-XZCJ5TEZ.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-BGBZW_Qv.mjs +0 -2
- package/dist/init-B02GcqsQ.mjs +0 -1
- package/dist/loader-CT3CzsPt.mjs +0 -1
- package/dist/preview-DtuXRRGi.mjs +0 -1
- package/dist/public/assets/SettingsDialogBody-do88Fri6.js +0 -7
- package/dist/public/assets/file-tree-adapter-B8tTfm_Y.js +0 -1
- package/dist/public/assets/index-Ci4eWUi8.js +0 -2003
- package/dist/public/assets/navigation-targets-DM3L8UZy.js +0 -1
- package/dist/repair-skills-B0TdudPZ.mjs +0 -1
- package/dist/server-lock-GuuouVft-CCnjEa8y.mjs +0 -1
- package/dist/start-CDJKwObu.mjs +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Mn as e,ht as t}from"./server-lock-iLcBw_q0-RDMfTH6b.mjs";import{Or as n,ar as r,vr as i}from"./dist-DAVo_TRx.mjs";import{n as a,t as o}from"./esm-CsQUg9js.mjs";import{i as s,t as c}from"./gh-detect-BxDh8M_E.mjs";import{n as l}from"./constants-BGBZW_Qv.mjs";import{spawn as u}from"node:child_process";import{basename as d,dirname as f,join as p}from"node:path";import{homedir as m}from"node:os";import{closeSync as h,existsSync as g,mkdirSync as _,openSync as v,statSync as y}from"node:fs";import{rm as b}from"node:fs/promises";import{setTimeout as x}from"node:timers/promises";const S=`OpenKnowledge.app`,C=`/Applications/${S}`;function w(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return y(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function T(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(E(e,C))return C;let t=p(e.homeDir??m(),`Applications`,S);return E(e,t)?t:null}function E(e,t){try{let n=p(t,`Contents`,`MacOS`,`OpenKnowledge`),r=e.statSync(n);return r&&typeof r.isFile==`function`?r.isFile():!1}catch{return!1}}function D(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=T(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 O(e){(e.log??(e=>console.error(e)))("Launching OpenKnowledge 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 k(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found at ${C}. 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 ${C} (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available at ${C} but launch dispatch did not fire (caller bug).`}}function A(e){return p(f(e),`..`,`Frameworks`,`OpenKnowledge Server.app`,`Contents`,`MacOS`,`OpenKnowledge Helper`)}const j=/\/[^/]+\.app\/Contents\/MacOS\/[^/]+$/;function M(e){if(e.platform!==`darwin`||!j.test(e.execPath))return null;let t=A(e.execPath);return e.exists(t)?t:null}function N(e={}){let t=e.execPath??process.execPath,n=e.platform??process.platform,r=e.argv??process.argv,i=e.exists??g,a=r[1];return a?{command:M({execPath:t,platform:n,exists:i})??t,prefixArgs:[a]}:(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(r)}`),{command:`npx`,prefixArgs:[`-y`,`@inkeep/open-knowledge@latest`]})}function P(e,t){return e.host??t.HOST??`127.0.0.1`}function F(e){let t=d(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var I=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 L(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 R(t){g(t.lockDir)||_(t.lockDir,{recursive:!0});let n=v(p(t.lockDir,e),`w`),r=t.spawn??u,{PORT:i,...a}=process.env,o=N();try{let e=r(o.command,[...o.prefixArgs,...t.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,n],windowsHide:!0,cwd:t.cwd,env:{...a,ELECTRON_RUN_AS_NODE:`1`}});return e.unref(),e}finally{try{h(n)}catch{}}}function z(e,t,n){return e??(n===void 0?t:void 0)}function B(e,t){return e!==void 0&&t!==null&&t.port>0&&t.draining!==!0}function V(e,t,n){return e??(t!=null&&!n?1:0)}async function H(e){let t=e.spawn??u,n=N(),{PORT:r,...i}=process.env,a=t(n.command,[...n.prefixArgs,`ui`,`--port`,String(e.uiPort)],{cwd:e.cwd,stdio:`inherit`,windowsHide:!0,env:{...i,ELECTRON_RUN_AS_NODE:`1`}}),o=!1,s=e=>{o=!0;try{a.kill(e)}catch{}},c=()=>s(`SIGINT`),l=()=>s(`SIGTERM`);process.once(`SIGINT`,c),process.once(`SIGTERM`,l),await new Promise(e=>{a.on(`exit`,(t,n)=>{process.exitCode=V(t,n,o),e()}),a.on(`error`,t=>{console.error(`[start] connect fallback: failed to spawn ok ui — ${t instanceof Error?t.message:String(t)}`),process.exitCode=1,e()})}),process.removeListener(`SIGINT`,c),process.removeListener(`SIGTERM`,l)}async function U(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 W=t;function G(e,t,n=e=>b(e,{recursive:!0,force:!0})){return async()=>{try{await e()}finally{try{await n(t)}catch(e){process.stderr.write(`[start] ephemeral temp dir reap failed for ${t}: ${e instanceof Error?e.message:String(e)}\n`)}}}}function K(e,t={}){let n=t.exit??(e=>process.exit(e)),r=t.getActiveHandles??(()=>{let e=process._getActiveHandles;return e?e.call(process):null});return async()=>{let i=!1;try{await e()}catch(e){i=!0,t.log?.error({err:e},`idle-shutdown: destroy failed — exiting anyway`)}finally{let e=null;try{let t=r();if(t!==null){e={};for(let n of t){let t=n?.constructor?.name??`unknown`;e[t]=(e[t]??0)+1}}}catch{e=null}t.log?.info({event:`idle-shutdown-exit`,exitCode:i?1:0,openHandles:e??{},handlesAvailable:e!==null},`idle-shutdown: teardown finished — exiting process`),n(i?1:0)}}}function q(e){let t=e.sigtermGraceMs??W,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>x(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 J(e){let{config:t,cwd:a,host:o}=e,l=e.skipAutoInit??!1,u=e.skipUiAutoSpawn??!1,d=e.idleThresholdMs??18e5,{existsSync:f,mkdirSync:p}=await import(`node:fs`),{basename:m,dirname:h}=await import(`node:path`),{bootServer:g,getLogger:_,isProcessAlive:v,readUiLock:y,resolveContentDir:b,resolveLockDir:S,waitForServerLockDrain:C}=await import(`./dist-DJ0wJimx.mjs`),w=e.log??_(`start`),T=e.singleFile!==void 0,E=e.projectDir??a,D=T?n(e.singleFile).canonicalFilePath:void 0,O=D?h(D):void 0,k=D?m(D):void 0;if(!T){if(!l&&!r(a))throw new I(a);let t=process.env.OK_RECLAIM_DISABLE??null,n=e=>{let t=typeof e.event==`string`?e.event:``;(t.endsWith(`-failed`)||t.endsWith(`-error`)||t.endsWith(`-missing`))&&w.warn({event:e},`[start] reclaim sweep reported a problem`)};try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-DZMxi-7M.mjs`)).repairMcpConfigs)({projectDir:a,reclaimDisableEnv:t,logger:n})}catch(e){w.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-BdfDMobg.mjs`)).repairLaunchJson)({projectDir:a,reclaimDisableEnv:t,logger:n})}catch(e){w.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-B0TdudPZ.mjs`)).repairSkills)({projectDir:a,reclaimDisableEnv:t,logger:n})}catch(e){w.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let A=O??b(t,a);!T&&!f(A)&&(p(A,{recursive:!0}),w.info({contentDir:A},`Created content directory`));let j=null,M=async({lockDir:t})=>{if(j=L({uiLock:y(t),isAlive:v}),j.action===`spawn`&&!u)try{let n=e.uiPort===void 0?void 0:[`ui`,`--port`,String(e.uiPort)];R({lockDir:t,cwd:a,spawn:e.spawn,args:n}),w.info({reason:j.reason,uiPort:e.uiPort},`[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 j.action===`skip`&&w.info({port:j.port,pid:j.pid},`UI already running at port ${j.port}`)},N=e.reactShellDistDir===void 0,P=s(),F=i();{let e=S(T?E:a),t=Date.now(),n=await C(e);n!==`no-drain`&&w.info({event:`start-waited-for-draining-predecessor`,outcome:n,waitedMs:Date.now()-t,drainLockDir:e},n===`released`?`[start] predecessor server finished draining — proceeding`:`[start] predecessor server still draining after wait — proceeding to collide`)}let z=await g({config:t,contentDir:A,projectDir:T?E:a,contentRoot:T?void 0:t.content.dir,port:e.port,host:o,quiet:!1,detectGh:c,tokenStore:P,embeddingsKeyStore:F,...T?{ephemeral:!0,singleDocRelPath:k,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:N,idleShutdownMs:d,skipAutoInit:!0,...N?{spawnUiSiblingFn:M}:{},idleShutdownHandler:t=>{let n=q({readUiLock:()=>y(z.lockDir),isAlive:v,killPid:(e,t)=>{process.kill(e,t)},destroy:t,log:w});return K(T?G(n,E):n,{log:w,exit:e.idleExit})},log:w,...e.serveContentAssets?{serveContentAssets:!0}:{},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});j||={action:`skip`,reason:`alive`,pid:0,port:0};let B=j,V=null;if(B.action===`skip`)V=B.port>0?B.port:null;else if(!u){let t=e.uiBindTimeoutMs??3e3;V=await U({readUiLock:()=>y(z.lockDir),now:Date.now,sleep:e=>x(e),timeoutMs:t,pollIntervalMs:50}),V===null&&w.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:z.httpServer,destroy:z.destroy,lockDir:z.lockDir,contentDir:A,port:z.port,ready:z.ready,degraded:z.degraded,uiSpawnDecision:j,resolvedUiPort:V}}function ee(e){if(e===`browser`||e===`app`)return e;throw new a(`--mode must be 'browser' or 'app'`)}function te(e){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<1||t>65535)throw new a(`--ui-port must be a port number between 1 and 65535`);return t}function Y(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function X(e){let t=[`Stopping OpenKnowledge…`,`Saving pending changes and releasing the server lock — this can take a few seconds.`];return e===`SIGINT`&&t.push(`Press Ctrl+C again to force quit.`),t}async function Z(e,t){let n=Y(process.env);n!==null&&(process.env.OK_CONSOLE_LEVEL=n);let{renderBanner:r}=await import(`./banner-BLebOalA.mjs`),{accent:i,dim:a,error:o,warning:s}=await import(`./colors-CmkIIbww.mjs`),c=process.cwd(),u=e;process.title=F(c);let d=P(t,process.env),f=t.port===void 0?void 0:Number(t.port),p=process.env.PORT?Number(process.env.PORT):void 0,m=t.uiPort===void 0?void 0:Number(t.uiPort),h=z(f,p,m);if(m!==void 0){let{readServerLock:e,resolveLockDir:t}=await import(`./dist-DJ0wJimx.mjs`);if(B(m,e(t(c)))){await H({cwd:c,uiPort:m});return}}let g;try{g=await J({config:u,cwd:c,host:d,port:h,...m===void 0?{}:{uiPort:m},...t.serveContentAssets?{serveContentAssets:!0}:{},...t.reactShellDistDir?{reactShellDistDir:t.reactShellDistDir}:{},...t.singleFile?{singleFile:t.singleFile}:{},...t.projectDir?{projectDir:t.projectDir}:{}})}catch(e){e instanceof I&&(console.error(o(e.message)),process.exit(1));let t=await import(`./dist-DJ0wJimx.mjs`);if((e instanceof t.GitNotAvailableError||e instanceof t.GitTooOldError)&&process.exit(78),(e instanceof t.SingleFileNotFoundError||e instanceof t.SingleFileNotAFileError||e instanceof t.SingleFileNotMarkdownError)&&(console.error(o(e.message)),process.exit(1)),m!==void 0&&Q(e,t)){await H({cwd:c,uiPort:m});return}let n=$(e,c,t);n!==null&&(console.error(o(n)),process.exit(1)),console.error(`${o(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let _=!1,v=async e=>{if(_)return;_=!0;let[t,...n]=X(e);console.log(i(`\n${t}`));for(let e of n)console.log(a(` ${e}`));try{await g.destroy()}catch(e){console.error(`${o(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)};process.once(`SIGINT`,()=>{v(`SIGINT`)}),process.once(`SIGTERM`,()=>{v(`SIGTERM`)});let y=`http://${d}:${g.port}`,b=d===`0.0.0.0`||d===`::`?`http://0.0.0.0:${g.port}`:void 0,x=g.resolvedUiPort,S=x!==null&&x>0?`http://${d}:${x}`:y;console.log(r({name:`open-knowledge`,version:l,localUrl:S,apiUrl:S===y?void 0:y,networkUrl:b,nextSteps:[`Open the Editor URL in your browser to start editing.`]}));let C={"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`};g.ready.then(async()=>{if(g.degraded.length>0){console.log();for(let e of g.degraded){let t=C[e]??`${e} (check server logs for details)`;console.warn(` ${s(`⚠`)} ${s(e)}: ${a(t)}`)}console.log()}if(t.open){let{openBrowser:e}=await import(`./open-browser-6ztGUs93.mjs`);e(S)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function Q(e,t){let n=t.ServerLockCollisionError;return n!==void 0&&e instanceof n}function $(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=p(t,`.ok`),r=n.readServerLock(e);return r?r.kind===`interactive`?`OpenKnowledge 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`.":"OpenKnowledge server is already running on this project — check `ok status` or `ok stop`.":"OpenKnowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function ne(e){return new o(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`--ui-port <port>`,`Pin the ok ui sibling to <port> and connect (not exit) if a server already runs here — the worktree-preview recipe path`,te).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,ee).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)`).option(`--single-file <path>`,`No-project ephemeral single-file mode: scope the server to one markdown file (git + MCP off)`).option(`--project-dir <dir>`,`Throwaway project root for --single-file (where ephemeral .ok/ state lives)`).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{Mn as e,ht as t}from"./server-lock-iLcBw_q0-DB1Ahu2b.mjs";import{Or as n,ar as r,vr as i}from"./dist-DXIG2Jyg.mjs";import{n as a,t as o}from"./esm-CsQUg9js.mjs";import{i as s,t as c}from"./gh-detect-BMbpd_Yj.mjs";import{n as l}from"./constants-UBjBavXu.mjs";import{spawn as u}from"node:child_process";import{basename as d,dirname as f,join as p}from"node:path";import{homedir as m}from"node:os";import{closeSync as h,existsSync as g,mkdirSync as _,openSync as v,statSync as y}from"node:fs";import{rm as b}from"node:fs/promises";import{setTimeout as x}from"node:timers/promises";const S=`OpenKnowledge.app`,C=`/Applications/${S}`;function w(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return y(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function T(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(E(e,C))return C;let t=p(e.homeDir??m(),`Applications`,S);return E(e,t)?t:null}function E(e,t){try{let n=p(t,`Contents`,`MacOS`,`OpenKnowledge`),r=e.statSync(n);return r&&typeof r.isFile==`function`?r.isFile():!1}catch{return!1}}function D(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=T(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 O(e){(e.log??(e=>console.error(e)))("Launching OpenKnowledge 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 k(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found at ${C}. 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 ${C} (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available at ${C} but launch dispatch did not fire (caller bug).`}}function A(e){return p(f(e),`..`,`Frameworks`,`OpenKnowledge Server.app`,`Contents`,`MacOS`,`OpenKnowledge Helper`)}const j=/\/[^/]+\.app\/Contents\/MacOS\/[^/]+$/;function M(e){if(e.platform!==`darwin`||!j.test(e.execPath))return null;let t=A(e.execPath);return e.exists(t)?t:null}function N(e={}){let t=e.execPath??process.execPath,n=e.platform??process.platform,r=e.argv??process.argv,i=e.exists??g,a=r[1];return a?{command:M({execPath:t,platform:n,exists:i})??t,prefixArgs:[a]}:(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(r)}`),{command:`npx`,prefixArgs:[`-y`,`@inkeep/open-knowledge@latest`]})}function P(e,t){return e.host??t.HOST??`127.0.0.1`}function F(e){let t=d(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var I=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 L(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 R(t){g(t.lockDir)||_(t.lockDir,{recursive:!0});let n=v(p(t.lockDir,e),`w`),r=t.spawn??u,{PORT:i,...a}=process.env,o=N();try{let e=r(o.command,[...o.prefixArgs,...t.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,n],windowsHide:!0,cwd:t.cwd,env:{...a,ELECTRON_RUN_AS_NODE:`1`}});return e.unref(),e}finally{try{h(n)}catch{}}}function z(e,t,n){return e??(n===void 0?t:void 0)}function B(e,t){return e!==void 0&&t!==null&&t.port>0&&t.draining!==!0}function V(e,t,n){return e??(t!=null&&!n?1:0)}async function H(e){let t=e.spawn??u,n=N(),{PORT:r,...i}=process.env,a=t(n.command,[...n.prefixArgs,`ui`,`--port`,String(e.uiPort)],{cwd:e.cwd,stdio:`inherit`,windowsHide:!0,env:{...i,ELECTRON_RUN_AS_NODE:`1`}}),o=!1,s=e=>{o=!0;try{a.kill(e)}catch{}},c=()=>s(`SIGINT`),l=()=>s(`SIGTERM`);process.once(`SIGINT`,c),process.once(`SIGTERM`,l),await new Promise(e=>{a.on(`exit`,(t,n)=>{process.exitCode=V(t,n,o),e()}),a.on(`error`,t=>{console.error(`[start] connect fallback: failed to spawn ok ui — ${t instanceof Error?t.message:String(t)}`),process.exitCode=1,e()})}),process.removeListener(`SIGINT`,c),process.removeListener(`SIGTERM`,l)}async function U(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 W=t;function G(e,t,n=e=>b(e,{recursive:!0,force:!0})){return async()=>{try{await e()}finally{try{await n(t)}catch(e){process.stderr.write(`[start] ephemeral temp dir reap failed for ${t}: ${e instanceof Error?e.message:String(e)}\n`)}}}}function K(e,t={}){let n=t.exit??(e=>process.exit(e)),r=t.getActiveHandles??(()=>{let e=process._getActiveHandles;return e?e.call(process):null});return async()=>{let i=!1;try{await e()}catch(e){i=!0,t.log?.error({err:e},`idle-shutdown: destroy failed — exiting anyway`)}finally{let e=null;try{let t=r();if(t!==null){e={};for(let n of t){let t=n?.constructor?.name??`unknown`;e[t]=(e[t]??0)+1}}}catch{e=null}t.log?.info({event:`idle-shutdown-exit`,exitCode:i?1:0,openHandles:e??{},handlesAvailable:e!==null},`idle-shutdown: teardown finished — exiting process`),n(i?1:0)}}}function q(e){let t=e.sigtermGraceMs??W,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>x(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 J(e){let{config:t,cwd:a,host:o}=e,l=e.skipAutoInit??!1,u=e.skipUiAutoSpawn??!1,d=e.idleThresholdMs??18e5,{existsSync:f,mkdirSync:p}=await import(`node:fs`),{basename:m,dirname:h}=await import(`node:path`),{bootServer:g,getLogger:_,isProcessAlive:v,readUiLock:y,resolveContentDir:b,resolveLockDir:S,waitForServerLockDrain:C}=await import(`./dist-B5JbDwWb.mjs`),w=e.log??_(`start`),T=e.singleFile!==void 0,E=e.projectDir??a,D=T?n(e.singleFile).canonicalFilePath:void 0,O=D?h(D):void 0,k=D?m(D):void 0;if(!T){if(!l&&!r(a))throw new I(a);let t=process.env.OK_RECLAIM_DISABLE??null,n=e=>{let t=typeof e.event==`string`?e.event:``;(t.endsWith(`-failed`)||t.endsWith(`-error`)||t.endsWith(`-missing`))&&w.warn({event:e},`[start] reclaim sweep reported a problem`)};try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-RYSmTXdj.mjs`)).repairMcpConfigs)({projectDir:a,reclaimDisableEnv:t,logger:n})}catch(e){w.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-DO2QDHDR.mjs`)).repairLaunchJson)({projectDir:a,reclaimDisableEnv:t,logger:n})}catch(e){w.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-NtsjF26d.mjs`)).repairSkills)({projectDir:a,reclaimDisableEnv:t,logger:n})}catch(e){w.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let A=O??b(t,a);!T&&!f(A)&&(p(A,{recursive:!0}),w.info({contentDir:A},`Created content directory`));let j=null,M=async({lockDir:t})=>{if(j=L({uiLock:y(t),isAlive:v}),j.action===`spawn`&&!u)try{let n=e.uiPort===void 0?void 0:[`ui`,`--port`,String(e.uiPort)];R({lockDir:t,cwd:a,spawn:e.spawn,args:n}),w.info({reason:j.reason,uiPort:e.uiPort},`[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 j.action===`skip`&&w.info({port:j.port,pid:j.pid},`UI already running at port ${j.port}`)},N=e.reactShellDistDir===void 0,P=s(),F=i();{let e=S(T?E:a),t=Date.now(),n=await C(e);n!==`no-drain`&&w.info({event:`start-waited-for-draining-predecessor`,outcome:n,waitedMs:Date.now()-t,drainLockDir:e},n===`released`?`[start] predecessor server finished draining — proceeding`:`[start] predecessor server still draining after wait — proceeding to collide`)}let z=await g({config:t,contentDir:A,projectDir:T?E:a,contentRoot:T?void 0:t.content.dir,port:e.port,host:o,quiet:!1,detectGh:c,tokenStore:P,embeddingsKeyStore:F,...T?{ephemeral:!0,singleDocRelPath:k,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:N,idleShutdownMs:d,skipAutoInit:!0,...N?{spawnUiSiblingFn:M}:{},idleShutdownHandler:t=>{let n=q({readUiLock:()=>y(z.lockDir),isAlive:v,killPid:(e,t)=>{process.kill(e,t)},destroy:t,log:w});return K(T?G(n,E):n,{log:w,exit:e.idleExit})},log:w,...e.serveContentAssets?{serveContentAssets:!0}:{},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});j||={action:`skip`,reason:`alive`,pid:0,port:0};let B=j,V=null;if(B.action===`skip`)V=B.port>0?B.port:null;else if(!u){let t=e.uiBindTimeoutMs??3e3;V=await U({readUiLock:()=>y(z.lockDir),now:Date.now,sleep:e=>x(e),timeoutMs:t,pollIntervalMs:50}),V===null&&w.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:z.httpServer,destroy:z.destroy,lockDir:z.lockDir,contentDir:A,port:z.port,ready:z.ready,degraded:z.degraded,uiSpawnDecision:j,resolvedUiPort:V}}function ee(e){if(e===`browser`||e===`app`)return e;throw new a(`--mode must be 'browser' or 'app'`)}function te(e){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<1||t>65535)throw new a(`--ui-port must be a port number between 1 and 65535`);return t}function Y(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function X(e){let t=[`Stopping OpenKnowledge…`,`Saving pending changes and releasing the server lock — this can take a few seconds.`];return e===`SIGINT`&&t.push(`Press Ctrl+C again to force quit.`),t}async function Z(e,t){let n=Y(process.env);n!==null&&(process.env.OK_CONSOLE_LEVEL=n);let{renderBanner:r}=await import(`./banner-BLebOalA.mjs`),{accent:i,dim:a,error:o,warning:s}=await import(`./colors-CmkIIbww.mjs`),c=process.cwd(),u=e;process.title=F(c);let d=P(t,process.env),f=t.port===void 0?void 0:Number(t.port),p=process.env.PORT?Number(process.env.PORT):void 0,m=t.uiPort===void 0?void 0:Number(t.uiPort),h=z(f,p,m);if(m!==void 0){let{readServerLock:e,resolveLockDir:t}=await import(`./dist-B5JbDwWb.mjs`);if(B(m,e(t(c)))){await H({cwd:c,uiPort:m});return}}let g;try{g=await J({config:u,cwd:c,host:d,port:h,...m===void 0?{}:{uiPort:m},...t.serveContentAssets?{serveContentAssets:!0}:{},...t.reactShellDistDir?{reactShellDistDir:t.reactShellDistDir}:{},...t.singleFile?{singleFile:t.singleFile}:{},...t.projectDir?{projectDir:t.projectDir}:{}})}catch(e){e instanceof I&&(console.error(o(e.message)),process.exit(1));let t=await import(`./dist-B5JbDwWb.mjs`);if((e instanceof t.GitNotAvailableError||e instanceof t.GitTooOldError)&&process.exit(78),(e instanceof t.SingleFileNotFoundError||e instanceof t.SingleFileNotAFileError||e instanceof t.SingleFileNotMarkdownError)&&(console.error(o(e.message)),process.exit(1)),m!==void 0&&Q(e,t)){await H({cwd:c,uiPort:m});return}let n=$(e,c,t);n!==null&&(console.error(o(n)),process.exit(1)),console.error(`${o(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let _=!1,v=async e=>{if(_)return;_=!0;let[t,...n]=X(e);console.log(i(`\n${t}`));for(let e of n)console.log(a(` ${e}`));try{await g.destroy()}catch(e){console.error(`${o(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)};process.once(`SIGINT`,()=>{v(`SIGINT`)}),process.once(`SIGTERM`,()=>{v(`SIGTERM`)});let y=`http://${d}:${g.port}`,b=d===`0.0.0.0`||d===`::`?`http://0.0.0.0:${g.port}`:void 0,x=g.resolvedUiPort,S=x!==null&&x>0?`http://${d}:${x}`:y;console.log(r({name:`open-knowledge`,version:l,localUrl:S,apiUrl:S===y?void 0:y,networkUrl:b,nextSteps:[`Open the Editor URL in your browser to start editing.`]}));let C={"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`};g.ready.then(async()=>{if(g.degraded.length>0){console.log();for(let e of g.degraded){let t=C[e]??`${e} (check server logs for details)`;console.warn(` ${s(`⚠`)} ${s(e)}: ${a(t)}`)}console.log()}if(t.open){let{openBrowser:e}=await import(`./open-browser-gwoFcjXN.mjs`);e(S)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function Q(e,t){let n=t.ServerLockCollisionError;return n!==void 0&&e instanceof n}function $(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=p(t,`.ok`),r=n.readServerLock(e);return r?r.kind===`interactive`?`OpenKnowledge 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`.":"OpenKnowledge server is already running on this project — check `ok status` or `ok stop`.":"OpenKnowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function ne(e){return new o(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`--ui-port <port>`,`Pin the ok ui sibling to <port> and connect (not exit) if a server already runs here — the worktree-preview recipe path`,te).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,ee).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)`).option(`--single-file <path>`,`No-project ephemeral single-file mode: scope the server to one markdown file (git + MCP off)`).option(`--project-dir <dir>`,`Throwaway project root for --single-file (where ephemeral .ok/ state lives)`).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.uiPort!==void 0&&e.push(`--ui-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=D(w());if(n.available){O({spawn:u});return}console.error(k(n.reason)),process.exit(1)}await Z(n,t)})}export{D as C,w as S,ne as _,V as a,K as b,F as c,z as d,P as f,R as g,B as h,q as i,X as l,Z as m,U as n,H as o,Y as p,J as r,L as s,I as t,Q as u,$ as v,O as w,N as x,G as y};
|
|
3
|
-
//# sourceMappingURL=start-
|
|
3
|
+
//# sourceMappingURL=start-CR2-ryWz.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,f as t,r as n}from"./start-CR2-ryWz.mjs";export{n as bootStartServer,t as resolveHost,e as startCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{It as e,S as t,an as n,wt as r}from"./server-lock-iLcBw_q0-
|
|
1
|
+
import{It as e,S as t,an as n,wt as r}from"./server-lock-iLcBw_q0-DB1Ahu2b.mjs";import{Xr as i,d as a,lt as o}from"./dist-DXIG2Jyg.mjs";import{basename as s,dirname as c,isAbsolute as ee,join as l,posix as u,relative as d,resolve as f,sep as p,win32 as m}from"node:path";import{homedir as h}from"node:os";import{cpSync as te,existsSync as g,lstatSync as _,mkdirSync as v,realpathSync as y,rmSync as b}from"node:fs";const x=t,S=r,C=e,w=`node`,T={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`},ne=`# ok-mcp-v1`,E=`# ok-mcp-v1
|
|
2
2
|
USER_BUNDLE="$HOME/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
|
|
3
3
|
[ -f "$USER_BUNDLE" ] && [ -x "$USER_BUNDLE" ] && exec "$USER_BUNDLE" mcp
|
|
4
4
|
BUNDLE="/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
|
|
@@ -33,4 +33,4 @@ foreach ($d in $dirs) {
|
|
|
33
33
|
}
|
|
34
34
|
[Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g @inkeep/open-knowledge), then restart your editor')
|
|
35
35
|
exit 127`,k=`// ok-pi-bridge`,A=`${k}-v1`,j=`ok-pi-managed-extension`;function M(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return typeof e==`string`&&e.includes(`# ok-mcp-v1`)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return typeof e==`string`&&e.includes(`# ok-mcp-v1`)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(A)}return!1}function N(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=f(e);if(s(t)===`cli.mjs`&&s(c(t))===`dist`)return t;let n=t.split(p),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r);return l(i.length===0?p:i.join(p),`packages`,`cli`,`dist`,`cli.mjs`)}function P(e={}){return e.mode===`dev`?{command:w,args:[N(),`mcp`],env:{...T}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,O]}:{command:`/bin/sh`,args:[`-l`,`-c`,E]}}function re(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[w,N(),`mcp`],environment:{...T}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,O]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,E]}}function ie(e){if(typeof e!=`object`||!e)return!1;let t=e;return F(t,P({mode:`published`,platformName:`darwin`}))||F(t,P({mode:`published`,platformName:`win32`}))}function F(e,t){if(Object.keys(e).length!==Object.keys(t).length||e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function I(e){return e===`win32`?m:u}function ae(e={}){let t=e.platformName??process.platform,n=e.home??h(),r=e.env??process.env,i=I(t);return t===`darwin`?i.join(n,`Library`,`Application Support`):t===`win32`?r.APPDATA??i.join(n,`AppData`,`Roaming`):r.XDG_CONFIG_HOME??i.join(n,`.config`)}function L(e={}){let t=e.platformName??process.platform,n=e.home??h();return I(t).join(n,`.claude.json`)}function R(e={}){let t=e.platformName??process.platform,n=e.home??h(),r=e.env??process.env;if(t===`darwin`)return u.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??m.join(n,`AppData`,`Roaming`);return m.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function z(e={}){let t=e.platformName??process.platform,n=e.home??h();return I(t).join(n,`.cursor`,`mcp.json`)}function B(e={}){let t=e.platformName??process.platform,n=e.home??h();return(e.env??process.env).CODEX_HOME??I(t).join(n,`.codex`)}function V(e={}){return I(e.platformName??process.platform).join(B(e),`config.toml`)}function H(e={}){let t=e.platformName??process.platform,n=e.home??h(),r=e.env??process.env,i=I(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function U(e={}){return I(e.platformName??process.platform).join(H(e),`opencode.json`)}function W(e={}){let t=e.platformName??process.platform,n=e.home??h();return I(t).join(n,`.openclaw`,`openclaw.json`)}function G(e={}){let t=e.platformName??process.platform,n=e.home??h();return I(t).join(n,`.hermes`,`config.yaml`)}function K(e={}){let t=e.platformName??process.platform,n=e.home??h();return(e.env??process.env).PI_CODING_AGENT_DIR??I(t).join(n,`.pi`,`agent`)}function q(e={}){let t=e.platformName??process.platform,n=e.home??h();return I(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function oe(e,t){let n=I(t),r=n.join(e,`.lmstudio`,`mcp.json`),i=n.join(e,`.cache`,`lm-studio`,`mcp.json`);return t===`darwin`?[i,r]:[r,i]}function J(e={}){let t=e.platformName??process.platform,n=oe(e.home??h(),t);return n.find(e=>g(e))||n.find(e=>g(c(e)))||n[0]}const Y={claude:{id:`claude`,label:S.claude,configPath:(e,t)=>L({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>n,buildEntry:(e,t)=>P(t),scope:`global`,detectPath:(e,t)=>l(t??h(),`.claude`),projectConfigPath:e=>l(e,`.mcp.json`),projectSkillPath:e=>l(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:S[`claude-desktop`],configPath:(e,t)=>R({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>n,buildEntry:(e,t)=>P(t),scope:`global`,detectPath:(e,t)=>c(R({home:t}))},cursor:{id:`cursor`,label:S.cursor,configPath:(e,t)=>z({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>n,buildEntry:(e,t)=>P(t),scope:`global`,detectPath:(e,t)=>c(z({home:t})),projectConfigPath:e=>l(e,`.cursor`,`mcp.json`),projectSkillPath:e=>l(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:S.codex,configPath:(e,t)=>V({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>n,buildEntry:(e,t)=>P(t),scope:`global`,detectPath:(e,t)=>c(V({home:t})),projectConfigPath:e=>l(e,`.codex`,`config.toml`),projectSkillPath:e=>l(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:S.opencode,configPath:(e,t)=>U({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>n,buildEntry:(e,t)=>re(t),scope:`global`,detectPath:(e,t)=>c(U({home:t})),projectConfigPath:e=>l(e,`opencode.json`),projectSkillPath:e=>l(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:S.openclaw,configPath:(e,t)=>W({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>n,buildEntry:(e,t)=>P(t),scope:`global`,detectPath:(e,t)=>l(t??h(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:S.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>n,buildEntry:()=>{throw Error(`Pi has no MCP entry shape; the managed bridge file is built by buildPiExtensionSource (integrations/pi-extension.ts).`)},scope:`project`,detectPath:(e,t)=>K({home:t}),projectConfigPath:e=>l(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>l(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:S.antigravity,configPath:(e,t)=>q({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>n,buildEntry:(e,t)=>P(t),scope:`global`,detectPath:(e,t)=>l(t??h(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:S[`lm-studio`],configPath:(e,t)=>J({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>n,buildEntry:(e,t)=>P(t),scope:`global`,detectPath:(e,t)=>c(J({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:S.hermes,configPath:(e,t)=>G({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>n,buildEntry:(e,t)=>P(t),scope:`global`,detectPath:(e,t)=>l(t??h(),`.hermes`),offerOnlyWhenDetected:!0}};function se(e){let t=e.filter(e=>!Object.hasOwn(Y,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${x.join(`, `)}`);return e.map(e=>Y[e])}function X(e){let t=[];for(let n of o){let r=a[n];t.push({path:l(e,`.agents`,`skills`,r),bundleId:n,scope:`central`});for(let i of C)t.push({path:l(e,i.hostDir,`skills`,r),bundleId:n,scope:`host`,hostDir:i.hostDir})}return t}function ce(e,t){let n=[];for(let r of X(e))if(r.bundleId===t)try{b(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}function Z(e,t){let n;try{n=_(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);$(e,t)}function Q(e,t){$(e,t)}function $(e,t){let n;try{n=y(t)}catch{n=f(t)}let r=c(e);for(;r.length>1&&r!==p;){let t;try{t=y(r)}catch(e){if(e.code===`ENOENT`){r=c(r);continue}throw e}let i=d(n,t);if(i===``||!i.startsWith(`..`)&&!ee(i))return;throw Error(`Refusing to write at ${e}: ancestor ${r} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function le(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=i(`project`,{checkDesktop:!0}),a=c(n);Z(a,t);let o=g(n)?`overwritten`:`written`;return b(a,{recursive:!0,force:!0}),v(c(a),{recursive:!0}),te(r,a,{recursive:!0}),{editorId:e.id,label:e.label,action:o,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function ue(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=c(n);return g(n)?(Q(r,t),b(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}export{M as _,ce as a,se as b,ne as c,Y as d,C as f,P as g,j as h,le as i,D as l,A as m,Q as n,X as o,k as p,ue as r,x as s,Z as t,S as u,ie as v,ae as y};
|
|
36
|
-
//# sourceMappingURL=write-project-skill-
|
|
36
|
+
//# sourceMappingURL=write-project-skill-XZCJ5TEZ.mjs.map
|
package/package.json
CHANGED
package/dist/init-B02GcqsQ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e}from"./init-E8FDYW-D.mjs";export{e as runInit};
|
package/dist/loader-CT3CzsPt.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./loader-Bi7zAoyk.mjs";export{e as loadConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./preview-hq0cdoZw.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{o as e,t}from"./chunk-CFjPhJqf.js";import{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{$t as a,C as o,E as s,M as c,S as l,T as u,Ut as d,Vt as f,Wt as p,pn as m,ut as h,w as g,x as _}from"./DocumentContext-CPgyt-fa.js";import{n as v,r as y}from"./dist-CQw2y-s3.js";import{n as b}from"./dist-BVOt51sU.js";import{A as x,Bi as S,Gi as C,Sr as w,Vi as T,Wi as E,_ as D,et as O,h as k,it as A,ji as j,k as M,wt as N,xt as P,zi as F}from"./dist-CJfVM-iJ.js";import{a as I,i as L,t as R,u as z}from"./button-cneJOVxD.js";import{a as B,c as V,i as H,r as U,t as W}from"./EnableSyncConfirmDialog-a1BAa003.js";import{t as ee}from"./arrow-up-right-Crm0Btez.js";import{t as G}from"./check-DRRCCRSs.js";import{t as te}from"./chevron-right-DSNnH-Vb.js";import{i as ne}from"./prop-types-Cl1SYZho.js";import{D as re,E as K,T as ie,b as ae,c as oe,d as q,i as se,m as J,r as ce,s as le,t as ue,u as de,w as fe}from"./skill-actions-BV30AE89.js";import{$ as pe,A as me,B as he,C as ge,E as _e,H as ve,M as ye,Q as be,S as xe,T as Se,U as Y,V as Ce,W as we,_ as Te,at as Ee,c as De,d as Oe,f as ke,g as Ae,h as je,i as Me,j as Ne,l as Pe,lt as Fe,m as Ie,n as Le,o as Re,p as ze,q as Be,st as Ve,u as He,v as Ue,w as We,x as Ge,y as Ke,z as qe}from"./auth-state-cache-D4z3eiMF.js";import{i as Je,l as Ye,r as Xe,s as Ze}from"./workspace-paths-CMbeqczX.js";import{_ as Qe,b as $e,d as et,f as tt,g as nt,h as rt,l as it,m as at,o as ot,t as st,u as ct,v as lt,y as ut}from"./open-managed-artifact-tab-NBmHUyDy.js";import{t as dt}from"./info-BlYnsVoP.js";import{t as ft}from"./triangle-alert-c3yCucJv.js";import{n as X,r as pt}from"./dist-CoyydoqN.js";import{i as mt,n as ht,t as gt}from"./tooltip-FFg0kVkD.js";import{n as _t,r as vt,t as yt}from"./collapsible-mJvufeMs.js";import{a as bt,c as xt,i as St,n as Ct,o as wt,r as Tt,s as Et,t as Dt}from"./dialog-DdHaoAGK.js";import{t as Ot}from"./checkbox-DurEHAAx.js";import{E as kt,h as At,p as jt}from"./skills-api-B0z9Mw2W.js";import{t as Mt}from"./label-DPn_C7ZD.js";import{n as Nt,r as Pt,t as Ft}from"./radio-group-B0RG5um-.js";import{n as It,t as Lt}from"./toggle-group-CXHn0FKi.js";import{t as Rt}from"./input-tW78aNaR.js";import{t as zt}from"./parse-api-error-CqtA8BcL.js";import{r as Bt}from"./documents-events-H4-z8Qjp.js";import{a as Vt,n as Ht,r as Ut,s as Wt,t as Gt}from"./keyboard-shortcuts-DnJWzgZ1.js";import"./config-provider-BONo47Qc.js";import{n as Kt}from"./config-context-CE3SCVYc.js";import{t as qt}from"./external-link-BjECE2gH.js";var Jt=z(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Z=i(),Q=e(n(),1),$=r(),Yt=`settings-sharing-title`;function Xt(){let e=(0,Z.c)(1),t=(typeof window<`u`?window.okDesktop:void 0)?.sharing,n;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=t===void 0?(0,$.jsx)(Zt,{}):(0,$.jsx)(Qt,{}),e[0]=n):n=e[0],n}function Zt(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`h3`,{id:Yt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`section`,{"aria-labelledby":Yt,className:`space-y-3`,children:(0,$.jsxs)(`div`,{className:`space-y-1`,children:[t,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`7YRrJ9`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{}),2:(0,$.jsx)(`code`,{})}})})]})}),e[1]=n):n=e[1],n}function Qt(){let e=(0,Z.c)(28),{_:t}=y(),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c;e[0]===t?c=e[1]:(c=async function(){let e=window.okDesktop?.sharing;if(e)try{r(await e.status())}catch(e){let n=e;X.error(n instanceof Error?n.message:t({id:`K0N7zS`})),r(en)}},e[0]=t,e[1]=c);let l=c,u;e[2]===l?u=e[3]:(u=()=>{l()},e[2]=l,e[3]=u);let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],e[4]=d):d=e[4],(0,Q.useEffect)(u,d);let f;e[5]!==t||e[6]!==i||e[7]!==l||e[8]!==n?(f=async function(e){let r=window.okDesktop?.sharing;if(!r||n===null||i||n.mode===e)return;a(!0),s(null);let o=null,c=null;try{o=await r.setMode(e)}catch(e){c=e}if(a(!1),c!==null){X.error(c instanceof Error?c.message:t({id:`qZv5ZR`}));return}o!==null&&(o.kind===`refused-tracked`?(s({tracked:o.tracked,remediation:o.remediation}),X.error(t({id:`z2JdQ-`}),{duration:5e3})):o.kind===`no-exclude`?X.warning(o.reason===`no-git`?t({id:`YSFv5w`}):t({id:`8cS0nH`,values:{0:o.reason}})):X.success(t(e===`local-only`?{id:`VvS_k_`}:{id:`k_pade`})),await l())},e[5]=t,e[6]=i,e[7]=l,e[8]=n,e[9]=f):f=e[9];let p=f;if(n===null){let t;return e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":Yt,className:`space-y-3`,children:[(0,$.jsx)(`h3`,{id:Yt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),(0,$.jsx)(Y,{className:`h-24`})]}),e[10]=t):t=e[10],t}let m=n.mode===`no-git`,h;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`h3`,{id:Yt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),(0,$.jsx)(Pt,{})]}),e[11]=h):h=e[11];let g;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[h,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`N55YNr`})})]}),e[12]=g):g=e[12];let _;e[13]!==i||e[14]!==m||e[15]!==p||e[16]!==n.mode?(_=m?(0,$.jsx)(`p`,{className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,role:`status`,"data-testid":`settings-sharing-no-git`,children:(0,$.jsx)(v,{id:`ju38ms`})}):(0,$.jsxs)(Ft,{value:n.mode,onValueChange:e=>void p(e),disabled:i,className:`gap-2`,"aria-labelledby":Yt,"data-testid":`settings-sharing-radiogroup`,children:[(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-shared`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(Nt,{id:`settings-sharing-shared`,value:`shared`,"data-testid":`settings-sharing-shared`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`0Gd0NU`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`dJw2_7`})})]})]}),(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-local-only`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(Nt,{id:`settings-sharing-local-only`,value:`local-only`,"data-testid":`settings-sharing-local-only`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`OgyJSr`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`cZ_8zB`})})]})]})]}),e[13]=i,e[14]=m,e[15]=p,e[16]=n.mode,e[17]=_):_=e[17];let b;e[18]===o?b=e[19]:(b=o===null?null:(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border border-destructive bg-destructive/10 p-3 text-sm`,role:`alert`,"data-testid":`settings-sharing-refusal`,children:[(0,$.jsx)(`p`,{className:`font-semibold`,children:(0,$.jsx)(v,{id:`Kgdbkt`})}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs leading-relaxed`,children:o.remediation}),(0,$.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>s(null),children:(0,$.jsx)(v,{id:`1QfxQT`})})]}),e[18]=o,e[19]=b);let x;e[20]!==o||e[21]!==n.mode||e[22]!==n.trackedUpstream?(x=n.trackedUpstream.length>0&&n.mode!==`no-git`&&o===null?(0,$.jsxs)(`div`,{className:`space-y-1 rounded-md border border-muted-foreground/30 bg-muted/40 p-3 text-sm`,"data-testid":`settings-sharing-tracked-info`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`LhWYpm`})}),(0,$.jsx)(`ul`,{className:`list-disc pl-5 font-mono text-xs text-muted-foreground`,children:n.trackedUpstream.map($t)}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`1XSMhZ`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]}):null,e[20]=o,e[21]=n.mode,e[22]=n.trackedUpstream,e[23]=x):x=e[23];let S;return e[24]!==_||e[25]!==b||e[26]!==x?(S=(0,$.jsxs)(`section`,{"aria-labelledby":Yt,className:`space-y-4`,"data-testid":`settings-sharing`,children:[g,_,b,x]}),e[24]=_,e[25]=b,e[26]=x,e[27]=S):S=e[27],S}function $t(e){return(0,$.jsx)(`li`,{children:e},e)}function en(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[]}}var tn=_e,nn=Q.createContext({}),rn=e=>{let t=(0,Z.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;t[2]===n.name?r=t[3]:(r={name:n.name},t[2]=n.name,t[3]=r);let i;t[4]===n?i=t[5]:(i=(0,$.jsx)(Se,{...n}),t[4]=n,t[5]=i);let a;return t[6]!==r||t[7]!==i?(a=(0,$.jsx)(nn.Provider,{value:r,children:i}),t[6]=r,t[7]=i,t[8]=a):a=t[8],a},an=()=>{let e=(0,Z.c)(13),t=Q.use(nn),n=Q.use(on),{getFieldState:r}=Ne(),i;e[0]===t.name?i=e[1]:(i={name:t.name},e[0]=t.name,e[1]=i);let a=ye(i),o;e[2]!==t.name||e[3]!==a||e[4]!==r?(o=r(t.name,a),e[2]=t.name,e[3]=a,e[4]=r,e[5]=o):o=e[5];let s=o;if(!t)throw Error(`useFormField should be used within <FormField>`);let{id:c}=n,l=`${c}-form-item`,u=`${c}-form-item-description`,d=`${c}-form-item-message`,f;return e[6]!==t.name||e[7]!==s||e[8]!==c||e[9]!==l||e[10]!==u||e[11]!==d?(f={id:c,name:t.name,formItemId:l,formDescriptionId:u,formMessageId:d,...s},e[6]=t.name,e[7]=s,e[8]=c,e[9]=l,e[10]=u,e[11]=d,e[12]=f):f=e[12],f},on=Q.createContext({});function sn(e){let t=(0,Z.c)(13),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=Q.useId(),a;t[3]===i?a=t[4]:(a={id:i},t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=L(`grid gap-2`,n),t[5]=n,t[6]=o);let s;t[7]!==r||t[8]!==o?(s=(0,$.jsx)(`div`,{"data-slot":`form-item`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(0,$.jsx)(on.Provider,{value:a,children:s}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function cn(e){let t=(0,Z.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{error:i,formItemId:a}=an(),o=!!i,s;t[3]===n?s=t[4]:(s=L(`data-[error=true]:text-destructive`,n),t[3]=n,t[4]=s);let c;return t[5]!==a||t[6]!==r||t[7]!==o||t[8]!==s?(c=(0,$.jsx)(Mt,{"data-slot":`form-label`,"data-error":o,className:s,htmlFor:a,...r}),t[5]=a,t[6]=r,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function ln(e){let t=(0,Z.c)(7),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{error:r,formItemId:i,formDescriptionId:a,formMessageId:o}=an(),s=r?`${a} ${o}`:`${a}`,c=!!r,l;return t[2]!==i||t[3]!==n||t[4]!==s||t[5]!==c?(l=(0,$.jsx)(I,{"data-slot":`form-control`,id:i,"aria-describedby":s,"aria-invalid":c,...n}),t[2]=i,t[3]=n,t[4]=s,t[5]=c,t[6]=l):l=t[6],l}function un(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{formDescriptionId:i}=an(),a;t[3]===n?a=t[4]:(a=L(`text-1sm text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==r||t[7]!==a?(o=(0,$.jsx)(`p`,{"data-slot":`form-description`,id:i,className:a,...r}),t[5]=i,t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function dn(e){let t=(0,Z.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{error:i,formMessageId:a}=an(),o=i?String(i?.message??``):r.children;if(!o)return null;let s=i?`alert`:void 0,c;t[3]===n?c=t[4]:(c=L(`text-sm text-destructive`,n),t[3]=n,t[4]=c);let l;return t[5]!==o||t[6]!==a||t[7]!==r||t[8]!==s||t[9]!==c?(l=(0,$.jsx)(`p`,{"data-slot":`form-message`,id:a,role:s,className:c,...r,children:o}),t[5]=o,t[6]=a,t[7]=r,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function fn(e){let t=(0,Z.c)(30),{authQueryTransport:n,authTransport:r}=e,{_:i}=y(),a;t[0]===n?a=t[1]:(a=n??Be(),t[0]=n,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={phase:`loading`},t[2]=s):s=t[2];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(!1),_;t[3]===o?_=t[4]:(_=async function(){l({phase:`loading`});try{let e=await o.status();l({phase:`loaded`,result:e}),Le(e.authenticated)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),l({phase:`check-failed`})}},t[3]=o,t[4]=_);let b=_,x;t[5]===b?x=t[6]:(x=()=>{b()},t[5]=b,t[6]=x);let S;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[7]=S):S=t[7],(0,Q.useEffect)(x,S);let C;t[8]!==i||t[9]!==b||t[10]!==o?(C=async function(){if(g.current)return;g.current=!0,d(!1),p(!0),h(null);let e=null;try{let t=o.signout?await o.signout():{ok:!1,error:i({id:`8cpOa8`})};t.ok||(e=t.error??i({id:`8cpOa8`}))}catch(t){console.warn(`[AccountSection] GitHub disconnect failed`,t),e=i({id:`8cpOa8`})}await b(),e&&h(e),p(!1),g.current=!1},t[8]=i,t[9]=b,t[10]=o,t[11]=C):C=t[11];let w=C,T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(`h3`,{id:`settings-account-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`AeXO77`})}),t[12]=T):T=t[12];let E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[T,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`E6lrpp`})})]}),t[13]=E):E=t[13];let D;t[14]!==m||t[15]!==f||t[16]!==w||t[17]!==b||t[18]!==c.phase||t[19]!==c.result?(D=c.phase===`loading`?(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-loading`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`IWGfGF`})}),(0,$.jsx)(Y,{className:`h-4 w-40`}),(0,$.jsx)(Y,{className:`h-8 w-32`})]}):c.phase===`check-failed`?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-check-failed`,children:[(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`T_wG4n`})}),(0,$.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:(0,$.jsx)(v,{id:`KDw4GX`})})]}):c.result.authenticated?c.result.tier===`A`?(0,$.jsx)(mn,{login:c.result.login}):(0,$.jsx)(pn,{login:c.result.login,disconnecting:f,error:m,onDisconnect:()=>void w()}):(0,$.jsx)(hn,{onConnect:()=>d(!0)}),t[14]=m,t[15]=f,t[16]=w,t[17]=b,t[18]=c.phase,t[19]=c.result,t[20]=D):D=t[20];let O;t[21]===b?O=t[22]:(O=()=>{b()},t[21]=b,t[22]=O);let k;t[23]!==u||t[24]!==r||t[25]!==O?(k=(0,$.jsx)(we,{open:u,onOpenChange:d,transport:r,onSuccess:O}),t[23]=u,t[24]=r,t[25]=O,t[26]=k):k=t[26];let A;return t[27]!==k||t[28]!==D?(A=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[E,D,k]}),t[27]=k,t[28]=D,t[29]=A):A=t[29],A}function pn(e){let t=(0,Z.c)(20),{login:n,disconnecting:r,error:i,onDisconnect:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`nxlOpL`})}),t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[3]=o,t[4]=c);let l;t[5]===r?l=t[6]:(l=r?(0,$.jsx)(v,{id:`rppgXF`}):(0,$.jsx)(v,{id:`-K0AvT`}),t[5]=r,t[6]=l);let u;t[7]!==r||t[8]!==a||t[9]!==l?(u=(0,$.jsx)(R,{variant:`outline`,onClick:a,disabled:r,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:l}),t[7]=r,t[8]=a,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==c||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,$.jsx)(v,{id:`msOK6I`})}),t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-account-disconnect-error`,children:i}):null,t[15]=i,t[16]=p);let m;return t[17]!==d||t[18]!==p?(m=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[d,f,p]}),t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function mn(e){let t=(0,Z.c)(5),{login:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`ny6vNn`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-gh-cli`,children:(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[r,i]})}),t[3]=r,t[4]=a),a}function hn(e){let t=(0,Z.c)(5),{onConnect:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`S33tz3`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`EJuO7B`})})]}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(v,{id:`3jod3l`}),t[2]=a):a=t[2];let o;return t[3]===n?o=t[4]:(o=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-disconnected`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,(0,$.jsx)(R,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=o),o}function gn(e){return e.kind===`editor`?`editor:${e.id}`:e.kind===`skill`?`skill:${e.id}`:`path`}function _n(e){let t=(0,Z.c)(11),{testId:n,children:r}=e,{_:i}=y(),a;t[0]===i?a=t[1]:(a=i({id:`2B6eYX`}),t[0]=i,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(dt,{className:`size-3.5`}),t[2]=o):o=t[2];let s;t[3]!==a||t[4]!==n?(s=(0,$.jsx)(mt,{asChild:!0,children:(0,$.jsx)(R,{variant:`ghost`,size:`icon`,className:`mt-1.5 mr-1.5 h-6 w-6 shrink-0 text-muted-foreground opacity-60 hover:opacity-100`,"aria-label":a,"data-testid":n,children:o})}),t[3]=a,t[4]=n,t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=(0,$.jsx)(ht,{side:`left`,className:`max-w-sm text-left`,children:(0,$.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:r})}),t[6]=r,t[7]=c);let l;return t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(gt,{children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function vn(){let e=(0,Z.c)(38),{_:t}=y(),n=typeof window<`u`?window.okDesktop??null:null,[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l,u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{if(!n)return;let e=!1;return n.integrations.status().then(t=>{e||i(t)}).catch(()=>{e||o(!0)}),()=>{e=!0}},u=[n],e[0]=l,e[1]=u):(l=e[0],u=e[1]),(0,Q.useEffect)(l,u);let d;e[2]===t?d=e[3]:(d=async function(e,r){if(n){c(gn(e));try{let t=await n.integrations.setComponent({component:e,enabled:r});i(t.status),t.ok||X.error(t.error)}catch(e){let n=e;X.error(t({id:`gfdqcY`,values:{0:n instanceof Error?n.message:String(n)}}))}c(null)}},e[2]=t,e[3]=d);let f=d,p;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`h3`,{id:`settings-ai-tools-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`_5qBNl`})}),e[4]=p):p=e[4];let m;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[p,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`mLAjyL`})})]}),e[5]=m):m=e[5];let h=m;if(!n||a){let t;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[h,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`ai-tools-unavailable`,children:(0,$.jsx)(v,{id:`O4PnDd`})})]}),e[6]=t):t=e[6],t}if(r===null){let t;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[h,(0,$.jsxs)(`div`,{className:`space-y-2`,"data-testid":`ai-tools-loading`,children:[(0,$.jsx)(Y,{className:`h-10 w-full`}),(0,$.jsx)(Y,{className:`h-10 w-full`}),(0,$.jsx)(Y,{className:`h-10 w-full`})]})]}),e[7]=t):t=e[7],t}let g=s!==null||!r.available,_=r.path.shellDetected||r.path.installed,b;e[8]===r.available?b=e[9]:(b=!r.available&&(0,$.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,"data-testid":`ai-tools-read-only`,children:(0,$.jsx)(v,{id:`OplnBG`})}),e[8]=r.available,e[9]=b);let S;e[10]!==t||e[11]!==f||e[12]!==g||e[13]!==_||e[14]!==r.path.installed||e[15]!==r.path.rcFilesToTouch?(S=_&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(v,{id:`ALhMYW`})}),(0,$.jsxs)(`div`,{className:`flex items-start overflow-hidden rounded-md border border-border bg-card/50 hover:bg-accent`,children:[(0,$.jsxs)(Mt,{htmlFor:`ai-tools-path`,className:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(Ot,{id:`ai-tools-path`,checked:r.path.installed,disabled:g,onCheckedChange:()=>void f({kind:`path`},!r.path.installed),className:`mt-0.5`,"data-testid":`ai-tools-path-checkbox`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(v,{id:`Fsx78O`,components:{0:(0,$.jsx)(`code`,{className:`inline-code`})}})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`ai-tools-path-status`,children:r.path.installed?t({id:`yhdqox`}):t({id:`04XyCH`,values:{0:r.path.rcFilesToTouch.join(`, `)}})})]})]}),(0,$.jsxs)(_n,{testId:`ai-tools-path-info`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(v,{id:`f9lQNJ`})}),r.path.rcFilesToTouch.map(bn),(0,$.jsx)(`p`,{className:`pt-1`,children:(0,$.jsx)(v,{id:`CWzc2T`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]})]})]}),e[10]=t,e[11]=f,e[12]=g,e[13]=_,e[14]=r.path.installed,e[15]=r.path.rcFilesToTouch,e[16]=S):S=e[16];let C;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(v,{id:`psfGPX`})}),e[17]=C):C=e[17];let w;if(e[18]!==t||e[19]!==f||e[20]!==g||e[21]!==r.editors){let n;e[23]!==t||e[24]!==f||e[25]!==g?(n=e=>{let n=e.state===`installed`||e.state===`foreign`,r=g||e.state===`unmanageable`,i=e.state===`not-installed`&&!e.detected,a=`https://openknowledge.ai/docs/integrations/${x[e.id]}`,o=e.state===`installed`?t({id:`eQkgKV`}):e.state===`foreign`?t({id:`AczYxH`}):e.state===`unmanageable`?t({id:`LbmLyU`}):e.detected?t({id:`bBE5tC`}):null,s=e.state===`foreign`||e.state===`unmanageable`?`text-xs text-amber-600 dark:text-amber-400`:`text-xs text-muted-foreground`;return(0,$.jsxs)(`li`,{className:r?`flex items-start`:`flex items-start hover:bg-accent`,children:[(0,$.jsxs)(Mt,{htmlFor:`ai-tools-editor-${e.id}`,className:r?`flex flex-1 items-start gap-2.5 px-3 py-2.5 font-normal`:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(Ot,{id:`ai-tools-editor-${e.id}`,checked:n,disabled:r,onCheckedChange:()=>void f({kind:`editor`,id:e.id},!n),className:`mt-0.5`,"data-testid":`ai-tools-editor-checkbox-${e.id}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e.label}),o!==null&&(0,$.jsx)(`span`,{className:s,"data-testid":`ai-tools-editor-status-${e.id}`,children:o})]})]}),i&&(0,$.jsxs)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>qt(e,a),onAuxClick:e=>qt(e,a),"aria-label":t({id:`D-Oh1s`,values:{0:e.label}}),className:`flex shrink-0 items-center gap-0.5 px-2 py-2.5 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,"data-testid":`ai-tools-editor-status-${e.id}`,children:[(0,$.jsx)(v,{id:`P_bX4O`}),(0,$.jsx)(ee,{className:`size-3`,"aria-hidden":!0})]}),(0,$.jsxs)(_n,{testId:`ai-tools-editor-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(v,{id:`J2eKUI`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.configPath??t({id:`ndwmea`})})}),(0,$.jsx)(`p`,{className:`pt-1 opacity-70`,children:(0,$.jsx)(v,{id:`VIwCaD`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.entryLocator})})]})]},e.id)},e[23]=t,e[24]=f,e[25]=g,e[26]=n):n=e[26],w=r.editors.map(n),e[18]=t,e[19]=f,e[20]=g,e[21]=r.editors,e[22]=w}else w=e[22];let T;e[27]===w?T=e[28]:(T=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[C,(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`,children:w})]}),e[27]=w,e[28]=T);let E;e[29]!==f||e[30]!==g||e[31]!==r.skills?(E=r.skills.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(v,{id:`28B21t`})}),(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`,children:r.skills.map(e=>(0,$.jsxs)(`li`,{className:`flex items-start hover:bg-accent`,children:[(0,$.jsxs)(Mt,{htmlFor:`ai-tools-skill-${e.id}`,className:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(Ot,{id:`ai-tools-skill-${e.id}`,checked:e.installed,disabled:g,onCheckedChange:()=>void f({kind:`skill`,id:e.id},!e.installed),className:`mt-0.5`,"data-testid":`ai-tools-skill-checkbox-${e.id}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(`code`,{children:e.name})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`ai-tools-skill-status-${e.id}`,children:e.id===`discovery`?(0,$.jsx)(v,{id:`0inVGS`}):(0,$.jsx)(v,{id:`FXk_zY`})})]})]}),(0,$.jsxs)(_n,{testId:`ai-tools-skill-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(v,{id:`HSh8u_`})}),e.paths.map(yn)]})]},e.id))})]}),e[29]=f,e[30]=g,e[31]=r.skills,e[32]=E):E=e[32];let D;return e[33]!==E||e[34]!==b||e[35]!==S||e[36]!==T?(D=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[h,b,S,T,E]}),e[33]=E,e[34]=b,e[35]=S,e[36]=T,e[37]=D):D=e[37],D}function yn(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}function bn(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}async function xn(e){try{let t=A.safeParse(await e.json());if(t.success)return t.data.title}catch{}}async function Sn(e,t){try{let n=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return n.ok?{ok:!0}:{ok:!1,error:await xn(n)}}catch{return{ok:!1}}}function Cn(){return{setKey:e=>Sn(`/api/local-op/embeddings/set-key`,{key:e}),clearKey:()=>Sn(`/api/local-op/embeddings/clear-key`,{})}}function wn(e){let t=(0,Z.c)(29),{transport:n}=e,{_:r}=y(),i;t[0]===n?i=t[1]:(i=n??Cn(),t[0]=n,t[1]=i);let a=i,{status:o,refresh:s}=pe(),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),m=o?.keyPresent??!1,h=o?.keySource??null,g=o?.keyHint??null,_;t[2]!==r||t[3]!==u||t[4]!==c||t[5]!==s||t[6]!==a?(_=async function(){let e=c.trim();if(!e||u)return;d(!0),p(null);let t=await a.setKey(e);d(!1),t.ok?(l(``),s()):p(t.error??r({id:`Ck9XRt`}))},t[2]=r,t[3]=u,t[4]=c,t[5]=s,t[6]=a,t[7]=_):_=t[7];let b=_,x;t[8]!==r||t[9]!==u||t[10]!==s||t[11]!==a?(x=async function(){if(u)return;d(!0),p(null);let e=await a.clearKey();d(!1),e.ok?s():p(e.error??r({id:`CSL0l1`}))},t[8]=r,t[9]=u,t[10]=s,t[11]=a,t[12]=x):x=t[12];let S=x,C;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(`h3`,{id:`settings-embeddings-key-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`nh3wwx`})}),t[13]=C):C=t[13];let w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[C,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`FOyCTr`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]}),t[14]=w):w=t[14];let T;t[15]!==r||t[16]!==u||t[17]!==g||t[18]!==c||t[19]!==m||t[20]!==h||t[21]!==S||t[22]!==b?(T=h===`env`?(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-embeddings-key-env`,children:(0,$.jsx)(v,{id:`KH5bQi`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}):(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,"data-testid":`settings-embeddings-key-set`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-1.5 text-sm font-medium`,children:(0,$.jsx)(v,{id:`AqnqMJ`})}),g?(0,$.jsxs)(`p`,{className:`truncate font-mono text-muted-foreground text-xs`,title:r({id:`qEIFZu`,values:{keyHint:g}}),"data-testid":`settings-embeddings-key-hint`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`••••••••`}),g]}):null,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`3TCafD`})})]}),(0,$.jsx)(R,{variant:`outline`,onClick:()=>void S(),disabled:u,"data-testid":`settings-embeddings-key-clear`,children:(0,$.jsx)(v,{id:`xCJdfg`})})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{htmlFor:`settings-embeddings-key-input`,className:`mb-2 block text-sm font-medium`,children:m?(0,$.jsx)(v,{id:`UW93oq`}):(0,$.jsx)(v,{id:`K6jxcj`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Rt,{id:`settings-embeddings-key-input`,type:`password`,value:c,onChange:e=>l(e.target.value),placeholder:r({id:`tsiTqO`}),autoComplete:`off`,spellCheck:!1,disabled:u,"data-testid":`settings-embeddings-key-input`,className:`h-8 font-mono text-sm`}),(0,$.jsx)(R,{onClick:()=>void b(),disabled:u||c.trim().length===0,"data-testid":`settings-embeddings-key-save`,children:u?(0,$.jsx)(v,{id:`uF9ruK`}):(0,$.jsx)(v,{id:`tfDRzk`})})]})]})]}),t[15]=r,t[16]=u,t[17]=g,t[18]=c,t[19]=m,t[20]=h,t[21]=S,t[22]=b,t[23]=T):T=t[23];let E;t[24]===f?E=t[25]:(E=f?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-embeddings-key-error`,children:f}):null,t[24]=f,t[25]=E);let D;return t[26]!==T||t[27]!==E?(D=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-embeddings-key-title`,className:`space-y-3`,"data-testid":`settings-embeddings-key`,children:[w,(0,$.jsxs)(`div`,{className:`space-y-3 rounded-md border p-3`,children:[T,E]})]}),t[26]=T,t[27]=E,t[28]=D):D=t[28],D}var Tn=e(t(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}var r=``,i=` `,a=`\\`,o=/^\s+$/,s=/(?:[^\\]|^)\\$/,c=/^\\!/,l=/^\\#/,u=/\r?\n/g,d=/^\.*\/|^\.+$/,f=`/`,p=`node-ignore`;typeof Symbol<`u`&&(p=Symbol.for(`node-ignore`));var m=p,h=(e,t,n)=>Object.defineProperty(e,t,{value:n}),g=/([0-z])-([0-z])/g,_=()=>!1,v=e=>e.replace(g,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:r),y=e=>{let{length:t}=e;return e.slice(0,t-t%2)},b=[[/^\uFEFF/,()=>r],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?i:r)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+i}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>a],[/\\\\/g,()=>a],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===a?`\\[${n}${y(r)}${i}`:i===`]`&&r.length%2==0?`[${v(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],x=Object.create(null),S=(e,t)=>{let n=x[e];return n||(n=b.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),x[e]=n),t?new RegExp(n,`i`):new RegExp(n)},C=e=>typeof e==`string`,w=e=>e&&C(e)&&!o.test(e)&&!s.test(e)&&e.indexOf(`#`)!==0,T=e=>e.split(u),E=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}},D=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(c,`!`).replace(l,`#`);let i=S(e,t);return new E(n,e,r,i)},O=(e,t)=>{throw new t(e)},k=(e,t,n)=>C(e)?e?k.isNotRelative(e)?n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),A=e=>d.test(e);k.isNotRelative=A,k.convert=e=>e;var j=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){h(this,m,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[m]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(w(e)){let t=D(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(C(e)?T(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&k.convert(e);return k(i,e,this._allowRelativePaths?_:O),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(f),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(f)+f,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},M=e=>new j(e);if(M.isPathValid=e=>k(e&&k.convert(e),e,_),M.default=M,t.exports=M,typeof process<`u`&&({}.IGNORE_TEST_WIN32||process.platform===`win32`)){k.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;k.isNotRelative=t=>e.test(t)||A(t)}}))(),1),En=new Map;function Dn(e){let t=En.get(e);if(t)return En.delete(e),En.set(e,t),t;let n=(0,Tn.default)();if(n.add(e),En.set(e,n),En.size>256){let e=En.keys().next().value;e!==void 0&&En.delete(e)}return n}function On(e,t){let n=e.trim();if(n.length===0||n.startsWith(`#`))return 0;let r=Dn(n),i=0;for(let e of t)e.length!==0&&r.ignores(e)&&(i+=1);return i}var kn={"trailing-backslash":`Trailing backslash — line continuation isn't supported.`,"unmatched-bracket":`Unmatched [ — character class is open.`,"lone-bang":`Lone ! — negation needs a pattern after it.`,"leading-whitespace":`Leading whitespace — the rule may not match as expected.`,"embedded-newline":`Embedded line break — the row spans multiple lines.`};function An(e){let t=[];if(e.length===0||e.trimStart().startsWith(`#`))return t;/[\r\n]/.test(e)&&t.push({code:`embedded-newline`,message:kn[`embedded-newline`]}),/^\s/.test(e)&&t.push({code:`leading-whitespace`,message:kn[`leading-whitespace`]});let n=e.trim();return n===`!`&&t.push({code:`lone-bang`,message:kn[`lone-bang`]}),n.endsWith(`\\`)&&t.push({code:`trailing-backslash`,message:kn[`trailing-backslash`]}),jn(n,`[`)>jn(n,`]`)&&t.push({code:`unmatched-bracket`,message:kn[`unmatched-bracket`]}),t}function jn(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}var Mn=`https://openknowledge.ai/docs/features/ignore-patterns`,Nn=1200,Pn=150,Fn=150,In=5e3,Ln=600,Rn=400,zn=`okignore-show-advanced`;function Bn(e){let t=(0,Z.c)(3),{binding:n,synced:r}=e;if(n===null||!r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Vn,{}),t[0]=e):e=t[0],e}let i;return t[1]===n?i=t[2]:(i=(0,$.jsx)(Hn,{binding:n}),t[1]=n,t[2]=i),i}function Vn(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-skeleton`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`3zyg_A`})}),(0,$.jsx)(Y,{className:`h-4 w-72`})]}),(0,$.jsx)(Y,{className:`h-20 w-full`})]}),e[0]=t):t=e[0],t}function Hn(e){let t=(0,Z.c)(72),{binding:n}=e,{_:r}=y(),i;t[0]===n?i=t[1]:(i=()=>n.current(),t[0]=n,t[1]=i);let[a,o]=(0,Q.useState)(i),s,c;t[2]===n?(s=t[3],c=t[4]):(s=()=>n.subscribe(e=>{o(e)}),c=[n],t[2]=n,t[3]=s,t[4]=c),(0,Q.useEffect)(s,c);let{pages:l,pageMeta:u,assetPaths:d}=ne(),f;t[5]!==d||t[6]!==u||t[7]!==l?(f=lr(l,u,d),t[5]=d,t[6]=u,t[7]=l,t[8]=f):f=t[8];let p=f,m,h;t[9]===a?(m=t[10],h=t[11]):(m=Ie(a),h=ze(m),t[9]=a,t[10]=m,t[11]=h);let g=h,_=g.length===0,[b,x]=(0,Q.useState)(null),C=(0,Q.useRef)(null),w,T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>()=>{C.current&&clearTimeout(C.current)},T=[],t[12]=w,t[13]=T):(w=t[12],T=t[13]),(0,Q.useEffect)(w,T);let E;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{x({key:e,ts:Date.now()}),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>x(null),Nn)},t[14]=E):E=t[14];let D=E,[O,k]=(0,Q.useState)(null),A=(0,Q.useRef)(null),j,M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>{A.current&&clearTimeout(A.current)},j=[],t[15]=j,t[16]=M):(j=t[15],M=t[16]),(0,Q.useEffect)(M,j);let N,P;t[17]===n?(N=t[18],P=t[19]):(N=()=>Me(e=>{e.docName===`__config__/okignore`&&n.notifyRejection(e.error)}),P=[n],t[17]=n,t[18]=N,t[19]=P),(0,Q.useEffect)(N,P);let F,I;t[20]===n?(F=t[21],I=t[22]):(F=()=>n.subscribeRejection(e=>{let{error:t}=e,n=ar(t);k({message:n?.detail??S(t),lineNumber:n?.lineNumber,ts:Date.now()}),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>k(null),In)}),I=[n],t[20]=n,t[21]=F,t[22]=I),(0,Q.useEffect)(F,I);let L,R;t[23]===r?(L=t[24],R=t[25]):(L=()=>Re(e=>{let{path:t}=e;X.error(r({id:`3oh0nQ`,values:{path:t}}),{description:e.error,id:`okignore-nested-error:${e.path}`,duration:8e3})}),R=[r],t[23]=r,t[24]=L,t[25]=R),(0,Q.useEffect)(L,R);let z;t[26]===n?z=t[27]:(z=e=>{n.patch(e)},t[26]=n,t[27]=z);let B=z,V;t[28]!==B||t[29]!==m||t[30]!==g?(V=(e,t)=>{let n=t.trim(),r=g[e];if(r&&n!==r.text){if(n.length===0){B(Te(je(m,e)));return}B(Te(Oe(m,e,n))),D(ir(n,e))}},t[28]=B,t[29]=m,t[30]=g,t[31]=V):V=t[31];let H=V,U;t[32]!==B||t[33]!==m?(U=e=>{B(Te(je(m,e)))},t[32]=B,t[33]=m,t[34]=U):U=t[34];let W=U,ee;t[35]!==B||t[36]!==m||t[37]!==g.length?(ee=e=>{let t=e.trim();if(t.length===0)return;let n=ke(m,t);if(n>=0){D(ir(t,n));return}B(Te(He(m,t))),D(ir(t,g.length))},t[35]=B,t[36]=m,t[37]=g.length,t[38]=ee):ee=t[38];let G=ee,te;t[39]!==B||t[40]!==m?(te=e=>{let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=rr(t),i=rr(n);r<0||i<0||r===i||B(Te(Ae(m,r,i)))},t[39]=B,t[40]=m,t[41]=te):te=t[41];let re=te,K;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K={activationConstraint:{distance:4}},t[42]=K):K=t[42];let ie;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ie={coordinateGetter:it},t[43]=ie):ie=t[43];let ae=lt(Qe(rt,K),Qe(at,ie)),oe=O===null?null:`rejection-${O.ts}`,[q,se]=fr(),J;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`3zyg_A`})}),t[44]=J):J=t[44];let ce;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[J,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`Z5h97D`,components:{0:(0,$.jsx)(`a`,{href:Mn,target:`_blank`,rel:`noreferrer noopener`,className:`text-primary underline-offset-2 hover:underline`,"data-testid":`settings-okignore-primer`})}})})]}),t[45]=ce):ce=t[45];let le;t[46]===O?le=t[47]:(le=O===null?null:(0,$.jsx)(Gn,{rejection:O}),t[46]=O,t[47]=le);let ue;t[48]!==n||t[49]!==p||t[50]!==G||t[51]!==re||t[52]!==H||t[53]!==W||t[54]!==_||t[55]!==g||t[56]!==oe||t[57]!==b||t[58]!==ae||t[59]!==q||t[60]!==a?(ue=q?(0,$.jsx)(Un,{binding:n,text:a}):_?(0,$.jsx)(Kn,{onAdd:G,rejectionFlashKey:oe,filePaths:p}):(0,$.jsx)(qn,{patterns:g,sensors:ae,onDragEnd:re,onEdit:H,onRemove:W,onAdd:G,savedFlash:b,rejectionFlashKey:oe,filePaths:p}),t[48]=n,t[49]=p,t[50]=G,t[51]=re,t[52]=H,t[53]=W,t[54]=_,t[55]=g,t[56]=oe,t[57]=b,t[58]=ae,t[59]=q,t[60]=a,t[61]=ue):ue=t[61];let de;t[62]!==se||t[63]!==q?(de=()=>se(!q),t[62]=se,t[63]=q,t[64]=de):de=t[64];let fe;t[65]!==q||t[66]!==de?(fe=(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(Wn,{enabled:q,onToggle:de})}),t[65]=q,t[66]=de,t[67]=fe):fe=t[67];let pe;return t[68]!==le||t[69]!==ue||t[70]!==fe?(pe=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-section`,children:[ce,le,ue,fe]}),t[68]=le,t[69]=ue,t[70]=fe,t[71]=pe):pe=t[71],pe}function Un(e){let t=(0,Z.c)(31),{binding:n,text:r}=e,{_:i}=y(),[a,o]=(0,Q.useState)(r),s=(0,Q.useRef)(r),c=(0,Q.useRef)(!1),l=(0,Q.useRef)(r),u=(0,Q.useRef)(null),d,f;t[0]===r?(d=t[1],f=t[2]):(d=()=>{c.current||r!==s.current&&(o(r),l.current=r,s.current=r)},f=[r],t[0]=r,t[1]=d,t[2]=f),(0,Q.useEffect)(d,f);let p,m;t[3]===a?(p=t[4],m=t[5]):(p=()=>{l.current=a},m=[a],t[3]=a,t[4]=p,t[5]=m),(0,Q.useEffect)(p,m);let h,g;t[6]===n?(h=t[7],g=t[8]):(h=()=>()=>{u.current&&(clearTimeout(u.current),u.current=null,l.current!==s.current&&(n.patch(l.current),s.current=l.current))},g=[n],t[6]=n,t[7]=h,t[8]=g),(0,Q.useEffect)(h,g);let _;t[9]===n?_=t[10]:(_=e=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,e!==s.current&&(s.current=e,n.patch(e))},Rn)},t[9]=n,t[10]=_);let v=_,b;t[11]===n?b=t[12]:(b=()=>{u.current&&=(clearTimeout(u.current),null),l.current!==s.current&&(s.current=l.current,n.patch(l.current))},t[11]=n,t[12]=b);let x=b,S;t[13]===v?S=t[14]:(S=e=>{o(e.target.value),v(e.target.value)},t[13]=v,t[14]=S);let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{c.current=!0},t[15]=C):C=t[15];let w;t[16]===x?w=t[17]:(w=()=>{c.current=!1,x()},t[16]=x,t[17]=w);let T;t[18]===a?T=t[19]:(T=a.split(`
|
|
2
|
-
`),t[18]=a,t[19]=T);let E=Math.max(6,Math.min(20,T.length+1)),D;t[20]===i?D=t[21]:(D=i({id:`rssK8c`}),t[20]=i,t[21]=D);let O;t[22]===i?O=t[23]:(O=i({id:`AeHuzT`}),t[22]=i,t[23]=O);let k;return t[24]!==a||t[25]!==w||t[26]!==E||t[27]!==D||t[28]!==O||t[29]!==S?(k=(0,$.jsx)(`textarea`,{value:a,onChange:S,onFocus:C,onBlur:w,spellCheck:!1,rows:E,"aria-label":D,placeholder:O,className:`min-h-32 w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-xs outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,"data-testid":`settings-okignore-advanced-textarea`}),t[24]=a,t[25]=w,t[26]=E,t[27]=D,t[28]=O,t[29]=S,t[30]=k):k=t[30],k}function Wn(e){let t=(0,Z.c)(6),{enabled:n,onToggle:r}=e,i;t[0]===n?i=t[1]:(i=n?(0,$.jsx)(v,{id:`9PQysm`}):(0,$.jsx)(v,{id:`Nv3mUj`}),t[0]=n,t[1]=i);let a;return t[2]!==n||t[3]!==r||t[4]!==i?(a=(0,$.jsx)(R,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,"aria-pressed":n,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,"data-testid":`settings-okignore-show-advanced-toggle`,children:i}),t[2]=n,t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function Gn(e){let t=(0,Z.c)(7),{rejection:n}=e,{_:r}=y(),{lineNumber:i,message:a}=n,o;t[0]!==r||t[1]!==i||t[2]!==a?(o=r(i===void 0?{id:`G7-rf8`,values:{message:a}}:{id:`P3NS4G`,values:{lineNumber:i,message:a}}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3];let s=o,c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(ft,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0`}),t[4]=c):c=t[4];let l;return t[5]===s?l=t[6]:(l=(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":`settings-okignore-rejection-banner`,className:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive animate-in fade-in`,children:[c,(0,$.jsx)(`span`,{children:s})]}),t[5]=s,t[6]=l),l}function Kn(e){let t=(0,Z.c)(8),{onAdd:n,rejectionFlashKey:r,filePaths:i}=e,{_:a}=y(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`makN88`})}),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=a({id:`Gx0VS1`}),t[1]=a,t[2]=s);let c;return t[3]!==i||t[4]!==n||t[5]!==r||t[6]!==s?(c=(0,$.jsxs)(`div`,{className:`space-y-3 rounded-md border border-dashed p-4`,"data-testid":`settings-okignore-empty`,children:[o,(0,$.jsx)(Zn,{onAdd:n,placeholder:s,rejectionFlashKey:r,filePaths:i})]}),t[3]=i,t[4]=n,t[5]=r,t[6]=s,t[7]=c):c=t[7],c}function qn(e){let t=(0,Z.c)(35),{patterns:n,sensors:r,onDragEnd:i,onEdit:a,onRemove:o,onAdd:s,savedFlash:c,rejectionFlashKey:l,filePaths:u}=e,{_:d}=y(),f;t[0]===n?f=t[1]:(f=n.map(Jn),t[0]=n,t[1]=f);let p=f,m;t[2]===d?m=t[3]:(m=d({id:`3zyg_A`}),t[2]=d,t[3]=m);let h;if(t[4]!==u||t[5]!==a||t[6]!==o||t[7]!==n||t[8]!==c){let e;t[10]!==u||t[11]!==a||t[12]!==o||t[13]!==c?(e=(e,t)=>{let n=ir(e.text,t),r=c!==null&&c.key===n;return(0,$.jsx)(Yn,{sortableId:nr(t),patternIndex:t,pattern:e,onEdit:a,onRemove:o,flashActive:r,filePaths:u},nr(t))},t[10]=u,t[11]=a,t[12]=o,t[13]=c,t[14]=e):e=t[14],h=n.map(e),t[4]=u,t[5]=a,t[6]=o,t[7]=n,t[8]=c,t[9]=h}else h=t[9];let g;t[15]!==m||t[16]!==h?(g=(0,$.jsx)(`ul`,{"aria-label":m,className:`divide-y rounded-md border`,"data-testid":`settings-okignore-list`,children:h}),t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;t[18]!==p||t[19]!==g?(_=(0,$.jsx)(ot,{items:p,strategy:et,children:g}),t[18]=p,t[19]=g,t[20]=_):_=t[20];let v;t[21]!==i||t[22]!==r||t[23]!==_?(v=(0,$.jsx)(tt,{sensors:r,collisionDetection:nt,onDragEnd:i,children:_}),t[21]=i,t[22]=r,t[23]=_,t[24]=v):v=t[24];let b;t[25]===d?b=t[26]:(b=d({id:`cZGNlb`}),t[25]=d,t[26]=b);let x;t[27]!==u||t[28]!==s||t[29]!==l||t[30]!==b?(x=(0,$.jsx)(Zn,{onAdd:s,placeholder:b,rejectionFlashKey:l,filePaths:u}),t[27]=u,t[28]=s,t[29]=l,t[30]=b,t[31]=x):x=t[31];let S;return t[32]!==v||t[33]!==x?(S=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[v,x]}),t[32]=v,t[33]=x,t[34]=S):S=t[34],S}function Jn(e,t){return nr(t)}function Yn(e){let t=(0,Z.c)(47),{sortableId:n,patternIndex:r,pattern:i,onEdit:a,onRemove:o,flashActive:s,filePaths:c}=e,{_:l}=y(),u;t[0]===n?u=t[1]:(u={id:n},t[0]=n,t[1]=u);let{attributes:d,listeners:f,setNodeRef:p,transform:m,transition:h,isDragging:g}=ct(u),_=i.text,v;t[2]===m?v=t[3]:(v=ut.Transform.toString(m),t[2]=m,t[3]=v);let b=g?.5:void 0,x=g?1:void 0,S;t[4]!==v||t[5]!==b||t[6]!==x||t[7]!==h?(S={transform:v,transition:h,opacity:b,zIndex:x},t[4]=v,t[5]=b,t[6]=x,t[7]=h,t[8]=S):S=t[8];let C=S,w;t[9]!==l||t[10]!==_?(w=l({id:`7_bFEL`,values:{patternText:_}}),t[9]=l,t[10]=_,t[11]=w):w=t[11];let T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)($e,{className:`size-3.5`}),t[12]=T):T=t[12];let E;t[13]!==d||t[14]!==f||t[15]!==w?(E=(0,$.jsx)(R,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-testid":`settings-okignore-drag-handle`,"aria-label":w,...d,...f,className:`h-7 w-4 shrink-0 cursor-grab touch-none px-0 text-muted-foreground/40 hover:text-foreground focus-visible:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring active:cursor-grabbing`,children:T}),t[13]=d,t[14]=f,t[15]=w,t[16]=E):E=t[16];let D;t[17]!==a||t[18]!==r?(D=e=>a(r,e),t[17]=a,t[18]=r,t[19]=D):D=t[19];let O;t[20]!==c||t[21]!==i.text||t[22]!==r||t[23]!==D?(O=(0,$.jsx)(Xn,{patternIndex:r,initialText:i.text,onCommit:D,filePaths:c}),t[20]=c,t[21]=i.text,t[22]=r,t[23]=D,t[24]=O):O=t[24];let k;t[25]===s?k=t[26]:(k=(0,$.jsx)(tr,{visible:s}),t[25]=s,t[26]=k);let A;t[27]!==l||t[28]!==_?(A=l({id:`S9Vnum`,values:{patternText:_}}),t[27]=l,t[28]=_,t[29]=A):A=t[29];let j;t[30]!==o||t[31]!==r?(j=()=>o(r),t[30]=o,t[31]=r,t[32]=j):j=t[32];let M;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(pt,{className:`size-3.5`}),t[33]=M):M=t[33];let N;t[34]!==A||t[35]!==j?(N=(0,$.jsx)(R,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-testid":`settings-okignore-remove`,"aria-label":A,onClick:j,className:`h-7 w-7 shrink-0 text-muted-foreground hover:text-destructive`,children:M}),t[34]=A,t[35]=j,t[36]=N):N=t[36];let P;t[37]!==O||t[38]!==k||t[39]!==N||t[40]!==E?(P=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[E,O,k,N]}),t[37]=O,t[38]=k,t[39]=N,t[40]=E,t[41]=P):P=t[41];let F;return t[42]!==r||t[43]!==p||t[44]!==C||t[45]!==P?(F=(0,$.jsx)(`li`,{ref:p,style:C,className:`flex flex-col gap-0.5 px-2 py-1.5`,"data-testid":`settings-okignore-row`,"data-pattern-index":r,children:P}),t[42]=r,t[43]=p,t[44]=C,t[45]=P,t[46]=F):F=t[46],F}function Xn(e){let t=(0,Z.c)(31),{patternIndex:n,initialText:r,onCommit:i,filePaths:a}=e,{_:o}=y(),[s,c]=(0,Q.useState)(r),l=(0,Q.useRef)(r),u=(0,Q.useRef)(!1),d,f;t[0]===r?(d=t[1],f=t[2]):(d=()=>{u.current||r!==l.current&&(c(r),l.current=r)},f=[r],t[0]=r,t[1]=d,t[2]=f),(0,Q.useEffect)(d,f);let p=or(s),m=sr(s,a),h=n+1,g;t[3]!==s||t[4]!==i?(g=()=>{s!==l.current&&(l.current=s,i(s))},t[3]=s,t[4]=i,t[5]=g):g=t[5];let _=g,v,b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>c(e.target.value),b=()=>{u.current=!0},t[6]=v,t[7]=b):(v=t[6],b=t[7]);let x;t[8]===_?x=t[9]:(x=()=>{u.current=!1,_()},t[8]=_,t[9]=x);let S;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{e.key===`Enter`?(e.preventDefault(),e.currentTarget.blur()):e.key===`Escape`&&(e.preventDefault(),c(l.current),e.currentTarget.blur())},t[10]=S):S=t[10];let C;t[11]!==o||t[12]!==h?(C=o({id:`-YV1Uo`,values:{patternNumber:h}}),t[11]=o,t[12]=h,t[13]=C):C=t[13];let w=p.length>0?`border-amber-500/60 focus-visible:ring-amber-500/40`:``,T;t[14]===w?T=t[15]:(T=L(`h-7 flex-1 font-mono text-xs`,w),t[14]=w,t[15]=T);let E;t[16]!==s||t[17]!==T||t[18]!==x||t[19]!==C?(E=(0,$.jsx)(Rt,{value:s,onChange:v,onFocus:b,onBlur:x,onKeyDown:S,"aria-label":C,className:T,"data-testid":`settings-okignore-row-input`}),t[16]=s,t[17]=T,t[18]=x,t[19]=C,t[20]=E):E=t[20];let D;t[21]===p?D=t[22]:(D=(0,$.jsx)(Qn,{warnings:p}),t[21]=p,t[22]=D);let O;t[23]!==E||t[24]!==D?(O=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[E,D]}),t[23]=E,t[24]=D,t[25]=O):O=t[25];let k;t[26]===m?k=t[27]:(k=(0,$.jsx)(cr,{count:m}),t[26]=m,t[27]=k);let A;return t[28]!==O||t[29]!==k?(A=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[O,k]}),t[28]=O,t[29]=k,t[30]=A):A=t[30],A}function Zn(e){let t=(0,Z.c)(34),{onAdd:n,placeholder:r,rejectionFlashKey:i,filePaths:a}=e,{_:o}=y(),[s,c]=(0,Q.useState)(``),l=or(s),u=sr(s,a),d=mr(i),f;t[0]!==n||t[1]!==s?(f=()=>{let e=s.trim();e.length!==0&&(n(e),c(``))},t[0]=n,t[1]=s,t[2]=f):f=t[2];let p=f,m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>c(e.target.value),t[3]=m):m=t[3];let h;t[4]===p?h=t[5]:(h=e=>{e.key===`Enter`&&(e.preventDefault(),p())},t[4]=p,t[5]=h);let g;t[6]===o?g=t[7]:(g=o({id:`p9sdCy`}),t[6]=o,t[7]=g);let _=d?`border-destructive ring-2 ring-destructive/30 focus-visible:ring-destructive/50`:l.length>0?`border-amber-500/60 focus-visible:ring-amber-500/40`:``,b;t[8]===_?b=t[9]:(b=L(`h-8 text-sm`,_),t[8]=_,t[9]=b);let x=d?`true`:void 0,S;t[10]!==s||t[11]!==r||t[12]!==h||t[13]!==g||t[14]!==b||t[15]!==x?(S=(0,$.jsx)(Rt,{value:s,onChange:m,onKeyDown:h,placeholder:r,"aria-label":g,className:b,"data-testid":`settings-okignore-add-input`,"data-rejection-flashing":x}),t[10]=s,t[11]=r,t[12]=h,t[13]=g,t[14]=b,t[15]=x,t[16]=S):S=t[16];let C;t[17]===l?C=t[18]:(C=(0,$.jsx)(Qn,{warnings:l}),t[17]=l,t[18]=C);let w;t[19]===s?w=t[20]:(w=s.trim(),t[19]=s,t[20]=w);let T=w.length===0,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(v,{id:`BY-g4_`}),t[21]=E):E=t[21];let D;t[22]!==p||t[23]!==T?(D=(0,$.jsx)(R,{size:`sm`,onClick:p,disabled:T,"data-testid":`settings-okignore-add-button`,children:E}),t[22]=p,t[23]=T,t[24]=D):D=t[24];let O;t[25]!==D||t[26]!==S||t[27]!==C?(O=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[S,C,D]}),t[25]=D,t[26]=S,t[27]=C,t[28]=O):O=t[28];let k;t[29]===u?k=t[30]:(k=(0,$.jsx)(cr,{count:u}),t[29]=u,t[30]=k);let A;return t[31]!==O||t[32]!==k?(A=(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,"data-testid":`settings-okignore-add`,children:[O,k]}),t[31]=O,t[32]=k,t[33]=A):A=t[33],A}function Qn(e){let t=(0,Z.c)(31),{warnings:n}=e,{_:r}=y();if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`flex w-4 shrink-0 justify-center`,"data-testid":`settings-okignore-warning-indicator`,"data-warnings":`0`}),t[0]=e):e=t[0],e}let i,a,o,s,c,l,u;t[1]!==r||t[2]!==n?(o=n.map(er).join(` `),a=gt,i=mt,u=!0,s=`status`,c=`polite`,l=r({id:`NORKZU`,values:{summary:o}}),t[1]=r,t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u):(i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9]);let d=String(n.length),f;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(ft,{"aria-hidden":`true`,className:`size-3.5`}),t[10]=f):f=t[10];let p;t[11]===o?p=t[12]:(p=(0,$.jsx)(`span`,{className:`sr-only`,children:o}),t[11]=o,t[12]=p);let m;t[13]!==s||t[14]!==c||t[15]!==l||t[16]!==d||t[17]!==p?(m=(0,$.jsxs)(`span`,{role:s,"aria-live":c,"aria-label":l,className:`flex w-4 shrink-0 cursor-help justify-center text-amber-500`,"data-testid":`settings-okignore-warning-indicator`,"data-warnings":d,children:[f,p]}),t[13]=s,t[14]=c,t[15]=l,t[16]=d,t[17]=p,t[18]=m):m=t[18];let h;t[19]!==i||t[20]!==u||t[21]!==m?(h=(0,$.jsx)(i,{asChild:u,children:m}),t[19]=i,t[20]=u,t[21]=m,t[22]=h):h=t[22];let g;t[23]===n?g=t[24]:(g=n.map($n),t[23]=n,t[24]=g);let _;t[25]===g?_=t[26]:(_=(0,$.jsx)(ht,{side:`top`,className:`max-w-xs`,children:(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-4`,children:g})}),t[25]=g,t[26]=_);let v;return t[27]!==a||t[28]!==_||t[29]!==h?(v=(0,$.jsxs)(a,{children:[h,_]}),t[27]=a,t[28]=_,t[29]=h,t[30]=v):v=t[30],v}function $n(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function er(e){return e.message}function tr(e){let t=(0,Z.c)(4),{visible:n}=e,r;t[0]===n?r=t[1]:(r=n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(G,{"aria-hidden":`true`,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`idD8Ev`})})]}):null,t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`flex w-4 shrink-0 justify-center text-emerald-600`,"data-testid":`settings-okignore-saved-indicator`,children:r}),t[2]=r,t[3]=i),i}function nr(e){return`okignore-pattern-${e}`}function rr(e){let t=e.match(/^okignore-pattern-(\d+)$/);if(!t)return-1;let n=Number.parseInt(t[1]??``,10);return Number.isNaN(n)?-1:n}function ir(e,t){return`${t}::${e}`}function ar(e){return!T(e)||e.code!==`OKIGNORE_INVALID`?null:{detail:e.detail,lineNumber:e.lineNumber}}function or(e){let t=(0,Z.c)(5),n;t[0]===e?n=t[1]:(n=()=>e.length===0?[]:An(e),t[0]=e,t[1]=n);let[r,i]=(0,Q.useState)(n),a,o;return t[2]===e?(a=t[3],o=t[4]):(a=()=>{if(e.length===0){i([]);return}let t=setTimeout(()=>{i(An(e))},Pn);return()=>clearTimeout(t)},o=[e],t[2]=e,t[3]=a,t[4]=o),(0,Q.useEffect)(a,o),r}function sr(e,t){let n=(0,Z.c)(9),r;n[0]===e?r=n[1]:(r=e.trim(),n[0]=e,n[1]=r);let i=r,a;n[2]!==t||n[3]!==i?(a=()=>i.length===0?null:On(i,t),n[2]=t,n[3]=i,n[4]=a):a=n[4];let[o,s]=(0,Q.useState)(a),c,l;return n[5]!==t||n[6]!==i?(c=()=>{if(i.length===0){s(null);return}let e=setTimeout(()=>{s(On(i,t))},Fn);return()=>clearTimeout(e)},l=[i,t],n[5]=t,n[6]=i,n[7]=c,n[8]=l):(c=n[7],l=n[8]),(0,Q.useEffect)(c,l),o}function cr(e){let t=(0,Z.c)(12),{count:n}=e;if(n===null){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`block h-3.5`,"data-testid":`settings-okignore-preview`,"data-preview-state":`hidden`}),t[0]=e):e=t[0],e}let r=n===0,i=String(n),a=r?`text-muted-foreground/70`:`text-muted-foreground`,o;t[1]===a?o=t[2]:(o=L(`block text-xs`,a),t[1]=a,t[2]=o);let s;t[3]===n?s=t[4]:(s=(0,$.jsx)(v,{id:`-3Qbv7`,values:{count:n}}),t[3]=n,t[4]=s);let c;t[5]===r?c=t[6]:(c=r?(0,$.jsx)(`span`,{className:`ml-1 text-muted-foreground/60`,children:(0,$.jsx)(v,{id:`5kWklo`})}):null,t[5]=r,t[6]=c);let l;return t[7]!==i||t[8]!==o||t[9]!==s||t[10]!==c?(l=(0,$.jsxs)(`span`,{role:`status`,"aria-live":`polite`,"data-testid":`settings-okignore-preview`,"data-preview-state":`visible`,"data-preview-count":i,className:o,children:[s,c]}),t[7]=i,t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function lr(e,t,n){let r=[];for(let n of e){let e=t.get(n)?.docExt??`.md`;r.push(n+e)}for(let e of n)r.push(e);return r}function ur(){try{return globalThis.localStorage?.getItem(zn)===`true`}catch{return!1}}function dr(e){try{globalThis.localStorage?.setItem(zn,e?`true`:`false`)}catch(e){console.debug(`[OkignoreSection] localStorage unavailable; advanced toggle will not persist:`,e)}}function fr(){let e=(0,Z.c)(3),[t,n]=(0,Q.useState)(pr),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=e=>{n(e),dr(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function pr(){return ur()}function mr(e){let t=(0,Z.c)(3),[n,r]=(0,Q.useState)(!1),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(e===null)return;r(!0);let t=setTimeout(()=>r(!1),Ln);return()=>clearTimeout(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a),n}function hr(e){return`editor:${e}`}var gr=`skill`;function _r(e){let t=(0,Z.c)(11),{testId:n,children:r}=e,{_:i}=y(),a;t[0]===i?a=t[1]:(a=i({id:`2B6eYX`}),t[0]=i,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(dt,{className:`size-3.5`}),t[2]=o):o=t[2];let s;t[3]!==a||t[4]!==n?(s=(0,$.jsx)(mt,{asChild:!0,children:(0,$.jsx)(R,{variant:`ghost`,size:`icon`,className:`mt-1.5 mr-1.5 h-6 w-6 shrink-0 text-muted-foreground opacity-60 hover:opacity-100`,"aria-label":a,"data-testid":n,children:o})}),t[3]=a,t[4]=n,t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=(0,$.jsx)(ht,{side:`left`,className:`max-w-sm text-left`,children:(0,$.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:r})}),t[6]=r,t[7]=c);let l;return t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(gt,{children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function vr(e){let t=(0,Z.c)(5),{followUp:n,testId:r}=e;if(n===`none`)return null;let i;t[0]===n?i=t[1]:(i=n===`approve-once`?(0,$.jsx)(v,{id:`HTW0Zw`,components:{0:(0,$.jsx)(`code`,{className:`inline-code`})}}):n===`enable-manually`?(0,$.jsx)(v,{id:`NNJsn7`}):(0,$.jsx)(v,{id:`n8DwqQ`}),t[0]=n,t[1]=i);let a;return t[2]!==i||t[3]!==r?(a=(0,$.jsx)(`span`,{role:`status`,className:`text-xs text-amber-600 dark:text-amber-400`,"data-testid":r,children:i}),t[2]=i,t[3]=r,t[4]=a):a=t[4],a}function yr(){let e=(0,Z.c)(29),{_:t}=y(),n=typeof window<`u`?window.okDesktop??null:null,[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l,u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{if(!n)return;let e=!1;return n.projectIntegrations.status().then(t=>{e||i(t)}).catch(()=>{e||o(!0)}),()=>{e=!0}},u=[n],e[0]=l,e[1]=u):(l=e[0],u=e[1]),(0,Q.useEffect)(l,u);let d;e[2]===t?d=e[3]:(d=async function(e,r){if(n){c(e.kind===`editor`?hr(e.id):gr);try{let t=await n.projectIntegrations.setComponent({component:e,enabled:r});i(t.status),t.ok||X.error(t.error)}catch(e){let n=e;X.error(t({id:`gfdqcY`,values:{0:n instanceof Error?n.message:String(n)}}))}c(null)}},e[2]=t,e[3]=d);let f=d,p;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`h3`,{id:`settings-project-ai-tools-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`crqzW5`})}),e[4]=p):p=e[4];let m;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[p,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`ZYtq3m`})})]}),e[5]=m):m=e[5];let h=m;if(!n||a){let t;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-project-ai-tools-title`,className:`space-y-4`,children:[h,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`project-ai-tools-unavailable`,children:(0,$.jsx)(v,{id:`g4WlQK`})})]}),e[6]=t):t=e[6],t}if(r===null){let t;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-project-ai-tools-title`,className:`space-y-4`,children:[h,(0,$.jsxs)(`div`,{className:`space-y-2`,"data-testid":`project-ai-tools-loading`,children:[(0,$.jsx)(Y,{className:`h-10 w-full`}),(0,$.jsx)(Y,{className:`h-10 w-full`})]})]}),e[7]=t):t=e[7],t}if(!r.hasProject){let t;return e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-project-ai-tools-title`,className:`space-y-4`,children:[h,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`project-ai-tools-no-project`,children:(0,$.jsx)(v,{id:`yaPGPa`})})]}),e[8]=t):t=e[8],t}let g=s!==null||!r.available,_;e[9]===r.available?_=e[10]:(_=!r.available&&(0,$.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,"data-testid":`project-ai-tools-read-only`,children:(0,$.jsx)(v,{id:`_NX6gG`})}),e[9]=r.available,e[10]=_);let b;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(v,{id:`psfGPX`})}),e[11]=b):b=e[11];let x;if(e[12]!==f||e[13]!==g||e[14]!==r.editors){let t;e[16]!==f||e[17]!==g?(t=e=>(0,$.jsx)(xr,{editor:e,busy:g,onToggle:t=>void f({kind:`editor`,id:e.id},t)},e.id),e[16]=f,e[17]=g,e[18]=t):t=e[18],x=r.editors.map(t),e[12]=f,e[13]=g,e[14]=r.editors,e[15]=x}else x=e[15];let S;e[19]===x?S=e[20]:(S=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[b,(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`,children:x})]}),e[19]=x,e[20]=S);let C;e[21]!==f||e[22]!==g||e[23]!==r.skill?(C=r.skill!==null&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(v,{id:`LtiJ5c`})}),(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 overflow-hidden`,children:(0,$.jsxs)(`li`,{className:`flex items-start hover:bg-accent`,children:[(0,$.jsxs)(Mt,{htmlFor:`project-ai-tools-skill`,className:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(Ot,{id:`project-ai-tools-skill`,checked:r.skill.installed,disabled:g,onCheckedChange:()=>void f({kind:`skill`},!r.skill?.installed),className:`mt-0.5`,"data-testid":`project-ai-tools-skill-checkbox`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(`code`,{children:`open-knowledge`})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(v,{id:`khCa4M`})})]})]}),(0,$.jsxs)(_r,{testId:`project-ai-tools-skill-info`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(v,{id:`HSh8u_`})}),r.skill.paths.map(br)]})]})})]}),e[21]=f,e[22]=g,e[23]=r.skill,e[24]=C):C=e[24];let w;return e[25]!==_||e[26]!==S||e[27]!==C?(w=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-project-ai-tools-title`,className:`space-y-4`,children:[h,_,S,C]}),e[25]=_,e[26]=S,e[27]=C,e[28]=w):w=e[28],w}function br(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}function xr(e){let t=(0,Z.c)(45),{editor:n,busy:r,onToggle:i}=e,{_:a}=y(),o=n.state===`installed`||n.state===`foreign`,s=r||n.state===`unmanageable`,c;t[0]!==a||t[1]!==n.state?(c=n.state===`installed`?a({id:`eQkgKV`}):n.state===`foreign`?a({id:`AczYxH`}):n.state===`unmanageable`?a({id:`CXTwen`}):null,t[0]=a,t[1]=n.state,t[2]=c):c=t[2];let l=c,u=n.state===`foreign`||n.state===`unmanageable`?`text-xs text-amber-600 dark:text-amber-400`:`text-xs text-muted-foreground`,d=s?`flex items-start`:`flex items-start hover:bg-accent`,f=`project-ai-tools-editor-${n.id}`,p=s?`flex flex-1 items-start gap-2.5 px-3 py-2.5 font-normal`:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,m=`project-ai-tools-editor-${n.id}`,h;t[3]!==o||t[4]!==i?(h=()=>i(!o),t[3]=o,t[4]=i,t[5]=h):h=t[5];let g=`project-ai-tools-editor-checkbox-${n.id}`,_;t[6]!==o||t[7]!==s||t[8]!==m||t[9]!==h||t[10]!==g?(_=(0,$.jsx)(Ot,{id:m,checked:o,disabled:s,onCheckedChange:h,className:`mt-0.5`,"data-testid":g}),t[6]=o,t[7]=s,t[8]=m,t[9]=h,t[10]=g,t[11]=_):_=t[11];let b;t[12]===n.label?b=t[13]:(b=(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:n.label}),t[12]=n.label,t[13]=b);let x;t[14]!==n.id||t[15]!==u||t[16]!==l?(x=l!==null&&(0,$.jsx)(`span`,{className:u,"data-testid":`project-ai-tools-editor-status-${n.id}`,children:l}),t[14]=n.id,t[15]=u,t[16]=l,t[17]=x):x=t[17];let S;t[18]!==o||t[19]!==n.followUp||t[20]!==n.id?(S=o&&(0,$.jsx)(vr,{followUp:n.followUp,testId:`project-ai-tools-editor-followup-${n.id}`}),t[18]=o,t[19]=n.followUp,t[20]=n.id,t[21]=S):S=t[21];let C;t[22]!==x||t[23]!==S||t[24]!==b?(C=(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[b,x,S]}),t[22]=x,t[23]=S,t[24]=b,t[25]=C):C=t[25];let w;t[26]!==C||t[27]!==f||t[28]!==p||t[29]!==_?(w=(0,$.jsxs)(Mt,{htmlFor:f,className:p,children:[_,C]}),t[26]=C,t[27]=f,t[28]=p,t[29]=_,t[30]=w):w=t[30];let T=`project-ai-tools-editor-info-${n.id}`,E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(v,{id:`J2eKUI`})}),t[31]=E):E=t[31];let D;t[32]===n.configPath?D=t[33]:(D=(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:n.configPath})}),t[32]=n.configPath,t[33]=D);let O;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(`p`,{className:`pt-1 opacity-70`,children:(0,$.jsx)(v,{id:`VIwCaD`})}),t[34]=O):O=t[34];let k;t[35]===n.entryLocator?k=t[36]:(k=(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:n.entryLocator})}),t[35]=n.entryLocator,t[36]=k);let A;t[37]!==T||t[38]!==D||t[39]!==k?(A=(0,$.jsxs)(_r,{testId:T,children:[E,D,O,k]}),t[37]=T,t[38]=D,t[39]=k,t[40]=A):A=t[40];let j;return t[41]!==w||t[42]!==A||t[43]!==d?(j=(0,$.jsxs)(`li`,{className:d,children:[w,A]}),t[41]=w,t[42]=A,t[43]=d,t[44]=j):j=t[44],j}function Sr(e){let t=(0,Z.c)(68),{config:n}=e,{state:r,refresh:i}=Ve(``),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u=be(),d;t[0]===u?d=t[1]:(d=function(e,t){st(h(e,t)),u.close()},t[0]=u,t[1]=d);let f=d,p,m,g,_,y,b,x,S,C;if(t[2]!==n||t[3]!==c||t[4]!==f||t[5]!==i||t[6]!==r){C=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r.status===`ready`?(r.data.folder.templates_available??[]).filter(e=>e.scope===n.scope).sort(wr):[];if(r.status===`error`){let{loadErrorTitle:e}=n,{message:a}=r,o=`settings-${n.testIdPrefix}-section`,s;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>l(!0),t[16]=s):s=t[16];let u;t[17]===n?u=t[18]:(u=(0,$.jsx)(Tr,{config:n,onNewClick:s}),t[17]=n,t[18]=u);let d;t[19]!==e||t[20]!==a?(d=(0,$.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,$.jsx)(v,{id:`uH_S-u`,values:{loadErrorTitle:e,message:a}})}),t[19]=e,t[20]=a,t[21]=d):d=t[21];let p;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(p=new Set,t[22]=p):p=t[22];let m;t[23]!==f||t[24]!==i?(m=e=>{i(),f(``,e)},t[23]=f,t[24]=i,t[25]=m):m=t[25];let h;t[26]!==c||t[27]!==m?(h=(0,$.jsx)(ve,{folderPath:``,existingNames:p,open:c,onOpenChange:l,onCreated:m}),t[26]=c,t[27]=m,t[28]=h):h=t[28];let g;t[29]!==n.settingsId||t[30]!==o||t[31]!==u||t[32]!==d||t[33]!==h?(g=(0,$.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":n.settingsId,"data-testid":o,children:[u,d,h]}),t[29]=n.settingsId,t[30]=o,t[31]=u,t[32]=d,t[33]=h,t[34]=g):g=t[34],C=g;break bb0}if(r.status===`idle`||r.status===`loading`){let e=`settings-${n.testIdPrefix}-section`,r;t[35]===n?r=t[36]:(r=(0,$.jsx)(Tr,{config:n}),t[35]=n,t[36]=r);let i;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`rounded-lg border bg-card p-3 space-y-2`,children:[(0,$.jsx)(Y,{className:`h-12 w-full`}),(0,$.jsx)(Y,{className:`h-12 w-full`})]}),t[37]=i):i=t[37];let a;t[38]!==n.settingsId||t[39]!==e||t[40]!==r?(a=(0,$.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":n.settingsId,"data-testid":e,children:[r,i]}),t[38]=n.settingsId,t[39]=e,t[40]=r,t[41]=a):a=t[41],C=a;break bb0}_=`space-y-3`,y=n.settingsId,b=`settings-${n.testIdPrefix}-section`;let o;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>l(!0),t[42]=o):o=t[42],t[43]===n?x=t[44]:(x=(0,$.jsx)(Tr,{config:n,onNewClick:o}),t[43]=n,t[44]=x);let u=e.length===0?(0,$.jsx)(`p`,{className:`px-3 py-4 text-sm text-muted-foreground`,"data-testid":`settings-${n.testIdPrefix}-empty`,children:n.emptyMessage}):(0,$.jsx)(`ul`,{className:`space-y-1 p-2`,"data-testid":`settings-${n.testIdPrefix}-list`,children:e.map(e=>(0,$.jsx)(he,{template:e,onEdit:()=>f(e.source_folder,e.name),onDelete:()=>s(e),badge:(0,$.jsx)(a,{variant:n.badge.variant,className:`text-2xs`,children:n.badge.label})},e.name))});t[45]===u?S=t[46]:(S=(0,$.jsx)(`div`,{className:`rounded-lg border bg-card`,children:u}),t[45]=u,t[46]=S),p=ve,m=``,g=new Set(e.map(Cr))}t[2]=n,t[3]=c,t[4]=f,t[5]=i,t[6]=r,t[7]=p,t[8]=m,t[9]=g,t[10]=_,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C}else p=t[7],m=t[8],g=t[9],_=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15];if(C!==Symbol.for(`react.early_return_sentinel`))return C;let w;t[47]!==f||t[48]!==i?(w=e=>{i(),f(``,e)},t[47]=f,t[48]=i,t[49]=w):w=t[49];let T;t[50]!==p||t[51]!==c||t[52]!==w||t[53]!==m||t[54]!==g?(T=(0,$.jsx)(p,{folderPath:m,existingNames:g,open:c,onOpenChange:l,onCreated:w}),t[50]=p,t[51]=c,t[52]=w,t[53]=m,t[54]=g,t[55]=T):T=t[55];let E;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||s(null)},t[56]=E):E=t[56];let D;t[57]!==o||t[58]!==i?(D=(0,$.jsx)(Ce,{template:o,onOpenChange:E,onDeleted:i}),t[57]=o,t[58]=i,t[59]=D):D=t[59];let O;return t[60]!==T||t[61]!==D||t[62]!==_||t[63]!==y||t[64]!==b||t[65]!==x||t[66]!==S?(O=(0,$.jsxs)(`section`,{className:_,"aria-labelledby":y,"data-testid":b,children:[x,S,T,D]}),t[60]=T,t[61]=D,t[62]=_,t[63]=y,t[64]=b,t[65]=x,t[66]=S,t[67]=O):O=t[67],O}function Cr(e){return e.name}function wr(e,t){return(e.title??e.name).toLowerCase().localeCompare((t.title??t.name).toLowerCase())}function Tr(e){let t=(0,Z.c)(14),{config:n,onNewClick:r}=e,i;t[0]!==n.settingsId||t[1]!==n.title?(i=(0,$.jsx)(`h3`,{id:n.settingsId,className:`text-base font-semibold`,children:n.title}),t[0]=n.settingsId,t[1]=n.title,t[2]=i):i=t[2];let a;t[3]===n.description?a=t[4]:(a=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description}),t[3]=n.description,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,$.jsxs)(`div`,{children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7];let s;t[8]!==n.testIdPrefix||t[9]!==r?(s=r?(0,$.jsxs)(R,{variant:`outline`,size:`sm`,className:`font-mono uppercase shrink-0`,onClick:r,"data-testid":`settings-${n.testIdPrefix}-new-button`,children:[(0,$.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(v,{id:`G1Gw0v`})]}):null,t[8]=n.testIdPrefix,t[9]=r,t[10]=s):s=t[10];let c;return t[11]!==o||t[12]!==s?(c=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,s]}),t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function Er(){let e=(0,Z.c)(16),{_:t}=y(),n;e[0]===t?n=e[1]:(n=t({id:`hBMK4W`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(v,{id:`nft48x`,components:{0:(0,$.jsx)(`code`,{className:`font-mono`})}}),e[2]=r):r=e[2];let i;e[3]===t?i=e[4]:(i=t({id:`6Pxqwv`}),e[3]=t,e[4]=i);let a;e[5]===t?a=e[6]:(a=t({id:`BD0XSC`}),e[5]=t,e[6]=a);let o;e[7]===t?o=e[8]:(o=t({id:`ysxgu8`}),e[7]=t,e[8]=o);let s;e[9]===o?s=e[10]:(s={label:o,variant:`gray`},e[9]=o,e[10]=s);let c;return e[11]!==n||e[12]!==i||e[13]!==a||e[14]!==s?(c=(0,$.jsx)(Sr,{config:{scope:`local`,title:n,description:r,emptyMessage:i,loadErrorTitle:a,badge:s,settingsId:`settings-project-templates-title`,testIdPrefix:`project-templates`}}),e[11]=n,e[12]=i,e[13]=a,e[14]=s,e[15]=c):c=e[15],c}var Dr=[2500,5e3];function Or(){let e=(0,Z.c)(48),{_:t}=y(),{projectLocalConfig:n,projectLocalSynced:r,projectLocalBinding:i}=Kt(),{status:a,refresh:o}=pe(),[s,c]=(0,Q.useState)(!1),l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],e[0]=l):l=e[0];let u=(0,Q.useRef)(l),d,f;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{for(let e of u.current)clearTimeout(e)},f=[],e[1]=d,e[2]=f):(d=e[1],f=e[2]),(0,Q.useEffect)(d,f);let p=n?.search?.semantic?.enabled??!1,m=r&&i!==null,h;e[3]===o?h=e[4]:(h=function(){for(let e of u.current)clearTimeout(e);u.current=Dr.map(e=>setTimeout(o,e))},e[3]=o,e[4]=h);let g=h,b;e[5]!==t||e[6]!==i||e[7]!==o||e[8]!==g?(b=function(e){if(i===null)return X.error(t({id:`YW7Q86`})),!1;let n=i.patch({search:{semantic:{enabled:e}}});if(!n.ok){let r=S(n.error);return X.error(t(e?{id:`LYufDw`,values:{detail:r}}:{id:`5mksg0`,values:{detail:r}})),!1}return o(),g(),!0},e[5]=t,e[6]=i,e[7]=o,e[8]=g,e[9]=b):b=e[9];let x=b,C;e[10]===x?C=e[11]:(C=function(e){if(e){c(!0);return}x(!1)},e[10]=x,e[11]=C);let w=C,T;e[12]===x?T=e[13]:(T=function(){x(!0)&&c(!1)},e[12]=x,e[13]=T);let E=T,D=a?.enabled??!1,O=a?.keyPresent??!1,k=a?.ready??!1,A=a?.capable??!1,j=a?.embedded??0,M=a?.total??0,N;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(`h3`,{id:`settings-search-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`3y6XTb`})}),e[14]=N):N=e[14];let P;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[N,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`dUQ7_J`})})]}),e[15]=P):P=e[15];let F;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(`label`,{htmlFor:`settings-search-semantic-toggle`,className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`3y6XTb`})}),e[16]=F):F=e[16];let I;e[17]===p?I=e[18]:(I=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[F,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-search-body`,children:p?(0,$.jsx)(v,{id:`stlgky`}):(0,$.jsx)(v,{id:`kdzzOK`})})]}),e[17]=p,e[18]=I);let L=!m,R;e[19]!==t||e[20]!==p?(R=t(p?{id:`fNr-MX`}:{id:`Aif3E7`}),e[19]=t,e[20]=p,e[21]=R):R=e[21];let z;e[22]!==p||e[23]!==w||e[24]!==L||e[25]!==R?(z=(0,$.jsx)(_,{id:`settings-search-semantic-toggle`,checked:p,disabled:L,onCheckedChange:w,"aria-label":R,"data-testid":`settings-search-semantic-toggle`}),e[22]=p,e[23]=w,e[24]=L,e[25]=R,e[26]=z):z=e[26];let B;e[27]!==I||e[28]!==z?(B=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[I,z]}),e[27]=I,e[28]=z,e[29]=B):B=e[29];let V;e[30]!==A||e[31]!==j||e[32]!==p||e[33]!==O||e[34]!==k||e[35]!==D||e[36]!==a||e[37]!==M?(V=p?(0,$.jsx)(kr,{loaded:a!==null,serverEnabled:D,keyPresent:O,ready:k,capable:A,embedded:j,total:M}):null,e[30]=A,e[31]=j,e[32]=p,e[33]=O,e[34]=k,e[35]=D,e[36]=a,e[37]=M,e[38]=V):V=e[38];let H;e[39]!==B||e[40]!==V?(H=(0,$.jsxs)(`div`,{className:`rounded-md border p-3`,children:[B,V]}),e[39]=B,e[40]=V,e[41]=H):H=e[41];let U;e[42]!==s||e[43]!==E?(U=(0,$.jsx)(Ar,{open:s,onOpenChange:c,onConfirm:E}),e[42]=s,e[43]=E,e[44]=U):U=e[44];let W;return e[45]!==H||e[46]!==U?(W=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-search-title`,className:`space-y-3`,"data-testid":`settings-search`,children:[P,H,U]}),e[45]=H,e[46]=U,e[47]=W):W=e[47],W}function kr(e){let t=(0,Z.c)(12),{loaded:n,serverEnabled:r,keyPresent:i,ready:a,capable:o,embedded:s,total:c}=e;if(!n||!r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`text-muted-foreground text-1sm mt-2`,"data-testid":`settings-search-settling`,children:(0,$.jsx)(v,{id:`AdcGcG`})}),t[0]=e):e=t[0],e}if(!i){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{role:`alert`,className:`mt-2 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-1sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`settings-search-needs-key`,children:(0,$.jsx)(v,{id:`dN20LW`,components:{0:(0,$.jsx)(`span`,{className:`font-medium`})}})}),t[1]=e):e=t[1],e}if(a&&!o){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{role:`alert`,className:`mt-2 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-1sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`settings-search-provider-error`,children:(0,$.jsx)(v,{id:`8BsGpU`,components:{0:(0,$.jsx)(`span`,{className:`font-medium`})}})}),t[2]=e):e=t[2],e}if(!a){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{role:`status`,className:`text-muted-foreground text-1sm mt-2`,"data-testid":`settings-search-pending`,children:(0,$.jsx)(v,{id:`VZSBXL`})}),t[3]=e):e=t[3],e}let l;t[4]!==s||t[5]!==c?(l=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`lVWEIL`,values:{embedded:s,total:c}})}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===s?u=t[8]:(u=s===0?(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`ku0yLQ`})}):null,t[7]=s,t[8]=u);let d;return t[9]!==l||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`mt-2 space-y-0.5`,"data-testid":`settings-search-coverage`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function Ar(e){let t=(0,Z.c)(14),{open:n,onOpenChange:r,onConfirm:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(xt,{children:(0,$.jsx)(v,{id:`vhAnzJ`})}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(Et,{children:[a,(0,$.jsx)(bt,{children:(0,$.jsx)(v,{id:`aENGMB`})})]}),t[1]=o):o=t[1];let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`mb-2 font-medium`,children:(0,$.jsx)(v,{id:`7PNNNs`})}),t[2]=s):s=t[2];let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`li`,{children:(0,$.jsx)(v,{id:`UfW9Kr`})}),t[3]=c):c=t[3];let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`li`,{children:(0,$.jsx)(v,{id:`Emz5BG`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-amber-100 px-1 py-0.5 font-mono text-xs dark:bg-amber-900`})}})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(Ct,{children:(0,$.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,children:[s,(0,$.jsxs)(`ul`,{className:`list-disc space-y-1.5 pl-5`,children:[c,l,(0,$.jsx)(`li`,{children:(0,$.jsx)(v,{id:`o5gfs1`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-amber-100 px-1 py-0.5 font-mono text-xs dark:bg-amber-900`})}})})]})]})}),t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(Tt,{asChild:!0,children:(0,$.jsx)(R,{variant:`outline`,children:(0,$.jsx)(v,{id:`dEgA5A`})})}),t[6]=d):d=t[6];let f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(v,{id:`iMkWoF`}),t[7]=f):f=t[7];let p;t[8]===i?p=t[9]:(p=(0,$.jsxs)(St,{className:`sm:max-w-lg`,"data-testid":`settings-search-confirm`,children:[o,u,(0,$.jsxs)(wt,{children:[d,(0,$.jsx)(R,{onClick:i,"data-testid":`settings-search-confirm-enable`,children:f})]})]}),t[8]=i,t[9]=p);let m;return t[10]!==r||t[11]!==n||t[12]!==p?(m=(0,$.jsx)(Dt,{open:n,onOpenChange:r,children:p}),t[10]=r,t[11]=n,t[12]=p,t[13]=m):m=t[13],m}function jr(e){let t=(0,Z.c)(19),{installStates:n,terminalLaunch:r,disabled:i,onPick:a,onLaunchTerminal:o}=e,{_:s}=y(),[c,l]=(0,Q.useState)(``),u;if(t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==c||t[4]!==o||t[5]!==a||t[6]!==r){let e;t[8]===n?e=t[9]:(e=e=>n[e.id]?.installed===!0,t[8]=n,t[9]=e);let d=K.filter(e),f=K.some(e=>n[e.id]?.installed==null),p=d.length>0,m=r!==null,h=p||m,g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>l(e.target.value),t[10]=g):g=t[10];let _;t[11]===s?_=t[12]:(_=s({id:`Rah7yq`}),t[11]=s,t[12]=_);let y;t[13]===s?y=t[14]:(y=s({id:`ZBt4rI`}),t[13]=s,t[14]=y);let b;t[15]!==c||t[16]!==_||t[17]!==y?(b=(0,$.jsx)(`div`,{className:`px-2 pt-2 pb-1.5`,children:(0,$.jsx)(Rt,{value:c,onChange:g,placeholder:_,"aria-label":y,"data-testid":`open-in-agent-instruction`})}),t[15]=c,t[16]=_,t[17]=y,t[18]=b):b=t[18],u=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[b,h?(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[m?(0,$.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-terminal-label`,children:(0,$.jsx)(v,{id:`ALhMYW`})}),le.map(e=>{let{displayName:t}=N[e];return(0,$.jsxs)(R,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:i,"data-testid":`open-in-agent-terminal-${e}`,"aria-label":s({id:`QYfQdv`,values:{displayName:t}}),onClick:()=>o(e,c),children:[(0,$.jsx)(q,{id:oe(e),"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:t})]},e)})]}):null,p?(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsx)(Ee,{className:`my-1`}):null,(0,$.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-desktop-label`,children:(0,$.jsx)(v,{id:`BBqGS9`})}),d.map(e=>{let{displayName:t}=e;return(0,$.jsxs)(R,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:i,"data-testid":`open-in-agent-item-${e.id}`,"aria-label":s({id:`WqLq6M`,values:{displayName:t}}),onClick:()=>a(e,c),children:[(0,$.jsx)(q,{id:e.id,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:t})]},e.id)})]})]}):null]}):(0,$.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`open-in-agent-empty`,"aria-live":`polite`,children:f?(0,$.jsx)(v,{id:`EcR0fl`}):(0,$.jsx)(v,{id:`l6OXqI`})})]}),t[0]=s,t[1]=i,t[2]=n,t[3]=c,t[4]=o,t[5]=a,t[6]=r,t[7]=u}else u=t[7];return u}function Mr(e){let t=(0,Z.c)(44),{input:n,open:r,onOpenChange:i}=e,{_:a}=y(),{states:o,refresh:s}=J(),{dispatch:c}=fe(),l=de(),[u,m]=(0,Q.useState)(!1),h=(0,Q.useRef)(!1),g=Xe(),_=r??u,b;t[0]===s?b=t[1]:(b=()=>{s()},t[0]=s,t[1]=b);let x=(0,Q.useEffectEvent)(b),S;t[2]!==_||t[3]!==x?(S=()=>{_&&x()},t[2]=_,t[3]=x,t[4]=S):S=t[4];let C;if(t[5]===_?C=t[6]:(C=[_],t[5]=_,t[6]=C),(0,Q.useEffect)(S,C),g)return null;let w=typeof window<`u`&&window.okDesktop!=null,T;t[7]!==i||t[8]!==r?(T=e=>{r===void 0&&m(e),i?.(e)},t[7]=i,t[8]=r,t[9]=T):T=t[9];let E=T,D=n===null,O;t[10]===n?O=t[11]:(O=e=>{if(n===null)return null;let t=e.trim();return t?{...n,instruction:t}:n},t[10]=n,t[11]=O);let k=O,A;t[12]!==c||t[13]!==E||t[14]!==k?(A=(e,t)=>{let n=k(t);n!==null&&(c(e.id,n),E(!1))},t[12]=c,t[13]=E,t[14]=k,t[15]=A):A=t[15];let j=A,M;t[16]!==E||t[17]!==k||t[18]!==l?(M=(e,t)=>{let n=k(t);n===null||l===null||(l.launchInTerminal(n,e),E(!1))},t[16]=E,t[17]=k,t[18]=l,t[19]=M):M=t[19];let N=M,P;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(P=w?()=>{h.current=!0}:void 0,t[20]=P):P=t[20];let F;t[21]===E?F=t[22]:(F=w?()=>{if(h.current){h.current=!1;return}E(!0)}:void 0,t[21]=E,t[22]=F);let I,L;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(Ye,{className:`size-3.5`,"aria-hidden":`true`}),L=(0,$.jsx)(v,{id:`O7_W_a`}),t[23]=I,t[24]=L):(I=t[23],L=t[24]);let z;t[25]!==F||t[26]!==D?(z=(0,$.jsx)(p,{asChild:!0,children:(0,$.jsxs)(R,{variant:`ghost`,size:`sm`,disabled:D,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:P,onClick:F,children:[I,L]})}),t[25]=F,t[26]=D,t[27]=z):z=t[27];let B;t[28]===a?B=t[29]:(B=a({id:`O7_W_a`}),t[28]=a,t[29]=B);let V=n===null,H;t[30]!==N||t[31]!==j||t[32]!==o||t[33]!==V||t[34]!==l?(H=(0,$.jsx)(jr,{installStates:o,terminalLaunch:l,disabled:V,onPick:j,onLaunchTerminal:N}),t[30]=N,t[31]=j,t[32]=o,t[33]=V,t[34]=l,t[35]=H):H=t[35];let U;t[36]!==B||t[37]!==H?(U=(0,$.jsx)(d,{align:`end`,className:`p-1`,"aria-label":B,"data-testid":`open-in-agent-menu`,children:H}),t[36]=B,t[37]=H,t[38]=U):U=t[38];let W;return t[39]!==E||t[40]!==_||t[41]!==z||t[42]!==U?(W=(0,$.jsxs)(f,{open:_,onOpenChange:E,children:[z,U]}),t[39]=E,t[40]=_,t[41]=z,t[42]=U,t[43]=W):W=t[43],W}function Nr(e){let t=(0,Z.c)(50),{skill:n,onEdit:r,onDelete:i,onInstall:a,onUninstall:o,installing:s}=e,{_:c}=y(),l=ie(),u;t[0]!==n.name||t[1]!==n.scope||t[2]!==l?(u=ae({skillName:n.name,scope:n.scope,workspace:l}),t[0]=n.name,t[1]=n.scope,t[2]=l,t[3]=u):u=t[3];let d=u,f=`skill-row-${n.name}`,p;t[4]===n.name?p=t[5]:(p=(0,$.jsx)(`code`,{className:`truncate font-mono font-medium`,children:n.name}),t[4]=n.name,t[5]=p);let m;t[6]===n.installed?m=t[7]:(m=(0,$.jsx)(De,{installed:n.installed,className:`text-2xs`}),t[6]=n.installed,t[7]=m);let h;t[8]!==p||t[9]!==m?(h=(0,$.jsxs)(`span`,{className:`flex w-full items-center gap-2`,children:[p,m]}),t[8]=p,t[9]=m,t[10]=h):h=t[10];let g;t[11]===n.description?g=t[12]:(g=n.description?(0,$.jsx)(`span`,{className:`block w-full truncate text-sm text-muted-foreground`,children:n.description}):(0,$.jsx)(`span`,{className:`block w-full truncate text-sm italic text-muted-foreground`,children:(0,$.jsx)(v,{id:`xnP32l`})}),t[11]=n.description,t[12]=g);let _;t[13]===n.hosts?_=t[14]:(_=n.hosts.length>0?(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1 pt-0.5`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`G_efLf`})}),n.hosts.map(Pr)]}):null,t[13]=n.hosts,t[14]=_);let b;t[15]!==r||t[16]!==h||t[17]!==g||t[18]!==_?(b=(0,$.jsxs)(R,{type:`button`,variant:`ghost`,onClick:r,className:`h-auto min-w-0 flex-1 flex-col items-start gap-0.5 px-1.5 py-1 text-left font-normal hover:bg-transparent`,children:[h,g,_]}),t[15]=r,t[16]=h,t[17]=g,t[18]=_,t[19]=b):b=t[19];let x;t[20]===d?x=t[21]:(x=(0,$.jsx)(`span`,{className:`shrink-0 self-center opacity-0 group-hover:opacity-100 focus-within:opacity-100 data-[state=open]:opacity-100`,children:(0,$.jsx)(Mr,{input:d})}),t[20]=d,t[21]=x);let S=`skill-install-${n.name}`,C;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),t[22]=C):C=t[22];let w;t[23]===n.installed?w=t[24]:(w=n.installed?(0,$.jsx)(v,{id:`eQkgKV`}):(0,$.jsx)(v,{id:`TKQ7K-`}),t[23]=n.installed,t[24]=w);let T;t[25]!==s||t[26]!==a||t[27]!==S||t[28]!==w?(T=(0,$.jsxs)(R,{type:`button`,variant:`ghost`,size:`sm`,className:`shrink-0 self-center font-mono uppercase opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:a,disabled:s,"data-testid":S,children:[C,w]}),t[25]=s,t[26]=a,t[27]=S,t[28]=w,t[29]=T):T=t[29];let E;t[30]!==c||t[31]!==n.name?(E=c({id:`RlLl3G`,values:{0:n.name}}),t[30]=c,t[31]=n.name,t[32]=E):E=t[32];let D;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(Fe,{className:`size-4`,"aria-hidden":!0}),t[33]=D):D=t[33];let O;t[34]===E?O=t[35]:(O=(0,$.jsx)(kt,{asChild:!0,children:(0,$.jsx)(R,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 self-center opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,"aria-label":E,children:D})}),t[34]=E,t[35]=O);let k;t[36]!==i||t[37]!==r||t[38]!==o||t[39]!==n?(k=(0,$.jsx)(At,{align:`end`,className:`min-w-52`,children:(0,$.jsx)(ue,{skill:n,onEdit:r,onUninstall:o,onDelete:i})}),t[36]=i,t[37]=r,t[38]=o,t[39]=n,t[40]=k):k=t[40];let A;t[41]!==O||t[42]!==k?(A=(0,$.jsxs)(jt,{children:[O,k]}),t[41]=O,t[42]=k,t[43]=A):A=t[43];let j;return t[44]!==T||t[45]!==A||t[46]!==f||t[47]!==b||t[48]!==x?(j=(0,$.jsxs)(`li`,{className:`group flex items-start gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-muted/50`,"data-testid":f,children:[b,x,T,A]}),t[44]=T,t[45]=A,t[46]=f,t[47]=b,t[48]=x,t[49]=j):j=t[49],j}function Pr(e){return(0,$.jsx)(a,{variant:`gray`,className:`text-2xs`,children:e},e)}function Fr(){let e=(0,Z.c)(8),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(0),[o,s]=(0,Q.useState)(!1),c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/skill-targets`).then(zr).then(t=>{if(e)return;let n=P.safeParse(t);if(!n.success){console.error(`[ok-skills] /api/skill-targets response failed schema validation:`,n.error.issues),r({status:`error`,message:`Server returned an incomplete skill-targets response.`});return}r({status:`ready`,data:n.data})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[1]=c):c=e[1];let l;e[2]===i?l=e[3]:(l=[i],e[2]=i,e[3]=l),(0,Q.useEffect)(c,l);let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=async e=>{s(!0);let t=await fetch(`/api/skill-targets`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({targets:e})}).catch(Rr);if(!t?.ok){s(!1);let e=t?await t.json().catch(Lr):null;throw Error(zt(e)??(t?`HTTP ${t.status}`:`Request failed`))}Bt(),a(Ir),s(!1)},e[4]=u):u=e[4];let d=u,f;return e[5]!==o||e[6]!==n?(f={state:n,save:d,saving:o},e[5]=o,e[6]=n,e[7]=f):f=e[7],f}function Ir(e){return e+1}function Lr(){return null}function Rr(){return null}async function zr(e){if(!e.ok){let t=await e.json().catch(Br);throw Error(zt(t)??`HTTP ${e.status}`)}return e.json()}function Br(){return null}function Vr(){let e=(0,Z.c)(21),{_:t}=y(),{state:n,save:r,saving:i}=Fr(),a=O,o;e[0]!==n.data||e[1]!==n.status?(o=n.status===`ready`?new Set(n.data.targets):new Set,e[0]=n.data,e[1]=n.status,e[2]=o):o=e[2];let s=o,c;e[3]!==t||e[4]!==r||e[5]!==n.data||e[6]!==n.status?(c=async(e,i)=>{if(n.status!==`ready`)return;let a=new Set(n.data.targets);i?a.add(e):a.delete(e);try{await r([...a])}catch(e){let n=e;X.error(t({id:`XqNHcm`,values:{0:n instanceof Error?n.message:String(n)}}))}},e[3]=t,e[4]=r,e[5]=n.data,e[6]=n.status,e[7]=c):c=e[7];let l=c,u;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(`h4`,{id:`settings-skill-targets-heading`,className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`el312q`})}),e[8]=u):u=e[8];let d;e[9]!==n.data||e[10]!==n.status?(d=(0,$.jsxs)(`div`,{children:[u,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:n.status===`ready`&&!n.data.configured?(0,$.jsx)(v,{id:`4XL6N4`}):(0,$.jsx)(v,{id:`Ea1prf`})})]}),e[9]=n.data,e[10]=n.status,e[11]=d):d=e[11];let f;e[12]!==i||e[13]!==s||e[14]!==n.message||e[15]!==n.status||e[16]!==l?(f=n.status===`error`?(0,$.jsx)(`div`,{className:`text-1sm text-destructive`,role:`alert`,"data-testid":`skill-targets-error`,children:(0,$.jsx)(v,{id:`yitgD9`,values:{0:n.message}})}):n.status===`idle`||n.status===`loading`?(0,$.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,$.jsx)(Y,{className:`h-5 w-40`}),(0,$.jsx)(Y,{className:`h-5 w-40`})]}):(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2 pt-1`,disabled:i,children:[(0,$.jsx)(`legend`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`Sq8lf2`})}),a.map(e=>{let t=`skill-target-${e}`;return(0,$.jsxs)(Mt,{htmlFor:t,className:`text-sm font-normal`,children:[(0,$.jsx)(Ot,{id:t,checked:s.has(e),onCheckedChange:t=>l(e,t===!0),disabled:i,"data-testid":`skill-target-${e}`}),(0,$.jsx)(`span`,{children:M[e]})]},e)})]}),e[12]=i,e[13]=s,e[14]=n.message,e[15]=n.status,e[16]=l,e[17]=f):f=e[17];let p;return e[18]!==d||e[19]!==f?(p=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-skill-targets-heading`,className:`space-y-2 rounded-lg border bg-card p-3`,"data-testid":`settings-skill-targets`,children:[d,f]}),e[18]=d,e[19]=f,e[20]=p):p=e[20],p}function Hr(){let e=(0,Z.c)(19),{_:t}=y(),n=Ze(),r=n.global,i;e[0]===t?i=e[1]:(i=t({id:`2bVHbB`}),e[0]=t,e[1]=i);let a;e[2]===t?a=e[3]:(a=t({id:`MmqnGI`}),e[2]=t,e[3]=a);let o;e[4]!==n.global||e[5]!==i||e[6]!==a?(o={title:r,blurb:i,empty:a},e[4]=n.global,e[5]=i,e[6]=a,e[7]=o):o=e[7];let s=n.project,c;e[8]===t?c=e[9]:(c=t({id:`RXNu_r`}),e[8]=t,e[9]=c);let l;e[10]===t?l=e[11]:(l=t({id:`uFOL2y`}),e[10]=t,e[11]=l);let u;e[12]!==n.project||e[13]!==c||e[14]!==l?(u={title:s,blurb:c,empty:l},e[12]=n.project,e[13]=c,e[14]=l,e[15]=u):u=e[15];let d;return e[16]!==o||e[17]!==u?(d={global:o,project:u},e[16]=o,e[17]=u,e[18]=d):d=e[18],d}function Ur(){let e=(0,Z.c)(26),t=se(),n=Hr(),r=be(),[i,a]=(0,Q.useState)(!1),o;e[0]===r?o=e[1]:(o=function(e,t){st(w(e,t)),r.close()},e[0]=r,e[1]=o);let s=o,c=ce(),l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`h3`,{id:`settings-skills-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`PCSkw2`})}),e[2]=l):l=e[2];let u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[l,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`wn8EJi`})})]}),e[3]=u):u=e[3];let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>a(!0),e[4]=d):d=e[4];let f,p;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[u,(0,$.jsxs)(R,{variant:`outline`,size:`sm`,className:`shrink-0 font-mono uppercase`,onClick:d,"data-testid":`settings-skills-new-button`,children:[(0,$.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(v,{id:`MdpSC1`})]})]}),p=(0,$.jsx)(Vr,{}),e[5]=f,e[6]=p):(f=e[5],p=e[6]);let h;e[7]!==c.install||e[8]!==c.installingName||e[9]!==c.requestDelete||e[10]!==c.uninstall||e[11]!==n||e[12]!==s||e[13]!==t.data||e[14]!==t.message||e[15]!==t.status?(h=t.status===`error`?(0,$.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,"data-testid":`settings-skills-error`,children:(0,$.jsx)(v,{id:`OEu_0l`,values:{0:t.message}})}):t.status===`idle`||t.status===`loading`?(0,$.jsxs)(`div`,{className:`rounded-lg border bg-card p-3 space-y-2`,children:[(0,$.jsx)(Y,{className:`h-12 w-full`}),(0,$.jsx)(Y,{className:`h-12 w-full`})]}):Je.map(e=>{let r=t.data.filter(t=>t.scope===e).sort(Wr);return e===`global`&&r.length===0?null:(0,$.jsx)(Gr,{chrome:n[e],scope:e,skills:r,installingName:c.installingName,onEdit:e=>s(e.scope,e.name),onDelete:c.requestDelete,onInstall:c.install,onUninstall:c.uninstall},e)}),e[7]=c.install,e[8]=c.installingName,e[9]=c.requestDelete,e[10]=c.uninstall,e[11]=n,e[12]=s,e[13]=t.data,e[14]=t.message,e[15]=t.status,e[16]=h):h=e[16];let g;e[17]===s?g=e[18]:(g=e=>{let{scope:t,name:n}=e;return s(t,n)},e[17]=s,e[18]=g);let _;e[19]!==i||e[20]!==g?(_=(0,$.jsx)(Pe,{defaultScope:`project`,open:i,onOpenChange:a,onCreated:g}),e[19]=i,e[20]=g,e[21]=_):_=e[21];let y;return e[22]!==c.dialogs||e[23]!==h||e[24]!==_?(y=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-skills-title`,className:`space-y-4`,"data-testid":`settings-skills-section`,children:[f,p,h,c.dialogs,_]}),e[22]=c.dialogs,e[23]=h,e[24]=_,e[25]=y):y=e[25],y}function Wr(e,t){return e.name.toLowerCase().localeCompare(t.name.toLowerCase())}function Gr(e){let t=(0,Z.c)(22),{chrome:n,scope:r,skills:i,installingName:a,onEdit:o,onDelete:s,onInstall:c,onUninstall:l}=e,u=`settings-skills-${r}-heading`,d=`skills-group-${r}`,f;t[0]!==n.title||t[1]!==u?(f=(0,$.jsx)(`h4`,{id:u,className:`text-sm font-medium`,children:n.title}),t[0]=n.title,t[1]=u,t[2]=f):f=t[2];let p;t[3]===n.blurb?p=t[4]:(p=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:n.blurb}),t[3]=n.blurb,t[4]=p);let m;t[5]!==f||t[6]!==p?(m=(0,$.jsxs)(`div`,{children:[f,p]}),t[5]=f,t[6]=p,t[7]=m):m=t[7];let h;t[8]!==n.empty||t[9]!==a||t[10]!==s||t[11]!==o||t[12]!==c||t[13]!==l||t[14]!==r||t[15]!==i?(h=(0,$.jsx)(`div`,{className:`rounded-lg border bg-card`,children:i.length===0?(0,$.jsx)(`p`,{className:`px-3 py-4 text-sm text-muted-foreground`,"data-testid":`skills-group-${r}-empty`,children:n.empty}):(0,$.jsx)(`ul`,{className:`space-y-1 p-2`,"data-testid":`skills-group-${r}-list`,children:i.map(e=>(0,$.jsx)(Nr,{skill:e,installing:a===e.name,onEdit:()=>o(e),onDelete:()=>s(e),onInstall:()=>c(e),onUninstall:()=>l(e)},e.name))})}),t[8]=n.empty,t[9]=a,t[10]=s,t[11]=o,t[12]=c,t[13]=l,t[14]=r,t[15]=i,t[16]=h):h=t[16];let g;return t[17]!==u||t[18]!==d||t[19]!==m||t[20]!==h?(g=(0,$.jsxs)(`section`,{"aria-labelledby":u,className:`space-y-2`,"data-testid":d,children:[m,h]}),t[17]=u,t[18]=d,t[19]=m,t[20]=h,t[21]=g):g=t[21],g}function Kr(e,t){if(e.length===0)throw Error(`buildPatch: path must be non-empty`);let[n,...r]=e;return r.length===0?{[String(n)]:t}:{[String(n)]:Kr(r,t)}}function qr(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(e?.type===`default`){let t=e.defaultValue;return typeof t==`function`?t():t}let n=t?._zod?.def?.innerType;if(n===void 0)return;t=n}}function Jr(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`default`||e.type===`optional`||e.type===`nullable`){t=e.innerType;continue}return e.type}}function Yr(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`enum`)return e.entries?Object.values(e.entries):void 0;if(e.innerType!==void 0){t=e.innerType;continue}return}}function Xr(){let e=(0,Z.c)(71),{_:t}=y(),{enabled:n,synced:r}=Ue(),i=Ke(),a=n!==!1,{userConfig:o,userBinding:s,userSynced:c}=Kt(),l=o?.agents?.autoApproveOkTools!==!1,[u,d]=(0,Q.useState)(!1),f,p;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.terminal.cliPreflight(`codex`).then(e=>{t||d(e.onPath===`present`&&e.okServerConfigured!==!0)}).catch(Zr),()=>{t=!0}},p=[],e[0]=f,e[1]=p):(f=e[0],p=e[1]),(0,Q.useEffect)(f,p);let m;e[2]!==t||e[3]!==i?(m=function(e){if(i===null){X.error(t({id:`w6sBjd`}));return}let n=i(e);n.ok||X.error(t(e?{id:`jKd3AP`,values:{0:n.error}}:{id:`pajIrl`,values:{0:n.error}}))},e[2]=t,e[3]=i,e[4]=m):m=e[4];let h=m,g;e[5]!==t||e[6]!==s?(g=function(e){if(s===null){X.error(t({id:`fnlBN4`}));return}let n=s.patch({agents:{autoApproveOkTools:e}});if(!n.ok){let e=S(n.error);X.error(t({id:`habOU_`,values:{detail:e}}))}},e[5]=t,e[6]=s,e[7]=g):g=e[7];let v=g,b;e[8]===t?b=e[9]:(b=t({id:`ALhMYW`}),e[8]=t,e[9]=b);let x;e[10]===b?x=e[11]:(x=(0,$.jsx)(`h3`,{id:`settings-terminal-title`,className:`text-base font-semibold`,children:b}),e[10]=b,e[11]=x);let C;e[12]===t?C=e[13]:(C=t({id:`FCAcjR`}),e[12]=t,e[13]=C);let w;e[14]===C?w=e[15]:(w=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:C}),e[14]=C,e[15]=w);let T;e[16]!==x||e[17]!==w?(T=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[x,w]}),e[16]=x,e[17]=w,e[18]=T):T=e[18];let E;e[19]===t?E=e[20]:(E=t({id:`E4XYYH`}),e[19]=t,e[20]=E);let D;e[21]===E?D=e[22]:(D=(0,$.jsx)(`label`,{htmlFor:`settings-terminal-toggle`,className:`text-sm font-medium`,children:E}),e[21]=E,e[22]=D);let O;e[23]!==t||e[24]!==a?(O=t(a?{id:`AQGtjK`}:{id:`R65q-K`}),e[23]=t,e[24]=a,e[25]=O):O=e[25];let k;e[26]===O?k=e[27]:(k=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-body`,children:O}),e[26]=O,e[27]=k);let A;e[28]!==D||e[29]!==k?(A=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[D,k]}),e[28]=D,e[29]=k,e[30]=A):A=e[30];let j=!r||i===null,M;e[31]===t?M=e[32]:(M=t({id:`E4XYYH`}),e[31]=t,e[32]=M);let N;e[33]!==h||e[34]!==a||e[35]!==j||e[36]!==M?(N=(0,$.jsx)(_,{id:`settings-terminal-toggle`,checked:a,onCheckedChange:h,disabled:j,"aria-label":M,"data-testid":`settings-terminal-toggle`}),e[33]=h,e[34]=a,e[35]=j,e[36]=M,e[37]=N):N=e[37];let P;e[38]!==A||e[39]!==N?(P=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[A,N]}),e[38]=A,e[39]=N,e[40]=P):P=e[40];let F;e[41]===t?F=e[42]:(F=t({id:`ilodsp`}),e[41]=t,e[42]=F);let I;e[43]===F?I=e[44]:(I=(0,$.jsx)(`label`,{htmlFor:`settings-terminal-autoapprove-toggle`,className:`text-sm font-medium`,children:F}),e[43]=F,e[44]=I);let L;e[45]===t?L=e[46]:(L=t({id:`nP76lk`}),e[45]=t,e[46]=L);let R;e[47]===L?R=e[48]:(R=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-autoapprove-body`,children:L}),e[47]=L,e[48]=R);let z;e[49]!==t||e[50]!==l||e[51]!==u?(z=l&&u?(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-autoapprove-codex-note`,children:t({id:`Kr3VPS`})}):null,e[49]=t,e[50]=l,e[51]=u,e[52]=z):z=e[52];let B;e[53]!==I||e[54]!==R||e[55]!==z?(B=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[I,R,z]}),e[53]=I,e[54]=R,e[55]=z,e[56]=B):B=e[56];let V=!c||s===null,H;e[57]===t?H=e[58]:(H=t({id:`ilodsp`}),e[57]=t,e[58]=H);let U;e[59]!==v||e[60]!==l||e[61]!==V||e[62]!==H?(U=(0,$.jsx)(_,{id:`settings-terminal-autoapprove-toggle`,checked:l,onCheckedChange:v,disabled:V,"aria-label":H,"data-testid":`settings-terminal-autoapprove-toggle`}),e[59]=v,e[60]=l,e[61]=V,e[62]=H,e[63]=U):U=e[63];let W;e[64]!==B||e[65]!==U?(W=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[B,U]}),e[64]=B,e[65]=U,e[66]=W):W=e[66];let ee;return e[67]!==P||e[68]!==W||e[69]!==T?(ee=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-terminal-title`,className:`space-y-3`,children:[T,P,W]}),e[67]=P,e[68]=W,e[69]=T,e[70]=ee):ee=e[70],ee}function Zr(){}function Qr(e){let t=(0,Z.c)(14),n;t[0]===e?n=t[1]:(n=e.current(),t[0]=e,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i={defaultValues:r,mode:`onBlur`},t[2]=r,t[3]=i);let a=me(i),o,s;t[4]!==e||t[5]!==a?(o=()=>e.subscribe(e=>{$r(a,e)}),s=[e,a],t[4]=e,t[5]=a,t[6]=o,t[7]=s):(o=t[6],s=t[7]),(0,Q.useEffect)(o,s);let c;t[8]!==e||t[9]!==a?(c=t=>ei(a,e,t),t[8]=e,t[9]=a,t[10]=c):c=t[10];let l=c,u;return t[11]!==l||t[12]!==a?(u={form:a,commitField:l},t[11]=l,t[12]=a,t[13]=u):u=t[13],u}function $r(e,t){e.reset(t,{keepDirtyValues:!0,keepDirty:!0,keepTouched:!0})}function ei(e,t,n){let r=e.getValues(n),i=Kr(ri(n),r),a=t.patch(i);if(a.ok)return e.clearErrors(n),e.resetField(n,{defaultValue:r,keepError:!1}),!0;if(T(a.error)&&a.error.code===`SCHEMA_INVALID`&&a.error.issues.length>0){e.clearErrors(n);for(let t of a.error.issues){let r=t.path.length>0?t.path.map(String).join(`.`):n;e.setError(r,{type:`config-binding`,message:t.message})}}else e.setError(n,{type:`config-binding`,message:ti(a.error,n)});return!1}function ti(e,t){if(T(e)&&e.code===`SCHEMA_INVALID`){let n=e.issues.find(e=>ni(e,t));if(n)return n.message}return S(e)}function ni(e,t){return e.path.map(String).join(`.`)===t}function ri(e){return e.split(`.`)}var ii=[{path:[`appearance`,`theme`],label:{id:`FEr96N`},description:{id:`JZ8cO6`},control:`enum-toggle`},{path:[`editor`,`wordWrap`],label:{id:`iKSP5j`},description:{id:`mmpzAq`}},{path:[`appearance`,`preview`,`autoOpen`],label:{id:`2XQ8Ww`},description:{id:`bultyE`}}],ai=`data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground data-[state=on]:hover:bg-primary/90`;function oi(e){let t=(0,Z.c)(20),{activeId:n,userBinding:r,okignoreBinding:i,okignoreSynced:a}=e,{_:o}=y();if(n===`preferences`){let e;t[0]!==o||t[1]!==r?(e=r?(0,$.jsx)(fi,{title:o({id:`Q6hhn8`}),description:o({id:`Y_kL7X`}),scope:`user`,binding:r,fields:ii}):(0,$.jsx)(ci,{}),t[0]=o,t[1]=r,t[2]=e):e=t[2];let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(bi,{}),t[3]=n):n=t[3];let i;return t[4]===e?i=t[5]:(i=(0,$.jsxs)(`div`,{className:`space-y-8`,children:[e,n]}),t[4]=e,t[5]=i),i}if(n===`hotkeys`){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ui,{}),t[6]=e):e=t[6],e}if(n===`account`){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`div`,{className:`space-y-8`,children:[(0,$.jsx)(fn,{}),(0,$.jsx)(wn,{})]}),t[7]=e):e=t[7],e}if(n===`sync`){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Si,{}),t[8]=e):e=t[8],e}if(n===`search`){let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Or,{}),t[9]=e):e=t[9],e}if(n===`terminal`){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Xr,{}),t[10]=e):e=t[10],e}if(n===`project-templates`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Er,{}),t[11]=e):e=t[11],e}if(n===`skills`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ur,{}),t[12]=e):e=t[12],e}if(n===`sharing`){let e;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Xt,{}),t[13]=e):e=t[13],e}if(n===`okignore`){let e;return t[14]!==i||t[15]!==a?(e=(0,$.jsx)(Bn,{binding:i,synced:a}),t[14]=i,t[15]=a,t[16]=e):e=t[16],e}if(n===`ai-tools`){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(vn,{}),t[17]=e):e=t[17],e}if(n===`project-ai-tools`){let e;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(yr,{}),t[18]=e):e=t[18],e}if(n===`claude-desktop`){let e;return t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ki,{}),t[19]=e):e=t[19],e}return null}function si(e){if(!T(e)||e.code!==`SCHEMA_INVALID`)return null;let t=e.issues[0];return!t||t.path.length===0?null:t.path.map(String).join(`.`)}function ci(){let e=(0,Z.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Y,{className:`h-5 w-32`}),n=(0,$.jsx)(Y,{className:`h-4 w-64`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`space-y-3`,children:[t,n,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(Y,{className:`h-9 w-full`}),(0,$.jsx)(Y,{className:`h-9 w-full`})]})]}),e[2]=r):r=e[2],r}function li({binding:e}){return Vt(e).split(` / `).map((e,t)=>t===0?(0,$.jsx)(c,{"aria-label":Wt(e),children:e},`kbd-${e}`):(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`qEue6Q`})}),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` / `}),(0,$.jsx)(c,{"aria-label":Wt(e),children:e})]},`or-${e}`))}function ui(){let e=(0,Z.c)(6),{_:t}=y(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`h3`,{id:`settings-hotkeys-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`4KmEoC`})}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[n,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`RaPMZv`})})]}),e[1]=r):r=e[1];let i;e[2]===t?i=e[3]:(i=Ut.map(e=>{let n=Gt.filter(t=>t.category===e);return n.length===0?null:(0,$.jsxs)(`section`,{"aria-labelledby":`settings-hotkeys-${e}`,children:[(0,$.jsx)(`h4`,{id:`settings-hotkeys-${e}`,className:`mb-2 font-mono text-muted-foreground text-xs uppercase tracking-wide`,children:t(Ht[e])}),(0,$.jsx)(`ul`,{"aria-labelledby":`settings-hotkeys-${e}`,className:`m-0 list-none overflow-hidden rounded-md border p-0`,children:n.map(e=>{let n=`settings-hotkey-${e.id}-title`,r=`settings-hotkey-${e.id}-description`,i=e.bindings.reduce(di,0)>4;return(0,$.jsxs)(`li`,{"aria-describedby":r,"aria-labelledby":n,className:L(`grid gap-2 border-border border-b px-3 py-3 last:border-b-0`,i?`sm:grid-cols-1`:`sm:grid-cols-[minmax(0,1fr)_minmax(0,auto)]`),"data-testid":`settings-hotkey-${e.id}`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`font-medium text-sm`,id:n,children:t(e.title)}),(0,$.jsxs)(a,{variant:`gray`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`iXTp5j`})}),t(e.scope)]})]}),(0,$.jsx)(`p`,{className:`text-muted-foreground text-sm`,id:r,children:t(e.description)})]}),(0,$.jsx)(`div`,{className:L(`flex min-w-0 max-w-full self-start content-start flex-wrap items-start gap-1.5`,i?`sm:justify-start`:`sm:max-w-[38rem] sm:justify-end`),children:e.bindings.map(t=>(0,$.jsx)(li,{binding:t},`${e.id}-${t.mac}-${t.windowsLinux}`))})]},e.id)})})]},e)}),e[2]=t,e[3]=i);let o;return e[4]===i?o=e[5]:(o=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-hotkeys-title`,className:`space-y-5`,"data-testid":`settings-hotkeys`,children:[r,(0,$.jsx)(`div`,{className:`space-y-6`,"data-testid":`settings-hotkeys-list`,children:i})]}),e[4]=i,e[5]=o),o}function di(e,t){return e+Vt(t).split(` / `).length}function fi(e){let t=(0,Z.c)(14),{title:n,description:r,scope:i,binding:a,fields:o}=e,{form:s,commitField:c}=Qr(a),[l,u]=(0,Q.useState)(null),d=(0,Q.useRef)(null),f,p;t[0]!==s||t[1]!==i?(f=()=>{let e=i===`project`?k:D,t=Me(t=>{if(t.docName!==e)return;X.error(S(t.error),{duration:8e3});let n=si(t.error);n&&(s.setError(n,{type:`config-validation-rejected`,message:ti(t.error,n)}),s.setFocus(n),u(n),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{u(null),s.clearErrors(n)},600))});return()=>{t(),d.current&&clearTimeout(d.current)}},p=[i,s],t[0]=s,t[1]=i,t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m;t[4]!==c||t[5]!==r||t[6]!==o||t[7]!==l||t[8]!==i||t[9]!==n?(m=(0,$.jsx)(pi,{title:n,description:r,scope:i,fields:o,commitField:c,flashedPath:l}),t[4]=c,t[5]=r,t[6]=o,t[7]=l,t[8]=i,t[9]=n,t[10]=m):m=t[10];let h;return t[11]!==s||t[12]!==m?(h=(0,$.jsx)(tn,{...s,children:m}),t[11]=s,t[12]=m,t[13]=h):h=t[13],h}function pi(e){let t=(0,Z.c)(23),{title:n,description:r,scope:i,fields:a,commitField:o,flashedPath:s}=e,c=`settings-section-${i}-title`,l;t[0]!==n||t[1]!==c?(l=(0,$.jsx)(`h3`,{id:c,className:`text-base font-semibold`,children:n}),t[0]=n,t[1]=c,t[2]=l):l=t[2];let u;t[3]===r?u=t[4]:(u=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}),t[3]=r,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[l,u]}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;if(t[8]!==o||t[9]!==a||t[10]!==s||t[11]!==i){let e;t[13]!==o||t[14]!==s||t[15]!==i?(e=e=>(0,$.jsx)(Ci,{field:e,scope:i,commitField:o,isFlashed:s===e.path.join(`.`)},e.path.join(`.`)),t[13]=o,t[14]=s,t[15]=i,t[16]=e):e=t[16],f=a.map(e),t[8]=o,t[9]=a,t[10]=s,t[11]=i,t[12]=f}else f=t[12];let p;t[17]===f?p=t[18]:(p=(0,$.jsx)(`div`,{className:`space-y-10`,children:f}),t[17]=f,t[18]=p);let m;return t[19]!==d||t[20]!==p||t[21]!==c?(m=(0,$.jsxs)(`section`,{"aria-labelledby":c,className:`space-y-3`,children:[d,p]}),t[19]=d,t[20]=p,t[21]=c,t[22]=m):m=t[22],m}var mi=`content.attachmentFolderPath`,hi=`attachments`;function gi(e){let t=E(e);return t===`./`?`same-folder`:t===`/`?`content-root`:t.startsWith(`./`)?`current-folder-subfolder`:`content-root-folder`}function _i(e){let t=E(e);return t===`./`||t===`/`?hi:t.startsWith(`./`)?t.slice(2)||hi:t}function vi(e){return e.trim().replace(/^(?:\.\/)+/,``).replace(/\/{2,}/g,`/`).replace(/\/+$/g,``)}function yi(e,t){let n=vi(t)||hi;return e===`same-folder`?`./`:e===`content-root`?`/`:e===`current-folder-subfolder`?`./${n}`:n}function bi(){let e=(0,Z.c)(4),{projectBinding:t,projectConfig:n,projectSynced:r}=Kt();if(!t||!r||!n){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ci,{}),e[0]=t):t=e[0],t}let i=n.content.attachmentFolderPath??`./`,a;return e[1]!==i||e[2]!==t?(a=(0,$.jsx)(xi,{binding:t,value:i},i),e[1]=i,e[2]=t,e[3]=a):a=e[3],a}function xi(e){let t=(0,Z.c)(50),{binding:n,value:r}=e,{_:i}=y(),a;t[0]===r?a=t[1]:(a=()=>gi(r),t[0]=r,t[1]=a);let[c,d]=(0,Q.useState)(a),f;t[2]===r?f=t[3]:(f=()=>_i(r),t[2]=r,t[3]=f);let[p,m]=(0,Q.useState)(f),[h,_]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D,O;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{T.current&&clearTimeout(T.current),E.current&&clearTimeout(E.current)},O=[],t[4]=D,t[5]=O):(D=t[4],O=t[5]),(0,Q.useEffect)(D,O);let k,A;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>Me(e=>{if(e.docName!==`__config__/project`||si(e.error)!==mi)return;let t=ti(e.error,mi);X.error(S(e.error),{duration:8e3}),_(t),w(!0),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{w(!1),_(null)},600)}),A=[],t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,Q.useEffect)(k,A);let j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{x(!0),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>x(!1),1200)},t[8]=j):j=t[8];let M=j,N;t[9]!==i||t[10]!==n?(N=e=>{let t=n.patch({content:{attachmentFolderPath:e}});if(t.ok){_(null),M();return}let r=ti(t.error,mi);_(r),X.error(i({id:`eQxm13`,values:{detail:r}}))},t[9]=i,t[10]=n,t[11]=N):N=t[11];let P=N,F;t[12]!==P||t[13]!==p?(F=e=>{if(e!==`same-folder`&&e!==`content-root`&&e!==`current-folder-subfolder`&&e!==`content-root-folder`)return;let t=e,n=t===`current-folder-subfolder`||t===`content-root-folder`?p||hi:p;d(t),m(n),P(yi(t,n))},t[12]=P,t[13]=p,t[14]=F):F=t[14];let I=F,R;t[15]!==P||t[16]!==p||t[17]!==c?(R=()=>{let e=yi(c,p);m(_i(e)),P(e)},t[15]=P,t[16]=p,t[17]=c,t[18]=R):R=t[18];let z=R,B=c===`current-folder-subfolder`||c===`content-root-folder`,V;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(`h3`,{id:`settings-attachments-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`w_Sphq`})}),t[19]=V):V=t[19];let H;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[V,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`Hnl9nT`})})]}),t[20]=H):H=t[20];let U=C&&`animate-settings-flash`,W;t[21]===U?W=t[22]:(W=L(`rounded-md border p-3`,U),t[21]=U,t[22]=W);let ee;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(`div`,{className:`text-sm font-medium`,id:`settings-attachments-location-label`,children:(0,$.jsx)(v,{id:`AsqRE_`})}),t[23]=ee):ee=t[23];let G;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[ee,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`vppAju`})})]}),t[24]=G):G=t[24];let te;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(u,{"aria-labelledby":`settings-attachments-location-label`,"data-testid":`settings-attachments-mode`,size:`sm`,children:(0,$.jsx)(s,{})}),t[25]=te):te=t[25];let ne;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(g,{value:`same-folder`,children:(0,$.jsx)(v,{id:`Q7W-mC`})}),t[26]=ne):ne=t[26];let re;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(g,{value:`content-root`,children:(0,$.jsx)(v,{id:`yWSvcf`})}),t[27]=re):re=t[27];let K;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(g,{value:`current-folder-subfolder`,children:(0,$.jsx)(v,{id:`0YUS3Q`})}),t[28]=K):K=t[28];let ie;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsxs)(o,{children:[ne,re,K,(0,$.jsx)(g,{value:`content-root-folder`,children:(0,$.jsx)(v,{id:`qAx7xG`})})]}),t[29]=ie):ie=t[29];let ae;t[30]!==c||t[31]!==I?(ae=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(16rem,18rem)] sm:items-start`,children:[G,(0,$.jsxs)(l,{value:c,onValueChange:I,children:[te,ie]})]}),t[30]=c,t[31]=I,t[32]=ae):ae=t[32];let oe;t[33]!==i||t[34]!==z||t[35]!==p||t[36]!==B?(oe=B?(0,$.jsxs)(`div`,{className:`mt-3 max-w-sm space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:`settings-attachments-folder-input`,children:(0,$.jsx)(v,{id:`kNqMMd`})}),(0,$.jsx)(Rt,{id:`settings-attachments-folder-input`,value:p,placeholder:i({id:`OeAl1e`}),onChange:e=>m(e.target.value),onBlur:z,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),z())},className:`h-8 text-sm`,"data-testid":`settings-attachments-folder`})]}):null,t[33]=i,t[34]=z,t[35]=p,t[36]=B,t[37]=oe):oe=t[37];let q;t[38]===h?q=t[39]:(q=h?(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,"data-field-error":mi,role:`alert`,children:h}):null,t[38]=h,t[39]=q);let se;t[40]===b?se=t[41]:(se=(0,$.jsx)(Oi,{visible:b}),t[40]=b,t[41]=se);let J;t[42]!==q||t[43]!==se?(J=(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 items-center gap-2`,children:[q,se]}),t[42]=q,t[43]=se,t[44]=J):J=t[44];let ce;return t[45]!==W||t[46]!==ae||t[47]!==oe||t[48]!==J?(ce=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-attachments-title`,className:`space-y-3`,"data-testid":`settings-attachments`,children:[H,(0,$.jsxs)(`div`,{className:W,"data-field":mi,"data-scope":`project`,children:[ae,oe,J]})]}),t[45]=W,t[46]=ae,t[47]=oe,t[48]=J,t[49]=ce):ce=t[49],ce}function Si(){let e=(0,Z.c)(75),{_:t}=y(),n=V(),{projectConfig:r,projectLocalConfig:i,projectLocalSynced:a,projectSynced:o}=Kt(),s=B(),c=H(),{confirmOpen:l,setConfirmOpen:u,onToggleRequest:d,onConfirm:f}=U(s),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1);if(n&&!n.hasRemote&&n.state===`dormant`){let t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`h3`,{id:`settings-sync-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`Nu4DdT`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[t,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`AiNMQ7`})})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`3_6U6f`})}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`i92eAT`})})]}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>m(!0),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[i,(0,$.jsx)(R,{onClick:a,"data-testid":`settings-sync-setup`,children:(0,$.jsx)(v,{id:`zkz0Fg`})})]}),e[5]=o):o=e[5];let s;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(vt,{asChild:!0,children:(0,$.jsxs)(R,{variant:`ghost`,size:`sm`,className:`group gap-1 px-1.5 text-muted-foreground`,children:[(0,$.jsx)(te,{className:`size-3.5 transition-transform group-data-[state=open]:rotate-90`,"aria-hidden":!0}),(0,$.jsx)(v,{id:`6caB2T`})]})}),e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsxs)(yt,{children:[s,(0,$.jsx)(_t,{className:`px-1.5 pt-2 text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`44DSl0`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]}),e[7]=c):c=e[7];let l;return e[8]===p?l=e[9]:(l=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-sync-title`,className:`space-y-4`,"data-testid":`settings-sync-empty`,children:[n,o,c,(0,$.jsx)(We,{open:p,onOpenChange:m})]}),e[8]=p,e[9]=l),l}let b=i?.autoSync?.enabled??!1,x=n?.pushPermission?.checkStatus,S;e[10]!==a||e[11]!==x?(S=xe(a,x),e[10]=a,e[11]=x,e[12]=S):S=e[12];let C=S,w=n?.pushPermission?.checkStatus===`denied`||n?.pausedReason===`no-push-permission`,T;e[13]!==w||e[14]!==n?(T=w||!n?.pausedReason?null:Ge(n.pausedReason),e[13]=w,e[14]=n,e[15]=T):T=e[15];let E=T,D=r?.autoSync?.default??null,O=D===!0?`on`:D===!1?`off`:`ask`,k;e[16]!==t||e[17]!==c?(k=function(e){if(e!==`ask`&&e!==`on`&&e!==`off`)return;if(c===null){X.error(t({id:`fiMNLl`}));return}let n=c(e===`on`?!0:e===`off`?!1:null);if(!n.ok){let e=n.error;X.error(t({id:`oAFVKX`,values:{detail:e}}))}},e[16]=t,e[17]=c,e[18]=k):k=e[18];let A=k,j;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(`h3`,{id:`settings-sync-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`Nu4DdT`})}),e[19]=j):j=e[19];let M;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[j,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`T67A0Y`})})]}),e[20]=M):M=e[20];let N;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(`label`,{htmlFor:`settings-sync-toggle`,className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`Nx7BWE`})}),e[21]=N):N=e[21];let P;e[22]!==b||e[23]!==w?(P=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-sync-body`,children:w?(0,$.jsx)(v,{id:`l8G3S9`}):b?(0,$.jsx)(v,{id:`-gdcIo`}):(0,$.jsx)(v,{id:`qUB_o_`})}),e[22]=b,e[23]=w,e[24]=P):P=e[24];let F;e[25]!==t||e[26]!==n?(F=n?.remote?(0,$.jsxs)(`p`,{className:`text-muted-foreground text-1sm truncate`,"data-testid":`settings-sync-remote`,children:[(0,$.jsx)(v,{id:`Q8A-U_`}),` `,n.remote.webUrl?(0,$.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-foreground hover:text-primary hover:underline inline-flex items-center gap-0.5`,"aria-label":t({id:`1nke1r`,values:{0:n.remote.label}}),"data-testid":`settings-sync-remote-link`,children:[(0,$.jsx)(`span`,{children:n.remote.label}),(0,$.jsx)(ee,{className:`inline size-3.5`,"aria-hidden":!0})]}):(0,$.jsx)(`span`,{className:`font-medium text-foreground`,"data-testid":`settings-sync-remote-label`,children:n.remote.label})]}):null,e[25]=t,e[26]=n,e[27]=F):F=e[27];let I;e[28]!==P||e[29]!==F?(I=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[N,P,F]}),e[28]=P,e[29]=F,e[30]=I):I=e[30];let L;e[31]!==t||e[32]!==b||e[33]!==n?.pushPermission?.checkStatus?(L=n?.pushPermission?.checkStatus===`denied`?t({id:`FnMkli`}):t(b?{id:`OmHTGj`}:{id:`MKOVhz`}),e[31]=t,e[32]=b,e[33]=n?.pushPermission?.checkStatus,e[34]=L):L=e[34];let z;e[35]!==C||e[36]!==b||e[37]!==d||e[38]!==L?(z=(0,$.jsx)(_,{id:`settings-sync-toggle`,checked:b,disabled:C,onCheckedChange:d,"aria-label":L,"data-testid":`settings-sync-toggle`}),e[35]=C,e[36]=b,e[37]=d,e[38]=L,e[39]=z):z=e[39];let G;e[40]!==z||e[41]!==I?(G=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[I,z]}),e[40]=z,e[41]=I,e[42]=G):G=e[42];let ne;e[43]===E?ne=e[44]:(ne=E!==null&&(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground mt-2`,"data-testid":`settings-sync-reason`,children:E}),e[43]=E,e[44]=ne);let re;e[45]===n?.pushPermission?re=e[46]:(re=ge(n?.pushPermission)&&(0,$.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-signin-again`,children:[(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,$.jsx)(v,{id:`C_cPoW`})}),(0,$.jsx)(R,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>g(!0),children:(0,$.jsx)(v,{id:`5lWFkC`})})]}),e[45]=n?.pushPermission,e[46]=re);let K;e[47]!==G||e[48]!==ne||e[49]!==re?(K=(0,$.jsxs)(`div`,{className:`rounded-md border p-3`,children:[G,ne,re]}),e[47]=G,e[48]=ne,e[49]=re,e[50]=K):K=e[50];let ie;e[51]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`j_Z6g7`})}),e[51]=ie):ie=e[51];let ae;e[52]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[ie,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`W3Xlpc`})})]}),e[52]=ae):ae=e[52];let oe=!o,q;e[53]===t?q=e[54]:(q=t({id:`dvGKu2`}),e[53]=t,e[54]=q);let se;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(It,{value:`ask`,className:ai,"data-testid":`settings-sync-default-ask`,children:(0,$.jsx)(v,{id:`EdQY6l`})}),e[55]=se):se=e[55];let J;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,$.jsx)(It,{value:`on`,className:ai,"data-testid":`settings-sync-default-on`,children:(0,$.jsx)(v,{id:`Z5HWHd`})}),e[56]=J):J=e[56];let ce;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(It,{value:`off`,className:ai,"data-testid":`settings-sync-default-off`,children:(0,$.jsx)(v,{id:`az8lvo`})}),e[57]=ce):ce=e[57];let le;e[58]!==O||e[59]!==A||e[60]!==oe||e[61]!==q?(le=(0,$.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2`,"data-testid":`settings-sync-default`,children:[ae,(0,$.jsxs)(Lt,{type:`single`,variant:`outline`,spacing:2,value:O,onValueChange:A,disabled:oe,"aria-label":q,"data-testid":`settings-sync-default-toggle`,children:[se,J,ce]})]}),e[58]=O,e[59]=A,e[60]=oe,e[61]=q,e[62]=le):le=e[62];let ue;e[63]!==l||e[64]!==f||e[65]!==u?(ue=(0,$.jsx)(W,{open:l,onOpenChange:u,onConfirm:f}),e[63]=l,e[64]=f,e[65]=u,e[66]=ue):ue=e[66];let de;e[67]===Symbol.for(`react.memo_cache_sentinel`)?(de=()=>g(!1),e[67]=de):de=e[67];let fe;e[68]===h?fe=e[69]:(fe=(0,$.jsx)(we,{open:h,onOpenChange:g,onSuccess:de}),e[68]=h,e[69]=fe);let pe;return e[70]!==K||e[71]!==le||e[72]!==ue||e[73]!==fe?(pe=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-sync-title`,className:`space-y-3`,children:[M,K,le,ue,fe]}),e[70]=K,e[71]=le,e[72]=ue,e[73]=fe,e[74]=pe):pe=e[74],pe}function Ci({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let{_:i}=y(),a=Ne(),o=C(j,e.path),s=o?Jr(o):void 0,c=o?qr(o):void 0,l=o?Yr(o):void 0,u=o?F(o):void 0,d=u?.scope===`project`&&t!==`project`||u?.scope===`user`&&t!==`user`,f=e.path.join(`.`),p=i(e.label),[m,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]);let _=()=>{h(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(!1),1200)},b=()=>{let e=n(f);return e&&_(),e},x=()=>a.getFieldState(f).isDirty?b():!0,S=()=>{let e=c===void 0?null:c;a.setValue(f,e,{shouldDirty:!1}),b()},w=L(`relative`,r&&`animate-settings-flash`);return(0,$.jsx)(rn,{control:a.control,name:f,render:({field:n})=>{let r=!d&&(c!==void 0||n.value!==void 0);return(0,$.jsxs)(sn,{className:w,"data-field":e.path.join(`.`),"data-scope":t,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(cn,{className:`text-sm font-medium`,children:p}),r?(0,$.jsxs)(gt,{children:[(0,$.jsx)(mt,{asChild:!0,children:(0,$.jsx)(R,{variant:`ghost`,size:`icon`,className:`h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100`,onClick:S,"aria-label":i({id:`lhjq3G`,values:{labelText:p}}),children:(0,$.jsx)(Jt,{className:`size-3.5`})})}),(0,$.jsx)(ht,{children:(0,$.jsx)(v,{id:`L-rMC9`})})]}):null]}),e.description?(0,$.jsx)(un,{className:`text-muted-foreground text-1sm`,children:i(e.description)}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(ln,{children:(0,$.jsx)(wi,{field:e,ctl:n,typeTag:s,enumOptions:l,onCommit:x})}),(0,$.jsx)(Oi,{visible:m})]}),(0,$.jsx)(dn,{"data-field-error":e.path.join(`.`)})]})}})}function wi({field:e,ctl:t,typeTag:n,enumOptions:r,onCommit:i,...a}){"use no memo";let{_:o}=y(),{setTheme:s}=b();if(n===`boolean`)return(0,$.jsx)(_,{...a,checked:!!t.value,ref:t.ref,onCheckedChange:e=>{t.onChange(e),i()},onBlur:t.onBlur});if(n===`enum`&&r&&r.length>0&&(e.control===`enum-toggle`||r.length<=4)){let{id:n,...c}=a,l=e.path[0]===`appearance`&&e.path[1]===`theme`;return(0,$.jsx)(Lt,{...c,type:`single`,value:typeof t.value==`string`?t.value:``,ref:t.ref,onValueChange:e=>{e&&(l&&s(e),t.onChange(e),i())},onBlur:t.onBlur,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,"aria-label":o(e.label),children:r.map((e,t)=>(0,$.jsx)(It,{value:e,id:t===0?n:void 0,className:`text-1sm capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(Ei,{ctl:t,onCommit:i,...a}):n===`array`?(0,$.jsx)(Di,{ctl:t,onCommit:i,...a}):(0,$.jsx)(Ti,{ctl:t,onCommit:i,...a})}function Ti({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(Rt,{...n,value:typeof e.value==`string`?e.value:``,ref:e.ref,onChange:t=>e.onChange(t.target.value),onBlur:()=>{e.onBlur(),t()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),t())},className:`h-8 text-sm`})}function Ei({ctl:e,onCommit:t,...n}){"use no memo";let[r,i]=(0,Q.useState)(e.value===void 0?``:String(e.value)),a=(0,Q.useRef)(e.value);(0,Q.useEffect)(()=>{a.current!==e.value&&(i(e.value===void 0?``:String(e.value)),a.current=e.value)},[e.value]);let o=()=>{let n=Number(r);if(!Number.isFinite(n)){e.onChange(r),t();return}e.onChange(n),t(),a.current=n};return(0,$.jsx)(Rt,{...n,type:`number`,value:r,ref:e.ref,onChange:e=>i(e.target.value),onBlur:()=>{e.onBlur(),o()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())},className:`h-8 w-28 text-sm tabular-nums`})}function Di({ctl:e,onCommit:t,...n}){"use no memo";let r=Array.isArray(e.value)?e.value.join(`
|
|
3
|
-
`):``,[i,a]=(0,Q.useState)(r),o=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{let t=Array.isArray(e.value)?e.value.join(`
|
|
4
|
-
`):``;t!==o.current&&(a(t),o.current=t)},[e.value]);let s=()=>{let n=i.split(`
|
|
5
|
-
`).map(e=>e.trim()).filter(e=>e.length>0);e.onChange(n),t(),o.current=n.join(`
|
|
6
|
-
`)};return(0,$.jsx)(`textarea`,{...n,value:i,ref:e.ref,onChange:e=>a(e.target.value),onBlur:()=>{e.onBlur(),s()},rows:Math.max(2,Math.min(6,i.split(`
|
|
7
|
-
`).length)),className:`min-h-16 w-full rounded-md border border-input bg-background px-3 py-1.5 font-mono text-xs outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`})}function Oi(e){let t=(0,Z.c)(4),{visible:n}=e,r;t[0]===n?r=t[1]:(r=n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(G,{"aria-hidden":`true`,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`idD8Ev`})})]}):null,t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-emerald-600`,children:r}),t[2]=r,t[3]=i),i}function ki(){(0,Z.c)(16);let[e,t]=(0,Q.useState)(!1),{skillInstalled:n,refresh:r}=qe();return null}export{oi as SettingsDialogBody};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Hi as e,Ui as t}from"./dist-CJfVM-iJ.js";import{t as n}from"./file-tree-rename-validation-DeKIxKnc.js";import{_ as r,g as i,h as a,i as o}from"./navigation-targets-DM3L8UZy.js";import{c as s,o as c,s as l}from"./doc-hash-BLS3MEoj.js";var u=`application/x-open-knowledge-sidebar-item+json`,d={image:!0,video:!0,audio:!0,pdf:!0,text:!0,mermaid:!0};function f(e){return JSON.stringify(e)}function p(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:s(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:c(e.assetPath)}:{target:o(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:l(e.docName)}}function m(e){if(!e||!Array.from(e.types).includes(`application/x-open-knowledge-sidebar-item+json`))return null;let t=e.getData(u);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!h(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!g(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function h(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function g(e){return typeof e==`string`&&Object.hasOwn(d,e)}var _={background:`#171717`,foreground:`#e5e5e5`,cursor:`#e5e5e5`,cursorAccent:`#171717`,selectionBackground:`#3a3d41`,black:`#000000`,red:`#cd3131`,green:`#0dbc79`,yellow:`#e5e510`,blue:`#2472c8`,magenta:`#bc3fbc`,cyan:`#11a8cd`,white:`#e5e5e5`,brightBlack:`#666666`,brightRed:`#f14c4c`,brightGreen:`#23d18b`,brightYellow:`#f5f543`,brightBlue:`#3b8eea`,brightMagenta:`#d670d6`,brightCyan:`#29b8db`,brightWhite:`#ffffff`},v={background:`#ffffff`,foreground:`#262626`,cursor:`#262626`,cursorAccent:`#ffffff`,selectionBackground:`#add6ff`,black:`#000000`,red:`#cd3131`,green:`#00bc00`,yellow:`#949800`,blue:`#0451a5`,magenta:`#bc05bc`,cyan:`#0598bc`,white:`#555555`,brightBlack:`#666666`,brightRed:`#cd3131`,brightGreen:`#14ce14`,brightYellow:`#b5ba00`,brightBlue:`#0451a5`,brightMagenta:`#bc05bc`,brightCyan:`#0598bc`,brightWhite:`#a5a5a5`};function y(e){return e===`dark`?_:v}var b=`.md`,x=/\.(md|mdx)$/i;function S(t,n=b){return x.test(t)||e(t)?t:`${t}${n}`}function C(e){return Q(e).replace(x,``)}function w(e,t){let n=Q(e),r=t.find(e=>i(e)&&T(e)===n);if(r)return r.docName;let a=C(n);return t.find(e=>{let t=T(e);return t!==n&&x.test(t)&&C(t)===a})&&x.test(n)?n:a}function T(e){return r(e)?O(e.path):a(e)?e.path:S(e.docName,e.docExt)}function E(e){let t=Q(e).match(x);return t?`.${t[1].toLowerCase()}`:void 0}function D(e){return Q(e)}function O(e){let t=Q(e.trim());return t?`${t}/`:``}function k(e){return e.endsWith(`/`)?D(e):C(e)}function A(e){return e.map(T)}function j(e){return[...e].sort().join(`\0`)}function M(e){return j(A(e))}function N(e){let t=new Set;for(let n of e){let e=(r(n)||a(n)?n.path:n.docName).split(`/`).filter(Boolean);if(e.includes(`.ok`))continue;if(r(n)){let e=O(n.path);e&&t.add(e)}let i=r(n)?e.length:e.length-1;for(let n=1;n<=i;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function P(e){if(!e)return[];let t=Q(e.replace(x,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function F(e,t,n){let r=E(e);if(r)return r;let a=n.find(e=>i(e)&&e.docName===t);return a?a.docExt??b:Z(e).includes(`.`)?void 0:b}function I(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),o=t.filter(e=>{if(!a(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return o.length===1?o[0].path:null}function L(e,t,n){if(E(e))return null;let r=n.find(e=>a(e)&&e.path===t);return r?r.path:Z(e).includes(`.`)?t:I(t,n)}function R(e,t){let n=e.kind===`directory`,r=n?D(e.path):w(e.path,t);if(n)return{kind:`folder`,name:Q(Z(e.path)).replace(x,``),path:r,treePath:B(e.path,!0)};let i=L(e.path,r,t);if(i)return{kind:`asset`,name:Q(Z(i)),path:i,treePath:i};let a=F(e.path,r,t);return{kind:`file`,name:Q(Z(e.path)).replace(x,``),path:r,treePath:B(e.path,!1),docExt:a}}function z(e){return e.kind===`directory`?D(e.path):e.path}function B(e,t){return t?O(e):x.test(e)?e:`${e}${b}`}function V(e,t,n){let r=O(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${b}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function H(e,t){return e===`file`?B(t,!1):`${D(t)}/index${b}`}function U(e,t){return t.kind===`root`||t.directoryPath==null?Z(e):`${t.directoryPath}${Z(e)}`}function W(e,t){if(t)return D(O(e));let n=C(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function G(e,t){let n=D(O(e));return n?`${n}/${t}`:t}function K(e,t,n){e.append(`parentDocName`,G(t,n)),e.append(`placement`,`parent-dir`)}function q(e,t){return(t.path??G(e,t.src)).replace(/^\/+/,``)}function J(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function Y(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function X(e,r){let i=n(e).toLowerCase();if(i===``)return null;let a=new Date().toISOString();if(i===`.md`||i===`.mdx`)return{kind:`document`,docName:C(e),docExt:i,modified:a,size:r.size};let o=i.startsWith(`.`)?i.slice(1):i;return{kind:`asset`,path:e,assetExt:o,mediaKind:t(o),modified:a,size:r.size}}function Z(e){let t=Q(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Q(e){return e.endsWith(`/`)?e.slice(0,-1):e}export{f as A,j as C,u as D,y as E,p as O,R as S,q as T,z as _,H as a,C as b,A as c,T as d,Y as f,W as g,B as h,U as i,m as k,M as l,J as m,N as n,V as o,O as p,P as r,S as s,K as t,X as u,I as v,k as w,w as x,D as y};
|