@inkeep/open-knowledge 0.35.1-beta.6 → 0.35.1-beta.7
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 +6 -6
- package/dist/constants-CIPwjYvb.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{init-CwXQEPui.mjs → init-CyoYb1pQ.mjs} +3 -3
- package/dist/init-DqRJOP_K.mjs +1 -0
- package/dist/{launch-json-removal-BWzPxI4I.mjs → launch-json-removal-Dgu7KolA.mjs} +2 -2
- package/dist/{loader-KE55RbMp.mjs → loader-BOy4NGBp.mjs} +2 -2
- package/dist/loader-CtGaThuY.mjs +1 -0
- package/dist/{preview-9n5Pboi0.mjs → preview-BDhV-rtm.mjs} +2 -2
- package/dist/preview-JvnYBZy9.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-BekkKvt5.js → ActivityModeContent-V_zAw2Cp.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-DX5yygoO.js → AgentDiffPane-CVTl1yHd.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-Bqy90c-v.js → CodeMirrorPropInput-BbZYh8z8.js} +1 -1
- package/dist/public/assets/{DocumentContext-DpeyjVxx.js → DocumentContext-DdPNvhCs.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-cztPH24v.js → EnableSyncConfirmDialog-YbXwL0lV.js} +1 -1
- package/dist/public/assets/{GraphPanel-klcC474u.js → GraphPanel-C_f_Xd2V.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-BM943qIb.js → ManagedArtifactProperties-DlJgeeBW.js} +1 -1
- package/dist/public/assets/{McpConsentDialogBody-MWFa6hL-.js → McpConsentDialogBody-DWMKC7U_.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-DMLRe7kf.js → MermaidDocEditor-ChTa4qji.js} +1 -1
- package/dist/public/assets/{PropertyPanel-CghCdyF1.js → PropertyPanel-CGrfp7KX.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-CatE51p5.js → ReportBugDialogBody-DO-LsEqg.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-DCuLzGe5.js → SettingsDialogBody-Dqdq8UCp.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-JC3ssCG1.js → ShareBranchSwitchDialog-CtWDd4RN.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-Bv4NmuUd.js → ShareReceiveDialog-DHN60dEn.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-DCuf6F3E.js → ShareReceiveMissDialog-BPZPyDcg.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-Edciau_D.js → SkillEditorActions-D0qSUb6F.js} +1 -1
- package/dist/public/assets/{SourceEditor-CQzUCXVj.js → SourceEditor-CiiGGjlz.js} +1 -1
- package/dist/public/assets/{TerminalPanel-4-XK5RI5.js → TerminalPanel-DipsMDbQ.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-BSMJUakG.js → TimelineDiffPane-CCoQyhfx.js} +1 -1
- package/dist/public/assets/{agent-presence-aWLDoz77.js → agent-presence-DB_yc77e.js} +1 -1
- package/dist/public/assets/auth-state-cache-Bm2yGEzY.js +11 -0
- package/dist/public/assets/{config-provider-BndKfIQn.js → config-provider-TXwl7IKA.js} +1 -1
- package/dist/public/assets/{dist-B2EDiaY_.js → dist-D--vIb9_.js} +1 -1
- package/dist/public/assets/{dist-BKmPXTTI.js → dist-DAFoMRai.js} +1 -1
- package/dist/public/assets/{doc-hash-DMNk5rpw.js → doc-hash-BNPgzBjA.js} +1 -1
- package/dist/public/assets/{documents-events-DXJkkSko.js → documents-events-BOt1_9Hf.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-CKQwswy3.js → file-tree-adapter-C2NHvUNc.js} +1 -1
- package/dist/public/assets/{index-BzMVLovC.js → index-Dqu53vRM.js} +8 -8
- package/dist/public/assets/lint-config-client-DfHR5qma.js +1 -0
- package/dist/public/assets/{navigation-targets-DK_JH7Tb.js → navigation-targets-Dp0ljlND.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-BT96NXgW.js → open-managed-artifact-tab-SLDmUABC.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-CtinJwXM.js → pending-receive-nav-store-DjOWVQpM.js} +1 -1
- package/dist/public/assets/{prop-types-Cf8g0EEm.js → prop-types-D27bl_X-.js} +1 -1
- package/dist/public/assets/{receive-store-CkUOBZ5-.js → receive-store-CqCttQos.js} +1 -1
- package/dist/public/assets/{selection-context-ixLwMixV.js → selection-context-VCaFOVcH.js} +1 -1
- package/dist/public/assets/{skill-actions-BffiTy28.js → skill-actions-2X4vusgg.js} +1 -1
- package/dist/public/assets/{skills-api-DjDFbpaJ.js → skills-api-Zn9HHSnp.js} +1 -1
- package/dist/public/assets/{src-Bg8dr3SE.js → src-DOsxfOd0.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-zbxkZi4l.js → target-navigation-intent-gXTtsPCh.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-v9igCcyQ.js → typing-burst-detector-xnXm4fKL.js} +1 -1
- package/dist/public/assets/{use-activity-panel-DM1azsHE.js → use-activity-panel-Bw3nEPtk.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-U4kAm-FK.js → use-apply-config-color-theme-B7VneWrH.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-jL54o2-s.js → use-timeline-entry-diff-BlAVrAam.js} +1 -1
- package/dist/public/assets/{workspace-paths-CCP6lJKi.js → workspace-paths-DFIcBLaH.js} +1 -1
- package/dist/public/index.html +26 -26
- package/dist/{repair-launch-json-BuvXw8q-.mjs → repair-launch-json-CmCCmAJv.mjs} +2 -2
- package/dist/{repair-mcp-configs-DcCKyHrR.mjs → repair-mcp-configs-d3ypUlcB.mjs} +2 -2
- package/dist/{src-Dwakh1BL.mjs → src-CS54K9uB.mjs} +2 -2
- package/dist/{start-BEFJCwqf.mjs → start-BFz8mNMt.mjs} +2 -2
- package/dist/start-DSgr4S7F.mjs +1 -0
- package/package.json +5 -5
- package/dist/constants-CtrYcI0v.mjs +0 -2
- package/dist/init-BRDE0k-1.mjs +0 -1
- package/dist/loader-DzcO9u-N.mjs +0 -1
- package/dist/preview-Dbfots-x.mjs +0 -1
- package/dist/public/assets/auth-state-cache-CIX5FmID.js +0 -11
- package/dist/public/assets/lint-config-client-C8q65Ycw.js +0 -1
- package/dist/start-Boj7-YRp.mjs +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as e,v as t}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-mcp-configs-
|
|
1
|
+
import{d as e,v as t}from"./init-CyoYb1pQ.mjs";import{_ as n,d as r,s as i}from"./write-project-skill-BZ1Qx_Fc.mjs";import{t as a}from"./mcp-migrate-event-C35ikoh2.mjs";import{homedir as o}from"node:os";function s(e){let t=e.logger??u,n=e.home??o(),a=[];if(e.reclaimDisableEnv===`1`)return t({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of i){let i=r[o],s=c(()=>i.configPath(``,n));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:i,home:n,cwd:``,configPath:s,configPathOverride:void 0,logger:t})),i.projectConfigPath){let n=i.projectConfigPath,r=c(()=>n(e.projectDir));r!==null&&a.push(l({scope:`project`,editorId:o,target:i,home:void 0,cwd:e.projectDir,configPath:r,configPathOverride:r,logger:t}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(r){let i={scope:r.scope,editorId:r.editorId,configPath:r.configPath},o=e(r.target,r.cwd,r.home,r.configPathOverride);if(o===null)return{...i,outcome:`no-entry`};if(n(o))return{...i,outcome:`canonical`};r.logger(a({scope:r.scope,surface:`cli-repair`,editorId:r.editorId,configPath:r.configPath,priorEntry:o}));let s=t(r.target,r.cwd,{mode:`published`,skipAvailabilityCheck:!0},r.home,r.configPathOverride);if(s.action===`failed`){let e=s.error??`unknown write failure`;return r.logger({event:`mcp-config-repair-write-failed`,scope:r.scope,editorId:r.editorId,configPath:r.configPath,error:e}),{...i,outcome:`write-failed`,error:e}}return s.action===`declined`?(r.logger({event:`mcp-config-repair-declined`,scope:r.scope,editorId:r.editorId,configPath:r.configPath,reason:s.declineReason}),{...i,outcome:`declined`}):{...i,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
|
|
2
|
+
//# sourceMappingURL=repair-mcp-configs-d3ypUlcB.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DTipWd-i.mjs";import{N as t,P as n,qo as r}from"./src-CgIX2vtn.mjs";import{Mr as i,Tr as a,et as o,fa as s,la as c,nn as l,nt as u,rt as d,tt as f}from"./src-i2Sa6WJ8.mjs";import{b as p,u as m,v as h,y as g}from"./server-lock-B_XsVesk.mjs";import{t as _}from"./yazl-BucAN8Ez.mjs";import{t as v}from"./esm-EvSEzE_V.mjs";import"./gh-detect-D21DaYXA.mjs";import{E as y,S as b,T as x,_ as ee,b as S,o as C,v as te,w}from"./init-
|
|
1
|
+
import{o as e}from"./chunk-DTipWd-i.mjs";import{N as t,P as n,qo as r}from"./src-CgIX2vtn.mjs";import{Mr as i,Tr as a,et as o,fa as s,la as c,nn as l,nt as u,rt as d,tt as f}from"./src-i2Sa6WJ8.mjs";import{b as p,u as m,v as h,y as g}from"./server-lock-B_XsVesk.mjs";import{t as _}from"./yazl-BucAN8Ez.mjs";import{t as v}from"./esm-EvSEzE_V.mjs";import"./gh-detect-D21DaYXA.mjs";import{E as y,S as b,T as x,_ as ee,b as S,o as C,v as te,w}from"./init-CyoYb1pQ.mjs";import{n as T}from"./constants-CIPwjYvb.mjs";import{t as E}from"./is-object-DYBErO9v.mjs";import{_ as ne,d as re,i as D,v as ie}from"./write-project-skill-BZ1Qx_Fc.mjs";import"./loader-BOy4NGBp.mjs";import{c as ae}from"./colors-B_qgKwrk.mjs";import"./preview-BDhV-rtm.mjs";import{execSync as oe,spawnSync as O}from"node:child_process";import{basename as k,dirname as A,isAbsolute as j,join as M,relative as N,resolve as P,sep as se}from"node:path";import{cpSync as ce,createWriteStream as le,existsSync as F,lstatSync as ue,mkdirSync as I,mkdtempSync as de,readFileSync as L,readdirSync as R,readlinkSync as fe,rmSync as pe,statSync as me,writeFileSync as z}from"node:fs";import{arch as he,freemem as ge,homedir as _e,hostname as ve,platform as ye,release as be,tmpdir as xe,totalmem as Se,type as Ce,uptime as we}from"node:os";import{readFile as B,realpath as V}from"node:fs/promises";import{createHash as H}from"node:crypto";const Te=[{name:`macos-home-path`,regex:/\/Users\/[^/]+\//g,replacement:`~/`},{name:`linux-home-path`,regex:/\/home\/[^/]+\//g,replacement:`~/`},{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)\S+/g,replacement:`$1[REDACTED]`},{name:`jwt`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@]+:[^/\s:@]+@/g,replacement:`://[REDACTED]@`}],Ee=Te.map(e=>e.name);function U(e){let t=new Set,n=0;return{redacted:e.split(`
|
|
2
2
|
`).map(e=>{let r=e;for(let{name:e,regex:i,replacement:a}of Te)i.lastIndex=0,i.test(r)&&(t.add(e),n++,i.lastIndex=0,r=r.replace(i,a));return r}).join(`
|
|
3
3
|
`),patterns:[...t],lineCount:n}}function De(){return M(_e(),`.ok`,`bug-reports`)}function Oe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`);return M(De(),`${t}-bugreport.zip`)}function ke(e,t){let n=M(e,`.ok`,`config.yml`);if(F(n))try{let e=L(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e instanceof Error?e.message:String(e)},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return F(M(e,`.ok`))?H(`sha256`).update(P(e)).digest(`hex`).slice(0,12):null}function Ae(){let e={timestamp:new Date().toISOString(),platform:ye(),osType:Ce(),osRelease:be(),hostname:`[redacted]`,uptime:we(),freeMem:ge(),totalMem:Se(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=oe(`sw_vers -productVersion 2>/dev/null`,i({encoding:`utf8`})).trim()}catch{}try{let t=M(__dirname,`..`,`..`,`package.json`);F(t)&&(e.okVersion=JSON.parse(L(t,`utf8`)).version)}catch{}return e}function je(e,t){if(!F(t))return{files:[]};let n=R(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>M(t,e));if(e&&n.length>0){let t=n.filter(t=>{try{return L(t,`utf8`).includes(`"project":"${e}"`)}catch{return!0}});t.length>0&&(n=t)}return{files:n}}function Me(e){let n=M(e,`.ok`,`local`);return F(n)?{files:[`server.lock`,`last-spawn-error.log`,t].map(e=>M(n,e)).filter(e=>F(e))}:{files:[]}}function Ne(e){let t=M(e,`.ok`,`local`,`logs`);return F(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>M(t,e)).filter(e=>F(e))}:{files:[]}}function Pe(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=U(e.content);e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name),n.length>0&&e.redactions.push({file:e.name,lineCount:r,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function W(e){for(let t of e.files)try{Pe({zipfile:e.zipfile,name:`${e.prefix}/${k(t)}`,content:L(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n instanceof Error?n.message:String(n)},`bug-report: skipped unreadable file`)}}async function Fe(t){let{redact:n,outputPath:r,logger:i}=t,a=t.userLogsDir??M(_e(),`.ok`,`logs`),o=t.projectDir?ke(t.projectDir,i):null;I(A(r),{recursive:!0}),i?.info({projectSlug:o},`gathering diagnostic data`);let s=Ae();s.desktop=t.desktop??null;let{files:c}=je(o,a),{files:l}=t.projectDir?Me(t.projectDir):{files:[]},{files:u}=t.projectDir?Ne(t.projectDir):{files:[]};i?.info({logFileCount:c.length,lockFileCount:l.length,localSinkFileCount:u.length},`files collected`);let d=[],f=[],{ZipFile:p}=await import(`./yazl-DvlathRc.mjs`).then(t=>e(t.default,1)),m=new p;W({zipfile:m,files:c,prefix:`logs`,redact:n,bundleFiles:f,redactions:d,logger:i}),W({zipfile:m,files:l,prefix:`lockdir`,redact:n,bundleFiles:f,redactions:d,logger:i}),W({zipfile:m,files:u,prefix:`local-logs`,redact:n,bundleFiles:f,redactions:d,logger:i});for(let e of t.extraFiles??[])try{let t=L(e.sourcePath),n=`extra/${e.zipName??k(e.sourcePath)}`;m.addBuffer(t,n),f.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&Pe({zipfile:m,name:`note.txt`,content:t.note,redact:n,bundleFiles:f,redactions:d});let h=JSON.stringify(s,null,2);m.addBuffer(Buffer.from(h,`utf8`),`sysinfo.json`),f.push(`sysinfo.json`);let g={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:o,files:f,redactions:d,sysinfo:s};m.addBuffer(Buffer.from(JSON.stringify(g,null,2),`utf8`),`MANIFEST.json`);let _=d.reduce((e,t)=>e+t.lineCount,0),v=[`# Bug Report Bundle`,``,`Generated: ${g.generatedAt}`,`Project: ${o??`(unscoped)`}`,`Discipline version: ${g.disciplineVersion}`,``,`## Contents`,``,...f.map(e=>`- ${e}`),``,`## Privacy`,``,...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${Ee.join(`, `)}`,_>0?`${_} line(s) were scrubbed across ${d.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
|
|
4
4
|
`);m.addBuffer(Buffer.from(v,`utf8`),`README.md`),m.end();let y=le(r);return m.outputStream.pipe(y),await new Promise((e,t)=>{y.on(`close`,e),y.on(`error`,t)}),i?.info({bundlePath:r,fileCount:f.length,redactionCount:_},`bundle written`),{zipPath:r,summary:{projectSlug:o,files:f,redactions:d,redactedLineCount:_,generatedAt:g.generatedAt}}}var G=r(),Ie=e(_(),1);const Le=new Set([`doc.name`,`currentDoc`]);function Re(e){return`doc:${H(`sha256`).update(e).digest(`hex`).slice(0,8)}`}function ze(e,t,n){let r=e.docNameMap[n];if(r===void 0){e.docNameMap[n]=t;return}if(r===t)return;let i=e.docNameCollisions[n];i?i.includes(t)||i.push(t):e.docNameCollisions[n]=[t]}function Be(e,t){let n=t.originalToHashed.get(e);if(n!==void 0)return n;let r=Re(e);return t.originalToHashed.set(e,r),ze(t,e,r),r}function Ve(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function He(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e,t){if(typeof e==`string`)return Ve(e,t.contentDir);if(Array.isArray(e))return e.map(e=>K(e,t));if(!He(e))return e;let n=typeof e.key==`string`&&Le.has(e.key)&&He(e.value)&&typeof e.value.stringValue==`string`?e.value.stringValue:null,r={};for(let[i,a]of Object.entries(e))if(n!==null&&i===`value`&&He(a)){let e=Be(n,t);r[i]={...a,stringValue:e}}else Le.has(i)&&typeof a==`string`?r[i]=Be(a,t):r[i]=K(a,t);return r}function Ue(e,t){if(t.originalToHashed.size===0)return e;let n=Array.from(t.originalToHashed.entries()).sort(([e],[t])=>t.length-e.length),r=e;for(let[e,t]of n)e.length!==0&&r.includes(e)&&(r=r.split(e).join(t));return r}function We(e,t){let n=L(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
@@ -18,4 +18,4 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{N as t,P as n,qo as r}from"./src
|
|
|
18
18
|
`).replace(/\n/g,`\r
|
|
19
19
|
`));let d=`${i?``:``}${u}`;return d!==r&&s(e,d,{mode:w(e)}),{kind:`removed`}}const Qt=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function $t(e,t,n=l){if(e!==void 0&&!Qt.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let en=null;function tn(e){en=e}function nn(){return en??process.cwd()}function rn(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function an(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function on(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:f(r),command:r,isDesktop:rn(r)}}function sn(e){return e.ui==null?!1:e.ui.status===`alive`||e.ui.status===`foreign-host`}function Q(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:t===`dead-pid`&&sn(e)?`ui-orphan`:`stale`}const cn=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function ln(e){switch(e){case`running`:return Z.default.green(e);case`desktop`:return Z.default.blue(e);case`foreign`:return Z.default.cyan(e);case`ui-orphan`:return Z.default.magenta(e);case`stale`:return Z.default.yellow(e)}}function un(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function dn(e){return`${un(e.server.usage)} | ${un(e.ui?.usage??null)}`}function fn(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function pn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>{let t=Q(e),n=t===`ui-orphan`&&e.ui!=null?e.ui.pid:e.server.pid;return[e.directory,fn(e),dn(e),t,String(n),an(e.server.startedAt),e.binary??`—`]}),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=ln(Q(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=Z.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
|
|
20
20
|
`)}async function mn(e={}){let t=e.discover??o,n=e.inspect??X,r=e.log??(e=>console.log(e)),i=e.resolveCommand??u,a=e.resolveUsage??d,s=await t(),c=[];for(let e of s){let t=n(e,`server`),r=n(e,`ui`),o=on(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:a(r.lock.pid));o!=null&&c.push(o)}if(e.json){let e=c.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(pn(e.all?c:c.filter(e=>cn.has(Q(e)))))}function hn(){return new v(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await mn({all:t.all===!0||e===`all`,json:t.json===!0})})}function gn(e,t,n={}){let r=n.isAlive??g,i=[];for(let[n,a]of[[`server`,e],[`ui`,t]])(a.status===`alive`||a.status===`foreign-host`&&r(a.lock.pid))&&i.push({name:n,pid:a.lock.pid,port:a.lock.port});return{targets:i}}function _n(e){let t=e.inspect??(t=>X(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=gn(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function $(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function vn(e,t=g){let n=await o(),r=null;for(let i of n){let n=X(i,`server`),a=X(i,`ui`);if($(n,t)&&n.lock.port===e||$(a,t)&&a.lock.port===e)return i;r===null&&($(n,t)&&n.lock.pid===e||$(a,t)&&a.lock.pid===e)&&(r=i)}return r}function yn(e){let t=_n({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function bn(e){return new v(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=_n({lockDir:a(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await mn({});return}if(n===`all`){let e=await o();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=X(n,`server`),r=X(n,`ui`);!$(e,g)&&!$(r,g)||(yn(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await vn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}yn(t);return}yn(a(P(nn(),n)))})}function xn(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}async function Sn(e,t){let n,r;try{n=await V(P(e)),r=await V(P(A(e)))}catch{return{kind:`not-git`}}if(!wn(n,r))return{kind:`symlink-escape`};let i=M(n,`.git`),a;try{a=me(i)}catch{return{kind:`not-git`}}let o;if(a.isDirectory()){let e;try{e=await V(i)}catch{return{kind:`not-git`}}if(!wn(e,n))return{kind:`symlink-escape`};o=e}else if(a.isFile()){let e;try{e=await B(i,`utf-8`)}catch{return{kind:`not-git`}}let t=/^gitdir:\s*(.+)$/m.exec(e.trim());if(!t)return{kind:`not-git`};let r=t[1].trim(),a=j(r)?r:P(n,r);try{o=await V(a)}catch{return{kind:`not-git`}}}else return{kind:`not-git`};let s=M(await Cn(o),`config`),c;try{c=await B(s,`utf-8`)}catch{return{kind:`not-git`}}let l=En(c);if(l===null)return{kind:`no-origin`};let u=Pt(l);if(u===null||u.hostname!==`github.com`)return{kind:`non-github`};let d=u.owner.toLowerCase()===t.owner.toLowerCase(),f=u.name.toLowerCase()===t.repo.toLowerCase();return!d||!f?{kind:`wrong-repo`,actualOwner:u.owner,actualRepo:u.name}:{kind:`ok`,gitRemoteUrl:`https://github.com/${u.owner}/${u.name}.git`}}async function Cn(e){let t;try{t=(await B(M(e,`commondir`),`utf-8`)).trim()}catch{return e}if(t.length===0)return e;let n=j(t)?t:P(e,t);try{return await V(n)}catch{return n}}function wn(e,t){if(e===t)return!0;let n=N(t,e);return n.length>0&&!n.startsWith(`..`)&&!j(n)}function Tn(e){let t=e.indexOf(`#`),n=e.indexOf(`;`),r=-1;return t>=0&&n>=0?r=Math.min(t,n):t>=0?r=t:n>=0&&(r=n),(r===-1?e:e.slice(0,r)).trim()}function En(e){let t=!1;for(let n of e.split(/\r?\n/)){let e=Tn(n);if(e.length===0)continue;if(e.startsWith(`[`)){t=/^\[\s*remote\s+["']origin["']\s*\]$/.test(e);continue}if(!t)continue;let r=/^url\s*=\s*(.+)$/.exec(e);if(r)return Dn(r[1])}return null}function Dn(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}const On=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=te(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=D(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function kn(e,t,n={},r=On){let i=[];for(let a of t){let t=re[a];for(let a of r)i.push(a.write(t,e,n))}return i}function An(e,t,n={}){return{integrations:kn(e,t,n)}}export{Mt as C,U as D,Oe as E,X as S,kt as T,Wt as _,bn as a,It as b,tn as c,Rt as d,Bt as f,Ut as g,Vt as h,_n as i,$t as l,Gt as m,Sn as n,hn as o,zt as p,xn as r,nn as s,An as t,Jt as u,Ft as v,Ot as w,Pt as x,Lt as y};
|
|
21
|
-
//# sourceMappingURL=src-
|
|
21
|
+
//# sourceMappingURL=src-CS54K9uB.mjs.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{F as e,M as t}from"./src-CgIX2vtn.mjs";import{Mr as n,a as r,br as i,rn as a}from"./src-i2Sa6WJ8.mjs";import{n as o,t as s}from"./esm-EvSEzE_V.mjs";import{i as c,t as l}from"./gh-detect-D21DaYXA.mjs";import{n as u}from"./constants-CtrYcI0v.mjs";import{spawn as d}from"node:child_process";import{basename as f,dirname as p,join as m}from"node:path";import{closeSync as h,existsSync as g,mkdirSync as _,openSync as v,statSync as y}from"node:fs";import{homedir as b}from"node:os";import{rm as x}from"node:fs/promises";import{setTimeout as S}from"node:timers/promises";function C(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function w(e,t,r={}){let i=(r.spawn??d)(e,[...t],n({detached:!0,stdio:`ignore`,env:C(r.env??process.env)}));return i.unref(),i}const T=`OpenKnowledge.app`,E=`/Applications/${T}`;function D(){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 O(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(k(e,E))return E;let t=m(e.homeDir??b(),`Applications`,T);return k(e,t)?t:null}function k(e,t){try{let n=m(t,`Contents`,`MacOS`,`OpenKnowledge`),r=e.statSync(n);return r&&typeof r.isFile==`function`?r.isFile():!1}catch{return!1}}function A(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=O(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 j(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)"),w(`open`,[`-b`,`com.inkeep.open-knowledge`],{spawn:e.spawn})}function M(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found at ${E}. 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 ${E} (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available at ${E} but launch dispatch did not fire (caller bug).`}}function N(e){return m(p(e),`..`,`Frameworks`,`OpenKnowledge Server.app`,`Contents`,`MacOS`,`OpenKnowledge Helper`)}const P=/\/[^/]+\.app\/Contents\/MacOS\/[^/]+$/;function F(e){if(e.platform!==`darwin`||!P.test(e.execPath))return null;let t=N(e.execPath);return e.exists(t)?t:null}function I(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:F({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 L(e,t){return e.host??t.HOST??`127.0.0.1`}function R(e){let t=f(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var z=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 B(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 V(t){g(t.lockDir)||_(t.lockDir,{recursive:!0});let n=v(m(t.lockDir,e),`w`),r=t.spawn??d,{PORT:i,...a}=process.env,o=I();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 H(e,t,n){return e??(n===void 0?t:void 0)}function U(e,t){return e!==void 0&&t!==null&&t.port>0&&t.draining!==!0}function W(e,t,n){return e??+(t!=null&&!n)}async function G(e){let t=e.spawn??d,n=I(),{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=W(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 K(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 ee=t;function q(e,t,n=e=>x(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 J(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,openHandles:e??{},handlesAvailable:e!==null},`idle-shutdown: teardown finished — exiting process`),n(+!!i)}}}function Y(e){let t=e.sigtermGraceMs??ee,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>S(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 X(e){let{config:t,cwd:n,host:o}=e,s=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:x,waitForServerLockDrain:C}=await import(`./src-PsxMXz66.mjs`),w=e.log??_(`start`),T=e.singleFile!==void 0,E=e.projectDir??n,D=T?r(e.singleFile).canonicalFilePath:void 0,O=D?h(D):void 0,k=D?m(D):void 0;if(!T){if(!s&&!a(n))throw new z(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=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-DcCKyHrR.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-BuvXw8q-.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-B_LT6KmX.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let A=O??b(t,n);!T&&!f(A)&&(p(A,{recursive:!0}),w.info({contentDir:A},`Created content directory`));let j=null,M=async({lockDir:t})=>{if(j=B({uiLock:y(t),isAlive:v}),j.action===`spawn`&&!u)try{let r=e.uiPort===void 0?void 0:[`ui`,`--port`,String(e.uiPort)];V({lockDir:t,cwd:n,spawn:e.spawn,args:r}),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=c(),F=i();{let e=x(T?E:n),t=Date.now(),r=await C(e);r!==`no-drain`&&w.info({event:`start-waited-for-draining-predecessor`,outcome:r,waitedMs:Date.now()-t,drainLockDir:e},r===`released`?`[start] predecessor server finished draining — proceeding`:`[start] predecessor server still draining after wait — proceeding to collide`)}let I=await g({config:t,contentDir:A,projectDir:T?E:n,contentRoot:T?void 0:t.content.dir,port:e.port,host:o,quiet:!1,detectGh:l,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=Y({readUiLock:()=>y(I.lockDir),isAlive:v,killPid:(e,t)=>{process.kill(e,t)},destroy:t,log:w});return J(T?q(n,E):n,{log:w,exit:e.idleExit})},log:w,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});j||={action:`skip`,reason:`alive`,pid:0,port:0};let L=j,R=null;if(L.action===`skip`)R=L.port>0?L.port:null;else if(!u){let t=e.uiBindTimeoutMs??3e3;R=await K({readUiLock:()=>y(I.lockDir),now:Date.now,sleep:e=>S(e),timeoutMs:t,pollIntervalMs:50}),R===null&&w.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:I.httpServer,destroy:I.destroy,lockDir:I.lockDir,contentDir:A,port:I.port,ready:I.ready,degraded:I.degraded,uiSpawnDecision:j,resolvedUiPort:R}}function te(e){if(e===`browser`||e===`app`)return e;throw new o(`--mode must be 'browser' or 'app'`)}function ne(e){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<1||t>65535)throw new o(`--ui-port must be a port number between 1 and 65535`);return t}function Z(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function Q(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 $(e,t){let n=Z(process.env);n!==null&&(process.env.OK_CONSOLE_LEVEL=n);let{renderBanner:r}=await import(`./banner-dc_0Y_PF.mjs`),{accent:i,dim:a,error:o,warning:s}=await import(`./colors-DUjg75V3.mjs`),c=process.cwd(),l=e;process.title=R(c);let d=L(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=H(f,p,m);if(m!==void 0){let{readServerLock:e,resolveLockDir:t}=await import(`./src-PsxMXz66.mjs`);if(U(m,e(t(c)))){await G({cwd:c,uiPort:m});return}}let g;try{g=await X({config:l,cwd:c,host:d,port:h,...m===void 0?{}:{uiPort:m},...t.serveContentAssets===void 0?{}:{serveContentAssets:t.serveContentAssets},...t.reactShellDistDir?{reactShellDistDir:t.reactShellDistDir}:{},...t.singleFile?{singleFile:t.singleFile}:{},...t.projectDir?{projectDir:t.projectDir}:{}})}catch(e){e instanceof z&&(console.error(o(e.message)),process.exit(1));let t=await import(`./src-PsxMXz66.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&&re(e,t)){await G({cwd:c,uiPort:m});return}let n=ie(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]=Q(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:u,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-CO5MRLMI.mjs`);e(S)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function re(e,t){let n=t.ServerLockCollisionError;return n!==void 0&&e instanceof n}function ie(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=m(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 ae(e){return new s(`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`,ne).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,te).option(`--serve-content-assets`,`Serve content assets from this server (now the default; kept for compatibility)`).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{F as e,M as t}from"./src-CgIX2vtn.mjs";import{Mr as n,a as r,br as i,rn as a}from"./src-i2Sa6WJ8.mjs";import{n as o,t as s}from"./esm-EvSEzE_V.mjs";import{i as c,t as l}from"./gh-detect-D21DaYXA.mjs";import{n as u}from"./constants-CIPwjYvb.mjs";import{spawn as d}from"node:child_process";import{basename as f,dirname as p,join as m}from"node:path";import{closeSync as h,existsSync as g,mkdirSync as _,openSync as v,statSync as y}from"node:fs";import{homedir as b}from"node:os";import{rm as x}from"node:fs/promises";import{setTimeout as S}from"node:timers/promises";function C(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function w(e,t,r={}){let i=(r.spawn??d)(e,[...t],n({detached:!0,stdio:`ignore`,env:C(r.env??process.env)}));return i.unref(),i}const T=`OpenKnowledge.app`,E=`/Applications/${T}`;function D(){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 O(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(k(e,E))return E;let t=m(e.homeDir??b(),`Applications`,T);return k(e,t)?t:null}function k(e,t){try{let n=m(t,`Contents`,`MacOS`,`OpenKnowledge`),r=e.statSync(n);return r&&typeof r.isFile==`function`?r.isFile():!1}catch{return!1}}function A(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=O(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 j(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)"),w(`open`,[`-b`,`com.inkeep.open-knowledge`],{spawn:e.spawn})}function M(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found at ${E}. 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 ${E} (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available at ${E} but launch dispatch did not fire (caller bug).`}}function N(e){return m(p(e),`..`,`Frameworks`,`OpenKnowledge Server.app`,`Contents`,`MacOS`,`OpenKnowledge Helper`)}const P=/\/[^/]+\.app\/Contents\/MacOS\/[^/]+$/;function F(e){if(e.platform!==`darwin`||!P.test(e.execPath))return null;let t=N(e.execPath);return e.exists(t)?t:null}function I(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:F({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 L(e,t){return e.host??t.HOST??`127.0.0.1`}function R(e){let t=f(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var z=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 B(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 V(t){g(t.lockDir)||_(t.lockDir,{recursive:!0});let n=v(m(t.lockDir,e),`w`),r=t.spawn??d,{PORT:i,...a}=process.env,o=I();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 H(e,t,n){return e??(n===void 0?t:void 0)}function U(e,t){return e!==void 0&&t!==null&&t.port>0&&t.draining!==!0}function W(e,t,n){return e??+(t!=null&&!n)}async function G(e){let t=e.spawn??d,n=I(),{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=W(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 K(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 ee=t;function q(e,t,n=e=>x(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 J(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,openHandles:e??{},handlesAvailable:e!==null},`idle-shutdown: teardown finished — exiting process`),n(+!!i)}}}function Y(e){let t=e.sigtermGraceMs??ee,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>S(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 X(e){let{config:t,cwd:n,host:o}=e,s=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:x,waitForServerLockDrain:C}=await import(`./src-PsxMXz66.mjs`),w=e.log??_(`start`),T=e.singleFile!==void 0,E=e.projectDir??n,D=T?r(e.singleFile).canonicalFilePath:void 0,O=D?h(D):void 0,k=D?m(D):void 0;if(!T){if(!s&&!a(n))throw new z(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=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-d3ypUlcB.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-CmCCmAJv.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-B_LT6KmX.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let A=O??b(t,n);!T&&!f(A)&&(p(A,{recursive:!0}),w.info({contentDir:A},`Created content directory`));let j=null,M=async({lockDir:t})=>{if(j=B({uiLock:y(t),isAlive:v}),j.action===`spawn`&&!u)try{let r=e.uiPort===void 0?void 0:[`ui`,`--port`,String(e.uiPort)];V({lockDir:t,cwd:n,spawn:e.spawn,args:r}),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=c(),F=i();{let e=x(T?E:n),t=Date.now(),r=await C(e);r!==`no-drain`&&w.info({event:`start-waited-for-draining-predecessor`,outcome:r,waitedMs:Date.now()-t,drainLockDir:e},r===`released`?`[start] predecessor server finished draining — proceeding`:`[start] predecessor server still draining after wait — proceeding to collide`)}let I=await g({config:t,contentDir:A,projectDir:T?E:n,contentRoot:T?void 0:t.content.dir,port:e.port,host:o,quiet:!1,detectGh:l,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=Y({readUiLock:()=>y(I.lockDir),isAlive:v,killPid:(e,t)=>{process.kill(e,t)},destroy:t,log:w});return J(T?q(n,E):n,{log:w,exit:e.idleExit})},log:w,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});j||={action:`skip`,reason:`alive`,pid:0,port:0};let L=j,R=null;if(L.action===`skip`)R=L.port>0?L.port:null;else if(!u){let t=e.uiBindTimeoutMs??3e3;R=await K({readUiLock:()=>y(I.lockDir),now:Date.now,sleep:e=>S(e),timeoutMs:t,pollIntervalMs:50}),R===null&&w.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:I.httpServer,destroy:I.destroy,lockDir:I.lockDir,contentDir:A,port:I.port,ready:I.ready,degraded:I.degraded,uiSpawnDecision:j,resolvedUiPort:R}}function te(e){if(e===`browser`||e===`app`)return e;throw new o(`--mode must be 'browser' or 'app'`)}function ne(e){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<1||t>65535)throw new o(`--ui-port must be a port number between 1 and 65535`);return t}function Z(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function Q(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 $(e,t){let n=Z(process.env);n!==null&&(process.env.OK_CONSOLE_LEVEL=n);let{renderBanner:r}=await import(`./banner-dc_0Y_PF.mjs`),{accent:i,dim:a,error:o,warning:s}=await import(`./colors-DUjg75V3.mjs`),c=process.cwd(),l=e;process.title=R(c);let d=L(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=H(f,p,m);if(m!==void 0){let{readServerLock:e,resolveLockDir:t}=await import(`./src-PsxMXz66.mjs`);if(U(m,e(t(c)))){await G({cwd:c,uiPort:m});return}}let g;try{g=await X({config:l,cwd:c,host:d,port:h,...m===void 0?{}:{uiPort:m},...t.serveContentAssets===void 0?{}:{serveContentAssets:t.serveContentAssets},...t.reactShellDistDir?{reactShellDistDir:t.reactShellDistDir}:{},...t.singleFile?{singleFile:t.singleFile}:{},...t.projectDir?{projectDir:t.projectDir}:{}})}catch(e){e instanceof z&&(console.error(o(e.message)),process.exit(1));let t=await import(`./src-PsxMXz66.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&&re(e,t)){await G({cwd:c,uiPort:m});return}let n=ie(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]=Q(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:u,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-CO5MRLMI.mjs`);e(S)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function re(e,t){let n=t.ServerLockCollisionError;return n!==void 0&&e instanceof n}function ie(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=m(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 ae(e){return new s(`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`,ne).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,te).option(`--serve-content-assets`,`Serve content assets from this server (now the default; kept for compatibility)`).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=A(D());if(n.available){j({spawn:d});return}console.error(M(n.reason)),process.exit(1)}await $(n,t)})}export{A as C,D as S,w as T,ae as _,W as a,J as b,R as c,H as d,L as f,V as g,U as h,Y as i,Q as l,$ as m,K as n,G as o,Z as p,X as r,B as s,z as t,re as u,ie as v,j as w,I as x,q as y};
|
|
3
|
-
//# sourceMappingURL=start-
|
|
3
|
+
//# sourceMappingURL=start-BFz8mNMt.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,f as t,r as n}from"./start-BFz8mNMt.mjs";export{n as bootStartServer,t as resolveHost,e as startCommand};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/open-knowledge",
|
|
3
|
-
"version": "0.35.1-beta.
|
|
3
|
+
"version": "0.35.1-beta.7",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"ajv-formats": "^3.0.1",
|
|
62
62
|
"tsdown": "^0.21.7",
|
|
63
63
|
"typescript": "^5.9.3",
|
|
64
|
-
"@inkeep/open-knowledge-app": "0.35.1-beta.
|
|
65
|
-
"@inkeep/open-knowledge-
|
|
66
|
-
"@inkeep/open-knowledge-
|
|
67
|
-
"@inkeep/open-knowledge-
|
|
64
|
+
"@inkeep/open-knowledge-app": "0.35.1-beta.7",
|
|
65
|
+
"@inkeep/open-knowledge-core": "0.35.1-beta.7",
|
|
66
|
+
"@inkeep/open-knowledge-server": "0.35.1-beta.7",
|
|
67
|
+
"@inkeep/open-knowledge-native-config": "0.0.0"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build:cli": "tsdown",
|
package/dist/init-BRDE0k-1.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e}from"./init-CwXQEPui.mjs";export{e as runInit};
|
package/dist/loader-DzcO9u-N.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./loader-KE55RbMp.mjs";export{e as loadConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./preview-9n5Pboi0.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DseTPa7n.js";import{n as t,r as n,t as r}from"./compiler-runtime-DrcePeIl.js";import{C as i,E as a,En as o,On as s,S as c,T as l,Ut as u,Vt as d,Wt as f,n as p,w as m,x as h}from"./DocumentContext-DpeyjVxx.js";import{n as g,r as _}from"./dist-CSDjUb5q.js";import{l as v,n as y,t as b,u as x}from"./createLucideIcon-Wgamzz8_.js";import{d as S}from"./dist-DivkR5AO.js";import{i as C,n as w,t as T}from"./tooltip-CuKuwVbZ.js";import{a as E,c as D,i as O,n as k,o as A,s as j,t as M}from"./dialog-492Ff7fG.js";import{_t as N}from"./CodeMirrorPropInput-Bqy90c-v.js";import{E as P,_ as F,h as I,l as L,p as R}from"./skills-api-DjDFbpaJ.js";import{t as z}from"./label-CveCqKNR.js";import{n as B,t as V}from"./radio-group-D9Wp487Q.js";import{At as H,Ot as U,Tt as W,Ur as G,Yr as K,_a as q,ht as J,jt as ee,kt as te,zt as ne}from"./dist-B2EDiaY_.js";import{t as re}from"./trace-api-BIWqyPc9.js";import{a as ie,l as ae,n as oe,r as se,t as ce}from"./EnableSyncConfirmDialog-cztPH24v.js";import{t as le}from"./arrow-up-right-BnJZWj8r.js";import{t as ue}from"./check-BJRSVBAg.js";import{n as de}from"./CopyButton-B8lE78wK.js";import{s as fe}from"./prop-types-Cf8g0EEm.js";import{i as pe,o as me,w as he}from"./skill-actions-BffiTy28.js";import{i as ge,o as _e,s as ve,u as ye}from"./workspace-paths-CCP6lJKi.js";import{t as be}from"./copy-CfDOH9N1.js";import{a as xe,r as Se,s as Ce}from"./open-managed-artifact-tab-BT96NXgW.js";import{t as we}from"./loader-circle-BrJhrTc7.js";import{t as Te}from"./refresh-cw-DgVrChIu.js";import{t as Ee}from"./trash-2-U9wpS1zc.js";import{t as De}from"./triangle-alert-BaZPlVka.js";import{t as Oe}from"./x-_C6KOlzX.js";import{n as ke}from"./dist-CAIcun02.js";import{t as Ae}from"./input-b4FSCbA5.js";import{t as Y}from"./dist-o9cVHl8Q.js";import{_ as je,v as Me}from"./lint-config-client-C8q65Ycw.js";import{t as Ne}from"./parse-api-error-DfesE4Y7.js";import{c as Pe,o as Fe}from"./documents-events-DXJkkSko.js";import{a as Ie,m as Le,s as Re}from"./doc-hash-DMNk5rpw.js";import"./config-provider-BndKfIQn.js";import{n as ze}from"./config-context-BaIZpYSb.js";import{t as Be}from"./external-link-BUoZ56id.js";import{n as Ve,t as He}from"./clipboard-adapter-CfjsRFpv.js";import{t as Ue}from"./textarea-D45cTFgp.js";var X=e(t(),1),Z=n(),We=`Separator`,Ge=`horizontal`,Ke=[`horizontal`,`vertical`],qe=X.forwardRef((e,t)=>{let{decorative:n,orientation:r=Ge,...i}=e,a=Je(r)?r:Ge,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,Z.jsx)(S.div,{"data-orientation":a,...o,...i,ref:t})});qe.displayName=We;function Je(e){return Ke.includes(e)}var Ye=qe,Xe=b(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ze=b(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Qe=b(`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`}]]),$e=b(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),et=b(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),tt=b(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),nt=b(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),rt=b(`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`}]]),it=b(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Q=r(),at=`#settings`;function ot(e){return je(e.target)?!1:Me(e,`settings`)}function st(e){return e.replace(/^#/,``)===`settings`}function ct(){return typeof window>`u`?``:window.location.hash}function lt(){let e=(0,Q.c)(4),[t,n]=(0,X.useState)(dt),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{(0,X.startTransition)(()=>{n(st(ct()))})};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,X.useEffect)(r,i);let a=ut,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function ut(){typeof window>`u`||st(ct())&&window.history.back()}function dt(){return st(ct())}function ft(e){let t=(0,Q.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,X.useState)(n),[a,o]=(0,X.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return Pe(()=>{o(gt)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,X.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(mt).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:`Server returned an incomplete folder response.`});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,X.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(pt),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function pt(e){return e+1}async function mt(e){if(!e.ok){let t=await e.json().catch(ht);throw Error(Ne(t)??`HTTP ${e.status}`)}return e.json()}function ht(){return null}function gt(e){return e+1}function _t(){let e=(0,Q.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,X.useState)(t),[i,a]=(0,X.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>Pe(()=>{a(bt)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,X.useEffect)(o,s);let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/templates`).then(vt).then(t=>{if(e)return;let n=ne.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:`Server returned an incomplete templates response.`});return}r({status:`ready`,data:n.data.templates})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let l;return e[4]===i?l=e[5]:(l=[i],e[4]=i,e[5]=l),(0,X.useEffect)(c,l),n}async function vt(e){if(!e.ok){let t=await e.json().catch(yt);throw Error(Ne(t)??`HTTP ${e.status}`)}return e.json()}function yt(){return null}function bt(e){return e+1}function xt(e){let t=(0,Q.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=x(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,Z.jsx)(Ye,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}function St(e){let t=(0,Q.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=x(`group/field-group @container/field-group flex w-full flex-col gap-6 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`field-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Ct=v(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function wt(e){let t=(0,Q.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]!==n||t[5]!==a?(o=x(Ct({orientation:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":a,className:o,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function Tt(e){let t=(0,Q.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=x(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`field-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Et(e){let t=(0,Q.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=x(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(z,{"data-slot":`field-label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Dt(e){let t=(0,Q.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=x(`flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`field-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ot(e){let t=(0,Q.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=x(`text-left text-1sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`p`,{"data-slot":`field-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function kt(e){let t=(0,Q.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,errors:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;bb0:{if(n){o=n;break bb0}if(!i?.length){o=null;break bb0}let e;t[5]===i?e=t[6]:(e=[...new Map(i.map(jt)).values()],t[5]=i,t[6]=e);let r=e;if(r?.length===1){o=r[0]?.message;break bb0}let a;t[7]===r?a=t[8]:(a=(0,Z.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:r.map(At)}),t[7]=r,t[8]=a),o=a}let s=o;if(!s)return null;let c;t[9]===r?c=t[10]:(c=x(`text-sm font-normal text-destructive`,r),t[9]=r,t[10]=c);let l;return t[11]!==s||t[12]!==a||t[13]!==c?(l=(0,Z.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:c,...a,children:s}),t[11]=s,t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function At(e){return e?.message&&(0,Z.jsx)(`li`,{children:e.message},e.message)}function jt(e){return[e?.message,e]}async function Mt(){try{let e=await fetch(`/api/semantic-status`);return e.ok?await e.json():(console.debug(`[semantic-status] probe returned`,e.status),null)}catch(e){return console.debug(`[semantic-status] probe failed`,e),null}}function Nt(e){let t=(0,Q.c)(16),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n.enabled??!0,[i,a]=(0,X.useState)(null),o;t[2]===r?o=t[3]:(o=function(){r&&Mt().then(e=>{e&&a(e)})},t[2]=r,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=()=>{s()},t[4]=s,t[5]=c);let l;t[6]===r?l=t[7]:(l=[r],t[6]=r,t[7]=l),(0,X.useEffect)(c,l);let u;t[8]!==r||t[9]!==s?(u=()=>{if(r)return Fe(e=>{e.includes(`files`)&&s()})},t[8]=r,t[9]=s,t[10]=u):u=t[10];let d;t[11]===r?d=t[12]:(d=[r],t[11]=r,t[12]=d),(0,X.useEffect)(u,d);let f;return t[13]!==s||t[14]!==i?(f={status:i,refresh:s},t[13]=s,t[14]=i,t[15]=f):f=t[15],f}var Pt=`open-knowledge-app`;function Ft(e){try{re.getTracer(Pt).startSpan(e).end()}catch(e){console.warn(`[terminal-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function It(){Ft(`ok.desktop.terminalOpened`)}function Lt(){Ft(`ok.desktop.shellConsentGranted`)}var Rt=`github.com`,zt=new Map;async function Bt(e){try{let t=await e.json(),n=J.safeParse(t);if(n.success)return n.data.title}catch{}}async function Vt(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function Ht(e){let t=e?.host??Rt,n=await Vt(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await Bt(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0}}function Ut(e){let t=e?.host??Rt,n=zt.get(t);if(n)return n;let r=Ht(e).finally(()=>{zt.delete(t)});return zt.set(t,r),r}function Wt(e){let t=e.split(`
|
|
2
|
-
`);for(let e=t.length-1;e>=0;e--){let n=t[e]?.trim();if(n)try{let e=JSON.parse(n);if(e&&typeof e==`object`)return e}catch{}}return null}function Gt(){return{status:Ut,async repos(e){let t=e?.host??`github.com`,n=await Vt(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:await Bt(n)??`Failed to fetch repositories`};let r=Wt(await n.text());if(r&&r.type===`error`&&r.problem&&typeof r.problem==`object`){let e=r.problem;return{ok:!1,error:e.detail||e.title||`Failed to fetch repositories`}}if(!r||!Array.isArray(r.repos))return{ok:!1,error:`Failed to fetch repositories`};let i=[];for(let e of r.repos){let t=e;typeof t?.full_name==`string`&&typeof t.clone_url==`string`&&i.push({full_name:t.full_name,clone_url:t.clone_url,private:t.private===!0})}return{ok:!0,host:typeof r.host==`string`?r.host:t,repos:i}},async signout(e){let t=await Vt(`/api/local-op/auth/signout`,e);return t.ok?{ok:!0}:{ok:!1,error:await Bt(t)}}}}function Kt(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function qt(e,t){let n=e.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)return i+=r.decode(),!!(i.trim()&&t(i)===`terminal`);i+=r.decode(a,{stream:!0});let o=i.split(`
|
|
3
|
-
`);i=o.pop()??``;for(let e of o)if(e.trim()&&t(e)===`terminal`)return!0}}function Jt(e){let t=[],n=[],r=new AbortController,i=!1,a=()=>{for(let e of n.splice(0))e(null)};return e(e=>{i||(n.length>0?n.shift()?.(e):t.push(e),(e.type===`complete`||e.type===`error`)&&(i=!0,r.abort(),a()))},r.signal),{events:{[Symbol.asyncIterator](){return{async next(){if(t.length>0){let e=t.shift();return e===void 0?{value:void 0,done:!0}:{value:e,done:!1}}return i?{value:void 0,done:!0}:new Promise(e=>{n.push(t=>{e(t===null?{value:void 0,done:!0}:{value:t,done:!1})})})}}}},cancel:()=>{i||(i=!0,r.abort(),a())}}}function Yt(){return{start(){return Jt((e,t)=>{(async()=>{try{let n=await fetch(`/api/local-op/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({json:!0}),signal:t});if(!n.ok){let t=`Failed to start sign-in — try again`;try{let e=await n.json(),r=J.safeParse(e);r.success&&(t=r.data.title)}catch{}e({type:`error`,message:t});return}if(!n.body){e({type:`error`,message:`Failed to start sign-in — try again`});return}!await qt(n.body,t=>{let n;try{n=JSON.parse(t)}catch{return console.warn(`[auth-transport] Dropped unparseable NDJSON line:`,t.slice(0,100)),`continue`}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let t=n.problem;return e({type:`error`,message:t?.detail||t?.title||`Unknown error`}),`terminal`}let r=n;return e(r),r.type===`complete`||r.type===`error`?`terminal`:`continue`})&&!t.aborted&&e({type:`error`,message:`Sign-in stream ended without confirmation — please try again`})}catch(t){if(t instanceof Error&&t.name===`AbortError`)return;e({type:`error`,message:`Connection error — try again`})}})()})}}}function Xt(e){return{start(){return e.localOp.auth.start()}}}async function Zt(e){try{await navigator.clipboard.writeText(e)}catch{}}var Qt=120*1e3;function $t(e){let t=(0,Q.c)(25),{onSuccess:n,transport:r}=e,{_:i}=_(),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(`https://github.com/login/device`),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(Qt),h=(0,X.useRef)(null),v=(0,X.useRef)(null),b;t[0]!==i||t[1]!==n||t[2]!==r?(b=async function(){f(null);try{let e=r.start();h.current=e.cancel;let t=e.events[Symbol.asyncIterator](),a=!1,s=await t.next();for(;!s.done;){let e=s.value;if(e.type===`verification`)o(e.user_code),c(e.verification_uri),m(e.expires_in*1e3),Zt(e.user_code).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)});else if(e.type===`complete`){a=!0,n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){a=!0,f(e.message);break}s=await t.next()}a||f(i({id:`DskIkK`}))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&f(i({id:`Q5fqMz`}))}},t[0]=i,t[1]=n,t[2]=r,t[3]=b):b=t[3];let x=b,S;t[4]===x?S=t[5]:(S=()=>{let e=!1;return queueMicrotask(()=>{e||x()}),()=>{e=!0,h.current?.(),h.current=null,v.current&&clearInterval(v.current)}},t[4]=x,t[5]=S);let C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[6]=C):C=t[6],(0,X.useEffect)(S,C);let w,T;t[7]!==i||t[8]!==a?(w=()=>{if(!a)return;let e=Date.now();return v.current=setInterval(()=>{let t=Qt-(Date.now()-e);t<=0?(m(0),v.current&&clearInterval(v.current),f(i({id:`ve8vEM`}))):m(t)},1e3),()=>{v.current&&clearInterval(v.current)}},T=[a,i],t[7]=i,t[8]=a,t[9]=w,t[10]=T):(w=t[9],T=t[10]),(0,X.useEffect)(w,T);let E=Math.floor(p/6e4),D=Math.floor(p%6e4/1e3),O;t[11]===D?O=t[12]:(O=D.toString().padStart(2,`0`),t[11]=D,t[12]=O);let k=`${E}:${O}`,A;t[13]!==i||t[14]!==l||t[15]!==d||t[16]!==k||t[17]!==a||t[18]!==s?(A=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(g,{id:`eVPynQ`,values:{verificationUri:s},components:{0:(0,Z.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Be(e,s),onAuxClick:e=>Be(e,s),className:`inline-flex items-center gap-0.5 text-foreground hover:text-primary hover:underline`}),1:(0,Z.jsx)(`span`,{}),2:(0,Z.jsx)(le,{className:`inline size-3.5`,"aria-hidden":!0})}})}),(0,Z.jsxs)(y,{type:`button`,variant:`outline`,"aria-label":i({id:`nCzR-G`,values:{userCode:a}}),onClick:()=>void Zt(a).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)}),className:`relative h-auto w-full justify-center rounded-md bg-muted px-12 py-3 hover:bg-muted/80`,children:[(0,Z.jsx)(`code`,{className:`font-mono text-2xl font-bold tracking-widest`,children:a}),(0,Z.jsx)(`span`,{className:`absolute right-3 text-muted-foreground`,"aria-hidden":`true`,children:l?(0,Z.jsx)(ue,{className:`size-4`}):(0,Z.jsx)(be,{className:`size-4`})})]}),(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:l?(0,Z.jsx)(g,{id:`80c4-P`}):null}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),(0,Z.jsx)(g,{id:`5y_9lO`})]}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(g,{id:`gYz2ep`,values:{timeLabel:k}})})]})]}):(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:d?null:(0,Z.jsx)(g,{id:`aWlJai`})}),t[13]=i,t[14]=l,t[15]=d,t[16]=k,t[17]=a,t[18]=s,t[19]=A):A=t[19];let j;t[20]===d?j=t[21]:(j=d&&(0,Z.jsx)(`p`,{className:`text-1sm text-destructive`,children:d}),t[20]=d,t[21]=j);let M;return t[22]!==A||t[23]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[A,j]}),t[22]=A,t[23]=j,t[24]=M):M=t[24],M}function en(e){let t=(0,Q.c)(30),{login:n,name:r,onNameChange:i,email:a,onEmailChange:o}=e,{_:s}=_(),c;t[0]===n?c=t[1]:(c=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(g,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=c);let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(g,{id:`gp3I7-`})}),t[2]=l):l=t[2];let u;t[3]===s?u=t[4]:(u=s({id:`6YtxFj`}),t[3]=s,t[4]=u);let d;t[5]!==s||t[6]!==n?(d=s({id:`J2Mv98`,values:{login:n}}),t[5]=s,t[6]=n,t[7]=d):d=t[7];let f;t[8]===i?f=t[9]:(f=e=>i(e.target.value),t[8]=i,t[9]=f);let p;t[10]!==r||t[11]!==u||t[12]!==d||t[13]!==f?(p=(0,Z.jsx)(Ae,{"aria-label":u,placeholder:d,value:r,onChange:f}),t[10]=r,t[11]=u,t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;t[15]===s?m=t[16]:(m=s({id:`O3oNi5`}),t[15]=s,t[16]=m);let h;t[17]===s?h=t[18]:(h=s({id:`O3oNi5`}),t[17]=s,t[18]=h);let v;t[19]===o?v=t[20]:(v=e=>o(e.target.value),t[19]=o,t[20]=v);let y;t[21]!==a||t[22]!==m||t[23]!==h||t[24]!==v?(y=(0,Z.jsx)(Ae,{type:`email`,"aria-label":m,placeholder:h,value:a,onChange:v}),t[21]=a,t[22]=m,t[23]=h,t[24]=v,t[25]=y):y=t[25];let b;return t[26]!==c||t[27]!==y||t[28]!==p?(b=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[c,l,p,y]}),t[26]=c,t[27]=y,t[28]=p,t[29]=b):b=t[29],b}var tn=1e4;function nn(e){let t=(0,Q.c)(59),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:s,queryTransport:c}=e,{_:l}=_(),u;t[0]===s?u=t[1]:(u=s??Yt(),t[0]=s,t[1]=u);let d=u,f;t[2]===c?f=t[3]:(f=c??Gt(),t[2]=c,t[3]=f);let p=f,[m,h]=(0,X.useState)(`auth`),[v,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(``),T,E;t[4]!==a||t[5]!==n?(T=()=>{n&&(b(null),S(``),w(``),h(a?`checking`:`auth`))},E=[n,a],t[4]=a,t[5]=n,t[6]=T,t[7]=E):(T=t[6],E=t[7]),(0,X.useLayoutEffect)(T,E);let N;t[8]!==a||t[9]!==n||t[10]!==p?(N=()=>{if(!n||!a)return;let e=!1,t=t=>{e||(e=!0,h(t))},r=setTimeout(()=>t(`auth`),tn);return p.status().then(n=>{e||(n.authenticated?(b({login:n.login,name:n.name,email:n.email}),S(n.name??``),w(n.email??``),t(`identity`)):t(`auth`))}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[8]=a,t[9]=n,t[10]=p,t[11]=N):N=t[11];let P;t[12]!==a||t[13]!==n?(P=[n,a],t[12]=a,t[13]=n,t[14]=P):P=t[14],(0,X.useEffect)(N,P);let F;t[15]!==l||t[16]!==a||t[17]!==r||t[18]!==i?(F=function(e){if(b(e),a)S(e.name??``),w(e.email??``),h(`identity`);else{h(`done`),i?.(e),r(!1);let t=e.login;ke.success(l({id:`E_tNGD`,values:{login:t}}))}},t[15]=l,t[16]=a,t[17]=r,t[18]=i,t[19]=F):F=t[19];let I=F,L;t[20]!==l||t[21]!==v||t[22]!==r||t[23]!==i?(L=function(e,t){fetch(`/api/local-op/auth/set-identity`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,email:t})}).catch(rn);let n={...v??{login:``},name:e,email:t};h(`done`),i?.(n),r(!1);let a=n.login;ke.success(l({id:`E_tNGD`,values:{login:a}}))},t[20]=l,t[21]=v,t[22]=r,t[23]=i,t[24]=L):L=t[24];let R=L,z;t[25]!==l||t[26]!==v||t[27]!==r||t[28]!==i?(z=function(){if(!v)return;h(`done`),i?.(v),r(!1);let e=v.login;ke.success(l({id:`E_tNGD`,values:{login:e}}))},t[25]=l,t[26]=v,t[27]=r,t[28]=i,t[29]=z):z=t[29];let B=z,V;t[30]===r?V=t[31]:(V=function(){r(!1)},t[30]=r,t[31]=V);let H=V,U;t[32]!==a||t[33]!==o||t[34]!==m?(U=(0,Z.jsx)(j,{children:(0,Z.jsx)(D,{children:o?(0,Z.jsx)(g,{id:`X8kjQX`}):a&&m!==`auth`?(0,Z.jsx)(g,{id:`29XZXN`}):(0,Z.jsx)(g,{id:`3jod3l`})})}),t[32]=a,t[33]=o,t[34]=m,t[35]=U):U=t[35];let W;t[36]===m?W=t[37]:(W=m===`checking`&&(0,Z.jsx)(k,{children:(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(g,{id:`gBbxn_`})})}),t[36]=m,t[37]=W);let G;t[38]!==I||t[39]!==H||t[40]!==d||t[41]!==m?(G=m===`auth`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(k,{children:(0,Z.jsx)($t,{onSuccess:I,transport:d})}),(0,Z.jsx)(A,{children:(0,Z.jsx)(y,{variant:`outline`,className:`font-mono uppercase`,onClick:H,children:(0,Z.jsx)(g,{id:`dEgA5A`})})})]}),t[38]=I,t[39]=H,t[40]=d,t[41]=m,t[42]=G):G=t[42];let K;t[43]!==v||t[44]!==R||t[45]!==B||t[46]!==C||t[47]!==x||t[48]!==m?(K=m===`identity`&&v&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(k,{children:(0,Z.jsx)(en,{login:v.login,name:x,onNameChange:S,email:C,onEmailChange:w})}),(0,Z.jsxs)(A,{children:[(0,Z.jsx)(y,{variant:`ghost`,onClick:B,children:(0,Z.jsx)(g,{id:`6Uau97`})}),(0,Z.jsx)(y,{onClick:()=>R(x.trim(),C.trim()),disabled:!x.trim()||!C.trim(),children:(0,Z.jsx)(g,{id:`tfDRzk`})})]})]}),t[43]=v,t[44]=R,t[45]=B,t[46]=C,t[47]=x,t[48]=m,t[49]=K):K=t[49];let q;t[50]!==U||t[51]!==W||t[52]!==G||t[53]!==K?(q=(0,Z.jsxs)(O,{className:`sm:max-w-md`,children:[U,W,G,K]}),t[50]=U,t[51]=W,t[52]=G,t[53]=K,t[54]=q):q=t[54];let J;return t[55]!==r||t[56]!==n||t[57]!==q?(J=(0,Z.jsx)(M,{open:n,onOpenChange:r,children:q}),t[55]=r,t[56]=n,t[57]=q,t[58]=J):J=t[58],J}function rn(){}function an(e){let t=(0,Q.c)(16),{value:n,onChange:r,disabled:i,placeholder:a,rows:o}=e,s=i===void 0?!1:i,c=o===void 0?12:o,l=(0,X.useId)(),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(g,{id:`3o3tur`}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=(0,Z.jsx)(Et,{htmlFor:l,children:u}),t[1]=l,t[2]=d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Ot,{children:(0,Z.jsx)(g,{id:`5gr_ev`,values:{dateToken:`{{date}}`,userToken:`{{user}}`},components:{0:(0,Z.jsx)(`code`,{className:`font-mono`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}})}),t[3]=f):f=t[3];let p;t[4]===r?p=t[5]:(p=e=>r(e.target.value),t[4]=r,t[5]=p);let m;t[6]!==s||t[7]!==l||t[8]!==a||t[9]!==c||t[10]!==p||t[11]!==n?(m=(0,Z.jsx)(Ue,{id:l,value:n,onChange:p,disabled:s,rows:c,spellCheck:!1,placeholder:a,className:`font-mono text-xs leading-relaxed min-h-72`}),t[6]=s,t[7]=l,t[8]=a,t[9]=c,t[10]=p,t[11]=n,t[12]=m):m=t[12];let h;return t[13]!==d||t[14]!==m?(h=(0,Z.jsxs)(wt,{children:[d,f,m]}),t[13]=d,t[14]=m,t[15]=h):h=t[15],h}var on=/^[A-Za-z0-9_-]+$/;function sn(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function cn(e){let t={},n=e.title.trim();n&&(t.title=n);let r=e.description.trim();return r&&(t.description=r),t}var ln=0;function un(){return ln+=1,`prop-${ln}`}function dn(e){let{frontmatter:t,body:n}=G(e);if(t===``)return{type:``,properties:[],markdown:e};let r=[];for(let e of K(t).split(`
|
|
4
|
-
`)){if(e.trim()===``)continue;let t=e.indexOf(`:`);if((/^\s/.test(e)||t===-1)&&r.length>0){let t=r[r.length-1];t&&(t.value+=`\n${e}`);continue}t!==-1&&r.push({key:e.slice(0,t).trim(),value:e.slice(t+1).replace(/^ /,``)})}let i=``,a=[];for(let e of r){if(e.key===`type`&&i===``){i=e.value.trim();continue}a.push({id:un(),key:e.key,value:e.value})}return{type:i,properties:a,markdown:n}}function fn(e){let t=[],n=e.type.trim();n&&t.push(`type: ${n}`);for(let n of e.properties){let e=n.key.trim();e===``||e===`type`||t.push(n.value===``?`${e}:`:`${e}: ${n.value}`)}if(t.length===0)return e.markdown.replace(/^\n+/,``);let r=e.markdown.startsWith(`
|
|
5
|
-
`)?e.markdown:`\n${e.markdown}`;return`---\n${t.join(`
|
|
6
|
-
`)}\n---\n${r}`}function pn(e){let t=(0,Q.c)(54),{mode:n,folderPath:r,scope:i,initial:a,existingNames:o,onCommitted:s}=e,c=i===void 0?`local`:i,[l,u]=(0,X.useState)(a.title),[d,f]=(0,X.useState)(a.name),[p,m]=(0,X.useState)(a.description),h;t[0]===a.body?h=t[1]:(h=()=>dn(a.body),t[0]=a.body,t[1]=h);let g=(0,X.useState)(h)[0],[_,v]=(0,X.useState)(g.type),[y,b]=(0,X.useState)(g.properties),[x,S]=(0,X.useState)(g.markdown),[C,w]=(0,X.useState)(!1),[T,E]=(0,X.useState)(!1),[D,O]=(0,X.useState)(!1),k;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(e,t){b(n=>n.map(n=>n.id===e?{...n,...t}:n))},t[2]=k):k=t[2];let A=k,j;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){b(mn)},t[3]=j):j=t[3];let M=j,N;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e){b(t=>t.filter(t=>t.id!==e))},t[4]=N):N=t[4];let P=N,F;t[5]!==n||t[6]!==T?(F=function(e){u(e),n===`create`&&!T&&f(sn(e))},t[5]=n,t[6]=T,t[7]=F):F=t[7];let I=F,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(L=function(e){f(e),E(!0)},t[8]=L):L=t[8];let R=L,z=n===`edit`&&c===`local`,B=n===`create`||z,V;t[9]===l?V=t[10]:(V=l.trim(),t[9]=l,t[10]=V);let H=V,U,W,G,K;t[11]!==o||t[12]!==n||t[13]!==d||t[14]!==B||t[15]!==H?(K=d.trim(),G=H===``,U=B&&(K===``||!on.test(K)),W=n===`create`&&!U&&(o?.has(K)??!1),t[11]=o,t[12]=n,t[13]=d,t[14]=B,t[15]=H,t[16]=U,t[17]=W,t[18]=G,t[19]=K):(U=t[16],W=t[17],G=t[18],K=t[19]);let q=W,J=!C&&!G&&!U,ee;t[20]!==x||t[21]!==z||t[22]!==J||t[23]!==p||t[24]!==r||t[25]!==a.name||t[26]!==n||t[27]!==s||t[28]!==y||t[29]!==l||t[30]!==K||t[31]!==H||t[32]!==_?(ee=async function(){if(!J){O(!0);return}w(!0);let e=cn({title:l,description:p}),t=fn({type:_,properties:y,markdown:x}),i=z&&K!==a.name,o=i?await xe({fromFolder:r,fromName:a.name,toFolder:r,toName:K,frontmatter:e,body:t}):await Ce({folder:r,name:n===`create`?K:a.name,frontmatter:e,body:t});if(w(!1),!o.ok){let{error:e}=o;ke.error(n===`create`?Y._({id:`jdGUeI`,values:{error:e}}):Y._({id:`rQAQus`,values:{error:e}}));return}i?ke.success(Y._({id:`YKLP_-`})):`warnings`in o&&o.warnings.length>0?ke.warning(o.warnings.join(` `)):n===`create`?ke.success(Y._({id:`06SZfb`,values:{trimmedTitle:H}})):ke.success(Y._({id:`GamjcN`})),s(n===`create`||i?K:a.name)},t[20]=x,t[21]=z,t[22]=J,t[23]=p,t[24]=r,t[25]=a.name,t[26]=n,t[27]=s,t[28]=y,t[29]=l,t[30]=K,t[31]=H,t[32]=_,t[33]=ee):ee=t[33];let te=ee,ne;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ne=()=>O(!0),t[34]=ne):ne=t[34];let re;return t[35]!==x||t[36]!==z||t[37]!==J||t[38]!==p||t[39]!==a.name||t[40]!==n||t[41]!==y||t[42]!==C||t[43]!==I||t[44]!==d||t[45]!==U||t[46]!==q||t[47]!==te||t[48]!==l||t[49]!==G||t[50]!==D||t[51]!==K||t[52]!==_?(re={mode:n,title:l,slug:d,description:p,type:_,properties:y,body:x,setTitle:I,setSlug:R,setDescription:m,setType:v,setProperty:A,addProperty:M,removeProperty:P,setBody:S,markTitleTouched:ne,titleTouched:D,isSaving:C,canSubmit:J,titleInvalid:G,slugInvalid:U,slugShadows:q,trimmedSlug:K,fixedName:a.name,canRename:z,submit:te},t[35]=x,t[36]=z,t[37]=J,t[38]=p,t[39]=a.name,t[40]=n,t[41]=y,t[42]=C,t[43]=I,t[44]=d,t[45]=U,t[46]=q,t[47]=te,t[48]=l,t[49]=G,t[50]=D,t[51]=K,t[52]=_,t[53]=re):re=t[53],re}function mn(e){return[...e,{id:un(),key:``,value:``}]}function hn(e){let t=(0,Q.c)(72),{form:n,bodyPlaceholder:r}=e,{_:i}=_(),a=(0,X.useId)(),o=(0,X.useId)(),s=(0,X.useId)(),c=n.titleTouched&&n.titleInvalid,{fixedName:l}=n,u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(g,{id:`MHrjPM`}),d=(0,Z.jsx)(`span`,{className:`text-destructive`,children:`*`}),t[0]=u,t[1]=d):(u=t[0],d=t[1]);let f;t[2]===a?f=t[3]:(f=(0,Z.jsxs)(Et,{htmlFor:a,children:[u,d]}),t[2]=a,t[3]=f);let p=n.title,m;t[4]===n?m=t[5]:(m=e=>n.setTitle(e.target.value),t[4]=n,t[5]=m);let h=n.markTitleTouched,v;t[6]===i?v=t[7]:(v=i({id:`KWL_Ih`}),t[6]=i,t[7]=v);let y;t[8]!==n.isSaving||t[9]!==n.markTitleTouched||t[10]!==n.title||t[11]!==a||t[12]!==c||t[13]!==m||t[14]!==v?(y=(0,Z.jsx)(Ae,{id:a,"data-testid":`template-name-input`,value:p,onChange:m,onBlur:h,placeholder:v,disabled:n.isSaving,"aria-invalid":c}),t[8]=n.isSaving,t[9]=n.markTitleTouched,t[10]=n.title,t[11]=a,t[12]=c,t[13]=m,t[14]=v,t[15]=y):y=t[15];let b;t[16]===c?b=t[17]:(b=c?(0,Z.jsx)(kt,{children:(0,Z.jsx)(g,{id:`V_wltx`})}):null,t[16]=c,t[17]=b);let x;t[18]!==f||t[19]!==y||t[20]!==b?(x=(0,Z.jsxs)(wt,{children:[f,y,b]}),t[18]=f,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]!==l||t[23]!==n?(S=n.mode===`create`?(0,Z.jsx)(_n,{form:n}):n.canRename?(0,Z.jsx)(vn,{form:n}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(g,{id:`NjrIak`,values:{fixedName:l},components:{0:(0,Z.jsx)(`code`,{className:`font-mono`})}})}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(g,{id:`jSO1X5`})})]}),t[22]=l,t[23]=n,t[24]=S):S=t[24];let C;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(g,{id:`Nu4oKW`}),t[25]=C):C=t[25];let w;t[26]===o?w=t[27]:(w=(0,Z.jsx)(Et,{htmlFor:o,children:C}),t[26]=o,t[27]=w);let T=n.description,E;t[28]===n?E=t[29]:(E=e=>n.setDescription(e.target.value),t[28]=n,t[29]=E);let D;t[30]===i?D=t[31]:(D=i({id:`3FMvls`}),t[30]=i,t[31]=D);let O;t[32]!==o||t[33]!==n.description||t[34]!==n.isSaving||t[35]!==E||t[36]!==D?(O=(0,Z.jsx)(Ue,{id:o,value:T,onChange:E,placeholder:D,disabled:n.isSaving,rows:2}),t[32]=o,t[33]=n.description,t[34]=n.isSaving,t[35]=E,t[36]=D,t[37]=O):O=t[37];let k;t[38]!==w||t[39]!==O?(k=(0,Z.jsxs)(wt,{children:[w,O]}),t[38]=w,t[39]=O,t[40]=k):k=t[40];let A;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(g,{id:`-zy2Nq`}),t[41]=A):A=t[41];let j;t[42]===s?j=t[43]:(j=(0,Z.jsx)(Et,{htmlFor:s,children:A}),t[42]=s,t[43]=j);let M=n.type,N;t[44]===n?N=t[45]:(N=e=>n.setType(e.target.value),t[44]=n,t[45]=N);let P;t[46]===i?P=t[47]:(P=i({id:`o9CrsQ`}),t[46]=i,t[47]=P);let F;t[48]!==n.isSaving||t[49]!==n.type||t[50]!==N||t[51]!==P||t[52]!==s?(F=(0,Z.jsx)(Ae,{id:s,value:M,onChange:N,placeholder:P,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`font-mono`}),t[48]=n.isSaving,t[49]=n.type,t[50]=N,t[51]=P,t[52]=s,t[53]=F):F=t[53];let I;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Ot,{children:(0,Z.jsx)(g,{id:`ipn17C`,components:{0:(0,Z.jsx)(`code`,{className:`font-mono`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}})}),t[54]=I):I=t[54];let L;t[55]!==j||t[56]!==F?(L=(0,Z.jsxs)(wt,{children:[j,F,I]}),t[55]=j,t[56]=F,t[57]=L):L=t[57];let R;t[58]===n?R=t[59]:(R=(0,Z.jsx)(gn,{form:n}),t[58]=n,t[59]=R);let z;t[60]!==r||t[61]!==n.body||t[62]!==n.isSaving||t[63]!==n.setBody?(z=(0,Z.jsx)(an,{value:n.body,onChange:n.setBody,disabled:n.isSaving,placeholder:r}),t[60]=r,t[61]=n.body,t[62]=n.isSaving,t[63]=n.setBody,t[64]=z):z=t[64];let B;return t[65]!==x||t[66]!==S||t[67]!==k||t[68]!==L||t[69]!==R||t[70]!==z?(B=(0,Z.jsxs)(St,{children:[x,S,k,L,R,z]}),t[65]=x,t[66]=S,t[67]=k,t[68]=L,t[69]=R,t[70]=z,t[71]=B):B=t[71],B}function gn(e){let t=(0,Q.c)(12),{form:n}=e,{_:r}=_(),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Et,{children:(0,Z.jsx)(g,{id:`-WFFG2`})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Ot,{children:(0,Z.jsx)(g,{id:`zrP8HX`,components:{0:(0,Z.jsx)(`code`,{className:`font-mono`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}})}),t[1]=a):a=t[1];let o;t[2]!==r||t[3]!==n?(o=n.properties.length>0?(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.properties.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ae,{"aria-label":r({id:`56xUL1`}),value:e.key,onChange:t=>n.setProperty(e.id,{key:t.target.value}),placeholder:r({id:`Aq-O0x`}),disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`font-mono w-1/3`}),(0,Z.jsx)(Ae,{"aria-label":r({id:`iKZkk1`}),value:e.value,onChange:t=>n.setProperty(e.id,{value:t.target.value}),placeholder:r({id:`jEZ6Lf`}),disabled:n.isSaving,spellCheck:!1,className:`font-mono flex-1`}),(0,Z.jsx)(y,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":r({id:`rNifQd`}),onClick:()=>n.removeProperty(e.id),disabled:n.isSaving,children:(0,Z.jsx)(Oe,{"aria-hidden":`true`})})]},e.id))}):null,t[2]=r,t[3]=n,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(g,{id:`F-NRCj`}),t[5]=s):s=t[5];let c;t[6]!==n.addProperty||t[7]!==n.isSaving?(c=(0,Z.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,onClick:n.addProperty,disabled:n.isSaving,children:s}),t[6]=n.addProperty,t[7]=n.isSaving,t[8]=c):c=t[8];let l;return t[9]!==o||t[10]!==c?(l=(0,Z.jsxs)(wt,{children:[i,a,o,c]}),t[9]=o,t[10]=c,t[11]=l):l=t[11],l}function _n(e){let t=(0,Q.c)(34),{form:n}=e,{_:r}=_(),i=(0,X.useId)(),[a,o]=(0,X.useState)(!1),s=a||n.titleTouched&&(n.slugInvalid||n.slugShadows),{slug:c,trimmedSlug:l}=n;if(!s){if(l===``)return null;let e;t[0]===c?e=t[1]:(e={slug:c},t[0]=c,t[1]=e);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`code`,{className:`font-mono`})},t[2]=r):r=t[2];let i;t[3]===e?i=t[4]:(i=(0,Z.jsx)(g,{id:`Pgu10b`,values:e,components:r}),t[3]=e,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>o(!0),t[5]=a):a=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(g,{id:`ePK91l`}),t[6]=s):s=t[6];let u;t[7]===n.isSaving?u=t[8]:(u=(0,Z.jsx)(y,{type:`button`,variant:`link`,className:`h-auto p-0 align-baseline text-xs font-mono uppercase`,onClick:a,disabled:n.isSaving,children:s}),t[7]=n.isSaving,t[8]=u);let d;return t[9]!==i||t[10]!==u?(d=(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[i,` `,u]}),t[9]=i,t[10]=u,t[11]=d):d=t[11],d}let u;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(g,{id:`GN6L5F`}),t[12]=u):u=t[12];let d;t[13]===i?d=t[14]:(d=(0,Z.jsx)(Et,{htmlFor:i,children:u}),t[13]=i,t[14]=d);let f;t[15]===n?f=t[16]:(f=e=>n.setSlug(e.target.value),t[15]=n,t[16]=f);let p;t[17]===r?p=t[18]:(p=r({id:`tjXez2`}),t[17]=r,t[18]=p);let m;t[19]!==n.isSaving||t[20]!==n.slugInvalid||t[21]!==c||t[22]!==i||t[23]!==f||t[24]!==p?(m=(0,Z.jsx)(Ae,{id:i,value:c,onChange:f,placeholder:p,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":n.slugInvalid,className:`font-mono`}),t[19]=n.isSaving,t[20]=n.slugInvalid,t[21]=c,t[22]=i,t[23]=f,t[24]=p,t[25]=m):m=t[25];let h;t[26]!==n.slugInvalid||t[27]!==n.slugShadows||t[28]!==l?(h=n.slugInvalid?(0,Z.jsx)(kt,{children:(0,Z.jsx)(g,{id:`l_FAT6`,components:{0:(0,Z.jsx)(`code`,{className:`font-mono`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}})}):n.slugShadows?(0,Z.jsx)(Ot,{className:`text-yellow-600 dark:text-yellow-500`,children:(0,Z.jsx)(g,{id:`jwnpdM`,values:{trimmedSlug:l},components:{0:(0,Z.jsx)(`code`,{className:`font-mono`})}})}):(0,Z.jsx)(Ot,{children:(0,Z.jsx)(g,{id:`TsZmgr`})}),t[26]=n.slugInvalid,t[27]=n.slugShadows,t[28]=l,t[29]=h):h=t[29];let v;return t[30]!==d||t[31]!==m||t[32]!==h?(v=(0,Z.jsxs)(wt,{children:[d,m,h]}),t[30]=d,t[31]=m,t[32]=h,t[33]=v):v=t[33],v}function vn(e){let t=(0,Q.c)(20),{form:n}=e,{_:r}=_(),i=(0,X.useId)(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(g,{id:`GN6L5F`}),t[0]=a):a=t[0];let o;t[1]===i?o=t[2]:(o=(0,Z.jsx)(Et,{htmlFor:i,children:a}),t[1]=i,t[2]=o);let s=n.slug,c;t[3]===n?c=t[4]:(c=e=>n.setSlug(e.target.value),t[3]=n,t[4]=c);let l;t[5]===r?l=t[6]:(l=r({id:`tjXez2`}),t[5]=r,t[6]=l);let u;t[7]!==n.isSaving||t[8]!==n.slug||t[9]!==n.slugInvalid||t[10]!==i||t[11]!==c||t[12]!==l?(u=(0,Z.jsx)(Ae,{id:i,value:s,onChange:c,placeholder:l,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":n.slugInvalid,className:`font-mono`}),t[7]=n.isSaving,t[8]=n.slug,t[9]=n.slugInvalid,t[10]=i,t[11]=c,t[12]=l,t[13]=u):u=t[13];let d;t[14]===n.slugInvalid?d=t[15]:(d=n.slugInvalid?(0,Z.jsx)(kt,{children:(0,Z.jsx)(g,{id:`l_FAT6`,components:{0:(0,Z.jsx)(`code`,{className:`font-mono`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}})}):(0,Z.jsx)(Ot,{children:(0,Z.jsx)(g,{id:`FvMSms`})}),t[14]=n.slugInvalid,t[15]=d);let f;return t[16]!==o||t[17]!==u||t[18]!==d?(f=(0,Z.jsxs)(wt,{children:[o,u,d]}),t[16]=o,t[17]=u,t[18]=d,t[19]=f):f=t[19],f}var yn={name:``,title:``,description:``,body:``},bn=`## Overview
|
|
7
|
-
|
|
8
|
-
(Replace with the starting content for new documents.)
|
|
9
|
-
`;function xn(e){let t=(0,Q.c)(12),{folderPath:n,existingNames:r,open:i,onOpenChange:a,onCreated:o}=e,s;t[0]!==r||t[1]!==n||t[2]!==o||t[3]!==a||t[4]!==i?(s=i?(0,Z.jsx)(Sn,{folderPath:n,existingNames:r,onOpenChange:a,onCreated:o}):null,t[0]=r,t[1]=n,t[2]=o,t[3]=a,t[4]=i,t[5]=s):s=t[5];let c;t[6]===s?c=t[7]:(c=(0,Z.jsx)(O,{className:`sm:max-w-3xl max-h-[85vh] flex flex-col`,children:s}),t[6]=s,t[7]=c);let l;return t[8]!==a||t[9]!==i||t[10]!==c?(l=(0,Z.jsx)(M,{open:i,onOpenChange:a,children:c}),t[8]=a,t[9]=i,t[10]=c,t[11]=l):l=t[11],l}function Sn(e){let t=(0,Q.c)(31),{folderPath:n,existingNames:r,onOpenChange:i,onCreated:a}=e,o;t[0]!==a||t[1]!==i?(o=e=>{a(e),i(!1)},t[0]=a,t[1]=i,t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==n||t[5]!==o?(s={mode:`create`,folderPath:n,initial:yn,existingNames:r,onCommitted:o},t[3]=r,t[4]=n,t[5]=o,t[6]=s):s=t[6];let c=pn(s),l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(D,{children:(0,Z.jsx)(g,{id:`G1Gw0v`})}),t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsxs)(j,{children:[l,(0,Z.jsx)(E,{children:(0,Z.jsx)(g,{id:`NUr4kz`})})]}),t[8]=u):u=t[8];let d;t[9]===c?d=t[10]:(d=(0,Z.jsx)(k,{children:(0,Z.jsx)(hn,{form:c,bodyPlaceholder:bn})}),t[9]=c,t[10]=d);let f;t[11]===i?f=t[12]:(f=()=>i(!1),t[11]=i,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(g,{id:`dEgA5A`}),t[13]=p):p=t[13];let m;t[14]!==c.isSaving||t[15]!==f?(m=(0,Z.jsx)(y,{variant:`outline`,className:`font-mono uppercase`,onMouseDown:Cn,onClick:f,disabled:c.isSaving,children:p}),t[14]=c.isSaving,t[15]=f,t[16]=m):m=t[16];let h;t[17]===c?h=t[18]:(h=()=>void c.submit(),t[17]=c,t[18]=h);let _;t[19]===c.isSaving?_=t[20]:(_=c.isSaving?(0,Z.jsx)(g,{id:`E9bKSA`}):(0,Z.jsx)(g,{id:`A5hiCy`}),t[19]=c.isSaving,t[20]=_);let v;t[21]!==c.isSaving||t[22]!==_||t[23]!==h?(v=(0,Z.jsx)(y,{onClick:h,disabled:c.isSaving,children:_}),t[21]=c.isSaving,t[22]=_,t[23]=h,t[24]=v):v=t[24];let b;t[25]!==v||t[26]!==m?(b=(0,Z.jsxs)(A,{children:[m,v]}),t[25]=v,t[26]=m,t[27]=b):b=t[27];let x;return t[28]!==b||t[29]!==d?(x=(0,Z.jsxs)(Z.Fragment,{children:[u,d,b]}),t[28]=b,t[29]=d,t[30]=x):x=t[30],x}function Cn(e){return e.preventDefault()}function wn(e){let t=(0,Q.c)(16),{template:n,onOpenChange:r,onDeleted:i}=e,{_:a}=_(),[o,s]=(0,X.useState)(!1),c;t[0]!==a||t[1]!==i||t[2]!==r?(c=async function(e){s(!0);let t=await Se(e.source_folder,e.name);if(s(!1),!t.ok){let{error:e}=t;ke.error(a({id:`36WXSC`,values:{error:e}}));return}let n=e.title??e.name;ke.success(a({id:`ErRi6L`,values:{label:n}})),i(),r(!1)},t[0]=a,t[1]=i,t[2]=r,t[3]=c):c=t[3];let l=c,u=n!==null,d;t[4]!==o||t[5]!==r?(d=e=>{!e&&!o&&r(!1)},t[4]=o,t[5]=r,t[6]=d):d=t[6];let f;t[7]!==a||t[8]!==o||t[9]!==l||t[10]!==n?(f=n?(()=>{let{name:e,path:t,scope:r}=n,i=r===`inherited`?`\n\n${a({id:`8uAWix`})}`:``;return(0,Z.jsx)(me,{itemName:a({id:`XfzqjK`,values:{name:e}}),isSubmitting:o,onDelete:()=>l(n),customDescription:`${a({id:`5LXwX8`,values:{path:t}})}${i}`})})():null,t[7]=a,t[8]=o,t[9]=l,t[10]=n,t[11]=f):f=t[11];let p;return t[12]!==u||t[13]!==d||t[14]!==f?(p=(0,Z.jsx)(M,{open:u,onOpenChange:d,children:f}),t[12]=u,t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function Tn(e){let t=(0,Q.c)(45),{template:n,onEdit:r,onDelete:i,onCreate:a,badge:o}=e,{_:s}=_(),c=n.title??n.name,l=!!(n.title&&n.title!==n.name),u;t[0]===c?u=t[1]:(u=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:c}),t[0]=c,t[1]=u);let d;t[2]!==l||t[3]!==n.name?(d=l?(0,Z.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:n.name}):null,t[2]=l,t[3]=n.name,t[4]=d):d=t[4];let f;t[5]===o?f=t[6]:(f=o?(0,Z.jsx)(`span`,{className:`ml-auto shrink-0`,children:o}):null,t[5]=o,t[6]=f);let p;t[7]!==u||t[8]!==d||t[9]!==f?(p=(0,Z.jsxs)(`span`,{className:`flex w-full items-center gap-2`,children:[u,d,f]}),t[7]=u,t[8]=d,t[9]=f,t[10]=p):p=t[10];let m;t[11]===n.description?m=t[12]:(m=n.description?(0,Z.jsx)(`span`,{className:`w-full truncate text-sm text-muted-foreground`,children:n.description}):null,t[11]=n.description,t[12]=m);let h;t[13]!==r||t[14]!==p||t[15]!==m?(h=(0,Z.jsxs)(y,{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:[p,m]}),t[13]=r,t[14]=p,t[15]=m,t[16]=h):h=t[16];let v;t[17]!==s||t[18]!==c||t[19]!==a?(v=a?(0,Z.jsxs)(y,{type:`button`,variant:`ghost`,size:`sm`,className:`shrink-0 font-mono uppercase opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:a,"aria-label":s({id:`mZ1r4i`,values:{label:c}}),children:[(0,Z.jsx)(et,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(g,{id:`hYgDIe`})]}):null,t[17]=s,t[18]=c,t[19]=a,t[20]=v):v=t[20];let b;t[21]!==s||t[22]!==c?(b=s({id:`Bx4EXG`,values:{label:c}}),t[21]=s,t[22]=c,t[23]=b):b=t[23];let x;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)($e,{className:`size-4`,"aria-hidden":!0}),t[24]=x):x=t[24];let S;t[25]===b?S=t[26]:(S=(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsx)(y,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,"aria-label":b,children:x})}),t[25]=b,t[26]=S);let C,w;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(ye,{"aria-hidden":!0}),w=(0,Z.jsx)(g,{id:`ePK91l`}),t[27]=C,t[28]=w):(C=t[27],w=t[28]);let T;t[29]===r?T=t[30]:(T=(0,Z.jsxs)(F,{onSelect:r,children:[C,w]}),t[29]=r,t[30]=T);let E,D;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(Ee,{"aria-hidden":!0}),D=(0,Z.jsx)(g,{id:`cnGeoo`}),t[31]=E,t[32]=D):(E=t[31],D=t[32]);let O;t[33]===i?O=t[34]:(O=(0,Z.jsxs)(F,{variant:`destructive`,onSelect:i,children:[E,D]}),t[33]=i,t[34]=O);let k;t[35]!==T||t[36]!==O?(k=(0,Z.jsxs)(I,{align:`end`,className:`min-w-52`,children:[T,O]}),t[35]=T,t[36]=O,t[37]=k):k=t[37];let A;t[38]!==S||t[39]!==k?(A=(0,Z.jsxs)(R,{children:[S,k]}),t[38]=S,t[39]=k,t[40]=A):A=t[40];let j;return t[41]!==A||t[42]!==h||t[43]!==v?(j=(0,Z.jsxs)(`li`,{className:`group flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-muted/50`,children:[h,v,A]}),t[41]=A,t[42]=h,t[43]=v,t[44]=j):j=t[44],j}var En=`claude-cowork`,Dn=`ok:skill:cowork:installed:v`,On=250,kn=`/api/skill/install-state`,An=null,jn=new Set,Mn=null,Nn=!1,Pn=()=>{Kn(er())},Fn=e=>{e.key?.startsWith(Dn)&&Kn(er())};function In(){Nn||typeof window>`u`||(window.addEventListener(`focus`,Pn),window.addEventListener(`storage`,Fn),Nn=!0)}function Ln(){Nn&&(typeof window>`u`||(window.removeEventListener(`focus`,Pn),window.removeEventListener(`storage`,Fn),Nn=!1))}var Rn=!1,zn=!1,Bn=!1,Vn=!1,Hn=!1,Un=!1,Wn=!1;async function Gn(e){let t=!0;if(e.detectClaudeDesktop)try{t=await e.detectClaudeDesktop()}catch(e){t=!0,Rn||(Rn=!0,console.warn(`[claude-desktop-integration] detectClaudeDesktop IPC rejected — falling back to desktopPresent=true`,e))}let n=await e.fetchSnapshot();if(n){let e=n.targets?.[En]??null;return e?.version?{desktopPresent:t,skillInstalled:!0,skillVersion:e.version}:{desktopPresent:t,skillInstalled:!1,skillVersion:null}}let r=e.readLocalStorageGuard();return{desktopPresent:t,skillInstalled:r.skillInstalled,skillVersion:r.skillVersion}}async function Kn(e){return Mn||(Mn=(async()=>{try{An=await Gn(e);for(let e of jn)try{e()}catch(e){console.error(`[claude-desktop-integration] subscriber threw`,e)}}catch(e){console.error(`[claude-desktop-integration] probe rejected unexpectedly`,e)}finally{Mn=null}})(),Mn)}function qn(e){return jn.size===0&&In(),jn.add(e),()=>{jn.delete(e),jn.size===0&&Ln()}}function Jn(){return An}function Yn(){if(typeof window>`u`)return;let e=window.okDesktop?.skill,t=e?.detectClaudeDesktop;if(t)return()=>t.call(e)}function Xn(e){let t=e?.timeoutMs??On,n=e?.fetchImpl??(typeof fetch<`u`?fetch:void 0);return async()=>{if(!n)return null;let e;try{let r=new AbortController,i=setTimeout(()=>r.abort(),t);try{e=await n(kn,{method:`GET`,cache:`no-store`,signal:r.signal})}finally{clearTimeout(i)}}catch(e){let n=e instanceof DOMException&&e.name===`AbortError`;return n&&!Bn?(Bn=!0,console.warn(`[claude-desktop-integration] fetch ${kn} timed out (>${t}ms) — falling back to localStorage guard`)):!n&&!zn&&(zn=!0,console.warn(`[claude-desktop-integration] fetch ${kn} failed — falling back to localStorage guard`,e)),null}if(!e.ok)return Vn||(Vn=!0,console.warn(`[claude-desktop-integration] ${kn} returned ${e.status} ${e.statusText} — falling back to localStorage guard`)),null;let r;try{r=await e.json()}catch(e){return Hn||(Hn=!0,console.warn(`[claude-desktop-integration] ${kn} returned unparseable JSON — falling back to localStorage guard`,e)),null}return Zn(r)}}function Zn(e){if(typeof e!=`object`||!e)return Qn(`not an object`);let t=e;if(typeof t.currentVersion!=`string`||t.currentVersion===``)return Qn(`currentVersion not a non-empty string`);if(t.targets!==void 0){if(t.targets===null||typeof t.targets!=`object`)return Qn(`targets not object`);for(let[,e]of Object.entries(t.targets)){if(e==null)continue;if(typeof e!=`object`)return Qn(`target entry not object`);let t=e;if(typeof t.version!=`string`||t.version===``)return Qn(`target.version not a non-empty string`)}}return t}function Qn(e){return Un||(Un=!0,console.warn(`[claude-desktop-integration] ${kn} response failed shape validation (${e}) — falling back to localStorage guard`)),null}function $n(){if(typeof localStorage>`u`)return{skillInstalled:!1,skillVersion:null};try{for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);if(t?.startsWith(Dn))return{skillInstalled:!0,skillVersion:t.slice(27)}}}catch(e){Wn||(Wn=!0,console.warn(`[claude-desktop-integration] localStorage scan threw — falling back to skillInstalled=false`,e))}return{skillInstalled:!1,skillVersion:null}}function er(){return{detectClaudeDesktop:Yn(),fetchSnapshot:Xn(),readLocalStorageGuard:$n}}function tr(){let e=(0,Q.c)(5),t=(0,X.useSyncExternalStore)(qn,Jn,Jn),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],e[0]=n):n=e[0],(0,X.useEffect)(rr,n);let r=t?.desktopPresent??!0,i=t?.skillInstalled??!1,a=t?.skillVersion??null,o;return e[1]!==r||e[2]!==i||e[3]!==a?(o={desktopPresent:r,skillInstalled:i,skillVersion:a,refresh:nr},e[1]=r,e[2]=i,e[3]=a,e[4]=o):o=e[4],o}function nr(){Kn(er())}function rr(){An||Kn(er())}var ir=[{id:`markdownlint`,label:`markdownlint`}];async function ar(){try{let e=await fetch(`/api/sync/conflicts`);return e.ok?{conflicts:(await e.json()).conflicts??[]}:(console.warn(JSON.stringify({event:`conflicts-fetch-failed`,status:e.status})),{conflicts:[],error:`server`})}catch(e){return console.warn(JSON.stringify({event:`conflicts-fetch-failed`,status:null,detail:e instanceof Error?e.message:String(e)})),{conflicts:[],error:`network`}}}function or(){let e=(0,Q.c)(10),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,X.useState)(t),[i,a]=(0,X.useState)(!0),[o,s]=(0,X.useState)(null),c=(0,X.useRef)(0),l;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=function(){let e=c.current+=1;ar().then(t=>{let{conflicts:n,error:i}=t;e===c.current&&(r(n),s(i??null),a(!1))})},e[1]=l):l=e[1];let u=l,d,f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{u()},f=[],e[2]=d,e[3]=f):(d=e[2],f=e[3]),(0,X.useEffect)(d,f);let p,m;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>Fe(e=>{e.includes(`sync-status`)&&u()}),m=[],e[4]=p,e[5]=m):(p=e[4],m=e[5]),(0,X.useEffect)(p,m);let h;return e[6]!==n||e[7]!==o||e[8]!==i?(h={conflicts:n,loading:i,error:o},e[6]=n,e[7]=o,e[8]=i,e[9]=h):h=e[9],h}function sr(e){if(!e)return``;let t=e.replace(/[/\\]+$/g,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?t:t.slice(n+1)}var cr=`/api/share/construct-url`;function lr(e){return{kind:`doc`,docName:e}}function ur(e){return{kind:`folder`,folderRelativePath:e}}var dr=`Could not construct share URL.`,fr=`Link ready but could not copy to clipboard.`;async function pr(e,t=fetch){let n=await t(cr,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(`construct-url transport ${n.status}`);let r=await n.json(),i=U.safeParse(r);if(!i.success)throw Error(`construct-url response shape mismatch`);return i.data}function mr(e,t){switch(e){case`detached-head`:return`Switch to a branch to share.`;case`branch-not-on-origin`:return t?`Push ${t} to GitHub before sharing.`:`Push this branch to GitHub before sharing.`;case`non-github-remote`:return`Sharing supports GitHub remotes only.`;case`invalid-path`:return`Can't share this path.`;case`no-remote`:return`This project has no GitHub remote.`}}async function hr(e,t){if(!e.hasRemote)return e.onClickWhenNoRemote(),{kind:`opened-wizard`};let n=e.kind===`folder`?{kind:`folder`,folderPath:e.folderRelativePath}:{kind:`doc`,docPath:Le(e.docName)},r;try{r=await pr(n,t.fetchFn)}catch{return t.toastError(dr),{kind:`transport-error`}}if(r.ok){try{await t.clipboardWrite(r.shareUrl)}catch{return t.toastError(fr),t.logEvent(`[share] action=link-construct result=clipboard-failed`),{kind:`clipboard-failed`,shareUrl:r.shareUrl,freshness:r.freshness}}return t.toastSuccess(e.kind===`folder`?`Folder share link copied.`:`Link copied.`),t.logEvent(`[share] action=link-construct`),{kind:`copied`,shareUrl:r.shareUrl,branch:r.branch,freshness:r.freshness}}if(r.error===`no-remote`)return e.onClickWhenNoRemote(),{kind:`opened-wizard`};let i=r.branch;return t.toastError(mr(r.error,i)),{kind:`business-error`,error:r.error,branch:i}}var gr=e=>e.type===`checkbox`,_r=e=>e instanceof Date,vr=e=>e==null,yr=e=>typeof e==`object`,br=e=>!vr(e)&&!Array.isArray(e)&&yr(e)&&!_r(e),xr=e=>br(e)&&e.target?gr(e.target)?e.target.checked:e.target.value:e,Sr=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),Cr=e=>{let t=e.constructor&&e.constructor.prototype;return br(t)&&t.hasOwnProperty(`isPrototypeOf`)},wr=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function Tr(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(wr&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(br(e)&&Cr(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=Tr(e[t]));return r}var Er={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},Dr={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},Or={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},kr=`root`,Ar=[`__proto__`,`constructor`,`prototype`],jr=/^\w*$/,Mr=e=>jr.test(e),Nr=e=>e===void 0,Pr=/[.[\]'"]/,Fr=e=>e.split(Pr).filter(Boolean),$=(e,t,n)=>{if(!t||!br(e))return n;let r=Mr(t)?[t]:Fr(t);if(r.some(e=>Ar.includes(e)))return n;let i=r.reduce((e,t)=>vr(e)?void 0:e[t],e);return Nr(i)||i===e?Nr(e[t])?n:e[t]:i},Ir=e=>typeof e==`boolean`,Lr=e=>typeof e==`function`,Rr=(e,t,n)=>{let r=-1,i=Mr(t)?[t]:Fr(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=br(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(Ar.includes(t))return;e[t]=a,e=e[t]}},zr=X.createContext(null);zr.displayName=`HookFormControlContext`;var Br=()=>X.useContext(zr),Vr=(e,t,n,r=!0)=>{let i={};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==Dr.all&&(t._proxyFormState[i]=!r||Dr.all),n&&(n[i]=!0),e[i]}});return i},Hr=wr?X.useLayoutEffect:X.useEffect;function Ur(e){let t=Br(),{control:n=t,disabled:r,name:i,exact:a}=e||{},[o,s]=X.useState(()=>({...n._formState,defaultValues:n._defaultValues})),c=X.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Hr(()=>n._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!r&&s({...n._formState,...e,defaultValues:n._defaultValues})}}),[i,r,a]),X.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),X.useMemo(()=>Vr(o,n,c.current,!1),[o,n])}var Wr=e=>typeof e==`string`,Gr=(e,t,n,r,i)=>Wr(e)?(r&&t.watch.add(e),$(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),$(n,e))):(r&&(t.watchAll=!0),n),Kr=e=>vr(e)||!yr(e),qr=(e,t)=>t.length===0&&!Array.isArray(e)&&!Cr(e);function Jr(e,t,n=new WeakMap){if(e===t)return!0;if(Kr(e)||Kr(t))return Object.is(e,t);if(_r(e)&&_r(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(qr(e,r)||qr(t,i))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;let a=n.get(e);if(a&&a.has(t))return!0;if(a)a.add(t);else{let r=new WeakSet;r.add(t),n.set(e,r)}for(let i of r){let r=e[i];if(!(i in t))return!1;if(i!==`ref`){let e=t[i];if(_r(r)&&_r(e)||(br(r)||Array.isArray(r))&&(br(e)||Array.isArray(e))?!Jr(r,e,n):!Object.is(r,e))return!1}}return!0}function Yr(e){let t=Br(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=X.useRef(i),l=X.useRef(s),u=X.useRef(void 0),d=X.useRef(n),f=X.useRef(r);l.current=s;let[p,m]=X.useState(()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e}),h=X.useCallback(e=>{let t=Gr(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),g=X.useCallback(e=>{if(!a){let t=Gr(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);Jr(e,u.current)||(m(e),u.current=e)}else m(t)}},[n._formValues,n._names,a,r]);Hr(()=>((d.current!==n||!Jr(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]),X.useEffect(()=>n._removeUnmounted());let _=d.current!==n,v=f.current,y=X.useMemo(()=>{if(a)return null;let e=!_&&!Jr(v,r);return _||e?h():null},[a,_,r,v,h]);return y===null?p:y}function Xr(e){let t=Br(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=Sr(i._names.array,n),l=Yr({control:i,name:n,defaultValue:X.useMemo(()=>$(i._formValues,n,$(i._defaultValues,n,o)),[i,n,o]),exact:s}),u=Ur({control:i,name:n,exact:s}),d=X.useRef(e),f=X.useRef(null),p=X.useRef(i.register(n,{...e.rules,value:l,...Ir(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let m=X.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!$(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!$(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!$(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!$(u.validatingFields,n)},error:{enumerable:!0,get:()=>$(u.errors,n)}}),[u,n]),h=X.useCallback(e=>{let t=xr(e);return $(i._fields,n)||(p.current=i.register(n,{...d.current.rules,value:t})),p.current.onChange({target:{value:xr(e),name:n},type:Er.CHANGE})},[n,i]),g=X.useCallback(()=>p.current.onBlur({target:{value:$(i._formValues,n),name:n},type:Er.BLUR}),[n,i._formValues]),_=X.useCallback(e=>{e&&(f.current={focus:()=>Lr(e.focus)&&e.focus(),select:()=>Lr(e.select)&&e.select(),setCustomValidity:t=>Lr(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>Lr(e.reportValidity)&&e.reportValidity()});let t=$(i._fields,n);t&&t._f&&e&&(t._f.ref=f.current)},[i._fields,n]),v=X.useMemo(()=>({name:n,value:l,...Ir(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:h,onBlur:g,ref:_}),[n,r,u.disabled,h,g,_,l]);return X.useEffect(()=>{let e=i._options.shouldUnregister||a;i.register(n,{...d.current.rules,...Ir(d.current.disabled)?{disabled:d.current.disabled}:{}});let t=(e,t)=>{let n=$(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=Tr($(a?i._defaultValues:i._options.values||i._defaultValues,n,$(i._options.defaultValues,n,d.current.defaultValue)));Rr(i._defaultValues,n,e),Nr($(i._formValues,n))&&Rr(i._formValues,n,e)}if(!c&&i.register(n),f.current){let e=$(i._fields,n);e&&e._f&&(e._f.ref=f.current)}return()=>{(c?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,c,a]),X.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),X.useMemo(()=>({field:v,formState:u,fieldState:m}),[v,u,m])}var Zr=e=>e.render(Xr(e)),Qr=e=>{let t={};for(let n of Object.keys(e))if(yr(e[n])&&e[n]!==null&&!_r(e[n])){let r=Qr(e[n]);for(let e of Object.keys(r))t[`${n}.${e}`]=r[e]}else t[n]=e[n];return t},$r=X.createContext(null);$r.displayName=`HookFormContext`;var ei=()=>X.useContext($r),ti=({children:e,watch:t,getValues:n,getFieldState:r,setError:i,clearErrors:a,setValue:o,setValues:s,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:p,control:m,register:h,setFocus:g,subscribe:_})=>{let v=X.useMemo(()=>({watch:t,getValues:n,getFieldState:r,setError:i,clearErrors:a,setValue:o,setValues:s,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:p,control:m,register:h,setFocus:g,subscribe:_}),[a,m,l,r,n,f,h,d,u,i,g,o,s,_,c,p,t]);return X.createElement($r.Provider,{value:v},X.createElement(zr.Provider,{value:v.control},e))},ni=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},ri=e=>Array.isArray(e)?e.filter(Boolean):[],ii=e=>Array.isArray(e)?e:[e],ai=()=>{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 oi(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&br(i)&&a){let e=oi(i,a);br(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var si=e=>br(e)&&!Object.keys(e).length,ci=e=>e.type===`file`,li=e=>{if(!wr)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ui=e=>e.type===`select-multiple`,di=e=>e.type===`radio`,fi=e=>di(e)||gr(e),pi=e=>li(e)&&e.isConnected;function mi(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;){if(vr(e)){e=void 0;break}e=e[t[r]],r++}return e}function hi(e){for(let t in e)if(e.hasOwnProperty(t)&&!Nr(e[t]))return!1;return!0}function gi(e,t){if(Wr(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:Mr(t)?[t]:Fr(t);if(n.some(e=>Ar.includes(String(e))))return e;let r=n.length===1?e:mi(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(br(r)&&si(r)||Array.isArray(r)&&hi(r))&&gi(e,n.slice(0,-1)),e}var _i=e=>{for(let t in e)if(Lr(e[t]))return!0;return!1};function vi(e){return Array.isArray(e)||br(e)&&!_i(e)}function yi(e,t={}){for(let n in e){let r=e[n];vi(r)?(t[n]=Array.isArray(r)?[]:{},yi(r,t[n])):Nr(r)||(t[n]=!0)}return t}function bi(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){let t=e.map(e=>bi(e));return t.some(e=>e!==void 0)?t:void 0}if(br(e)){let t={};for(let n in e){let r=bi(e[n]);Nr(r)||(t[n]=r)}return Object.keys(t).length?t:void 0}}}function xi(e,t,n){n||=yi(t);for(let r in e){let i=e[r];if(vi(i))Nr(t)||Kr(n[r])?n[r]=yi(i,Array.isArray(i)?[]:{}):xi(i,vr(t)?{}:t[r],n[r]);else{let e=t[r];n[r]=!Jr(i,e)}}return bi(n)||{}}var Si={value:!1,isValid:!1},Ci={value:!0,isValid:!0},wi=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&&!Nr(e[0].attributes.value)?Nr(e[0].value)||e[0].value===``?Ci:{value:e[0].value,isValid:!0}:Ci:Si}return Si},Ti=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Nr(e)?e:t?e===``?NaN:e&&+e:n&&Wr(e)?new Date(e):r?r(e):e,Ei={isValid:!1,value:null},Di=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Ei):Ei;function Oi(e){let t=e.ref;return ci(t)?t.files:di(t)?Di(e.refs).value:ui(t)?[...t.selectedOptions].map(({value:e})=>e):gr(t)?wi(e.refs).value:Ti(Nr(t.value)?e.ref.value:t.value,e)}var ki=(e,t,n,r)=>{let i={};for(let n of e){let e=$(t,n);e&&Rr(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},Ai=e=>e instanceof RegExp,ji=e=>Nr(e)?e:Ai(e)?e.source:br(e)?Ai(e.value)?e.value.source:e.value:e,Mi=e=>({isOnSubmit:!e||e===Dr.onSubmit,isOnBlur:e===Dr.onBlur,isOnChange:e===Dr.onChange,isOnAll:e===Dr.all,isOnTouch:e===Dr.onTouched}),Ni=`AsyncFunction`,Pi=e=>{if(!e||!e.validate)return!1;if(Lr(e.validate))return e.validate.constructor.name===Ni;if(br(e.validate)){for(let t in e.validate)if(e.validate[t].constructor.name===Ni)return!0}return!1},Fi=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ii=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(let n of t.watch)if(e.startsWith(n)&&e.charAt(n.length)===`.`)return!0;return!1},Li=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=$(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(Li(a,t))break}else if(br(a)&&Li(a,t))break}}};function Ri(e,t,n){let r=$(e,n);if(r||Mr(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=$(t,r),o=$(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 zi=(e,t,n,r)=>{n(e);let{name:i,...a}=e,o=Object.keys(a);return!o.length||r&&o.length>=Object.keys(t).length||o.find(e=>t[e]===(!r||Dr.all))},Bi=(e,t,n)=>!e||!t||e===t||ii(e).some(e=>e&&(n?e===t||e.startsWith(t+`.`):e.startsWith(t)||t.startsWith(e))),Vi=(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,Hi=(e,t)=>!ri($(e,t)).length&&gi(e,t),Ui=(e,t,n)=>{let r=$(e,n),i=Array.isArray(r)?r:[];return Rr(i,kr,t[n]),Rr(e,n,i),e};function Wi(e,t,n=`validate`){if(Wr(e)||Array.isArray(e)&&e.every(Wr)||Ir(e)&&!e)return{type:n,message:Wr(e)?e:``,ref:t}}var Gi=e=>br(e)&&!Ai(e)?e:{value:e,message:``},Ki=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=$(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{if(i&&y.reportValidity){let t=Ir(e)?``:e||``;s?s.forEach(e=>e.setCustomValidity(t)):y.setCustomValidity(t),y.reportValidity()}},x={},S=di(o),C=gr(o),w=S||C,T=(g||ci(o))&&Nr(o.value)&&Nr(v)||li(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length,E=ni.bind(null,h,r,x),D=(e,t,n,r=Or.maxLength,i=Or.minLength)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...E(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!w&&(T||vr(v))||Ir(v)&&!v||C&&!wi(s).isValid||S&&!Di(s).isValid)){let{value:e,message:t}=Wr(c)?{value:!!c,message:c}:Gi(c);if(e&&(x[h]={type:Or.required,message:t,ref:y,...E(Or.required,t)},!r))return b(t),x}if(!T&&(!vr(d)||!vr(f))){let e,t,n=Gi(f),i=Gi(d);if(!vr(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;vr(n.value)||(e=r>n.value),vr(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`;Wr(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),Wr(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}if((e||t)&&(D(!!e,n.message,i.message,Or.max,Or.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(Wr(v)||a&&Array.isArray(v))){let e=Gi(l),t=Gi(u),n=!vr(e.value)&&v.length>+e.value,i=!vr(t.value)&&v.length<+t.value;if((n||i)&&(D(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!T&&Wr(v)){let{value:e,message:t}=Gi(p);if(Ai(e)&&!v.match(e)&&(x[h]={type:Or.pattern,message:t,ref:o,...E(Or.pattern,t)},!r))return b(t),x}if(m){if(Lr(m)){let e=Wi(await m(v,n),y);if(e&&(x[h]={...e,...E(Or.validate,e.message)},!r))return b(e.message),x}else if(br(m)){let e={};for(let t in m){if(!si(e)&&!r)break;let i=Wi(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!si(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},qi={mode:Dr.onSubmit,reValidateMode:Dr.onChange,shouldFocusError:!0},Ji=`form`,Yi={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function Xi(e={}){let t={...qi,...e},n={...Tr(Yi),isLoading:Lr(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},r={},i=(br(t.defaultValues)||br(t.values))&&Tr(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:Tr(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=0,d=Mi(t.mode),f=Mi(t.reValidateMode),p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...p},h={...m},g={array:ai(),state:ai()},_=t.criteriaMode===Dr.all,v=e=>t=>{clearTimeout(l),l=setTimeout(e,t)},y=async e=>{if(!o.keepIsValid&&!t.disabled&&(m.isValid||h.isValid||e)){let e;t.resolver?(e=si((await k()).errors),b()):e=await M({fields:r,onlyCheckValid:!0,eventType:Er.VALID}),e!==n.isValid&&g.state.next({isValid:e})}},b=(e,r)=>{!t.disabled&&(m.isValidating||m.validatingFields||h.isValidating||h.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?Rr(n.validatingFields,e,r):gi(n.validatingFields,e))}),g.state.next({validatingFields:n.validatingFields,isValidating:!si(n.validatingFields)}))},x=()=>{n.dirtyFields=xi(i,a)},S=(e,i=[],s,c,l=!0,u=!0)=>{if(c&&s&&!t.disabled){if(o.action=!0,u&&Array.isArray($(r,e))){let t=s($(r,e),c.argA,c.argB);l&&Rr(r,e,t)}if(u&&Array.isArray($(n.errors,e))){let t=s($(n.errors,e),c.argA,c.argB);l&&Rr(n.errors,e,t),Hi(n.errors,e)}if((m.touchedFields||h.touchedFields)&&u&&Array.isArray($(n.touchedFields,e))){let t=s($(n.touchedFields,e),c.argA,c.argB);l&&Rr(n.touchedFields,e,t)}(m.dirtyFields||h.dirtyFields)&&x(),g.state.next({name:e,isDirty:P(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Rr(a,e,i)},C=(e,t)=>{Rr(n.errors,e,t),n.errors={...n.errors},g.state.next({errors:n.errors})},w=e=>{n.errors=e,g.state.next({errors:n.errors,isValid:!1})},T=e=>{let t=Mr(e)?[e]:Fr(e),n=a,r=i;for(let e=0;e<t.length-1;e++){let i=t[e];if(n=vr(n)?n:n[i],r=vr(r)?r:r[i],n===null&&r!==null)return!0}return!1},E=(t,c,l,u)=>{let d=$(r,t);if(d){if(T(t))return;let r=Nr($(a,t)),f=$(a,t,Nr(l)?$(i,t):l);Nr(f)||u&&u.defaultChecked||c?Rr(a,t,c?f:Oi(d._f)):L(t,f),o.mount&&!o.action&&(y(),r&&n.isDirty&&(m.isDirty||h.isDirty)&&(P()||(n.isDirty=!1,g.state.next({...n}))),e.shouldUnregister&&r&&!Nr($(a,t))&&Ii(t,s)&&(o.watch=!0))}},D=(e,r,o,s,c)=>{let l=!1,u=!1,d={name:e};if(!t.disabled){if(!o||s){let t=Jr($(i,e),r);(m.isDirty||h.isDirty)&&(u=n.isDirty,n.isDirty=d.isDirty=!t||P(),l=u!==d.isDirty),u=!!$(n.dirtyFields,e),t===n.isDirty?t?gi(n.dirtyFields,e):Rr(n.dirtyFields,e,!0):n.dirtyFields=xi(i,a),d.dirtyFields=n.dirtyFields,l||=(m.dirtyFields||h.dirtyFields)&&u!==!t}if(o){let t=$(n.touchedFields,e);t||(Rr(n.touchedFields,e,o),d.touchedFields=n.touchedFields,l||=(m.touchedFields||h.touchedFields)&&t!==o)}l&&c&&g.state.next(d)}return l?d:{}},O=(e,r,i,a)=>{let o=$(n.errors,e),s=(m.isValid||h.isValid)&&Ir(r)&&n.isValid!==r;if(t.delayError&&i?(c=v(()=>C(e,i)),c(t.delayError)):(clearTimeout(l),c=null,i?Rr(n.errors,e,i):gi(n.errors,e),n.errors={...n.errors}),(i?!Jr(o,i):o)||!si(a)||s){let t={...a,...s&&Ir(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},g.state.next(t)}},k=async e=>(b(e,!0),await t.resolver(a,t.context,ki(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),A=async e=>{let{errors:t}=await k(e);if(b(e),e){for(let r of e){let e=$(t,r);e?s.array.has(r)&&br(e)&&!Object.keys(e).some(e=>!Number.isNaN(Number(e)))?Ui(n.errors,{[r]:e},r):Rr(n.errors,r,e):gi(n.errors,r)}n.errors={...n.errors}}else n.errors=t;return t},j=async({name:t,eventType:r})=>{if(e.validate){let i=await e.validate({formValues:a,formState:n,name:t,eventType:r});if(br(i))for(let e in i){let t=i[e];t&&J(`${Ji}.${e}`,{message:Wr(t.message)?t.message:``,type:t.type||Or.validate})}else Wr(i)||!i?J(Ji,{message:i||``,type:Or.validate}):q(Ji);return i}return!0},M=async({fields:r,onlyCheckValid:i,name:o,eventType:c,context:l={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(l.runRootValidation=!0,!await j({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,...d}=u;if(r){let o=s.array.has(r.name),c=u._f&&Pi(u._f),d=m.validatingFields||m.isValidating||h.validatingFields||h.isValidating;c&&d&&b([r.name],!0);let f=await Ki(u,s.disabled,a,_,t.shouldUseNativeValidation&&!i,o);if(c&&d&&b([r.name]),f[r.name]&&(l.valid=!1,i)||(!i&&($(f,r.name)?o?Ui(n.errors,f,r.name):Rr(n.errors,r.name,f[r.name]):gi(n.errors,r.name)),e.shouldUseNativeValidation&&f[r.name]))break}!si(d)&&await M({context:l,onlyCheckValid:i,fields:d,name:o,eventType:c})}}return l.valid},N=()=>{for(let e of s.unMount){let t=$(r,e);t&&(t._f.refs?t._f.refs.every(e=>!pi(e)):!pi(t._f.ref))&&re(e)}s.unMount=new Set},P=(e,n)=>!t.disabled&&(e&&n&&Rr(a,e,n),!Jr(o.mount?a:i,i)),F=(e,t,n)=>Gr(e,s,{...o.mount?a:Nr(t)?i:Wr(e)?{[e]:t}:t},n,t),I=e=>ri($(o.mount?a:i,e,t.shouldUnregister?$(i,e,[]):[])),L=(e,t,n={},i=!1,o=!1)=>{let s=$(r,e),c=t;if(s){let n=s._f;n&&(!n.disabled&&Rr(a,e,Ti(t,n)),c=li(n.ref)&&vr(t)?``:t,ui(n.ref)?[...n.ref.options].forEach(e=>e.selected=c.includes(e.value)):n.refs?gr(n.ref)?n.refs.forEach(e=>{(!e.defaultChecked||!e.disabled)&&(Array.isArray(c)?e.checked=!!c.find(t=>t===e.value):e.checked=c===e.value||!!c)}):n.refs.forEach(e=>e.checked=e.value===c):ci(n.ref)?n.ref.value=``:(n.ref.value=c,!n.ref.type&&!o&&g.state.next({name:e,values:i?a:Tr(a)})))}(n.shouldDirty||n.shouldTouch)&&D(e,c,n.shouldTouch,n.shouldDirty,!o),n.shouldValidate&&W(e)},R=(e,t,n,i=!1,a=!1)=>{for(let o in t){if(!t.hasOwnProperty(o))return;let c=t[o],l=e+`.`+o,u=$(r,l);(s.array.has(e)||br(c)||u&&!u._f)&&!_r(c)?R(l,c,n,i,a):L(l,c,n,i,a)}},z=(e,t,i,c,l=!1)=>{let u=$(r,e),d=s.array.has(e),f=c?t:Tr(t),p=Jr($(a,e),f);if(p||Rr(a,e,f),d)g.array.next({name:e,values:c?a:Tr(a)}),(m.isDirty||m.dirtyFields||h.isDirty||h.dirtyFields)&&i.shouldDirty&&(x(),l||g.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:P(e,f)}));else{let t=Array.isArray(f)&&!f.length||si(f);!u||u._f||vr(f)||t?L(e,f,i,c,l):R(e,f,i,c,l)}if(!p&&!l){let t=Ii(e,s),r=c?a:Tr(a);g.state.next({...t&&n,name:o.mount||t?e:void 0,values:r})}},B=(e,t,n={})=>z(e,t,n,!1),V=(e,t={})=>{let r=Lr(e)?e(a):e;if(!Jr(a,r)){a={...a,...r};let e=Qr(r);for(let n of s.mount)n in e&&z(n,e[n],t,!0,!0);g.state.next({...n,name:void 0,type:void 0,...u?{values:a}:{}}),t.shouldValidate&&y()}},H=async i=>{o.mount=!0;let l=i.target,p=l.name,v=!0,x=$(r,p),S=e=>{v=Number.isNaN(e)||_r(e)&&isNaN(e.getTime())||Jr(e,$(a,p,e))};if(x){let o,C,w=l.type?Oi(x._f):xr(i),T=i.type===Er.BLUR||i.type===Er.FOCUS_OUT,E=!Fi(x._f)&&!e.validate&&!t.resolver&&!$(n.errors,p)&&!x._f.deps,A=E||Vi(T,$(n.touchedFields,p),n.isSubmitted,f,d),N=Ii(p,s,T);Rr(a,p,w),T?(!l||!l.readOnly)&&(x._f.onBlur&&x._f.onBlur(i),c&&c(0)):x._f.onChange&&x._f.onChange(i);let P=D(p,w,T),F=!si(P)||N;if(!T&&g.state.next({name:p,type:i.type,...u?{values:Tr(a)}:{}}),A)return(!E||!n.isValid)&&(m.isValid||h.isValid)&&(t.mode===`onBlur`?T&&y():T||y()),F&&g.state.next({name:p,...N?{}:P});if(!t.resolver&&e.validate&&await j({name:p,eventType:i.type}),!T&&N&&g.state.next({...n}),t.resolver){let{errors:e}=await k([p]);if(b([p]),S(w),!v){!si(P)&&g.state.next(P);return}let t=Ri(n.errors,r,p),i=Ri(e,r,t.name||p);o=i.error,p=i.name,C=si(e)}else b([p],!0),o=(await Ki(x,s.disabled,a,_,t.shouldUseNativeValidation))[p],b([p]),S(w),v&&(o?C=!1:(m.isValid||h.isValid)&&(C=await M({fields:r,onlyCheckValid:!0,name:p,eventType:i.type})));v&&(x._f.deps&&(!Array.isArray(x._f.deps)||x._f.deps.length>0)&&W(x._f.deps),O(p,C,o,P))}},U=(e,t)=>{if($(n.errors,t)&&e.focus)return e.focus(),1},W=async(e,i={})=>{let a,o,c=ii(e);if(t.resolver){let t=await A(Nr(e)?e:c);a=si(t),o=e?!c.some(e=>$(t,e)):a}else e?(o=(await Promise.all(c.map(async e=>{let t=$(r,e);return await M({fields:t&&t._f?{[e]:t}:t,eventType:Er.TRIGGER})}))).every(Boolean),!(!o&&!n.isValid)&&y()):o=a=await M({fields:r,name:e,eventType:Er.TRIGGER});return g.state.next({...!Wr(e)||(m.isValid||h.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&Li(r,U,e?c:s.mount),o},G=(e,t)=>{let r={...o.mount?a:i};return t&&(r=oi(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),Nr(e)?r:Wr(e)?$(r,e):e.map(e=>$(r,e))},K=(e,t)=>({invalid:!!$((t||n).errors,e),isDirty:!!$((t||n).dirtyFields,e),error:$((t||n).errors,e),isValidating:!!$(n.validatingFields,e),isTouched:!!$((t||n).touchedFields,e)}),q=e=>{let t=e?ii(e):void 0;t?.forEach(e=>gi(n.errors,e)),t?t.forEach(e=>{g.state.next({name:e,errors:n.errors})}):g.state.next({errors:{}})},J=(e,t,i)=>{let a=($(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=$(n.errors,e)||{};Rr(n.errors,e,{...l,...t,ref:a}),g.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},ee=(e,t)=>{if(Lr(e)){u++;let{unsubscribe:n}=g.state.subscribe({next:n=>`values`in n&&e(n.values||F(void 0,t),n)}),r=!1;return{unsubscribe:()=>{r||(r=!0,u--,n())}}}return F(e,t,!0)},te=e=>{let t=!!e.formState?.values;t&&u++;let{unsubscribe:r}=g.state.subscribe({next:t=>{if(Bi(e.name,t.name,e.exact)&&zi(t,e.formState||m,pe,e.reRenderRoot)){let r={...a};e.callback({values:r,...n,...t,defaultValues:i})}}});if(!t)return r;let o=!1;return()=>{o||(o=!0,u--,r())}},ne=e=>(o.mount=!0,h={...h,...e.formState},te({...e,formState:{...p,...e.formState}})),re=(e,o={})=>{for(let c of e?ii(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(gi(r,c),gi(a,c)),!o.keepError&&gi(n.errors,c),!o.keepDirty&&gi(n.dirtyFields,c),!o.keepTouched&&gi(n.touchedFields,c),!o.keepIsValidating&&gi(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&gi(i,c);g.state.next({values:Tr(a)}),g.state.next({...n,...o.keepDirty?{isDirty:P()}:{}}),!o.keepIsValid&&y()},ie=({disabled:e,name:t})=>{if(Ir(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&&y()}},ae=(e,n={})=>{let a=$(r,e),c=Ir(n.disabled)||Ir(t.disabled),l=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;return Rr(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&!l?ie({disabled:Ir(n.disabled)?n.disabled:t.disabled,name:e}):E(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:ji(n.min),max:ji(n.max),minLength:ji(n.minLength),maxLength:ji(n.maxLength),pattern:ji(n.pattern)}:{},name:e,onChange:H,onBlur:H,ref:c=>{if(c){s.registerName.add(e),ae(e,n),s.registerName.delete(e),a=$(r,e);let t=Nr(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=fi(t),l=a._f.refs||[];if(o?l.find(e=>e===t):t===a._f.ref)return;Rr(r,e,{_f:{...a._f,...o?{refs:[...l.filter(pi),t,...Array.isArray($(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),E(e,!1,void 0,t)}else a=$(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(Sr(s.array,e)&&o.action)&&s.unMount.add(e)}}},oe=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Li(r,U,s.mount),se=e=>{Ir(e)&&(g.state.next({disabled:e}),Li(r,(t,n)=>{let i=$(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=Tr(a);if(g.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await k();b(),n.errors=e,l=Tr(t)}else await M({fields:r,eventType:Er.SUBMIT});if(s.disabled.size)for(let e of s.disabled)gi(l,e);if(gi(n.errors,kr),si(n.errors)){g.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),oe(),setTimeout(oe);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:si(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},le=(e,t={})=>{$(r,e)&&(Nr(t.defaultValue)?B(e,Tr($(i,e))):(B(e,t.defaultValue),Rr(i,e,Tr(t.defaultValue))),t.keepTouched||gi(n.touchedFields,e),t.keepDirty||(gi(n.dirtyFields,e),n.isDirty=t.defaultValue?P(e,Tr($(i,e))):P()),t.keepError||(gi(n.errors,e),m.isValid&&y()),g.state.next({...n}))},ue=(e,c={})=>{let l=e?Tr(e):i,u=Tr(l),d=si(e),f=u;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(xi(i,a))]);for(let t of Array.from(e)){let e=$(n.dirtyFields,t),r=$(a,t),i=$(f,t);e&&!Nr(r)?Rr(f,t,r):!e&&!Nr(i)&&B(t,i)}}else{if(wr&&Nr(e))for(let e of s.mount){let t=$(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(li(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)B(e,$(f,e));else r={}}if(t.shouldUnregister){if(a=c.keepDefaultValues?Tr(i):{},c.keepFieldsRef)for(let e of s.mount)Rr(a,e,$(f,e))}else a=Tr(f);g.array.next({values:{...f}}),g.state.next({name:void 0,type:void 0,values:{...f}})}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=!m.isValid||!!c.keepIsValid||!!c.keepDirtyValues||!t.shouldUnregister&&!si(f),o.watch=!!t.shouldUnregister,o.keepIsValid=!!c.keepIsValid,o.action=!1,c.keepErrors||(n.errors={}),g.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:d?!1:c.keepDirty?n.isDirty:c.keepValues?P():!!(c.keepDefaultValues&&!Jr(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:d?{}:c.keepDirtyValues?c.keepDefaultValues&&a?xi(i,a):n.dirtyFields:c.keepDefaultValues&&e?xi(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})},de=(e,n)=>ue(Lr(e)?e(a):e,{...t.resetOptions,...n}),fe=(e,t={})=>{let n=$(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&Lr(e.select)&&e.select()})}},pe=e=>{let{name:t,type:r,values:i,...a}=e;n={...n,...a}},me={control:{register:ae,unregister:re,getFieldState:K,handleSubmit:ce,setError:J,_subscribe:te,_runSchema:k,_updateIsValidating:b,_focusError:oe,_getWatch:F,_getDirty:P,_setValid:y,_setFieldArray:S,_setDisabledField:ie,_setErrors:w,_getFieldArray:I,_reset:ue,_resetDefaultValues:()=>Lr(t.defaultValues)&&t.defaultValues().then(e=>{de(e,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:N,_disableForm:se,_subjects:g,_proxyFormState:m,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},d=Mi(t.mode),f=Mi(t.reValidateMode)}},subscribe:ne,trigger:W,register:ae,handleSubmit:ce,watch:ee,setValue:B,setValues:V,getValues:G,reset:de,resetField:le,resetDefaultValues:(e,t={})=>{if(i=Tr(e),!t.keepDirty){let e=xi(i,a);n.dirtyFields=e,n.isDirty=!si(e)}t.keepIsValid||y(),g.state.next({...n,defaultValues:i})},clearErrors:q,unregister:re,setError:J,setFocus:fe,getFieldState:K};return{...me,formControl:me}}function Zi(e={}){let t=X.useRef(void 0),n=X.useRef(void 0),r=X.useRef(e.formControl),[i,a]=X.useState(()=>({...Tr(Yi),isLoading:Lr(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Lr(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&r.current!==e.formControl)if(r.current=e.formControl,e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!Lr(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...r}=Xi(e);t.current={...r,formState:i}}let o=t.current.control;return o._options=e,Hr(()=>{let e=o._subscribe({formState:o._proxyFormState,callback:()=>a({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return a(e=>({...e,isReady:!0})),o._formState.isReady=!0,e},[o]),X.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),X.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),X.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),X.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),X.useEffect(()=>{if(o._proxyFormState.isDirty){let e=o._getDirty();e!==i.isDirty&&o._subjects.state.next({isDirty:e})}},[o,i.isDirty]),X.useEffect(()=>{e.values&&!Jr(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),o._options.resetOptions?.keepIsValid||o._setValid(),n.current=e.values,a(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),X.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=X.useMemo(()=>Vr(i,o),[o,i]),t.current}var Qi=`/api/share/publish/owners`,$i=`/api/share/publish/name-check`,ea=`/api/share/publish`,ta=/[A-Za-z0-9._-]/g;function na(e){return(e.match(ta)?.join(``)??``).replace(/[-.]{2,}/g,e=>e[0]??`-`).replace(/^[-.]+/,``).replace(/[-.]+$/,``)}function ra(e){return e.find(e=>e.kind===`org`)?.login??e[0]?.login??``}function ia(e){return`https://github.com/orgs/${encodeURIComponent(e)}/policies/applications`}function aa(e,t,n){switch(e){case`name-conflict`:return{banner:`${t}/${n} already exists. Pick a different name.`,next:{kind:`edit-name`}};case`saml-sso`:return{banner:`GitHub denied the request. You may need to authorize OpenKnowledge for ${t} in your browser.`,next:{kind:`authorize-org`,authorizeUrl:ia(t)}};case`push-failed`:return{banner:`Created ${t}/${n}, push failed.`,next:{kind:`retry-push`}};case`auth-required`:return{banner:`GitHub connection expired. Connect again to continue.`,next:{kind:`reauth`}};case`init-failed`:return{banner:`Couldn't prepare this project for publish.`,next:{kind:`edit-form`}};case`network`:return{banner:`Couldn't reach GitHub. Try again?`,next:{kind:`edit-form`}};case`no-project`:return{banner:`Open a project first.`,next:{kind:`edit-form`}}}}async function oa(e=fetch){let t=await e(Qi,{method:`GET`});if(!t.ok)throw Error(`owners transport ${t.status}`);let n=await t.json(),r=H.safeParse(n);if(!r.success)throw Error(`owners response shape mismatch`);return r.data}async function sa(e,t,n=fetch){let r=await n(`${$i}?owner=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`,{method:`GET`});if(!r.ok)throw Error(`name-check transport ${r.status}`);let i=await r.json(),a=te.safeParse(i);if(!a.success)throw Error(`name-check response shape mismatch`);return a.data}async function ca(e,t=fetch){let n=await t(ea,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(`publish transport ${n.status}`);let r=await n.json(),i=ee.safeParse(r);if(!i.success)throw Error(`publish response shape mismatch`);return i.data}function la(e,t,n){return e.ok?e.available?{kind:`available`}:{kind:`taken`,owner:t,name:n}:e.error===`auth-required`?{kind:`error`,banner:`GitHub connection expired. Connect again to continue.`}:{kind:`error`,banner:`Couldn't reach GitHub. Try again?`}}function ua(e){return e.submitting||e.owner===null||e.sanitizedName.length===0?!1:e.nameCheck.kind===`available`}var da=500;function fa(e){let t=(0,Q.c)(69),{open:n,onOpenChange:r}=e,{_:i}=_(),a=he(),{activeDocName:o}=p(),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),[m,h]=(0,X.useState)(``),[v,b]=(0,X.useState)(``),[x,S]=(0,X.useState)(`private`),[C,w]=(0,X.useState)(``),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T={kind:`idle`},t[0]=T):T=t[0];let[N,P]=(0,X.useState)(T),[F,I]=(0,X.useState)(!1),[L,R]=(0,X.useState)(null),[H,U]=(0,X.useState)(!1),[W,G]=(0,X.useState)(null),[K,q]=(0,X.useState)(!1),[J,ee]=(0,X.useState)(null),[te,ne]=(0,X.useState)(null),re=(0,X.useRef)(null),ie=(0,X.useRef)(null),ae=(0,X.useRef)(null),oe;t[1]===v?oe=t[2]:(oe=na(v),t[1]=v,t[2]=oe);let se=oe,ce=s?.find(e=>e.login===m)??null,le;t[3]!==i||t[4]!==m?(le=async function(){u(!0),f(null);try{let e=await oa();if(!e.ok){e.error===`auth-required`?(U(!0),f(i({id:`6cyguR`}))):f(i({id:`UVLlMV`})),u(!1);return}c(e.owners),e.owners.length>0&&m===``&&h(ra(e.owners))}catch{f(i({id:`UVLlMV`}))}u(!1)},t[3]=i,t[4]=m,t[5]=le):le=t[5];let ue=le,de;t[6]!==ue||t[7]!==n||t[8]!==s||t[9]!==m||t[10]!==a?.contentDir?(de=()=>{n&&(P({kind:`idle`}),R(null),I(!1),f(null),G(null),q(!1),ee(null),ne(null),b(na(sr(a?.contentDir??``))),S(`private`),w(``),s===null?ue():m===``&&s.length>0&&h(ra(s)))},t[6]=ue,t[7]=n,t[8]=s,t[9]=m,t[10]=a?.contentDir,t[11]=de):de=t[11];let fe;t[12]===n?fe=t[13]:(fe=[n],t[12]=n,t[13]=fe),(0,X.useEffect)(de,fe);let pe,me;t[14]!==i||t[15]!==n||t[16]!==se||t[17]!==m?(pe=()=>{if(n){if(re.current!==null&&clearTimeout(re.current),m===``||se===``){P({kind:`idle`});return}return P({kind:`pending`}),re.current=setTimeout(async()=>{let e=m,t=se;ie.current=`${e}|${t}`,P({kind:`checking`});try{let n=await sa(e,t);if(ie.current!==`${e}|${t}`)return;P(la(n,e,t))}catch{if(ie.current!==`${e}|${t}`)return;P({kind:`error`,banner:i({id:`UVLlMV`})})}},da),()=>{re.current!==null&&(clearTimeout(re.current),re.current=null)}}},me=[n,m,se,i],t[14]=i,t[15]=n,t[16]=se,t[17]=m,t[18]=pe,t[19]=me):(pe=t[18],me=t[19]),(0,X.useEffect)(pe,me);let ge,_e;t[20]!==i||t[21]!==o||t[22]!==W?(ge=()=>{if(!W||!o)return;let e=!1;return(async()=>{try{let t=await pr({kind:`doc`,docPath:Le(o)});if(e)return;t.ok?ee(t.shareUrl):ne(mr(t.error,t.branch))}catch(t){let n=t;if(e)return;console.warn(`[share] action=prefetch-share-url result=failed`,n),ne(i({id:`J6N5MX`}))}})(),()=>{e=!0}},_e=[W,o,i],t[20]=i,t[21]=o,t[22]=W,t[23]=ge,t[24]=_e):(ge=t[23],_e=t[24]),(0,X.useEffect)(ge,_e);let ve;t[25]===ue?ve=t[26]:(ve=function(){U(!1),f(null),ue()},t[25]=ue,t[26]=ve);let ye=ve,be=async function(){if(ua({owner:ce,sanitizedName:se,nameCheck:N,submitting:F})){I(!0),R(null);try{let e=await ca({owner:m,name:se,visibility:x,description:C.trim().length>0?C.trim():void 0});if(e.ok){G({ownerLogin:e.ownerLogin,repoName:e.repoName}),I(!1);return}let t=aa(e.error,m,se);R({message:t.banner,next:t.next}),t.next.kind===`edit-name`?(ae.current?.focus(),ae.current?.select()):t.next.kind===`reauth`&&U(!0)}catch{R({message:i({id:`UVLlMV`}),next:{kind:`edit-form`}})}I(!1)}},xe;t[27]!==i||t[28]!==K||t[29]!==r||t[30]!==J?(xe=function(){!J||K||(q(!0),Ve(J).then(()=>{ke.success(i({id:`c1LZZH`})),r(!1)}).catch(e=>{if(console.warn(`[share] action=link-construct result=clipboard-failed`,e),He(e)&&window.self!==window.top){ke.error(i({id:`Dub54T`}));return}ke.error(i({id:`MQIM_Y`}))}).finally(()=>{q(!1)}))},t[27]=i,t[28]=K,t[29]=r,t[30]=J,t[31]=xe):xe=t[31];let Se=xe,Ce;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(e){let t=window.okDesktop?.shell?.openExternal;t?t(e):window.open(e,`_blank`,`noopener`)},t[32]=Ce):Ce=t[32];let Te=Ce,Ee;t[33]===r?Ee=t[34]:(Ee=function(){r(!1)},t[33]=r,t[34]=Ee);let De=Ee,Oe=!ua({owner:ce,sanitizedName:se,nameCheck:N,submitting:F}),Y;t[35]!==i||t[36]!==o||t[37]!==L||t[38]!==K||t[39]!==C||t[40]!==Te||t[41]!==De||t[42]!==Se||t[43]!==be||t[44]!==ue||t[45]!==v||t[46]!==N||t[47]!==s||t[48]!==d||t[49]!==l||t[50]!==W||t[51]!==se||t[52]!==m||t[53]!==J||t[54]!==te||t[55]!==Oe||t[56]!==F||t[57]!==x?(Y=(0,Z.jsx)(O,{className:`sm:max-w-lg`,showCloseButton:!1,children:W?(0,Z.jsx)(ma,{ownerLogin:W.ownerLogin,repoName:W.repoName,shareUrl:J,shareUrlError:te,copying:K,canCopy:o!==null,onCopy:Se,onClose:De}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(j,{children:[(0,Z.jsx)(D,{children:(0,Z.jsx)(g,{id:`qXsafh`})}),(0,Z.jsx)(E,{children:(0,Z.jsx)(g,{id:`Z1LF1M`})})]}),(0,Z.jsxs)(k,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(z,{id:`publish-owner-label`,children:(0,Z.jsx)(g,{id:`LtI9AS`})}),l&&s===null?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(we,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,Z.jsx)(g,{id:`Z3FXyt`})]}):d?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm text-destructive`,children:d}),(0,Z.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>ue(),children:(0,Z.jsx)(g,{id:`6gRgw8`})})]}):(0,Z.jsx)(V,{value:m,onValueChange:h,"aria-labelledby":`publish-owner-label`,"data-testid":`publish-owner-radio`,children:(s??[]).map(pa)})]}),(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(z,{htmlFor:`publish-name`,children:(0,Z.jsx)(g,{id:`0xnmlQ`})}),(0,Z.jsx)(Ae,{id:`publish-name`,ref:ae,"data-testid":`publish-name`,value:v,onChange:e=>b(e.target.value),onBlur:()=>{ie.current=null},placeholder:`my-knowledge-base`,autoComplete:`off`,spellCheck:!1}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-1sm`,"aria-live":`polite`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:se?(0,Z.jsx)(g,{id:`Nn4GgW`,values:{sanitizedName:se},components:{0:(0,Z.jsx)(`code`,{className:`font-mono`})}}):(0,Z.jsx)(g,{id:`Oxyd5f`})}),(0,Z.jsx)(ya,{status:N})]})]}),(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(z,{id:`publish-visibility-label`,children:(0,Z.jsx)(g,{id:`2q_Q7x`})}),(0,Z.jsxs)(V,{value:x,onValueChange:e=>S(e===`public`?`public`:`private`),className:`sm:flex`,"aria-labelledby":`publish-visibility-label`,children:[(0,Z.jsx)(Et,{htmlFor:`publish-visibility-private`,children:(0,Z.jsxs)(wt,{orientation:`horizontal`,children:[(0,Z.jsxs)(Tt,{children:[(0,Z.jsx)(Dt,{children:(0,Z.jsx)(g,{id:`zwBp5t`})}),(0,Z.jsx)(Ot,{className:`text-1sm`,children:(0,Z.jsx)(g,{id:`D8OV7J`})})]}),(0,Z.jsx)(B,{value:`private`,id:`publish-visibility-private`,"data-testid":`publish-visibility-private`})]})}),(0,Z.jsx)(Et,{htmlFor:`publish-visibility-public`,children:(0,Z.jsxs)(wt,{orientation:`horizontal`,children:[(0,Z.jsxs)(Tt,{children:[(0,Z.jsx)(Dt,{children:(0,Z.jsx)(g,{id:`7d1a0d`})}),(0,Z.jsx)(Ot,{className:`text-1sm`,children:(0,Z.jsx)(g,{id:`4jDd0j`})})]}),(0,Z.jsx)(B,{value:`public`,id:`publish-visibility-public`,"data-testid":`publish-visibility-public`})]})})]})]}),(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(z,{htmlFor:`publish-description`,children:(0,Z.jsx)(g,{id:`Fxf4jq`})}),(0,Z.jsx)(Ue,{id:`publish-description`,"data-testid":`publish-description`,rows:2,value:C,onChange:e=>w(e.target.value),placeholder:i({id:`c5rF4v`})})]}),L&&(0,Z.jsx)(va,{banner:L,onAuthorize:Te,onRetryPush:be})]}),(0,Z.jsxs)(A,{children:[(0,Z.jsx)(y,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:De,children:(0,Z.jsx)(g,{id:`dEgA5A`})}),(0,Z.jsx)(y,{type:`button`,onClick:be,disabled:Oe,"data-testid":`publish-submit`,children:F?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,Z.jsx)(g,{id:`Bdha5y`})]}):(0,Z.jsx)(g,{id:`EEYbdt`})})]})]})}),t[35]=i,t[36]=o,t[37]=L,t[38]=K,t[39]=C,t[40]=Te,t[41]=De,t[42]=Se,t[43]=be,t[44]=ue,t[45]=v,t[46]=N,t[47]=s,t[48]=d,t[49]=l,t[50]=W,t[51]=se,t[52]=m,t[53]=J,t[54]=te,t[55]=Oe,t[56]=F,t[57]=x,t[58]=Y):Y=t[58];let je;t[59]!==r||t[60]!==n||t[61]!==Y?(je=(0,Z.jsx)(M,{open:n,onOpenChange:r,children:Y}),t[59]=r,t[60]=n,t[61]=Y,t[62]=je):je=t[62];let Me;t[63]!==H||t[64]!==ye?(Me=(0,Z.jsx)(nn,{open:H,onOpenChange:U,onSuccess:ye}),t[63]=H,t[64]=ye,t[65]=Me):Me=t[65];let Ne;return t[66]!==je||t[67]!==Me?(Ne=(0,Z.jsxs)(Z.Fragment,{children:[je,Me]}),t[66]=je,t[67]=Me,t[68]=Ne):Ne=t[68],Ne}function pa(e){let t=`publish-owner-${e.login}`;return(0,Z.jsx)(Et,{htmlFor:t,children:(0,Z.jsxs)(wt,{orientation:`horizontal`,children:[(0,Z.jsx)(Tt,{children:(0,Z.jsxs)(Dt,{children:[e.avatarUrl?(0,Z.jsx)(`img`,{src:e.avatarUrl,alt:``,"aria-hidden":!0,className:`size-4 rounded-full`}):null,(0,Z.jsx)(`span`,{children:e.login})]})}),(0,Z.jsx)(B,{value:e.login,id:t,"data-testid":`publish-owner-option-${e.login}`})]})},e.login)}function ma(e){let t=(0,Q.c)(36),{ownerLogin:n,repoName:r,shareUrl:i,shareUrlError:a,copying:o,canCopy:s,onCopy:c,onClose:l}=e,{_:u}=_(),d=(0,X.useRef)(null),f,p;t[0]===i?(f=t[1],p=t[2]):(f=()=>{!i||!d.current||(d.current.focus(),d.current.select())},p=[i],t[0]=i,t[1]=f,t[2]=p),(0,X.useEffect)(f,p);let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(D,{children:(0,Z.jsx)(g,{id:`u3wRF-`})}),t[3]=m):m=t[3];let h;t[4]!==n||t[5]!==r?(h={ownerLogin:n,repoName:r},t[4]=n,t[5]=r,t[6]=h):h=t[6];let v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v={0:(0,Z.jsx)(`code`,{className:`font-mono`})},t[7]=v):v=t[7];let b;t[8]===h?b=t[9]:(b=(0,Z.jsxs)(j,{children:[m,(0,Z.jsx)(E,{children:(0,Z.jsx)(g,{id:`r871ed`,values:h,components:v})})]}),t[8]=h,t[9]=b);let x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(fe,{className:`mt-0.5 size-4 text-emerald-600`,"aria-hidden":!0}),t[10]=x):x=t[10];let S;t[11]===s?S=t[12]:(S=(0,Z.jsxs)(`div`,{role:`status`,"data-testid":`publish-success`,className:`flex items-start gap-3 rounded-md border border-emerald-500/40 bg-emerald-500/5 p-3 text-sm`,children:[x,(0,Z.jsx)(`span`,{className:`text-foreground`,children:s?(0,Z.jsx)(g,{id:`cOrTMo`}):(0,Z.jsx)(g,{id:`nTwL53`})})]}),t[11]=s,t[12]=S);let C;t[13]!==s||t[14]!==i||t[15]!==a?(C=s&&(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(z,{htmlFor:`publish-share-url`,children:(0,Z.jsx)(g,{id:`5-FeN2`})}),a?(0,Z.jsx)(`div`,{role:`alert`,"data-testid":`publish-share-url-error`,className:`rounded-md border border-destructive/50 bg-destructive/5 p-2 text-sm text-destructive`,children:a}):i?(0,Z.jsx)(Ae,{id:`publish-share-url`,ref:d,"data-testid":`publish-share-url`,readOnly:!0,value:i,onFocus:_a,onClick:ga,onContextMenu:ha,className:`font-mono text-xs`}):(0,Z.jsxs)(`div`,{"data-testid":`publish-share-url-loading`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(we,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,Z.jsx)(g,{id:`M9597s`})]})]}),t[13]=s,t[14]=i,t[15]=a,t[16]=C):C=t[16];let w;t[17]!==S||t[18]!==C?(w=(0,Z.jsxs)(k,{className:`flex flex-col gap-4`,children:[S,C]}),t[17]=S,t[18]=C,t[19]=w):w=t[19];let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(g,{id:`DPfwMq`}),t[20]=T):T=t[20];let O;t[21]===l?O=t[22]:(O=(0,Z.jsx)(y,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:l,"data-testid":`publish-success-done`,children:T}),t[21]=l,t[22]=O);let M;t[23]!==u||t[24]!==s||t[25]!==o||t[26]!==c||t[27]!==i?(M=s&&(0,Z.jsx)(y,{type:`button`,onClick:c,disabled:o||!i,"data-testid":`publish-copy-link`,"aria-label":u({id:`RGCCrg`}),children:o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,Z.jsx)(g,{id:`OvEjsP`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(be,{className:`size-3.5`,"aria-hidden":!0}),` `,(0,Z.jsx)(g,{id:`RGCCrg`})]})}),t[23]=u,t[24]=s,t[25]=o,t[26]=c,t[27]=i,t[28]=M):M=t[28];let N;t[29]!==O||t[30]!==M?(N=(0,Z.jsxs)(A,{children:[O,M]}),t[29]=O,t[30]=M,t[31]=N):N=t[31];let P;return t[32]!==w||t[33]!==N||t[34]!==b?(P=(0,Z.jsxs)(Z.Fragment,{children:[b,w,N]}),t[32]=w,t[33]=N,t[34]=b,t[35]=P):P=t[35],P}function ha(e){return e.currentTarget.select()}function ga(e){return e.currentTarget.select()}function _a(e){return e.currentTarget.select()}function va(e){let t=(0,Q.c)(13),{banner:n,onAuthorize:r,onRetryPush:i}=e,a=n.next,s;t[0]===n.message?s=t[1]:(s=(0,Z.jsx)(`span`,{children:n.message}),t[0]=n.message,t[1]=s);let c;t[2]!==a.authorizeUrl||t[3]!==a.kind||t[4]!==r?(c=a.kind===`authorize-org`&&(0,Z.jsxs)(y,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,"data-testid":`publish-authorize-org`,onClick:()=>r(a.authorizeUrl),children:[(0,Z.jsx)(g,{id:`FyW0WO`}),` `,(0,Z.jsx)(o,{className:`ml-1 size-3`,"aria-hidden":!0})]}),t[2]=a.authorizeUrl,t[3]=a.kind,t[4]=r,t[5]=c):c=t[5];let l;t[6]!==a.kind||t[7]!==i?(l=a.kind===`retry-push`&&(0,Z.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,"data-testid":`publish-retry-push`,onClick:i,children:(0,Z.jsx)(g,{id:`NOHyEE`})}),t[6]=a.kind,t[7]=i,t[8]=l):l=t[8];let u;return t[9]!==s||t[10]!==c||t[11]!==l?(u=(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`publish-banner`,className:`flex flex-col gap-2 rounded-md border border-destructive/50 bg-destructive/5 p-3 text-sm`,children:[s,c,l]}),t[9]=s,t[10]=c,t[11]=l,t[12]=u):u=t[12],u}function ya(e){let t=(0,Q.c)(12),{status:n}=e;if(n.kind===`available`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":`available`,className:`flex items-center gap-1 text-emerald-600 dark:text-emerald-400`,children:[e,` `,(0,Z.jsx)(g,{id:`csDS2L`})]}),t[1]=n):n=t[1],n}if(n.kind===`taken`){let{owner:e,name:r}=n,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),t[2]=i):i=t[2];let a;return t[3]!==r||t[4]!==e?(a=(0,Z.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":`taken`,className:`flex items-center gap-1 text-destructive`,children:[i,` `,(0,Z.jsx)(g,{id:`LRgZAt`,values:{owner:e,name:r}})]}),t[3]=r,t[4]=e,t[5]=a):a=t[5],a}if(n.kind===`checking`||n.kind===`pending`){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(we,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),t[6]=e):e=t[6];let r;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(g,{id:`pWT04I`}),t[7]=r):r=t[7];let i;return t[8]===n.kind?i=t[9]:(i=(0,Z.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":n.kind,className:`flex items-center gap-1 text-muted-foreground`,children:[e,` `,r]}),t[8]=n.kind,t[9]=i),i}if(n.kind===`error`){let e;return t[10]===n.banner?e=t[11]:(e=(0,Z.jsx)(`span`,{"data-testid":`publish-name-check`,"data-status":`error`,className:`text-destructive`,children:n.banner}),t[10]=n.banner,t[11]=e),e}return null}function ba(){oe(`sync`).catch(e=>{console.warn(`[sync-badge] manual sync trigger failed`,e instanceof Error?e.message:e)})}function xa(e){if(!e)return Y._({id:`Zul8Ry`});let t=Date.now()-new Date(e).getTime();if(t<6e4)return Y._({id:`xOTzt5`});if(t<36e5){let e=Math.floor(t/6e4);return Y._({id:`LNum6A`,values:{minutes:e}})}if(t<864e5){let e=Math.floor(t/36e5);return Y._({id:`nYeBmY`,values:{hours:e}})}return new Date(e).toLocaleDateString()}function Sa(e){let t=(0,Q.c)(9),{status:n}=e;switch(n.state){case`dormant`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ze,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Te,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ze,{className:`size-3.5 text-muted-foreground`}),t[2]=e):e=t[2],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Te,{className:`size-3.5 text-muted-foreground animate-spin`}),t[3]=e):e=t[3],e}case`conflict`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(De,{className:`size-3.5 text-amber-500`}),t[4]=e):e=t[4],e}case`offline`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Xe,{className:`size-3.5 text-muted-foreground`}),t[5]=e):e=t[5],e}case`auth-error`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(tt,{className:`size-3.5 text-destructive`}),t[6]=e):e=t[6],e}case`disabled`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(De,{className:`size-3.5 text-amber-500`}),t[7]=e):e=t[7],e}default:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ze,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function Ca(e){switch(e.state){case`idle`:return e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function wa(e){switch(e){case`dormant`:return Y._({id:`RmBY0A`});case`idle`:return Y._({id:`N2FcBE`});case`fetching`:return Y._({id:`Wgmlsw`});case`pulling`:return Y._({id:`4uNLmk`});case`pushing`:return Y._({id:`iycx_A`});case`conflict`:return Y._({id:`IInnZo`});case`offline`:return Y._({id:`6Aih4U`});case`auth-error`:return Y._({id:`mHVPm5`});case`disabled`:return Y._({id:`DrYM2Z`});default:return e}}function Ta(e){switch(e){case`external-changes-pending`:return Y._({id:`W9_Bub`});case`dirty-tree`:return Y._({id:`a5Gha5`});case`non-content-merge-failure`:return Y._({id:`sIxSSP`});case`detached-head`:return Y._({id:`uQNW00`});case`auth-error`:return Y._({id:`mHVPm5`});case`protected-branch`:return Y._({id:`8fc_3j`});case`no-push-permission`:return Y._({id:`ChAtFg`});default:return e}}function Ea(e){switch(e){case`no-collaborator`:return Y._({id:`ChAtFg`});case`private-no-access`:return Y._({id:`07gHun`});case`repo-not-found`:return Y._({id:`uksqrP`});default:return Y._({id:`ChAtFg`})}}function Da(e){switch(e){case`auth-403`:return Y._({id:`EiVgl5`});case`auth-401`:return Y._({id:`-Qw-1t`});case`auth-scope-mismatch`:return Y._({id:`Zue_jx`});case`auth-no-credential`:return Y._({id:`uCaIdy`});case`semantic-protected-branch`:return Y._({id:`T0OVm7`});default:return Y._({id:`1AumWo`})}}function Oa(e){switch(e){case`auth-403`:return Y._({id:`RgbKEe`});case`auth-401`:return Y._({id:`-Qw-1t`});case`auth-scope-mismatch`:return Y._({id:`Zue_jx`});case`auth-no-credential`:return Y._({id:`uCaIdy`});default:return Y._({id:`jZ_E5M`})}}function ka(e){switch(e){case`auth-403`:return Y._({id:`RgbKEe`});case`auth-401`:return Y._({id:`-Qw-1t`});case`auth-scope-mismatch`:return Y._({id:`Zue_jx`});case`auth-no-credential`:return Y._({id:`uCaIdy`});case`semantic-protected-branch`:return Y._({id:`T0OVm7`});default:return Y._({id:`cUk6TF`})}}function Aa(e){let t=e.pushErrorCode!=null||e.pushError!=null,n=e.pullErrorCode!=null||e.pullError!=null;if(t&&n&&(e.pushErrorCode==null?e.pullErrorCode==null&&e.pushError===e.pullError:e.pushErrorCode===e.pullErrorCode))return[{key:`sync`,direction:null,message:e.pushErrorCode==null?e.pushError:ka(e.pushErrorCode)}];let r=t&&n,i=[];return t&&i.push({key:`push`,direction:r?`push`:null,message:e.pushErrorCode?Da(e.pushErrorCode):e.pushError}),n&&i.push({key:`pull`,direction:r?`pull`:null,message:e.pullErrorCode?Oa(e.pullErrorCode):e.pullError}),i}function ja(e){return e?.checkStatus===`unknown`&&e.unknownError===`token-invalid`}function Ma(e,t){return!e||t===`denied`}function Na(e){if(!e.syncEnabled)return Y._({id:`kUn-CN`});if(e.state===`idle`){let{ahead:t,behind:n}=e;return t>0&&n>0?Y._({id:`5F5HYj`,values:{ahead:t,behind:n}}):t>0?Y._({id:`PdA9NZ`,values:{ahead:t}}):n>0?Y._({id:`9o1bIV`,values:{behind:n}}):Y._({id:`N2FcBE`})}if(e.state===`conflict`&&e.conflictCount>0){let{conflictCount:t}=e;return Y._({id:`cUK8lW`,values:{conflictCount:t}})}return wa(e.state)}function Pa(e){let t=(0,Q.c)(97),{status:n,onSignIn:r,onSetIdentity:i}=e,{_:a}=_(),{ahead:o,behind:s,conflictCount:c}=n,{projectLocalConfig:l,projectLocalSynced:u}=ze(),d=l?.autoSync?.enabled??!1,f;t[0]===n.lastSyncUtc?f=t[1]:(f=xa(n.lastSyncUtc),t[0]=n.lastSyncUtc,t[1]=f);let p=f,{confirmOpen:m,setConfirmOpen:v,onToggleRequest:b,onConfirm:x}=se(ie()),{conflicts:S}=or(),C=S[0]??null,w;t[2]===n?w=t[3]:(w=(0,Z.jsx)(Sa,{status:n}),t[2]=n,t[3]=w);let T;t[4]===n.state?T=t[5]:(T=wa(n.state),t[4]=n.state,t[5]=T);let E;t[6]===T?E=t[7]:(E=(0,Z.jsx)(`span`,{className:`text-1sm font-medium truncate`,children:T}),t[6]=T,t[7]=E);let D;t[8]!==w||t[9]!==E?(D=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[w,E]}),t[8]=w,t[9]=E,t[10]=D):D=t[10];let O=n.pushPermission?.checkStatus,k;t[11]!==u||t[12]!==O?(k=Ma(u,O),t[11]=u,t[12]=O,t[13]=k):k=t[13];let A;t[14]!==a||t[15]!==d||t[16]!==n.pushPermission?.checkStatus?(A=n.pushPermission?.checkStatus===`denied`?a({id:`FnMkli`}):a(d?{id:`lIn9L9`}:{id:`wbwHYD`}),t[14]=a,t[15]=d,t[16]=n.pushPermission?.checkStatus,t[17]=A):A=t[17];let j;t[18]!==d||t[19]!==b||t[20]!==k||t[21]!==A?(j=(0,Z.jsx)(h,{checked:d,disabled:k,onCheckedChange:b,"aria-label":A}),t[18]=d,t[19]=b,t[20]=k,t[21]=A,t[22]=j):j=t[22];let M;t[23]!==D||t[24]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[D,j]}),t[23]=D,t[24]=j,t[25]=M):M=t[25];let N;t[26]!==m||t[27]!==x||t[28]!==v?(N=(0,Z.jsx)(ce,{open:m,onOpenChange:v,onConfirm:x}),t[26]=m,t[27]=x,t[28]=v,t[29]=N):N=t[29];let P;if(t[30]!==a||t[31]!==n){let e;t[33]===a?e=t[34]:(e=e=>(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:e.direction===`push`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`font-medium`,children:[a({id:`uO9WLl`}),`: `]}),e.message]}):e.direction===`pull`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`font-medium`,children:[a({id:`e4GHWP`}),`: `]}),e.message]}):e.message},e.key),t[33]=a,t[34]=e),P=Aa(n).map(e),t[30]=a,t[31]=n,t[32]=P}else P=t[32];let F;t[35]!==r||t[36]!==n.pausedReason||t[37]!==n.pushPermission?(F=n.pausedReason?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:Ta(n.pausedReason)}):n.pushPermission?.checkStatus===`denied`?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:Ea(n.pushPermission.deniedReason)}):ja(n.pushPermission)?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground flex-1 min-w-0`,children:(0,Z.jsx)(g,{id:`C_cPoW`})}),r&&(0,Z.jsx)(y,{variant:`outline`,size:`xs`,className:`self-start`,onClick:r,children:(0,Z.jsx)(g,{id:`5lWFkC`})})]}):null,t[35]=r,t[36]=n.pausedReason,t[37]=n.pushPermission,t[38]=F):F=t[38];let I;t[39]===n.state?I=t[40]:(I=n.state===`conflict`&&(0,Z.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(g,{id:`t2TkQ3`})}),t[39]=n.state,t[40]=I);let L;t[41]!==a||t[42]!==n.remote?(L=n.remote&&(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,Z.jsx)(g,{id:`IreQBq`})}),n.remote.webUrl?(0,Z.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-0.5 text-foreground hover:text-primary hover:underline`,"aria-label":a({id:`1nke1r`,values:{0:n.remote.label}}),children:[(0,Z.jsx)(`span`,{className:`truncate`,children:n.remote.label}),(0,Z.jsx)(le,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:n.remote.label})]}),t[41]=a,t[42]=n.remote,t[43]=L):L=t[43];let R;t[44]!==d||t[45]!==p||t[46]!==n.state?(R=d&&n.state!==`dormant`&&(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,Z.jsx)(g,{id:`uWx2ZP`})}),(0,Z.jsx)(`span`,{className:`text-foreground`,children:p})]}),t[44]=d,t[45]=p,t[46]=n.state,t[47]=R):R=t[47];let z;t[48]!==o||t[49]!==n.ahead?(z=n.ahead>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(g,{id:`iTlqm3`,values:{ahead:o}})}),t[48]=o,t[49]=n.ahead,t[50]=z):z=t[50];let B;t[51]!==s||t[52]!==n.behind?(B=n.behind>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(g,{id:`YsEYYS`,values:{behind:s}})}),t[51]=s,t[52]=n.behind,t[53]=B):B=t[53];let V;t[54]!==c||t[55]!==n.conflictCount?(V=n.conflictCount>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(g,{id:`B4_ipX`,values:{conflictCount:c}})}),t[54]=c,t[55]=n.conflictCount,t[56]=V):V=t[56];let H;t[57]===d?H=t[58]:(H=!d&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(g,{id:`Wt5W56`})}),t[57]=d,t[58]=H);let U;t[59]!==L||t[60]!==R||t[61]!==z||t[62]!==B||t[63]!==V||t[64]!==H?(U=(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-2`,children:[L,R,z,B,V,H]}),t[59]=L,t[60]=R,t[61]=z,t[62]=B,t[63]=V,t[64]=H,t[65]=U):U=t[65];let W;t[66]!==i||t[67]!==n.identityUnresolved?(W=n.identityUnresolved&&i&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Z.jsx)(it,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:(0,Z.jsx)(g,{id:`nrGWJ7`})}),(0,Z.jsx)(y,{variant:`outline`,size:`xs`,className:`self-start`,onClick:i,children:(0,Z.jsx)(g,{id:`keNFEd`})})]})]}),t[66]=i,t[67]=n.identityUnresolved,t[68]=W):W=t[68];let G;t[69]!==d||t[70]!==n.state?(G=d&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Z.jsx)(y,{variant:`outline`,size:`xs`,onClick:ba,children:(0,Z.jsx)(g,{id:`lb_UU4`})}),t[69]=d,t[70]=n.state,t[71]=G):G=t[71];let K;t[72]!==d||t[73]!==r||t[74]!==n.state?(K=d&&n.state===`auth-error`&&(0,Z.jsx)(y,{variant:`outline`,size:`xs`,onClick:r,children:(0,Z.jsx)(g,{id:`3jod3l`})}),t[72]=d,t[73]=r,t[74]=n.state,t[75]=K):K=t[75];let q;t[76]!==d||t[77]!==n.state?(q=d&&n.state===`offline`&&(0,Z.jsx)(y,{variant:`outline`,size:`xs`,onClick:ba,children:(0,Z.jsx)(g,{id:`6gRgw8`})}),t[76]=d,t[77]=n.state,t[78]=q):q=t[78];let J;t[79]!==d||t[80]!==C||t[81]!==n.state?(J=d&&n.state===`conflict`&&C&&(0,Z.jsx)(y,{variant:`outline`,size:`xs`,onClick:()=>{if(typeof window>`u`)return;let e=Re(Ie(C.file));window.location.hash!==e&&(window.location.hash=e)},children:(0,Z.jsx)(g,{id:`0yL--g`})}),t[79]=d,t[80]=C,t[81]=n.state,t[82]=J):J=t[82];let ee;t[83]!==G||t[84]!==K||t[85]!==q||t[86]!==J?(ee=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[G,K,q,J]}),t[83]=G,t[84]=K,t[85]=q,t[86]=J,t[87]=ee):ee=t[87];let te;return t[88]!==M||t[89]!==N||t[90]!==P||t[91]!==F||t[92]!==I||t[93]!==U||t[94]!==W||t[95]!==ee?(te=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[M,N,P,F,I,U,W,ee]}),t[88]=M,t[89]=N,t[90]=P,t[91]=F,t[92]=I,t[93]=U,t[94]=W,t[95]=ee,t[96]=te):te=t[96],te}function Fa(e){let t=(0,Q.c)(69),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onSetIdentity:i}=n,{_:a}=_(),{status:o,fetchError:s}=ae();if(!o){if(s){let e;t[2]===a?e=t[3]:(e=a({id:`iqIDv4`}),t[2]=a,t[3]=e);let n;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Xe,{className:`size-3.5`}),t[4]=n):n=t[4];let r;t[5]===e?r=t[6]:(r=(0,Z.jsx)(C,{asChild:!0,children:(0,Z.jsx)(y,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":e,disabled:!0,children:n})}),t[5]=e,t[6]=r);let i;t[7]===s?i=t[8]:(i=(0,Z.jsx)(w,{children:s===`network`?(0,Z.jsx)(g,{id:`I5AfhE`}):(0,Z.jsx)(g,{id:`uKRYiW`})}),t[7]=s,t[8]=i);let o;return t[9]!==r||t[10]!==i?(o=(0,Z.jsxs)(T,{children:[r,i]}),t[9]=r,t[10]=i,t[11]=o):o=t[11],o}return null}if(o.state===`dormant`&&!o.hasRemote||o.state===`disabled`&&!o.pausedReason)return null;let c;t[12]===o?c=t[13]:(c=Ca(o),t[12]=o,t[13]=c);let l=c,p,m,h,v,b,x,S,E,D,O,k,A;if(t[14]!==a||t[15]!==o.identityUnresolved||t[16]!==o.state){let e=wa(o.state);x=!!o.identityUnresolved,b=d,v=T,h=C,A=!0,m=f,k=!0,p=y,S=`ghost`,E=`icon-sm`,D=`text-muted-foreground relative`,O=a(x?{id:`DFfRbX`,values:{syncStateLabel:e}}:{id:`F4vEsL`,values:{syncStateLabel:e}}),t[14]=a,t[15]=o.identityUnresolved,t[16]=o.state,t[17]=p,t[18]=m,t[19]=h,t[20]=v,t[21]=b,t[22]=x,t[23]=S,t[24]=E,t[25]=D,t[26]=O,t[27]=k,t[28]=A}else p=t[17],m=t[18],h=t[19],v=t[20],b=t[21],x=t[22],S=t[23],E=t[24],D=t[25],O=t[26],k=t[27],A=t[28];let j;t[29]===o?j=t[30]:(j=(0,Z.jsx)(Sa,{status:o}),t[29]=o,t[30]=j);let M;t[31]===l?M=t[32]:(M=l&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:l}),t[31]=l,t[32]=M);let N;t[33]!==l||t[34]!==x?(N=!l&&x&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[33]=l,t[34]=x,t[35]=N):N=t[35];let P;t[36]!==p||t[37]!==M||t[38]!==N||t[39]!==S||t[40]!==E||t[41]!==D||t[42]!==O||t[43]!==j?(P=(0,Z.jsxs)(p,{variant:S,size:E,className:D,"aria-label":O,children:[j,M,N]}),t[36]=p,t[37]=M,t[38]=N,t[39]=S,t[40]=E,t[41]=D,t[42]=O,t[43]=j,t[44]=P):P=t[44];let F;t[45]!==m||t[46]!==P||t[47]!==k?(F=(0,Z.jsx)(m,{asChild:k,children:P}),t[45]=m,t[46]=P,t[47]=k,t[48]=F):F=t[48];let I;t[49]!==h||t[50]!==F||t[51]!==A?(I=(0,Z.jsx)(h,{asChild:A,children:F}),t[49]=h,t[50]=F,t[51]=A,t[52]=I):I=t[52];let L;t[53]===o?L=t[54]:(L=Na(o),t[53]=o,t[54]=L);let R;t[55]===L?R=t[56]:(R=(0,Z.jsx)(w,{children:L}),t[55]=L,t[56]=R);let z;t[57]!==v||t[58]!==I||t[59]!==R?(z=(0,Z.jsxs)(v,{children:[I,R]}),t[57]=v,t[58]=I,t[59]=R,t[60]=z):z=t[60];let B;t[61]!==i||t[62]!==r||t[63]!==o?(B=(0,Z.jsx)(u,{align:`end`,className:`w-64 p-3`,children:(0,Z.jsx)(Pa,{status:o,onSignIn:r,onSetIdentity:i})}),t[61]=i,t[62]=r,t[63]=o,t[64]=B):B=t[64];let V;return t[65]!==b||t[66]!==z||t[67]!==B?(V=(0,Z.jsxs)(b,{children:[z,B]}),t[65]=b,t[66]=z,t[67]=B,t[68]=V):V=t[68],V}function Ia(){let e=(0,Q.c)(3),{projectLocalConfig:t,projectLocalSynced:n}=ze(),r=t?.terminal?.enabled??null,i;return e[0]!==n||e[1]!==r?(i={enabled:r,synced:n},e[0]=n,e[1]=r,e[2]=i):i=e[2],i}function La(){let e=(0,Q.c)(2),{projectLocalBinding:t}=ze();if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=e=>{let n=t.patch({terminal:{enabled:e}});return n.ok&&e&&Lt(),n.ok?{ok:!0}:{ok:!1,error:q(n.error)}},e[0]=t,e[1]=n),n}function Ra(e){let t=e.trim();return t.length===0?{kind:`blank`,raw:e}:t.startsWith(`#`)?{kind:`comment`,raw:e}:{kind:`pattern`,raw:e,text:t}}function za(e){return{lines:e.split(`
|
|
10
|
-
`).map(Ra)}}function Ba(e){return e.lines.map(e=>e.raw).join(`
|
|
11
|
-
`)}function Va(e){return e.lines.filter(e=>e.kind===`pattern`)}function Ha(e,t){let n=t.trim();if(n.length===0)return e;for(let t of e.lines)if(t.kind===`pattern`&&t.text===n)return e;let r={kind:`pattern`,raw:n,text:n},i=e.lines.slice(),a=i[i.length-1];return a&&a.kind===`blank`&&a.raw===``?i.splice(i.length-1,0,r):i.push(r,{kind:`blank`,raw:``}),{lines:i}}function Ua(e,t){let n=t.trim();if(n.length===0)return-1;let r=0;for(let t of e.lines)if(t.kind===`pattern`){if(t.text===n)return r;r++}return-1}function Wa(e,t,n){let r=n.trim();if(r.length===0)return Ga(e,t);let i=qa(e,t);if(i<0)return e;let a=e.lines.slice();return a[i]={kind:`pattern`,raw:r,text:r},{lines:a}}function Ga(e,t){let n=qa(e,t);if(n<0)return e;let r=e.lines.slice();return r.splice(n,1),{lines:r}}function Ka(e,t,n){if(t===n)return e;let r=[],i=[];if(e.lines.forEach((e,t)=>{e.kind===`pattern`&&(r.push(t),i.push(e))}),t<0||t>=i.length||n<0||n>=i.length)return e;let a=i.slice(),[o]=a.splice(t,1);if(!o)return e;a.splice(n,0,o);let s=e.lines.slice();return r.forEach((e,t)=>{let n=a[t];n&&(s[e]=n)}),{lines:s}}function qa(e,t){if(t<0)return-1;let n=0;for(let r=0;r<e.lines.length;r++)if(e.lines[r]?.kind===`pattern`){if(n===t)return r;n++}return-1}function Ja(e){let t=(0,Q.c)(11),{defaultScope:n,open:r,onOpenChange:i,onCreated:a}=e,o;t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r?(o=r?(0,Z.jsx)(Ya,{defaultScope:n,onOpenChange:i,onCreated:a}):null,t[0]=n,t[1]=a,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===o?s=t[6]:(s=(0,Z.jsx)(O,{className:`sm:max-w-2xl`,children:o}),t[5]=o,t[6]=s);let c;return t[7]!==i||t[8]!==r||t[9]!==s?(c=(0,Z.jsx)(M,{open:r,onOpenChange:i,children:s}),t[7]=i,t[8]=r,t[9]=s,t[10]=c):c=t[10],c}function Ya(e){let t=(0,Q.c)(97),{defaultScope:n,onOpenChange:r,onCreated:o}=e,{_:s}=_(),u=(0,X.useId)(),d=(0,X.useId)(),f=(0,X.useId)(),p=ve(),h=pe(),v;t[0]!==h.data||t[1]!==h.status?(v=h.status===`ready`?h.data:[],t[0]=h.data,t[1]=h.status,t[2]=v):v=t[2];let b=_e(v),[x,S]=(0,X.useState)(n),[C,w]=(0,X.useState)(``),[T,O]=(0,X.useState)(``),[M,N]=(0,X.useState)(!1),[P,F]=(0,X.useState)(!1),I=C.trim(),R=I===``||!W.test(I),B=!R&&b[x].has(I),V=!P&&!R&&!B,H;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){return e.toLowerCase().replace(/[^a-z0-9-]+/g,`-`).replace(/-{2,}/g,`-`).replace(/^-+/,``)},t[3]=H):H=t[3];let U=H,G;t[4]!==s||t[5]!==V||t[6]!==T||t[7]!==o||t[8]!==r||t[9]!==x||t[10]!==F||t[11]!==N||t[12]!==I?(G=async function(){if(!V){N(!0);return}F(!0);let e=await L({scope:x,name:I,frontmatter:{name:I,description:T.trim()},body:``});if(F(!1),!e.ok){ke.error(s({id:`xrVr_k`,values:{0:e.error}}));return}ke.success(s({id:`UMrOy2`,values:{trimmedName:I}})),o({scope:x,name:I}),r(!1)},t[4]=s,t[5]=V,t[6]=T,t[7]=o,t[8]=r,t[9]=x,t[10]=F,t[11]=N,t[12]=I,t[13]=G):G=t[13];let K=G,q=M&&(R||B),J;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(D,{children:(0,Z.jsx)(g,{id:`MdpSC1`})}),t[14]=J):J=t[14];let ee;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsxs)(j,{children:[J,(0,Z.jsx)(E,{children:(0,Z.jsx)(g,{id:`mY8U64`})})]}),t[15]=ee):ee=t[15];let te;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(g,{id:`aBgwis`}),t[16]=te):te=t[16];let ne;t[17]===f?ne=t[18]:(ne=(0,Z.jsx)(z,{htmlFor:f,children:te}),t[17]=f,t[18]=ne);let re;t[19]===S?re=t[20]:(re=e=>S(e),t[19]=S,t[20]=re);let ie;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(a,{}),t[21]=ie):ie=t[21];let ae;t[22]===f?ae=t[23]:(ae=(0,Z.jsx)(l,{id:f,size:`sm`,className:`w-48`,children:ie}),t[22]=f,t[23]=ae);let oe;t[24]===p?oe=t[25]:(oe=ge.map(e=>(0,Z.jsx)(m,{value:e,children:p[e]},e)),t[24]=p,t[25]=oe);let se;t[26]===oe?se=t[27]:(se=(0,Z.jsx)(i,{children:oe}),t[26]=oe,t[27]=se);let ce;t[28]!==x||t[29]!==ae||t[30]!==se||t[31]!==re?(ce=(0,Z.jsxs)(c,{value:x,onValueChange:re,children:[ae,se]}),t[28]=x,t[29]=ae,t[30]=se,t[31]=re,t[32]=ce):ce=t[32];let le;t[33]!==ce||t[34]!==ne?(le=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[ne,ce]}),t[33]=ce,t[34]=ne,t[35]=le):le=t[35];let ue;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(g,{id:`6YtxFj`}),t[36]=ue):ue=t[36];let de;t[37]===u?de=t[38]:(de=(0,Z.jsx)(z,{htmlFor:u,children:ue}),t[37]=u,t[38]=de);let fe;t[39]===w?fe=t[40]:(fe=e=>w(U(e.target.value)),t[39]=w,t[40]=fe);let me;t[41]!==w||t[42]!==N?(me=()=>{N(!0),w(Za)},t[41]=w,t[42]=N,t[43]=me):me=t[43];let he;t[44]===K?he=t[45]:(he=e=>{e.key===`Enter`&&K()},t[44]=K,t[45]=he);let ye;t[46]!==C||t[47]!==u||t[48]!==q||t[49]!==fe||t[50]!==me||t[51]!==he?(ye=(0,Z.jsx)(Ae,{id:u,"data-testid":`skill-name-input`,value:C,onChange:fe,onBlur:me,onKeyDown:he,"aria-invalid":q,className:`font-mono`}),t[46]=C,t[47]=u,t[48]=q,t[49]=fe,t[50]=me,t[51]=he,t[52]=ye):ye=t[52];let be;t[53]!==B||t[54]!==q?(be=q?(0,Z.jsx)(`p`,{className:`text-[11px] text-destructive`,children:B?(0,Z.jsx)(g,{id:`jX0IPx`}):(0,Z.jsx)(g,{id:`v7hK0U`})}):(0,Z.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:(0,Z.jsx)(g,{id:`1hvhf0`})}),t[53]=B,t[54]=q,t[55]=be):be=t[55];let xe;t[56]!==de||t[57]!==ye||t[58]!==be?(xe=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[de,ye,be]}),t[56]=de,t[57]=ye,t[58]=be,t[59]=xe):xe=t[59];let Se;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(g,{id:`Nu4oKW`}),t[60]=Se):Se=t[60];let Ce;t[61]===d?Ce=t[62]:(Ce=(0,Z.jsx)(z,{htmlFor:d,children:Se}),t[61]=d,t[62]=Ce);let we;t[63]===O?we=t[64]:(we=e=>O(e.target.value),t[63]=O,t[64]=we);let Te;t[65]!==T||t[66]!==d||t[67]!==we?(Te=(0,Z.jsx)(Ue,{id:d,"data-testid":`skill-description-input`,value:T,onChange:we,className:`min-h-16 resize-none`}),t[65]=T,t[66]=d,t[67]=we,t[68]=Te):Te=t[68];let Ee;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:(0,Z.jsx)(g,{id:`6EKG_c`})}),t[69]=Ee):Ee=t[69];let De;t[70]!==Ce||t[71]!==Te?(De=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[Ce,Te,Ee]}),t[70]=Ce,t[71]=Te,t[72]=De):De=t[72];let Oe;t[73]!==le||t[74]!==xe||t[75]!==De?(Oe=(0,Z.jsxs)(k,{className:`flex flex-col gap-4`,children:[le,xe,De]}),t[73]=le,t[74]=xe,t[75]=De,t[76]=Oe):Oe=t[76];let Y;t[77]===r?Y=t[78]:(Y=()=>r(!1),t[77]=r,t[78]=Y);let je;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsx)(g,{id:`dEgA5A`}),t[79]=je):je=t[79];let Me;t[80]!==P||t[81]!==Y?(Me=(0,Z.jsx)(y,{variant:`outline`,className:`font-mono uppercase`,onMouseDown:Xa,onClick:Y,disabled:P,children:je}),t[80]=P,t[81]=Y,t[82]=Me):Me=t[82];let Ne;t[83]===K?Ne=t[84]:(Ne=()=>void K(),t[83]=K,t[84]=Ne);let Pe=!V,Fe;t[85]===P?Fe=t[86]:(Fe=P?(0,Z.jsx)(g,{id:`E9bKSA`}):(0,Z.jsx)(g,{id:`-r_Kx7`}),t[85]=P,t[86]=Fe);let Ie;t[87]!==Ne||t[88]!==Pe||t[89]!==Fe?(Ie=(0,Z.jsx)(y,{"data-testid":`skill-create-button`,onClick:Ne,disabled:Pe,children:Fe}),t[87]=Ne,t[88]=Pe,t[89]=Fe,t[90]=Ie):Ie=t[90];let Le;t[91]!==Me||t[92]!==Ie?(Le=(0,Z.jsxs)(A,{children:[Me,Ie]}),t[91]=Me,t[92]=Ie,t[93]=Le):Le=t[93];let Re;return t[94]!==Oe||t[95]!==Le?(Re=(0,Z.jsxs)(Z.Fragment,{children:[ee,Oe,Le]}),t[94]=Oe,t[95]=Le,t[96]=Re):Re=t[96],Re}function Xa(e){return e.preventDefault()}function Za(e){return e.replace(/-+$/,``)}function Qa(e){let t=(0,Q.c)(16),{installed:n,className:r,subtle:i}=e,a=i===void 0?!1:i,o=n?`skill-state-installed`:`skill-state-draft`;if(a){let e=n?`text-primary/80`:`text-muted-foreground/70`,i;t[0]!==r||t[1]!==e?(i=x(`text-2xs`,e,r),t[0]=r,t[1]=e,t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=n?(0,Z.jsx)(g,{id:`eQkgKV`}):(0,Z.jsx)(g,{id:`eneWvv`}),t[3]=n,t[4]=a);let s;return t[5]!==i||t[6]!==a||t[7]!==o?(s=(0,Z.jsx)(`span`,{className:i,"data-testid":o,children:a}),t[5]=i,t[6]=a,t[7]=o,t[8]=s):s=t[8],s}let s=n?`primary`:`warning`,c;t[9]===n?c=t[10]:(c=n?(0,Z.jsx)(g,{id:`eQkgKV`}):(0,Z.jsx)(g,{id:`eneWvv`}),t[9]=n,t[10]=c);let l;return t[11]!==r||t[12]!==s||t[13]!==c||t[14]!==o?(l=(0,Z.jsx)(de,{variant:s,className:r,"data-testid":o,children:c}),t[11]=r,t[12]=s,t[13]=c,t[14]=o,t[15]=l):l=t[15],l}var $a=`npx @inkeep/open-knowledge cowork`,eo=`https://openknowledge.ai/docs/integrations/claude-code`;function to(){return typeof window<`u`&&typeof window.okDesktop?.skill==`object`}function no(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.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 ro(e){let t=(0,Q.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=x(`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,Z.jsx)(`p`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function io(e){let t=(0,Q.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,Z.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 ao(){let e=(0,Q.c)(8),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(ro,{children:(0,Z.jsx)(g,{id:`cIptmH`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(io,{n:1}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`li`,{className:`flex gap-3`,children:[n,(0,Z.jsx)(`span`,{children:(0,Z.jsx)(g,{id:`pHYP6v`,components:{0:(0,Z.jsx)(`strong`,{className:`font-medium`}),1:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),2:(0,Z.jsx)(`strong`,{className:`font-medium`})}})})]}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(io,{n:2}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`li`,{className:`flex gap-3`,children:[i,(0,Z.jsx)(`span`,{children:(0,Z.jsx)(g,{id:`gGVP4q`,components:{0:(0,Z.jsx)(`span`,{className:`inline-flex items-center justify-center font-medium border h-5 w-5 rounded-md text-xs`}),1:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),2:(0,Z.jsx)(`strong`,{className:`font-medium`}),3:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),4:(0,Z.jsx)(`strong`,{className:`font-medium`})}})})]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(io,{n:3}),e[5]=o):o=e[5];let s;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`ol`,{className:`flex flex-col gap-4 text-sm`,children:[r,a,(0,Z.jsxs)(`li`,{className:`flex gap-3`,children:[o,(0,Z.jsx)(`span`,{children:(0,Z.jsx)(g,{id:`COr1Y7`,components:{0:(0,Z.jsx)(no,{}),1:(0,Z.jsx)(`strong`,{className:`font-medium`})}})})]})]}),e[6]=s):s=e[6];let c;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t,s,(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground mt-4`,children:(0,Z.jsx)(g,{id:`kV2YZv`,components:{0:(0,Z.jsx)(`strong`,{className:`font-medium`}),1:(0,Z.jsx)(`strong`,{className:`font-medium`}),2:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),3:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`})}})})]}),e[7]=c):c=e[7],c}function oo(e){let t=(0,Q.c)(74),{open:n,onOpenChange:r,reinstall:i}=e,a=i===void 0?!1:i,{_:o}=_(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={kind:`idle`},t[0]=s):s=t[0];let[c,l]=(0,X.useState)(s),[u,d]=(0,X.useState)(!1),f,p;t[1]===n?(f=t[2],p=t[3]):(f=()=>{n||(l({kind:`idle`}),d(!1))},p=[n],t[1]=n,t[2]=f,t[3]=p),(0,X.useEffect)(f,p);let m;t[4]===o?m=t[5]:(m=async function(){l({kind:`downloading`});let e=window.okDesktop?.skill;if(!e){l({kind:`error`,message:o({id:`y46m5r`})});return}let t=await e.buildAndOpen();if(t.ok)l({kind:`handed-off`,path:t.path});else{let e=t.message??t.reason;ke.error(o({id:`hSySVc`,values:{msg:e}})),l({kind:`error`,message:t.reason===`open-failed`?o({id:`IA1wNb`,values:{msg:e}}):`${t.reason}: ${e}`})}},t[4]=o,t[5]=m);let h=m,v;t[6]===o?v=t[7]:(v=async function(){try{await navigator.clipboard.writeText($a),d(!0),setTimeout(()=>d(!1),2e3)}catch(e){let t=e,n=t instanceof Error?t.message:String(t);ke.error(o({id:`Uw6ERJ`,values:{detail:n}}))}},t[6]=o,t[7]=v);let b=v,x;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(x=to(),t[8]=x):x=t[8];let S=x,C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Qe,{"aria-hidden":`true`,className:`h-4 w-4`}),t[9]=C):C=t[9];let w;t[10]===a?w=t[11]:(w=(0,Z.jsxs)(D,{className:`flex items-center gap-2`,children:[C,a?(0,Z.jsx)(g,{id:`xNyj3h`}):(0,Z.jsx)(g,{id:`7qRHf0`})]}),t[10]=a,t[11]=w);let T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(E,{children:(0,Z.jsx)(g,{id:`9V0W-R`,components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}})}),t[12]=T):T=t[12];let N;t[13]===w?N=t[14]:(N=(0,Z.jsxs)(j,{children:[w,T]}),t[13]=w,t[14]=N);let P;t[15]===c.kind?P=t[16]:(P=c.kind===`idle`&&S&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(ro,{className:`text-muted-foreground`,children:(0,Z.jsx)(g,{id:`Dnn2XG`})}),(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(g,{id:`RN62Q8`,components:{0:(0,Z.jsx)(no,{}),1:(0,Z.jsx)(no,{})}})})]}),(0,Z.jsx)(ao,{})]}),t[15]=c.kind,t[16]=P);let F;t[17]!==o||t[18]!==u||t[19]!==b||t[20]!==c.kind?(F=c.kind===`idle`&&!S&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(ro,{children:(0,Z.jsx)(g,{id:`L8fKuc`})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border bg-muted/40 p-2`,children:[(0,Z.jsx)(`code`,{className:`flex-1 font-mono text-xs`,children:$a}),(0,Z.jsx)(y,{variant:`ghost`,size:`sm`,onClick:b,"aria-label":o({id:`Oos8fo`}),className:`h-7 gap-1`,children:u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(fe,{"aria-hidden":`true`,className:`h-3 w-3`}),(0,Z.jsx)(g,{id:`6V3Ea3`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(be,{"aria-hidden":`true`,className:`h-3 w-3`}),(0,Z.jsx)(g,{id:`he3ygx`})]})})]}),(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(g,{id:`z60Lgn`,components:{0:(0,Z.jsx)(no,{})}})})]}),(0,Z.jsx)(ao,{})]}),t[17]=o,t[18]=u,t[19]=b,t[20]=c.kind,t[21]=F):F=t[21];let I;t[22]===c.kind?I=t[23]:(I=c.kind===`downloading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,Z.jsx)(we,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(g,{id:`bwil08`,components:{0:(0,Z.jsx)(no,{})}})]}),t[22]=c.kind,t[23]=I);let L;t[24]!==c.kind||t[25]!==c.path?(L=c.kind===`handed-off`&&S&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,Z.jsx)(fe,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,Z.jsx)(g,{id:`r51jLC`})}),(0,Z.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground`,children:c.path??`~/Downloads/openknowledge.skill`})]})]}),(0,Z.jsx)(ao,{})]}),t[24]=c.kind,t[25]=c.path,t[26]=L):L=t[26];let R;t[27]===c.kind?R=t[28]:(R=c.kind===`handed-off`&&!S&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,Z.jsx)(fe,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,Z.jsx)(g,{id:`hynz2K`})}),(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(g,{id:`qXg5W9`,components:{0:(0,Z.jsx)(no,{})}})})]})]}),(0,Z.jsx)(ao,{})]}),t[27]=c.kind,t[28]=R);let z;t[29]!==c.kind||t[30]!==c.message?(z=c.kind===`error`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Z.jsx)(`span`,{className:`text-destructive`,children:c.message}),(0,Z.jsx)(`a`,{href:eo,target:`_blank`,rel:`noopener noreferrer`,onClick:uo,onAuxClick:lo,className:`text-xs underline underline-offset-2 hover:text-foreground`,children:(0,Z.jsx)(g,{id:`mGaZwZ`})})]}),t[29]=c.kind,t[30]=c.message,t[31]=z):z=t[31];let B;t[32]!==P||t[33]!==F||t[34]!==I||t[35]!==L||t[36]!==R||t[37]!==z?(B=(0,Z.jsx)(k,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6 py-2`,children:[P,F,I,L,R,z]})}),t[32]=P,t[33]=F,t[34]=I,t[35]=L,t[36]=R,t[37]=z,t[38]=B):B=t[38];let V;t[39]===c.kind?V=t[40]:(V=c.kind!==`error`&&(0,Z.jsxs)(`a`,{href:eo,target:`_blank`,rel:`noopener noreferrer`,onClick:co,onAuxClick:so,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:[(0,Z.jsx)(g,{id:`U3IvM5`}),(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`h-3 w-3`})]}),t[39]=c.kind,t[40]=V);let H;t[41]!==h||t[42]!==r||t[43]!==c.kind||t[44]!==a?(H=c.kind===`idle`&&S&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(y,{className:`uppercase font-mono`,variant:`outline`,onClick:()=>r(!1),children:(0,Z.jsx)(g,{id:`dEgA5A`})}),(0,Z.jsxs)(y,{onClick:h,children:[(0,Z.jsx)(Qe,{"aria-hidden":`true`,className:`h-4 w-4`}),a?(0,Z.jsx)(g,{id:`YGIi_c`}):(0,Z.jsx)(g,{id:`TKQ7K-`})]})]}),t[41]=h,t[42]=r,t[43]=c.kind,t[44]=a,t[45]=H):H=t[45];let U;t[46]!==r||t[47]!==c.kind?(U=c.kind===`idle`&&!S&&(0,Z.jsx)(y,{className:`uppercase font-mono`,variant:`outline`,onClick:()=>r(!1),children:(0,Z.jsx)(g,{id:`yz7wBu`})}),t[46]=r,t[47]=c.kind,t[48]=U):U=t[48];let W;t[49]!==h||t[50]!==r||t[51]!==c.kind?(W=c.kind===`error`&&S&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(y,{className:`uppercase font-mono`,variant:`outline`,onClick:()=>r(!1),children:(0,Z.jsx)(g,{id:`dEgA5A`})}),(0,Z.jsxs)(y,{onClick:h,children:[(0,Z.jsx)(Qe,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(g,{id:`KDw4GX`})]})]}),t[49]=h,t[50]=r,t[51]=c.kind,t[52]=W):W=t[52];let G;t[53]!==c.kind||t[54]!==a?(G=c.kind===`downloading`&&(0,Z.jsxs)(y,{disabled:!0,children:[(0,Z.jsx)(we,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),a?(0,Z.jsx)(g,{id:`fIgqfQ`}):(0,Z.jsx)(g,{id:`Wtw22s`})]}),t[53]=c.kind,t[54]=a,t[55]=G):G=t[55];let K;t[56]!==r||t[57]!==c.kind?(K=c.kind===`handed-off`&&(0,Z.jsx)(y,{onClick:()=>r(!1),children:(0,Z.jsx)(g,{id:`DPfwMq`})}),t[56]=r,t[57]=c.kind,t[58]=K):K=t[58];let q;t[59]!==V||t[60]!==H||t[61]!==U||t[62]!==W||t[63]!==G||t[64]!==K?(q=(0,Z.jsxs)(A,{children:[V,H,U,W,G,K]}),t[59]=V,t[60]=H,t[61]=U,t[62]=W,t[63]=G,t[64]=K,t[65]=q):q=t[65];let J;t[66]!==N||t[67]!==B||t[68]!==q?(J=(0,Z.jsxs)(O,{className:`sm:max-w-lg`,"data-ok-layer-spawned":``,children:[N,B,q]}),t[66]=N,t[67]=B,t[68]=q,t[69]=J):J=t[69];let ee;return t[70]!==r||t[71]!==n||t[72]!==J?(ee=(0,Z.jsx)(M,{open:n,onOpenChange:r,children:J}),t[70]=r,t[71]=n,t[72]=J,t[73]=ee):ee=t[73],ee}function so(e){return Be(e,eo)}function co(e){return Be(e,eo)}function lo(e){return Be(e,eo)}function uo(e){return Be(e,eo)}var fo=new Set;function po(e){for(let t of fo)try{t(e)}catch(e){console.warn(`[config-ignore-nested-error-events] listener threw:`,e)}}function mo(e){return fo.add(e),()=>{fo.delete(e)}}var ho=new Set;function go(e){for(let t of ho)try{t(e)}catch(e){console.warn(`[config-validation-events] listener threw:`,e)}}function _o(e){return ho.add(e),()=>{ho.delete(e)}}var vo=null;function yo(){return vo}function bo(e){vo=e}export{Ot as $,Zi as A,tr as B,ja as C,ni as D,ti as E,ur as F,Xt as G,wn as H,hr as I,Kt as J,Jt as K,sr as L,Ur as M,fr as N,$ as O,lr as P,Tt as Q,or as R,Ma as S,Zr as T,xn as U,Tn as V,nn as W,Nt as X,It as Y,wt as Z,Ba as _,po as a,ft as at,Fa as b,Qa as c,lt as ct,Wa as d,$e as dt,kt as et,Ua as f,Qe as ft,Ka as g,Ga as h,_o as i,_t as it,ei as j,Rr as k,Ja as l,rt as lt,za as m,bo as n,Dt as nt,mo as o,at as ot,Va as p,Ze as pt,Gt as q,go as r,xt as rt,oo as s,ot as st,yo as t,Et as tt,Ha as u,et as ut,Ia as v,fa as w,Ta as x,La as y,ir as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DseTPa7n.js";import{n as t,r as n,t as r}from"./compiler-runtime-DrcePeIl.js";import{u as i}from"./createLucideIcon-Wgamzz8_.js";import{$ as a,Oi as o,Q as s,Z as c}from"./dist-B2EDiaY_.js";var l={general:{id:`Weq9zb`},workspace:{id:`pmUArF`},search:{id:`A1taO8`},wysiwyg:{id:`ur2XSb`},source:{id:`tiWX6q`},navigation:{id:`LXfNU-`}},u=Object.keys(l),d=[{id:`command-palette`,category:`general`,title:{id:`ZjtgI-`},description:{id:`OFBmkg`},scope:{id:`2GT3Hf`},bindings:[{mac:`⌘ K`,windowsLinux:`Ctrl K`,match:{key:`k`,mod:!0}}]},{id:`settings`,category:`general`,title:{id:`Tz0i8g`},description:{id:`6m_7We`},scope:{id:`zL0LPh`},bindings:[{mac:`⌘ ,`,windowsLinux:`Ctrl ,`,match:{key:`,`,anyMod:!0}}]},{id:`new-item`,category:`general`,title:{id:`HdkSiO`},description:{id:`KkEAud`},scope:{id:`zL0LPh`},bindings:[{mac:`⌘ N`,windowsLinux:`Ctrl N`,match:{key:`n`,mod:!0}},{mac:`⌥⌘ N`,windowsLinux:`Ctrl Alt N`,match:{key:`n`,anyMod:!0,altKey:!0,allowExtraModifiers:!0}}]},{id:`new-folder`,category:`general`,title:{id:`96G6Re`},description:{id:`3cOo2C`},scope:{id:`cZI5AL`},bindings:[{mac:`⇧⌘ N`,windowsLinux:`Ctrl Shift N`}]},{id:`toggle-files-sidebar`,category:`general`,title:{id:`rtdR4v`},description:{id:`EbZT7P`},scope:{id:`2GT3Hf`},bindings:[{mac:`⌥⌘ S`,windowsLinux:`Ctrl Alt S`,match:{code:`KeyS`,anyMod:!0,altKey:!0,allowExtraModifiers:!0}}]},{id:`toggle-document-panel`,category:`general`,title:{id:`lkYioO`},description:{id:`It9ARY`},scope:{id:`2GT3Hf`},bindings:[{mac:`⌥⌘ B`,windowsLinux:`Ctrl Alt B`,match:{code:`KeyB`,anyMod:!0,altKey:!0,allowExtraModifiers:!0}}]},{id:`toggle-terminal-panel`,category:`general`,title:{id:`dPOFid`},description:{id:`oCNLN8`},scope:{id:`cZI5AL`},bindings:[{mac:`⌘ J`,windowsLinux:`Ctrl J`,match:{key:`j`,mod:!0}}]},{id:`open-ask-ai`,category:`general`,title:{id:`xWEvuo`},description:{id:`5OTgC7`},scope:{id:`cZI5AL`},bindings:[{mac:`⌘ L`,windowsLinux:`Ctrl L`,match:{key:`l`,mod:!0}}]},{id:`new-terminal-tab`,category:`general`,title:{id:`k0vc0N`},description:{id:`si3L24`},scope:{id:`cZI5AL`},bindings:[{mac:`⇧⌘ J`,windowsLinux:`Ctrl Shift J`,match:{key:`j`,mod:!0,shiftKey:!0}}]},{id:`tab-new`,category:`navigation`,title:{id:`3YvS-c`},description:{id:`t6w1cq`},scope:{id:`2GT3Hf`},bindings:[{mac:`⌘ T`,windowsLinux:`Ctrl T`,match:{key:`t`,mod:!0}}]},{id:`tab-next`,category:`navigation`,title:{id:`l46MqT`},description:{id:`thnPBX`},scope:{id:`2GT3Hf`},bindings:[{mac:`⌃ Tab`,windowsLinux:`Ctrl Tab`,match:{key:`Tab`,ctrlKey:!0}}]},{id:`tab-previous`,category:`navigation`,title:{id:`Mh_4hd`},description:{id:`DJd000`},scope:{id:`2GT3Hf`},bindings:[{mac:`⌃⇧ Tab`,windowsLinux:`Ctrl Shift Tab`,match:{key:`Tab`,ctrlKey:!0,shiftKey:!0}}]},{id:`tab-jump`,category:`navigation`,title:{id:`_6FVBz`},description:{id:`wGSHzy`},scope:{id:`2GT3Hf`},bindings:[{mac:`⌘ 1-8`,windowsLinux:`Ctrl 1-8`}]},{id:`tab-jump-last`,category:`navigation`,title:{id:`N1KkEO`},description:{id:`ZQJ1IV`},scope:{id:`2GT3Hf`},bindings:[{mac:`⌘ 9`,windowsLinux:`Ctrl 9`}]},{id:`tab-reopen-closed`,category:`navigation`,title:{id:`hpzRlK`},description:{id:`E5WeIy`},scope:{id:`2GT3Hf`},bindings:[{mac:`⇧⌘ T`,windowsLinux:`Ctrl Shift T`,match:{key:`t`,mod:!0,shiftKey:!0}}]},{id:`open-folder`,category:`workspace`,title:{id:`PVUn_c`},description:{id:`VYd_YA`},scope:{id:`cZI5AL`},bindings:[{mac:`⌘ O`,windowsLinux:`Ctrl O`}]},{id:`switch-project`,category:`workspace`,title:{id:`xaDWAI`},description:{id:`oS1YpJ`},scope:{id:`cZI5AL`},bindings:[{mac:`⇧⌘ P`,windowsLinux:`Ctrl Shift P`}]},{id:`file-tree-copy`,category:`workspace`,title:{id:`eGUbmF`},description:{id:`7uBlRT`},scope:{id:`vbK_ZG`},bindings:[{mac:`⌘ C`,windowsLinux:`Ctrl C`}]},{id:`file-tree-paste`,category:`workspace`,title:{id:`_tjopj`},description:{id:`e4PbgC`},scope:{id:`vbK_ZG`},bindings:[{mac:`⌘ V`,windowsLinux:`Ctrl V`}]},{id:`file-tree-duplicate`,category:`workspace`,title:{id:`ot5BRK`},description:{id:`mxY24F`},scope:{id:`vbK_ZG`},bindings:[{mac:`⌘ D`,windowsLinux:`Ctrl D`}]},{id:`file-tree-delete`,category:`workspace`,title:{id:`VxO6wR`},description:{id:`osRqlv`},scope:{id:`vbK_ZG`},bindings:[{mac:`⌘ Backspace`,windowsLinux:`Delete`}]},{id:`file-tree-select-all`,category:`workspace`,title:{id:`1d1F11`},description:{id:`4v2Yyz`},scope:{id:`vbK_ZG`},bindings:[{mac:`⌘ A`,windowsLinux:`Ctrl A`}]},{id:`find`,category:`search`,title:{id:`KujtjC`},description:{id:`8OGgNM`},scope:{id:`ur2XSb`},bindings:[{mac:`⌘ F`,windowsLinux:`Ctrl F`,match:{key:`f`,mod:!0,allowShiftKey:!0}}]},{id:`replace`,category:`search`,title:{id:`fqSfXY`},description:{id:`wT4iQr`},scope:{id:`ur2XSb`},bindings:[{mac:`⌥⌘ F`,windowsLinux:`Ctrl H`,match:{mac:{key:`f`,mod:!0,altKey:!0},windowsLinux:{key:`h`,mod:!0}}}]},{id:`find-next`,category:`search`,title:{id:`v7lbnC`},description:{id:`PR9FSv`},scope:{id:`EqtBXb`},bindings:[{mac:`⌘ G`,windowsLinux:`Ctrl G`,match:{key:`g`,mod:!0}},{mac:`F3`,windowsLinux:`F3`,match:{key:`F3`}}]},{id:`find-previous`,category:`search`,title:{id:`PB4upl`},description:{id:`PgzIpb`},scope:{id:`EqtBXb`},bindings:[{mac:`⇧⌘ G`,windowsLinux:`Ctrl Shift G`,match:{key:`g`,mod:!0,shiftKey:!0}},{mac:`Shift F3`,windowsLinux:`Shift F3`,match:{key:`F3`,shiftKey:!0}}]},{id:`find-field-navigation`,category:`search`,title:{id:`yMgL_E`},description:{id:`5ALjdr`},scope:{id:`BgV29F`},bindings:[{mac:`Enter / Shift Enter`,windowsLinux:`Enter / Shift Enter`}]},{id:`replace-current-from-field`,category:`search`,title:{id:`LDuM35`},description:{id:`EZVxVz`},scope:{id:`rZVMkf`},bindings:[{mac:`Enter`,windowsLinux:`Enter`}]},{id:`format-bold`,category:`wysiwyg`,title:{id:`KmydK6`},description:{id:`fbdLmk`},scope:{id:`ur2XSb`},bindings:[{mac:`⌘ B`,windowsLinux:`Ctrl B`}]},{id:`format-italic`,category:`wysiwyg`,title:{id:`pzutoc`},description:{id:`TLIO3j`},scope:{id:`ur2XSb`},bindings:[{mac:`⌘ I`,windowsLinux:`Ctrl I`}]},{id:`format-underline`,category:`wysiwyg`,title:{id:`YyXtnN`},description:{id:`Okd2Xv`},scope:{id:`ur2XSb`},bindings:[{mac:`⌘ U`,windowsLinux:`Ctrl U`}]},{id:`format-strike`,category:`wysiwyg`,title:{id:`WhOsNE`},description:{id:`HCn0Ay`},scope:{id:`ur2XSb`},bindings:[{mac:`⇧⌘ X`,windowsLinux:`Ctrl Shift X`}]},{id:`format-inline-code`,category:`wysiwyg`,title:{id:`OX2Neh`},description:{id:`mo22UP`},scope:{id:`ur2XSb`},bindings:[{mac:`⌘ E`,windowsLinux:`Ctrl E`}]},{id:`format-highlight`,category:`wysiwyg`,title:{id:`gtEbeW`},description:{id:`Eji13z`},scope:{id:`ur2XSb`},bindings:[{mac:`⇧⌘ H`,windowsLinux:`Ctrl Shift H`}]},{id:`add-link`,category:`wysiwyg`,title:{id:`VzGJRl`},description:{id:`u7U_Ij`},scope:{id:`v77jrg`},bindings:[{mac:`⌘ K`,windowsLinux:`Ctrl K`,match:{key:`k`,mod:!0}}]},{id:`edit-with-ai`,category:`general`,title:{id:`G4-bgo`},description:{id:`a3H_MR`},scope:{id:`C62P6b`},bindings:[{mac:`⇧⌘ I`,windowsLinux:`Ctrl Shift I`,match:{key:`i`,mod:!0,shiftKey:!0}}]},{id:`history-undo-redo`,category:`wysiwyg`,title:{id:`i9OyGp`},description:{id:`lbkOif`},scope:{id:`ur2XSb`},bindings:[{mac:`⌘ Z`,windowsLinux:`Ctrl Z`},{mac:`⇧⌘ Z / ⌘ Y`,windowsLinux:`Ctrl Shift Z / Ctrl Y`}]},{id:`heading-paragraph`,category:`wysiwyg`,title:{id:`bkQRMh`},description:{id:`rgPqOw`},scope:{id:`ur2XSb`},bindings:[{mac:`⌥⌘ 0`,windowsLinux:`Ctrl Alt 0`}]},{id:`heading-levels`,category:`wysiwyg`,title:{id:`q_z77Z`},description:{id:`8Jm2EP`},scope:{id:`ur2XSb`},bindings:[{mac:`⌥⌘ 1-6`,windowsLinux:`Ctrl Alt 1-6`}]},{id:`list-bullet`,category:`wysiwyg`,title:{id:`ijLc3m`},description:{id:`By-7Pn`},scope:{id:`ur2XSb`},bindings:[{mac:`⇧⌘ 8`,windowsLinux:`Ctrl Shift 8`}]},{id:`list-ordered`,category:`wysiwyg`,title:{id:`iSQTsg`},description:{id:`ou1hFW`},scope:{id:`ur2XSb`},bindings:[{mac:`⇧⌘ 7`,windowsLinux:`Ctrl Shift 7`}]},{id:`list-task`,category:`wysiwyg`,title:{id:`E1_c72`},description:{id:`-slrNR`},scope:{id:`ur2XSb`},bindings:[{mac:`⇧⌘ 9`,windowsLinux:`Ctrl Shift 9`}]},{id:`code-block`,category:`wysiwyg`,title:{id:`4A3Yzu`},description:{id:`pTPqMK`},scope:{id:`ur2XSb`},bindings:[{mac:`⌥⌘ C`,windowsLinux:`Ctrl Alt C`}]},{id:`hard-break`,category:`wysiwyg`,title:{id:`-3ois8`},description:{id:`vDXqVv`},scope:{id:`ur2XSb`},bindings:[{mac:`Shift Enter`,windowsLinux:`Shift Enter`},{mac:`⌘ Enter`,windowsLinux:`Ctrl Enter`}]},{id:`move-block`,category:`wysiwyg`,title:{id:`f1XQyZ`},description:{id:`zQBg2C`},scope:{id:`ur2XSb`},bindings:[{mac:`⇧⌘ ↑`,windowsLinux:`Ctrl Shift ↑`},{mac:`⇧⌘ ↓`,windowsLinux:`Ctrl Shift ↓`}]},{id:`list-indent`,category:`wysiwyg`,title:{id:`G0YZ-I`},description:{id:`5GKMSz`},scope:{id:`ynIa4S`},bindings:[{mac:`Tab`,windowsLinux:`Tab`},{mac:`Shift Tab`,windowsLinux:`Shift Tab`}]},{id:`list-split-item`,category:`wysiwyg`,title:{id:`neRy3o`},description:{id:`NpC29w`},scope:{id:`ynIa4S`},bindings:[{mac:`Enter`,windowsLinux:`Enter`}]},{id:`table-cell-navigation`,category:`wysiwyg`,title:{id:`K8-WWn`},description:{id:`4NC2Ym`},scope:{id:`l1aQKz`},bindings:[{mac:`Tab`,windowsLinux:`Tab`},{mac:`Shift Tab`,windowsLinux:`Shift Tab`}]},{id:`table-delete-selection`,category:`wysiwyg`,title:{id:`881Uwh`},description:{id:`YEP3X2`},scope:{id:`99eR72`},bindings:[{mac:`Backspace / Delete`,windowsLinux:`Backspace / Delete`},{mac:`⌘ Backspace / ⌘ Delete`,windowsLinux:`Ctrl Backspace / Ctrl Delete`}]},{id:`delete-atom`,category:`wysiwyg`,title:{id:`636K3K`},description:{id:`oXKEsy`},scope:{id:`ur2XSb`},bindings:[{mac:`Backspace`,windowsLinux:`Backspace`},{mac:`Delete`,windowsLinux:`Delete`}]},{id:`slash-menu`,category:`navigation`,title:{id:`shNd9t`},description:{id:`8PmoQF`},scope:{id:`ur2XSb`},bindings:[{mac:`/`,windowsLinux:`/`}]},{id:`suggestion-navigation`,category:`navigation`,title:{id:`riqekz`},description:{id:`OiHJdA`},scope:{id:`y5FUYi`},bindings:[{mac:`↑ / ↓`,windowsLinux:`↑ / ↓`},{mac:`Enter / Tab`,windowsLinux:`Enter / Tab`},{mac:`Esc`,windowsLinux:`Esc`}]},{id:`component-navigation`,category:`navigation`,title:{id:`rwrPbS`},description:{id:`0s8-e8`},scope:{id:`ur2XSb`},bindings:[{mac:`↑ / ↓ / ← / →`,windowsLinux:`↑ / ↓ / ← / →`},{mac:`Enter / Esc`,windowsLinux:`Enter / Esc`}]},{id:`source-indent`,category:`source`,title:{id:`fwhX-N`},description:{id:`skf5Ix`},scope:{id:`tiWX6q`},bindings:[{mac:`Tab`,windowsLinux:`Tab`},{mac:`Shift Tab`,windowsLinux:`Shift Tab`}]},{id:`source-navigation`,category:`source`,title:{id:`qSKu2v`},description:{id:`gITz7o`},scope:{id:`tiWX6q`},bindings:[{mac:`Arrow keys / Option Arrow / Command Arrow`,windowsLinux:`Arrow keys / Ctrl Arrow / Home / End`},{mac:`Page Up / Page Down`,windowsLinux:`Page Up / Page Down`},{mac:`Shift with movement keys`,windowsLinux:`Shift with movement keys`}]},{id:`source-editing`,category:`source`,title:{id:`pFagOn`},description:{id:`MGb89P`},scope:{id:`tiWX6q`},bindings:[{mac:`Enter / Shift Enter / ⌘ Enter`,windowsLinux:`Enter / Shift Enter / Ctrl Enter`},{mac:`Backspace / Delete`,windowsLinux:`Backspace / Delete`},{mac:`⌥ Backspace / ⌥ Delete`,windowsLinux:`Ctrl Backspace / Ctrl Delete`},{mac:`⌥ ↑ / ⌥ ↓`,windowsLinux:`Alt ↑ / Alt ↓`},{mac:`⇧⌥ ↑ / ⇧⌥ ↓`,windowsLinux:`Shift Alt ↑ / Shift Alt ↓`},{mac:`⇧⌘ K`,windowsLinux:`Ctrl Shift K`}]},{id:`source-history`,category:`source`,title:{id:`4Sxexw`},description:{id:`r2huLx`},scope:{id:`tiWX6q`},bindings:[{mac:`⌘ Z`,windowsLinux:`Ctrl Z`},{mac:`⇧⌘ Z`,windowsLinux:`Ctrl Y / Ctrl Shift Z`},{mac:`⌘ U / ⇧⌘ U`,windowsLinux:`Ctrl U / Alt U`}]},{id:`source-select-all`,category:`source`,title:{id:`a-cKXz`},description:{id:`UTNVyS`},scope:{id:`tiWX6q`},bindings:[{mac:`⌘ A`,windowsLinux:`Ctrl A`}]},{id:`source-multi-cursor`,category:`source`,title:{id:`mg0YGL`},description:{id:`lWNpNB`},scope:{id:`tiWX6q`},bindings:[{mac:`⌥⌘ ↑ / ⌥⌘ ↓`,windowsLinux:`Ctrl Alt ↑ / Ctrl Alt ↓`},{mac:`⇧⌘ L`,windowsLinux:`Ctrl Shift L`}]},{id:`source-search`,category:`source`,title:{id:`7OhaRy`},description:{id:`mwMF9u`},scope:{id:`tiWX6q`},bindings:[{mac:`⌘ F`,windowsLinux:`Ctrl F`}]},{id:`source-toggle-comment`,category:`source`,title:{id:`RfaEio`},description:{id:`MrwYIK`},scope:{id:`tiWX6q`},bindings:[{mac:`⌘ /`,windowsLinux:`Ctrl /`},{mac:`Shift Alt A`,windowsLinux:`Shift Alt A`}]},{id:`source-select-next-occurrence`,category:`source`,title:{id:`hY8pka`},description:{id:`XnlF3W`},scope:{id:`tiWX6q`},bindings:[{mac:`⌘ D`,windowsLinux:`Ctrl D`}]},{id:`source-goto-line`,category:`source`,title:{id:`7FamGZ`},description:{id:`yHikCO`},scope:{id:`tiWX6q`},bindings:[{mac:`⌥⌘ G`,windowsLinux:`Ctrl Alt G`}]},{id:`source-find-results`,category:`source`,title:{id:`rJVoVX`},description:{id:`TwYboS`},scope:{id:`qyLmWw`},bindings:[{mac:`⌘ G / ⇧⌘ G`,windowsLinux:`Ctrl G / Ctrl Shift G`},{mac:`F3 / Shift F3`,windowsLinux:`F3 / Shift F3`},{mac:`Esc`,windowsLinux:`Esc`}]},{id:`source-folding`,category:`source`,title:{id:`bcjYUA`},description:{id:`VZGh8G`},scope:{id:`tiWX6q`},bindings:[{mac:`⌥⌘ [ / ⌥⌘ ]`,windowsLinux:`Ctrl Shift [ / Ctrl Shift ]`},{mac:`Ctrl Alt [ / Ctrl Alt ]`,windowsLinux:`Ctrl Alt [ / Ctrl Alt ]`}]},{id:`source-completion`,category:`source`,title:{id:`VuxVSP`},description:{id:`Ehkru0`},scope:{id:`tiWX6q`},bindings:[{mac:`Ctrl Space`,windowsLinux:`Ctrl Space`},{mac:"⌥ ` / ⌥ I",windowsLinux:`Ctrl Space`},{mac:`↑ / ↓ / Page Up / Page Down`,windowsLinux:`↑ / ↓ / Page Up / Page Down`},{mac:`Enter / Esc`,windowsLinux:`Enter / Esc`}]},{id:`source-tab-focus-mode`,category:`source`,title:{id:`eG8Jsg`},description:{id:`qRZh7J`},scope:{id:`tiWX6q`},bindings:[{mac:`Shift Alt M`,windowsLinux:`Ctrl M`}]},{id:`source-lint-panel`,category:`source`,title:{id:`yvG-l1`},description:{id:`kCqCyf`},scope:{id:`tiWX6q`},bindings:[{mac:`⇧⌘ M`,windowsLinux:`Ctrl Shift M`}]},{id:`source-next-diagnostic`,category:`source`,title:{id:`M1OfV9`},description:{id:`ExPiRQ`},scope:{id:`tiWX6q`},bindings:[{mac:`F8`,windowsLinux:`F8`}]}],f=d,p=new Map(d.map(e=>[e.id,e]));function m(e){let t=p.get(e);if(!t)throw Error(`Unknown keyboard shortcut: ${e}`);return t}function h(){return o()?`mac`:`windowsLinux`}var g=[[/⌘/g,` Command `],[/⌥/g,` Option `],[/⇧/g,` Shift `],[/⌃/g,` Control `],[/↑/g,` Up Arrow `],[/↓/g,` Down Arrow `],[/←/g,` Left Arrow `],[/→/g,` Right Arrow `],[/\[/g,` Left Bracket `],[/\]/g,` Right Bracket `],[/,/g,` Comma `],[/\bCtrl\b/g,` Control `]];function _(e){return e.split(` / `).map(e=>g.reduce((e,[t,n])=>e.replace(t,n),e).replaceAll(/\s+/g,` `).trim()).join(` or `)}function v(e,t=h()){return t===`mac`?e.mac:e.windowsLinux}function y(e,t=h()){return _(v(e,t))}function b(e,t=h()){return v(m(e).bindings[0],t)}function x(e,t=h()){return y(m(e).bindings[0],t)}function S(e){if(!e||typeof e!=`object`)return!1;if(`isContentEditable`in e&&e.isContentEditable===!0)return!0;if(!(`tagName`in e))return!1;let t=String(e.tagName).toUpperCase();return t===`INPUT`||t===`TEXTAREA`}function C(e,t,n=h()){return m(t).bindings.some(t=>{let r=w(t.match,n);return r?E(e,r,n):!1})}function w(e,t){return e?T(e)?e:e[t]??null:null}function T(e){return`key`in e||`code`in e}function E(e,t,n){if(t.key&&e.key.toLowerCase()!==t.key.toLowerCase()||t.code&&e.code!==t.code)return!1;let r=t.metaKey??(t.mod?n===`mac`:!1),i=t.ctrlKey??(t.mod?n===`windowsLinux`:!1),a=t.altKey??!1,o=t.shiftKey??!1;return t.allowExtraModifiers?!(t.anyMod&&!e.metaKey&&!e.ctrlKey||r&&!e.metaKey||i&&!e.ctrlKey||a&&!e.altKey||o&&!e.shiftKey):(t.anyMod?e.metaKey||e.ctrlKey:e.metaKey===r&&e.ctrlKey===i)&&e.altKey===a&&(t.allowShiftKey||!!e.shiftKey===o)}var D=r(),O=n();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 a;t[3]===n?a=t[4]:(a=i(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,O.jsx)(`div`,{"data-slot":`skeleton`,className:a,...r}),t[5]=r,t[6]=a,t[7]=o):o=t[7],o}var A=e(t(),1),j=`open-knowledge:lint-config-changed`;function M(){window.dispatchEvent(new CustomEvent(j))}function N(e){let t=()=>e();return window.addEventListener(j,t),()=>window.removeEventListener(j,t)}async function P(e){try{let t=e===void 0?``:`?doc=${encodeURIComponent(e)}`,n=await fetch(`/api/lint/config${t}`);if(!n.ok)return null;let r=await n.json().catch(()=>null),i=s.safeParse(r);return i.success?i.data:(console.warn(`[lint] lint-config response failed schema validation`,i.error.issues),null)}catch{return null}}async function F(e){return(await P(e))?.effective??null}async function I(e){try{let t=e?`?path=${encodeURIComponent(e)}`:``,n=await fetch(`/api/lint/audit${t}`);if(!n.ok)return null;let r=await n.json().catch(()=>null),i=c.safeParse(r);return i.success?i.data:(console.warn(`[lint] audit response failed schema validation`,i.error.issues),null)}catch{return null}}async function L(e){try{let t=await fetch(`/api/lint/fix`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({docName:e})});if(!t.ok){let e=await t.json().catch(()=>null);return{ok:!1,errorDetail:typeof e?.title==`string`?e.title:null}}let n=await t.json().catch(()=>null),r=a.safeParse(n);return r.success?{ok:!0,result:r.data}:(console.warn(`[lint] fix response failed schema validation`,r.error.issues),{ok:!1,errorDetail:null})}catch{return{ok:!1,errorDetail:null}}}async function R(e,t){try{let n=await fetch(`/api/lint/markdownlint-config`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({ruleId:e,value:t})});if(!n.ok){let e=await n.json().catch(()=>null);return{ok:!1,errorDetail:typeof e?.title==`string`?e.title:null}}let r=await n.json().catch(()=>null),i=s.safeParse(r);return i.success?{ok:!0,response:i.data}:{ok:!1,errorDetail:null}}catch{return{ok:!1,errorDetail:null}}}function z(e){let t=(0,D.c)(5),[n,r]=(0,A.useState)(null),i,a;t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(null);return}let t=!1,n=()=>{P(e).then(e=>{t||r(e)})};n();let i=N(n);return()=>{t=!0,i()}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,A.useEffect)(i,a);let o;return t[3]===n?o=t[4]:(o={data:n},t[3]=n,t[4]=o),o}function B(){let e=(0,D.c)(4),[t,n]=(0,A.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=!1,t=()=>{P().then(t=>{e||n(t)})};t();let r=N(t);return()=>{e=!0,r()}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,A.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={data:t},e[2]=t,e[3]=a),a}export{S as _,N as a,R as c,l as d,u as f,_ as g,x as h,I as i,k as l,v as m,F as n,z as o,b as p,L as r,B as s,M as t,f as u,C as v};
|
package/dist/start-Boj7-YRp.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,f as t,r as n}from"./start-BEFJCwqf.mjs";export{n as bootStartServer,t as resolveHost,e as startCommand};
|