@inkeep/open-knowledge 0.0.0-dev-20260501122629 → 0.0.0-dev-20260501144307

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cli.mjs +5 -5
  2. package/dist/constants-D4b3yFb4.mjs +2 -0
  3. package/dist/index.mjs +1 -1
  4. package/dist/init-CleqrmS6.mjs +1 -0
  5. package/dist/init-D1vMwuMO.mjs +1 -0
  6. package/dist/{init-BCKGDNi5.mjs → init-DpiVQYhQ.mjs} +3 -3
  7. package/dist/{init-5DdHFOn5.mjs → init-qoXDcT6N.mjs} +2 -2
  8. package/dist/{loader-DPYQX6A4.mjs → loader-BEUtMT2_.mjs} +2 -2
  9. package/dist/loader-CwvZAVlq.mjs +1 -0
  10. package/dist/paths-B1biT3Kh.mjs +2 -0
  11. package/dist/paths-BQoQfIvS.mjs +1 -0
  12. package/dist/{preview-Du0nzUle.mjs → preview-BIrbsSSc.mjs} +2 -2
  13. package/dist/preview-BNMytxTe.mjs +1 -0
  14. package/dist/public/assets/SettingsPane-tlYUoGwR.js +6 -0
  15. package/dist/public/assets/config-validation-events-Dlj9dOCp.js +1 -0
  16. package/dist/public/assets/index-DiLfeu2w.css +1 -0
  17. package/dist/public/assets/{index-Co7fh3o_.js → index-n9oW9uU-.js} +12 -12
  18. package/dist/public/index.html +3 -3
  19. package/dist/src-CGZcpVS_.mjs +1 -0
  20. package/dist/{start-DxnG8rrP.mjs → start-BSqokDQs.mjs} +2 -2
  21. package/dist/start-C7hQj_dW.mjs +1 -0
  22. package/package.json +1 -1
  23. package/dist/constants-BLXHRgxh.mjs +0 -2
  24. package/dist/init-DF-E9KdN.mjs +0 -1
  25. package/dist/init-rD8YKpQP.mjs +0 -1
  26. package/dist/loader-Cr-MhIko.mjs +0 -1
  27. package/dist/paths-D_eMsBW4.mjs +0 -1
  28. package/dist/paths-Dhmr8b15.mjs +0 -2
  29. package/dist/preview--MyGIsAY.mjs +0 -1
  30. package/dist/public/assets/SettingsPane-KcZvMKvd.js +0 -6
  31. package/dist/public/assets/config-validation-events-CQgLCHcr.js +0 -1
  32. package/dist/public/assets/index-Du0-WJgD.css +0 -1
  33. package/dist/src-BtV48QLl.mjs +0 -1
  34. package/dist/start-DCbBu-0B.mjs +0 -1
@@ -20,7 +20,7 @@
20
20
  nothing for the formatter to reindent.
21
21
  -->
22
22
  <script>(() => { let mode = 'wysiwyg'; try { const raw = localStorage.getItem('ok-editor-mode-v1'); if (raw === 'wysiwyg' || raw === 'source') mode = raw; } catch {} window.__OK_EDITOR_MODE__ = mode; })();</script>
23
- <script type="module" crossorigin src="./assets/index-Co7fh3o_.js"></script>
23
+ <script type="module" crossorigin src="./assets/index-n9oW9uU-.js"></script>
24
24
  <link rel="modulepreload" crossorigin href="./assets/chunk-DECur_0Z.js">
25
25
  <link rel="modulepreload" crossorigin href="./assets/trace-api-CbLDdnQA.js">
26
26
  <link rel="modulepreload" crossorigin href="./assets/propagation-api-LnD10wq2.js">
@@ -36,12 +36,12 @@
36
36
  <link rel="modulepreload" crossorigin href="./assets/panel-DT62BXGr.js">
37
37
  <link rel="modulepreload" crossorigin href="./assets/clipboard-CW1hOwDY.js">
38
38
  <link rel="modulepreload" crossorigin href="./assets/circle-check-C-DpX4dU.js">
39
- <link rel="modulepreload" crossorigin href="./assets/config-validation-events-CQgLCHcr.js">
39
+ <link rel="modulepreload" crossorigin href="./assets/config-validation-events-Dlj9dOCp.js">
40
40
  <link rel="modulepreload" crossorigin href="./assets/tooltip-FdwzzIbl.js">
41
41
  <link rel="modulepreload" crossorigin href="./assets/agent-presence-BxT9uQ-C.js">
42
42
  <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-BeUCdVKa.js">
43
43
  <link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-BBTXqzE6.js">
44
- <link rel="stylesheet" crossorigin href="./assets/index-Du0-WJgD.css">
44
+ <link rel="stylesheet" crossorigin href="./assets/index-DiLfeu2w.css">
45
45
  </head>
46
46
 
47
47
  <body class="antialiased">
