@inkeep/open-knowledge 0.83.0-beta.4 → 0.83.0-beta.5
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/project/SKILL.md +1 -1
- package/dist/assets/skills/project/references/linking.md +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/constants-DPhkbJXs.mjs +1 -0
- package/dist/{dist-Db3MAmfg.mjs → dist-BHg9XI3A.mjs} +503 -503
- package/dist/{dist-CuKjbrew.mjs → dist-ByQ8IZXo.mjs} +1 -1
- package/dist/index.mjs +3 -3
- package/dist/{init-CL_e6Q1D.mjs → init-CrjTf1pi.mjs} +2 -2
- package/dist/init-Kw-TosnB.mjs +1 -0
- package/dist/{launch-json-removal-D3kd2brC.mjs → launch-json-removal-BEKplNGY.mjs} +1 -1
- package/dist/{loader-C7EEsDKg.mjs → loader-CrmSAWIW.mjs} +1 -1
- package/dist/loader-CwZvWeL0.mjs +1 -0
- package/dist/{md-manager-BGnqyqi1-IqwoPmS1.mjs → md-manager-BGnqyqi1-DsBy1Dky.mjs} +1 -1
- package/dist/{open-browser-DNGrx2It.mjs → open-browser-CJogphTe.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-AWnyLtzP.mjs +1 -0
- package/dist/{preview-BlJ1Z0op.mjs → preview-B2beHnfh.mjs} +1 -1
- package/dist/public/assets/{AccountSection-BRBXF1vN.js → AccountSection-Droiytue.js} +1 -1
- package/dist/public/assets/{ActivityModeContent-CJJP9rF8.js → ActivityModeContent-CbnLPTIH.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-D3pJsHJb.js → AddPropertiesButton-KfKILXo9.js} +2 -2
- package/dist/public/assets/{AgentConnectionsSection-CmOmHMSc.js → AgentConnectionsSection-CJhM0Oqw.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-tNG4XT0X.js → AgentDiffPane-B0odJ1aT.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-JCBkP1bH.js → AttachmentsSection-Mw0-ZVyb.js} +1 -1
- package/dist/public/assets/{AuthModal-D1eciNeA.js → AuthModal-DcixDUcD.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-a3VwRUQz.js → CodeMirrorPropInput-CJK_-B_x.js} +1 -1
- package/dist/public/assets/{ContentRulesSection-D5HpfzEM.js → ContentRulesSection-Bss4zUDP.js} +1 -1
- package/dist/public/assets/{DiffViewBoundary-DnPwZD0g.js → DiffViewBoundary-B5VRWFoq.js} +1 -1
- package/dist/public/assets/{DocumentContext-mYOuQjoP.js → DocumentContext-Bsl186nT.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-CzpyTCmQ.js → EditorModeToggle-DPAypJvm.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-DOGkm6OY.js → ExcalidrawDocEditor-C_j2ekRK.js} +1 -1
- package/dist/public/assets/FeedbackForm-CQ0MZzAX.js +1 -0
- package/dist/public/assets/{GraphPanel-CpJ-EZeA.js → GraphPanel-ZgCaGJ14.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-DnFzketi.js → ImportSkillDialog-CYgy5v1q.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-DoydKz8c.js → LinkPreviewsSection-uXIP-dp3.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-CRNgDVC9.js → LintConfigEditor-BFYDnPot.js} +1 -1
- package/dist/public/assets/{LintingSection-6XJ9IDh1.js → LintingSection-CKk0R2XV.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-D4nKksLq.js +1 -0
- package/dist/public/assets/{ManagedArtifactProperties-KZga5-nk.js → ManagedArtifactProperties-oK6vCr7C.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-Db30lOly.js → MermaidDocEditor-7zbWvNHd.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-Br-oNBym.js → NetworkAccessSection-Bn8H6wuf.js} +1 -1
- package/dist/public/assets/{ProjectTemplatesSection-BgjUl8Rv.js → ProjectTemplatesSection-Cf5bgyHk.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-D6hboSk0.js → PropertyDisplayRow-DtQD10NU.js} +1 -1
- package/dist/public/assets/{PublishToGitHubDialog-CwKAOyMe.js → PublishToGitHubDialog-Bi_yfoyq.js} +1 -1
- package/dist/public/assets/{RegisteredAgentIcon-DHzxArZN.js → RegisteredAgentIcon-jysj1Acv.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-DB6DsLhh.js → SchemaConfigEditor-CmvHbYD0.js} +1 -1
- package/dist/public/assets/{SearchSection-Dk-yosmd.js → SearchSection-NRyXWfQ3.js} +1 -1
- package/dist/public/assets/{SessionsHost-hUeKJj7l.js → SessionsHost-Cc2oV3dV.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-De0p1s3_.js → SettingsDialogBody-CWnpUal4.js} +2 -2
- package/dist/public/assets/{ShareReceiveMissDialog-hMFYD5AW.js → ShareReceiveMissDialog-ChcdZosR.js} +1 -1
- package/dist/public/assets/{SkillCostValue-DC_VaXgy.js → SkillCostValue-Bgy3wkjV.js} +1 -1
- package/dist/public/assets/{SkillForkDialog-DeoTv3wY.js → SkillForkDialog-CwCSC6Z0.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-1E0cH5_q.js → SkillInstallMenu-BIs2wAUZ.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-CLKoMHNo.js → SkillOriginInline-Dr1zcAGa.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-nnJTYYrn.js → SkillToolbarControls-BXSkUGmd.js} +1 -1
- package/dist/public/assets/{SkillsManagerSection-DKedsWHo.js → SkillsManagerSection-CiaThXM_.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-BSKDSVIG.js → SlidesToolbarControls-BpGxFSJu.js} +1 -1
- package/dist/public/assets/{SourceEditor-BCeRHOW_.js → SourceEditor-AolrPcnF.js} +1 -1
- package/dist/public/assets/{SpellingSettings-Cmy-eBih.js → SpellingSettings-Bp5WJ0V7.js} +1 -1
- package/dist/public/assets/{SyncSection-Ctc1ZAYE.js → SyncSection-DN4BNjYi.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-CykVps4K.js → SyncStatusBadge-BO6CFavL.js} +1 -1
- package/dist/public/assets/{TemplateRow-B2jVmQlY.js → TemplateRow-Bj4hpJ-E.js} +1 -1
- package/dist/public/assets/{TerminalLaunchContext-BReEuF5W.js → TerminalLaunchContext-kR8NUVFa.js} +1 -1
- package/dist/public/assets/{TerminalPanel-DQg3L4EK.js → TerminalPanel-CBpH9VnO.js} +1 -1
- package/dist/public/assets/{TerminalSection-CcQc7fKK.js → TerminalSection-DnexOFJv.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-a7QkAGXd.js → TerminalWindowApp-CYOc89Z0.js} +1 -1
- package/dist/public/assets/{TextDocEditor-CdGAdSor.js → TextDocEditor-DcTmh_sa.js} +1 -1
- package/dist/public/assets/{ThemePluginSection-B4oIayEG.js → ThemePluginSection-DOCAYKOj.js} +1 -1
- package/dist/public/assets/{ThreadView-Cu22t-sf.js → ThreadView-H4YeUz_6.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-CcFwzBDW.js → TimelineDiffPane-DBRzt5of.js} +1 -1
- package/dist/public/assets/{agent-connections-D-XX-7tC.js → agent-connections-BmjcmCOh.js} +1 -1
- package/dist/public/assets/{agent-registry-CC-eSzdu.js → agent-registry--47SG0kt.js} +1 -1
- package/dist/public/assets/{bridge-1xVdv27q.js → bridge-njD5PB6P.js} +1 -1
- package/dist/public/assets/{card-CUu_Dbtf.js → card-BsBNZHzU.js} +1 -1
- package/dist/public/assets/{catalog-DQ0C9DYn.js → catalog-DtlAjcAT.js} +1 -1
- package/dist/public/assets/{comment-chips-ucdDq5Q3.js → comment-chips-CO_v36hx.js} +1 -1
- package/dist/public/assets/{config-provider-BDWGnun_.js → config-provider-DYjwca1V.js} +1 -1
- package/dist/public/assets/config-schema-CjObvyCB.js +1 -0
- package/dist/public/assets/{css-color-to-hex-Ds26W_X-.js → css-color-to-hex-vFOfC-Pa.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-CdteDFL9.js → doc-undo-manager-Dn9t2Iwn.js} +1 -1
- package/dist/public/assets/field-controls-23rf_c2g.js +1 -0
- package/dist/public/assets/{field-controls-CFLl9l2A.js → field-controls-CAjZIoxe.js} +1 -1
- package/dist/public/assets/{frontmatter-tags-BIkfDL6K.js → frontmatter-tags-B-pVcI4P.js} +1 -1
- package/dist/public/assets/{index-X6cytEL5.js → index-jj7AN3ys.js} +7 -7
- package/dist/public/assets/{lint-config-client-DgV9TE2y.js → lint-config-client-DRl_GTbs.js} +1 -1
- package/dist/public/assets/{lint-plugins-DmlA1sEu.js → lint-plugins-DQC4DG_-.js} +1 -1
- package/dist/public/assets/{markdown-lint-CfRH6CjV.js → markdown-lint-C_9h2J3z.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-CN1TwJhU.js → markdownlint-rule-browser-BShldaY9.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-NYViaTsT.js → pending-receive-nav-store-DIU-Po1C.js} +1 -1
- package/dist/public/assets/{preferred-session-events-78C4kXpL.js → preferred-session-events-Ayg96deM.js} +1 -1
- package/dist/public/assets/{progress-C_Q7qzuf.js → progress-BpdOUTnu.js} +1 -1
- package/dist/public/assets/{saved-themes-client-D5M6AESh.js → saved-themes-client-BdzXiLZg.js} +1 -1
- package/dist/public/assets/{schema-section-Cn4ovS7A.js → schema-section-AjQemGau.js} +1 -1
- package/dist/public/assets/{schemas-api-KjBzkxAy.js → schemas-api-C4CP1G39.js} +1 -1
- package/dist/public/assets/{selection-context-C9FxlvvI.js → selection-context-Dj_iPBku.js} +1 -1
- package/dist/public/assets/{skills-api-DfXaxEkX.js → skills-api-BUVVp6gv.js} +1 -1
- package/dist/public/assets/{src-zjRc3l1B.js → src-CS5ZPUzW.js} +1 -1
- package/dist/public/assets/storage-scope-DRWogX35.js +1 -0
- package/dist/public/assets/{tag-pill-input-D_82NbMi.js → tag-pill-input-BoyxN9pC.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-BBXwmVEO.js → terminal-launch-events-Cy8GAcTt.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-Ba4T0Jvq.js → typing-burst-detector-Clq1sSnx.js} +1 -1
- package/dist/public/assets/{use-activity-panel-DgFEYoQD.js → use-activity-panel-I5AELaRz.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-DyzsFMYv.js → use-apply-config-color-theme-lLFWDFMc.js} +1 -1
- package/dist/public/assets/{use-conflicts-B9eHyj9o.js → use-conflicts-B0yvUiLf.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-D9OrOkx3.js → use-live-xterm-theme-BIzA-mu0.js} +1 -1
- package/dist/public/assets/{use-open-skill-DX2J-XUP.js → use-open-skill-Bro5-8rY.js} +1 -1
- package/dist/public/assets/{use-semantic-search-status-BGdqXgED.js → use-semantic-search-status-CGPJyDjj.js} +1 -1
- package/dist/public/assets/{use-skill-origin-BqSrJPU6.js → use-skill-origin-Cv_S5gSq.js} +1 -1
- package/dist/public/assets/{use-skill-targets-oy2zvORL.js → use-skill-targets-D-Tfz8TQ.js} +1 -1
- package/dist/public/assets/{use-skills-CV4zn3OT.js → use-skills-CRuEYkjM.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-MKxsix4h.js → use-terminal-enabled-DASwB3kR.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-DsZ2Vu7B.js → use-timeline-entry-diff-DePScbzI.js} +1 -1
- package/dist/public/assets/{use-workspace-Co3BqTgM.js → use-workspace-Bf2VHQrp.js} +1 -1
- package/dist/public/index.html +45 -45
- package/dist/{registry-probes-eRPQMY-y.mjs → registry-probes-CtY_1ly1.mjs} +1 -1
- package/dist/{removal-file-path-CLkfpBwn.mjs → removal-file-path-CNIqq13J.mjs} +1 -1
- package/dist/{repair-launch-json-VnuW7Q8d.mjs → repair-launch-json-CJpZgLgO.mjs} +1 -1
- package/dist/{repair-mcp-configs-CE_7diVc.mjs → repair-mcp-configs-DlqDZ1Q-.mjs} +1 -1
- package/dist/{src-DRsRktps.mjs → src-CnRhVti_.mjs} +1 -1
- package/dist/src-lCnJgf0p.mjs +1 -0
- package/dist/start-CIrEb03P.mjs +1 -0
- package/dist/{start-CpHu1y5K.mjs → start-UcVINga1.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-ClUiDros.mjs +0 -1
- package/dist/init-B5hTJt74.mjs +0 -1
- package/dist/loader-DsVfCsZZ.mjs +0 -1
- package/dist/preview-BSdoL4SZ.mjs +0 -1
- package/dist/public/assets/FeedbackForm-CAstgJmN.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-DccpG1E9.js +0 -1
- package/dist/public/assets/config-schema-mXZFcyl-.js +0 -1
- package/dist/public/assets/field-controls-k0sTXrth.js +0 -1
- package/dist/public/assets/storage-scope-BVU9p11A.js +0 -1
- package/dist/src-mWhQUBg3.mjs +0 -1
- package/dist/start-BqJyj8XY.mjs +0 -1
|
@@ -238,7 +238,7 @@ $2`).split(`
|
|
|
238
238
|
`)].join(`
|
|
239
239
|
`);case`REMOVED_KEY`:{let t=e.path.join(`.`),n=[`${e.source?`Removed key at ${e.source.file}:${e.source.line}:${e.source.column}`:`Removed key in configuration`}: ${t}`,e.redirect];if(e.source?.snippet&&e.source.snippet.length>0)for(let t of e.source.snippet.split(`
|
|
240
240
|
`))n.push(` ${t}`);return n.join(`
|
|
241
|
-
`)}case`NOT_SYNCED`:return`Settings are still loading. Try again in a moment.`;case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}function Kg(e,t,n){return qg([e,t,n],[])}function qg(e,t){if(t.length>0){let n=Vh(Rh,t);if(n?.scope===`user`)return e[0];if(n?.scope===`project`)return e[1]??e[0];if(n?.scope===`project-local`)return e[2]??e[0]}let n=Jg(e);if(n===void 0)return;if(n===null)return null;if(Array.isArray(n)||typeof n!=`object`)return n;let r=e.map(e=>Yg(e)?e:void 0),i=new Set;for(let e of r)if(e!==void 0)for(let t of Object.keys(e))i.add(t);let a={};for(let e of i)a[e]=qg(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function Jg(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function Yg(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Xg=`__system__`,Zg=1,Qg=`__config__/project`,$g=`__user__/config.yml`,e_=`__local__/project`,t_=`__config__/okignore`,n_=Object.freeze([Qg,e_,$g,t_]),r_=`__skill__/`,i_=`__template__/`,a_=[`project`,`global`];function o_(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)||e.startsWith(`__extskill__/`)}function s_(e){return`__extskill__/${e}`}function c_(e){if(!e.startsWith(`__extskill__/`))return null;let t=e.slice(13),n=t.indexOf(`/`),r=n<0?t:t.slice(0,n),i=n<0?null:t.slice(n+1);return/^[a-z0-9-]+$/.test(r)?{name:r,rel:i&&i.length>0?i:null}:null}function l_(e){return e.replace(/\.mdx?$/i,``)}const u_=`.ok/skills`;function d_(e){return`${u_}/${e}/SKILL`}const f_=[`references`,`scripts`];function p_(e,t){let n=e.trim();if(!n.startsWith(`/`))return null;let r=n.slice(1);if(r===``||r.includes(`/`))return null;let i=/^(\.[A-Za-z0-9_-]+\/skills)\/[^/]+\/(?:SKILL|references\/.+)$/.exec(t);return i?`${i[1]}/${r}/SKILL`:/^__skill__\/(global)\/[^/]+(?:\/references\/.+)?$/.exec(t)?y_(`global`,r):null}function m_(e,t){let n=/^(\.[A-Za-z0-9_-]+\/skills\/[^/]+)\/(?:SKILL|references\/.+)$/.exec(t)??/^(__skill__\/global\/[^/]+)(?:\/references\/.+)?$/.exec(t)??/^(__extskill__\/[^/]+)(?:\/.+)?$/.exec(t);if(!n)return null;let r=n[1],i=l_(e.trim()).split(`/`).filter(e=>e!==``&&e!==`.`),[a]=i;return!a||!f_.includes(a)||i.includes(`..`)||i.length<2?null:`${r}/${i.join(`/`)}`}const h_=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(SKILL|references\/.+)$/;function g_(e){let t=h_.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===`SKILL`?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}const __=/^__skill__\/global\/([^/]+)(?:\/(references\/.+))?$/;function v_(e){let t=__.exec(e);if(!t)return null;let{name:n,host:r}=b_(t[1]),i=t[2];return i===void 0?{name:n,kind:`skill`,rel:null,host:r}:{name:n,kind:`reference`,rel:i.slice(11),host:r}}function y_(e,t,n){return e===`project`?d_(t):`${r_}${e}/${t}${n?`@${n}`:``}`}function b_(e){let t=e.indexOf(`@`);if(t<0)return{name:e,host:null};let n=e.slice(t+1);return{name:e.slice(0,t),host:n===``?null:n}}function x_(e){if(e===``)return``;try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function S_(e){if(e.startsWith(`__skill__/`)){let t=e.slice(10),n=t.indexOf(`/`);if(n<0)return null;let r=t.slice(0,n);if(r!==`global`&&r!==`project`)return null;let i=t.slice(n+1);if(!i)return null;let a=x_(i),o=a.indexOf(`/`),s=o<0?a:a.slice(0,o);if(!s)return null;let c=o<0?null:a.slice(o+1),{name:l,host:u}=b_(s);return l?{kind:`skill`,scope:r,name:l,host:u,rel:c}:null}return null}function C_(e,t){let n=e.replace(/^\/+|\/+$/g,``);return n?`${n}/.ok/templates/${t}`:`.ok/templates/${t}`}const w_=[`.mdx`,`.md`],T_=v.stable.mcpServerName,E_=`Server unreachable:`,D_=`Server timed out:`,O_=[`exec`,`search`,`history`,`links`,`skills`,`config`,`palette`,`preview_url`,`share_link`,`lint`,`audit`,`write`,`edit`,`delete`,`move`,`install`,`import`,`checkpoint`,`restore_version`],k_=`OK_HOSTED_AGENT`;function A_(e){return e.OK_DESKTOP_TERMINAL===`1`||e.OK_HOSTED_AGENT===`1`}function j_(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}const M_=new Set([`opencode.json`]),N_=/^\.[A-Za-z0-9_-]+\/skills\/[^/]+\/.+$/;function P_(e){return N_.test(e)}function F_(e){return P_(e)?!1:e.split(`/`).some(e=>e.startsWith(`.`))?!0:M_.has(e.slice(e.lastIndexOf(`/`)+1))}const I_=P(j().min(1)).max(50),ane=I([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),one=F({label:j().min(1),webUrl:so().nullable(),transport:I([`https`,`http`,`ssh`,`git`]).optional()}).loose(),sne=Mo(`checkStatus`,[F({checkStatus:L(`allowed`)}).loose(),F({checkStatus:L(`denied`),deniedReason:I([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`]),resolvedLogin:j().optional(),declaredLogin:j().optional(),declaredSource:j().optional()}).loose(),F({checkStatus:L(`unknown`),unknownError:I([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),L_=I([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`auth-not-found-as-identity`,`semantic-protected-branch`]),cne=I(Lp),lne=I([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]),une=F({state:ane,lastSyncUtc:j().nullable(),lastRunUtc:j().nullable().optional(),lastPullOkUtc:j().nullable().optional(),lastPushOkUtc:j().nullable().optional(),lastFetchUtc:j().nullable(),lastPushedSha:j().nullable(),ahead:M().int().min(0),behind:M().int().min(0),consecutiveFailures:M().int().min(0),consecutivePushFailures:M().int().min(0).optional(),conflictCount:M().int().min(0),hasRemote:N(),syncEnabled:N(),identityUnresolved:N(),remote:one.nullable().optional(),pushError:j().optional(),pushErrorCode:L_.optional(),pullError:j().optional(),pullErrorCode:L_.optional(),pausedReason:j().optional(),blockingPaths:P(j().min(1)).optional(),refusedSymlinkPaths:I_.optional(),pushPermission:sne.optional(),syncMode:cne.optional(),lastPullUtc:j().nullable().optional(),lastPullOutcome:lne.nullable().optional()}).loose(),dne=F({action:I([`commit`]),paths:P(j().min(1)),commitSha:j().optional()}).loose(),fne=F({action:I([`commit`])}).loose(),pne=F({op:I([`sync`,`push`,`pull`,`fetch`]).optional()}).loose(),mne=F({op:I([`sync`,`push`,`pull`,`fetch`])}).loose(),R_=[`merge-native`,`working-tree`,`reconcile`],z_=I(R_),B_=[`merged-with-markers`,`refused-conflict-markers`,`refused-no-base`,`refused-too-large`,`disk-markers`,`stale-external-write`],V_=I(B_),hne=I([`mine`,`theirs`,`content`,`delete`]),gne=F({conflicts:P(F({file:j().min(1),detectedAt:j().min(1),conflict:z_,reason:V_.optional().catch(void 0),conflictKind:I([`git`,`stale-external-write`]).optional(),docName:j().nullable(),theirsSha:j().optional(),baseSha:j().optional()}).loose())}).loose(),_ne=F({file:j().min(1),strategy:I([`mine`,`theirs`,`content`,`delete`]),content:j().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0,{message:`content must be provided when strategy is 'content' (an empty string keeps an empty file)`,path:[`content`]}),vne=F({}).loose(),yne=F({file:j().min(1),base:j(),ours:j(),theirs:j(),kind:I([`both-modified`,`delete-modify`,`modify-delete`]),conflict:z_,reason:V_.optional().catch(void 0),conflictKind:I([`git`,`stale-external-write`]).optional(),resolutionOptions:P(hne)}).loose(),bne=F({plan:ps(e=>e!==void 0,{message:`plan is required`})}).loose(),xne=F({plan:ps(e=>e!==void 0,{message:`plan is required`})}).loose(),Sne=F({result:ps(e=>e!==void 0,{message:`result is required`})}).loose(),Cne=F({packId:j().min(1)}).strict(),wne=F({installedHosts:P(j()),skills:P(F({name:j().min(1),created:N()}).strict())}).strict(),Tne=F({path:j().min(1),summary:j().min(1)}).loose(),Ene=F({files:M().int().nonnegative(),folders:M().int().nonnegative()}).loose(),Dne=F({packs:P(F({id:j().min(1),name:j().min(1),description:j().min(1),defaultSubfolder:j().optional(),folders:P(Tne),entryCounts:Ene}).loose())}).loose(),One=F({noOpen:N().optional(),out:j().min(1).optional()}).loose(),kne=F({reason:I([`unsupported-platform`,`spawn-error`]),message:j()}).loose(),Ane=Mo(`status`,[F({status:L(`installed`),outputPath:j(),size:M().int().nonnegative(),sha256:j(),skillVersion:j()}).loose(),F({status:L(`built`),outputPath:j(),size:M().int().nonnegative(),sha256:j(),skillVersion:j(),handoffError:kne.optional()}).loose(),F({status:L(`failed`),buildError:j()}).loose(),F({status:L(`skip-current`),skillVersion:j(),recordedAt:j().optional()}).loose()]),jne=Mo(`kind`,[F({kind:L(`doc`),docPath:j().min(1)}).loose(),F({kind:L(`folder`),folderPath:j()}).loose()]),H_=I([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),U_=I([`current`,`stale`,`absent`,`empty`]),Mne=Mo(`ok`,[F({ok:L(!0),shareUrl:j().min(1),sharedUrl:j().min(1),branch:j().min(1),freshness:U_.optional().catch(void 0)}).loose(),F({ok:L(!1),error:H_,branch:j().min(1).optional()}).loose()]),Nne=I([`user`,`org`]),Pne=F({login:j().min(1),kind:Nne,avatarUrl:j().optional()}).loose(),W_=I([`auth-required`,`network`]),Fne=Mo(`ok`,[F({ok:L(!0),owners:P(Pne)}).loose(),F({ok:L(!1),error:W_}).loose()]),Ine=Mo(`ok`,[F({ok:L(!0),available:N()}).loose(),F({ok:L(!1),error:W_}).loose()]),Lne=I([`public`,`private`]),Rne=F({owner:j().min(1),name:j().min(1),visibility:Lne,description:j().optional()}).loose(),zne=I([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),Bne=Mo(`ok`,[F({ok:L(!0),ownerLogin:j().min(1),repoName:j().min(1),cloneUrl:j().min(1),defaultBranch:j().min(1)}).loose(),F({ok:L(!1),error:zne}).loose()]);function G_(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const K_=e=>e.refine(G_,`invalid branch name`);function q_(e){if(e==null)return!1;let t=e instanceof Error?e.message:String(e);return/couldn'?t find remote ref|Remote branch .+ not found/i.test(t)}const J_=[/could not read (username|password)/i,/terminal prompts disabled/i,/user interactivity has been disabled/i,/unable to get password from user/i],Y_=[/insufficient scopes/i,/missing.*scope/i,/required scope/i],X_=[/permission denied.*\(publickey\)/i,/host key verification failed/i],Z_=/fatal:.*repository.*not found/i,Q_=[/\b(401|403)\b/,/authentication failed/i,/authorization failed/i,/invalid credentials/i,/credential helper/i,/bad credentials/i,/token.*expired/i,/expired.*token/i,Z_];function $_(e){if(typeof e!=`object`||!e)return``;let t=e.git;return t==null?``:String(t)}function ev(e){if(e==null)return{kind:`non-auth`};let t=`${e instanceof Error?e.message:String(e)}\n${$_(e)}`;return J_.some(e=>e.test(t))?{kind:`auth`,subclass:`no-credential`}:Y_.some(e=>e.test(t))?{kind:`auth`,subclass:`scope-mismatch`}:X_.some(e=>e.test(t))?{kind:`auth`,subclass:`ssh-auth`}:Q_.some(e=>e.test(t))?/\b401\b/.test(t)||/token.*expired/i.test(t)?{kind:`auth`,subclass:`401`}:/\b403\b/.test(t)?{kind:`auth`,subclass:`403`}:Z_.test(t)?{kind:`auth`,subclass:`not-found-as-identity`}:{kind:`auth`,subclass:`unknown-auth`}:{kind:`non-auth`}}function tv(e){return e.kind===`auth`?e.subclass===`no-credential`||e.subclass===`401`||e.subclass===`unknown-auth`:!1}const nv={shareTargetExists:N(),dirtyConflicts:F({conflicts:N(),files:P(j().min(1))}).loose(),branchIsLocal:N(),shareTargetOnOriginBranch:N().optional()},rv=Mo(`detached`,[F({detached:L(!1),currentBranch:j().min(1).nullable(),currentHeadSha:Co(),...nv}).loose(),F({detached:L(!0),currentBranch:Co(),currentHeadSha:j().min(1),...nv}).loose()]),iv=F({branch:K_(j().min(1)),principalId:j().optional(),fastForward:N().optional()}).loose(),av=I([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`,`unsafe-symlinks`,`symlink-check-failed`]),ov=Mo(`ok`,[F({ok:L(!0)}).loose(),F({ok:L(!1),reason:av,files:P(j().min(1)).optional(),otherWorktreePath:j().min(1).optional(),refusedSymlinkPaths:I_.optional()}).loose()]);I([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]);const sv=F({branch:K_(j().min(1)),path:j(),kind:I([`doc`,`folder`]),contentRootDepth:M().int().min(1).max(65535).optional()}).loose(),cv=Mo(`verdict`,[F({verdict:L(`on-origin`)}).loose(),F({verdict:L(`renamed`),renamedTo:j().min(1)}).loose(),F({verdict:L(`deleted`)}).loose(),F({verdict:L(`never-on-branch`)}).loose(),F({verdict:L(`changed-locally`)}).loose(),F({verdict:L(`unknown`)}).loose()]).catch({verdict:`unknown`});function lv(e,t){let n=j_(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const uv=j().superRefine(lv).optional(),dv=j().superRefine(lv),fv={agentId:j().optional(),agentName:j().optional(),colorSeed:j().optional(),clientName:j().optional(),clientVersion:j().optional(),label:j().optional()},pv=j().optional(),mv=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,hv=F({startedAt:j().min(1),httpListenMs:M().nonnegative().optional(),seedWalkMs:M().nonnegative().optional(),indexesMs:M().nonnegative().optional(),readyMs:M().nonnegative().optional(),fileCount:M().nonnegative().optional()}),gv=F({serverInstanceId:j().min(1),currentBranch:j().min(1).optional(),currentDiskAckSVs:Ro(j().min(1),j().min(1)).optional(),boot:hv.optional(),collabClients:M().int().nonnegative().optional()}).loose(),_v=F({id:j().min(1),display_name:j().min(1),display_email:j(),source:I([`git-config`,`synthesized`]),created_at:j().min(1)}).loose(),vv=F({collabUrl:j().nullable(),previewUrl:j().nullable(),port:M(),singleFile:N().default(!1)}).loose(),yv=I(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:symlink-refused.urn:ok:error:links-not-permitted.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:unsupported-media-type.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:stale-external-write.urn:ok:error:store-refused.urn:ok:error:doc-removed.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:non-github-origin.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:concurrent-overwrite-refused.urn:ok:error:unresolved-conflict-markers.urn:ok:error:no-conflict-tracked.urn:ok:error:no-blocking-changes.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`));function bv(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const xv=F({type:yv,title:j().min(1),status:M().int().min(400).max(599),instance:j().regex(mv,`instance must be urn:uuid:<uuid>`).optional(),detail:j().optional()}).loose(),Sv=F({parentDocName:j().min(1),placement:I([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:j().min(1).optional(),agentName:j().min(1).optional()}).loose(),Cv=F({src:j().min(1),path:j().min(1).optional(),deduped:N().optional()}).loose(),wv=F({url:j().min(1),dir:j().min(1),branch:j().min(1).refine(G_,`invalid branch name`).optional()}).loose(),Tv=F({type:L(`error`),problem:xv}).loose(),Ev=F({docName:uv,summary:pv,content:j().optional(),...fv}).loose(),Dv=F({docName:uv,summary:pv,markdown:j(),position:I([`append`,`prepend`,`replace`]).optional(),extension:I(w_).optional(),...fv}).loose(),Ov=F({docName:uv,summary:pv,find:j().min(1),replace:j(),offset:M().int().nonnegative().optional(),...fv}).loose(),kv=F({docName:uv,connectionId:j().min(1),scope:I([`last`,`session`,`file`,`count`]).optional(),count:M().int().positive().optional(),...fv}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]}),Av=F({value:j(),truncatedFrom:M().int().nonnegative().optional(),hint:j().optional()}).loose(),jv=Mo(`kind`,[F({kind:L(`inline`),content:j()}),F({kind:L(`truncated`),byteLength:M().int().nonnegative(),hint:j()})]),Mv=F({kind:L(`content-divergence`),intendedBytes:M().int().nonnegative(),actualBytes:M().int().nonnegative(),byteDelta:M().int(),divergenceType:j().optional(),currentState:jv.optional(),hint:j().optional()}).loose(),Nv=F({type:L(`orphan`),parentCandidates:P(j()),message:j()}).loose(),Pv=F({kind:L(`disk-edit-reconciled`),intendedBytes:M().int().nonnegative(),actualBytes:M().int().nonnegative(),byteDelta:M().int(),mergeOutcome:j().optional(),hint:j().optional()}).loose();Mo(`kind`,[Mv,Pv]);const Fv=Object.keys({"content-divergence":!0,"disk-edit-reconciled":!0});function Iv(e){return Fv.includes(e)}function Lv(e){throw Error(`Unexpected WriteWarning variant: ${JSON.stringify(e)}`)}const Rv=F({kind:L(`mermaid-parse-error`),fenceIndex:M().int().positive(),fenceFirstLine:j(),message:j(),line:M().int().positive().optional()}).loose(),zv=F({href:j(),targetKind:j(),role:j(),sourceForm:j(),resolvedTarget:j().nullable(),reason:j(),resolutionMethod:j(),fallbackTarget:j().nullable().optional(),definition:F({line:M().int().nonnegative(),label:j()}).loose().optional()}).loose(),Bv=Mo(`kind`,[Mv,Pv,Rv,F({kind:L(`lint-violation`),source:j(),code:j(),message:j(),severity:I([`error`,`warning`,`info`,`hint`]),line:M().int().positive(),column:M().int().positive(),linkTarget:j().optional(),localTarget:zv.optional()}).loose()]),Vv=P(Bv).min(1),Hv=F({href:j(),resolvedTo:j().nullable(),reason:I([`no-such-doc`,`no-such-file`,`unresolvable`]),localTarget:zv.optional()}).loose(),Uv=P(Hv),Wv=[`reserved-log-policy`],Gv=F({reason:j().min(1),count:M().int().positive()}).loose(),Kv=F({timestamp:j().min(1),summary:Av.optional(),warnings:Vv.optional()}).loose(),qv=F({timestamp:j().min(1),subscriberCount:M().int().nonnegative(),systemSubscriberCount:M().int().nonnegative(),hints:P(Nv).optional(),summary:Av.optional(),warnings:Vv.optional(),brokenLinks:Uv,brokenLinkSuppression:Gv.optional()}).loose(),Jv=F({timestamp:j().min(1),subscriberCount:M().int().nonnegative(),systemSubscriberCount:M().int().nonnegative(),summary:Av.optional(),warnings:Vv.optional(),brokenLinks:Uv,brokenLinkSuppression:Gv.optional()}).loose(),Yv=F({docName:j().min(1),scope:I([`last`,`session`,`count`]),undone:N()}).loose(),Xv=F({docs:P(F({docName:dv,markdown:j(),position:I([`append`,`prepend`,`replace`]).optional(),extension:I(w_).optional(),summary:pv}).loose()).min(1).max(100),...fv}).loose(),Zv=F({type:yv,title:j(),detail:j().optional()}).loose(),Qv=Mo(`status`,[F({status:L(`written`),docName:j().min(1),summary:Av.optional(),warnings:Vv.optional(),brokenLinks:Uv,brokenLinkSuppression:Gv.optional()}).loose(),F({status:L(`error`),docName:j().min(1),error:Zv}).loose()]),$v=F({timestamp:j().min(1),results:P(Qv),written:M().int().nonnegative(),failed:M().int().nonnegative()}).loose(),ey=F({docName:uv,patch:Ro(j(),Ao([$l,Co()])),types:Ro(j(),I(Xl)).optional(),summary:pv,...fv}).loose(),ty=F({timestamp:j().min(1),subscriberCount:M().int().nonnegative(),systemSubscriberCount:M().int().nonnegative(),appliedKeys:P(j()),summary:Av.optional(),warnings:Vv.optional(),brokenLinks:Uv,brokenLinkSuppression:Gv.optional()}).loose();function ny(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}const ry=my(/[A-Za-z]/),iy=my(/[\dA-Za-z]/),ay=my(/[#-'*+\--9=?A-Z^-~]/);function oy(e){return e!==null&&(e<32||e===127)}const sy=my(/\d/),cy=my(/[\dA-Fa-f]/),ly=my(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function uy(e){return e!==null&&(e<0||e===32)}function dy(e){return e===-2||e===-1||e===32}const fy=my(/\p{P}|\p{S}/u),py=my(/\s/);function my(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function hy(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}const gy=(function(e,t,n,r,i){let a=_y(t);if(n!=null&&(typeof n!=`number`||n<0||n===1/0))throw Error(`Expected positive finite index`);if(r!=null&&(!gy(r)||!r.children))throw Error(`Expected parent node`);if(r==null!=(n==null))throw Error(`Expected both parent and index`);return Cy(e)?a.call(i,e,n,r):!1}),_y=(function(e){if(e==null)return Sy;if(typeof e==`function`)return xy(e);if(typeof e==`object`)return Array.isArray(e)?vy(e):yy(e);if(typeof e==`string`)return by(e);throw Error(`Expected function, string, or object as test`)});function vy(e){let t=[],n=-1;for(;++n<e.length;)t[n]=_y(e[n]);return xy(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function yy(e){let t=e;return xy(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function by(e){return xy(t);function t(t){return t&&t.type===e}}function xy(e){return t;function t(t,n,r){return!!(Cy(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Sy(){return!0}function Cy(e){return typeof e==`object`&&!!e&&`type`in e}function wy(e){return`\x1B[33m`+e+`\x1B[39m`}const Ty=[],Ey=`skip`;function Dy(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=_y(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+wy(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Ty,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Oy(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Oy(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Ty:[e]}function ky(e,t,n){let r=_y((n||{}).ignore||[]),i=Ay(t),a=-1;for(;++a<i.length;)Dy(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function Ay(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([jy(e[0]),My(e[1])])}return t}function jy(e){return typeof e==`string`?new RegExp(hy(e),`g`):e}function My(e){return typeof e==`function`?e:function(){return e}}const Ny=`phrasing`,Py=[`autolink`,`link`,`image`,`label`];function Fy(){return{transforms:[Uy],enter:{literalAutolink:Ly,literalAutolinkEmail:Ry,literalAutolinkHttp:Ry,literalAutolinkWww:Ry},exit:{literalAutolink:Hy,literalAutolinkEmail:Vy,literalAutolinkHttp:zy,literalAutolinkWww:By}}}function Iy(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Ny,notInConstruct:Py},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Ny,notInConstruct:Py},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Ny,notInConstruct:Py}]}}function Ly(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Ry(e){this.config.enter.autolinkProtocol.call(this,e)}function zy(e){this.config.exit.autolinkProtocol.call(this,e)}function By(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Vy(e){this.config.exit.autolinkEmail.call(this,e)}function Hy(e){this.exit(e)}function Uy(e){ky(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Wy],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Gy]],{ignore:[`link`,`linkReference`]})}function Wy(e,t,n,r,i){let a=``;if(!Jy(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Ky(n)))return!1;let o=qy(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Gy(e,t,n,r){return!Jy(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Ky(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function qy(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=ny(e,`(`),a=ny(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Jy(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||py(n)||fy(n))&&(!t||n!==47)}function Yy(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}ab.peek=ib;function Xy(){this.buffer()}function Zy(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Qy(){this.buffer()}function $y(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function eb(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Yy(this.sliceSerialize(e)).toLowerCase(),n.label=t}function tb(e){this.exit(e)}function nb(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Yy(this.sliceSerialize(e)).toLowerCase(),n.label=t}function rb(e){this.exit(e)}function ib(){return`[`}function ab(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function ob(){return{enter:{gfmFootnoteCallString:Xy,gfmFootnoteCall:Zy,gfmFootnoteDefinitionLabelString:Qy,gfmFootnoteDefinition:$y},exit:{gfmFootnoteCallString:eb,gfmFootnoteCall:tb,gfmFootnoteDefinitionLabelString:nb,gfmFootnoteDefinition:rb}}}function sb(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:ab},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
241
|
+
`)}case`NOT_SYNCED`:return`Settings are still loading. Try again in a moment.`;case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}function Kg(e,t,n){return qg([e,t,n],[])}function qg(e,t){if(t.length>0){let n=Vh(Rh,t);if(n?.scope===`user`)return e[0];if(n?.scope===`project`)return e[1]??e[0];if(n?.scope===`project-local`)return e[2]??e[0]}let n=Jg(e);if(n===void 0)return;if(n===null)return null;if(Array.isArray(n)||typeof n!=`object`)return n;let r=e.map(e=>Yg(e)?e:void 0),i=new Set;for(let e of r)if(e!==void 0)for(let t of Object.keys(e))i.add(t);let a={};for(let e of i)a[e]=qg(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function Jg(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function Yg(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Xg=`__system__`,Zg=1,Qg=`__config__/project`,$g=`__user__/config.yml`,e_=`__local__/project`,t_=`__config__/okignore`,n_=Object.freeze([Qg,e_,$g,t_]),r_=`__skill__/`,i_=`__template__/`,a_=[`project`,`global`];function o_(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)||e.startsWith(`__extskill__/`)}function s_(e){return`__extskill__/${e}`}function c_(e){if(!e.startsWith(`__extskill__/`))return null;let t=e.slice(13),n=t.indexOf(`/`),r=n<0?t:t.slice(0,n),i=n<0?null:t.slice(n+1);return/^[a-z0-9-]+$/.test(r)?{name:r,rel:i&&i.length>0?i:null}:null}function l_(e){return e.replace(/\.mdx?$/i,``)}const u_=`.ok/skills`;function d_(e){return`${u_}/${e}/SKILL`}const f_=[`references`,`scripts`];function p_(e,t){let n=e.trim();if(!n.startsWith(`/`))return null;let r=n.slice(1);if(r===``||r.includes(`/`))return null;let i=/^(\.[A-Za-z0-9_-]+\/skills)\/[^/]+\/(?:SKILL|references\/.+)$/.exec(t);return i?`${i[1]}/${r}/SKILL`:/^__skill__\/(global)\/[^/]+(?:\/references\/.+)?$/.exec(t)?y_(`global`,r):null}function m_(e,t){let n=/^(\.[A-Za-z0-9_-]+\/skills\/[^/]+)\/(?:SKILL|references\/.+)$/.exec(t)??/^(__skill__\/global\/[^/]+)(?:\/references\/.+)?$/.exec(t)??/^(__extskill__\/[^/]+)(?:\/.+)?$/.exec(t);if(!n)return null;let r=n[1],i=l_(e.trim()).split(`/`).filter(e=>e!==``&&e!==`.`),[a]=i;return!a||!f_.includes(a)||i.includes(`..`)||i.length<2?null:`${r}/${i.join(`/`)}`}const h_=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(SKILL|references\/.+)$/;function g_(e){let t=h_.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===`SKILL`?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}const __=/^__skill__\/global\/([^/]+)(?:\/(references\/.+))?$/;function v_(e){let t=__.exec(e);if(!t)return null;let{name:n,host:r}=b_(t[1]),i=t[2];return i===void 0?{name:n,kind:`skill`,rel:null,host:r}:{name:n,kind:`reference`,rel:i.slice(11),host:r}}function y_(e,t,n){return e===`project`?d_(t):`${r_}${e}/${t}${n?`@${n}`:``}`}function b_(e){let t=e.indexOf(`@`);if(t<0)return{name:e,host:null};let n=e.slice(t+1);return{name:e.slice(0,t),host:n===``?null:n}}function x_(e){if(e===``)return``;try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function S_(e){if(e.startsWith(`__skill__/`)){let t=e.slice(10),n=t.indexOf(`/`);if(n<0)return null;let r=t.slice(0,n);if(r!==`global`&&r!==`project`)return null;let i=t.slice(n+1);if(!i)return null;let a=x_(i),o=a.indexOf(`/`),s=o<0?a:a.slice(0,o);if(!s)return null;let c=o<0?null:a.slice(o+1),{name:l,host:u}=b_(s);return l?{kind:`skill`,scope:r,name:l,host:u,rel:c}:null}return null}function C_(e,t){let n=e.replace(/^\/+|\/+$/g,``);return n?`${n}/.ok/templates/${t}`:`.ok/templates/${t}`}const w_=[`.mdx`,`.md`],T_=v.stable.mcpServerName,E_=`Server unreachable:`,D_=`Server timed out:`,O_=[`exec`,`search`,`history`,`links`,`skills`,`config`,`palette`,`preview_url`,`share_link`,`lint`,`audit`,`write`,`edit`,`delete`,`move`,`install`,`import`,`checkpoint`,`restore_version`],k_=`OK_HOSTED_AGENT`;function A_(e){return e.OK_DESKTOP_TERMINAL===`1`||e.OK_HOSTED_AGENT===`1`}function j_(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}const M_=new Set([`opencode.json`]),N_=/^\.[A-Za-z0-9_-]+\/skills\/[^/]+\/.+$/;function P_(e){return N_.test(e)}function F_(e){return P_(e)?!1:e.split(`/`).some(e=>e.startsWith(`.`))?!0:M_.has(e.slice(e.lastIndexOf(`/`)+1))}const I_=P(j().min(1)).max(50),ane=I([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),one=F({label:j().min(1),webUrl:so().nullable(),transport:I([`https`,`http`,`ssh`,`git`]).optional()}).loose(),sne=Mo(`checkStatus`,[F({checkStatus:L(`allowed`)}).loose(),F({checkStatus:L(`denied`),deniedReason:I([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`]),resolvedLogin:j().optional(),declaredLogin:j().optional(),declaredSource:j().optional()}).loose(),F({checkStatus:L(`unknown`),unknownError:I([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),L_=I([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`auth-not-found-as-identity`,`semantic-protected-branch`]),cne=I(Lp),lne=I([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]),une=F({state:ane,lastSyncUtc:j().nullable(),lastRunUtc:j().nullable().optional(),lastPullOkUtc:j().nullable().optional(),lastPushOkUtc:j().nullable().optional(),lastFetchUtc:j().nullable(),lastPushedSha:j().nullable(),ahead:M().int().min(0),behind:M().int().min(0),consecutiveFailures:M().int().min(0),consecutivePushFailures:M().int().min(0).optional(),conflictCount:M().int().min(0),hasRemote:N(),syncEnabled:N(),identityUnresolved:N(),remote:one.nullable().optional(),pushError:j().optional(),pushErrorCode:L_.optional(),pullError:j().optional(),pullErrorCode:L_.optional(),pausedReason:j().optional(),blockingPaths:P(j().min(1)).optional(),refusedSymlinkPaths:I_.optional(),pushPermission:sne.optional(),syncMode:cne.optional(),lastPullUtc:j().nullable().optional(),lastPullOutcome:lne.nullable().optional()}).loose(),dne=F({action:I([`commit`]),paths:P(j().min(1)),commitSha:j().optional()}).loose(),fne=F({action:I([`commit`])}).loose(),pne=F({op:I([`sync`,`push`,`pull`,`fetch`]).optional()}).loose(),mne=F({op:I([`sync`,`push`,`pull`,`fetch`])}).loose(),R_=[`merge-native`,`working-tree`,`reconcile`],z_=I(R_),B_=[`merged-with-markers`,`refused-conflict-markers`,`refused-no-base`,`refused-too-large`,`disk-markers`,`stale-external-write`],V_=I(B_),hne=I([`mine`,`theirs`,`content`,`delete`]),gne=F({conflicts:P(F({file:j().min(1),detectedAt:j().min(1),conflict:z_,reason:V_.optional().catch(void 0),conflictKind:I([`git`,`stale-external-write`]).optional(),docName:j().nullable(),theirsSha:j().optional(),baseSha:j().optional()}).loose())}).loose(),_ne=F({file:j().min(1),strategy:I([`mine`,`theirs`,`content`,`delete`]),content:j().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0,{message:`content must be provided when strategy is 'content' (an empty string keeps an empty file)`,path:[`content`]}),vne=F({}).loose(),yne=F({file:j().min(1),base:j(),ours:j(),theirs:j(),kind:I([`both-modified`,`delete-modify`,`modify-delete`]),conflict:z_,reason:V_.optional().catch(void 0),conflictKind:I([`git`,`stale-external-write`]).optional(),resolutionOptions:P(hne)}).loose(),bne=F({plan:ps(e=>e!==void 0,{message:`plan is required`})}).loose(),xne=F({plan:ps(e=>e!==void 0,{message:`plan is required`})}).loose(),Sne=F({result:ps(e=>e!==void 0,{message:`result is required`})}).loose(),Cne=F({packId:j().min(1)}).strict(),wne=F({installedHosts:P(j()),skills:P(F({name:j().min(1),created:N()}).strict())}).strict(),Tne=F({path:j().min(1),summary:j().min(1)}).loose(),Ene=F({files:M().int().nonnegative(),folders:M().int().nonnegative()}).loose(),Dne=F({packs:P(F({id:j().min(1),name:j().min(1),description:j().min(1),defaultSubfolder:j().optional(),folders:P(Tne),entryCounts:Ene}).loose())}).loose(),One=F({noOpen:N().optional(),out:j().min(1).optional()}).loose(),kne=F({reason:I([`unsupported-platform`,`spawn-error`]),message:j()}).loose(),Ane=Mo(`status`,[F({status:L(`installed`),outputPath:j(),size:M().int().nonnegative(),sha256:j(),skillVersion:j()}).loose(),F({status:L(`built`),outputPath:j(),size:M().int().nonnegative(),sha256:j(),skillVersion:j(),handoffError:kne.optional()}).loose(),F({status:L(`failed`),buildError:j()}).loose(),F({status:L(`skip-current`),skillVersion:j(),recordedAt:j().optional()}).loose()]),jne=Mo(`kind`,[F({kind:L(`doc`),docPath:j().min(1)}).loose(),F({kind:L(`folder`),folderPath:j()}).loose()]),H_=I([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),U_=I([`current`,`stale`,`absent`,`empty`]),Mne=Mo(`ok`,[F({ok:L(!0),shareUrl:j().min(1),sharedUrl:j().min(1),branch:j().min(1),freshness:U_.optional().catch(void 0)}).loose(),F({ok:L(!1),error:H_,branch:j().min(1).optional()}).loose()]),Nne=I([`user`,`org`]),Pne=F({login:j().min(1),kind:Nne,avatarUrl:j().optional()}).loose(),W_=I([`auth-required`,`network`]),Fne=Mo(`ok`,[F({ok:L(!0),owners:P(Pne)}).loose(),F({ok:L(!1),error:W_}).loose()]),Ine=Mo(`ok`,[F({ok:L(!0),available:N()}).loose(),F({ok:L(!1),error:W_}).loose()]),Lne=I([`public`,`private`]),Rne=F({owner:j().min(1),name:j().min(1),visibility:Lne,description:j().optional()}).loose(),zne=I([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),Bne=Mo(`ok`,[F({ok:L(!0),ownerLogin:j().min(1),repoName:j().min(1),cloneUrl:j().min(1),defaultBranch:j().min(1)}).loose(),F({ok:L(!1),error:zne}).loose()]);function G_(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const K_=e=>e.refine(G_,`invalid branch name`);function q_(e){if(e==null)return!1;let t=e instanceof Error?e.message:String(e);return/couldn'?t find remote ref|Remote branch .+ not found/i.test(t)}const J_=[/could not read (username|password)/i,/terminal prompts disabled/i,/user interactivity has been disabled/i,/unable to get password from user/i],Y_=[/insufficient scopes/i,/missing.*scope/i,/required scope/i],X_=[/permission denied.*\(publickey\)/i,/host key verification failed/i],Z_=/fatal:.*repository.*not found/i,Q_=[/\b(401|403)\b/,/authentication failed/i,/authorization failed/i,/invalid credentials/i,/credential helper/i,/bad credentials/i,/token.*expired/i,/expired.*token/i,Z_];function $_(e){if(typeof e!=`object`||!e)return``;let t=e.git;return t==null?``:String(t)}function ev(e){if(e==null)return{kind:`non-auth`};let t=`${e instanceof Error?e.message:String(e)}\n${$_(e)}`;return J_.some(e=>e.test(t))?{kind:`auth`,subclass:`no-credential`}:Y_.some(e=>e.test(t))?{kind:`auth`,subclass:`scope-mismatch`}:X_.some(e=>e.test(t))?{kind:`auth`,subclass:`ssh-auth`}:Q_.some(e=>e.test(t))?/\b401\b/.test(t)||/token.*expired/i.test(t)?{kind:`auth`,subclass:`401`}:/\b403\b/.test(t)?{kind:`auth`,subclass:`403`}:Z_.test(t)?{kind:`auth`,subclass:`not-found-as-identity`}:{kind:`auth`,subclass:`unknown-auth`}:{kind:`non-auth`}}function tv(e){return e.kind===`auth`?e.subclass===`no-credential`||e.subclass===`401`||e.subclass===`unknown-auth`:!1}const nv={shareTargetExists:N(),dirtyConflicts:F({conflicts:N(),files:P(j().min(1))}).loose(),branchIsLocal:N(),shareTargetOnOriginBranch:N().optional()},rv=Mo(`detached`,[F({detached:L(!1),currentBranch:j().min(1).nullable(),currentHeadSha:Co(),...nv}).loose(),F({detached:L(!0),currentBranch:Co(),currentHeadSha:j().min(1),...nv}).loose()]),iv=F({branch:K_(j().min(1)),principalId:j().optional(),fastForward:N().optional()}).loose(),av=I([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`,`unsafe-symlinks`,`symlink-check-failed`]),ov=Mo(`ok`,[F({ok:L(!0)}).loose(),F({ok:L(!1),reason:av,files:P(j().min(1)).optional(),otherWorktreePath:j().min(1).optional(),refusedSymlinkPaths:I_.optional()}).loose()]);I([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]);const sv=F({branch:K_(j().min(1)),path:j(),kind:I([`doc`,`folder`]),contentRootDepth:M().int().min(1).max(65535).optional()}).loose(),cv=Mo(`verdict`,[F({verdict:L(`on-origin`)}).loose(),F({verdict:L(`renamed`),renamedTo:j().min(1)}).loose(),F({verdict:L(`deleted`)}).loose(),F({verdict:L(`never-on-branch`)}).loose(),F({verdict:L(`changed-locally`)}).loose(),F({verdict:L(`unknown`)}).loose()]).catch({verdict:`unknown`});function lv(e,t){let n=j_(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const uv=j().superRefine(lv).optional(),dv=j().superRefine(lv),fv={agentId:j().optional(),agentName:j().optional(),colorSeed:j().optional(),clientName:j().optional(),clientVersion:j().optional(),label:j().optional()},pv=j().optional(),mv=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,hv=F({startedAt:j().min(1),httpListenMs:M().nonnegative().optional(),seedWalkMs:M().nonnegative().optional(),indexesMs:M().nonnegative().optional(),readyMs:M().nonnegative().optional(),fileCount:M().nonnegative().optional()}),gv=F({serverInstanceId:j().min(1),currentBranch:j().min(1).optional(),currentDiskAckSVs:Ro(j().min(1),j().min(1)).optional(),boot:hv.optional(),collabClients:M().int().nonnegative().optional()}).loose(),_v=F({id:j().min(1),display_name:j().min(1),display_email:j(),source:I([`git-config`,`synthesized`]),created_at:j().min(1)}).loose(),vv=F({collabUrl:j().nullable(),previewUrl:j().nullable(),port:M(),singleFile:N().default(!1)}).loose(),yv=I(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:symlink-refused.urn:ok:error:links-not-permitted.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:unsupported-media-type.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:stale-external-write.urn:ok:error:store-refused.urn:ok:error:doc-removed.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:non-github-origin.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:concurrent-overwrite-refused.urn:ok:error:unresolved-conflict-markers.urn:ok:error:no-conflict-tracked.urn:ok:error:no-blocking-changes.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`));function bv(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const xv=F({type:yv,title:j().min(1),status:M().int().min(400).max(599),instance:j().regex(mv,`instance must be urn:uuid:<uuid>`).optional(),detail:j().optional()}).loose(),Sv=F({parentDocName:j().min(1),placement:I([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:j().min(1).optional(),agentName:j().min(1).optional()}).loose(),Cv=F({src:j().min(1),path:j().min(1).optional(),deduped:N().optional()}).loose(),wv=F({url:j().min(1),dir:j().min(1),branch:j().min(1).refine(G_,`invalid branch name`).optional()}).loose(),Tv=F({type:L(`error`),problem:xv}).loose(),Ev=F({docName:uv,summary:pv,content:j().optional(),...fv}).loose(),Dv=F({docName:uv,summary:pv,markdown:j(),position:I([`append`,`prepend`,`replace`]).optional(),extension:I(w_).optional(),...fv}).loose(),Ov=F({docName:uv,summary:pv,find:j().min(1),replace:j(),offset:M().int().nonnegative().optional(),...fv}).loose(),kv=F({docName:uv,connectionId:j().min(1),scope:I([`last`,`session`,`file`,`count`]).optional(),count:M().int().positive().optional(),...fv}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]}),Av=F({value:j(),truncatedFrom:M().int().nonnegative().optional(),hint:j().optional()}).loose(),jv=Mo(`kind`,[F({kind:L(`inline`),content:j()}),F({kind:L(`truncated`),byteLength:M().int().nonnegative(),hint:j()})]),Mv=F({kind:L(`content-divergence`),intendedBytes:M().int().nonnegative(),actualBytes:M().int().nonnegative(),byteDelta:M().int(),divergenceType:j().optional(),currentState:jv.optional(),hint:j().optional()}).loose(),Nv=F({type:L(`orphan`),parentCandidates:P(j()),message:j()}).loose(),Pv=F({kind:L(`disk-edit-reconciled`),intendedBytes:M().int().nonnegative(),actualBytes:M().int().nonnegative(),byteDelta:M().int(),mergeOutcome:j().optional(),hint:j().optional()}).loose();Mo(`kind`,[Mv,Pv]);const Fv=Object.keys({"content-divergence":!0,"disk-edit-reconciled":!0});function Iv(e){return Fv.includes(e)}function Lv(e){throw Error(`Unexpected WriteWarning variant: ${JSON.stringify(e)}`)}const Rv=F({kind:L(`mermaid-parse-error`),fenceIndex:M().int().positive(),fenceFirstLine:j(),message:j(),line:M().int().positive().optional()}).loose(),zv=F({href:j(),targetKind:j(),role:j(),sourceForm:j(),resolvedTarget:j().nullable(),reason:j(),resolutionMethod:j(),fallbackTarget:j().nullable().optional(),definition:F({line:M().int().nonnegative(),label:j()}).loose().optional()}).loose(),Bv=Mo(`kind`,[Mv,Pv,Rv,F({kind:L(`lint-violation`),source:j(),code:j(),message:j(),severity:I([`error`,`warning`,`info`,`hint`]),line:M().int().positive(),column:M().int().positive(),linkTarget:j().optional(),localTarget:zv.optional()}).loose(),F({kind:L(`link-check-deferred`),message:j()}).loose()]),Vv=P(Bv).min(1),Hv=F({href:j(),resolvedTo:j().nullable(),reason:I([`no-such-doc`,`no-such-file`,`unresolvable`]),localTarget:zv.optional()}).loose(),Uv=P(Hv),Wv=[`reserved-log-policy`],Gv=F({reason:j().min(1),count:M().int().positive()}).loose(),Kv=F({timestamp:j().min(1),summary:Av.optional(),warnings:Vv.optional()}).loose(),qv=F({timestamp:j().min(1),subscriberCount:M().int().nonnegative(),systemSubscriberCount:M().int().nonnegative(),hints:P(Nv).optional(),summary:Av.optional(),warnings:Vv.optional(),brokenLinks:Uv,brokenLinkSuppression:Gv.optional()}).loose(),Jv=F({timestamp:j().min(1),subscriberCount:M().int().nonnegative(),systemSubscriberCount:M().int().nonnegative(),summary:Av.optional(),warnings:Vv.optional(),brokenLinks:Uv,brokenLinkSuppression:Gv.optional()}).loose(),Yv=F({docName:j().min(1),scope:I([`last`,`session`,`count`]),undone:N()}).loose(),Xv=F({docs:P(F({docName:dv,markdown:j(),position:I([`append`,`prepend`,`replace`]).optional(),extension:I(w_).optional(),summary:pv}).loose()).min(1).max(100),...fv}).loose(),Zv=F({type:yv,title:j(),detail:j().optional()}).loose(),Qv=Mo(`status`,[F({status:L(`written`),docName:j().min(1),summary:Av.optional(),warnings:Vv.optional(),brokenLinks:Uv,brokenLinkSuppression:Gv.optional()}).loose(),F({status:L(`error`),docName:j().min(1),error:Zv}).loose()]),$v=F({timestamp:j().min(1),results:P(Qv),written:M().int().nonnegative(),failed:M().int().nonnegative()}).loose(),ey=F({docName:uv,patch:Ro(j(),Ao([$l,Co()])),types:Ro(j(),I(Xl)).optional(),summary:pv,...fv}).loose(),ty=F({timestamp:j().min(1),subscriberCount:M().int().nonnegative(),systemSubscriberCount:M().int().nonnegative(),appliedKeys:P(j()),summary:Av.optional(),warnings:Vv.optional(),brokenLinks:Uv,brokenLinkSuppression:Gv.optional()}).loose();function ny(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}const ry=my(/[A-Za-z]/),iy=my(/[\dA-Za-z]/),ay=my(/[#-'*+\--9=?A-Z^-~]/);function oy(e){return e!==null&&(e<32||e===127)}const sy=my(/\d/),cy=my(/[\dA-Fa-f]/),ly=my(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function uy(e){return e!==null&&(e<0||e===32)}function dy(e){return e===-2||e===-1||e===32}const fy=my(/\p{P}|\p{S}/u),py=my(/\s/);function my(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function hy(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}const gy=(function(e,t,n,r,i){let a=_y(t);if(n!=null&&(typeof n!=`number`||n<0||n===1/0))throw Error(`Expected positive finite index`);if(r!=null&&(!gy(r)||!r.children))throw Error(`Expected parent node`);if(r==null!=(n==null))throw Error(`Expected both parent and index`);return Cy(e)?a.call(i,e,n,r):!1}),_y=(function(e){if(e==null)return Sy;if(typeof e==`function`)return xy(e);if(typeof e==`object`)return Array.isArray(e)?vy(e):yy(e);if(typeof e==`string`)return by(e);throw Error(`Expected function, string, or object as test`)});function vy(e){let t=[],n=-1;for(;++n<e.length;)t[n]=_y(e[n]);return xy(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function yy(e){let t=e;return xy(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function by(e){return xy(t);function t(t){return t&&t.type===e}}function xy(e){return t;function t(t,n,r){return!!(Cy(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Sy(){return!0}function Cy(e){return typeof e==`object`&&!!e&&`type`in e}function wy(e){return`\x1B[33m`+e+`\x1B[39m`}const Ty=[],Ey=`skip`;function Dy(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=_y(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+wy(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Ty,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Oy(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Oy(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Ty:[e]}function ky(e,t,n){let r=_y((n||{}).ignore||[]),i=Ay(t),a=-1;for(;++a<i.length;)Dy(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function Ay(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([jy(e[0]),My(e[1])])}return t}function jy(e){return typeof e==`string`?new RegExp(hy(e),`g`):e}function My(e){return typeof e==`function`?e:function(){return e}}const Ny=`phrasing`,Py=[`autolink`,`link`,`image`,`label`];function Fy(){return{transforms:[Uy],enter:{literalAutolink:Ly,literalAutolinkEmail:Ry,literalAutolinkHttp:Ry,literalAutolinkWww:Ry},exit:{literalAutolink:Hy,literalAutolinkEmail:Vy,literalAutolinkHttp:zy,literalAutolinkWww:By}}}function Iy(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Ny,notInConstruct:Py},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Ny,notInConstruct:Py},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Ny,notInConstruct:Py}]}}function Ly(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Ry(e){this.config.enter.autolinkProtocol.call(this,e)}function zy(e){this.config.exit.autolinkProtocol.call(this,e)}function By(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Vy(e){this.config.exit.autolinkEmail.call(this,e)}function Hy(e){this.exit(e)}function Uy(e){ky(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Wy],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Gy]],{ignore:[`link`,`linkReference`]})}function Wy(e,t,n,r,i){let a=``;if(!Jy(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Ky(n)))return!1;let o=qy(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Gy(e,t,n,r){return!Jy(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Ky(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function qy(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=ny(e,`(`),a=ny(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Jy(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||py(n)||fy(n))&&(!t||n!==47)}function Yy(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}ab.peek=ib;function Xy(){this.buffer()}function Zy(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Qy(){this.buffer()}function $y(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function eb(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Yy(this.sliceSerialize(e)).toLowerCase(),n.label=t}function tb(e){this.exit(e)}function nb(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Yy(this.sliceSerialize(e)).toLowerCase(),n.label=t}function rb(e){this.exit(e)}function ib(){return`[`}function ab(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function ob(){return{enter:{gfmFootnoteCallString:Xy,gfmFootnoteCall:Zy,gfmFootnoteDefinitionLabelString:Qy,gfmFootnoteDefinition:$y},exit:{gfmFootnoteCallString:eb,gfmFootnoteCall:tb,gfmFootnoteDefinitionLabelString:nb,gfmFootnoteDefinition:rb}}}function sb(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:ab},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
242
242
|
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?lb:cb))),s(),o}}function cb(e,t,n){return t===0?e:lb(e,t,n)}function lb(e,t,n){return(n?``:` `)+e}const ub=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];hb.peek=gb;function db(){return{canContainEols:[`delete`],enter:{strikethrough:pb},exit:{strikethrough:mb}}}function fb(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:ub}],handlers:{delete:hb}}}function pb(e){this.enter({type:`delete`,children:[]},e)}function mb(e){this.exit(e)}function hb(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function gb(){return`~`}function _b(e){return e.length}function vb(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||_b,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=yb(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=bb(r[d]);else{let e=bb(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
243
243
|
`)}function yb(e){return e==null?``:String(e)}function bb(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const xb={}.hasOwnProperty;function Sb(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&xb.call(t,e)){let n=String(t[e]);i=xb.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const Cb={}.hasOwnProperty;function wb(e,t){let n=-1,r;if(t.extensions)for(;++n<t.extensions.length;)wb(e,t.extensions[n]);for(r in t)if(Cb.call(t,r))switch(r){case`extensions`:break;case`unsafe`:Tb(e[r],t[r]);break;case`join`:Tb(e[r],t[r]);break;case`handlers`:Eb(e[r],t[r]);break;default:e.options[r]=t[r]}return e}function Tb(e,t){t&&e.push(...t)}function Eb(e,t){t&&Object.assign(e,t)}function Db(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),Ob);return i(),o}function Ob(e,t,n){return`>`+(n?``:` `)+e}function kb(e,t){return Ab(e,t.inConstruct,!0)&&!Ab(e,t.notInConstruct,!1)}function Ab(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function jb(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
244
244
|
`&&kb(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{wo as e}from"./dist-
|
|
1
|
+
import{wo as e}from"./dist-BHg9XI3A.mjs";import{execFile as t}from"node:child_process";const n=new Set([`http:`,`https:`]),r=/[\u0000-\u0020\u007F-\u009F"'`\\&|<>^()$;{}[\]*?!~]/;function i(e,t){console.warn(`Could not auto-open browser (${t}); visit ${e} manually`)}function a(a){let o;try{o=new URL(a)}catch{i(a,`invalid URL`);return}if(!n.has(o.protocol)){i(a,`unsupported scheme '${o.protocol}'`);return}if(r.test(a)){i(a,`URL contains unsafe characters`);return}let s=process.platform===`darwin`?`open`:process.platform===`win32`?`cmd`:`xdg-open`,c=process.platform===`win32`?[`/c`,`start`,``,a]:[a];t(s,c,e({}),e=>{e&&console.warn(`Could not auto-open browser (${e.message}); visit ${a} manually`)})}export{a as openBrowser};
|
package/dist/parse-worker.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./md-manager-BGnqyqi1-
|
|
1
|
+
import{t as e}from"./md-manager-BGnqyqi1-DsBy1Dky.mjs";import{parentPort as t}from"node:worker_threads";function n(t){try{let n,r;if(t.embedTable!==void 0&&t.sourcePath!==void 0){let e=t.embedTable;r={sourcePath:t.sourcePath,resolveEmbed:t=>e[t]?.path??null,...t.wantSizes?{resolveSize:t=>e[t]?.size??null}:{}}}else if(t.recordEmbeds&&t.sourcePath!==void 0){let e=new Set;n=e,r={sourcePath:t.sourcePath,resolveEmbed:t=>(e.add(t),null),...t.wantSizes?{resolveSize:t=>(e.add(t),null)}:{}}}let i=e.parseWithFallback(t.body,r);return n!==void 0&&n.size>0?{id:t.id,ok:!0,parsedJson:i,requestedTargets:[...n]}:{id:t.id,ok:!0,parsedJson:i}}catch(e){return{id:t.id,ok:!1,message:e instanceof Error?e.message.slice(0,500):String(e).slice(0,500)}}}t?.on(`message`,e=>{t?.postMessage(n(e))});export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./preview-B2beHnfh.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{kn as e}from"./dist-
|
|
1
|
+
import{kn as e}from"./dist-BHg9XI3A.mjs";import"./constants-DPhkbJXs.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);a.push(``);let c=t(i,`.ok`,`config.yml`);return r(c)?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
|
|
2
2
|
`)}export{c as n,l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./label-CvMpFFbN.js";import{t as s}from"./button-DzgjsZzC.js";import{n as c}from"./config-errors-DCSQBhyj.js";import{n as l,r as u}from"./constants-github-DOek7bCt.js";import{f as d,l as f}from"./SyncStatusBadge-CykVps4K.js";import{t as p}from"./trash-2-CchZ0T47.js";import{t as m}from"./input-C-Qm8YDT.js";import{t as h}from"./use-git-sync-status-BQYF2F5Z.js";import{a as g,n as _,t as v}from"./AuthModal-D1eciNeA.js";import{t as y}from"./skeleton-BPb29aFG.js";import{n as b}from"./auth-state-cache-cHC7MUdm.js";import{t as x}from"./SettingsSectionHeader-XnGFBVeB.js";var S=e(n(),1),ee=a(),C=`[a-z0-9](?:[a-z0-9-]*[a-z0-9])?`,w=RegExp(`^${C}(?:\\.${C})*$`),T=/^[a-z][a-z0-9+.-]*:\/\//i;function E(e){if(T.test(e))try{return new URL(e).host}catch{return null}let t=e.split(`/`)[0]??``;return t.slice(t.lastIndexOf(`@`)+1).replace(/:(?!\d+$).*$/,``)}function D(e,t){let n=e.trim();if(n===``)return{ok:!1,reason:`empty`};let r=E(n);if(r===null||r===``)return{ok:!1,reason:`invalid`};let i=u(r);return w.test(i)?i===`github.com`?{ok:!1,reason:`github-com`}:t.has(i)?{ok:!1,reason:`duplicate`}:{ok:!0,host:i}:{ok:!1,reason:`invalid`}}function O(e){let t=e.git?.hosts??{};return Object.entries(t).filter(([,e])=>e?.provider===`github`).map(([e])=>e).sort((e,t)=>e.localeCompare(t))}var k=t();function A(e){let t=(0,ee.c)(59),{binding:n}=e,{_:a}=i(),o=(0,S.useId)(),l=(0,S.useId)(),u;t[0]===n?u=t[1]:(u=()=>O(n.current()),t[0]=n,t[1]=u);let[d,f]=(0,S.useState)(u),[h,g]=(0,S.useState)(``),[_,v]=(0,S.useState)(null),[y,b]=(0,S.useState)(!1),[x,C]=(0,S.useState)(null),w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=new Map,t[2]=w):w=t[2];let T=(0,S.useRef)(w),E=(0,S.useRef)(null),A,j;t[3]===x?(A=t[4],j=t[5]):(A=()=>{x!==null&&(((x.host===null?null:T.current.get(x.host))??E.current)?.focus(),C(null))},j=[x],t[3]=x,t[4]=A,t[5]=j),(0,S.useEffect)(A,j);let M,N;t[6]===n?(M=t[7],N=t[8]):(M=()=>n.subscribe(e=>f(O(e))),N=[n],t[6]=n,t[7]=M,t[8]=N),(0,S.useEffect)(M,N);let P;t[9]===a?P=t[10]:(P=function(e){switch(e){case`empty`:return a({id:`cFONFy`});case`invalid`:return a({id:`QsnBxE`});case`github-com`:return a({id:`UK3GW4`});case`duplicate`:return a({id:`DEkRZA`})}},t[9]=a,t[10]=P);let ne=P,F;t[11]!==n||t[12]!==h||t[13]!==d||t[14]!==ne?(F=function(e){e.preventDefault();let t=D(h,new Set(d.map(te)));if(!t.ok){v(ne(t.reason));return}let r=n.patch({git:{hosts:{[t.host]:{provider:`github`}}}});if(!r.ok){v(c(r.error));return}f(O(r.effective)),g(``),v(null),b(!0)},t[11]=n,t[12]=h,t[13]=d,t[14]=ne,t[15]=F):F=t[15];let re=F,I;t[16]!==n||t[17]!==d?(I=function(e){let t=d.indexOf(e),r=d[t+1]??d[t-1]??null,i=n.patch({git:{hosts:{[e]:null}}});if(!i.ok){v(c(i.error));return}f(O(i.effective)),C({host:r}),v(null),b(!0)},t[16]=n,t[17]=d,t[18]=I):I=t[18];let L=I,R;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,k.jsx)(`h4`,{id:`settings-enterprise-hosts-title`,className:`text-sm font-medium`,children:(0,k.jsx)(r,{id:`J2-D_a`})}),t[19]=R):R=t[19];let z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,k.jsx)(r,{id:`PgY2nN`}),t[20]=z):z=t[20];let B;t[21]===o?B=t[22]:(B=(0,k.jsxs)(`div`,{children:[R,(0,k.jsx)(`p`,{id:o,className:`text-1sm text-muted-foreground`,children:z})]}),t[21]=o,t[22]=B);let V;t[23]!==a||t[24]!==L||t[25]!==d?(V=d.length>0?(0,k.jsx)(`ul`,{className:`space-y-1`,"data-testid":`settings-enterprise-hosts-list`,children:d.map(e=>(0,k.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,k.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:e}),(0,k.jsx)(s,{variant:`ghost`,size:`icon`,className:`size-7`,"aria-label":a({id:`xVMoYb`,values:{host:e}}),ref:t=>{t?T.current.set(e,t):T.current.delete(e)},onClick:()=>L(e),children:(0,k.jsx)(p,{"aria-hidden":`true`})})]},e))}):(0,k.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-enterprise-hosts-empty`,children:(0,k.jsx)(r,{id:`HK2eIK`})}),t[23]=a,t[24]=L,t[25]=d,t[26]=V):V=t[26];let H;t[27]===a?H=t[28]:(H=a({id:`Qbf7Q4`}),t[27]=a,t[28]=H);let U=_!==null,W=_===null?o:`${o} ${l}`,G;t[29]===_?G=t[30]:(G=e=>{g(e.target.value),_!==null&&v(null)},t[29]=_,t[30]=G);let K;t[31]!==h||t[32]!==H||t[33]!==U||t[34]!==W||t[35]!==G?(K=(0,k.jsx)(m,{ref:E,value:h,"aria-label":H,placeholder:`github.example.com`,autoComplete:`off`,spellCheck:!1,inputMode:`url`,className:`h-7 flex-1 font-mono text-xs`,"aria-invalid":U,"aria-describedby":W,onChange:G}),t[31]=h,t[32]=H,t[33]=U,t[34]=W,t[35]=G,t[36]=K):K=t[36];let q;t[37]===h?q=t[38]:(q=h.trim(),t[37]=h,t[38]=q);let J=q===``,Y;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,k.jsx)(r,{id:`ALFlyF`}),t[39]=Y):Y=t[39];let X;t[40]===J?X=t[41]:(X=(0,k.jsx)(s,{type:`submit`,size:`sm`,variant:`secondary`,disabled:J,className:`h-7 px-2 font-normal text-xs`,children:Y}),t[40]=J,t[41]=X);let Z;t[42]!==re||t[43]!==K||t[44]!==X?(Z=(0,k.jsxs)(`form`,{className:`flex items-center gap-2 pt-1`,onSubmit:re,noValidate:!0,children:[K,X]}),t[42]=re,t[43]=K,t[44]=X,t[45]=Z):Z=t[45];let Q;t[46]!==_||t[47]!==l?(Q=_===null?null:(0,k.jsx)(`p`,{id:l,role:`alert`,className:`text-1sm text-destructive`,children:_}),t[46]=_,t[47]=l,t[48]=Q):Q=t[48];let $;t[49]===y?$=t[50]:($=y?(0,k.jsx)(`p`,{role:`status`,className:`text-1sm text-muted-foreground`,children:(0,k.jsx)(r,{id:`3LuFP-`})}):null,t[49]=y,t[50]=$);let ie;t[51]!==V||t[52]!==Z||t[53]!==Q||t[54]!==$?(ie=(0,k.jsxs)(`div`,{className:`space-y-2 rounded-lg border bg-card p-3`,children:[V,Z,Q,$]}),t[51]=V,t[52]=Z,t[53]=Q,t[54]=$,t[55]=ie):ie=t[55];let ae;return t[56]!==B||t[57]!==ie?(ae=(0,k.jsxs)(`section`,{"aria-labelledby":`settings-enterprise-hosts-title`,className:`space-y-4`,"data-field":`section:enterprise-hosts`,"data-testid":`settings-enterprise-hosts`,children:[B,ie]}),t[56]=B,t[57]=ie,t[58]=ae):ae=t[58],ae}function te(e){return u(e)}function j(e){let t=(0,ee.c)(44),{authQueryTransport:n,authTransport:a,userBinding:o}=e,{_:c}=i(),l;t[0]===n?l=t[1]:(l=n??g(),t[0]=n,t[1]=l);let u=l,d=h()?.remote??null,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f={phase:`loading`},t[2]=f):f=t[2];let[p,m]=(0,S.useState)(f),[_,C]=(0,S.useState)(!1),[w,T]=(0,S.useState)(!1),[E,D]=(0,S.useState)(null),O=(0,S.useRef)(!1),te;t[3]===u?te=t[4]:(te=async function(){m({phase:`loading`});try{let e=await u.status();m({phase:`loaded`,result:e}),b(e)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),m({phase:`check-failed`})}},t[3]=u,t[4]=te);let j=te,M;t[5]===j?M=t[6]:(M=()=>{j()},t[5]=j,t[6]=M);let N;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],t[7]=N):N=t[7],(0,S.useEffect)(M,N);let P;t[8]!==c||t[9]!==j||t[10]!==u?(P=async function(){if(O.current)return;O.current=!0,C(!1),T(!0),D(null);let e=null;try{let t=u.signout?await u.signout():{ok:!1,error:c({id:`8cpOa8`})};t.ok||(e=t.error??c({id:`8cpOa8`}))}catch(t){console.warn(`[AccountSection] GitHub disconnect failed`,t),e=c({id:`8cpOa8`})}await j(),e&&D(e),T(!1),O.current=!1},t[8]=c,t[9]=j,t[10]=u,t[11]=P):P=t[11];let L=P,R;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,k.jsx)(r,{id:`MpZRQy`}),t[12]=R):R=t[12];let z;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,k.jsx)(x,{titleId:`settings-account-title`,title:R,scope:`user`,children:(0,k.jsx)(r,{id:`pd6t3G`})}),t[13]=z):z=t[13];let B;t[14]!==E||t[15]!==w||t[16]!==L||t[17]!==j||t[18]!==p.phase||t[19]!==p.result?(B=p.phase===`loading`?(0,k.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-loading`,children:[(0,k.jsx)(`span`,{className:`sr-only`,children:(0,k.jsx)(r,{id:`IWGfGF`})}),(0,k.jsx)(y,{className:`h-4 w-40`}),(0,k.jsx)(y,{className:`h-8 w-32`})]}):p.phase===`check-failed`?(0,k.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-check-failed`,children:[(0,k.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:(0,k.jsx)(r,{id:`T_wG4n`})}),(0,k.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>void j(),children:(0,k.jsx)(r,{id:`KDw4GX`})})]}):p.result.authenticated?p.result.tier===`A`?(0,k.jsx)(re,{login:p.result.login}):(0,k.jsx)(F,{login:p.result.login,disconnecting:w,error:E,onDisconnect:()=>void L()}):p.result.unsupportedOrigin===void 0?(0,k.jsx)(I,{onConnect:()=>C(!0)}):null,t[14]=E,t[15]=w,t[16]=L,t[17]=j,t[18]=p.phase,t[19]=p.result,t[20]=B):B=t[20];let V;t[21]===o?V=t[22]:(V=(0,k.jsx)(A,{binding:o}),t[21]=o,t[22]=V);let H;t[23]!==a||t[24]!==d?(H=(0,k.jsx)(ne,{authTransport:a,remote:d}),t[23]=a,t[24]=d,t[25]=H):H=t[25];let U;t[26]!==V||t[27]!==H||t[28]!==B?(U=(0,k.jsxs)(`div`,{className:`space-y-8`,children:[B,V,H]}),t[26]=V,t[27]=H,t[28]=B,t[29]=U):U=t[29];let W;t[30]===j?W=t[31]:(W=e=>{C(e),e||j()},t[30]=j,t[31]=W);let G=p.phase===`loaded`?p.result.host:void 0,K=p.phase===`loaded`?p.result.ghAvailable:void 0,q;t[32]===j?q=t[33]:(q=()=>{j()},t[32]=j,t[33]=q);let J;t[34]!==_||t[35]!==a||t[36]!==W||t[37]!==G||t[38]!==K||t[39]!==q?(J=(0,k.jsx)(v,{open:_,onOpenChange:W,transport:a,host:G,ghAvailable:K,onSuccess:q}),t[34]=_,t[35]=a,t[36]=W,t[37]=G,t[38]=K,t[39]=q,t[40]=J):J=t[40];let Y;return t[41]!==U||t[42]!==J?(Y=(0,k.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-5`,"data-testid":`settings-account`,children:[z,U,J]}),t[41]=U,t[42]=J,t[43]=Y):Y=t[43],Y}function M(e){let t=e.split(`/`)[0]??``;return l(t)?t:``}function N(e){let t=(0,ee.c)(6),{login:n,host:i}=e,a;t[0]!==i||t[1]!==n?(a={login:n,host:i},t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={0:(0,k.jsx)(`code`,{translate:`no`})},t[3]=o):o=t[3];let s;return t[4]===a?s=t[5]:(s=(0,k.jsx)(`p`,{role:`status`,className:`text-1sm text-muted-foreground`,"data-testid":`settings-account-host-token-success`,children:(0,k.jsx)(r,{id:`4p8Baj`,values:a,components:o})}),t[4]=a,t[5]=s),s}var P={"data-1p-ignore":!0,"data-lpignore":`true`,"data-bwignore":!0,"data-form-type":`other`};function ne(e){let t=(0,ee.c)(89),{authTransport:n,remote:a}=e,{_:c}=i(),u;t[0]===n?u=t[1]:(u=n??_(),t[0]=n,t[1]=u);let p=u,h=a?.label??null,g;t[2]===a?g=t[3]:(g=a?f(a):!1,t[2]=a,t[3]=g);let v=g,y;t[4]===a?y=t[5]:(y=d(a),t[4]=a,t[5]=y);let b=y,x=(0,S.useId)(),C=(0,S.useId)(),w=(0,S.useId)(),T=(0,S.useId)(),E=(0,S.useId)(),[D,O]=(0,S.useState)(``),[A,te]=(0,S.useState)(``),[j,ne]=(0,S.useState)(``),[F,re]=(0,S.useState)(!1),[I,L]=(0,S.useState)(null),[R,z]=(0,S.useState)(!1),[B,V]=(0,S.useState)(null),H=(0,S.useRef)(!1),U=(0,S.useRef)(!1),W,G;t[6]!==v||t[7]!==h||t[8]!==b?(W=()=>{if(U.current||h===null||v||!b)return;let e=M(h);e&&(U.current=!0,O(e))},G=[h,v,b],t[6]=v,t[7]=h,t[8]=b,t[9]=W,t[10]=G):(W=t[9],G=t[10]),(0,S.useEffect)(W,G);let K;t[11]!==c||t[12]!==D||t[13]!==p||t[14]!==j||t[15]!==A?(K=async function(){if(H.current)return;let e=D.trim(),t=A.trim(),n=j.trim();if(!e||!t||!n)return;if(!l(e)){V(null),z(!0),L(c({id:`rZFxkH`}));return}if(z(!1),!p.hostToken){L(c({id:`iMYFJM`}));return}H.current=!0,re(!0),L(null),V(null);let r=await p.hostToken(e,t,n).catch(e=>(console.warn(`[AccountSection] storing a host token failed`,e),{ok:!1,login:void 0,error:c({id:`Q5fqMz`})}));re(!1),H.current=!1,r.ok?(ne(``),V({login:r.login||t,host:e})):L(r.error??c({id:`sNeKjP`}))},t[11]=c,t[12]=D,t[13]=p,t[14]=j,t[15]=A,t[16]=K):K=t[16];let q=K,J;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,k.jsx)(`h4`,{id:`settings-host-tokens-title`,className:`text-sm font-medium`,children:(0,k.jsx)(r,{id:`jbhCDS`})}),t[17]=J):J=t[17];let Y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,k.jsxs)(`div`,{children:[J,(0,k.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,k.jsx)(r,{id:`-nA68n`})})]}),t[18]=Y):Y=t[18];let X;t[19]===q?X=t[20]:(X=e=>{e.preventDefault(),q()},t[19]=q,t[20]=X);let Z;t[21]!==v||t[22]!==h||t[23]!==b?(Z=h!==null&&!v&&!b?(0,k.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-account-host-token-not-https`,children:(0,k.jsx)(r,{id:`OWs-8P`})}):null,t[21]=v,t[22]=h,t[23]=b,t[24]=Z):Z=t[24];let Q;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,k.jsx)(r,{id:`Ai2U7L`}),t[25]=Q):Q=t[25];let $;t[26]===x?$=t[27]:($=(0,k.jsx)(o,{htmlFor:x,children:Q}),t[26]=x,t[27]=$);let ie=R||void 0,ae=R&&I?C:void 0,oe;t[28]===R?oe=t[29]:(oe=e=>{U.current=!0,O(e.target.value),R&&(z(!1),L(null))},t[28]=R,t[29]=oe);let se;t[30]!==D||t[31]!==x||t[32]!==ie||t[33]!==ae||t[34]!==oe?(se=(0,k.jsx)(m,{id:x,type:`text`,placeholder:`git.example.com`,autoComplete:`off`,...P,"aria-invalid":ie,"aria-describedby":ae,value:D,onChange:oe}),t[30]=D,t[31]=x,t[32]=ie,t[33]=ae,t[34]=oe,t[35]=se):se=t[35];let ce;t[36]!==$||t[37]!==se?(ce=(0,k.jsxs)(`div`,{className:`space-y-1`,children:[$,se]}),t[36]=$,t[37]=se,t[38]=ce):ce=t[38];let le;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,k.jsx)(r,{id:`7sNhEz`}),t[39]=le):le=t[39];let ue;t[40]===w?ue=t[41]:(ue=(0,k.jsx)(o,{htmlFor:w,children:le}),t[40]=w,t[41]=ue);let de;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(de=e=>te(e.target.value),t[42]=de):de=t[42];let fe;t[43]!==A||t[44]!==T||t[45]!==w?(fe=(0,k.jsx)(m,{id:w,type:`text`,autoComplete:`off`,...P,"aria-describedby":T,value:A,onChange:de}),t[43]=A,t[44]=T,t[45]=w,t[46]=fe):fe=t[46];let pe;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,k.jsx)(r,{id:`azrR7I`,components:{0:(0,k.jsx)(`code`,{translate:`no`}),1:(0,k.jsx)(`code`,{translate:`no`}),2:(0,k.jsx)(`code`,{translate:`no`})}}),t[47]=pe):pe=t[47];let me;t[48]===T?me=t[49]:(me=(0,k.jsx)(`p`,{id:T,className:`text-1sm text-muted-foreground`,"data-testid":`settings-account-host-token-username-hint`,children:pe}),t[48]=T,t[49]=me);let he;t[50]!==ue||t[51]!==fe||t[52]!==me?(he=(0,k.jsxs)(`div`,{className:`space-y-1`,children:[ue,fe,me]}),t[50]=ue,t[51]=fe,t[52]=me,t[53]=he):he=t[53];let ge;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,k.jsx)(r,{id:`SkUcEr`}),t[54]=ge):ge=t[54];let _e;t[55]===E?_e=t[56]:(_e=(0,k.jsx)(o,{htmlFor:E,children:ge}),t[55]=E,t[56]=_e);let ve;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>ne(e.target.value),t[57]=ve):ve=t[57];let ye;t[58]!==j||t[59]!==E?(ye=(0,k.jsx)(m,{id:E,type:`password`,autoComplete:`off`,...P,value:j,onChange:ve}),t[58]=j,t[59]=E,t[60]=ye):ye=t[60];let be;t[61]!==_e||t[62]!==ye?(be=(0,k.jsxs)(`div`,{className:`space-y-1`,children:[_e,ye]}),t[61]=_e,t[62]=ye,t[63]=be):be=t[63];let xe;t[64]!==D||t[65]!==F||t[66]!==j||t[67]!==A?(xe=F||!D.trim()||!A.trim()||!j.trim(),t[64]=D,t[65]=F,t[66]=j,t[67]=A,t[68]=xe):xe=t[68];let Se;t[69]===F?Se=t[70]:(Se=F?(0,k.jsx)(r,{id:`1yHVE-`}):(0,k.jsx)(r,{id:`zXZJoN`}),t[69]=F,t[70]=Se);let Ce;t[71]!==xe||t[72]!==Se?(Ce=(0,k.jsx)(s,{type:`submit`,"data-testid":`settings-account-host-token-submit`,disabled:xe,children:Se}),t[71]=xe,t[72]=Se,t[73]=Ce):Ce=t[73];let we;t[74]===B?we=t[75]:(we=B?(0,k.jsx)(N,{login:B.login,host:B.host}):null,t[74]=B,t[75]=we);let Te;t[76]!==I||t[77]!==C||t[78]!==R?(Te=I?(0,k.jsx)(`p`,{id:R?C:void 0,role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-account-host-token-error`,children:I}):null,t[76]=I,t[77]=C,t[78]=R,t[79]=Te):Te=t[79];let Ee;return t[80]!==Z||t[81]!==ce||t[82]!==he||t[83]!==be||t[84]!==Ce||t[85]!==we||t[86]!==Te||t[87]!==X?(Ee=(0,k.jsxs)(`section`,{"aria-labelledby":`settings-host-tokens-title`,className:`space-y-4`,"data-field":`section:host-tokens`,children:[Y,(0,k.jsxs)(`form`,{className:`space-y-3 rounded-lg border bg-card p-3`,"data-testid":`settings-account-host-token`,"aria-labelledby":`settings-host-tokens-title`,autoComplete:`off`,onSubmit:X,children:[Z,ce,he,be,Ce,we,Te]})]}),t[80]=Z,t[81]=ce,t[82]=he,t[83]=be,t[84]=Ce,t[85]=we,t[86]=Te,t[87]=X,t[88]=Ee):Ee=t[88],Ee}function F(e){let t=(0,ee.c)(20),{login:n,disconnecting:i,error:a,onDisconnect:o}=e,c;t[0]===n?c=t[1]:(c=(0,k.jsx)(`div`,{className:`text-sm font-medium`,children:(0,k.jsx)(r,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=c);let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,k.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,k.jsx)(r,{id:`nxlOpL`})}),t[2]=l):l=t[2];let u;t[3]===c?u=t[4]:(u=(0,k.jsxs)(`div`,{className:`min-w-0`,children:[c,l]}),t[3]=c,t[4]=u);let d;t[5]===i?d=t[6]:(d=i?(0,k.jsx)(r,{id:`rppgXF`}):(0,k.jsx)(r,{id:`-K0AvT`}),t[5]=i,t[6]=d);let f;t[7]!==i||t[8]!==o||t[9]!==d?(f=(0,k.jsx)(s,{variant:`outline`,onClick:o,disabled:i,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:d}),t[7]=i,t[8]=o,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==u||t[12]!==f?(p=(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[u,f]}),t[11]=u,t[12]=f,t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,k.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,k.jsx)(r,{id:`msOK6I`})}),t[14]=m):m=t[14];let h;t[15]===a?h=t[16]:(h=a?(0,k.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-account-disconnect-error`,children:a}):null,t[15]=a,t[16]=h);let g;return t[17]!==p||t[18]!==h?(g=(0,k.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[p,m,h]}),t[17]=p,t[18]=h,t[19]=g):g=t[19],g}function re(e){let t=(0,ee.c)(5),{login:n}=e,i;t[0]===n?i=t[1]:(i=(0,k.jsx)(`div`,{className:`text-sm font-medium`,children:(0,k.jsx)(r,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,k.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,k.jsx)(r,{id:`ny6vNn`})}),t[2]=a):a=t[2];let o;return t[3]===i?o=t[4]:(o=(0,k.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-gh-cli`,children:(0,k.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[i,a]})}),t[3]=i,t[4]=o),o}function I(e){let t=(0,ee.c)(5),{onConnect:n}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,k.jsx)(`div`,{className:`text-sm font-medium`,children:(0,k.jsx)(r,{id:`S33tz3`})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,k.jsxs)(`div`,{className:`min-w-0`,children:[i,(0,k.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,k.jsx)(r,{id:`9djC8C`})})]}),t[1]=a):a=t[1];let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,k.jsx)(r,{id:`5lWFkC`}),t[2]=o):o=t[2];let c;return t[3]===n?c=t[4]:(c=(0,k.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-disconnected`,children:(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[a,(0,k.jsx)(s,{onClick:n,"data-testid":`settings-account-connect`,children:o})]})}),t[3]=n,t[4]=c),c}export{j as AccountSection};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./label-CvMpFFbN.js";import{t as s}from"./button-DzgjsZzC.js";import{n as c}from"./config-errors-DCSQBhyj.js";import{n as l,r as u}from"./constants-github-DOek7bCt.js";import{f as d,l as f}from"./SyncStatusBadge-BO6CFavL.js";import{t as p}from"./trash-2-CchZ0T47.js";import{t as m}from"./input-C-Qm8YDT.js";import{t as h}from"./use-git-sync-status-BQYF2F5Z.js";import{a as g,n as _,t as v}from"./AuthModal-DcixDUcD.js";import{t as y}from"./skeleton-BPb29aFG.js";import{n as b}from"./auth-state-cache-cHC7MUdm.js";import{t as x}from"./SettingsSectionHeader-XnGFBVeB.js";var S=e(n(),1),ee=a(),C=`[a-z0-9](?:[a-z0-9-]*[a-z0-9])?`,w=RegExp(`^${C}(?:\\.${C})*$`),T=/^[a-z][a-z0-9+.-]*:\/\//i;function E(e){if(T.test(e))try{return new URL(e).host}catch{return null}let t=e.split(`/`)[0]??``;return t.slice(t.lastIndexOf(`@`)+1).replace(/:(?!\d+$).*$/,``)}function D(e,t){let n=e.trim();if(n===``)return{ok:!1,reason:`empty`};let r=E(n);if(r===null||r===``)return{ok:!1,reason:`invalid`};let i=u(r);return w.test(i)?i===`github.com`?{ok:!1,reason:`github-com`}:t.has(i)?{ok:!1,reason:`duplicate`}:{ok:!0,host:i}:{ok:!1,reason:`invalid`}}function O(e){let t=e.git?.hosts??{};return Object.entries(t).filter(([,e])=>e?.provider===`github`).map(([e])=>e).sort((e,t)=>e.localeCompare(t))}var k=t();function A(e){let t=(0,ee.c)(59),{binding:n}=e,{_:a}=i(),o=(0,S.useId)(),l=(0,S.useId)(),u;t[0]===n?u=t[1]:(u=()=>O(n.current()),t[0]=n,t[1]=u);let[d,f]=(0,S.useState)(u),[h,g]=(0,S.useState)(``),[_,v]=(0,S.useState)(null),[y,b]=(0,S.useState)(!1),[x,C]=(0,S.useState)(null),w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=new Map,t[2]=w):w=t[2];let T=(0,S.useRef)(w),E=(0,S.useRef)(null),A,j;t[3]===x?(A=t[4],j=t[5]):(A=()=>{x!==null&&(((x.host===null?null:T.current.get(x.host))??E.current)?.focus(),C(null))},j=[x],t[3]=x,t[4]=A,t[5]=j),(0,S.useEffect)(A,j);let M,N;t[6]===n?(M=t[7],N=t[8]):(M=()=>n.subscribe(e=>f(O(e))),N=[n],t[6]=n,t[7]=M,t[8]=N),(0,S.useEffect)(M,N);let P;t[9]===a?P=t[10]:(P=function(e){switch(e){case`empty`:return a({id:`cFONFy`});case`invalid`:return a({id:`QsnBxE`});case`github-com`:return a({id:`UK3GW4`});case`duplicate`:return a({id:`DEkRZA`})}},t[9]=a,t[10]=P);let ne=P,F;t[11]!==n||t[12]!==h||t[13]!==d||t[14]!==ne?(F=function(e){e.preventDefault();let t=D(h,new Set(d.map(te)));if(!t.ok){v(ne(t.reason));return}let r=n.patch({git:{hosts:{[t.host]:{provider:`github`}}}});if(!r.ok){v(c(r.error));return}f(O(r.effective)),g(``),v(null),b(!0)},t[11]=n,t[12]=h,t[13]=d,t[14]=ne,t[15]=F):F=t[15];let re=F,I;t[16]!==n||t[17]!==d?(I=function(e){let t=d.indexOf(e),r=d[t+1]??d[t-1]??null,i=n.patch({git:{hosts:{[e]:null}}});if(!i.ok){v(c(i.error));return}f(O(i.effective)),C({host:r}),v(null),b(!0)},t[16]=n,t[17]=d,t[18]=I):I=t[18];let L=I,R;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,k.jsx)(`h4`,{id:`settings-enterprise-hosts-title`,className:`text-sm font-medium`,children:(0,k.jsx)(r,{id:`J2-D_a`})}),t[19]=R):R=t[19];let z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,k.jsx)(r,{id:`PgY2nN`}),t[20]=z):z=t[20];let B;t[21]===o?B=t[22]:(B=(0,k.jsxs)(`div`,{children:[R,(0,k.jsx)(`p`,{id:o,className:`text-1sm text-muted-foreground`,children:z})]}),t[21]=o,t[22]=B);let V;t[23]!==a||t[24]!==L||t[25]!==d?(V=d.length>0?(0,k.jsx)(`ul`,{className:`space-y-1`,"data-testid":`settings-enterprise-hosts-list`,children:d.map(e=>(0,k.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,k.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:e}),(0,k.jsx)(s,{variant:`ghost`,size:`icon`,className:`size-7`,"aria-label":a({id:`xVMoYb`,values:{host:e}}),ref:t=>{t?T.current.set(e,t):T.current.delete(e)},onClick:()=>L(e),children:(0,k.jsx)(p,{"aria-hidden":`true`})})]},e))}):(0,k.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-enterprise-hosts-empty`,children:(0,k.jsx)(r,{id:`HK2eIK`})}),t[23]=a,t[24]=L,t[25]=d,t[26]=V):V=t[26];let H;t[27]===a?H=t[28]:(H=a({id:`Qbf7Q4`}),t[27]=a,t[28]=H);let U=_!==null,W=_===null?o:`${o} ${l}`,G;t[29]===_?G=t[30]:(G=e=>{g(e.target.value),_!==null&&v(null)},t[29]=_,t[30]=G);let K;t[31]!==h||t[32]!==H||t[33]!==U||t[34]!==W||t[35]!==G?(K=(0,k.jsx)(m,{ref:E,value:h,"aria-label":H,placeholder:`github.example.com`,autoComplete:`off`,spellCheck:!1,inputMode:`url`,className:`h-7 flex-1 font-mono text-xs`,"aria-invalid":U,"aria-describedby":W,onChange:G}),t[31]=h,t[32]=H,t[33]=U,t[34]=W,t[35]=G,t[36]=K):K=t[36];let q;t[37]===h?q=t[38]:(q=h.trim(),t[37]=h,t[38]=q);let J=q===``,Y;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,k.jsx)(r,{id:`ALFlyF`}),t[39]=Y):Y=t[39];let X;t[40]===J?X=t[41]:(X=(0,k.jsx)(s,{type:`submit`,size:`sm`,variant:`secondary`,disabled:J,className:`h-7 px-2 font-normal text-xs`,children:Y}),t[40]=J,t[41]=X);let Z;t[42]!==re||t[43]!==K||t[44]!==X?(Z=(0,k.jsxs)(`form`,{className:`flex items-center gap-2 pt-1`,onSubmit:re,noValidate:!0,children:[K,X]}),t[42]=re,t[43]=K,t[44]=X,t[45]=Z):Z=t[45];let Q;t[46]!==_||t[47]!==l?(Q=_===null?null:(0,k.jsx)(`p`,{id:l,role:`alert`,className:`text-1sm text-destructive`,children:_}),t[46]=_,t[47]=l,t[48]=Q):Q=t[48];let $;t[49]===y?$=t[50]:($=y?(0,k.jsx)(`p`,{role:`status`,className:`text-1sm text-muted-foreground`,children:(0,k.jsx)(r,{id:`3LuFP-`})}):null,t[49]=y,t[50]=$);let ie;t[51]!==V||t[52]!==Z||t[53]!==Q||t[54]!==$?(ie=(0,k.jsxs)(`div`,{className:`space-y-2 rounded-lg border bg-card p-3`,children:[V,Z,Q,$]}),t[51]=V,t[52]=Z,t[53]=Q,t[54]=$,t[55]=ie):ie=t[55];let ae;return t[56]!==B||t[57]!==ie?(ae=(0,k.jsxs)(`section`,{"aria-labelledby":`settings-enterprise-hosts-title`,className:`space-y-4`,"data-field":`section:enterprise-hosts`,"data-testid":`settings-enterprise-hosts`,children:[B,ie]}),t[56]=B,t[57]=ie,t[58]=ae):ae=t[58],ae}function te(e){return u(e)}function j(e){let t=(0,ee.c)(44),{authQueryTransport:n,authTransport:a,userBinding:o}=e,{_:c}=i(),l;t[0]===n?l=t[1]:(l=n??g(),t[0]=n,t[1]=l);let u=l,d=h()?.remote??null,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f={phase:`loading`},t[2]=f):f=t[2];let[p,m]=(0,S.useState)(f),[_,C]=(0,S.useState)(!1),[w,T]=(0,S.useState)(!1),[E,D]=(0,S.useState)(null),O=(0,S.useRef)(!1),te;t[3]===u?te=t[4]:(te=async function(){m({phase:`loading`});try{let e=await u.status();m({phase:`loaded`,result:e}),b(e)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),m({phase:`check-failed`})}},t[3]=u,t[4]=te);let j=te,M;t[5]===j?M=t[6]:(M=()=>{j()},t[5]=j,t[6]=M);let N;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],t[7]=N):N=t[7],(0,S.useEffect)(M,N);let P;t[8]!==c||t[9]!==j||t[10]!==u?(P=async function(){if(O.current)return;O.current=!0,C(!1),T(!0),D(null);let e=null;try{let t=u.signout?await u.signout():{ok:!1,error:c({id:`8cpOa8`})};t.ok||(e=t.error??c({id:`8cpOa8`}))}catch(t){console.warn(`[AccountSection] GitHub disconnect failed`,t),e=c({id:`8cpOa8`})}await j(),e&&D(e),T(!1),O.current=!1},t[8]=c,t[9]=j,t[10]=u,t[11]=P):P=t[11];let L=P,R;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,k.jsx)(r,{id:`MpZRQy`}),t[12]=R):R=t[12];let z;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,k.jsx)(x,{titleId:`settings-account-title`,title:R,scope:`user`,children:(0,k.jsx)(r,{id:`pd6t3G`})}),t[13]=z):z=t[13];let B;t[14]!==E||t[15]!==w||t[16]!==L||t[17]!==j||t[18]!==p.phase||t[19]!==p.result?(B=p.phase===`loading`?(0,k.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-loading`,children:[(0,k.jsx)(`span`,{className:`sr-only`,children:(0,k.jsx)(r,{id:`IWGfGF`})}),(0,k.jsx)(y,{className:`h-4 w-40`}),(0,k.jsx)(y,{className:`h-8 w-32`})]}):p.phase===`check-failed`?(0,k.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-check-failed`,children:[(0,k.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:(0,k.jsx)(r,{id:`T_wG4n`})}),(0,k.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>void j(),children:(0,k.jsx)(r,{id:`KDw4GX`})})]}):p.result.authenticated?p.result.tier===`A`?(0,k.jsx)(re,{login:p.result.login}):(0,k.jsx)(F,{login:p.result.login,disconnecting:w,error:E,onDisconnect:()=>void L()}):p.result.unsupportedOrigin===void 0?(0,k.jsx)(I,{onConnect:()=>C(!0)}):null,t[14]=E,t[15]=w,t[16]=L,t[17]=j,t[18]=p.phase,t[19]=p.result,t[20]=B):B=t[20];let V;t[21]===o?V=t[22]:(V=(0,k.jsx)(A,{binding:o}),t[21]=o,t[22]=V);let H;t[23]!==a||t[24]!==d?(H=(0,k.jsx)(ne,{authTransport:a,remote:d}),t[23]=a,t[24]=d,t[25]=H):H=t[25];let U;t[26]!==V||t[27]!==H||t[28]!==B?(U=(0,k.jsxs)(`div`,{className:`space-y-8`,children:[B,V,H]}),t[26]=V,t[27]=H,t[28]=B,t[29]=U):U=t[29];let W;t[30]===j?W=t[31]:(W=e=>{C(e),e||j()},t[30]=j,t[31]=W);let G=p.phase===`loaded`?p.result.host:void 0,K=p.phase===`loaded`?p.result.ghAvailable:void 0,q;t[32]===j?q=t[33]:(q=()=>{j()},t[32]=j,t[33]=q);let J;t[34]!==_||t[35]!==a||t[36]!==W||t[37]!==G||t[38]!==K||t[39]!==q?(J=(0,k.jsx)(v,{open:_,onOpenChange:W,transport:a,host:G,ghAvailable:K,onSuccess:q}),t[34]=_,t[35]=a,t[36]=W,t[37]=G,t[38]=K,t[39]=q,t[40]=J):J=t[40];let Y;return t[41]!==U||t[42]!==J?(Y=(0,k.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-5`,"data-testid":`settings-account`,children:[z,U,J]}),t[41]=U,t[42]=J,t[43]=Y):Y=t[43],Y}function M(e){let t=e.split(`/`)[0]??``;return l(t)?t:``}function N(e){let t=(0,ee.c)(6),{login:n,host:i}=e,a;t[0]!==i||t[1]!==n?(a={login:n,host:i},t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={0:(0,k.jsx)(`code`,{translate:`no`})},t[3]=o):o=t[3];let s;return t[4]===a?s=t[5]:(s=(0,k.jsx)(`p`,{role:`status`,className:`text-1sm text-muted-foreground`,"data-testid":`settings-account-host-token-success`,children:(0,k.jsx)(r,{id:`4p8Baj`,values:a,components:o})}),t[4]=a,t[5]=s),s}var P={"data-1p-ignore":!0,"data-lpignore":`true`,"data-bwignore":!0,"data-form-type":`other`};function ne(e){let t=(0,ee.c)(89),{authTransport:n,remote:a}=e,{_:c}=i(),u;t[0]===n?u=t[1]:(u=n??_(),t[0]=n,t[1]=u);let p=u,h=a?.label??null,g;t[2]===a?g=t[3]:(g=a?f(a):!1,t[2]=a,t[3]=g);let v=g,y;t[4]===a?y=t[5]:(y=d(a),t[4]=a,t[5]=y);let b=y,x=(0,S.useId)(),C=(0,S.useId)(),w=(0,S.useId)(),T=(0,S.useId)(),E=(0,S.useId)(),[D,O]=(0,S.useState)(``),[A,te]=(0,S.useState)(``),[j,ne]=(0,S.useState)(``),[F,re]=(0,S.useState)(!1),[I,L]=(0,S.useState)(null),[R,z]=(0,S.useState)(!1),[B,V]=(0,S.useState)(null),H=(0,S.useRef)(!1),U=(0,S.useRef)(!1),W,G;t[6]!==v||t[7]!==h||t[8]!==b?(W=()=>{if(U.current||h===null||v||!b)return;let e=M(h);e&&(U.current=!0,O(e))},G=[h,v,b],t[6]=v,t[7]=h,t[8]=b,t[9]=W,t[10]=G):(W=t[9],G=t[10]),(0,S.useEffect)(W,G);let K;t[11]!==c||t[12]!==D||t[13]!==p||t[14]!==j||t[15]!==A?(K=async function(){if(H.current)return;let e=D.trim(),t=A.trim(),n=j.trim();if(!e||!t||!n)return;if(!l(e)){V(null),z(!0),L(c({id:`rZFxkH`}));return}if(z(!1),!p.hostToken){L(c({id:`iMYFJM`}));return}H.current=!0,re(!0),L(null),V(null);let r=await p.hostToken(e,t,n).catch(e=>(console.warn(`[AccountSection] storing a host token failed`,e),{ok:!1,login:void 0,error:c({id:`Q5fqMz`})}));re(!1),H.current=!1,r.ok?(ne(``),V({login:r.login||t,host:e})):L(r.error??c({id:`sNeKjP`}))},t[11]=c,t[12]=D,t[13]=p,t[14]=j,t[15]=A,t[16]=K):K=t[16];let q=K,J;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,k.jsx)(`h4`,{id:`settings-host-tokens-title`,className:`text-sm font-medium`,children:(0,k.jsx)(r,{id:`jbhCDS`})}),t[17]=J):J=t[17];let Y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,k.jsxs)(`div`,{children:[J,(0,k.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,k.jsx)(r,{id:`-nA68n`})})]}),t[18]=Y):Y=t[18];let X;t[19]===q?X=t[20]:(X=e=>{e.preventDefault(),q()},t[19]=q,t[20]=X);let Z;t[21]!==v||t[22]!==h||t[23]!==b?(Z=h!==null&&!v&&!b?(0,k.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-account-host-token-not-https`,children:(0,k.jsx)(r,{id:`OWs-8P`})}):null,t[21]=v,t[22]=h,t[23]=b,t[24]=Z):Z=t[24];let Q;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,k.jsx)(r,{id:`Ai2U7L`}),t[25]=Q):Q=t[25];let $;t[26]===x?$=t[27]:($=(0,k.jsx)(o,{htmlFor:x,children:Q}),t[26]=x,t[27]=$);let ie=R||void 0,ae=R&&I?C:void 0,oe;t[28]===R?oe=t[29]:(oe=e=>{U.current=!0,O(e.target.value),R&&(z(!1),L(null))},t[28]=R,t[29]=oe);let se;t[30]!==D||t[31]!==x||t[32]!==ie||t[33]!==ae||t[34]!==oe?(se=(0,k.jsx)(m,{id:x,type:`text`,placeholder:`git.example.com`,autoComplete:`off`,...P,"aria-invalid":ie,"aria-describedby":ae,value:D,onChange:oe}),t[30]=D,t[31]=x,t[32]=ie,t[33]=ae,t[34]=oe,t[35]=se):se=t[35];let ce;t[36]!==$||t[37]!==se?(ce=(0,k.jsxs)(`div`,{className:`space-y-1`,children:[$,se]}),t[36]=$,t[37]=se,t[38]=ce):ce=t[38];let le;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,k.jsx)(r,{id:`7sNhEz`}),t[39]=le):le=t[39];let ue;t[40]===w?ue=t[41]:(ue=(0,k.jsx)(o,{htmlFor:w,children:le}),t[40]=w,t[41]=ue);let de;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(de=e=>te(e.target.value),t[42]=de):de=t[42];let fe;t[43]!==A||t[44]!==T||t[45]!==w?(fe=(0,k.jsx)(m,{id:w,type:`text`,autoComplete:`off`,...P,"aria-describedby":T,value:A,onChange:de}),t[43]=A,t[44]=T,t[45]=w,t[46]=fe):fe=t[46];let pe;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,k.jsx)(r,{id:`azrR7I`,components:{0:(0,k.jsx)(`code`,{translate:`no`}),1:(0,k.jsx)(`code`,{translate:`no`}),2:(0,k.jsx)(`code`,{translate:`no`})}}),t[47]=pe):pe=t[47];let me;t[48]===T?me=t[49]:(me=(0,k.jsx)(`p`,{id:T,className:`text-1sm text-muted-foreground`,"data-testid":`settings-account-host-token-username-hint`,children:pe}),t[48]=T,t[49]=me);let he;t[50]!==ue||t[51]!==fe||t[52]!==me?(he=(0,k.jsxs)(`div`,{className:`space-y-1`,children:[ue,fe,me]}),t[50]=ue,t[51]=fe,t[52]=me,t[53]=he):he=t[53];let ge;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,k.jsx)(r,{id:`SkUcEr`}),t[54]=ge):ge=t[54];let _e;t[55]===E?_e=t[56]:(_e=(0,k.jsx)(o,{htmlFor:E,children:ge}),t[55]=E,t[56]=_e);let ve;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>ne(e.target.value),t[57]=ve):ve=t[57];let ye;t[58]!==j||t[59]!==E?(ye=(0,k.jsx)(m,{id:E,type:`password`,autoComplete:`off`,...P,value:j,onChange:ve}),t[58]=j,t[59]=E,t[60]=ye):ye=t[60];let be;t[61]!==_e||t[62]!==ye?(be=(0,k.jsxs)(`div`,{className:`space-y-1`,children:[_e,ye]}),t[61]=_e,t[62]=ye,t[63]=be):be=t[63];let xe;t[64]!==D||t[65]!==F||t[66]!==j||t[67]!==A?(xe=F||!D.trim()||!A.trim()||!j.trim(),t[64]=D,t[65]=F,t[66]=j,t[67]=A,t[68]=xe):xe=t[68];let Se;t[69]===F?Se=t[70]:(Se=F?(0,k.jsx)(r,{id:`1yHVE-`}):(0,k.jsx)(r,{id:`zXZJoN`}),t[69]=F,t[70]=Se);let Ce;t[71]!==xe||t[72]!==Se?(Ce=(0,k.jsx)(s,{type:`submit`,"data-testid":`settings-account-host-token-submit`,disabled:xe,children:Se}),t[71]=xe,t[72]=Se,t[73]=Ce):Ce=t[73];let we;t[74]===B?we=t[75]:(we=B?(0,k.jsx)(N,{login:B.login,host:B.host}):null,t[74]=B,t[75]=we);let Te;t[76]!==I||t[77]!==C||t[78]!==R?(Te=I?(0,k.jsx)(`p`,{id:R?C:void 0,role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-account-host-token-error`,children:I}):null,t[76]=I,t[77]=C,t[78]=R,t[79]=Te):Te=t[79];let Ee;return t[80]!==Z||t[81]!==ce||t[82]!==he||t[83]!==be||t[84]!==Ce||t[85]!==we||t[86]!==Te||t[87]!==X?(Ee=(0,k.jsxs)(`section`,{"aria-labelledby":`settings-host-tokens-title`,className:`space-y-4`,"data-field":`section:host-tokens`,children:[Y,(0,k.jsxs)(`form`,{className:`space-y-3 rounded-lg border bg-card p-3`,"data-testid":`settings-account-host-token`,"aria-labelledby":`settings-host-tokens-title`,autoComplete:`off`,onSubmit:X,children:[Z,ce,he,be,Ce,we,Te]})]}),t[80]=Z,t[81]=ce,t[82]=he,t[83]=be,t[84]=Ce,t[85]=we,t[86]=Te,t[87]=X,t[88]=Ee):Ee=t[88],Ee}function F(e){let t=(0,ee.c)(20),{login:n,disconnecting:i,error:a,onDisconnect:o}=e,c;t[0]===n?c=t[1]:(c=(0,k.jsx)(`div`,{className:`text-sm font-medium`,children:(0,k.jsx)(r,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=c);let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,k.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,k.jsx)(r,{id:`nxlOpL`})}),t[2]=l):l=t[2];let u;t[3]===c?u=t[4]:(u=(0,k.jsxs)(`div`,{className:`min-w-0`,children:[c,l]}),t[3]=c,t[4]=u);let d;t[5]===i?d=t[6]:(d=i?(0,k.jsx)(r,{id:`rppgXF`}):(0,k.jsx)(r,{id:`-K0AvT`}),t[5]=i,t[6]=d);let f;t[7]!==i||t[8]!==o||t[9]!==d?(f=(0,k.jsx)(s,{variant:`outline`,onClick:o,disabled:i,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:d}),t[7]=i,t[8]=o,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==u||t[12]!==f?(p=(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[u,f]}),t[11]=u,t[12]=f,t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,k.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,k.jsx)(r,{id:`msOK6I`})}),t[14]=m):m=t[14];let h;t[15]===a?h=t[16]:(h=a?(0,k.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-account-disconnect-error`,children:a}):null,t[15]=a,t[16]=h);let g;return t[17]!==p||t[18]!==h?(g=(0,k.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[p,m,h]}),t[17]=p,t[18]=h,t[19]=g):g=t[19],g}function re(e){let t=(0,ee.c)(5),{login:n}=e,i;t[0]===n?i=t[1]:(i=(0,k.jsx)(`div`,{className:`text-sm font-medium`,children:(0,k.jsx)(r,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,k.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,k.jsx)(r,{id:`ny6vNn`})}),t[2]=a):a=t[2];let o;return t[3]===i?o=t[4]:(o=(0,k.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-gh-cli`,children:(0,k.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[i,a]})}),t[3]=i,t[4]=o),o}function I(e){let t=(0,ee.c)(5),{onConnect:n}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,k.jsx)(`div`,{className:`text-sm font-medium`,children:(0,k.jsx)(r,{id:`S33tz3`})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,k.jsxs)(`div`,{className:`min-w-0`,children:[i,(0,k.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,k.jsx)(r,{id:`9djC8C`})})]}),t[1]=a):a=t[1];let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,k.jsx)(r,{id:`5lWFkC`}),t[2]=o):o=t[2];let c;return t[3]===n?c=t[4]:(c=(0,k.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-disconnected`,children:(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[a,(0,k.jsx)(s,{onClick:n,"data-testid":`settings-account-connect`,children:o})]})}),t[3]=n,t[4]=c),c}export{j as AccountSection};
|
package/dist/public/assets/{ActivityModeContent-CJJP9rF8.js → ActivityModeContent-CbnLPTIH.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{a as n,i as r}from"./DocumentContext-mYOuQjoP.js";import{t as i}from"./react-f2sANaYj.js";import{n as a,r as o}from"./dist-Nvb76hAm.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{i as c,n as l,t as u}from"./tooltip-DBqLYfio.js";import{t as d}from"./button-DzgjsZzC.js";import{n as f}from"./dist-BGzUo_18.js";import{t as p}from"./dist-C_FzPxEX2.js";import{f as m}from"./Mermaid-CboBP9o_.js";import{t as h}from"./circle-alert-eBm4JPxY.js";import{t as g}from"./spinner-Bx8xD6f8.js";import{t as _}from"./undo-2-xEF_s_Io.js";import{a as v,c as y,i as b,o as x,s as S,t as C}from"./dialog-BJEjKJjL.js";import{l as w}from"./doc-hash-BJkweiX9.js";import{s as T}from"./navigation-targets-BVafzc0v.js";import{r as E}from"./PageListContext-OHnhzUbe.js";import{a as D,i as O,n as k,o as A,t as ee}from"./agent-diff-store-C4k2G19B.js";import{t as j}from"./timeline-diff-store-BpioNUVS.js";import{n as M}from"./use-activity-panel-DgFEYoQD.js";var N=s(),P=e(i(),1),F=t();function te(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function I(e){let t=(0,N.c)(86),{burst:n,docName:r,editCount:i,sessionAlive:s,inFlight:f,onOpenDiff:p,onRestore:m}=e,{_:h}=o(),[w,T]=(0,P.useState)(ne),E,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{let e=setInterval(()=>T(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=E,t[1]=O):(E=t[0],O=t[1]),(0,P.useEffect)(E,O);let[k,A]=(0,P.useState)(!1),ee=D(),j=n.stackIndex+1,M=ee?.docName===r&&ee.keptCount===j,I=i-j,re=!s||f||I<=0,ie;t[2]!==I||t[3]!==m?(ie=function(){A(!1),m(I)},t[2]=I,t[3]=m,t[4]=ie):ie=t[4];let ae=ie,L;t[5]!==n||t[6]!==p?(L=()=>p(n),t[5]=n,t[6]=p,t[7]=L):L=t[7];let R;t[8]!==h||t[9]!==j||t[10]!==r?(R=h({id:`Z79bnE`,values:{burstNumber:j,docName:r}}),t[8]=h,t[9]=j,t[10]=r,t[11]=R):R=t[11];let oe=M?`bg-muted`:`hover:bg-muted/40`,se;t[12]===oe?se=t[13]:(se=[`flex min-w-0 flex-1 items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground transition-colors`,oe],t[12]=oe,t[13]=se);let ce=se.join(` `),z;t[14]!==n.ts||t[15]!==w?(z=te(n.ts,w),t[14]=n.ts,t[15]=w,t[16]=z):z=t[16];let B;t[17]===z?B=t[18]:(B=(0,F.jsx)(`span`,{className:`font-mono`,children:z}),t[17]=z,t[18]=B);let V;t[19]===n.additions?V=t[20]:(V=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[19]=n.additions,t[20]=V);let H;t[21]===n.deletions?H=t[22]:(H=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[21]=n.deletions,t[22]=H);let U;t[23]!==V||t[24]!==H?(U=(0,F.jsxs)(`span`,{className:`ml-auto font-mono`,children:[V,` `,H]}),t[23]=V,t[24]=H,t[25]=U):U=t[25];let W;t[26]!==M||t[27]!==B||t[28]!==U||t[29]!==L||t[30]!==R||t[31]!==ce?(W=(0,F.jsxs)(`button`,{type:`button`,onClick:L,"aria-pressed":M,"aria-label":R,"data-testid":`activity-panel-burst-open`,className:ce,children:[B,U]}),t[26]=M,t[27]=B,t[28]=U,t[29]=L,t[30]=R,t[31]=ce,t[32]=W):W=t[32];let le;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1.5 h-3 w-px shrink-0 bg-border`}),t[33]=le):le=t[33];let G;t[34]!==h||t[35]!==j||t[36]!==r?(G=h({id:`Zhe80e`,values:{burstNumber:j,docName:r}}),t[34]=h,t[35]=j,t[36]=r,t[37]=G):G=t[37];let ue;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>A(!0),t[38]=ue):ue=t[38];let K;t[39]===f?K=t[40]:(K=f?(0,F.jsx)(g,{className:`size-3`,"aria-hidden":`true`}):(0,F.jsx)(_,{className:`size-3`,"aria-hidden":`true`}),t[39]=f,t[40]=K);let q;t[41]!==re||t[42]!==G||t[43]!==K?(q=(0,F.jsx)(c,{asChild:!0,children:(0,F.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`activity-panel-burst-restore`,"aria-label":G,disabled:re,onClick:ue,children:K})}),t[41]=re,t[42]=G,t[43]=K,t[44]=q):q=t[44];let J;t[45]!==h||t[46]!==I||t[47]!==s?(J=h(s?I>0?{id:`SOPwPh`}:{id:`62bOuM`}:{id:`NzFvyK`}),t[45]=h,t[46]=I,t[47]=s,t[48]=J):J=t[48];let Y;t[49]===J?Y=t[50]:(Y=(0,F.jsx)(l,{side:`left`,children:J}),t[49]=J,t[50]=Y);let X;t[51]!==q||t[52]!==Y?(X=(0,F.jsxs)(u,{children:[q,Y]}),t[51]=q,t[52]=Y,t[53]=X):X=t[53];let Z;t[54]!==W||t[55]!==X?(Z=(0,F.jsxs)(`div`,{className:`flex items-center border-t border-border/50 pr-3`,children:[W,le,X]}),t[54]=W,t[55]=X,t[56]=Z):Z=t[56];let Q;t[57]===f?Q=t[58]:(Q=e=>{!e&&!f?A(!1):e&&A(!0)},t[57]=f,t[58]=Q);let de;t[59]===h?de=t[60]:(de=h({id:`a4FRQv`}),t[59]=h,t[60]=de);let fe;t[61]===de?fe=t[62]:(fe=(0,F.jsx)(y,{children:de}),t[61]=de,t[62]=fe);let pe;t[63]===I?pe=t[64]:(pe=(0,F.jsx)(v,{children:(0,F.jsx)(a,{id:`LKIPzv`,values:{laterEdits:I}})}),t[63]=I,t[64]=pe);let $;t[65]!==fe||t[66]!==pe?($=(0,F.jsxs)(S,{children:[fe,pe]}),t[65]=fe,t[66]=pe,t[67]=$):$=t[67];let me;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,F.jsx)(d,{variant:`outline`,"data-testid":`activity-panel-burst-restore-cancel`,onClick:()=>A(!1),children:(0,F.jsx)(a,{id:`dEgA5A`})}),t[68]=me):me=t[68];let he;t[69]===f?he=t[70]:(he=f?(0,F.jsx)(g,{className:`mr-2 size-4`,"aria-hidden":`true`}):null,t[69]=f,t[70]=he);let ge;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,F.jsx)(a,{id:`9uI_rE`}),t[71]=ge):ge=t[71];let _e;t[72]!==ae||t[73]!==f||t[74]!==he?(_e=(0,F.jsxs)(x,{children:[me,(0,F.jsxs)(d,{variant:`destructive`,"data-testid":`activity-panel-burst-restore-confirm`,disabled:f,onClick:ae,children:[he,ge]})]}),t[72]=ae,t[73]=f,t[74]=he,t[75]=_e):_e=t[75];let ve;t[76]!==$||t[77]!==_e?(ve=(0,F.jsxs)(b,{children:[$,_e]}),t[76]=$,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]!==k||t[80]!==Q||t[81]!==ve?(ye=(0,F.jsx)(C,{open:k,onOpenChange:Q,children:ve}),t[79]=k,t[80]=Q,t[81]=ve,t[82]=ye):ye=t[82];let be;return t[83]!==Z||t[84]!==ye?(be=(0,F.jsxs)(F.Fragment,{children:[Z,ye]}),t[83]=Z,t[84]=ye,t[85]=be):be=t[85],be}function ne(){return Date.now()}function re(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return p._({id:`nYeBmY`,values:{hours:r}})}function ie(e){let t=(0,N.c)(56),{file:n,sessionAlive:r,isWriting:i,onNavigate:s,onUndoDrop:c,onSetVersion:l}=e,{_:u}=o(),{docName:d}=n,[f,p]=(0,P.useState)(!1),[m,h]=(0,P.useState)(ae),g,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=setInterval(()=>h(Date.now()),3e4);return()=>clearInterval(e)},_=[],t[0]=g,t[1]=_):(g=t[0],_=t[1]),(0,P.useEffect)(g,_);let v=n.bursts.length,y;t[2]!==n.docName||t[3]!==c||t[4]!==r||t[5]!==f?(y=e=>{e<=0||!r||f||(p(!0),Promise.resolve(c(n.docName,e)).finally(()=>{p(!1),ee()}))},t[2]=n.docName,t[3]=c,t[4]=r,t[5]=f,t[6]=y):y=t[6];let b=y;if(n.bursts.length===0)return null;let x;t[7]!==n.docName||t[8]!==s?(x=()=>s(n.docName),t[7]=n.docName,t[8]=s,t[9]=x):x=t[9];let S;t[10]!==u||t[11]!==d?(S=u({id:`QcpeeE`,values:{docName:d}}),t[10]=u,t[11]=d,t[12]=S):S=t[12];let C;t[13]!==n.docName||t[14]!==x||t[15]!==S?(C=(0,F.jsx)(`button`,{type:`button`,onClick:x,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":S,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[13]=n.docName,t[14]=x,t[15]=S,t[16]=C):C=t[16];let w;t[17]===n.additionsTotal?w=t[18]:(w=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[17]=n.additionsTotal,t[18]=w);let T;t[19]===n.deletionsTotal?T=t[20]:(T=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[19]=n.deletionsTotal,t[20]=T);let E;t[21]!==w||t[22]!==T?(E=(0,F.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[w,` `,T]}),t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==n.lastTs||t[25]!==m?(D=re(n.lastTs,m),t[24]=n.lastTs,t[25]=m,t[26]=D):D=t[26];let O;t[27]===D?O=t[28]:(O=(0,F.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:D}),t[27]=D,t[28]=O);let k;t[29]===i?k=t[30]:(k=i?(0,F.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,F.jsx)(a,{id:`6q0rnH`})}):null,t[29]=i,t[30]=k);let A;t[31]!==O||t[32]!==k||t[33]!==C||t[34]!==E?(A=(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[C,E,O,k]}),t[31]=O,t[32]=k,t[33]=C,t[34]=E,t[35]=A):A=t[35];let j;if(t[36]!==b||t[37]!==v||t[38]!==n.bursts||t[39]!==n.docName||t[40]!==l||t[41]!==r||t[42]!==f){let e;t[44]!==b||t[45]!==v||t[46]!==n.docName||t[47]!==l||t[48]!==r||t[49]!==f?(e=e=>(0,F.jsx)(I,{burst:e,docName:n.docName,editCount:v,sessionAlive:r,inFlight:f,onOpenDiff:e=>l(e.stackIndex+1),onRestore:b},`${n.docName}:${e.stackIndex}`),t[44]=b,t[45]=v,t[46]=n.docName,t[47]=l,t[48]=r,t[49]=f,t[50]=e):e=t[50],j=n.bursts.map(e),t[36]=b,t[37]=v,t[38]=n.bursts,t[39]=n.docName,t[40]=l,t[41]=r,t[42]=f,t[43]=j}else j=t[43];let M;t[51]===j?M=t[52]:(M=(0,F.jsx)(`div`,{children:j}),t[51]=j,t[52]=M);let te;return t[53]!==A||t[54]!==M?(te=(0,F.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[A,M]}),t[53]=A,t[54]=M,t[55]=te):te=t[55],te}function ae(){return Date.now()}async function L(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function R(e){typeof window>`u`||(window.location.hash=w(e))}function oe(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(g,{className:`mr-2 size-4`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,F.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,F.jsx)(`span`,{className:`text-sm`,children:(0,F.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function se(e){let t=(0,N.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,F.jsx)(h,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,F.jsx)(`p`,{className:`text-sm font-medium`,children:(0,F.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,F.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,F.jsx)(a,{id:`6gRgw8`}),t[4]=c):c=t[4];let l;t[5]===r?l=t[6]:(l=(0,F.jsx)(d,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:c}),t[5]=r,t[6]=l);let u;return t[7]!==s||t[8]!==l?(u=(0,F.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,l]}),t[7]=s,t[8]=l,t[9]=u):u=t[9],u}function ce(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,F.jsx)(`p`,{className:`text-sm italic`,children:(0,F.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function z(e){let t=(0,N.c)(12),{onExit:n,showBackButton:r}=e,{_:i}=o(),s;t[0]===i?s=t[1]:(s=i({id:`kYL1lH`}),t[0]=i,t[1]=s);let c;t[2]!==n||t[3]!==r?(c=r?(0,F.jsx)(B,{onClick:n}):null,t[2]=n,t[3]=r,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,F.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,F.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,F.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":s,children:[u,d]}),t[9]=s,t[10]=u,t[11]=f):f=t[11],f}function B(e){let t=(0,N.c)(9),{onClick:n}=e,{_:r}=o(),i;t[0]===r?i=t[1]:(i=r({id:`ogAuyr`}),t[0]=r,t[1]=i);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(m,{}),t[2]=s):s=t[2];let f;t[3]!==n||t[4]!==i?(f=(0,F.jsx)(c,{asChild:!0,children:(0,F.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":i,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=i,t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,F.jsx)(l,{side:`bottom`,children:(0,F.jsx)(a,{id:`ogAuyr`})}),t[6]=p):p=t[6];let h;return t[7]===f?h=t[8]:(h=(0,F.jsxs)(u,{children:[f,p]}),t[7]=f,t[8]=h),h}function V(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.useState)(H),i;t[0]!==n||t[1]!==r?(i=n?U(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(`span`,{className:`font-medium`,children:(0,F.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,F.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,F.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,F.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[s,c,l]}),t[7]=c,t[8]=u),u}function H(){return Date.now()}function U(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return p._({id:`nYeBmY`,values:{hours:n}})}function W(e){let t=(0,N.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,F.jsx)(A,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,F.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function le(e){let t=(0,N.c)(25),{data:n,status:r,error:i,reload:s,onExit:c,onNavigate:l,onUndoDrop:u,onSetVersion:d,showBackButton:f}=e,{_:p}=o(),m=n?.files?.[0]?.lastTs??null,h=n?.files?.length??0,g;t[0]===p?g=t[1]:(g=p({id:`kYL1lH`}),t[0]=p,t[1]=g);let _;t[2]!==c||t[3]!==f?(_=f?(0,F.jsx)(B,{onClick:c}):null,t[2]=c,t[3]=f,t[4]=_):_=t[4];let v;t[5]!==n||t[6]!==h||t[7]!==m?(v=n?.agent?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(W,{agent:n.agent}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,F.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,F.jsx)(a,{id:`F6pfE9`}):m===null?(0,F.jsx)(a,{id:`PMyJ9C`}):(0,F.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsx)(a,{id:`u3BOHd`,values:{fileCount:h}})]}):null]})]})]}):(0,F.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=h,t[7]=m,t[8]=v):v=t[8];let y;t[9]!==_||t[10]!==v?(y=(0,F.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==n||t[13]!==i||t[14]!==m||t[15]!==l||t[16]!==d||t[17]!==u||t[18]!==s||t[19]!==r?(b=(0,F.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,F.jsx)(oe,{}):r===`error`&&i?(0,F.jsx)(se,{error:i,onRetry:s}):n===null?(0,F.jsx)(ce,{}):(0,F.jsxs)(F.Fragment,{children:[!n.sessionAlive&&m!==null?(0,F.jsx)(V,{lastTs:m}):null,n.files.length===0?(0,F.jsx)(ce,{}):n.files.map(e=>(0,F.jsx)(ie,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:l,onUndoDrop:u,onSetVersion:t=>d(e,t)},e.docName))]})}),t[12]=n,t[13]=i,t[14]=m,t[15]=l,t[16]=d,t[17]=u,t[18]=s,t[19]=r,t[20]=b):b=t[20];let x;return t[21]!==g||t[22]!==y||t[23]!==b?(x=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":g,children:[y,b]}),t[21]=g,t[22]=y,t[23]=b,t[24]=x):x=t[24],x}function G(e){let t=(0,N.c)(30),i;t[0]===e?i=t[1]:(i=e===void 0?{}:e,t[0]=e,t[1]=i);let{showBackButton:a}=i,s=a===void 0?!0:a,{_:c}=o(),{docPanelAgentId:l,closeActivityPanel:u}=r(),{openTargetTransition:d}=n(),{pageMeta:p}=E(),{data:m,status:h,error:g,reload:_}=M(l),v,y;if(t[2]!==m||t[3]!==l?(v=()=>{if(!(!m||l===null))for(let e of m.files)O(l,e.docName,e.bursts.length)},y=[m,l],t[2]=m,t[3]=l,t[4]=v,t[5]=y):(v=t[4],y=t[5]),(0,P.useEffect)(v,y),l===null){let e;return t[6]!==u||t[7]!==s?(e=(0,F.jsx)(z,{onExit:u,showBackButton:s}),t[6]=u,t[7]=s,t[8]=e):e=t[8],e}let b;t[9]!==d||t[10]!==p?(b=e=>{d(T({kind:`doc`,target:e,docName:e},p),{disposition:`permanent`,consumeActiveNewTab:!0}),R(e)},t[9]=d,t[10]=p,t[11]=b):b=t[11];let x=b,S;t[12]!==m||t[13]!==l?(S=(e,t)=>{if(!m?.agent||l===null)return;j();let n=e.bursts.length;k({agentId:l,agentName:m.agent.displayName,agentColor:m.agent.color,agentIcon:m.agent.icon,docName:e.docName,keptCount:Math.max(0,Math.min(t,n)),maxVersions:n})},t[12]=m,t[13]=l,t[14]=S):S=t[14];let C=S,w;t[15]!==c||t[16]!==m||t[17]!==l||t[18]!==_?(w=async(e,t)=>{if(!(t<=0))try{await L({connectionId:l,docName:e,scope:`count`,count:t,agentName:m?.agent?.displayName}),f.success(c(t===1?{id:`-dNlfM`,values:{docName:e}}:{id:`ApeA0n`,values:{dropCount:t,docName:e}})),_()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);f.error(c({id:`EqrC_R`,values:{message:n}})),_()}},t[15]=c,t[16]=m,t[17]=l,t[18]=_,t[19]=w):w=t[19];let D=w,A;return t[20]!==u||t[21]!==m||t[22]!==g||t[23]!==x||t[24]!==C||t[25]!==D||t[26]!==_||t[27]!==s||t[28]!==h?(A=(0,F.jsx)(le,{data:m,status:h,error:g,reload:_,onExit:u,onNavigate:x,onUndoDrop:D,onSetVersion:C,showBackButton:s}),t[20]=u,t[21]=m,t[22]=g,t[23]=x,t[24]=C,t[25]=D,t[26]=_,t[27]=s,t[28]=h,t[29]=A):A=t[29],A}export{G as ActivityModeContent};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{a as n,i as r}from"./DocumentContext-Bsl186nT.js";import{t as i}from"./react-f2sANaYj.js";import{n as a,r as o}from"./dist-Nvb76hAm.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{i as c,n as l,t as u}from"./tooltip-DBqLYfio.js";import{t as d}from"./button-DzgjsZzC.js";import{n as f}from"./dist-BGzUo_18.js";import{t as p}from"./dist-C_FzPxEX2.js";import{f as m}from"./Mermaid-CboBP9o_.js";import{t as h}from"./circle-alert-eBm4JPxY.js";import{t as g}from"./spinner-Bx8xD6f8.js";import{t as _}from"./undo-2-xEF_s_Io.js";import{a as v,c as y,i as b,o as x,s as S,t as C}from"./dialog-BJEjKJjL.js";import{l as w}from"./doc-hash-BJkweiX9.js";import{s as T}from"./navigation-targets-BVafzc0v.js";import{r as E}from"./PageListContext-OHnhzUbe.js";import{a as D,i as O,n as k,o as A,t as ee}from"./agent-diff-store-C4k2G19B.js";import{t as j}from"./timeline-diff-store-BpioNUVS.js";import{n as M}from"./use-activity-panel-I5AELaRz.js";var N=s(),P=e(i(),1),F=t();function te(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function I(e){let t=(0,N.c)(86),{burst:n,docName:r,editCount:i,sessionAlive:s,inFlight:f,onOpenDiff:p,onRestore:m}=e,{_:h}=o(),[w,T]=(0,P.useState)(ne),E,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{let e=setInterval(()=>T(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=E,t[1]=O):(E=t[0],O=t[1]),(0,P.useEffect)(E,O);let[k,A]=(0,P.useState)(!1),ee=D(),j=n.stackIndex+1,M=ee?.docName===r&&ee.keptCount===j,I=i-j,re=!s||f||I<=0,ie;t[2]!==I||t[3]!==m?(ie=function(){A(!1),m(I)},t[2]=I,t[3]=m,t[4]=ie):ie=t[4];let ae=ie,L;t[5]!==n||t[6]!==p?(L=()=>p(n),t[5]=n,t[6]=p,t[7]=L):L=t[7];let R;t[8]!==h||t[9]!==j||t[10]!==r?(R=h({id:`Z79bnE`,values:{burstNumber:j,docName:r}}),t[8]=h,t[9]=j,t[10]=r,t[11]=R):R=t[11];let oe=M?`bg-muted`:`hover:bg-muted/40`,se;t[12]===oe?se=t[13]:(se=[`flex min-w-0 flex-1 items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground transition-colors`,oe],t[12]=oe,t[13]=se);let ce=se.join(` `),z;t[14]!==n.ts||t[15]!==w?(z=te(n.ts,w),t[14]=n.ts,t[15]=w,t[16]=z):z=t[16];let B;t[17]===z?B=t[18]:(B=(0,F.jsx)(`span`,{className:`font-mono`,children:z}),t[17]=z,t[18]=B);let V;t[19]===n.additions?V=t[20]:(V=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[19]=n.additions,t[20]=V);let H;t[21]===n.deletions?H=t[22]:(H=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[21]=n.deletions,t[22]=H);let U;t[23]!==V||t[24]!==H?(U=(0,F.jsxs)(`span`,{className:`ml-auto font-mono`,children:[V,` `,H]}),t[23]=V,t[24]=H,t[25]=U):U=t[25];let W;t[26]!==M||t[27]!==B||t[28]!==U||t[29]!==L||t[30]!==R||t[31]!==ce?(W=(0,F.jsxs)(`button`,{type:`button`,onClick:L,"aria-pressed":M,"aria-label":R,"data-testid":`activity-panel-burst-open`,className:ce,children:[B,U]}),t[26]=M,t[27]=B,t[28]=U,t[29]=L,t[30]=R,t[31]=ce,t[32]=W):W=t[32];let le;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1.5 h-3 w-px shrink-0 bg-border`}),t[33]=le):le=t[33];let G;t[34]!==h||t[35]!==j||t[36]!==r?(G=h({id:`Zhe80e`,values:{burstNumber:j,docName:r}}),t[34]=h,t[35]=j,t[36]=r,t[37]=G):G=t[37];let ue;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>A(!0),t[38]=ue):ue=t[38];let K;t[39]===f?K=t[40]:(K=f?(0,F.jsx)(g,{className:`size-3`,"aria-hidden":`true`}):(0,F.jsx)(_,{className:`size-3`,"aria-hidden":`true`}),t[39]=f,t[40]=K);let q;t[41]!==re||t[42]!==G||t[43]!==K?(q=(0,F.jsx)(c,{asChild:!0,children:(0,F.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`activity-panel-burst-restore`,"aria-label":G,disabled:re,onClick:ue,children:K})}),t[41]=re,t[42]=G,t[43]=K,t[44]=q):q=t[44];let J;t[45]!==h||t[46]!==I||t[47]!==s?(J=h(s?I>0?{id:`SOPwPh`}:{id:`62bOuM`}:{id:`NzFvyK`}),t[45]=h,t[46]=I,t[47]=s,t[48]=J):J=t[48];let Y;t[49]===J?Y=t[50]:(Y=(0,F.jsx)(l,{side:`left`,children:J}),t[49]=J,t[50]=Y);let X;t[51]!==q||t[52]!==Y?(X=(0,F.jsxs)(u,{children:[q,Y]}),t[51]=q,t[52]=Y,t[53]=X):X=t[53];let Z;t[54]!==W||t[55]!==X?(Z=(0,F.jsxs)(`div`,{className:`flex items-center border-t border-border/50 pr-3`,children:[W,le,X]}),t[54]=W,t[55]=X,t[56]=Z):Z=t[56];let Q;t[57]===f?Q=t[58]:(Q=e=>{!e&&!f?A(!1):e&&A(!0)},t[57]=f,t[58]=Q);let de;t[59]===h?de=t[60]:(de=h({id:`a4FRQv`}),t[59]=h,t[60]=de);let fe;t[61]===de?fe=t[62]:(fe=(0,F.jsx)(y,{children:de}),t[61]=de,t[62]=fe);let pe;t[63]===I?pe=t[64]:(pe=(0,F.jsx)(v,{children:(0,F.jsx)(a,{id:`LKIPzv`,values:{laterEdits:I}})}),t[63]=I,t[64]=pe);let $;t[65]!==fe||t[66]!==pe?($=(0,F.jsxs)(S,{children:[fe,pe]}),t[65]=fe,t[66]=pe,t[67]=$):$=t[67];let me;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,F.jsx)(d,{variant:`outline`,"data-testid":`activity-panel-burst-restore-cancel`,onClick:()=>A(!1),children:(0,F.jsx)(a,{id:`dEgA5A`})}),t[68]=me):me=t[68];let he;t[69]===f?he=t[70]:(he=f?(0,F.jsx)(g,{className:`mr-2 size-4`,"aria-hidden":`true`}):null,t[69]=f,t[70]=he);let ge;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,F.jsx)(a,{id:`9uI_rE`}),t[71]=ge):ge=t[71];let _e;t[72]!==ae||t[73]!==f||t[74]!==he?(_e=(0,F.jsxs)(x,{children:[me,(0,F.jsxs)(d,{variant:`destructive`,"data-testid":`activity-panel-burst-restore-confirm`,disabled:f,onClick:ae,children:[he,ge]})]}),t[72]=ae,t[73]=f,t[74]=he,t[75]=_e):_e=t[75];let ve;t[76]!==$||t[77]!==_e?(ve=(0,F.jsxs)(b,{children:[$,_e]}),t[76]=$,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]!==k||t[80]!==Q||t[81]!==ve?(ye=(0,F.jsx)(C,{open:k,onOpenChange:Q,children:ve}),t[79]=k,t[80]=Q,t[81]=ve,t[82]=ye):ye=t[82];let be;return t[83]!==Z||t[84]!==ye?(be=(0,F.jsxs)(F.Fragment,{children:[Z,ye]}),t[83]=Z,t[84]=ye,t[85]=be):be=t[85],be}function ne(){return Date.now()}function re(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return p._({id:`nYeBmY`,values:{hours:r}})}function ie(e){let t=(0,N.c)(56),{file:n,sessionAlive:r,isWriting:i,onNavigate:s,onUndoDrop:c,onSetVersion:l}=e,{_:u}=o(),{docName:d}=n,[f,p]=(0,P.useState)(!1),[m,h]=(0,P.useState)(ae),g,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=setInterval(()=>h(Date.now()),3e4);return()=>clearInterval(e)},_=[],t[0]=g,t[1]=_):(g=t[0],_=t[1]),(0,P.useEffect)(g,_);let v=n.bursts.length,y;t[2]!==n.docName||t[3]!==c||t[4]!==r||t[5]!==f?(y=e=>{e<=0||!r||f||(p(!0),Promise.resolve(c(n.docName,e)).finally(()=>{p(!1),ee()}))},t[2]=n.docName,t[3]=c,t[4]=r,t[5]=f,t[6]=y):y=t[6];let b=y;if(n.bursts.length===0)return null;let x;t[7]!==n.docName||t[8]!==s?(x=()=>s(n.docName),t[7]=n.docName,t[8]=s,t[9]=x):x=t[9];let S;t[10]!==u||t[11]!==d?(S=u({id:`QcpeeE`,values:{docName:d}}),t[10]=u,t[11]=d,t[12]=S):S=t[12];let C;t[13]!==n.docName||t[14]!==x||t[15]!==S?(C=(0,F.jsx)(`button`,{type:`button`,onClick:x,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":S,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[13]=n.docName,t[14]=x,t[15]=S,t[16]=C):C=t[16];let w;t[17]===n.additionsTotal?w=t[18]:(w=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[17]=n.additionsTotal,t[18]=w);let T;t[19]===n.deletionsTotal?T=t[20]:(T=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[19]=n.deletionsTotal,t[20]=T);let E;t[21]!==w||t[22]!==T?(E=(0,F.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[w,` `,T]}),t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==n.lastTs||t[25]!==m?(D=re(n.lastTs,m),t[24]=n.lastTs,t[25]=m,t[26]=D):D=t[26];let O;t[27]===D?O=t[28]:(O=(0,F.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:D}),t[27]=D,t[28]=O);let k;t[29]===i?k=t[30]:(k=i?(0,F.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,F.jsx)(a,{id:`6q0rnH`})}):null,t[29]=i,t[30]=k);let A;t[31]!==O||t[32]!==k||t[33]!==C||t[34]!==E?(A=(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[C,E,O,k]}),t[31]=O,t[32]=k,t[33]=C,t[34]=E,t[35]=A):A=t[35];let j;if(t[36]!==b||t[37]!==v||t[38]!==n.bursts||t[39]!==n.docName||t[40]!==l||t[41]!==r||t[42]!==f){let e;t[44]!==b||t[45]!==v||t[46]!==n.docName||t[47]!==l||t[48]!==r||t[49]!==f?(e=e=>(0,F.jsx)(I,{burst:e,docName:n.docName,editCount:v,sessionAlive:r,inFlight:f,onOpenDiff:e=>l(e.stackIndex+1),onRestore:b},`${n.docName}:${e.stackIndex}`),t[44]=b,t[45]=v,t[46]=n.docName,t[47]=l,t[48]=r,t[49]=f,t[50]=e):e=t[50],j=n.bursts.map(e),t[36]=b,t[37]=v,t[38]=n.bursts,t[39]=n.docName,t[40]=l,t[41]=r,t[42]=f,t[43]=j}else j=t[43];let M;t[51]===j?M=t[52]:(M=(0,F.jsx)(`div`,{children:j}),t[51]=j,t[52]=M);let te;return t[53]!==A||t[54]!==M?(te=(0,F.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[A,M]}),t[53]=A,t[54]=M,t[55]=te):te=t[55],te}function ae(){return Date.now()}async function L(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function R(e){typeof window>`u`||(window.location.hash=w(e))}function oe(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(g,{className:`mr-2 size-4`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,F.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,F.jsx)(`span`,{className:`text-sm`,children:(0,F.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function se(e){let t=(0,N.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,F.jsx)(h,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,F.jsx)(`p`,{className:`text-sm font-medium`,children:(0,F.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,F.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,F.jsx)(a,{id:`6gRgw8`}),t[4]=c):c=t[4];let l;t[5]===r?l=t[6]:(l=(0,F.jsx)(d,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:c}),t[5]=r,t[6]=l);let u;return t[7]!==s||t[8]!==l?(u=(0,F.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,l]}),t[7]=s,t[8]=l,t[9]=u):u=t[9],u}function ce(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,F.jsx)(`p`,{className:`text-sm italic`,children:(0,F.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function z(e){let t=(0,N.c)(12),{onExit:n,showBackButton:r}=e,{_:i}=o(),s;t[0]===i?s=t[1]:(s=i({id:`kYL1lH`}),t[0]=i,t[1]=s);let c;t[2]!==n||t[3]!==r?(c=r?(0,F.jsx)(B,{onClick:n}):null,t[2]=n,t[3]=r,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,F.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,F.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,F.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":s,children:[u,d]}),t[9]=s,t[10]=u,t[11]=f):f=t[11],f}function B(e){let t=(0,N.c)(9),{onClick:n}=e,{_:r}=o(),i;t[0]===r?i=t[1]:(i=r({id:`ogAuyr`}),t[0]=r,t[1]=i);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(m,{}),t[2]=s):s=t[2];let f;t[3]!==n||t[4]!==i?(f=(0,F.jsx)(c,{asChild:!0,children:(0,F.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":i,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=i,t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,F.jsx)(l,{side:`bottom`,children:(0,F.jsx)(a,{id:`ogAuyr`})}),t[6]=p):p=t[6];let h;return t[7]===f?h=t[8]:(h=(0,F.jsxs)(u,{children:[f,p]}),t[7]=f,t[8]=h),h}function V(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.useState)(H),i;t[0]!==n||t[1]!==r?(i=n?U(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(`span`,{className:`font-medium`,children:(0,F.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,F.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,F.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,F.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[s,c,l]}),t[7]=c,t[8]=u),u}function H(){return Date.now()}function U(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return p._({id:`nYeBmY`,values:{hours:n}})}function W(e){let t=(0,N.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,F.jsx)(A,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,F.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function le(e){let t=(0,N.c)(25),{data:n,status:r,error:i,reload:s,onExit:c,onNavigate:l,onUndoDrop:u,onSetVersion:d,showBackButton:f}=e,{_:p}=o(),m=n?.files?.[0]?.lastTs??null,h=n?.files?.length??0,g;t[0]===p?g=t[1]:(g=p({id:`kYL1lH`}),t[0]=p,t[1]=g);let _;t[2]!==c||t[3]!==f?(_=f?(0,F.jsx)(B,{onClick:c}):null,t[2]=c,t[3]=f,t[4]=_):_=t[4];let v;t[5]!==n||t[6]!==h||t[7]!==m?(v=n?.agent?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(W,{agent:n.agent}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,F.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,F.jsx)(a,{id:`F6pfE9`}):m===null?(0,F.jsx)(a,{id:`PMyJ9C`}):(0,F.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsx)(a,{id:`u3BOHd`,values:{fileCount:h}})]}):null]})]})]}):(0,F.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=h,t[7]=m,t[8]=v):v=t[8];let y;t[9]!==_||t[10]!==v?(y=(0,F.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==n||t[13]!==i||t[14]!==m||t[15]!==l||t[16]!==d||t[17]!==u||t[18]!==s||t[19]!==r?(b=(0,F.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,F.jsx)(oe,{}):r===`error`&&i?(0,F.jsx)(se,{error:i,onRetry:s}):n===null?(0,F.jsx)(ce,{}):(0,F.jsxs)(F.Fragment,{children:[!n.sessionAlive&&m!==null?(0,F.jsx)(V,{lastTs:m}):null,n.files.length===0?(0,F.jsx)(ce,{}):n.files.map(e=>(0,F.jsx)(ie,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:l,onUndoDrop:u,onSetVersion:t=>d(e,t)},e.docName))]})}),t[12]=n,t[13]=i,t[14]=m,t[15]=l,t[16]=d,t[17]=u,t[18]=s,t[19]=r,t[20]=b):b=t[20];let x;return t[21]!==g||t[22]!==y||t[23]!==b?(x=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":g,children:[y,b]}),t[21]=g,t[22]=y,t[23]=b,t[24]=x):x=t[24],x}function G(e){let t=(0,N.c)(30),i;t[0]===e?i=t[1]:(i=e===void 0?{}:e,t[0]=e,t[1]=i);let{showBackButton:a}=i,s=a===void 0?!0:a,{_:c}=o(),{docPanelAgentId:l,closeActivityPanel:u}=r(),{openTargetTransition:d}=n(),{pageMeta:p}=E(),{data:m,status:h,error:g,reload:_}=M(l),v,y;if(t[2]!==m||t[3]!==l?(v=()=>{if(!(!m||l===null))for(let e of m.files)O(l,e.docName,e.bursts.length)},y=[m,l],t[2]=m,t[3]=l,t[4]=v,t[5]=y):(v=t[4],y=t[5]),(0,P.useEffect)(v,y),l===null){let e;return t[6]!==u||t[7]!==s?(e=(0,F.jsx)(z,{onExit:u,showBackButton:s}),t[6]=u,t[7]=s,t[8]=e):e=t[8],e}let b;t[9]!==d||t[10]!==p?(b=e=>{d(T({kind:`doc`,target:e,docName:e},p),{disposition:`permanent`,consumeActiveNewTab:!0}),R(e)},t[9]=d,t[10]=p,t[11]=b):b=t[11];let x=b,S;t[12]!==m||t[13]!==l?(S=(e,t)=>{if(!m?.agent||l===null)return;j();let n=e.bursts.length;k({agentId:l,agentName:m.agent.displayName,agentColor:m.agent.color,agentIcon:m.agent.icon,docName:e.docName,keptCount:Math.max(0,Math.min(t,n)),maxVersions:n})},t[12]=m,t[13]=l,t[14]=S):S=t[14];let C=S,w;t[15]!==c||t[16]!==m||t[17]!==l||t[18]!==_?(w=async(e,t)=>{if(!(t<=0))try{await L({connectionId:l,docName:e,scope:`count`,count:t,agentName:m?.agent?.displayName}),f.success(c(t===1?{id:`-dNlfM`,values:{docName:e}}:{id:`ApeA0n`,values:{dropCount:t,docName:e}})),_()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);f.error(c({id:`EqrC_R`,values:{message:n}})),_()}},t[15]=c,t[16]=m,t[17]=l,t[18]=_,t[19]=w):w=t[19];let D=w,A;return t[20]!==u||t[21]!==m||t[22]!==g||t[23]!==x||t[24]!==C||t[25]!==D||t[26]!==_||t[27]!==s||t[28]!==h?(A=(0,F.jsx)(le,{data:m,status:h,error:g,reload:_,onExit:u,onNavigate:x,onUndoDrop:D,onSetVersion:C,showBackButton:s}),t[20]=u,t[21]=m,t[22]=g,t[23]=x,t[24]=C,t[25]=D,t[26]=_,t[27]=s,t[28]=h,t[29]=A):A=t[29],A}export{G as ActivityModeContent};
|