@@ -0,0 +1 @@
1
+ import"./loader-BEUtMT2_.mjs";import"./init-DpiVQYhQ.mjs";export{};
@@ -1,2 +1,2 @@
1
- import{t as e}from"./esm-wByiX8MO.mjs";import{i as t}from"./constants-BLXHRgxh.mjs";import{spawn as n}from"node:child_process";import{join as r}from"node:path";import{closeSync as i,existsSync as a,mkdirSync as o,openSync as s}from"node:fs";import{setTimeout as c}from"node:timers/promises";function l(){let e=process.execPath,t=process.argv[1];return t?{command:e,prefixArgs:[t]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx @inkeep/open-knowledge\`. This re-introduces the version-drift surface that re-exec was fixing. Observed argv: ${JSON.stringify(process.argv)}`),{command:`npx`,prefixArgs:[`@inkeep/open-knowledge`]})}function u(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 d(e){a(e.lockDir)||o(e.lockDir,{recursive:!0});let t=s(r(e.lockDir,`last-spawn-error.log`),`w`),c=e.spawn??n,{PORT:u,...d}=process.env,f=l();try{let n=c(f.command,[...f.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:d});return n.unref(),n}finally{try{i(t)}catch{}}}async function f(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}function p(e){let t=e.sigtermGraceMs??1e4,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>c(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 m(e){let{config:t,cwd:n}=e,r=e.skipAutoInit??!1,i=e.skipUiAutoSpawn??!1,a=e.idleThresholdMs??18e5,{existsSync:o,mkdirSync:s}=await import(`node:fs`),{resolve:l}=await import(`node:path`),{bootServer:m,ensureProjectGit:h,getLogger:g,isProcessAlive:_,readUiLock:v}=await import(`./dist-B-uWyCj3.mjs`),{resolveContentDir:y}=await import(`./paths-D_eMsBW4.mjs`),b=e.log??g(`start`),x=y(t,n);o(x)||(s(x,{recursive:!0}),b.info({contentDir:x},`Created content directory`));let S=!o(l(n,`.ok`)),C=r?void 0:async()=>{try{let{initContent:e}=await import(`./init-DF-E9KdN.mjs`),t=e(n);return S||t.created.length>0||t.updated.length>0}catch(e){return console.warn(`Auto-init failed:`,e instanceof Error?e.message:e),!1}},w=!1,T=l(x,`.ok`),E=t.server.openOnAgentEdit?()=>{if(w)return;let e=v(T);if(!e||e.port<=0||!_(e.pid))return;w=!0;let t=`http://localhost:${e.port}`;import(`./open-browser-hvFa-TeR.mjs`).then(({openBrowser:e})=>e(t)).catch(()=>{})}:void 0,D=null,O=await m({contentDir:x,projectDir:n,contentRoot:t.content.dir,port:e.port,host:t.server.host,quiet:!1,onAgentWrite:E,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:!0,idleShutdownMs:a,skipAutoInit:r,autoInitFn:C,ensureProjectGitFn:r?void 0:()=>h(n),spawnUiSiblingFn:async({lockDir:t})=>{if(D=u({uiLock:v(t),isAlive:_}),D.action===`spawn`&&!i)try{d({lockDir:t,cwd:n,spawn:e.spawn}),b.info({reason:D.reason},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else D.action===`skip`&&b.info({port:D.port,pid:D.pid},`UI already running at port ${D.port}`)},idleShutdownHandler:e=>p({readUiLock:()=>v(O.lockDir),isAlive:_,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:b}),log:b});D||={action:`skip`,reason:`alive`,pid:0,port:0};let k=D,A=null;if(k.action===`skip`)A=k.port>0?k.port:null;else if(!i){let t=e.uiBindTimeoutMs??3e3;A=await f({readUiLock:()=>v(O.lockDir),now:Date.now,sleep:e=>c(e),timeoutMs:t,pollIntervalMs:50}),A===null&&b.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:O.httpServer,destroy:O.destroy,lockDir:O.lockDir,contentDir:x,port:O.port,ready:O.ready,degraded:O.degraded,uiSpawnDecision:D,resolvedUiPort:A,didAutoInit:O.didAutoInit,didGitInit:O.didGitInit}}function h(n){return new e(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--no-init`,`Skip auto-scaffolding of .ok/`).action(async e=>{let{renderBanner:r}=await import(`./banner-DoFNyNUH.mjs`),{dim:i,error:a,info:o,warning:s}=await import(`./colors-CswooXAS.mjs`),c=n(),l=process.cwd();e.host!==void 0&&(c.server.host=e.host);let u=e.port===void 0?void 0:Number(e.port),d=process.env.PORT?Number(process.env.PORT):void 0,f=u??d,p;try{p=await m({config:c,cwd:l,port:f,skipAutoInit:e.init===!1})}catch(e){let{ProjectGitInitError:t}=await import(`./dist-B-uWyCj3.mjs`);e instanceof t&&(console.error(a(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.`)),e.stderr&&console.error(i(e.stderr.trim())),process.exit(1)),console.error(`${a(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let h=!1,g=async e=>{if(!h){h=!0,console.log(i(`\nShutting down (${e})...`));try{await p.destroy()}catch(e){console.error(`${a(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{g(`SIGINT`)}),process.once(`SIGTERM`,()=>{g(`SIGTERM`)});let _=`http://${c.server.host}:${p.port}`,v=c.server.host===`0.0.0.0`||c.server.host===`::`?`http://0.0.0.0:${p.port}`:void 0,y=p.resolvedUiPort,b=y!==null&&y>0?`http://${c.server.host}:${y}`:_;console.log(r({name:`open-knowledge`,version:t,localUrl:b,apiUrl:b===_?void 0:_,networkUrl:v})),p.didAutoInit&&(console.log(` ${o(`✓`)} Scaffolded .ok/ (first run)`),console.log(` ${i("Tip: Run `open-knowledge init` to register MCP tools for Claude Code")}\n`));let x={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};p.ready.then(async()=>{if(p.degraded.length>0){console.log();for(let e of p.degraded){let t=x[e]??`${e} (check server logs for details)`;console.warn(` ${s(`⚠`)} ${s(e)}: ${i(t)}`)}console.log()}if(p.didAutoInit||p.didGitInit)if(p.didGitInit&&console.log(`\n ${o(`✓`)} Initialized git repo at ${l}/.git/ (default branch: main)`),p.didAutoInit)try{let{previewContent:e,formatPreviewBlock:t}=await import(`./preview--MyGIsAY.mjs`),n=e({projectDir:l,contentDir:p.contentDir});console.log(`\n${t(n,l)}\n`)}catch(e){console.warn(`Content preview unavailable: ${e instanceof Error?e.message:String(e)}`)}else console.log();if(e.open){let{openBrowser:e}=await import(`./open-browser-hvFa-TeR.mjs`);e(b)}}).catch(e=>{console.error(` ${a(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})})}export{d as a,u as i,m as n,h as o,p as r,l as s,f as t};
2
- //# sourceMappingURL=start-DxnG8rrP.mjs.map
1
+ import{t as e}from"./esm-wByiX8MO.mjs";import{i as t}from"./constants-D4b3yFb4.mjs";import{spawn as n}from"node:child_process";import{join as r}from"node:path";import{closeSync as i,existsSync as a,mkdirSync as o,openSync as s}from"node:fs";import{setTimeout as c}from"node:timers/promises";function l(){let e=process.execPath,t=process.argv[1];return t?{command:e,prefixArgs:[t]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx @inkeep/open-knowledge\`. This re-introduces the version-drift surface that re-exec was fixing. Observed argv: ${JSON.stringify(process.argv)}`),{command:`npx`,prefixArgs:[`@inkeep/open-knowledge`]})}function u(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 d(e){a(e.lockDir)||o(e.lockDir,{recursive:!0});let t=s(r(e.lockDir,`last-spawn-error.log`),`w`),c=e.spawn??n,{PORT:u,...d}=process.env,f=l();try{let n=c(f.command,[...f.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:d});return n.unref(),n}finally{try{i(t)}catch{}}}async function f(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}function p(e){let t=e.sigtermGraceMs??1e4,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>c(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 m(e){let{config:t,cwd:n}=e,r=e.skipAutoInit??!1,i=e.skipUiAutoSpawn??!1,a=e.idleThresholdMs??18e5,{existsSync:o,mkdirSync:s}=await import(`node:fs`),{resolve:l}=await import(`node:path`),{bootServer:m,ensureProjectGit:h,getLogger:g,isProcessAlive:_,readUiLock:v}=await import(`./dist-B-uWyCj3.mjs`),{resolveContentDir:y}=await import(`./paths-BQoQfIvS.mjs`),b=e.log??g(`start`),x=y(t,n);o(x)||(s(x,{recursive:!0}),b.info({contentDir:x},`Created content directory`));let S=!o(l(n,`.ok`)),C=r?void 0:async()=>{try{let{initContent:e}=await import(`./init-D1vMwuMO.mjs`),t=e(n);return S||t.created.length>0||t.updated.length>0}catch(e){return console.warn(`Auto-init failed:`,e instanceof Error?e.message:e),!1}},w=!1,T=l(x,`.ok`),E=t.server.openOnAgentEdit?()=>{if(w)return;let e=v(T);if(!e||e.port<=0||!_(e.pid))return;w=!0;let t=`http://localhost:${e.port}`;import(`./open-browser-hvFa-TeR.mjs`).then(({openBrowser:e})=>e(t)).catch(()=>{})}:void 0,D=null,O=await m({contentDir:x,projectDir:n,contentRoot:t.content.dir,port:e.port,host:t.server.host,quiet:!1,onAgentWrite:E,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:!0,idleShutdownMs:a,skipAutoInit:r,autoInitFn:C,ensureProjectGitFn:r?void 0:()=>h(n),spawnUiSiblingFn:async({lockDir:t})=>{if(D=u({uiLock:v(t),isAlive:_}),D.action===`spawn`&&!i)try{d({lockDir:t,cwd:n,spawn:e.spawn}),b.info({reason:D.reason},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else D.action===`skip`&&b.info({port:D.port,pid:D.pid},`UI already running at port ${D.port}`)},idleShutdownHandler:e=>p({readUiLock:()=>v(O.lockDir),isAlive:_,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:b}),log:b});D||={action:`skip`,reason:`alive`,pid:0,port:0};let k=D,A=null;if(k.action===`skip`)A=k.port>0?k.port:null;else if(!i){let t=e.uiBindTimeoutMs??3e3;A=await f({readUiLock:()=>v(O.lockDir),now:Date.now,sleep:e=>c(e),timeoutMs:t,pollIntervalMs:50}),A===null&&b.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:O.httpServer,destroy:O.destroy,lockDir:O.lockDir,contentDir:x,port:O.port,ready:O.ready,degraded:O.degraded,uiSpawnDecision:D,resolvedUiPort:A,didAutoInit:O.didAutoInit,didGitInit:O.didGitInit}}function h(n){return new e(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--no-init`,`Skip auto-scaffolding of .ok/`).action(async e=>{let{renderBanner:r}=await import(`./banner-DoFNyNUH.mjs`),{dim:i,error:a,info:o,warning:s}=await import(`./colors-CswooXAS.mjs`),c=n(),l=process.cwd();e.host!==void 0&&(c.server.host=e.host);let u=e.port===void 0?void 0:Number(e.port),d=process.env.PORT?Number(process.env.PORT):void 0,f=u??d,p;try{p=await m({config:c,cwd:l,port:f,skipAutoInit:e.init===!1})}catch(e){let{ProjectGitInitError:t}=await import(`./dist-B-uWyCj3.mjs`);e instanceof t&&(console.error(a(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.`)),e.stderr&&console.error(i(e.stderr.trim())),process.exit(1)),console.error(`${a(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let h=!1,g=async e=>{if(!h){h=!0,console.log(i(`\nShutting down (${e})...`));try{await p.destroy()}catch(e){console.error(`${a(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{g(`SIGINT`)}),process.once(`SIGTERM`,()=>{g(`SIGTERM`)});let _=`http://${c.server.host}:${p.port}`,v=c.server.host===`0.0.0.0`||c.server.host===`::`?`http://0.0.0.0:${p.port}`:void 0,y=p.resolvedUiPort,b=y!==null&&y>0?`http://${c.server.host}:${y}`:_;console.log(r({name:`open-knowledge`,version:t,localUrl:b,apiUrl:b===_?void 0:_,networkUrl:v})),p.didAutoInit&&(console.log(` ${o(`✓`)} Scaffolded .ok/ (first run)`),console.log(` ${i("Tip: Run `open-knowledge init` to register MCP tools for Claude Code")}\n`));let x={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};p.ready.then(async()=>{if(p.degraded.length>0){console.log();for(let e of p.degraded){let t=x[e]??`${e} (check server logs for details)`;console.warn(` ${s(`⚠`)} ${s(e)}: ${i(t)}`)}console.log()}if(p.didAutoInit||p.didGitInit)if(p.didGitInit&&console.log(`\n ${o(`✓`)} Initialized git repo at ${l}/.git/ (default branch: main)`),p.didAutoInit)try{let{previewContent:e,formatPreviewBlock:t}=await import(`./preview-BNMytxTe.mjs`),n=e({projectDir:l,contentDir:p.contentDir});console.log(`\n${t(n,l)}\n`)}catch(e){console.warn(`Content preview unavailable: ${e instanceof Error?e.message:String(e)}`)}else console.log();if(e.open){let{openBrowser:e}=await import(`./open-browser-hvFa-TeR.mjs`);e(b)}}).catch(e=>{console.error(` ${a(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})})}export{d as a,u as i,m as n,h as o,p as r,l as s,f as t};
2
+ //# sourceMappingURL=start-BSqokDQs.mjs.map
@@ -0,0 +1 @@
1
+ import{o as e}from"./start-BSqokDQs.mjs";export{e as startCommand};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/open-knowledge",
3
- "version": "0.0.0-dev-20260501122629",
3
+ "version": "0.0.0-dev-20260501144307",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,2 +0,0 @@
1
- import"./dist-CUghvkAf.mjs";var e=`0.0.0-dev-20260501122629`;const t=`config.yml`,n=`cache`,r=e,i=`open-knowledge`;export{r as i,t as n,i as r,n as t};
2
- //# sourceMappingURL=constants-BLXHRgxh.mjs.map
@@ -1 +0,0 @@
1
- import{r as e}from"./init-5DdHFOn5.mjs";export{e as initContent};
@@ -1 +0,0 @@
1
- import{o as e}from"./init-BCKGDNi5.mjs";export{e as runInit};
@@ -1 +0,0 @@
1
- import{n as e}from"./loader-DPYQX6A4.mjs";export{e as loadConfig};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./paths-Dhmr8b15.mjs";export{t as resolveContentDir,e as resolveLockDir};
@@ -1,2 +0,0 @@
1
- import"./constants-BLXHRgxh.mjs";import{resolve as e}from"node:path";function t(t,n){return e(n,t.content.dir)}function n(t){return e(t,`.ok`)}export{n,t};
2
- //# sourceMappingURL=paths-Dhmr8b15.mjs.map
@@ -1 +0,0 @@
1
- import{n as e,t}from"./preview-Du0nzUle.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1,6 +0,0 @@
1
- import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{G as i,Lt as a,T as o,Ut as s,Wt as c,kt as l,n as u,t as d,vt as f,w as p}from"./toggle-group-CyBGhndP.js";import{S as m,g as h,r as g,t as _}from"./button-Dyz7QGIk.js";import{I as v,W as y,et as b,n as x,w as S}from"./DocumentContext-gM6_1mHt.js";import{a as C,c as ee,i as w,n as T,r as te}from"./config-validation-events-CQgLCHcr.js";import{S as E,x as D}from"./dialog-FUclf-NK.js";import{i as O,n as k,t as A}from"./tooltip-FdwzzIbl.js";var ne=m(`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`}]]),j=r(),M=e(t(),1),re=e=>e.type===`checkbox`,N=e=>e instanceof Date,P=e=>e==null,ie=e=>typeof e==`object`,F=e=>!P(e)&&!Array.isArray(e)&&ie(e)&&!N(e),ae=e=>F(e)&&e.target?re(e.target)?e.target.checked:e.target.value:e,oe=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),se=e=>{let t=e.constructor&&e.constructor.prototype;return F(t)&&t.hasOwnProperty(`isPrototypeOf`)},ce=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function I(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(ce&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(F(e)&&se(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=I(e[t]));return r}var L=e=>/^\w*$/.test(e),R=e=>e===void 0,le=e=>Array.isArray(e)?e.filter(Boolean):[],z=e=>le(e.replace(/["|']|\]/g,``).split(/\.|\[/)),B=(e,t,n)=>{if(!t||!F(e))return n;let r=(L(t)?[t]:z(t)).reduce((e,t)=>P(e)?void 0:e[t],e);return R(r)||r===e?R(e[t])?n:e[t]:r},V=e=>typeof e==`boolean`,H=e=>typeof e==`function`,U=(e,t,n)=>{let r=-1,i=L(t)?[t]:z(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=F(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}},W={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},G={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},K={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},ue=`form`,de=`root`,fe=M.createContext(null);fe.displayName=`HookFormControlContext`;var pe=()=>M.useContext(fe),me=(e,t,n,r=!0)=>{let i={defaultValues:t._defaultValues};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==G.all&&(t._proxyFormState[i]=!r||G.all),n&&(n[i]=!0),e[i]}});return i},q=typeof window<`u`?M.useLayoutEffect:M.useEffect;function he(e){let t=pe(),{control:n=t,disabled:r,name:i,exact:a}=e||{},[o,s]=M.useState(n._formState),c=M.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return q(()=>n._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!r&&s({...n._formState,...e})}}),[i,r,a]),M.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),M.useMemo(()=>me(o,n,c.current,!1),[o,n])}var J=e=>typeof e==`string`,ge=(e,t,n,r,i)=>J(e)?(r&&t.watch.add(e),B(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),B(n,e))):(r&&(t.watchAll=!0),n),_e=e=>P(e)||!ie(e);function Y(e,t,n=new WeakSet){if(e===t)return!0;if(_e(e)||_e(t))return Object.is(e,t);if(N(e)&&N(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(let i of r){let r=e[i];if(!(i in t))return!1;if(i!==`ref`){let e=t[i];if(N(r)&&N(e)||(F(r)||Array.isArray(r))&&(F(e)||Array.isArray(e))?!Y(r,e,n):!Object.is(r,e))return!1}}return!0}function ve(e){let t=pe(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=M.useRef(i),l=M.useRef(s),u=M.useRef(void 0),d=M.useRef(n),f=M.useRef(r);l.current=s;let[p,m]=M.useState(()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e}),h=M.useCallback(e=>{let t=ge(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),g=M.useCallback(e=>{if(!a){let t=ge(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);Y(e,u.current)||(m(e),u.current=e)}else m(t)}},[n._formValues,n._names,a,r]);q(()=>((d.current!==n||!Y(f.current,r))&&(d.current=n,f.current=r,g()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:e=>{g(e.values)}})),[n,o,r,g]),M.useEffect(()=>n._removeUnmounted());let _=d.current!==n,v=f.current,y=M.useMemo(()=>{if(a)return null;let e=!_&&!Y(v,r);return _||e?h():null},[a,_,r,v,h]);return y===null?p:y}function ye(e){let t=pe(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=oe(i._names.array,n),l=ve({control:i,name:n,defaultValue:M.useMemo(()=>B(i._formValues,n,B(i._defaultValues,n,o)),[i,n,o]),exact:s}),u=he({control:i,name:n,exact:s}),d=M.useRef(e),f=M.useRef(i.register(n,{...e.rules,value:l,...V(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let p=M.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!B(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!B(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!B(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!B(u.validatingFields,n)},error:{enumerable:!0,get:()=>B(u.errors,n)}}),[u,n]),m=M.useCallback(e=>f.current.onChange({target:{value:ae(e),name:n},type:W.CHANGE}),[n]),h=M.useCallback(()=>f.current.onBlur({target:{value:B(i._formValues,n),name:n},type:W.BLUR}),[n,i._formValues]),g=M.useCallback(e=>{let t=B(i._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>H(e.focus)&&e.focus(),select:()=>H(e.select)&&e.select(),setCustomValidity:t=>H(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>H(e.reportValidity)&&e.reportValidity()})},[i._fields,n]),_=M.useMemo(()=>({name:n,value:l,...V(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:m,onBlur:h,ref:g}),[n,r,u.disabled,m,h,g,l]);return M.useEffect(()=>{let e=i._options.shouldUnregister||a;i.register(n,{...d.current.rules,...V(d.current.disabled)?{disabled:d.current.disabled}:{}});let t=(e,t)=>{let n=B(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=I(B(i._options.defaultValues,n,d.current.defaultValue));U(i._defaultValues,n,e),R(B(i._formValues,n))&&U(i._formValues,n,e)}return!c&&i.register(n),()=>{(c?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,c,a]),M.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),M.useMemo(()=>({field:_,formState:u,fieldState:p}),[_,u,p])}var be=e=>e.render(ye(e)),X=M.createContext(null);X.displayName=`HookFormContext`;var xe=()=>M.useContext(X),Se=e=>{let{children:t,watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:p,control:m,register:h,setFocus:g,subscribe:_}=e,v=M.useMemo(()=>({watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:p,control:m,register:h,setFocus:g,subscribe:_}),[o,m,l,i,r,f,h,d,u,a,g,s,_,c,p,n]);return M.createElement(X.Provider,{value:v},M.createElement(fe.Provider,{value:v.control},t))},Ce=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},we=e=>Array.isArray(e)?e:[e],Te=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function Ee(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&F(i)&&a){let e=Ee(i,a);F(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var Z=e=>F(e)&&!Object.keys(e).length,De=e=>e.type===`file`,Oe=e=>{if(!ce)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ke=e=>e.type===`select-multiple`,Ae=e=>e.type===`radio`,je=e=>Ae(e)||re(e),Me=e=>Oe(e)&&e.isConnected;function Ne(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;){if(P(e)){e=void 0;break}e=e[t[r]],r++}return e}function Pe(e){for(let t in e)if(e.hasOwnProperty(t)&&!R(e[t]))return!1;return!0}function Q(e,t){if(J(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:L(t)?[t]:z(t),r=n.length===1?e:Ne(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(F(r)&&Z(r)||Array.isArray(r)&&Pe(r))&&Q(e,n.slice(0,-1)),e}var Fe=e=>{for(let t in e)if(H(e[t]))return!0;return!1};function Ie(e){return Array.isArray(e)||F(e)&&!Fe(e)}function Le(e,t={}){for(let n in e){let r=e[n];Ie(r)?(t[n]=Array.isArray(r)?[]:{},Le(r,t[n])):R(r)||(t[n]=!0)}return t}function Re(e,t,n){n||=Le(t);for(let r in e){let i=e[r];if(Ie(i))R(t)||_e(n[r])?n[r]=Le(i,Array.isArray(i)?[]:{}):Re(i,P(t)?{}:t[r],n[r]);else{let e=t[r];n[r]=!Y(i,e)}}return n}var ze={value:!1,isValid:!1},Be={value:!0,isValid:!0},Ve=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!R(e[0].attributes.value)?R(e[0].value)||e[0].value===``?Be:{value:e[0].value,isValid:!0}:Be:ze}return ze},He=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>R(e)?e:t?e===``?NaN:e&&+e:n&&J(e)?new Date(e):r?r(e):e,Ue={isValid:!1,value:null},We=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Ue):Ue;function Ge(e){let t=e.ref;return De(t)?t.files:Ae(t)?We(e.refs).value:ke(t)?[...t.selectedOptions].map(({value:e})=>e):re(t)?Ve(e.refs).value:He(R(t.value)?e.ref.value:t.value,e)}var Ke=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,qe=(e,t,n,r)=>{let i={};for(let n of e){let e=B(t,n);e&&U(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},Je=e=>e instanceof RegExp,Ye=e=>R(e)?e:Je(e)?e.source:F(e)?Je(e.value)?e.value.source:e.value:e,Xe=e=>({isOnSubmit:!e||e===G.onSubmit,isOnBlur:e===G.onBlur,isOnChange:e===G.onChange,isOnAll:e===G.all,isOnTouch:e===G.onTouched}),Ze=`AsyncFunction`,Qe=e=>!!e&&!!e.validate&&!!(H(e.validate)&&e.validate.constructor.name===Ze||F(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===Ze)),$e=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),et=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),tt=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=B(e,i);if(n){let{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(tt(a,t))break}else if(F(a)&&tt(a,t))break}}};function nt(e,t,n){let r=B(e,n);if(r||L(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=B(t,r),o=B(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var rt=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return Z(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||G.all))},it=(e,t,n)=>!e||!t||e===t||we(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e))),at=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,ot=(e,t)=>!le(B(e,t)).length&&Q(e,t),st=(e,t,n)=>{let r=we(B(e,n));return U(r,de,t[n]),U(e,n,r),e};function ct(e,t,n=`validate`){if(J(e)||Array.isArray(e)&&e.every(J)||V(e)&&!e)return{type:n,message:J(e)?e:``,ref:t}}var lt=e=>F(e)&&!Je(e)?e:{value:e,message:``},ut=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_}=e._f,v=B(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{i&&y.reportValidity&&(y.setCustomValidity(V(e)?``:e||``),y.reportValidity())},x={},S=Ae(o),C=re(o),ee=S||C,w=(g||De(o))&&R(o.value)&&R(v)||Oe(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length||g&&typeof v==`number`&&isNaN(v),T=Ce.bind(null,h,r,x),te=(e,t,n,r=K.maxLength,i=K.minLength)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...T(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!ee&&(w||P(v))||V(v)&&!v||C&&!Ve(s).isValid||S&&!We(s).isValid)){let{value:e,message:t}=J(c)?{value:!!c,message:c}:lt(c);if(e&&(x[h]={type:K.required,message:t,ref:y,...T(K.required,t)},!r))return b(t),x}if(!w&&(!P(d)||!P(f))){let e,t,n=lt(f),i=lt(d);if(!P(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;P(n.value)||(e=r>n.value),P(i.value)||(t=r<i.value)}else{let r=o.valueAsDate||new Date(v),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;J(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),J(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}if((e||t)&&(te(!!e,n.message,i.message,K.max,K.min),!r))return b(x[h].message),x}if((l||u)&&!w&&(J(v)||a&&Array.isArray(v))){let e=lt(l),t=lt(u),n=!P(e.value)&&v.length>+e.value,i=!P(t.value)&&v.length<+t.value;if((n||i)&&(te(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!w&&J(v)){let{value:e,message:t}=lt(p);if(Je(e)&&!v.match(e)&&(x[h]={type:K.pattern,message:t,ref:o,...T(K.pattern,t)},!r))return b(t),x}if(m){if(H(m)){let e=ct(await m(v,n),y);if(e&&(x[h]={...e,...T(K.validate,e.message)},!r))return b(e.message),x}else if(F(m)){let e={};for(let t in m){if(!Z(e)&&!r)break;let i=ct(await m[t](v,n),y,t);i&&(e={...i,...T(t,i.message)},b(i.message),r&&(x[h]=e))}if(!Z(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},dt={mode:G.onSubmit,reValidateMode:G.onChange,shouldFocusError:!0};function ft(e={}){let t={...dt,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:H(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=(F(t.defaultValues)||F(t.values))&&I(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:I(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,l=0,u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u},f={...d},p={array:Te(),state:Te()},m=t.criteriaMode===G.all,h=e=>t=>{clearTimeout(l),l=setTimeout(e,t)},g=async e=>{if(!o.keepIsValid&&!t.disabled&&(d.isValid||f.isValid||e)){let e;t.resolver?(e=Z((await w()).errors),_()):e=await E({fields:r,onlyCheckValid:!0,eventType:W.VALID}),e!==n.isValid&&p.state.next({isValid:e})}},_=(e,r)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?U(n.validatingFields,e,r):Q(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!Z(n.validatingFields)}))},v=e=>{let t=Re(i,a),r=Ke(e);U(n.dirtyFields,r,B(t,r))},y=(e,i=[],s,c,l=!0,u=!0)=>{if(c&&s&&!t.disabled){if(o.action=!0,u&&Array.isArray(B(r,e))){let t=s(B(r,e),c.argA,c.argB);l&&U(r,e,t)}if(u&&Array.isArray(B(n.errors,e))){let t=s(B(n.errors,e),c.argA,c.argB);l&&U(n.errors,e,t),ot(n.errors,e)}if((d.touchedFields||f.touchedFields)&&u&&Array.isArray(B(n.touchedFields,e))){let t=s(B(n.touchedFields,e),c.argA,c.argB);l&&U(n.touchedFields,e,t)}(d.dirtyFields||f.dirtyFields)&&v(e),p.state.next({name:e,isDirty:O(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else U(a,e,i)},b=(e,t)=>{U(n.errors,e,t),p.state.next({errors:n.errors})},x=e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},S=(e,t,n,s)=>{let c=B(r,e);if(c){let r=B(a,e,R(n)?B(i,e):n);R(r)||s&&s.defaultChecked||t?U(a,e,t?r:Ge(c._f)):ne(e,r),o.mount&&!o.action&&g()}},C=(e,r,a,o,s)=>{let c=!1,l=!1,u={name:e};if(!t.disabled){if(!a||o){(d.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=u.isDirty=O(),c=l!==u.isDirty);let t=Y(B(i,e),r);l=!!B(n.dirtyFields,e),t?Q(n.dirtyFields,e):U(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,c||=(d.dirtyFields||f.dirtyFields)&&l!==!t}if(a){let t=B(n.touchedFields,e);t||(U(n.touchedFields,e,a),u.touchedFields=n.touchedFields,c||=(d.touchedFields||f.touchedFields)&&t!==a)}c&&s&&p.state.next(u)}return c?u:{}},ee=(e,r,i,a)=>{let o=B(n.errors,e),s=(d.isValid||f.isValid)&&V(r)&&n.isValid!==r;if(t.delayError&&i?(c=h(()=>b(e,i)),c(t.delayError)):(clearTimeout(l),c=null,i?U(n.errors,e,i):Q(n.errors,e)),(i?!Y(o,i):o)||!Z(a)||s){let t={...a,...s&&V(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>(_(e,!0),await t.resolver(a,t.context,qe(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),T=async e=>{let{errors:t}=await w(e);if(_(e),e)for(let r of e){let e=B(t,r);e?U(n.errors,r,e):Q(n.errors,r)}else n.errors=t;return t},te=async({name:t,eventType:r})=>{if(e.validate){let i=await e.validate({formValues:a,formState:n,name:t,eventType:r});if(F(i))for(let e in i)i[e]&&q(`${ue}.${e}`,{message:J(i.message)?i.message:``,type:K.validate});else J(i)||!i?q(ue,{message:i||``,type:K.validate}):me(ue);return i}return!0},E=async({fields:r,onlyCheckValid:i,name:o,eventType:c,context:l={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(l.runRootValidation=!0,!await te({name:o,eventType:c})&&(l.valid=!1,i)))return l.valid;for(let o in r){let u=r[o];if(u){let{_f:r,...f}=u;if(r){let o=s.array.has(r.name),c=u._f&&Qe(u._f);c&&d.validatingFields&&_([r.name],!0);let f=await ut(u,s.disabled,a,m,t.shouldUseNativeValidation&&!i,o);if(c&&d.validatingFields&&_([r.name]),f[r.name]&&(l.valid=!1,i)||(!i&&(B(f,r.name)?o?st(n.errors,f,r.name):U(n.errors,r.name,f[r.name]):Q(n.errors,r.name)),e.shouldUseNativeValidation&&f[r.name]))break}!Z(f)&&await E({context:l,onlyCheckValid:i,fields:f,name:o,eventType:c})}}return l.valid},D=()=>{for(let e of s.unMount){let t=B(r,e);t&&(t._f.refs?t._f.refs.every(e=>!Me(e)):!Me(t._f.ref))&&ye(e)}s.unMount=new Set},O=(e,n)=>!t.disabled&&(e&&n&&U(a,e,n),!Y(fe(),i)),k=(e,t,n)=>ge(e,s,{...o.mount?a:R(t)?i:J(e)?{[e]:t}:t},n,t),A=e=>le(B(o.mount?a:i,e,t.shouldUnregister?B(i,e,[]):[])),ne=(e,t,n={})=>{let i=B(r,e),o=t;if(i){let n=i._f;n&&(!n.disabled&&U(a,e,He(t,n)),o=Oe(n.ref)&&P(t)?``:t,ke(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?re(n.ref)?n.refs.forEach(e=>{(!e.defaultChecked||!e.disabled)&&(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):n.refs.forEach(e=>e.checked=e.value===o):De(n.ref)?n.ref.value=``:(n.ref.value=o,n.ref.type||p.state.next({name:e,values:I(a)})))}(n.shouldDirty||n.shouldTouch)&&C(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&z(e)},j=(e,t,n)=>{for(let i in t){if(!t.hasOwnProperty(i))return;let a=t[i],o=e+`.`+i,c=B(r,o);(s.array.has(e)||F(a)||c&&!c._f)&&!N(a)?j(o,a,n):ne(o,a,n)}},M=(e,t,i={})=>{let c=B(r,e),l=s.array.has(e),u=I(t),d=Y(B(a,e),u);if(U(a,e,u),l)p.array.next({name:e,values:I(a)}),i.shouldDirty&&(v(e),p.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:O(e,u)}));else{let t=Array.isArray(u)&&!u.length||Z(u);!c||c._f||P(u)||t?ne(e,u,i):j(e,u,i)}d||(et(e,s)?p.state.next({...n,name:e,values:I(a)}):p.state.next({name:o.mount?e:void 0,values:I(a)}))},ie=e=>{let t=H(e)?e(a):e;Y(a,t)||(a={...a,...t},p.state.next({...n,values:a}))},se=async i=>{o.mount=!0;let l=i.target,u=l.name,h=!0,v=B(r,u),y=e=>{h=Number.isNaN(e)||N(e)&&isNaN(e.getTime())||Y(e,B(a,u,e))},b=Xe(t.mode),x=Xe(t.reValidateMode);if(v){let o,S,T=l.type?Ge(v._f):ae(i),D=i.type===W.BLUR||i.type===W.FOCUS_OUT,O=!$e(v._f)&&!e.validate&&!t.resolver&&!B(n.errors,u)&&!v._f.deps||at(D,B(n.touchedFields,u),n.isSubmitted,x,b),k=et(u,s,D);U(a,u,T),D?(!l||!l.readOnly)&&(v._f.onBlur&&v._f.onBlur(i),c&&c(0)):v._f.onChange&&v._f.onChange(i);let A=C(u,T,D),ne=!Z(A)||k;if(!D&&p.state.next({name:u,type:i.type,values:I(a)}),O)return(d.isValid||f.isValid)&&(t.mode===`onBlur`?D&&g():D||g()),ne&&p.state.next({name:u,...k?{}:A});if(!t.resolver&&e.validate&&await te({name:u,eventType:i.type}),!D&&k&&p.state.next({...n}),t.resolver){let{errors:e}=await w([u]);if(_([u]),y(T),h){let t=nt(n.errors,r,u),i=nt(e,r,t.name||u);o=i.error,u=i.name,S=Z(e)}}else _([u],!0),o=(await ut(v,s.disabled,a,m,t.shouldUseNativeValidation))[u],_([u]),y(T),h&&(o?S=!1:(d.isValid||f.isValid)&&(S=await E({fields:r,onlyCheckValid:!0,name:u,eventType:i.type})));h&&(v._f.deps&&(!Array.isArray(v._f.deps)||v._f.deps.length>0)&&z(v._f.deps),ee(u,S,o,A))}},L=(e,t)=>{if(B(n.errors,t)&&e.focus)return e.focus(),1},z=async(e,i={})=>{let a,o,c=we(e);if(t.resolver){let t=await T(R(e)?e:c);a=Z(t),o=e?!c.some(e=>B(t,e)):a}else e?(o=(await Promise.all(c.map(async e=>{let t=B(r,e);return await E({fields:t&&t._f?{[e]:t}:t,eventType:W.TRIGGER})}))).every(Boolean),!(!o&&!n.isValid)&&g()):o=a=await E({fields:r,name:e,eventType:W.TRIGGER});return p.state.next({...!J(e)||(d.isValid||f.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&tt(r,L,e?c:s.mount),o},fe=(e,t)=>{let r={...o.mount?a:i};return t&&(r=Ee(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),R(e)?r:J(e)?B(r,e):e.map(e=>B(r,e))},pe=(e,t)=>({invalid:!!B((t||n).errors,e),isDirty:!!B((t||n).dirtyFields,e),error:B((t||n).errors,e),isValidating:!!B(n.validatingFields,e),isTouched:!!B((t||n).touchedFields,e)}),me=e=>{let t=e?we(e):void 0;t?.forEach(e=>Q(n.errors,e)),t?t.forEach(e=>{p.state.next({name:e,errors:n.errors})}):p.state.next({errors:{}})},q=(e,t,i)=>{let a=(B(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=B(n.errors,e)||{};U(n.errors,e,{...l,...t,ref:a}),p.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},he=(e,t)=>H(e)?p.state.subscribe({next:n=>`values`in n&&e(n.values||k(void 0,t),n)}):k(e,t,!0),_e=e=>p.state.subscribe({next:t=>{if(it(e.name,t.name,e.exact)&&rt(t,e.formState||d,Ie,e.reRenderRoot)){let r={...a};e.callback({values:r,...n,...t,defaultValues:i})}}}).unsubscribe,ve=e=>(o.mount=!0,f={...f,...e.formState},_e({...e,formState:{...u,...e.formState}})),ye=(e,o={})=>{for(let c of e?we(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(Q(r,c),Q(a,c)),!o.keepError&&Q(n.errors,c),!o.keepDirty&&Q(n.dirtyFields,c),!o.keepTouched&&Q(n.touchedFields,c),!o.keepIsValidating&&Q(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&Q(i,c);p.state.next({values:I(a)}),p.state.next({...n,...o.keepDirty?{isDirty:O()}:{}}),!o.keepIsValid&&g()},be=({disabled:e,name:t})=>{if(V(e)&&o.mount||e||s.disabled.has(t)){let n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&g()}},X=(e,n={})=>{let a=B(r,e),c=V(n.disabled)||V(t.disabled),l=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;return U(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&!l?be({disabled:V(n.disabled)?n.disabled:t.disabled,name:e}):S(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:Ye(n.min),max:Ye(n.max),minLength:Ye(n.minLength),maxLength:Ye(n.maxLength),pattern:Ye(n.pattern)}:{},name:e,onChange:se,onBlur:se,ref:c=>{if(c){s.registerName.add(e),X(e,n),s.registerName.delete(e),a=B(r,e);let t=R(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=je(t),l=a._f.refs||[];if(o?l.find(e=>e===t):t===a._f.ref)return;U(r,e,{_f:{...a._f,...o?{refs:[...l.filter(Me),t,...Array.isArray(B(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),S(e,!1,void 0,t)}else a=B(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(oe(s.array,e)&&o.action)&&s.unMount.add(e)}}},xe=()=>t.shouldFocusError&&tt(r,L,s.mount),Se=e=>{V(e)&&(p.state.next({disabled:e}),tt(r,(t,n)=>{let i=B(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},Ce=(e,i)=>async o=>{let c;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=I(a);if(p.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await w();_(),n.errors=e,l=I(t)}else await E({fields:r,eventType:W.SUBMIT});if(s.disabled.size)for(let e of s.disabled)Q(l,e);if(Q(n.errors,de),Z(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),xe(),setTimeout(xe);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Z(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},Ae=(e,t={})=>{B(r,e)&&(R(t.defaultValue)?M(e,I(B(i,e))):(M(e,t.defaultValue),U(i,e,I(t.defaultValue))),t.keepTouched||Q(n.touchedFields,e),t.keepDirty||(Q(n.dirtyFields,e),n.isDirty=t.defaultValue?O(e,I(B(i,e))):O()),t.keepError||(Q(n.errors,e),d.isValid&&g()),p.state.next({...n}))},Ne=(e,c={})=>{let l=e?I(e):i,u=I(l),f=Z(e),m=f?i:u;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(Re(i,a))]);for(let t of Array.from(e)){let e=B(n.dirtyFields,t),r=B(a,t),i=B(m,t);e&&!R(r)?U(m,t,r):!e&&!R(i)&&M(t,i)}}else{if(ce&&R(e))for(let e of s.mount){let t=B(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Oe(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)M(e,B(m,e));else r={}}a=t.shouldUnregister?c.keepDefaultValues?I(i):{}:I(m),p.array.next({values:{...m}}),p.state.next({values:{...m}})}s={mount:c.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!d.isValid||!!c.keepIsValid||!!c.keepDirtyValues||!t.shouldUnregister&&!Z(m),o.watch=!!t.shouldUnregister,o.keepIsValid=!!c.keepIsValid,o.action=!1,c.keepErrors||(n.errors={}),p.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:f?!1:c.keepDirty?n.isDirty:!!(c.keepDefaultValues&&!Y(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:f?{}:c.keepDirtyValues?c.keepDefaultValues&&a?Re(i,a):n.dirtyFields:c.keepDefaultValues&&e?Re(i,e):c.keepDirty?n.dirtyFields:{},touchedFields:c.keepTouched?n.touchedFields:{},errors:c.keepErrors?n.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},Pe=(e,n)=>Ne(H(e)?e(a):e,{...t.resetOptions,...n}),Fe=(e,t={})=>{let n=B(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&H(e.select)&&e.select()})}},Ie=e=>{n={...n,...e}},Le={control:{register:X,unregister:ye,getFieldState:pe,handleSubmit:Ce,setError:q,_subscribe:_e,_runSchema:w,_updateIsValidating:_,_focusError:xe,_getWatch:k,_getDirty:O,_setValid:g,_setFieldArray:y,_setDisabledField:be,_setErrors:x,_getFieldArray:A,_reset:Ne,_resetDefaultValues:()=>H(t.defaultValues)&&t.defaultValues().then(e=>{Pe(e,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:D,_disableForm:Se,_subjects:p,_proxyFormState:d,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:ve,trigger:z,register:X,handleSubmit:Ce,watch:he,setValue:M,setValues:ie,getValues:fe,reset:Pe,resetField:Ae,clearErrors:me,unregister:ye,setError:q,setFocus:Fe,getFieldState:pe};return{...Le,formControl:Le}}function pt(e={}){let t=M.useRef(void 0),n=M.useRef(void 0),[r,i]=M.useState({isDirty:!1,isValidating:!1,isLoading:H(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:H(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!H(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...i}=ft(e);t.current={...i,formState:r}}let a=t.current.control;return a._options=e,q(()=>{let e=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i(e=>({...e,isReady:!0})),a._formState.isReady=!0,e},[a]),M.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),M.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),M.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),M.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),M.useEffect(()=>{if(a._proxyFormState.isDirty){let e=a._getDirty();e!==r.isDirty&&a._subjects.state.next({isDirty:e})}},[a,r.isDirty]),M.useEffect(()=>{e.values&&!Y(e.values,n.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),a._options.resetOptions?.keepIsValid||a._setValid(),n.current=e.values,i(e=>({...e}))):a._resetDefaultValues()},[a,e.values]),M.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=M.useMemo(()=>me(r,a),[a,r]),t.current}var $=n(),mt=Se,ht=M.createContext({}),gt=e=>{let t=(0,j.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)(be,{...n}),t[4]=n,t[5]=i);let a;return t[6]!==r||t[7]!==i?(a=(0,$.jsx)(ht.Provider,{value:r,children:i}),t[6]=r,t[7]=i,t[8]=a):a=t[8],a},_t=()=>{let e=(0,j.c)(13),t=M.use(ht),n=M.use(vt),{getFieldState:r}=xe(),i;e[0]===t.name?i=e[1]:(i={name:t.name},e[0]=t.name,e[1]=i);let a=he(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},vt=M.createContext({});function yt(e){let t=(0,j.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=M.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=g(`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)(vt.Provider,{value:a,children:s}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function bt(e){let t=(0,j.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}=_t(),o=!!i,s;t[3]===n?s=t[4]:(s=g(`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)(w,{"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 xt(e){let t=(0,j.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}=_t(),s=r?`${a} ${o}`:`${a}`,c=!!r,l;return t[2]!==i||t[3]!==n||t[4]!==s||t[5]!==c?(l=(0,$.jsx)(h,{"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 St(e){let t=(0,j.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}=_t(),a;t[3]===n?a=t[4]:(a=g(`text-sm 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 Ct(e){let t=(0,j.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}=_t(),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=g(`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 wt(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)]:wt(r,t)}}function Tt(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 Et(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 Dt(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 Ot(e){let t=(0,j.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=pt(i),o,s;t[4]!==e||t[5]!==a?(o=()=>e.subscribe(e=>{kt(a,e)}),s=[e,a],t[4]=e,t[5]=a,t[6]=o,t[7]=s):(o=t[6],s=t[7]),(0,M.useEffect)(o,s);let c;t[8]!==e||t[9]!==a?(c=t=>At(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 kt(e,t){e.reset(t,{keepDirtyValues:!0,keepDirty:!0,keepTouched:!0})}function At(e,t,n){let r=e.getValues(n),i=wt(Nt(n),r),a=t.patch(i);return a.ok?(e.clearErrors(n),e.resetField(n,{defaultValue:r,keepError:!1}),!0):(e.setError(n,{type:`config-binding`,message:jt(a.error,n)}),!1)}function jt(e,t){if(l(e)&&e.code===`SCHEMA_INVALID`){let n=e.issues.find(e=>Mt(e,t));if(n)return n.message}return f(e)}function Mt(e,t){return e.path.map(String).join(`.`)===t}function Nt(e){return e.split(`.`)}var Pt=[{id:`server`,title:`Server`,description:`Local server bind and behavior.`,fields:[{path:[`server`,`host`],label:`Host`,description:`Bind interface (e.g. localhost, 0.0.0.0).`},{path:[`server`,`openOnAgentEdit`],label:`Open preview on agent edit`,description:`When enabled, an agent write opens the preview tab if not already open.`}]},{id:`github`,title:`GitHub`,description:`OAuth app identity for sign-in. Tokens are stored in your OS keychain, not here.`,fields:[{path:[`github`,`oauthAppClientId`],label:`OAuth App client ID`,description:`Public client ID for the GitHub OAuth app. Defaults to the published Open Knowledge app.`}]},{id:`preview`,title:`Preview`,description:`Where the preview tab points when no local UI is running.`,fields:[{path:[`preview`,`baseUrl`],label:`Preview base URL`,description:`URL of your team’s deployed wiki (project-only).`}]},{id:`mcp`,title:`MCP`,description:`Model Context Protocol agent integration tuning.`,fields:[{path:[`mcp`,`autoStart`],label:`Auto-start server`,description:"When enabled, `ok mcp` spawns `ok start` automatically."},{path:[`mcp`,`tools`,`read_document`,`historyDepth`],label:`read_document history depth`,description:`How many history entries the agent’s read_document tool returns.`},{path:[`mcp`,`tools`,`search`,`maxResults`],label:`search max results`,description:`Cap on results returned by the agent’s search tool.`}]},{id:`appearance`,title:`Appearance`,description:`UI preferences. Editor toggles continue to write localStorage as a cache.`,fields:[{path:[`appearance`,`theme`],label:`Theme`,description:`Light, dark, or follow the OS.`,control:`enum-toggle`},{path:[`appearance`,`editorModeDefault`],label:`Default editor mode`,description:`Which mode new docs open in by default.`,control:`enum-toggle`}]}];function Ft(e,t){let n=(0,j.c)(4),[r,a]=(0,M.useState)(null),s,c;return n[0]!==e||n[1]!==t?(s=()=>{if(e===null)return;let n=t===`project`?p:o,r=new b,s=new y({url:e,name:n,document:r}),c=i(s,t),l=!0,u=()=>{l&&a(e=>e?.provider===s?{...e,synced:!0}:e)};return s.on(`synced`,u),a({provider:s,binding:c,synced:!1}),()=>{l=!1,s.off(`synced`,u),c.dispose(),s.destroy(),r.destroy(),a(e=>e?.provider===s?null:e)}},c=[e,t],n[0]=e,n[1]=t,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,M.useEffect)(s,c),r}function It(e){let t=(0,j.c)(24),{scope:n,onClose:r,onScopeChange:i}=e,{collabUrl:a}=x(),o=Ft(a,n),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`h1`,{className:`text-sm font-semibold`,children:`Settings`}),t[0]=s):s=t[0];let c;t[1]===i?c=t[2]:(c=e=>{(e===`project`||e===`user`)&&i(e)},t[1]=i,t[2]=c);let l,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(u,{value:`project`,className:`text-xs`,children:`This project`}),f=(0,$.jsx)(u,{value:`user`,className:`text-xs`,children:`User`}),t[3]=l,t[4]=f):(l=t[3],f=t[4]);let p;t[5]!==n||t[6]!==c?(p=(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[s,(0,$.jsxs)(d,{type:`single`,value:n,onValueChange:c,"aria-label":`Settings scope`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,children:[l,f]})]}),t[5]=n,t[6]=c,t[7]=p):p=t[7];let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(E,{className:`size-4`}),t[8]=m):m=t[8];let h;t[9]===r?h=t[10]:(h=(0,$.jsx)(O,{asChild:!0,children:(0,$.jsx)(_,{variant:`ghost`,size:`icon`,onClick:r,"aria-label":`Close settings`,className:`text-muted-foreground`,children:m})}),t[9]=r,t[10]=h);let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(k,{children:`Close`}),t[11]=g):g=t[11];let v;t[12]===h?v=t[13]:(v=(0,$.jsxs)(A,{children:[h,g]}),t[12]=h,t[13]=v);let y;t[14]!==p||t[15]!==v?(y=(0,$.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between border-b px-4`,children:[p,v]}),t[14]=p,t[15]=v,t[16]=y):y=t[16];let b;t[17]!==o||t[18]!==n?(b=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:o===null||!o.synced?(0,$.jsx)(Rt,{}):(0,$.jsx)(Bt,{scope:n,binding:o.binding})}),t[17]=o,t[18]=n,t[19]=b):b=t[19];let S;return t[20]!==n||t[21]!==y||t[22]!==b?(S=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,"data-testid":`settings-pane`,"data-scope":n,children:[y,b]}),t[20]=n,t[21]=y,t[22]=b,t[23]=S):S=t[23],S}function Lt(e){if(!l(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 Rt(){let e=(0,j.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`space-y-6 p-6`,children:Array.from({length:3}).map(zt)}),e[0]=t):t=e[0],t}function zt(e,t){return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(C,{className:`h-5 w-32`}),(0,$.jsx)(C,{className:`h-4 w-64`}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(C,{className:`h-9 w-full`}),(0,$.jsx)(C,{className:`h-9 w-full`})]})]},t)}function Bt(e){let t=(0,j.c)(11),{scope:n,binding:r}=e,{form:i,commitField:a}=Ot(r),[o,s]=(0,M.useState)(null),c=(0,M.useRef)(null),l,u;t[0]!==i||t[1]!==n?(l=()=>{let e=T(e=>{if(!(n===`project`&&e.docName===`__config__/project`||n===`user`&&e.docName===`__user__/config.yml`))return;D.error(f(e.error),{duration:8e3});let t=Lt(e.error);t&&(i.setError(t,{type:`config-validation-rejected`,message:jt(e.error,t)}),i.setFocus(t),s(t),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{s(null),i.clearErrors(t)},600))});return()=>{e(),c.current&&clearTimeout(c.current)}},u=[n,i],t[0]=i,t[1]=n,t[2]=l,t[3]=u):(l=t[2],u=t[3]),(0,M.useEffect)(l,u);let d;t[4]!==a||t[5]!==o||t[6]!==n?(d=(0,$.jsx)(Vt,{scope:n,commitField:a,flashedPath:o}),t[4]=a,t[5]=o,t[6]=n,t[7]=d):d=t[7];let p;return t[8]!==i||t[9]!==d?(p=(0,$.jsx)(mt,{...i,children:d}),t[8]=i,t[9]=d,t[10]=p):p=t[10],p}function Vt(e){let t=(0,j.c)(7),{scope:n,commitField:r,flashedPath:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=Pt.map(e=>{let t=e.fields.filter(e=>Ht(e.path,n));return t.length===0?null:(0,$.jsx)(Ut,{section:e,children:t.map(e=>(0,$.jsx)(Wt,{field:e,scope:n,commitField:r,isFlashed:i===e.path.join(`.`)},e.path.join(`.`)))},e.id)}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(Zt,{}),t[4]=o):o=t[4];let s;return t[5]===a?s=t[6]:(s=(0,$.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-6`,children:[a,o]}),t[5]=a,t[6]=s),s}function Ht(e,t){let n=a(s,e);if(!n)return!0;let r=c(n);return r?!(r.scope===`project`&&t!==`project`||r.scope===`user`&&t!==`user`):!0}function Ut(e){let t=(0,j.c)(14),{section:n,children:r}=e,i=`settings-${n.id}-title`,a=`settings-${n.id}-title`,o;t[0]!==n.title||t[1]!==a?(o=(0,$.jsx)(`h2`,{id:a,className:`text-base font-semibold`,children:n.title}),t[0]=n.title,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n.description?s=t[4]:(s=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description}),t[3]=n.description,t[4]=s);let c;t[5]!==o||t[6]!==s?(c=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===r?l=t[9]:(l=(0,$.jsx)(`div`,{className:`space-y-4`,children:r}),t[8]=r,t[9]=l);let u;return t[10]!==i||t[11]!==c||t[12]!==l?(u=(0,$.jsxs)(`section`,{"aria-labelledby":i,className:`space-y-3`,children:[c,l]}),t[10]=i,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function Wt({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let i=xe(),o=a(s,e.path),l=o?Et(o):void 0,u=o?Tt(o):void 0,d=o?c(o):void 0,f=o?Dt(o):void 0,p=e.path.join(`.`),[m,h]=(0,M.useState)(!1),g=(0,M.useRef)(null);(0,M.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]);let v=()=>{h(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(!1),1200)},y=()=>{let e=n(p);return e&&v(),e},b=()=>i.getFieldState(p).isDirty?y():!0,x=()=>{let e=u===void 0?null:u;i.setValue(p,e,{shouldDirty:!1}),y()},S=d?.scope===`project`&&t!==`project`?`This field can only be set per-project. Switch to the 'This project' tab to edit it.`:d?.scope===`user`&&t!==`user`?`This field can only be set globally. Switch to the 'User' tab to edit it.`:null,C=`relative space-y-1 ${r?`animate-settings-flash`:``}`;return(0,$.jsx)(gt,{control:i.control,name:p,render:({field:n})=>{let r=u===void 0?n.value!==void 0&&n.value!==null:!Xt(n.value,u),i=!S&&(u!==void 0||n.value!==void 0),a=r?(0,$.jsx)(`span`,{"data-modified":`true`,className:`absolute -left-3 top-1 h-5 w-0.5 rounded-full bg-primary`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Modified from default`})}):null;return(0,$.jsxs)(yt,{className:C,"data-field":e.path.join(`.`),"data-scope":t,children:[a,(0,$.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,$.jsx)(bt,{className:`text-sm font-medium`,children:e.label}),i?(0,$.jsxs)(A,{children:[(0,$.jsx)(O,{asChild:!0,children:(0,$.jsx)(_,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-muted-foreground opacity-60 hover:opacity-100`,onClick:x,"aria-label":`Reset ${e.label} to default`,children:(0,$.jsx)(ne,{className:`size-3.5`})})}),(0,$.jsx)(k,{children:`Reset to default`})]}):null]}),e.description?(0,$.jsx)(St,{className:`text-xs text-muted-foreground`,children:e.description}):null,S?(0,$.jsx)(xt,{children:(0,$.jsx)(`div`,{role:`note`,className:`rounded border border-dashed border-muted px-3 py-2 text-xs text-muted-foreground`,children:S})}):(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(xt,{children:(0,$.jsx)(Gt,{field:e,ctl:n,typeTag:l,enumOptions:f,onCommit:b})}),(0,$.jsx)(Yt,{visible:m})]}),(0,$.jsx)(Ct,{"data-field-error":e.path.join(`.`)})]})}})}function Gt({field:e,ctl:t,typeTag:n,enumOptions:r,onCommit:i,...a}){"use no memo";if(n===`boolean`)return(0,$.jsx)(S,{...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,...o}=a;return(0,$.jsx)(d,{...o,type:`single`,value:typeof t.value==`string`?t.value:``,ref:t.ref,onValueChange:e=>{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":e.label,children:r.map((e,t)=>(0,$.jsx)(u,{value:e,id:t===0?n:void 0,className:`text-xs capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(qt,{ctl:t,onCommit:i,...a}):n===`array`?(0,$.jsx)(Jt,{ctl:t,onCommit:i,...a}):(0,$.jsx)(Kt,{ctl:t,onCommit:i,...a})}function Kt({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(v,{...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 qt({ctl:e,onCommit:t,...n}){"use no memo";let[r,i]=(0,M.useState)(e.value===void 0?``:String(e.value)),a=(0,M.useRef)(e.value);(0,M.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)(v,{...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 Jt({ctl:e,onCommit:t,...n}){"use no memo";let r=Array.isArray(e.value)?e.value.join(`
2
- `):``,[i,a]=(0,M.useState)(r),o=(0,M.useRef)(r);(0,M.useEffect)(()=>{let t=Array.isArray(e.value)?e.value.join(`
3
- `):``;t!==o.current&&(a(t),o.current=t)},[e.value]);let s=()=>{let n=i.split(`
4
- `).map(e=>e.trim()).filter(e=>e.length>0);e.onChange(n),t(),o.current=n.join(`
5
- `)};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(`
6
- `).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 Yt(e){let t=(0,j.c)(4),{visible:n}=e,r;t[0]===n?r=t[1]:(r=n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Saved`})]}):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 Xt(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Xt(e[n],t[n]))return!1;return!0}if(e&&t&&typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Xt(e[r],t[r]))return!1;return!0}return!1}function Zt(){let e=(0,j.c)(7),[t,n]=(0,M.useState)(!1),[r,i]=(0,M.useState)(!0),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=(typeof window<`u`?window.okDesktop:void 0)?.skill?.detectClaudeDesktop;if(!e){i(!0);return}let t=!1;return e().then(e=>{t||i(e)}).catch(()=>{t||i(!0)}),()=>{t=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,M.useEffect)(a,o),!r)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`h2`,{id:`settings-integrations-title`,className:`text-base font-semibold`,children:`Integrations`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect Open Knowledge to other tools you use.`})]}),e[2]=s):s=e[2];let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:`Install in Claude Desktop`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Make this knowledge base available as a Claude Skill.`})]}),e[3]=c):c=e[3];let l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,(0,$.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>n(!0),"data-testid":`settings-install-claude-desktop`,children:`Install…`})]})}),e[4]=l):l=e[4];let u;return e[5]===t?u=e[6]:(u=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-integrations-title`,className:`space-y-3`,children:[s,l,(0,$.jsx)(te,{open:t,onOpenChange:n})]}),e[5]=t,e[6]=u),u}export{It as SettingsPane};
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{S as i,m as a,r as o,t as s}from"./button-Dyz7QGIk.js";import{St as c}from"./DocumentContext-gM6_1mHt.js";import{t as l}from"./circle-check-C-DpX4dU.js";import{a as u,c as d,i as f,n as p,o as m,s as h,t as g,x as _}from"./dialog-FUclf-NK.js";var v=i(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),y=i(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),b=i(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),x=i(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),ee=i(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),S=e(t(),1),C=n(),w=`Label`,T=S.forwardRef((e,t)=>(0,C.jsx)(a.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));T.displayName=w;var E=T,D=r();function O(e){let t=(0,D.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,C.jsx)(`div`,{"data-slot":`skeleton`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function k(e){let t=(0,D.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,C.jsx)(E,{"data-slot":`label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var te=`npx @inkeep/open-knowledge install-skill`,ne=`https://inkeep.github.io/open-knowledge/guides/install-claude-cowork`;function re(){return typeof window<`u`&&typeof window.okDesktop?.skill==`object`}function A(e){let t=(0,D.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,C.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 font-mono text-[0.85em]`,children:n}),t[0]=n,t[1]=r),r}function j(e){let t=(0,D.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=o(`font-mono tracking-wide uppercase text-primary font-medium text-xs`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,C.jsx)(`p`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function M(e){let t=(0,D.c)(4),{n}=e,r;t[0]===n?r=t[1]:(r=n.toString().padStart(2,`0`),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,C.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-5 w-5 shrink-0 items-center justify-center text-xs font-medium text-muted-foreground font-mono tabular-nums`,children:r}),t[2]=r,t[3]=i),i}function N(){let e=(0,D.c)(17),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(j,{children:`In the Claude Desktop App`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,C.jsx)(M,{n:1}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,C.jsx)(`strong`,{className:`font-medium`,children:`Customize`}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,C.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,C.jsxs)(`li`,{className:`flex gap-3`,children:[n,(0,C.jsxs)(`span`,{children:[`Open `,r,` in the sidebar`,` `,i,` `,(0,C.jsx)(`strong`,{className:`font-medium`,children:`Skills`}),`.`]})]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,C.jsx)(M,{n:2}),e[5]=o):o=e[5];let s;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,C.jsx)(`span`,{className:`inline-flex items-center justify-center font-medium border h-5 w-5 rounded-md text-xs`,children:`+`}),e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,C.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[7]=c):c=e[7];let l;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,C.jsx)(`strong`,{className:`font-medium`,children:`Create skill`}),e[8]=l):l=e[8];let u;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,C.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[9]=u):u=e[9];let d;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,C.jsxs)(`li`,{className:`flex gap-3`,children:[o,(0,C.jsxs)(`span`,{children:[`Click`,` `,s,` `,c,` `,l,` `,u,` `,(0,C.jsx)(`strong`,{className:`font-medium`,children:`Upload skill`}),`.`]})]}),e[10]=d):d=e[10];let f;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,C.jsx)(M,{n:3}),e[11]=f):f=e[11];let p;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,C.jsx)(A,{children:`openknowledge.skill`}),e[12]=p):p=e[12];let m;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,C.jsxs)(`ol`,{className:`flex flex-col gap-4 text-sm`,children:[a,d,(0,C.jsxs)(`li`,{className:`flex gap-3`,children:[f,(0,C.jsxs)(`span`,{children:[`Pick `,p,` from your`,` `,(0,C.jsx)(`strong`,{className:`font-medium`,children:`Downloads`}),` folder. It enables automatically.`]})]})]}),e[13]=m):m=e[13];let h;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,C.jsx)(`strong`,{className:`font-medium`,children:`Skills`}),e[14]=h):h=e[14];let g;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,C.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[15]=g):g=e[15];let _;return e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,C.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t,m,(0,C.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-4`,children:[`Don't see `,h,`? Enable`,` `,(0,C.jsxs)(`strong`,{className:`font-medium`,children:[`Settings`,` `,g,` `,`Capabilities`,` `,(0,C.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),` Code execution and file creation`]}),` `,`first.`]})]}),e[16]=_):_=e[16],_}function P(e){let t=(0,D.c)(61),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={kind:`idle`},t[0]=i):i=t[0];let[a,o]=(0,S.useState)(i),[v,y]=(0,S.useState)(!1),w,T;t[1]===n?(w=t[2],T=t[3]):(w=()=>{n||(o({kind:`idle`}),y(!1))},T=[n],t[1]=n,t[2]=w,t[3]=T),(0,S.useEffect)(w,T);let E;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(E=async function(){o({kind:`downloading`});let e=window.okDesktop?.skill;if(!e){o({kind:`error`,message:`Electron bridge unavailable. Refresh and try again.`});return}let t=await e.buildAndOpen();if(t.ok)o({kind:`handed-off`,path:t.path});else{let e=t.message??t.reason;_.error(`Install handoff failed: ${e}`),o({kind:`error`,message:t.reason===`open-failed`?`The Claude Desktop App didn't open the file. Is it installed? (${e})`:`${t.reason}: ${e}`})}},t[4]=E):E=t[4];let O=E,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(k=async function(){try{await navigator.clipboard.writeText(te),y(!0),setTimeout(()=>y(!1),2e3)}catch(e){let t=e;_.error(`Couldn't copy: ${t instanceof Error?t.message:String(t)}`)}},t[5]=k):k=t[5];let M=k,P;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(P=re(),t[6]=P):P=t[6];let F=P,I;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,C.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,C.jsx)(x,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install for Claude Chat & Cowork`]}),t[7]=I):I=t[7];let L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,C.jsxs)(h,{children:[I,(0,C.jsxs)(u,{children:[`Adds the Open Knowledge skill to the`,` `,(0,C.jsx)(`strong`,{className:`font-medium text-foreground`,children:`Claude Desktop App`}),` so it's available in Chat and Cowork sessions.`]})]}),t[8]=L):L=t[8];let R;t[9]===a.kind?R=t[10]:(R=a.kind===`idle`&&F&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(j,{className:`text-muted-foreground`,children:`Automatic`}),(0,C.jsxs)(`p`,{className:`text-sm`,children:[`We'll build `,(0,C.jsx)(A,{children:`openknowledge.skill`}),`, save it to`,` `,(0,C.jsx)(A,{children:`~/Downloads`}),`, and open the Claude Desktop App for you.`]})]}),(0,C.jsx)(N,{})]}),t[9]=a.kind,t[10]=R);let z;t[11]!==v||t[12]!==a.kind?(z=a.kind===`idle`&&!F&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(j,{children:`Run this in your terminal`}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border bg-muted/40 p-2`,children:[(0,C.jsx)(`code`,{className:`flex-1 font-mono text-xs`,children:te}),(0,C.jsx)(s,{variant:`ghost`,size:`sm`,onClick:M,"aria-label":`Copy command`,className:`h-7 gap-1`,children:v?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(l,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copied`]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(b,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copy`]})})]}),(0,C.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Saves the file to `,(0,C.jsx)(A,{children:`~/Downloads/openknowledge.skill`}),` and opens the Claude Desktop App. Requires Node.js or Bun on your PATH.`]})]}),(0,C.jsx)(N,{})]}),t[11]=v,t[12]=a.kind,t[13]=z):z=t[13];let B;t[14]===a.kind?B=t[15]:(B=a.kind===`downloading`&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,C.jsx)(c,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Building `,(0,C.jsx)(A,{children:`openknowledge.skill`}),` and opening the Claude Desktop App…`]}),t[14]=a.kind,t[15]=B);let V;t[16]!==a.kind||t[17]!==a.path?(V=a.kind===`handed-off`&&F&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,C.jsx)(l,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,C.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`File saved & Claude Desktop App opened`}),(0,C.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground`,children:a.path??`~/Downloads/openknowledge.skill`})]})]}),(0,C.jsx)(N,{})]}),t[16]=a.kind,t[17]=a.path,t[18]=V):V=t[18];let H;t[19]===a.kind?H=t[20]:(H=a.kind===`handed-off`&&!F&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,C.jsx)(l,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,C.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`Download started`}),(0,C.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`File saves to `,(0,C.jsx)(A,{children:`~/Downloads/openknowledge.skill`}),`.`]})]})]}),(0,C.jsx)(N,{})]}),t[19]=a.kind,t[20]=H);let U;t[21]!==a.kind||t[22]!==a.message?(U=a.kind===`error`&&(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,C.jsx)(`span`,{className:`text-destructive`,children:a.message}),(0,C.jsx)(`a`,{href:ne,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs underline underline-offset-2 hover:text-foreground`,children:`See the full install guide`})]}),t[21]=a.kind,t[22]=a.message,t[23]=U):U=t[23];let W;t[24]!==z||t[25]!==B||t[26]!==V||t[27]!==H||t[28]!==U||t[29]!==R?(W=(0,C.jsx)(p,{children:(0,C.jsxs)(`div`,{className:`flex flex-col gap-6 py-2`,children:[R,z,B,V,H,U]})}),t[24]=z,t[25]=B,t[26]=V,t[27]=H,t[28]=U,t[29]=R,t[30]=W):W=t[30];let G;t[31]===a.kind?G=t[32]:(G=a.kind!==`error`&&(0,C.jsxs)(`a`,{href:ne,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 self-center text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground sm:mr-auto font-mono tracking-wide uppercase`,children:[`Full guide`,(0,C.jsx)(ee,{"aria-hidden":`true`,className:`h-3 w-3`})]}),t[31]=a.kind,t[32]=G);let K;t[33]!==r||t[34]!==a.kind?(K=a.kind===`idle`&&F&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,C.jsxs)(s,{onClick:O,children:[(0,C.jsx)(x,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install`]})]}),t[33]=r,t[34]=a.kind,t[35]=K):K=t[35];let q;t[36]!==r||t[37]!==a.kind?(q=a.kind===`idle`&&!F&&(0,C.jsx)(s,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Close`}),t[36]=r,t[37]=a.kind,t[38]=q):q=t[38];let J;t[39]!==r||t[40]!==a.kind?(J=a.kind===`error`&&F&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,C.jsxs)(s,{onClick:O,children:[(0,C.jsx)(x,{"aria-hidden":`true`,className:`h-4 w-4`}),`Try again`]})]}),t[39]=r,t[40]=a.kind,t[41]=J):J=t[41];let Y;t[42]===a.kind?Y=t[43]:(Y=a.kind===`downloading`&&(0,C.jsxs)(s,{disabled:!0,children:[(0,C.jsx)(c,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Installing…`]}),t[42]=a.kind,t[43]=Y);let X;t[44]!==r||t[45]!==a.kind?(X=a.kind===`handed-off`&&(0,C.jsx)(s,{onClick:()=>r(!1),children:`Done`}),t[44]=r,t[45]=a.kind,t[46]=X):X=t[46];let Z;t[47]!==G||t[48]!==K||t[49]!==q||t[50]!==J||t[51]!==Y||t[52]!==X?(Z=(0,C.jsxs)(m,{children:[G,K,q,J,Y,X]}),t[47]=G,t[48]=K,t[49]=q,t[50]=J,t[51]=Y,t[52]=X,t[53]=Z):Z=t[53];let Q;t[54]!==W||t[55]!==Z?(Q=(0,C.jsxs)(f,{className:`sm:max-w-lg`,"data-ok-layer-spawned":``,children:[L,W,Z]}),t[54]=W,t[55]=Z,t[56]=Q):Q=t[56];let $;return t[57]!==r||t[58]!==n||t[59]!==Q?($=(0,C.jsx)(g,{open:n,onOpenChange:r,children:Q}),t[57]=r,t[58]=n,t[59]=Q,t[60]=$):$=t[60],$}var F=new Set;function I(e){for(let t of F)try{t(e)}catch(e){console.warn(`[config-validation-events] listener threw:`,e)}}function L(e){return F.add(e),()=>{F.delete(e)}}export{O as a,y as c,k as i,v as l,L as n,x as o,P as r,b as s,I as t};