@inkeep/open-knowledge 0.47.0 → 0.47.2
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/{acp-harness-probe-LTkK-pm3.mjs → acp-harness-probe-BS_GVpXi.mjs} +2 -2
- package/dist/cli.mjs +7 -7
- package/dist/config-schema.json +10 -1
- package/dist/config.user.schema.json +10 -1
- package/dist/constants-B6Rluza9.mjs +2 -0
- package/dist/fs-traced-C-HqiL6u.mjs +1 -0
- package/dist/{fs-traced-OS6B1cZZ.mjs → fs-traced-D12ehU8a.mjs} +2 -2
- package/dist/{git-handle-RLYVdszV.mjs → git-handle-CllEzrX4.mjs} +2 -2
- package/dist/git-handle-DJPLRe3o.mjs +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/init-BPi9Ds95.mjs +1 -0
- package/dist/{init-C6L0cHF3.mjs → init-BeYJKmNg.mjs} +3 -3
- package/dist/{launch-json-removal-1HejjM9e.mjs → launch-json-removal-DdX9rfjT.mjs} +2 -2
- package/dist/{loader-CpKeMYig.mjs → loader-BkpwQ1M5.mjs} +2 -2
- package/dist/loader-dfPeN6AB.mjs +1 -0
- package/dist/md-manager-DqRVEVmJ.mjs +2 -0
- package/dist/{open-browser-D-pnyvDF.mjs → open-browser-CMjR6jVI.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-CL0M-CoJ.mjs → preview-CdF8JbyL.mjs} +2 -2
- package/dist/preview-D-HMAFqO.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-DnjDjPFp.js → ActivityModeContent-2l8BA531.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-Th6j3NhO.js → AgentDiffPane-wqdF9lpR.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-BVm5Ldhz.js → AgentThreadClientBinder-56IhVeqo.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-DVfCTGd2.js → ChangedOutsideBadge-eT1ODdAD.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-DmM8F7PJ.js → CodeMirrorPropInput-L7fbBlLy.js} +1 -1
- package/dist/public/assets/{DocumentContext-B0g_vd8N.js → DocumentContext-DD95gIt4.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-DKuXrb9b.js → EditorModeToggle-CR5jA0YM.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-BQttSYlY.js → EnableSyncConfirmDialog-C5fNw26t.js} +1 -1
- package/dist/public/assets/FeedbackForm-macxQS8x.js +1 -0
- package/dist/public/assets/{GraphPanel-DK2w8FEz.js → GraphPanel-BDGxPSvY.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-DHfVuiKL.js → ImportSkillDialog-B2ilfqxe.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-B-7Pe22_.js → LintConfigEditor-ByUOzhaw.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-B-Y5eayN.js → ManagedArtifactProperties-CVGjtd3P.js} +2 -2
- package/dist/public/assets/ManagedArtifactProperties-m1GRSrIt.js +1 -0
- package/dist/public/assets/{McpConsentDialogBody-DPMIdjmd.js → McpConsentDialogBody-B3ubISnW.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-CBHNf1No.js → MermaidDocEditor-CftVeU4U.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-CXLxw7Fr.js → ReportBugDialogBody-CWbkwdNL.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-DG-dOTBT.js → SchemaConfigEditor-UkvF3UAn.js} +1 -1
- package/dist/public/assets/{SessionsHost-DjbdveAp.js → SessionsHost-Pa6hY3sI.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-CFwua7VK.js → SettingsDialogBody-Be8P3Vqa.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-CyWPLWZG.js → ShareBranchSwitchDialog-BmGWQCY6.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-C-fxd4DJ.js → ShareReceiveDialog-BoqZXYhT.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-Y4PyuUCZ.js → ShareReceiveMissDialog-B_DT1dz2.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-Dbu0PwqP.js → SkillEditBanner-hcLaEQ2F.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-DuFc7cZs.js → SkillOriginInline-CtSdZ4_j.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-B4k3LXLX.js → SkillToolbarControls-DQYbvJTe.js} +1 -1
- package/dist/public/assets/{SourceEditor-BCMM4zJn.js → SourceEditor-DX9L1Mci.js} +1 -1
- package/dist/public/assets/{TerminalPanel-DkXL03UX.js → TerminalPanel-WTiFd3Z6.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-DH34WwKL.js → TerminalWindowApp-CnhrK_tv.js} +1 -1
- package/dist/public/assets/{TextDocEditor-DEdxUQxb.js → TextDocEditor-BGlQEeBq.js} +1 -1
- package/dist/public/assets/{ThreadView-ktubIY9d.js → ThreadView-CExveDEV.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-DSvFVt40.js → TimelineDiffPane-DDFvXSlv.js} +1 -1
- package/dist/public/assets/{agent-diff-store-BX4UT3y1.js → agent-diff-store-jazihC28.js} +1 -1
- package/dist/public/assets/{agent-visibility-CYBYXsoR.js → agent-visibility-Ch0XQMkJ.js} +1 -1
- package/dist/public/assets/{auth-state-cache-ZZgXmLCf.js → auth-state-cache-D47fide1.js} +2 -2
- package/dist/public/assets/{client-version-DN8Gnc8R.js → client-version-CHRlMl4l.js} +1 -1
- package/dist/public/assets/{config-context-CdjtvoAz.js → config-context-B2fceTMP.js} +1 -1
- package/dist/public/assets/{config-provider-CKct7q_G.js → config-provider-Cb43FIW2.js} +1 -1
- package/dist/public/assets/{dist-DIn3VYDc2.js → dist-5ovMzVKN2.js} +1 -1
- package/dist/public/assets/{doc-paths-KCjzuC60.js → doc-paths-BFNbv2er.js} +1 -1
- package/dist/public/assets/{documents-events-FrlFXuC-.js → documents-events-BM8xyAJz.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-BBMHbQG5.js → file-tree-adapter-C1zJK1Gk.js} +1 -1
- package/dist/public/assets/{file-tree-utils-DeyBapi2.js → file-tree-utils-Dma5c4k_.js} +1 -1
- package/dist/public/assets/{folder-config-api-OU19qNKs.js → folder-config-api-BxuLFuqM.js} +1 -1
- package/dist/public/assets/{globals-D4ycChQP.js → globals-DliH2YSL.js} +1 -1
- package/dist/public/assets/{index-Bnezs-Zg.js → index-DlH6tzhG.js} +108 -108
- package/dist/public/assets/{lint-config-client-D7DpNIwn.js → lint-config-client-DDxBMTZk.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-eFxHHf9q.js → markdownlint-rule-browser-c2Uv_5Ry.js} +1 -1
- package/dist/public/assets/{navigation-targets-BDSeZX3c.js → navigation-targets-D9VW9WdW.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-Wkw7QMir.js → open-managed-artifact-tab-CLwVAGCD.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-BN0afFCO.js → pending-receive-nav-store-BmcjNZOu.js} +1 -1
- package/dist/public/assets/{prop-types-MABP6X1c.js → prop-types-BPmLSxhG.js} +1 -1
- package/dist/public/assets/{receive-store-CTNYU3q-.js → receive-store-BlAqmJZT.js} +1 -1
- package/dist/public/assets/{selection-context-BgucOSM-.js → selection-context-DJvv-kK_.js} +1 -1
- package/dist/public/assets/{skill-actions-By3ZQhYp.js → skill-actions-CfQkZqK6.js} +1 -1
- package/dist/public/assets/{skill-scope-DkGQeaIH.js → skill-scope-DwJ84s_r.js} +1 -1
- package/dist/public/assets/{skills-api-BCiYKVSk.js → skills-api-BTy9LAk0.js} +1 -1
- package/dist/public/assets/{src-C_O1F_4l.js → src-hNXjwMT1.js} +1 -1
- package/dist/public/assets/{tag-pill-input-3Bkld5bN.js → tag-pill-input-DVdwNfBT.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-BZ8rve8n.js → target-navigation-intent-C6AhTsfc.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-DbpTBIvl.js → terminal-launch-events-B1DGOVIv.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-BMiT9GUh.js → terminal-telemetry-CviFLmIq.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-DDN6b6N7.js → typing-burst-detector-B4AQIJp7.js} +1 -1
- package/dist/public/assets/{uninstall-DJBDkbwq.js → uninstall-CfW-qETg.js} +1 -1
- package/dist/public/assets/{use-activity-panel-CInEut0L.js → use-activity-panel-D8pDT3xu.js} +1 -1
- package/dist/public/assets/{use-collab-url-ecWCytiv.js → use-collab-url-CUHlgRv5.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-Bf72FxVk.js → use-live-xterm-theme-CLCjRdjJ.js} +1 -1
- package/dist/public/assets/{use-open-skill-C3UqDa0B.js → use-open-skill-akwbVkG4.js} +1 -1
- package/dist/public/assets/{use-settings-route-CYvmk4XT.js → use-settings-route-BnOIfxuB.js} +1 -1
- package/dist/public/assets/{use-skill-directory-Ce1Wy5Qf.js → use-skill-directory-CSx9txvQ.js} +1 -1
- package/dist/public/assets/{use-skill-origin-DscI7Fo0.js → use-skill-origin-DvSOmIz_.js} +1 -1
- package/dist/public/assets/{use-skills-B19yYlmR.js → use-skills-DcLUuUJ9.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-D556BQSW.js → use-terminal-enabled-CgG0yd-l.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-C_2VFthE.js → use-timeline-entry-diff-DD-1OHsM.js} +1 -1
- package/dist/public/assets/{use-workspace-008C-zhL.js → use-workspace-J5QvjwOx.js} +1 -1
- package/dist/public/index.html +42 -42
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-BeUdZ-39.mjs → repair-launch-json-Csml14tc.mjs} +2 -2
- package/dist/{repair-mcp-configs-C8s9aOT7.mjs → repair-mcp-configs-C1e62GLZ.mjs} +2 -2
- package/dist/repair-skills-BwHyUVlU.mjs +1 -0
- package/dist/{repair-skills-CVvxGgPU.mjs → repair-skills-CvmGaGx7.mjs} +2 -2
- package/dist/schemas/v0/config.user.schema.json +10 -1
- package/dist/{server-lock-DgWnoftI.mjs → server-lock-CmYdHyX7.mjs} +2 -2
- package/dist/server-lock-D61z37T2.mjs +1 -0
- package/dist/{sleep-C5OfWWWx.mjs → sleep-jUpHbV7f.mjs} +2 -2
- package/dist/{src-pJ6LEXKc.mjs → src-CHSJwcpc.mjs} +2 -2
- package/dist/{src-DfBEsYnq.mjs → src-DaT-nAW_.mjs} +1 -1
- package/dist/{src-TjdCdQwN.mjs → src-DvOvMMTH.mjs} +428 -428
- package/dist/{src-DJJj_G31.mjs → src-hJ2UwH81.mjs} +2 -2
- package/dist/start-Bd2DGUlf.mjs +1 -0
- package/dist/{start-12r9bsmn.mjs → start-Cq99D9qF.mjs} +3 -3
- package/dist/{write-project-skill-BSzMH3X8.mjs → write-project-skill-BMSsRN12.mjs} +2 -2
- package/package.json +4 -4
- package/dist/constants-B8gZN6fz.mjs +0 -2
- package/dist/fs-traced-CbQ-GS7x.mjs +0 -1
- package/dist/git-handle-D0uAjBAd.mjs +0 -1
- package/dist/init-BNIRkFYJ.mjs +0 -1
- package/dist/loader-C6n9Xm0i.mjs +0 -1
- package/dist/md-manager-CrYbAiKl.mjs +0 -2
- package/dist/preview-A7_2Cf6I.mjs +0 -1
- package/dist/public/assets/FeedbackForm-FbNH_TYS.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-Ddk1e_f6.js +0 -1
- package/dist/repair-skills-CweOHJap.mjs +0 -1
- package/dist/server-lock-CiN5OJ-t.mjs +0 -1
- package/dist/start-CKnSpTvi.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{In as n,Nn as r,i,xn as a}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{In as n,Nn as r,i,xn as a}from"./DocumentContext-DD95gIt4.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./compiler-runtime-BfE3aGVn.js";import{a as u,c as d,s as f}from"./terminal-input-events-BGPQuYMh.js";import{t as p}from"./utils-CPqDy6Hr.js";import{t as m}from"./use-workspace-J5QvjwOx.js";import{c as h,i as g,l as _}from"./ChangedOutsideBadge-eT1ODdAD.js";import{t as v}from"./button-RQ5o7P7w.js";import{i as y,n as b,t as x}from"./tooltip-x7BNUa3s.js";import{a as S,c as C,i as w,n as T,o as E,s as D,t as O}from"./dialog-FGMqkFjm.js";import{a as k,m as A,r as j,t as M}from"./dropdown-menu-AlVJ7dJz.js";import{t as N}from"./label-G0lbYOgL.js";import{n as P,t as F}from"./radio-group-MAC3jHHk.js";import{t as I}from"./switch-BuVbhbtp.js";import{n as L,t as R}from"./toggle-group-Cnezoq-B.js";import{At as z,Dt as B,Eo as ee,Et as V,Fo as H,Ga as U,Lt as W,Ot as G,Tt as K,mt as q,qa as J,wo as te}from"./dist-5ovMzVKN2.js";import{t as ne}from"./createLucideIcon-DihYAFEK.js";import{f as re,n as ie,r as ae,t as oe}from"./EnableSyncConfirmDialog-C5fNw26t.js";import{s as se}from"./Mermaid-BePjlqwg.js";import{t as ce}from"./arrow-up-right-CxtRAecj.js";import{t as le}from"./check-BIbL8Vva.js";import{n as ue}from"./CopyButton-D6N3opvE.js";import{s as Y}from"./prop-types-BPmLSxhG.js";import{t as de}from"./download-DlaLrCD-.js";import{a as fe,r as pe,t as me}from"./folder-config-api-BxuLFuqM.js";import{t as he}from"./loader-circle-DJ1nzSAL.js";import{t as ge}from"./refresh-cw-CTfHLdRW.js";import{a as _e,i as ve,n as ye,o as be,r as xe,s as Se,t as Ce}from"./field-CmzMDU7U.js";import{t as we}from"./trash-2-WxyktwvM.js";import{t as Te}from"./triangle-alert-C2yId37R.js";import{t as Ee}from"./x-xV4a4mi6.js";import{n as De}from"./dist-uN7pEWl0.js";import{t as Oe}from"./input-Cm94Cun3.js";import{t as X}from"./dist-CzC3AWOn.js";import{f as ke,n as Ae,u as je}from"./doc-paths-BFNbv2er.js";import{t as Me}from"./parse-api-error-Dmlzsw8v.js";import{d as Ne,o as Pe,p as Fe}from"./documents-events-BM8xyAJz.js";import"./config-provider-Cb43FIW2.js";import{y as Ie}from"./skills-api-BTy9LAk0.js";import{n as Le}from"./config-context-B2fceTMP.js";import{t as Re}from"./external-link-Dvu-nzFi.js";import{t as ze}from"./textarea-Cl4IJ1LU.js";import{n as Be,t as Ve}from"./clipboard-adapter-Brbch5VX.js";var He=ne(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ue=ne(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),We=ne(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),Ge=ne(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),Ke=ne(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),qe=ne(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=l(),Q=e(o(),1);function Je(e){let t=(0,Z.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return Fe(()=>{o(Qe)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,Q.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(Xe).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:`Server returned an incomplete folder response.`});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,Q.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(Ye),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function Ye(e){return e+1}async function Xe(e){if(!e.ok){let t=await e.json().catch(Ze);throw Error(Me(t)??`HTTP ${e.status}`)}return e.json()}function Ze(){return null}function Qe(e){return e+1}function $e(){let e=(0,Z.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>Fe(()=>{a(nt)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,Q.useEffect)(o,s);let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/templates`).then(et).then(t=>{if(e)return;let n=W.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:`Server returned an incomplete templates response.`});return}r({status:`ready`,data:n.data.templates})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let l;return e[4]===i?l=e[5]:(l=[i],e[4]=i,e[5]=l),(0,Q.useEffect)(c,l),n}async function et(e){if(!e.ok){let t=await e.json().catch(tt);throw Error(Me(t)??`HTTP ${e.status}`)}return e.json()}function tt(){return null}function nt(e){return e+1}async function rt(){try{let e=await fetch(`/api/semantic-status`);return e.ok?await e.json():(console.debug(`[semantic-status] probe returned`,e.status),null)}catch(e){return console.debug(`[semantic-status] probe failed`,e),null}}function it(e){let t=(0,Z.c)(16),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n.enabled??!0,[i,a]=(0,Q.useState)(null),o;t[2]===r?o=t[3]:(o=function(){r&&rt().then(e=>{e&&a(e)})},t[2]=r,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=()=>{s()},t[4]=s,t[5]=c);let l;t[6]===r?l=t[7]:(l=[r],t[6]=r,t[7]=l),(0,Q.useEffect)(c,l);let u;t[8]!==r||t[9]!==s?(u=()=>{if(r)return Ne(e=>{e.includes(`files`)&&s()})},t[8]=r,t[9]=s,t[10]=u):u=t[10];let d;t[11]===r?d=t[12]:(d=[r],t[11]=r,t[12]=d),(0,Q.useEffect)(u,d);let f;return t[13]!==s||t[14]!==i?(f={status:i,refresh:s},t[13]=s,t[14]=i,t[15]=f):f=t[15],f}var $=t(),at=`github.com`,ot=new Map;async function st(e){try{let t=await e.json(),n=q.safeParse(t);if(n.success)return n.data.title}catch{}}async function ct(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function lt(e){let t=e?.host??at,n=await ct(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await st(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t,a=r.ghAvailable===!0;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0,ghAvailable:a}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0,ghAvailable:a}}function ut(e){let t=e?.host??at,n=ot.get(t);if(n)return n;let r=lt(e).finally(()=>{ot.delete(t)});return ot.set(t,r),r}function dt(e){let t=e.split(`
|
|
2
2
|
`);for(let e=t.length-1;e>=0;e--){let n=t[e]?.trim();if(n)try{let e=JSON.parse(n);if(e&&typeof e==`object`)return e}catch{}}return null}function ft(){return{status:ut,async repos(e){let t=e?.host??`github.com`,n=await ct(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:await st(n)??`Failed to fetch repositories`};let r=dt(await n.text());if(r&&r.type===`error`&&r.problem&&typeof r.problem==`object`){let e=r.problem;return{ok:!1,error:e.detail||e.title||`Failed to fetch repositories`}}if(!r||!Array.isArray(r.repos))return{ok:!1,error:`Failed to fetch repositories`};let i=[];for(let e of r.repos){let t=e;typeof t?.full_name==`string`&&typeof t.clone_url==`string`&&i.push({full_name:t.full_name,clone_url:t.clone_url,private:t.private===!0})}return{ok:!0,host:typeof r.host==`string`?r.host:t,repos:i}},async signout(e){let t=await ct(`/api/local-op/auth/signout`,e);return t.ok?{ok:!0}:{ok:!1,error:await st(t)}}}}function pt(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function mt(e,t){let n=e.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)return i+=r.decode(),!!(i.trim()&&t(i)===`terminal`);i+=r.decode(a,{stream:!0});let o=i.split(`
|
|
3
3
|
`);i=o.pop()??``;for(let e of o)if(e.trim()&&t(e)===`terminal`)return!0}}function ht(e){let t=[],n=[],r=new AbortController,i=!1,a=()=>{for(let e of n.splice(0))e(null)};return e(e=>{i||(n.length>0?n.shift()?.(e):t.push(e),(e.type===`complete`||e.type===`error`)&&(i=!0,r.abort(),a()))},r.signal),{events:{[Symbol.asyncIterator](){return{async next(){if(t.length>0){let e=t.shift();return e===void 0?{value:void 0,done:!0}:{value:e,done:!1}}return i?{value:void 0,done:!0}:new Promise(e=>{n.push(t=>{e(t===null?{value:void 0,done:!0}:{value:t,done:!1})})})}}}},cancel:()=>{i||(i=!0,r.abort(),a())}}}var gt=2e3,_t=1e4;function vt(e,t){return new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n()},e);function i(){clearTimeout(r),n()}t.addEventListener(`abort`,i,{once:!0})})}function yt(e){fetch(`/api/local-op/auth/cancel`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({channel:e})}).catch(e=>{console.warn(`[auth-transport] Cancel request failed (best-effort):`,e instanceof Error?e.message:e)})}async function bt(e,t,n,r){let i=ft(),a=gt;for(;!t.aborted&&Date.now()<n;){try{let n=await i.status(r?{host:r}:void 0);if(t.aborted)return;if(n.authenticated){e({type:`complete`,host:n.host,login:n.login,name:n.name,email:n.email});return}}catch(e){console.warn(`[auth-transport] Recovery probe failed:`,e instanceof Error?e.message:e)}await vt(a,t),a=Math.min(a*1.5,_t)}t.aborted||e({type:`error`,message:X._({id:`ve8vEM`})})}function xt(e,t,n){let r=!1,i=ht((n,i)=>{let a=e=>{(e.type===`complete`||e.type===`error`)&&(r=!0),n(e)};(async()=>{let n=null;try{let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:i});if(!r.ok){let e=X._({id:`LnVIW4`});try{let t=q.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}a({type:`error`,message:e});return}if(!r.body){a({type:`error`,message:X._({id:`LnVIW4`})});return}if(await mt(r.body,e=>{let t;try{t=JSON.parse(e)}catch{return console.warn(`[auth-transport] Dropped unparseable NDJSON line:`,e.slice(0,100)),`continue`}if(t&&typeof t==`object`&&t.type===`error`&&`problem`in t){let e=t.problem;return a({type:`error`,message:e?.detail||e?.title||X._({id:`29VNqC`})}),`terminal`}if(t.type===`ping`)return`continue`;let r=t;return r.type===`verification`&&(n=Date.now()+r.expires_in*1e3),a(r),r.type===`complete`||r.type===`error`?`terminal`:`continue`})||i.aborted)return;if(n===null){a({type:`error`,message:X._({id:`DskIkK`})});return}await bt(a,i,n,t.host)}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;if(n!==null){await bt(a,i,n,t.host);return}a({type:`error`,message:X._({id:`Q5fqMz`})})}})()});return{events:i.events,cancel:()=>{r||yt(n),i.cancel()}}}function St(){return{start(){return xt(`/api/local-op/auth/login`,{json:!0},`login`)},ghLogin(e){return xt(`/api/local-op/auth/gh-login`,{host:e,json:!0},`gh-login`)},async pat(e,t){try{let n=await fetch(`/api/local-op/auth/pat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({host:e,token:t})});if(n.ok){let e=await n.json();return{ok:!0,login:typeof e.login==`string`?e.login:``}}let r=X._({id:`sNeKjP`});try{let e=q.safeParse(await n.json());e.success&&(r=e.data.detail||e.data.title)}catch{}return{ok:!1,error:r}}catch{return{ok:!1,error:X._({id:`Q5fqMz`})}}}}}function Ct(e){return{start(){return e.localOp.auth.start()}}}async function wt(e){try{await navigator.clipboard.writeText(e)}catch{}}function Tt(e){let t=(0,Z.c)(25),{onSuccess:n,startFlow:r}=e,{_:i}=c(),[a,o]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(`https://github.com/login/device`),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,y]=(0,Q.useState)(0),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S;t[0]!==i||t[1]!==n||t[2]!==r?(S=async function(){m(null);try{let e=r();b.current=e.cancel;let t=e.events[Symbol.asyncIterator](),a=!1,s=await t.next();for(;!s.done;){let e=s.value;if(e.type===`verification`)o(e.user_code),u(e.verification_uri),g(Date.now()+e.expires_in*1e3),y(e.expires_in*1e3),wt(e.user_code).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)});else if(e.type===`complete`){a=!0,n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){a=!0,m(e.message);break}s=await t.next()}a||m(i({id:`DskIkK`}))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&m(i({id:`Q5fqMz`}))}},t[0]=i,t[1]=n,t[2]=r,t[3]=S):S=t[3];let C=S,w;t[4]===C?w=t[5]:(w=()=>{let e=!1;return queueMicrotask(()=>{e||C()}),()=>{e=!0,b.current?.(),b.current=null,x.current&&clearInterval(x.current)}},t[4]=C,t[5]=w);let T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[6]=T):T=t[6],(0,Q.useEffect)(w,T);let E,D;t[7]!==i||t[8]!==h?(E=()=>{if(h!==null)return x.current=setInterval(()=>{let e=h-Date.now();e<=0?(y(0),x.current&&clearInterval(x.current),m(i({id:`ve8vEM`}))):y(e)},1e3),()=>{x.current&&clearInterval(x.current)}},D=[h,i],t[7]=i,t[8]=h,t[9]=E,t[10]=D):(E=t[9],D=t[10]),(0,Q.useEffect)(E,D);let O=Math.floor(_/6e4),k=Math.floor(_%6e4/1e3),A;t[11]===k?A=t[12]:(A=k.toString().padStart(2,`0`),t[11]=k,t[12]=A);let j=`${O}:${A}`,M;t[13]!==i||t[14]!==d||t[15]!==p||t[16]!==j||t[17]!==a||t[18]!==l?(M=a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`eVPynQ`,values:{verificationUri:l},components:{0:(0,$.jsx)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Re(e,l),onAuxClick:e=>Re(e,l),className:`inline-flex items-center gap-0.5 text-foreground hover:text-primary hover:underline`}),1:(0,$.jsx)(`span`,{}),2:(0,$.jsx)(ce,{className:`inline size-3.5`,"aria-hidden":!0})}})}),(0,$.jsxs)(v,{type:`button`,variant:`outline`,"aria-label":i({id:`nCzR-G`,values:{userCode:a}}),onClick:()=>void wt(a).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)}),className:`relative h-auto w-full justify-center rounded-md bg-muted px-12 py-3 hover:bg-muted/80`,children:[(0,$.jsx)(`code`,{className:`font-mono text-2xl font-bold tracking-widest`,children:a}),(0,$.jsx)(`span`,{className:`absolute right-3 text-muted-foreground`,"aria-hidden":`true`,children:d?(0,$.jsx)(le,{className:`size-4`}):(0,$.jsx)(ue,{className:`size-4`})})]}),(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:d?(0,$.jsx)(s,{id:`80c4-P`}):null}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),(0,$.jsx)(s,{id:`5y_9lO`})]}),(0,$.jsx)(`span`,{children:(0,$.jsx)(s,{id:`gYz2ep`,values:{timeLabel:j}})})]})]}):(0,$.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:p?null:(0,$.jsx)(s,{id:`aWlJai`})}),t[13]=i,t[14]=d,t[15]=p,t[16]=j,t[17]=a,t[18]=l,t[19]=M):M=t[19];let N;t[20]===p?N=t[21]:(N=p&&(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,children:p}),t[20]=p,t[21]=N);let P;return t[22]!==M||t[23]!==N?(P=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[M,N]}),t[22]=M,t[23]=N,t[24]=P):P=t[24],P}function Et(e){let t=(0,Z.c)(30),{login:n,name:r,onNameChange:i,email:a,onEmailChange:o}=e,{_:l}=c(),u;t[0]===n?u=t[1]:(u=(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:(0,$.jsx)(s,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=u);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`gp3I7-`})}),t[2]=d):d=t[2];let f;t[3]===l?f=t[4]:(f=l({id:`6YtxFj`}),t[3]=l,t[4]=f);let p;t[5]!==l||t[6]!==n?(p=l({id:`J2Mv98`,values:{login:n}}),t[5]=l,t[6]=n,t[7]=p):p=t[7];let m;t[8]===i?m=t[9]:(m=e=>i(e.target.value),t[8]=i,t[9]=m);let h;t[10]!==r||t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,$.jsx)(Oe,{"aria-label":f,placeholder:p,value:r,onChange:m}),t[10]=r,t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===l?g=t[16]:(g=l({id:`O3oNi5`}),t[15]=l,t[16]=g);let _;t[17]===l?_=t[18]:(_=l({id:`O3oNi5`}),t[17]=l,t[18]=_);let v;t[19]===o?v=t[20]:(v=e=>o(e.target.value),t[19]=o,t[20]=v);let y;t[21]!==a||t[22]!==g||t[23]!==_||t[24]!==v?(y=(0,$.jsx)(Oe,{type:`email`,"aria-label":g,placeholder:_,value:a,onChange:v}),t[21]=a,t[22]=g,t[23]=_,t[24]=v,t[25]=y):y=t[25];let b;return t[26]!==u||t[27]!==y||t[28]!==h?(b=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u,d,h,y]}),t[26]=u,t[27]=y,t[28]=h,t[29]=b):b=t[29],b}function Dt(e){let t=(0,Z.c)(37),{host:n,token:r,onTokenChange:i,error:a,onSubmit:o,showGhOption:l,onGhSignIn:u}=e,{_:d}=c(),f=`https://${n}/settings/tokens/new?scopes=repo,read:user&description=OpenKnowledge`,p;t[0]!==n||t[1]!==u||t[2]!==l?(p=l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(v,{type:`button`,onClick:u,children:(0,$.jsx)(s,{id:`_SDGzH`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,$.jsx)(s,{id:`8L0EPw`}),(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`})]})]}):(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`8k6INX`,values:{host:n},components:{0:(0,$.jsx)(`span`,{className:`font-medium text-foreground`})}})}),t[0]=n,t[1]=u,t[2]=l,t[3]=p):p=t[3];let m,h;t[4]===f?(m=t[5],h=t[6]):(m=e=>Re(e,f),h=e=>Re(e,f),t[4]=f,t[5]=m,t[6]=h);let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(s,{id:`6hYjww`,values:{host:n}}),t[7]=n,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(ce,{className:`inline size-3.5`,"aria-hidden":!0}),t[9]=_):_=t[9];let y;t[10]!==f||t[11]!==m||t[12]!==h||t[13]!==g?(y=(0,$.jsxs)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,onClick:m,onAuxClick:h,className:`inline-flex w-fit items-center gap-0.5 text-sm text-foreground hover:text-primary hover:underline`,children:[g,_]}),t[10]=f,t[11]=m,t[12]=h,t[13]=g,t[14]=y):y=t[14];let b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(s,{id:`Xg-Ntj`})}),t[15]=b):b=t[15];let x;t[16]===d?x=t[17]:(x=d({id:`p2LEhJ`}),t[16]=d,t[17]=x);let S;t[18]===i?S=t[19]:(S=e=>i(e.target.value),t[18]=i,t[19]=S);let C;t[20]===o?C=t[21]:(C=e=>{e.key===`Enter`&&o()},t[20]=o,t[21]=C);let w;t[22]!==C||t[23]!==x||t[24]!==S||t[25]!==r?(w=(0,$.jsx)(Oe,{type:`password`,"aria-label":x,placeholder:`ghp_`,value:r,onChange:S,onKeyDown:C}),t[22]=C,t[23]=x,t[24]=S,t[25]=r,t[26]=w):w=t[26];let T;t[27]===a?T=t[28]:(T=a&&(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,children:a}),t[27]=a,t[28]=T);let E;t[29]===l?E=t[30]:(E=!l&&(0,$.jsxs)(`div`,{className:`mt-1 rounded-md border border-border/60 bg-muted/40 p-3 text-sm text-muted-foreground`,children:[(0,$.jsx)(`p`,{children:(0,$.jsx)(s,{id:`qX-ABr`})}),(0,$.jsxs)(`ol`,{className:`mt-1.5 list-decimal space-y-0.5 pl-5`,children:[(0,$.jsx)(`li`,{children:(0,$.jsx)(s,{id:`jxtXZI`})}),(0,$.jsx)(`li`,{children:(0,$.jsx)(s,{id:`9Vh9Jf`})})]})]}),t[29]=l,t[30]=E);let D;return t[31]!==p||t[32]!==w||t[33]!==T||t[34]!==E||t[35]!==y?(D=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[p,y,b,w,T,E]}),t[31]=p,t[32]=w,t[33]=T,t[34]=E,t[35]=y,t[36]=D):D=t[36],D}var Ot=1e4;function kt(e){let t=(0,Z.c)(92),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:l,queryTransport:u,host:d,ghAvailable:f}=e,{_:p}=c(),m;t[0]===l?m=t[1]:(m=l??St(),t[0]=l,t[1]=m);let h=m,g;t[2]===u?g=t[3]:(g=u??ft(),t[2]=u,t[3]=g);let _=g,[y,b]=(0,Q.useState)(`auth`),[x,S]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(``),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(void 0),[ee,V]=(0,Q.useState)(void 0),H=d??z,U=!!H&&H!==`github.com`&&!!(f??ee)&&typeof h.ghLogin==`function`,W=!a&&d===void 0,G,K;t[4]!==d||t[5]!==a||t[6]!==W||t[7]!==n?(G=()=>{n&&(S(null),A(``),M(``),P(``),I(null),R(!1),B(void 0),V(void 0),b(a||W?`checking`:d&&d!==`github.com`?`pat`:`auth`))},K=[n,a,d,W],t[4]=d,t[5]=a,t[6]=W,t[7]=n,t[8]=G,t[9]=K):(G=t[8],K=t[9]),(0,Q.useLayoutEffect)(G,K);let q;t[10]!==a||t[11]!==n||t[12]!==_?(q=()=>{if(!n||!a)return;let e=!1,t=t=>{e||(e=!0,b(t))},r=setTimeout(()=>t(`auth`),Ot);return _.status().then(n=>{e||(n.authenticated?(S({login:n.login,name:n.name,email:n.email}),A(n.name??``),M(n.email??``),t(`identity`)):t(`auth`))}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[10]=a,t[11]=n,t[12]=_,t[13]=q):q=t[13];let J;t[14]!==a||t[15]!==n?(J=[n,a],t[14]=a,t[15]=n,t[16]=J):J=t[16],(0,Q.useEffect)(q,J);let te;t[17]!==W||t[18]!==n||t[19]!==_?(te=()=>{if(!n||!W)return;let e=!1,t=t=>{e||(e=!0,b(t))},r=setTimeout(()=>t(`auth`),Ot);return _.status().then(n=>{if(e)return;let r=!!n.host&&n.host!==`github.com`;B(n.host),V(n.ghAvailable),t(r?`pat`:`auth`)}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[17]=W,t[18]=n,t[19]=_,t[20]=te):te=t[20];let ne;t[21]!==W||t[22]!==n?(ne=[n,W],t[21]=W,t[22]=n,t[23]=ne):ne=t[23],(0,Q.useEffect)(te,ne);let re;t[24]!==p||t[25]!==a||t[26]!==r||t[27]!==i?(re=function(e){if(S(e),a)A(e.name??``),M(e.email??``),b(`identity`);else{b(`done`),i?.(e),r(!1);let t=e.login;De.success(p(t?{id:`E_tNGD`,values:{login:t}}:{id:`cgl-gn`}))}},t[24]=p,t[25]=a,t[26]=r,t[27]=i,t[28]=re):re=t[28];let ie=re,ae;t[29]!==p||t[30]!==H||t[31]!==ie||t[32]!==L||t[33]!==N||t[34]!==h?(ae=async function(){let e=N.trim();if(!e||!H||L)return;if(!h.pat){I(p({id:`iMYFJM`}));return}R(!0),I(null);let t=await h.pat(H,e);R(!1),t.ok?ie({login:t.login??``}):I(t.error??p({id:`sNeKjP`}))},t[29]=p,t[30]=H,t[31]=ie,t[32]=L,t[33]=N,t[34]=h,t[35]=ae):ae=t[35];let oe=ae,se;t[36]!==p||t[37]!==x||t[38]!==r||t[39]!==i?(se=function(e,t){fetch(`/api/local-op/auth/set-identity`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,email:t})}).catch(At);let n={...x??{login:``},name:e,email:t};b(`done`),i?.(n),r(!1);let a=n.login;De.success(p(a?{id:`E_tNGD`,values:{login:a}}:{id:`cgl-gn`}))},t[36]=p,t[37]=x,t[38]=r,t[39]=i,t[40]=se):se=t[40];let ce=se,le;t[41]!==p||t[42]!==x||t[43]!==r||t[44]!==i?(le=function(){if(!x)return;b(`done`),i?.(x),r(!1);let e=x.login;De.success(p(e?{id:`E_tNGD`,values:{login:e}}:{id:`cgl-gn`}))},t[41]=p,t[42]=x,t[43]=r,t[44]=i,t[45]=le):le=t[45];let ue=le,Y;t[46]===r?Y=t[47]:(Y=function(){r(!1)},t[46]=r,t[47]=Y);let de=Y,fe;t[48]!==a||t[49]!==o||t[50]!==y?(fe=(0,$.jsx)(D,{children:(0,$.jsx)(C,{children:o&&(y===`pat`||y===`gh-device`)?(0,$.jsx)(s,{id:`DUWgfT`}):o?(0,$.jsx)(s,{id:`X8kjQX`}):y===`pat`||y===`gh-device`?(0,$.jsx)(s,{id:`tzZ6ha`}):a&&y!==`auth`?(0,$.jsx)(s,{id:`29XZXN`}):(0,$.jsx)(s,{id:`3jod3l`})})}),t[48]=a,t[49]=o,t[50]=y,t[51]=fe):fe=t[51];let pe;t[52]===y?pe=t[53]:(pe=y===`checking`&&(0,$.jsx)(T,{children:(0,$.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`gBbxn_`})})}),t[52]=y,t[53]=pe);let me;t[54]!==ie||t[55]!==de||t[56]!==h||t[57]!==y?(me=y===`auth`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{children:(0,$.jsx)(Tt,{onSuccess:ie,startFlow:()=>h.start()})}),(0,$.jsx)(E,{children:(0,$.jsx)(v,{variant:`outline`,className:`font-mono uppercase`,onClick:de,children:(0,$.jsx)(s,{id:`dEgA5A`})})})]}),t[54]=ie,t[55]=de,t[56]=h,t[57]=y,t[58]=me):me=t[58];let he;t[59]!==U||t[60]!==H||t[61]!==de||t[62]!==oe||t[63]!==F||t[64]!==L||t[65]!==N||t[66]!==y?(he=y===`pat`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{children:(0,$.jsx)(Dt,{host:H??``,token:N,onTokenChange:P,error:F,onSubmit:oe,showGhOption:U,onGhSignIn:()=>b(`gh-device`)})}),(0,$.jsxs)(E,{children:[(0,$.jsx)(v,{variant:`outline`,className:`font-mono uppercase`,onClick:de,children:(0,$.jsx)(s,{id:`dEgA5A`})}),(0,$.jsx)(v,{onClick:oe,disabled:!N.trim()||L,children:L?(0,$.jsx)(s,{id:`9zb2WA`}):(0,$.jsx)(s,{id:`iSLIjg`})})]})]}),t[59]=U,t[60]=H,t[61]=de,t[62]=oe,t[63]=F,t[64]=L,t[65]=N,t[66]=y,t[67]=he):he=t[67];let ge;t[68]!==H||t[69]!==ie||t[70]!==de||t[71]!==h||t[72]!==y?(ge=y===`gh-device`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{children:(0,$.jsx)(Tt,{onSuccess:ie,startFlow:()=>h.ghLogin?.(H??``)??h.start()})}),(0,$.jsxs)(E,{children:[(0,$.jsx)(v,{variant:`ghost`,onClick:()=>b(`pat`),children:(0,$.jsx)(s,{id:`hLKfZe`})}),(0,$.jsx)(v,{variant:`outline`,className:`font-mono uppercase`,onClick:de,children:(0,$.jsx)(s,{id:`dEgA5A`})})]})]}),t[68]=H,t[69]=ie,t[70]=de,t[71]=h,t[72]=y,t[73]=ge):ge=t[73];let _e;t[74]!==x||t[75]!==ce||t[76]!==ue||t[77]!==j||t[78]!==k||t[79]!==y?(_e=y===`identity`&&x&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{children:(0,$.jsx)(Et,{login:x.login,name:k,onNameChange:A,email:j,onEmailChange:M})}),(0,$.jsxs)(E,{children:[(0,$.jsx)(v,{variant:`ghost`,onClick:ue,children:(0,$.jsx)(s,{id:`6Uau97`})}),(0,$.jsx)(v,{onClick:()=>ce(k.trim(),j.trim()),disabled:!k.trim()||!j.trim(),children:(0,$.jsx)(s,{id:`tfDRzk`})})]})]}),t[74]=x,t[75]=ce,t[76]=ue,t[77]=j,t[78]=k,t[79]=y,t[80]=_e):_e=t[80];let ve;t[81]!==fe||t[82]!==pe||t[83]!==me||t[84]!==he||t[85]!==ge||t[86]!==_e?(ve=(0,$.jsxs)(w,{className:`sm:max-w-md`,children:[fe,pe,me,he,ge,_e]}),t[81]=fe,t[82]=pe,t[83]=me,t[84]=he,t[85]=ge,t[86]=_e,t[87]=ve):ve=t[87];let ye;return t[88]!==r||t[89]!==n||t[90]!==ve?(ye=(0,$.jsx)(O,{open:n,onOpenChange:r,children:ve}),t[88]=r,t[89]=n,t[90]=ve,t[91]=ye):ye=t[91],ye}function At(){}function jt(e){let t=(0,Z.c)(16),{value:n,onChange:r,disabled:i,placeholder:a,rows:o}=e,c=i===void 0?!1:i,l=o===void 0?12:o,u=(0,Q.useId)(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(s,{id:`3o3tur`}),t[0]=d):d=t[0];let f;t[1]===u?f=t[2]:(f=(0,$.jsx)(be,{htmlFor:u,children:d}),t[1]=u,t[2]=f);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(xe,{children:(0,$.jsx)(s,{id:`5gr_ev`,values:{dateToken:`{{date}}`,userToken:`{{user}}`},components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}),t[3]=p):p=t[3];let m;t[4]===r?m=t[5]:(m=e=>r(e.target.value),t[4]=r,t[5]=m);let h;t[6]!==c||t[7]!==u||t[8]!==a||t[9]!==l||t[10]!==m||t[11]!==n?(h=(0,$.jsx)(ze,{id:u,value:n,onChange:m,disabled:c,rows:l,spellCheck:!1,placeholder:a,className:`font-mono text-xs leading-relaxed min-h-72`}),t[6]=c,t[7]=u,t[8]=a,t[9]=l,t[10]=m,t[11]=n,t[12]=h):h=t[12];let g;return t[13]!==f||t[14]!==h?(g=(0,$.jsxs)(Ce,{children:[f,p,h]}),t[13]=f,t[14]=h,t[15]=g):g=t[15],g}var Mt=/^[A-Za-z0-9_-]+$/;function Nt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function Pt(e){let t={},n=e.title.trim();n&&(t.title=n);let r=e.description.trim();return r&&(t.description=r),t}var Ft=0;function It(){return Ft+=1,`prop-${Ft}`}function Lt(e){let{frontmatter:t,body:n}=U(e);if(t===``)return{type:``,properties:[],markdown:e};let r=[];for(let e of J(t).split(`
|
|
4
4
|
`)){if(e.trim()===``)continue;let t=e.indexOf(`:`);if((/^\s/.test(e)||t===-1)&&r.length>0){let t=r[r.length-1];t&&(t.value+=`\n${e}`);continue}t!==-1&&r.push({key:e.slice(0,t).trim(),value:e.slice(t+1).replace(/^ /,``)})}let i=``,a=[];for(let e of r){if(e.key===`type`&&i===``){i=e.value.trim();continue}a.push({id:It(),key:e.key,value:e.value})}return{type:i,properties:a,markdown:n}}function Rt(e){let t=[],n=e.type.trim();n&&t.push(`type: ${n}`);for(let n of e.properties){let e=n.key.trim();e===``||e===`type`||t.push(n.value===``?`${e}:`:`${e}: ${n.value}`)}if(t.length===0)return e.markdown.replace(/^\n+/,``);let r=e.markdown.startsWith(`
|
|
@@ -6,6 +6,6 @@ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js"
|
|
|
6
6
|
`)}\n---\n${r}`}function zt(e){let t=(0,Z.c)(54),{mode:n,folderPath:r,scope:i,initial:a,existingNames:o,onCommitted:s}=e,c=i===void 0?`local`:i,[l,u]=(0,Q.useState)(a.title),[d,f]=(0,Q.useState)(a.name),[p,m]=(0,Q.useState)(a.description),h;t[0]===a.body?h=t[1]:(h=()=>Lt(a.body),t[0]=a.body,t[1]=h);let g=(0,Q.useState)(h)[0],[_,v]=(0,Q.useState)(g.type),[y,b]=(0,Q.useState)(g.properties),[x,S]=(0,Q.useState)(g.markdown),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(!1),k;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(e,t){b(n=>n.map(n=>n.id===e?{...n,...t}:n))},t[2]=k):k=t[2];let A=k,j;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){b(Bt)},t[3]=j):j=t[3];let M=j,N;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e){b(t=>t.filter(t=>t.id!==e))},t[4]=N):N=t[4];let P=N,F;t[5]!==n||t[6]!==T?(F=function(e){u(e),n===`create`&&!T&&f(Nt(e))},t[5]=n,t[6]=T,t[7]=F):F=t[7];let I=F,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(L=function(e){f(e),E(!0)},t[8]=L):L=t[8];let R=L,z=n===`edit`&&c===`local`,B=n===`create`||z,ee;t[9]===l?ee=t[10]:(ee=l.trim(),t[9]=l,t[10]=ee);let V=ee,H,U,W,G;t[11]!==o||t[12]!==n||t[13]!==d||t[14]!==B||t[15]!==V?(G=d.trim(),W=V===``,H=B&&(G===``||!Mt.test(G)),U=n===`create`&&!H&&(o?.has(G)??!1),t[11]=o,t[12]=n,t[13]=d,t[14]=B,t[15]=V,t[16]=H,t[17]=U,t[18]=W,t[19]=G):(H=t[16],U=t[17],W=t[18],G=t[19]);let K=U,q=!C&&!W&&!H,J;t[20]!==x||t[21]!==z||t[22]!==q||t[23]!==p||t[24]!==r||t[25]!==a.name||t[26]!==n||t[27]!==s||t[28]!==y||t[29]!==l||t[30]!==G||t[31]!==V||t[32]!==_?(J=async function(){if(!q){O(!0);return}w(!0);let e=Pt({title:l,description:p}),t=Rt({type:_,properties:y,markdown:x}),i=z&&G!==a.name,o=i?await pe({fromFolder:r,fromName:a.name,toFolder:r,toName:G,frontmatter:e,body:t}):await fe({folder:r,name:n===`create`?G:a.name,frontmatter:e,body:t});if(w(!1),!o.ok){let{error:e}=o;De.error(n===`create`?X._({id:`jdGUeI`,values:{error:e}}):X._({id:`rQAQus`,values:{error:e}}));return}i?De.success(X._({id:`YKLP_-`})):`warnings`in o&&o.warnings.length>0?De.warning(o.warnings.join(` `)):n===`create`?De.success(X._({id:`06SZfb`,values:{trimmedTitle:V}})):De.success(X._({id:`GamjcN`})),s(n===`create`||i?G:a.name)},t[20]=x,t[21]=z,t[22]=q,t[23]=p,t[24]=r,t[25]=a.name,t[26]=n,t[27]=s,t[28]=y,t[29]=l,t[30]=G,t[31]=V,t[32]=_,t[33]=J):J=t[33];let te=J,ne;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ne=()=>O(!0),t[34]=ne):ne=t[34];let re;return t[35]!==x||t[36]!==z||t[37]!==q||t[38]!==p||t[39]!==a.name||t[40]!==n||t[41]!==y||t[42]!==C||t[43]!==I||t[44]!==d||t[45]!==H||t[46]!==K||t[47]!==te||t[48]!==l||t[49]!==W||t[50]!==D||t[51]!==G||t[52]!==_?(re={mode:n,title:l,slug:d,description:p,type:_,properties:y,body:x,setTitle:I,setSlug:R,setDescription:m,setType:v,setProperty:A,addProperty:M,removeProperty:P,setBody:S,markTitleTouched:ne,titleTouched:D,isSaving:C,canSubmit:q,titleInvalid:W,slugInvalid:H,slugShadows:K,trimmedSlug:G,fixedName:a.name,canRename:z,submit:te},t[35]=x,t[36]=z,t[37]=q,t[38]=p,t[39]=a.name,t[40]=n,t[41]=y,t[42]=C,t[43]=I,t[44]=d,t[45]=H,t[46]=K,t[47]=te,t[48]=l,t[49]=W,t[50]=D,t[51]=G,t[52]=_,t[53]=re):re=t[53],re}function Bt(e){return[...e,{id:It(),key:``,value:``}]}function Vt(e){let t=(0,Z.c)(72),{form:n,bodyPlaceholder:r}=e,{_:i}=c(),a=(0,Q.useId)(),o=(0,Q.useId)(),l=(0,Q.useId)(),u=n.titleTouched&&n.titleInvalid,{fixedName:d}=n,f,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(s,{id:`MHrjPM`}),p=(0,$.jsx)(`span`,{className:`text-destructive`,children:`*`}),t[0]=f,t[1]=p):(f=t[0],p=t[1]);let m;t[2]===a?m=t[3]:(m=(0,$.jsxs)(be,{htmlFor:a,children:[f,p]}),t[2]=a,t[3]=m);let h=n.title,g;t[4]===n?g=t[5]:(g=e=>n.setTitle(e.target.value),t[4]=n,t[5]=g);let _=n.markTitleTouched,v;t[6]===i?v=t[7]:(v=i({id:`KWL_Ih`}),t[6]=i,t[7]=v);let y;t[8]!==n.isSaving||t[9]!==n.markTitleTouched||t[10]!==n.title||t[11]!==a||t[12]!==u||t[13]!==g||t[14]!==v?(y=(0,$.jsx)(Oe,{id:a,"data-testid":`template-name-input`,value:h,onChange:g,onBlur:_,placeholder:v,disabled:n.isSaving,"aria-invalid":u}),t[8]=n.isSaving,t[9]=n.markTitleTouched,t[10]=n.title,t[11]=a,t[12]=u,t[13]=g,t[14]=v,t[15]=y):y=t[15];let b;t[16]===u?b=t[17]:(b=u?(0,$.jsx)(ve,{children:(0,$.jsx)(s,{id:`V_wltx`})}):null,t[16]=u,t[17]=b);let x;t[18]!==m||t[19]!==y||t[20]!==b?(x=(0,$.jsxs)(Ce,{children:[m,y,b]}),t[18]=m,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]!==d||t[23]!==n?(S=n.mode===`create`?(0,$.jsx)(Ut,{form:n}):n.canRename?(0,$.jsx)(Wt,{form:n}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(s,{id:`NjrIak`,values:{fixedName:d},components:{0:(0,$.jsx)(`code`,{className:`font-mono`})}})}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(s,{id:`jSO1X5`})})]}),t[22]=d,t[23]=n,t[24]=S):S=t[24];let C;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(s,{id:`Nu4oKW`}),t[25]=C):C=t[25];let w;t[26]===o?w=t[27]:(w=(0,$.jsx)(be,{htmlFor:o,children:C}),t[26]=o,t[27]=w);let T=n.description,E;t[28]===n?E=t[29]:(E=e=>n.setDescription(e.target.value),t[28]=n,t[29]=E);let D;t[30]===i?D=t[31]:(D=i({id:`3FMvls`}),t[30]=i,t[31]=D);let O;t[32]!==o||t[33]!==n.description||t[34]!==n.isSaving||t[35]!==E||t[36]!==D?(O=(0,$.jsx)(ze,{id:o,value:T,onChange:E,placeholder:D,disabled:n.isSaving,rows:2}),t[32]=o,t[33]=n.description,t[34]=n.isSaving,t[35]=E,t[36]=D,t[37]=O):O=t[37];let k;t[38]!==w||t[39]!==O?(k=(0,$.jsxs)(Ce,{children:[w,O]}),t[38]=w,t[39]=O,t[40]=k):k=t[40];let A;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(s,{id:`-zy2Nq`}),t[41]=A):A=t[41];let j;t[42]===l?j=t[43]:(j=(0,$.jsx)(be,{htmlFor:l,children:A}),t[42]=l,t[43]=j);let M=n.type,N;t[44]===n?N=t[45]:(N=e=>n.setType(e.target.value),t[44]=n,t[45]=N);let P;t[46]===i?P=t[47]:(P=i({id:`o9CrsQ`}),t[46]=i,t[47]=P);let F;t[48]!==n.isSaving||t[49]!==n.type||t[50]!==N||t[51]!==P||t[52]!==l?(F=(0,$.jsx)(Oe,{id:l,value:M,onChange:N,placeholder:P,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`font-mono`}),t[48]=n.isSaving,t[49]=n.type,t[50]=N,t[51]=P,t[52]=l,t[53]=F):F=t[53];let I;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(xe,{children:(0,$.jsx)(s,{id:`ipn17C`,components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}),t[54]=I):I=t[54];let L;t[55]!==j||t[56]!==F?(L=(0,$.jsxs)(Ce,{children:[j,F,I]}),t[55]=j,t[56]=F,t[57]=L):L=t[57];let R;t[58]===n?R=t[59]:(R=(0,$.jsx)(Ht,{form:n}),t[58]=n,t[59]=R);let z;t[60]!==r||t[61]!==n.body||t[62]!==n.isSaving||t[63]!==n.setBody?(z=(0,$.jsx)(jt,{value:n.body,onChange:n.setBody,disabled:n.isSaving,placeholder:r}),t[60]=r,t[61]=n.body,t[62]=n.isSaving,t[63]=n.setBody,t[64]=z):z=t[64];let B;return t[65]!==x||t[66]!==S||t[67]!==k||t[68]!==L||t[69]!==R||t[70]!==z?(B=(0,$.jsxs)(_e,{children:[x,S,k,L,R,z]}),t[65]=x,t[66]=S,t[67]=k,t[68]=L,t[69]=R,t[70]=z,t[71]=B):B=t[71],B}function Ht(e){let t=(0,Z.c)(12),{form:n}=e,{_:r}=c(),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(be,{children:(0,$.jsx)(s,{id:`-WFFG2`})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(xe,{children:(0,$.jsx)(s,{id:`zrP8HX`,components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}),t[1]=a):a=t[1];let o;t[2]!==r||t[3]!==n?(o=n.properties.length>0?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.properties.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Oe,{"aria-label":r({id:`56xUL1`}),value:e.key,onChange:t=>n.setProperty(e.id,{key:t.target.value}),placeholder:r({id:`Aq-O0x`}),disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`font-mono w-1/3`}),(0,$.jsx)(Oe,{"aria-label":r({id:`iKZkk1`}),value:e.value,onChange:t=>n.setProperty(e.id,{value:t.target.value}),placeholder:r({id:`jEZ6Lf`}),disabled:n.isSaving,spellCheck:!1,className:`font-mono flex-1`}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":r({id:`rNifQd`}),onClick:()=>n.removeProperty(e.id),disabled:n.isSaving,children:(0,$.jsx)(Ee,{"aria-hidden":`true`})})]},e.id))}):null,t[2]=r,t[3]=n,t[4]=o):o=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(s,{id:`F-NRCj`}),t[5]=l):l=t[5];let u;t[6]!==n.addProperty||t[7]!==n.isSaving?(u=(0,$.jsx)(v,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,onClick:n.addProperty,disabled:n.isSaving,children:l}),t[6]=n.addProperty,t[7]=n.isSaving,t[8]=u):u=t[8];let d;return t[9]!==o||t[10]!==u?(d=(0,$.jsxs)(Ce,{children:[i,a,o,u]}),t[9]=o,t[10]=u,t[11]=d):d=t[11],d}function Ut(e){let t=(0,Z.c)(34),{form:n}=e,{_:r}=c(),i=(0,Q.useId)(),[a,o]=(0,Q.useState)(!1),l=a||n.titleTouched&&(n.slugInvalid||n.slugShadows),{slug:u,trimmedSlug:d}=n;if(!l){if(d===``)return null;let e;t[0]===u?e=t[1]:(e={slug:u},t[0]=u,t[1]=e);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,$.jsx)(`code`,{className:`font-mono`})},t[2]=r):r=t[2];let i;t[3]===e?i=t[4]:(i=(0,$.jsx)(s,{id:`Pgu10b`,values:e,components:r}),t[3]=e,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>o(!0),t[5]=a):a=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(s,{id:`ePK91l`}),t[6]=c):c=t[6];let l;t[7]===n.isSaving?l=t[8]:(l=(0,$.jsx)(v,{type:`button`,variant:`link`,className:`h-auto p-0 align-baseline text-xs font-mono uppercase`,onClick:a,disabled:n.isSaving,children:c}),t[7]=n.isSaving,t[8]=l);let f;return t[9]!==i||t[10]!==l?(f=(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[i,` `,l]}),t[9]=i,t[10]=l,t[11]=f):f=t[11],f}let f;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(s,{id:`GN6L5F`}),t[12]=f):f=t[12];let p;t[13]===i?p=t[14]:(p=(0,$.jsx)(be,{htmlFor:i,children:f}),t[13]=i,t[14]=p);let m;t[15]===n?m=t[16]:(m=e=>n.setSlug(e.target.value),t[15]=n,t[16]=m);let h;t[17]===r?h=t[18]:(h=r({id:`tjXez2`}),t[17]=r,t[18]=h);let g;t[19]!==n.isSaving||t[20]!==n.slugInvalid||t[21]!==u||t[22]!==i||t[23]!==m||t[24]!==h?(g=(0,$.jsx)(Oe,{id:i,value:u,onChange:m,placeholder:h,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":n.slugInvalid,className:`font-mono`}),t[19]=n.isSaving,t[20]=n.slugInvalid,t[21]=u,t[22]=i,t[23]=m,t[24]=h,t[25]=g):g=t[25];let _;t[26]!==n.slugInvalid||t[27]!==n.slugShadows||t[28]!==d?(_=n.slugInvalid?(0,$.jsx)(ve,{children:(0,$.jsx)(s,{id:`l_FAT6`,components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}):n.slugShadows?(0,$.jsx)(xe,{className:`text-yellow-600 dark:text-yellow-500`,children:(0,$.jsx)(s,{id:`jwnpdM`,values:{trimmedSlug:d},components:{0:(0,$.jsx)(`code`,{className:`font-mono`})}})}):(0,$.jsx)(xe,{children:(0,$.jsx)(s,{id:`TsZmgr`})}),t[26]=n.slugInvalid,t[27]=n.slugShadows,t[28]=d,t[29]=_):_=t[29];let y;return t[30]!==p||t[31]!==g||t[32]!==_?(y=(0,$.jsxs)(Ce,{children:[p,g,_]}),t[30]=p,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function Wt(e){let t=(0,Z.c)(20),{form:n}=e,{_:r}=c(),i=(0,Q.useId)(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(s,{id:`GN6L5F`}),t[0]=a):a=t[0];let o;t[1]===i?o=t[2]:(o=(0,$.jsx)(be,{htmlFor:i,children:a}),t[1]=i,t[2]=o);let l=n.slug,u;t[3]===n?u=t[4]:(u=e=>n.setSlug(e.target.value),t[3]=n,t[4]=u);let d;t[5]===r?d=t[6]:(d=r({id:`tjXez2`}),t[5]=r,t[6]=d);let f;t[7]!==n.isSaving||t[8]!==n.slug||t[9]!==n.slugInvalid||t[10]!==i||t[11]!==u||t[12]!==d?(f=(0,$.jsx)(Oe,{id:i,value:l,onChange:u,placeholder:d,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":n.slugInvalid,className:`font-mono`}),t[7]=n.isSaving,t[8]=n.slug,t[9]=n.slugInvalid,t[10]=i,t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]===n.slugInvalid?p=t[15]:(p=n.slugInvalid?(0,$.jsx)(ve,{children:(0,$.jsx)(s,{id:`l_FAT6`,components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}):(0,$.jsx)(xe,{children:(0,$.jsx)(s,{id:`FvMSms`})}),t[14]=n.slugInvalid,t[15]=p);let m;return t[16]!==o||t[17]!==f||t[18]!==p?(m=(0,$.jsxs)(Ce,{children:[o,f,p]}),t[16]=o,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}var Gt={name:``,title:``,description:``,body:``},Kt=`## Overview
|
|
7
7
|
|
|
8
8
|
(Replace with the starting content for new documents.)
|
|
9
|
-
`;function qt(e){let t=(0,Z.c)(12),{folderPath:n,existingNames:r,open:i,onOpenChange:a,onCreated:o}=e,s;t[0]!==r||t[1]!==n||t[2]!==o||t[3]!==a||t[4]!==i?(s=i?(0,$.jsx)(Jt,{folderPath:n,existingNames:r,onOpenChange:a,onCreated:o}):null,t[0]=r,t[1]=n,t[2]=o,t[3]=a,t[4]=i,t[5]=s):s=t[5];let c;t[6]===s?c=t[7]:(c=(0,$.jsx)(w,{className:`sm:max-w-3xl max-h-[85vh] flex flex-col`,children:s}),t[6]=s,t[7]=c);let l;return t[8]!==a||t[9]!==i||t[10]!==c?(l=(0,$.jsx)(O,{open:i,onOpenChange:a,children:c}),t[8]=a,t[9]=i,t[10]=c,t[11]=l):l=t[11],l}function Jt(e){let t=(0,Z.c)(31),{folderPath:n,existingNames:r,onOpenChange:i,onCreated:a}=e,o;t[0]!==a||t[1]!==i?(o=e=>{a(e),i(!1)},t[0]=a,t[1]=i,t[2]=o):o=t[2];let c;t[3]!==r||t[4]!==n||t[5]!==o?(c={mode:`create`,folderPath:n,initial:Gt,existingNames:r,onCommitted:o},t[3]=r,t[4]=n,t[5]=o,t[6]=c):c=t[6];let l=zt(c),u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(C,{children:(0,$.jsx)(s,{id:`G1Gw0v`})}),t[7]=u):u=t[7];let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsxs)(D,{children:[u,(0,$.jsx)(S,{children:(0,$.jsx)(s,{id:`NUr4kz`})})]}),t[8]=d):d=t[8];let f;t[9]===l?f=t[10]:(f=(0,$.jsx)(T,{children:(0,$.jsx)(Vt,{form:l,bodyPlaceholder:Kt})}),t[9]=l,t[10]=f);let p;t[11]===i?p=t[12]:(p=()=>i(!1),t[11]=i,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(s,{id:`dEgA5A`}),t[13]=m):m=t[13];let h;t[14]!==l.isSaving||t[15]!==p?(h=(0,$.jsx)(v,{variant:`outline`,className:`font-mono uppercase`,onMouseDown:Yt,onClick:p,disabled:l.isSaving,children:m}),t[14]=l.isSaving,t[15]=p,t[16]=h):h=t[16];let g;t[17]===l?g=t[18]:(g=()=>void l.submit(),t[17]=l,t[18]=g);let _;t[19]===l.isSaving?_=t[20]:(_=l.isSaving?(0,$.jsx)(s,{id:`E9bKSA`}):(0,$.jsx)(s,{id:`A5hiCy`}),t[19]=l.isSaving,t[20]=_);let y;t[21]!==l.isSaving||t[22]!==_||t[23]!==g?(y=(0,$.jsx)(v,{onClick:g,disabled:l.isSaving,children:_}),t[21]=l.isSaving,t[22]=_,t[23]=g,t[24]=y):y=t[24];let b;t[25]!==y||t[26]!==h?(b=(0,$.jsxs)(E,{children:[h,y]}),t[25]=y,t[26]=h,t[27]=b):b=t[27];let x;return t[28]!==b||t[29]!==f?(x=(0,$.jsxs)($.Fragment,{children:[d,f,b]}),t[28]=b,t[29]=f,t[30]=x):x=t[30],x}function Yt(e){return e.preventDefault()}function Xt(e){let t=(0,Z.c)(16),{template:n,onOpenChange:r,onDeleted:i}=e,{_:a}=c(),[o,s]=(0,Q.useState)(!1),l;t[0]!==a||t[1]!==i||t[2]!==r?(l=async function(e){s(!0);let t=await me(e.source_folder,e.name);if(s(!1),!t.ok){let{error:e}=t;De.error(a({id:`36WXSC`,values:{error:e}}));return}let n=e.title??e.name;De.success(a({id:`ErRi6L`,values:{label:n}})),i(),r(!1)},t[0]=a,t[1]=i,t[2]=r,t[3]=l):l=t[3];let u=l,d=n!==null,f;t[4]!==o||t[5]!==r?(f=e=>{!e&&!o&&r(!1)},t[4]=o,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==a||t[8]!==o||t[9]!==u||t[10]!==n?(p=n?(()=>{let{name:e,path:t,scope:r}=n,i=r===`inherited`?`\n\n${a({id:`8uAWix`})}`:``;return(0,$.jsx)(g,{itemName:a({id:`XfzqjK`,values:{name:e}}),isSubmitting:o,onDelete:()=>u(n),customDescription:`${a({id:`5LXwX8`,values:{path:t}})}${i}`})})():null,t[7]=a,t[8]=o,t[9]=u,t[10]=n,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,$.jsx)(O,{open:d,onOpenChange:f,children:p}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function Zt(e){let t=(0,Z.c)(45),{template:n,onEdit:r,onDelete:i,onCreate:o,badge:l}=e,{_:u}=c(),d=n.title??n.name,f=!!(n.title&&n.title!==n.name),p;t[0]===d?p=t[1]:(p=(0,$.jsx)(`span`,{className:`truncate font-medium`,children:d}),t[0]=d,t[1]=p);let m;t[2]!==f||t[3]!==n.name?(m=f?(0,$.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:n.name}):null,t[2]=f,t[3]=n.name,t[4]=m):m=t[4];let g;t[5]===l?g=t[6]:(g=l?(0,$.jsx)(`span`,{className:`ml-auto shrink-0`,children:l}):null,t[5]=l,t[6]=g);let y;t[7]!==p||t[8]!==m||t[9]!==g?(y=(0,$.jsxs)(`span`,{className:`flex w-full items-center gap-2`,children:[p,m,g]}),t[7]=p,t[8]=m,t[9]=g,t[10]=y):y=t[10];let b;t[11]===n.description?b=t[12]:(b=n.description?(0,$.jsx)(`span`,{className:`w-full truncate text-sm text-muted-foreground`,children:n.description}):null,t[11]=n.description,t[12]=b);let x;t[13]!==r||t[14]!==y||t[15]!==b?(x=(0,$.jsxs)(v,{type:`button`,variant:`ghost`,onClick:r,className:`h-auto min-w-0 flex-1 flex-col items-start gap-0.5 px-1.5 py-1 text-left font-normal hover:bg-transparent`,children:[y,b]}),t[13]=r,t[14]=y,t[15]=b,t[16]=x):x=t[16];let S;t[17]!==u||t[18]!==d||t[19]!==o?(S=o?(0,$.jsxs)(v,{type:`button`,variant:`ghost`,size:`sm`,className:`shrink-0 font-mono uppercase opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:o,"aria-label":u({id:`mZ1r4i`,values:{label:d}}),children:[(0,$.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(s,{id:`hYgDIe`})]}):null,t[17]=u,t[18]=d,t[19]=o,t[20]=S):S=t[20];let C;t[21]!==u||t[22]!==d?(C=u({id:`Bx4EXG`,values:{label:d}}),t[21]=u,t[22]=d,t[23]=C):C=t[23];let w;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,$.jsx)(A,{asChild:!0,children:(0,$.jsx)(v,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,"aria-label":C,children:w})}),t[25]=C,t[26]=T);let E,D;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(a,{"aria-hidden":!0}),D=(0,$.jsx)(s,{id:`ePK91l`}),t[27]=E,t[28]=D):(E=t[27],D=t[28]);let O;t[29]===r?O=t[30]:(O=(0,$.jsxs)(k,{onSelect:r,children:[E,D]}),t[29]=r,t[30]=O);let N,P;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(we,{"aria-hidden":!0}),P=(0,$.jsx)(s,{id:`cnGeoo`}),t[31]=N,t[32]=P):(N=t[31],P=t[32]);let F;t[33]===i?F=t[34]:(F=(0,$.jsxs)(k,{variant:`destructive`,onSelect:i,children:[N,P]}),t[33]=i,t[34]=F);let I;t[35]!==O||t[36]!==F?(I=(0,$.jsxs)(j,{align:`end`,className:`min-w-52`,children:[O,F]}),t[35]=O,t[36]=F,t[37]=I):I=t[37];let L;t[38]!==T||t[39]!==I?(L=(0,$.jsxs)(M,{modal:!1,children:[T,I]}),t[38]=T,t[39]=I,t[40]=L):L=t[40];let R;return t[41]!==L||t[42]!==x||t[43]!==S?(R=(0,$.jsxs)(`li`,{className:`group flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-muted/50`,children:[x,S,L]}),t[41]=L,t[42]=x,t[43]=S,t[44]=R):R=t[44],R}function Qt(){let e=(0,Z.c)(8),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(0),[o,s]=(0,Q.useState)(!1),c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/skill-targets`).then(en).then(t=>{if(e)return;let n=z.safeParse(t);if(!n.success){console.error(`[ok-skills] /api/skill-targets response failed schema validation:`,n.error.issues),r({status:`error`,message:`Server returned an incomplete skill-targets response.`});return}r({status:`ready`,data:n.data})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[1]=c):c=e[1];let l;e[2]===i?l=e[3]:(l=[i],e[2]=i,e[3]=l),(0,Q.useEffect)(c,l);let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=async e=>{s(!0);let t=await Ie(e);if(!t.ok)throw s(!1),Error(t.error);Pe(),a($t),s(!1)},e[4]=u):u=e[4];let d=u,f;return e[5]!==o||e[6]!==n?(f={state:n,saving:o,folderAction:d},e[5]=o,e[6]=n,e[7]=f):f=e[7],f}function $t(e){return e+1}async function en(e){if(!e.ok){let t=await e.json().catch(tn);throw Error(Me(t)??`HTTP ${e.status}`)}return e.json()}function tn(){return null}var nn=`claude-cowork`,rn=`ok:skill:cowork:installed:v`,an=250,on=`/api/skill/install-state`,sn=null,cn=new Set,ln=null,un=!1,dn=()=>{Cn(jn())},fn=e=>{e.key?.startsWith(rn)&&Cn(jn())};function pn(){un||typeof window>`u`||(window.addEventListener(`focus`,dn),window.addEventListener(`storage`,fn),un=!0)}function mn(){un&&(typeof window>`u`||(window.removeEventListener(`focus`,dn),window.removeEventListener(`storage`,fn),un=!1))}var hn=!1,gn=!1,_n=!1,vn=!1,yn=!1,bn=!1,xn=!1;async function Sn(e){let t=!0;if(e.detectClaudeDesktop)try{t=await e.detectClaudeDesktop()}catch(e){t=!0,hn||(hn=!0,console.warn(`[claude-desktop-integration] detectClaudeDesktop IPC rejected — falling back to desktopPresent=true`,e))}let n=await e.fetchSnapshot();if(n){let e=n.targets?.[nn]??null;return e?.version?{desktopPresent:t,skillInstalled:!0,skillVersion:e.version}:{desktopPresent:t,skillInstalled:!1,skillVersion:null}}let r=e.readLocalStorageGuard();return{desktopPresent:t,skillInstalled:r.skillInstalled,skillVersion:r.skillVersion}}async function Cn(e){return ln||(ln=(async()=>{try{sn=await Sn(e);for(let e of cn)try{e()}catch(e){console.error(`[claude-desktop-integration] subscriber threw`,e)}}catch(e){console.error(`[claude-desktop-integration] probe rejected unexpectedly`,e)}finally{ln=null}})(),ln)}function wn(e){return cn.size===0&&pn(),cn.add(e),()=>{cn.delete(e),cn.size===0&&mn()}}function Tn(){return sn}function En(){if(typeof window>`u`)return;let e=window.okDesktop?.skill,t=e?.detectClaudeDesktop;if(t)return()=>t.call(e)}function Dn(e){let t=e?.timeoutMs??an,n=e?.fetchImpl??(typeof fetch<`u`?fetch:void 0);return async()=>{if(!n)return null;let e;try{let r=new AbortController,i=setTimeout(()=>r.abort(),t);try{e=await n(on,{method:`GET`,cache:`no-store`,signal:r.signal})}finally{clearTimeout(i)}}catch(e){let n=e instanceof DOMException&&e.name===`AbortError`;return n&&!_n?(_n=!0,console.warn(`[claude-desktop-integration] fetch ${on} timed out (>${t}ms) — falling back to localStorage guard`)):!n&&!gn&&(gn=!0,console.warn(`[claude-desktop-integration] fetch ${on} failed — falling back to localStorage guard`,e)),null}if(!e.ok)return vn||(vn=!0,console.warn(`[claude-desktop-integration] ${on} returned ${e.status} ${e.statusText} — falling back to localStorage guard`)),null;let r;try{r=await e.json()}catch(e){return yn||(yn=!0,console.warn(`[claude-desktop-integration] ${on} returned unparseable JSON — falling back to localStorage guard`,e)),null}return On(r)}}function On(e){if(typeof e!=`object`||!e)return kn(`not an object`);let t=e;if(typeof t.currentVersion!=`string`||t.currentVersion===``)return kn(`currentVersion not a non-empty string`);if(t.targets!==void 0){if(t.targets===null||typeof t.targets!=`object`)return kn(`targets not object`);for(let[,e]of Object.entries(t.targets)){if(e==null)continue;if(typeof e!=`object`)return kn(`target entry not object`);let t=e;if(typeof t.version!=`string`||t.version===``)return kn(`target.version not a non-empty string`)}}return t}function kn(e){return bn||(bn=!0,console.warn(`[claude-desktop-integration] ${on} response failed shape validation (${e}) — falling back to localStorage guard`)),null}function An(){if(typeof localStorage>`u`)return{skillInstalled:!1,skillVersion:null};try{for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);if(t?.startsWith(rn))return{skillInstalled:!0,skillVersion:t.slice(27)}}}catch(e){xn||(xn=!0,console.warn(`[claude-desktop-integration] localStorage scan threw — falling back to skillInstalled=false`,e))}return{skillInstalled:!1,skillVersion:null}}function jn(){return{detectClaudeDesktop:En(),fetchSnapshot:Dn(),readLocalStorageGuard:An}}function Mn(){let e=(0,Z.c)(5),t=(0,Q.useSyncExternalStore)(wn,Tn,Tn),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],e[0]=n):n=e[0],(0,Q.useEffect)(Pn,n);let r=t?.desktopPresent??!0,i=t?.skillInstalled??!1,a=t?.skillVersion??null,o;return e[1]!==r||e[2]!==i||e[3]!==a?(o={desktopPresent:r,skillInstalled:i,skillVersion:a,refresh:Nn},e[1]=r,e[2]=i,e[3]=a,e[4]=o):o=e[4],o}function Nn(){Cn(jn())}function Pn(){sn||Cn(jn())}var Fn=[{path:[`appearance`,`theme`],label:{id:`FEr96N`},description:{id:`JZ8cO6`},control:`enum-toggle`},{path:[`editor`,`wordWrap`],label:{id:`iKSP5j`},description:{id:`mmpzAq`}},{path:[`appearance`,`preview`,`autoOpen`],label:{id:`2XQ8Ww`},description:{id:`bultyE`}},{path:[`telemetry`,`skillInstallReports`,`enabled`],label:{id:`2jUGEP`},description:{id:`Ns0z5o`}}],In=[{path:[`appearance`,`colorTheme`],label:{id:`rFmBG3`},description:{id:`Pck6eI`},control:`theme-tiles`}],Ln=[{sectionId:`preferences`,fields:Fn},{sectionId:`plugin:theme`,fields:In}];async function Rn(){try{let e=await fetch(`/api/sync/conflicts`);return e.ok?{conflicts:(await e.json()).conflicts??[]}:(console.warn(JSON.stringify({event:`conflicts-fetch-failed`,status:e.status})),{conflicts:[],error:`server`})}catch(e){return console.warn(JSON.stringify({event:`conflicts-fetch-failed`,status:null,detail:e instanceof Error?e.message:String(e)})),{conflicts:[],error:`network`}}}function zn(){let e=(0,Z.c)(10),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(0),l;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=function(){let e=c.current+=1;Rn().then(t=>{let{conflicts:n,error:i}=t;e===c.current&&(r(n),s(i??null),a(!1))})},e[1]=l):l=e[1];let u=l,d,f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{u()},f=[],e[2]=d,e[3]=f):(d=e[2],f=e[3]),(0,Q.useEffect)(d,f);let p,m;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>Ne(e=>{e.includes(`sync-status`)&&u()}),m=[],e[4]=p,e[5]=m):(p=e[4],m=e[5]),(0,Q.useEffect)(p,m);let h;return e[6]!==n||e[7]!==o||e[8]!==i?(h={conflicts:n,loading:i,error:o},e[6]=n,e[7]=o,e[8]=i,e[9]=h):h=e[9],h}function Bn(e){if(!e)return``;let t=e.replace(/[/\\]+$/g,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?t:t.slice(n+1)}var Vn=`/api/share/construct-url`;function Hn(e){return{kind:`doc`,docName:e}}function Un(e){return{kind:`folder`,folderRelativePath:e}}var Wn=`Could not construct share URL.`,Gn=`Link ready but could not copy to clipboard.`;async function Kn(e,t=fetch){let n=await t(Vn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(`construct-url transport ${n.status}`);let r=await n.json(),i=K.safeParse(r);if(!i.success)throw Error(`construct-url response shape mismatch`);return i.data}function qn(e,t){switch(e){case`detached-head`:return`Switch to a branch to share.`;case`branch-not-on-origin`:return t?`Push ${t} to GitHub before sharing.`:`Push this branch to GitHub before sharing.`;case`non-github-remote`:return`Sharing supports GitHub remotes only.`;case`invalid-path`:return`Can't share this path.`;case`no-remote`:return`This project has no GitHub remote.`}}async function Jn(e,t){if(!e.hasRemote)return e.onClickWhenNoRemote(),{kind:`opened-wizard`};let n=e.kind===`folder`?{kind:`folder`,folderPath:e.folderRelativePath}:{kind:`doc`,docPath:Ae(e.docName)},r;try{r=await Kn(n,t.fetchFn)}catch{return t.toastError(Wn),{kind:`transport-error`}}if(r.ok){try{await t.clipboardWrite(r.shareUrl)}catch{return t.toastError(Gn),t.logEvent(`[share] action=link-construct result=clipboard-failed`),{kind:`clipboard-failed`,shareUrl:r.shareUrl,freshness:r.freshness}}return t.toastSuccess(e.kind===`folder`?`Folder share link copied.`:`Link copied.`),t.logEvent(`[share] action=link-construct`),{kind:`copied`,shareUrl:r.shareUrl,branch:r.branch,freshness:r.freshness}}if(r.error===`no-remote`)return e.onClickWhenNoRemote(),{kind:`opened-wizard`};let i=r.branch;return t.toastError(qn(r.error,i)),{kind:`business-error`,error:r.error,branch:i}}var Yn=`/api/share/publish/owners`,Xn=`/api/share/publish/name-check`,Zn=`/api/share/publish`,Qn=/[A-Za-z0-9._-]/g;function $n(e){return(e.match(Qn)?.join(``)??``).replace(/[-.]{2,}/g,e=>e[0]??`-`).replace(/^[-.]+/,``).replace(/[-.]+$/,``)}function er(e){return e.find(e=>e.kind===`org`)?.login??e[0]?.login??``}function tr(e){return`https://github.com/orgs/${encodeURIComponent(e)}/policies/applications`}function nr(e,t,n){switch(e){case`name-conflict`:return{banner:`${t}/${n} already exists. Pick a different name.`,next:{kind:`edit-name`}};case`saml-sso`:return{banner:`GitHub denied the request. You may need to authorize OpenKnowledge for ${t} in your browser.`,next:{kind:`authorize-org`,authorizeUrl:tr(t)}};case`push-failed`:return{banner:`Created ${t}/${n}, push failed.`,next:{kind:`retry-push`}};case`auth-required`:return{banner:`GitHub connection expired. Connect again to continue.`,next:{kind:`reauth`}};case`init-failed`:return{banner:`Couldn't prepare this project for publish.`,next:{kind:`edit-form`}};case`network`:return{banner:`Couldn't reach GitHub. Try again?`,next:{kind:`edit-form`}};case`no-project`:return{banner:`Open a project first.`,next:{kind:`edit-form`}}}}async function rr(e=fetch){let t=await e(Yn,{method:`GET`});if(!t.ok)throw Error(`owners transport ${t.status}`);let n=await t.json(),r=B.safeParse(n);if(!r.success)throw Error(`owners response shape mismatch`);return r.data}async function ir(e,t,n=fetch){let r=await n(`${Xn}?owner=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`,{method:`GET`});if(!r.ok)throw Error(`name-check transport ${r.status}`);let i=await r.json(),a=V.safeParse(i);if(!a.success)throw Error(`name-check response shape mismatch`);return a.data}async function ar(e,t=fetch){let n=await t(Zn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(`publish transport ${n.status}`);let r=await n.json(),i=G.safeParse(r);if(!i.success)throw Error(`publish response shape mismatch`);return i.data}function or(e,t,n){return e.ok?e.available?{kind:`available`}:{kind:`taken`,owner:t,name:n}:e.error===`auth-required`?{kind:`error`,banner:`GitHub connection expired. Connect again to continue.`}:{kind:`error`,banner:`Couldn't reach GitHub. Try again?`}}function sr(e){return e.submitting||e.owner===null||e.sanitizedName.length===0?!1:e.nameCheck.kind===`available`}var cr=500;function lr(e){let t=(0,Z.c)(69),{open:n,onOpenChange:r}=e,{_:a}=c(),o=m(),{activeDocName:l}=i(),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(`private`),[j,M]=(0,Q.useState)(``),I;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(I={kind:`idle`},t[0]=I):I=t[0];let[L,R]=(0,Q.useState)(I),[z,B]=(0,Q.useState)(!1),[ee,V]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(!1),[W,G]=(0,Q.useState)(null),[K,q]=(0,Q.useState)(!1),[J,te]=(0,Q.useState)(null),[ne,re]=(0,Q.useState)(null),ie=(0,Q.useRef)(null),ae=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),se;t[1]===b?se=t[2]:(se=$n(b),t[1]=b,t[2]=se);let ce=se,le=u?.find(e=>e.login===_)??null,ue;t[3]!==a||t[4]!==_?(ue=async function(){p(!0),g(null);try{let e=await rr();if(!e.ok){e.error===`auth-required`?(U(!0),g(a({id:`6cyguR`}))):g(a({id:`UVLlMV`})),p(!1);return}d(e.owners),e.owners.length>0&&_===``&&y(er(e.owners))}catch{g(a({id:`UVLlMV`}))}p(!1)},t[3]=a,t[4]=_,t[5]=ue):ue=t[5];let Y=ue,de;t[6]!==Y||t[7]!==n||t[8]!==u||t[9]!==_||t[10]!==o?.contentDir?(de=()=>{n&&(R({kind:`idle`}),V(null),B(!1),g(null),G(null),q(!1),te(null),re(null),x($n(Bn(o?.contentDir??``))),A(`private`),M(``),u===null?Y():_===``&&u.length>0&&y(er(u)))},t[6]=Y,t[7]=n,t[8]=u,t[9]=_,t[10]=o?.contentDir,t[11]=de):de=t[11];let fe;t[12]===n?fe=t[13]:(fe=[n],t[12]=n,t[13]=fe),(0,Q.useEffect)(de,fe);let pe,me;t[14]!==a||t[15]!==n||t[16]!==ce||t[17]!==_?(pe=()=>{if(n){if(ie.current!==null&&clearTimeout(ie.current),_===``||ce===``){R({kind:`idle`});return}return R({kind:`pending`}),ie.current=setTimeout(async()=>{let e=_,t=ce;ae.current=`${e}|${t}`,R({kind:`checking`});try{let n=await ir(e,t);if(ae.current!==`${e}|${t}`)return;R(or(n,e,t))}catch{if(ae.current!==`${e}|${t}`)return;R({kind:`error`,banner:a({id:`UVLlMV`})})}},cr),()=>{ie.current!==null&&(clearTimeout(ie.current),ie.current=null)}}},me=[n,_,ce,a],t[14]=a,t[15]=n,t[16]=ce,t[17]=_,t[18]=pe,t[19]=me):(pe=t[18],me=t[19]),(0,Q.useEffect)(pe,me);let ge,_e;t[20]!==a||t[21]!==l||t[22]!==W?(ge=()=>{if(!W||!l)return;let e=!1;return(async()=>{try{let t=await Kn({kind:`doc`,docPath:Ae(l)});if(e)return;t.ok?te(t.shareUrl):re(qn(t.error,t.branch))}catch(t){let n=t;if(e)return;console.warn(`[share] action=prefetch-share-url result=failed`,n),re(a({id:`J6N5MX`}))}})(),()=>{e=!0}},_e=[W,l,a],t[20]=a,t[21]=l,t[22]=W,t[23]=ge,t[24]=_e):(ge=t[23],_e=t[24]),(0,Q.useEffect)(ge,_e);let ve;t[25]===Y?ve=t[26]:(ve=function(){U(!1),g(null),Y()},t[25]=Y,t[26]=ve);let we=ve,Te=async function(){if(sr({owner:le,sanitizedName:ce,nameCheck:L,submitting:z})){B(!0),V(null);try{let e=await ar({owner:_,name:ce,visibility:k,description:j.trim().length>0?j.trim():void 0});if(e.ok){G({ownerLogin:e.ownerLogin,repoName:e.repoName}),B(!1);return}let t=nr(e.error,_,ce);V({message:t.banner,next:t.next}),t.next.kind===`edit-name`?(oe.current?.focus(),oe.current?.select()):t.next.kind===`reauth`&&U(!0)}catch{V({message:a({id:`UVLlMV`}),next:{kind:`edit-form`}})}B(!1)}},Ee;t[27]!==a||t[28]!==K||t[29]!==r||t[30]!==J?(Ee=function(){!J||K||(q(!0),Be(J).then(()=>{De.success(a({id:`c1LZZH`})),r(!1)}).catch(e=>{if(console.warn(`[share] action=link-construct result=clipboard-failed`,e),Ve(e)&&window.self!==window.top){De.error(a({id:`Dub54T`}));return}De.error(a({id:`MQIM_Y`}))}).finally(()=>{q(!1)}))},t[27]=a,t[28]=K,t[29]=r,t[30]=J,t[31]=Ee):Ee=t[31];let X=Ee,ke;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ke=function(e){let t=window.okDesktop?.shell?.openExternal;t?t(e):window.open(e,`_blank`,`noopener`)},t[32]=ke):ke=t[32];let je=ke,Me;t[33]===r?Me=t[34]:(Me=function(){r(!1)},t[33]=r,t[34]=Me);let Ne=Me,Pe=!sr({owner:le,sanitizedName:ce,nameCheck:L,submitting:z}),Fe;t[35]!==a||t[36]!==l||t[37]!==ee||t[38]!==K||t[39]!==j||t[40]!==je||t[41]!==Ne||t[42]!==X||t[43]!==Te||t[44]!==Y||t[45]!==b||t[46]!==L||t[47]!==u||t[48]!==h||t[49]!==f||t[50]!==W||t[51]!==ce||t[52]!==_||t[53]!==J||t[54]!==ne||t[55]!==Pe||t[56]!==z||t[57]!==k?(Fe=(0,$.jsx)(w,{className:`sm:max-w-lg`,showCloseButton:!1,children:W?(0,$.jsx)(dr,{ownerLogin:W.ownerLogin,repoName:W.repoName,shareUrl:J,shareUrlError:ne,copying:K,canCopy:l!==null,onCopy:X,onClose:Ne}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[(0,$.jsx)(C,{children:(0,$.jsx)(s,{id:`qXsafh`})}),(0,$.jsx)(S,{children:(0,$.jsx)(s,{id:`Z1LF1M`})})]}),(0,$.jsxs)(T,{className:`flex flex-col gap-6`,children:[(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(N,{id:`publish-owner-label`,children:(0,$.jsx)(s,{id:`LtI9AS`})}),f&&u===null?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(he,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`Z3FXyt`})]}):h?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm text-destructive`,children:h}),(0,$.jsx)(v,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>Y(),children:(0,$.jsx)(s,{id:`6gRgw8`})})]}):(0,$.jsx)(F,{value:_,onValueChange:y,"aria-labelledby":`publish-owner-label`,"data-testid":`publish-owner-radio`,children:(u??[]).map(ur)})]}),(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(N,{htmlFor:`publish-name`,children:(0,$.jsx)(s,{id:`0xnmlQ`})}),(0,$.jsx)(Oe,{id:`publish-name`,ref:oe,"data-testid":`publish-name`,value:b,onChange:e=>x(e.target.value),onBlur:()=>{ae.current=null},placeholder:`my-knowledge-base`,autoComplete:`off`,spellCheck:!1}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-1sm`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:ce?(0,$.jsx)(s,{id:`Nn4GgW`,values:{sanitizedName:ce},components:{0:(0,$.jsx)(`code`,{className:`font-mono`})}}):(0,$.jsx)(s,{id:`Oxyd5f`})}),(0,$.jsx)(gr,{status:L})]})]}),(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(N,{id:`publish-visibility-label`,children:(0,$.jsx)(s,{id:`2q_Q7x`})}),(0,$.jsxs)(F,{value:k,onValueChange:e=>A(e===`public`?`public`:`private`),className:`sm:flex`,"aria-labelledby":`publish-visibility-label`,children:[(0,$.jsx)(be,{htmlFor:`publish-visibility-private`,children:(0,$.jsxs)(Ce,{orientation:`horizontal`,children:[(0,$.jsxs)(ye,{children:[(0,$.jsx)(Se,{children:(0,$.jsx)(s,{id:`zwBp5t`})}),(0,$.jsx)(xe,{className:`text-1sm`,children:(0,$.jsx)(s,{id:`D8OV7J`})})]}),(0,$.jsx)(P,{value:`private`,id:`publish-visibility-private`,"data-testid":`publish-visibility-private`})]})}),(0,$.jsx)(be,{htmlFor:`publish-visibility-public`,children:(0,$.jsxs)(Ce,{orientation:`horizontal`,children:[(0,$.jsxs)(ye,{children:[(0,$.jsx)(Se,{children:(0,$.jsx)(s,{id:`7d1a0d`})}),(0,$.jsx)(xe,{className:`text-1sm`,children:(0,$.jsx)(s,{id:`4jDd0j`})})]}),(0,$.jsx)(P,{value:`public`,id:`publish-visibility-public`,"data-testid":`publish-visibility-public`})]})})]})]}),(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(N,{htmlFor:`publish-description`,children:(0,$.jsx)(s,{id:`Fxf4jq`})}),(0,$.jsx)(ze,{id:`publish-description`,"data-testid":`publish-description`,rows:2,value:j,onChange:e=>M(e.target.value),placeholder:a({id:`c5rF4v`})})]}),ee&&(0,$.jsx)(hr,{banner:ee,onAuthorize:je,onRetryPush:Te})]}),(0,$.jsxs)(E,{children:[(0,$.jsx)(v,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:Ne,children:(0,$.jsx)(s,{id:`dEgA5A`})}),(0,$.jsx)(v,{type:`button`,onClick:Te,disabled:Pe,"data-testid":`publish-submit`,children:z?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(he,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`Bdha5y`})]}):(0,$.jsx)(s,{id:`EEYbdt`})})]})]})}),t[35]=a,t[36]=l,t[37]=ee,t[38]=K,t[39]=j,t[40]=je,t[41]=Ne,t[42]=X,t[43]=Te,t[44]=Y,t[45]=b,t[46]=L,t[47]=u,t[48]=h,t[49]=f,t[50]=W,t[51]=ce,t[52]=_,t[53]=J,t[54]=ne,t[55]=Pe,t[56]=z,t[57]=k,t[58]=Fe):Fe=t[58];let Ie;t[59]!==r||t[60]!==n||t[61]!==Fe?(Ie=(0,$.jsx)(O,{open:n,onOpenChange:r,children:Fe}),t[59]=r,t[60]=n,t[61]=Fe,t[62]=Ie):Ie=t[62];let Le;t[63]!==H||t[64]!==we?(Le=(0,$.jsx)(kt,{open:H,onOpenChange:U,onSuccess:we}),t[63]=H,t[64]=we,t[65]=Le):Le=t[65];let Re;return t[66]!==Ie||t[67]!==Le?(Re=(0,$.jsxs)($.Fragment,{children:[Ie,Le]}),t[66]=Ie,t[67]=Le,t[68]=Re):Re=t[68],Re}function ur(e){let t=`publish-owner-${e.login}`;return(0,$.jsx)(be,{htmlFor:t,children:(0,$.jsxs)(Ce,{orientation:`horizontal`,children:[(0,$.jsx)(ye,{children:(0,$.jsxs)(Se,{children:[e.avatarUrl?(0,$.jsx)(`img`,{src:e.avatarUrl,alt:``,"aria-hidden":!0,className:`size-4 rounded-full`}):null,(0,$.jsx)(`span`,{children:e.login})]})}),(0,$.jsx)(P,{value:e.login,id:t,"data-testid":`publish-owner-option-${e.login}`})]})},e.login)}function dr(e){let t=(0,Z.c)(36),{ownerLogin:n,repoName:r,shareUrl:i,shareUrlError:a,copying:o,canCopy:l,onCopy:u,onClose:d}=e,{_:f}=c(),p=(0,Q.useRef)(null),m,h;t[0]===i?(m=t[1],h=t[2]):(m=()=>{!i||!p.current||(p.current.focus(),p.current.select())},h=[i],t[0]=i,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(C,{children:(0,$.jsx)(s,{id:`u3wRF-`})}),t[3]=g):g=t[3];let _;t[4]!==n||t[5]!==r?(_={ownerLogin:n,repoName:r},t[4]=n,t[5]=r,t[6]=_):_=t[6];let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y={0:(0,$.jsx)(`code`,{className:`font-mono`})},t[7]=y):y=t[7];let b;t[8]===_?b=t[9]:(b=(0,$.jsxs)(D,{children:[g,(0,$.jsx)(S,{children:(0,$.jsx)(s,{id:`r871ed`,values:_,components:y})})]}),t[8]=_,t[9]=b);let x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(Y,{className:`mt-0.5 size-4 text-emerald-600`,"aria-hidden":!0}),t[10]=x):x=t[10];let w;t[11]===l?w=t[12]:(w=(0,$.jsxs)(`div`,{role:`status`,"data-testid":`publish-success`,className:`flex items-start gap-3 rounded-md border border-emerald-500/40 bg-emerald-500/5 p-3 text-sm`,children:[x,(0,$.jsx)(`span`,{className:`text-foreground`,children:l?(0,$.jsx)(s,{id:`cOrTMo`}):(0,$.jsx)(s,{id:`nTwL53`})})]}),t[11]=l,t[12]=w);let O;t[13]!==l||t[14]!==i||t[15]!==a?(O=l&&(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(N,{htmlFor:`publish-share-url`,children:(0,$.jsx)(s,{id:`5-FeN2`})}),a?(0,$.jsx)(`div`,{role:`alert`,"data-testid":`publish-share-url-error`,className:`rounded-md border border-destructive/50 bg-destructive/5 p-2 text-sm text-destructive`,children:a}):i?(0,$.jsx)(Oe,{id:`publish-share-url`,ref:p,"data-testid":`publish-share-url`,readOnly:!0,value:i,onFocus:mr,onClick:pr,onContextMenu:fr,className:`font-mono text-xs`}):(0,$.jsxs)(`div`,{"data-testid":`publish-share-url-loading`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(he,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`M9597s`})]})]}),t[13]=l,t[14]=i,t[15]=a,t[16]=O):O=t[16];let k;t[17]!==w||t[18]!==O?(k=(0,$.jsxs)(T,{className:`flex flex-col gap-4`,children:[w,O]}),t[17]=w,t[18]=O,t[19]=k):k=t[19];let A;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(s,{id:`DPfwMq`}),t[20]=A):A=t[20];let j;t[21]===d?j=t[22]:(j=(0,$.jsx)(v,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:d,"data-testid":`publish-success-done`,children:A}),t[21]=d,t[22]=j);let M;t[23]!==f||t[24]!==l||t[25]!==o||t[26]!==u||t[27]!==i?(M=l&&(0,$.jsx)(v,{type:`button`,onClick:u,disabled:o||!i,"data-testid":`publish-copy-link`,"aria-label":f({id:`RGCCrg`}),children:o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(he,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`OvEjsP`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`RGCCrg`})]})}),t[23]=f,t[24]=l,t[25]=o,t[26]=u,t[27]=i,t[28]=M):M=t[28];let P;t[29]!==j||t[30]!==M?(P=(0,$.jsxs)(E,{children:[j,M]}),t[29]=j,t[30]=M,t[31]=P):P=t[31];let F;return t[32]!==k||t[33]!==P||t[34]!==b?(F=(0,$.jsxs)($.Fragment,{children:[b,k,P]}),t[32]=k,t[33]=P,t[34]=b,t[35]=F):F=t[35],F}function fr(e){return e.currentTarget.select()}function pr(e){return e.currentTarget.select()}function mr(e){return e.currentTarget.select()}function hr(e){let t=(0,Z.c)(13),{banner:n,onAuthorize:i,onRetryPush:a}=e,o=n.next,c;t[0]===n.message?c=t[1]:(c=(0,$.jsx)(`span`,{children:n.message}),t[0]=n.message,t[1]=c);let l;t[2]!==o.authorizeUrl||t[3]!==o.kind||t[4]!==i?(l=o.kind===`authorize-org`&&(0,$.jsxs)(v,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,"data-testid":`publish-authorize-org`,onClick:()=>i(o.authorizeUrl),children:[(0,$.jsx)(s,{id:`FyW0WO`}),` `,(0,$.jsx)(r,{className:`ml-1 size-3`,"aria-hidden":!0})]}),t[2]=o.authorizeUrl,t[3]=o.kind,t[4]=i,t[5]=l):l=t[5];let u;t[6]!==o.kind||t[7]!==a?(u=o.kind===`retry-push`&&(0,$.jsx)(v,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,"data-testid":`publish-retry-push`,onClick:a,children:(0,$.jsx)(s,{id:`NOHyEE`})}),t[6]=o.kind,t[7]=a,t[8]=u):u=t[8];let d;return t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,$.jsxs)(`div`,{role:`alert`,"data-testid":`publish-banner`,className:`flex flex-col gap-2 rounded-md border border-destructive/50 bg-destructive/5 p-3 text-sm`,children:[c,l,u]}),t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function gr(e){let t=(0,Z.c)(12),{status:r}=e;if(r.kind===`available`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":`available`,className:`flex items-center gap-1 text-emerald-600 dark:text-emerald-400`,children:[e,` `,(0,$.jsx)(s,{id:`csDS2L`})]}),t[1]=n):n=t[1],n}if(r.kind===`taken`){let{owner:e,name:i}=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==e?(o=(0,$.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":`taken`,className:`flex items-center gap-1 text-destructive`,children:[a,` `,(0,$.jsx)(s,{id:`LRgZAt`,values:{owner:e,name:i}})]}),t[3]=i,t[4]=e,t[5]=o):o=t[5],o}if(r.kind===`checking`||r.kind===`pending`){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(he,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),t[6]=e):e=t[6];let n;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(s,{id:`pWT04I`}),t[7]=n):n=t[7];let i;return t[8]===r.kind?i=t[9]:(i=(0,$.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":r.kind,className:`flex items-center gap-1 text-muted-foreground`,children:[e,` `,n]}),t[8]=r.kind,t[9]=i),i}if(r.kind===`error`){let e;return t[10]===r.banner?e=t[11]:(e=(0,$.jsx)(`span`,{"data-testid":`publish-name-check`,"data-status":`error`,className:`text-destructive`,children:r.banner}),t[10]=r.banner,t[11]=e),e}return null}function _r(e=`sync`){ie(e).catch(e=>{console.warn(`[sync-badge] manual sync trigger failed`,e instanceof Error?e.message:e)})}function vr(e){if(!e)return X._({id:`Zul8Ry`});let t=Date.now()-new Date(e).getTime();if(t<6e4)return X._({id:`xOTzt5`});if(t<36e5){let e=Math.floor(t/6e4);return X._({id:`LNum6A`,values:{minutes:e}})}if(t<864e5){let e=Math.floor(t/36e5);return X._({id:`nYeBmY`,values:{hours:e}})}return new Date(e).toLocaleDateString()}function yr(e){return e.syncMode===`follow`}function br(e){return yr(e)&&e.state===`idle`&&e.conflictCount>0?`conflict`:e.state}function xr(e){let t=(0,Z.c)(10),{status:n,paused:r}=e;if(r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ke,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}switch(br(n)){case`dormant`:{let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ue,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ge,{className:`size-3.5 text-muted-foreground`}),t[2]=e):e=t[2],e}let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ue,{className:`size-3.5 text-muted-foreground`}),t[3]=e):e=t[3],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ge,{className:`size-3.5 text-muted-foreground animate-spin`}),t[4]=e):e=t[4],e}case`conflict`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Te,{className:`size-3.5 text-amber-500`}),t[5]=e):e=t[5],e}case`offline`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(He,{className:`size-3.5 text-muted-foreground`}),t[6]=e):e=t[6],e}case`auth-error`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(We,{className:`size-3.5 text-destructive`}),t[7]=e):e=t[7],e}case`disabled`:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Te,{className:`size-3.5 text-amber-500`}),t[8]=e):e=t[8],e}default:{let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ue,{className:`size-3.5 text-muted-foreground`}),t[9]=e):e=t[9],e}}}function Sr(e){switch(br(e)){case`idle`:return!yr(e)&&e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function Cr(e,t=!1){switch(e){case`dormant`:return X._({id:`RmBY0A`});case`idle`:return t?X._({id:`j5CWO4`}):X._({id:`N2FcBE`});case`fetching`:return t?X._({id:`7IsvrP`}):X._({id:`Wgmlsw`});case`pulling`:return t?X._({id:`JL3si7`}):X._({id:`4uNLmk`});case`pushing`:return X._({id:`iycx_A`});case`conflict`:return X._({id:`IInnZo`});case`offline`:return X._({id:`6Aih4U`});case`auth-error`:return X._({id:`mHVPm5`});case`disabled`:return X._({id:`DrYM2Z`});default:return e}}function wr(e){switch(e){case`external-changes-pending`:return X._({id:`W9_Bub`});case`dirty-tree`:return X._({id:`a5Gha5`});case`non-content-merge-failure`:return X._({id:`sIxSSP`});case`detached-head`:return X._({id:`uQNW00`});case`diverged-local-commits`:return X._({id:`LQsCPn`});case`auth-error`:return X._({id:`mHVPm5`});case`protected-branch`:return X._({id:`8fc_3j`});case`no-push-permission`:return X._({id:`ChAtFg`});default:return e}}function Tr(e){switch(e){case`not-authenticated`:return X._({id:`ycIX5i`});case`no-collaborator`:return X._({id:`ChAtFg`});case`private-no-access`:return X._({id:`07gHun`});case`repo-not-found`:return X._({id:`uksqrP`});default:return X._({id:`ChAtFg`})}}function Er(e){return e?.checkStatus===`denied`&&e.deniedReason===`not-authenticated`}function Dr(e){switch(e){case`auth-403`:return X._({id:`EiVgl5`});case`auth-401`:return X._({id:`-Qw-1t`});case`auth-scope-mismatch`:return X._({id:`Zue_jx`});case`auth-no-credential`:return X._({id:`uCaIdy`});case`semantic-protected-branch`:return X._({id:`T0OVm7`});default:return X._({id:`1AumWo`})}}function Or(e){switch(e){case`auth-403`:return X._({id:`RgbKEe`});case`auth-401`:return X._({id:`-Qw-1t`});case`auth-scope-mismatch`:return X._({id:`Zue_jx`});case`auth-no-credential`:return X._({id:`uCaIdy`});default:return X._({id:`jZ_E5M`})}}function kr(e){switch(e){case`auth-403`:return X._({id:`RgbKEe`});case`auth-401`:return X._({id:`-Qw-1t`});case`auth-scope-mismatch`:return X._({id:`Zue_jx`});case`auth-no-credential`:return X._({id:`uCaIdy`});case`semantic-protected-branch`:return X._({id:`T0OVm7`});default:return X._({id:`cUk6TF`})}}function Ar(e){let t=e.pushErrorCode!=null||e.pushError!=null,n=e.pullErrorCode!=null||e.pullError!=null;if(t&&n&&(e.pushErrorCode==null?e.pullErrorCode==null&&e.pushError===e.pullError:e.pushErrorCode===e.pullErrorCode))return[{key:`sync`,direction:null,message:e.pushErrorCode==null?e.pushError:kr(e.pushErrorCode)}];let r=t&&n,i=[];return t&&i.push({key:`push`,direction:r?`push`:null,message:e.pushErrorCode?Dr(e.pushErrorCode):e.pushError}),n&&i.push({key:`pull`,direction:r?`pull`:null,message:e.pullErrorCode?Or(e.pullErrorCode):e.pullError}),i}function jr(e){return e?.checkStatus===`unknown`&&e.unknownError===`token-invalid`}function Mr(e,t=!1){if(t)return X._({id:`U6wmNc`});let n=yr(e);if(!e.syncEnabled&&!n)return X._({id:`kUn-CN`});let r=br(e);if(r===`conflict`&&e.conflictCount>0){let{conflictCount:t}=e;return X._({id:`cUK8lW`,values:{conflictCount:t}})}if(r===`idle`){let{ahead:t,behind:r}=e;return n?r>0?X._({id:`9o1bIV`,values:{behind:r}}):X._({id:`j5CWO4`}):t>0&&r>0?X._({id:`5F5HYj`,values:{ahead:t,behind:r}}):t>0?X._({id:`PdA9NZ`,values:{ahead:t}}):r>0?X._({id:`9o1bIV`,values:{behind:r}}):X._({id:`N2FcBE`})}return Cr(r,n)}function Nr(e){let t=(0,Z.c)(69),{status:n,onSignIn:r,onSetIdentity:i}=e,{_:a}=c(),{behind:o,conflictCount:l}=n,{projectLocalConfig:u,projectLocalSynced:d}=Le(),f=u?.autoSync,{active:p,paused:m,everEnabled:h,toggleMode:g,confirmOpen:_,setConfirmOpen:y,pendingMode:b,strandedCommitCount:x,onToggleActive:S,onModeSelect:C,onConfirm:w}=ae(f,n.ahead),T=H(f)??`off`,E=yr(n),D=br(n),O=vr(n.lastSyncUtc),k=!(n.pushPermission?.checkStatus===`denied`&&n.pushPermission.deniedReason!==`not-authenticated`),{conflicts:A}=zn(),j=A[0]??null,M=!m&&D===`conflict`&&j!==null,N=!m&&D===`auth-error`,P=h&&!M&&!N&&(m||D!==`dormant`),F=p&&T===`full`?`sync`:`pull`,z;t[0]!==m||t[1]!==n?(z=(0,$.jsx)(xr,{status:n,paused:m}),t[0]=m,t[1]=n,t[2]=z):z=t[2];let B=m?a({id:`U6wmNc`}):Cr(D,E),ee;t[3]===B?ee=t[4]:(ee=(0,$.jsx)(`span`,{className:`text-1sm font-medium truncate`,children:B}),t[3]=B,t[4]=ee);let V;t[5]!==z||t[6]!==ee?(V=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[z,ee]}),t[5]=z,t[6]=ee,t[7]=V):V=t[7];let U=!d,W;t[8]!==a||t[9]!==p?(W=a(p?{id:`MGBNwj`}:{id:`rn7n0G`}),t[8]=a,t[9]=p,t[10]=W):W=t[10];let G;t[11]!==p||t[12]!==S||t[13]!==U||t[14]!==W?(G=(0,$.jsx)(I,{checked:p,disabled:U,onCheckedChange:S,"aria-label":W}),t[11]=p,t[12]=S,t[13]=U,t[14]=W,t[15]=G):G=t[15];let K;t[16]!==V||t[17]!==G?(K=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[V,G]}),t[16]=V,t[17]=G,t[18]=K):K=t[18];let q=b??`full`,J;t[19]!==_||t[20]!==w||t[21]!==y||t[22]!==x||t[23]!==q?(J=(0,$.jsx)(oe,{open:_,onOpenChange:y,onConfirm:w,variant:q,strandedCommitCount:x}),t[19]=_,t[20]=w,t[21]=y,t[22]=x,t[23]=q,t[24]=J):J=t[24];let ne;t[25]!==a||t[26]!==p||t[27]!==E||t[28]!==r||t[29]!==m||t[30]!==n?(ne=m?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-paused-line`,children:(0,$.jsx)(s,{id:`PTb1Nx`})}):(0,$.jsxs)($.Fragment,{children:[Ar(n).map(e=>(0,$.jsx)(`p`,{className:`text-xs text-destructive`,children:e.direction===`push`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`font-medium`,children:[a({id:`uO9WLl`}),`: `]}),e.message]}):e.direction===`pull`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`font-medium`,children:[a({id:`e4GHWP`}),`: `]}),e.message]}):e.message},e.key)),!E&&Er(n.pushPermission)?(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground flex-1 min-w-0`,children:(0,$.jsx)(s,{id:`ycIX5i`})}),r&&(0,$.jsx)(v,{variant:`outline`,size:`xs`,className:`self-start`,onClick:r,children:(0,$.jsx)(s,{id:`5lWFkC`})})]}):n.pausedReason?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:wr(n.pausedReason)}):E?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-mode-line`,children:(0,$.jsx)(s,{id:`-imiMK`})}):p?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-mode-line`,children:(0,$.jsx)(s,{id:`iy64Li`})}):n.pushPermission?.checkStatus===`denied`?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:Tr(n.pushPermission.deniedReason)}):jr(n.pushPermission)?(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground flex-1 min-w-0`,children:(0,$.jsx)(s,{id:`C_cPoW`})}),r&&(0,$.jsx)(v,{variant:`outline`,size:`xs`,className:`self-start`,onClick:r,children:(0,$.jsx)(s,{id:`5lWFkC`})})]}):null]}),t[25]=a,t[26]=p,t[27]=E,t[28]=r,t[29]=m,t[30]=n,t[31]=ne):ne=t[31];let re;t[32]!==E||t[33]!==m||t[34]!==D?(re=!m&&D===`conflict`&&(0,$.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:E?(0,$.jsx)(s,{id:`ko386X`}):(0,$.jsx)(s,{id:`t2TkQ3`})}),t[32]=E,t[33]=m,t[34]=D,t[35]=re):re=t[35];let ie;t[36]!==a||t[37]!==n.remote?(ie=n.remote&&(0,$.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,$.jsx)(s,{id:`IreQBq`})}),n.remote.webUrl?(0,$.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-0.5 text-foreground hover:text-primary hover:underline`,"aria-label":a({id:`1nke1r`,values:{0:n.remote.label}}),children:[(0,$.jsx)(`span`,{className:`truncate`,children:n.remote.label}),(0,$.jsx)(ce,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,$.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:n.remote.label})]}),t[36]=a,t[37]=n.remote,t[38]=ie):ie=t[38];let se;t[39]!==p||t[40]!==o||t[41]!==E||t[42]!==n.behind?(se=p&&!E&&n.behind>0&&(0,$.jsx)(`div`,{children:(0,$.jsx)(s,{id:`YsEYYS`,values:{behind:o}})}),t[39]=p,t[40]=o,t[41]=E,t[42]=n.behind,t[43]=se):se=t[43];let le;t[44]!==l||t[45]!==n.conflictCount?(le=n.conflictCount>0&&(0,$.jsx)(`div`,{children:(0,$.jsx)(s,{id:`B4_ipX`,values:{conflictCount:l}})}),t[44]=l,t[45]=n.conflictCount,t[46]=le):le=t[46];let ue;t[47]!==a||t[48]!==k||t[49]!==C||t[50]!==g?(ue=k&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-0.5`,children:[(0,$.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,$.jsx)(s,{id:`zz_Wd_`})}),(0,$.jsxs)(R,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,value:g,onValueChange:e=>{te(e)&&C(e)},"aria-label":a({id:`CnOGgs`}),"data-testid":`sync-popover-mode-toggle`,children:[(0,$.jsx)(L,{value:`full`,"data-testid":`sync-popover-mode-full`,children:(0,$.jsx)(s,{id:`g2Tj8R`})}),(0,$.jsx)(L,{value:`follow`,"data-testid":`sync-popover-mode-follow`,children:(0,$.jsx)(s,{id:`MKEPCY`})})]})]}),t[47]=a,t[48]=k,t[49]=C,t[50]=g,t[51]=ue):ue=t[51];let Y;t[52]!==ie||t[53]!==se||t[54]!==le||t[55]!==ue?(Y=(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-2 border-t pt-3`,children:[ie,se,le,ue]}),t[52]=ie,t[53]=se,t[54]=le,t[55]=ue,t[56]=Y):Y=t[56];let de;t[57]!==i||t[58]!==m||t[59]!==n.identityUnresolved?(de=!m&&n.identityUnresolved&&i&&(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,$.jsx)(qe,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:(0,$.jsx)(s,{id:`nrGWJ7`})}),(0,$.jsx)(v,{variant:`outline`,size:`xs`,className:`self-start`,onClick:i,children:(0,$.jsx)(s,{id:`keNFEd`})})]})]}),t[57]=i,t[58]=m,t[59]=n.identityUnresolved,t[60]=de):de=t[60];let fe=(P||N||M||p&&D!==`dormant`)&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[p&&D!==`dormant`?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-last-sync`,children:a(E?{id:`4DcimZ`,values:{lastSyncedRelative:O}}:{id:`g85bAo`,values:{lastSyncedRelative:O}})}):(0,$.jsx)(`span`,{}),(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-1`,children:[P&&(0,$.jsx)(v,{variant:`outline`,size:`xs`,onClick:()=>_r(F),children:(0,$.jsx)(s,{id:`Nu4DdT`})}),N&&(0,$.jsx)(v,{variant:`outline`,size:`xs`,onClick:r,children:(0,$.jsx)(s,{id:`5lWFkC`})}),M&&j&&(0,$.jsx)(v,{variant:`outline`,size:`xs`,onClick:()=>{if(typeof window>`u`)return;let e=ke(je(j.file));window.location.hash!==e&&(window.location.hash=e)},children:(0,$.jsx)(s,{id:`0yL--g`})})]})]}),pe;return t[61]!==J||t[62]!==ne||t[63]!==re||t[64]!==Y||t[65]!==de||t[66]!==fe||t[67]!==K?(pe=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[K,J,ne,re,Y,de,fe]}),t[61]=J,t[62]=ne,t[63]=re,t[64]=Y,t[65]=de,t[66]=fe,t[67]=K,t[68]=pe):pe=t[68],pe}function Pr(e){let t=(0,Z.c)(74),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onSetIdentity:i}=n,{_:a}=c(),{status:o,fetchError:l}=re(),{projectLocalConfig:p}=Le(),m=p?.autoSync,h;t[2]===m?h=t[3]:(h=ee(m),t[2]=m,t[3]=h);let g=h,_=te(H(p?.autoSync));if(!o){if(l){let e;t[4]===a?e=t[5]:(e=a({id:`iqIDv4`}),t[4]=a,t[5]=e);let n;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(He,{className:`size-3.5`}),t[6]=n):n=t[6];let r;t[7]===e?r=t[8]:(r=(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":e,disabled:!0,children:n})}),t[7]=e,t[8]=r);let i;t[9]===l?i=t[10]:(i=(0,$.jsx)(b,{children:l===`network`?(0,$.jsx)(s,{id:`I5AfhE`}):(0,$.jsx)(s,{id:`uKRYiW`})}),t[9]=l,t[10]=i);let o;return t[11]!==r||t[12]!==i?(o=(0,$.jsxs)(x,{children:[r,i]}),t[11]=r,t[12]=i,t[13]=o):o=t[13],o}return null}if(o.state===`dormant`&&!o.hasRemote||o.state===`disabled`&&!o.pausedReason&&o.syncMode!==`follow`&&!g&&!_)return null;let S;t[14]!==g||t[15]!==o?(S=g?``:Sr(o),t[14]=g,t[15]=o,t[16]=S):S=t[16];let C=S,w,T,E,D,O,k,A,j,M,N,P,F;if(t[17]!==a||t[18]!==g||t[19]!==o){let e=g?a({id:`U6wmNc`}):Cr(br(o),yr(o));k=!!o.identityUnresolved,O=u,D=x,E=y,A=!0,T=d,F=!0,w=v,j=`ghost`,M=`icon-sm`,N=`text-muted-foreground relative`,P=a(k?{id:`DFfRbX`,values:{syncStateLabel:e}}:{id:`F4vEsL`,values:{syncStateLabel:e}}),t[17]=a,t[18]=g,t[19]=o,t[20]=w,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k,t[26]=A,t[27]=j,t[28]=M,t[29]=N,t[30]=P,t[31]=F}else w=t[20],T=t[21],E=t[22],D=t[23],O=t[24],k=t[25],A=t[26],j=t[27],M=t[28],N=t[29],P=t[30],F=t[31];let I;t[32]!==g||t[33]!==o?(I=(0,$.jsx)(xr,{status:o,paused:g}),t[32]=g,t[33]=o,t[34]=I):I=t[34];let L;t[35]===C?L=t[36]:(L=C&&(0,$.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:C}),t[35]=C,t[36]=L);let R;t[37]!==C||t[38]!==k?(R=!C&&k&&(0,$.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[37]=C,t[38]=k,t[39]=R):R=t[39];let z;t[40]!==w||t[41]!==I||t[42]!==L||t[43]!==R||t[44]!==j||t[45]!==M||t[46]!==N||t[47]!==P?(z=(0,$.jsxs)(w,{variant:j,size:M,className:N,"aria-label":P,children:[I,L,R]}),t[40]=w,t[41]=I,t[42]=L,t[43]=R,t[44]=j,t[45]=M,t[46]=N,t[47]=P,t[48]=z):z=t[48];let B;t[49]!==T||t[50]!==z||t[51]!==F?(B=(0,$.jsx)(T,{asChild:F,children:z}),t[49]=T,t[50]=z,t[51]=F,t[52]=B):B=t[52];let V;t[53]!==E||t[54]!==A||t[55]!==B?(V=(0,$.jsx)(E,{asChild:A,children:B}),t[53]=E,t[54]=A,t[55]=B,t[56]=V):V=t[56];let U;t[57]!==g||t[58]!==o?(U=Mr(o,g),t[57]=g,t[58]=o,t[59]=U):U=t[59];let W;t[60]===U?W=t[61]:(W=(0,$.jsx)(b,{children:U}),t[60]=U,t[61]=W);let G;t[62]!==D||t[63]!==V||t[64]!==W?(G=(0,$.jsxs)(D,{children:[V,W]}),t[62]=D,t[63]=V,t[64]=W,t[65]=G):G=t[65];let K;t[66]!==i||t[67]!==r||t[68]!==o?(K=(0,$.jsx)(f,{align:`end`,className:`w-80 p-3`,children:(0,$.jsx)(Nr,{status:o,onSignIn:r,onSetIdentity:i})}),t[66]=i,t[67]=r,t[68]=o,t[69]=K):K=t[69];let q;return t[70]!==O||t[71]!==G||t[72]!==K?(q=(0,$.jsxs)(O,{children:[G,K]}),t[70]=O,t[71]=G,t[72]=K,t[73]=q):q=t[73],q}function Fr(e){let t=e.trim();return t.length===0?{kind:`blank`,raw:e}:t.startsWith(`#`)?{kind:`comment`,raw:e}:{kind:`pattern`,raw:e,text:t}}function Ir(e){return{lines:e.split(`
|
|
9
|
+
`;function qt(e){let t=(0,Z.c)(12),{folderPath:n,existingNames:r,open:i,onOpenChange:a,onCreated:o}=e,s;t[0]!==r||t[1]!==n||t[2]!==o||t[3]!==a||t[4]!==i?(s=i?(0,$.jsx)(Jt,{folderPath:n,existingNames:r,onOpenChange:a,onCreated:o}):null,t[0]=r,t[1]=n,t[2]=o,t[3]=a,t[4]=i,t[5]=s):s=t[5];let c;t[6]===s?c=t[7]:(c=(0,$.jsx)(w,{className:`sm:max-w-3xl max-h-[85vh] flex flex-col`,children:s}),t[6]=s,t[7]=c);let l;return t[8]!==a||t[9]!==i||t[10]!==c?(l=(0,$.jsx)(O,{open:i,onOpenChange:a,children:c}),t[8]=a,t[9]=i,t[10]=c,t[11]=l):l=t[11],l}function Jt(e){let t=(0,Z.c)(31),{folderPath:n,existingNames:r,onOpenChange:i,onCreated:a}=e,o;t[0]!==a||t[1]!==i?(o=e=>{a(e),i(!1)},t[0]=a,t[1]=i,t[2]=o):o=t[2];let c;t[3]!==r||t[4]!==n||t[5]!==o?(c={mode:`create`,folderPath:n,initial:Gt,existingNames:r,onCommitted:o},t[3]=r,t[4]=n,t[5]=o,t[6]=c):c=t[6];let l=zt(c),u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(C,{children:(0,$.jsx)(s,{id:`G1Gw0v`})}),t[7]=u):u=t[7];let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsxs)(D,{children:[u,(0,$.jsx)(S,{children:(0,$.jsx)(s,{id:`NUr4kz`})})]}),t[8]=d):d=t[8];let f;t[9]===l?f=t[10]:(f=(0,$.jsx)(T,{children:(0,$.jsx)(Vt,{form:l,bodyPlaceholder:Kt})}),t[9]=l,t[10]=f);let p;t[11]===i?p=t[12]:(p=()=>i(!1),t[11]=i,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(s,{id:`dEgA5A`}),t[13]=m):m=t[13];let h;t[14]!==l.isSaving||t[15]!==p?(h=(0,$.jsx)(v,{variant:`outline`,className:`font-mono uppercase`,onMouseDown:Yt,onClick:p,disabled:l.isSaving,children:m}),t[14]=l.isSaving,t[15]=p,t[16]=h):h=t[16];let g;t[17]===l?g=t[18]:(g=()=>void l.submit(),t[17]=l,t[18]=g);let _;t[19]===l.isSaving?_=t[20]:(_=l.isSaving?(0,$.jsx)(s,{id:`E9bKSA`}):(0,$.jsx)(s,{id:`A5hiCy`}),t[19]=l.isSaving,t[20]=_);let y;t[21]!==l.isSaving||t[22]!==_||t[23]!==g?(y=(0,$.jsx)(v,{onClick:g,disabled:l.isSaving,children:_}),t[21]=l.isSaving,t[22]=_,t[23]=g,t[24]=y):y=t[24];let b;t[25]!==y||t[26]!==h?(b=(0,$.jsxs)(E,{children:[h,y]}),t[25]=y,t[26]=h,t[27]=b):b=t[27];let x;return t[28]!==b||t[29]!==f?(x=(0,$.jsxs)($.Fragment,{children:[d,f,b]}),t[28]=b,t[29]=f,t[30]=x):x=t[30],x}function Yt(e){return e.preventDefault()}function Xt(e){let t=(0,Z.c)(16),{template:n,onOpenChange:r,onDeleted:i}=e,{_:a}=c(),[o,s]=(0,Q.useState)(!1),l;t[0]!==a||t[1]!==i||t[2]!==r?(l=async function(e){s(!0);let t=await me(e.source_folder,e.name);if(s(!1),!t.ok){let{error:e}=t;De.error(a({id:`36WXSC`,values:{error:e}}));return}let n=e.title??e.name;De.success(a({id:`ErRi6L`,values:{label:n}})),i(),r(!1)},t[0]=a,t[1]=i,t[2]=r,t[3]=l):l=t[3];let u=l,d=n!==null,f;t[4]!==o||t[5]!==r?(f=e=>{!e&&!o&&r(!1)},t[4]=o,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==a||t[8]!==o||t[9]!==u||t[10]!==n?(p=n?(()=>{let{name:e,path:t,scope:r}=n,i=r===`inherited`?`\n\n${a({id:`8uAWix`})}`:``;return(0,$.jsx)(g,{itemName:a({id:`XfzqjK`,values:{name:e}}),isSubmitting:o,onDelete:()=>u(n),customDescription:`${a({id:`5LXwX8`,values:{path:t}})}${i}`})})():null,t[7]=a,t[8]=o,t[9]=u,t[10]=n,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,$.jsx)(O,{open:d,onOpenChange:f,children:p}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function Zt(e){let t=(0,Z.c)(45),{template:n,onEdit:r,onDelete:i,onCreate:o,badge:l}=e,{_:u}=c(),d=n.title??n.name,f=!!(n.title&&n.title!==n.name),p;t[0]===d?p=t[1]:(p=(0,$.jsx)(`span`,{className:`truncate font-medium`,children:d}),t[0]=d,t[1]=p);let m;t[2]!==f||t[3]!==n.name?(m=f?(0,$.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:n.name}):null,t[2]=f,t[3]=n.name,t[4]=m):m=t[4];let g;t[5]===l?g=t[6]:(g=l?(0,$.jsx)(`span`,{className:`ml-auto shrink-0`,children:l}):null,t[5]=l,t[6]=g);let y;t[7]!==p||t[8]!==m||t[9]!==g?(y=(0,$.jsxs)(`span`,{className:`flex w-full items-center gap-2`,children:[p,m,g]}),t[7]=p,t[8]=m,t[9]=g,t[10]=y):y=t[10];let b;t[11]===n.description?b=t[12]:(b=n.description?(0,$.jsx)(`span`,{className:`w-full truncate text-sm text-muted-foreground`,children:n.description}):null,t[11]=n.description,t[12]=b);let x;t[13]!==r||t[14]!==y||t[15]!==b?(x=(0,$.jsxs)(v,{type:`button`,variant:`ghost`,onClick:r,className:`h-auto min-w-0 flex-1 flex-col items-start gap-0.5 px-1.5 py-1 text-left font-normal hover:bg-transparent`,children:[y,b]}),t[13]=r,t[14]=y,t[15]=b,t[16]=x):x=t[16];let S;t[17]!==u||t[18]!==d||t[19]!==o?(S=o?(0,$.jsxs)(v,{type:`button`,variant:`ghost`,size:`sm`,className:`shrink-0 font-mono uppercase opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:o,"aria-label":u({id:`mZ1r4i`,values:{label:d}}),children:[(0,$.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(s,{id:`hYgDIe`})]}):null,t[17]=u,t[18]=d,t[19]=o,t[20]=S):S=t[20];let C;t[21]!==u||t[22]!==d?(C=u({id:`Bx4EXG`,values:{label:d}}),t[21]=u,t[22]=d,t[23]=C):C=t[23];let w;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,$.jsx)(A,{asChild:!0,children:(0,$.jsx)(v,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,"aria-label":C,children:w})}),t[25]=C,t[26]=T);let E,D;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(a,{"aria-hidden":!0}),D=(0,$.jsx)(s,{id:`ePK91l`}),t[27]=E,t[28]=D):(E=t[27],D=t[28]);let O;t[29]===r?O=t[30]:(O=(0,$.jsxs)(k,{onSelect:r,children:[E,D]}),t[29]=r,t[30]=O);let N,P;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(we,{"aria-hidden":!0}),P=(0,$.jsx)(s,{id:`cnGeoo`}),t[31]=N,t[32]=P):(N=t[31],P=t[32]);let F;t[33]===i?F=t[34]:(F=(0,$.jsxs)(k,{variant:`destructive`,onSelect:i,children:[N,P]}),t[33]=i,t[34]=F);let I;t[35]!==O||t[36]!==F?(I=(0,$.jsxs)(j,{align:`end`,className:`min-w-52`,children:[O,F]}),t[35]=O,t[36]=F,t[37]=I):I=t[37];let L;t[38]!==T||t[39]!==I?(L=(0,$.jsxs)(M,{modal:!1,children:[T,I]}),t[38]=T,t[39]=I,t[40]=L):L=t[40];let R;return t[41]!==L||t[42]!==x||t[43]!==S?(R=(0,$.jsxs)(`li`,{className:`group flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-muted/50`,children:[x,S,L]}),t[41]=L,t[42]=x,t[43]=S,t[44]=R):R=t[44],R}function Qt(){let e=(0,Z.c)(8),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(0),[o,s]=(0,Q.useState)(!1),c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/skill-targets`).then(en).then(t=>{if(e)return;let n=z.safeParse(t);if(!n.success){console.error(`[ok-skills] /api/skill-targets response failed schema validation:`,n.error.issues),r({status:`error`,message:`Server returned an incomplete skill-targets response.`});return}r({status:`ready`,data:n.data})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[1]=c):c=e[1];let l;e[2]===i?l=e[3]:(l=[i],e[2]=i,e[3]=l),(0,Q.useEffect)(c,l);let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=async e=>{s(!0);let t=await Ie(e);if(!t.ok)throw s(!1),Error(t.error);Pe(),a($t),s(!1)},e[4]=u):u=e[4];let d=u,f;return e[5]!==o||e[6]!==n?(f={state:n,saving:o,folderAction:d},e[5]=o,e[6]=n,e[7]=f):f=e[7],f}function $t(e){return e+1}async function en(e){if(!e.ok){let t=await e.json().catch(tn);throw Error(Me(t)??`HTTP ${e.status}`)}return e.json()}function tn(){return null}var nn=`claude-cowork`,rn=`ok:skill:cowork:installed:v`,an=250,on=`/api/skill/install-state`,sn=null,cn=new Set,ln=null,un=!1,dn=()=>{Cn(jn())},fn=e=>{e.key?.startsWith(rn)&&Cn(jn())};function pn(){un||typeof window>`u`||(window.addEventListener(`focus`,dn),window.addEventListener(`storage`,fn),un=!0)}function mn(){un&&(typeof window>`u`||(window.removeEventListener(`focus`,dn),window.removeEventListener(`storage`,fn),un=!1))}var hn=!1,gn=!1,_n=!1,vn=!1,yn=!1,bn=!1,xn=!1;async function Sn(e){let t=!0;if(e.detectClaudeDesktop)try{t=await e.detectClaudeDesktop()}catch(e){t=!0,hn||(hn=!0,console.warn(`[claude-desktop-integration] detectClaudeDesktop IPC rejected — falling back to desktopPresent=true`,e))}let n=await e.fetchSnapshot();if(n){let e=n.targets?.[nn]??null;return e?.version?{desktopPresent:t,skillInstalled:!0,skillVersion:e.version}:{desktopPresent:t,skillInstalled:!1,skillVersion:null}}let r=e.readLocalStorageGuard();return{desktopPresent:t,skillInstalled:r.skillInstalled,skillVersion:r.skillVersion}}async function Cn(e){return ln||(ln=(async()=>{try{sn=await Sn(e);for(let e of cn)try{e()}catch(e){console.error(`[claude-desktop-integration] subscriber threw`,e)}}catch(e){console.error(`[claude-desktop-integration] probe rejected unexpectedly`,e)}finally{ln=null}})(),ln)}function wn(e){return cn.size===0&&pn(),cn.add(e),()=>{cn.delete(e),cn.size===0&&mn()}}function Tn(){return sn}function En(){if(typeof window>`u`)return;let e=window.okDesktop?.skill,t=e?.detectClaudeDesktop;if(t)return()=>t.call(e)}function Dn(e){let t=e?.timeoutMs??an,n=e?.fetchImpl??(typeof fetch<`u`?fetch:void 0);return async()=>{if(!n)return null;let e;try{let r=new AbortController,i=setTimeout(()=>r.abort(),t);try{e=await n(on,{method:`GET`,cache:`no-store`,signal:r.signal})}finally{clearTimeout(i)}}catch(e){let n=e instanceof DOMException&&e.name===`AbortError`;return n&&!_n?(_n=!0,console.warn(`[claude-desktop-integration] fetch ${on} timed out (>${t}ms) — falling back to localStorage guard`)):!n&&!gn&&(gn=!0,console.warn(`[claude-desktop-integration] fetch ${on} failed — falling back to localStorage guard`,e)),null}if(!e.ok)return vn||(vn=!0,console.warn(`[claude-desktop-integration] ${on} returned ${e.status} ${e.statusText} — falling back to localStorage guard`)),null;let r;try{r=await e.json()}catch(e){return yn||(yn=!0,console.warn(`[claude-desktop-integration] ${on} returned unparseable JSON — falling back to localStorage guard`,e)),null}return On(r)}}function On(e){if(typeof e!=`object`||!e)return kn(`not an object`);let t=e;if(typeof t.currentVersion!=`string`||t.currentVersion===``)return kn(`currentVersion not a non-empty string`);if(t.targets!==void 0){if(t.targets===null||typeof t.targets!=`object`)return kn(`targets not object`);for(let[,e]of Object.entries(t.targets)){if(e==null)continue;if(typeof e!=`object`)return kn(`target entry not object`);let t=e;if(typeof t.version!=`string`||t.version===``)return kn(`target.version not a non-empty string`)}}return t}function kn(e){return bn||(bn=!0,console.warn(`[claude-desktop-integration] ${on} response failed shape validation (${e}) — falling back to localStorage guard`)),null}function An(){if(typeof localStorage>`u`)return{skillInstalled:!1,skillVersion:null};try{for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);if(t?.startsWith(rn))return{skillInstalled:!0,skillVersion:t.slice(27)}}}catch(e){xn||(xn=!0,console.warn(`[claude-desktop-integration] localStorage scan threw — falling back to skillInstalled=false`,e))}return{skillInstalled:!1,skillVersion:null}}function jn(){return{detectClaudeDesktop:En(),fetchSnapshot:Dn(),readLocalStorageGuard:An}}function Mn(){let e=(0,Z.c)(5),t=(0,Q.useSyncExternalStore)(wn,Tn,Tn),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],e[0]=n):n=e[0],(0,Q.useEffect)(Pn,n);let r=t?.desktopPresent??!0,i=t?.skillInstalled??!1,a=t?.skillVersion??null,o;return e[1]!==r||e[2]!==i||e[3]!==a?(o={desktopPresent:r,skillInstalled:i,skillVersion:a,refresh:Nn},e[1]=r,e[2]=i,e[3]=a,e[4]=o):o=e[4],o}function Nn(){Cn(jn())}function Pn(){sn||Cn(jn())}var Fn=[{path:[`appearance`,`theme`],label:{id:`FEr96N`},description:{id:`JZ8cO6`},control:`enum-toggle`},{path:[`editor`,`wordWrap`],label:{id:`iKSP5j`},description:{id:`mmpzAq`}},{path:[`editor`,`previewTabs`],label:{id:`drzzZw`},description:{id:`AIC67-`}},{path:[`appearance`,`preview`,`autoOpen`],label:{id:`2XQ8Ww`},description:{id:`bultyE`}},{path:[`telemetry`,`skillInstallReports`,`enabled`],label:{id:`2jUGEP`},description:{id:`Ns0z5o`}}],In=[{path:[`appearance`,`colorTheme`],label:{id:`rFmBG3`},description:{id:`Pck6eI`},control:`theme-tiles`}],Ln=[{sectionId:`preferences`,fields:Fn},{sectionId:`plugin:theme`,fields:In}];async function Rn(){try{let e=await fetch(`/api/sync/conflicts`);return e.ok?{conflicts:(await e.json()).conflicts??[]}:(console.warn(JSON.stringify({event:`conflicts-fetch-failed`,status:e.status})),{conflicts:[],error:`server`})}catch(e){return console.warn(JSON.stringify({event:`conflicts-fetch-failed`,status:null,detail:e instanceof Error?e.message:String(e)})),{conflicts:[],error:`network`}}}function zn(){let e=(0,Z.c)(10),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(0),l;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=function(){let e=c.current+=1;Rn().then(t=>{let{conflicts:n,error:i}=t;e===c.current&&(r(n),s(i??null),a(!1))})},e[1]=l):l=e[1];let u=l,d,f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{u()},f=[],e[2]=d,e[3]=f):(d=e[2],f=e[3]),(0,Q.useEffect)(d,f);let p,m;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>Ne(e=>{e.includes(`sync-status`)&&u()}),m=[],e[4]=p,e[5]=m):(p=e[4],m=e[5]),(0,Q.useEffect)(p,m);let h;return e[6]!==n||e[7]!==o||e[8]!==i?(h={conflicts:n,loading:i,error:o},e[6]=n,e[7]=o,e[8]=i,e[9]=h):h=e[9],h}function Bn(e){if(!e)return``;let t=e.replace(/[/\\]+$/g,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?t:t.slice(n+1)}var Vn=`/api/share/construct-url`;function Hn(e){return{kind:`doc`,docName:e}}function Un(e){return{kind:`folder`,folderRelativePath:e}}var Wn=`Could not construct share URL.`,Gn=`Link ready but could not copy to clipboard.`;async function Kn(e,t=fetch){let n=await t(Vn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(`construct-url transport ${n.status}`);let r=await n.json(),i=K.safeParse(r);if(!i.success)throw Error(`construct-url response shape mismatch`);return i.data}function qn(e,t){switch(e){case`detached-head`:return`Switch to a branch to share.`;case`branch-not-on-origin`:return t?`Push ${t} to GitHub before sharing.`:`Push this branch to GitHub before sharing.`;case`non-github-remote`:return`Sharing supports GitHub remotes only.`;case`invalid-path`:return`Can't share this path.`;case`no-remote`:return`This project has no GitHub remote.`}}async function Jn(e,t){if(!e.hasRemote)return e.onClickWhenNoRemote(),{kind:`opened-wizard`};let n=e.kind===`folder`?{kind:`folder`,folderPath:e.folderRelativePath}:{kind:`doc`,docPath:Ae(e.docName)},r;try{r=await Kn(n,t.fetchFn)}catch{return t.toastError(Wn),{kind:`transport-error`}}if(r.ok){try{await t.clipboardWrite(r.shareUrl)}catch{return t.toastError(Gn),t.logEvent(`[share] action=link-construct result=clipboard-failed`),{kind:`clipboard-failed`,shareUrl:r.shareUrl,freshness:r.freshness}}return t.toastSuccess(e.kind===`folder`?`Folder share link copied.`:`Link copied.`),t.logEvent(`[share] action=link-construct`),{kind:`copied`,shareUrl:r.shareUrl,branch:r.branch,freshness:r.freshness}}if(r.error===`no-remote`)return e.onClickWhenNoRemote(),{kind:`opened-wizard`};let i=r.branch;return t.toastError(qn(r.error,i)),{kind:`business-error`,error:r.error,branch:i}}var Yn=`/api/share/publish/owners`,Xn=`/api/share/publish/name-check`,Zn=`/api/share/publish`,Qn=/[A-Za-z0-9._-]/g;function $n(e){return(e.match(Qn)?.join(``)??``).replace(/[-.]{2,}/g,e=>e[0]??`-`).replace(/^[-.]+/,``).replace(/[-.]+$/,``)}function er(e){return e.find(e=>e.kind===`org`)?.login??e[0]?.login??``}function tr(e){return`https://github.com/orgs/${encodeURIComponent(e)}/policies/applications`}function nr(e,t,n){switch(e){case`name-conflict`:return{banner:`${t}/${n} already exists. Pick a different name.`,next:{kind:`edit-name`}};case`saml-sso`:return{banner:`GitHub denied the request. You may need to authorize OpenKnowledge for ${t} in your browser.`,next:{kind:`authorize-org`,authorizeUrl:tr(t)}};case`push-failed`:return{banner:`Created ${t}/${n}, push failed.`,next:{kind:`retry-push`}};case`auth-required`:return{banner:`GitHub connection expired. Connect again to continue.`,next:{kind:`reauth`}};case`init-failed`:return{banner:`Couldn't prepare this project for publish.`,next:{kind:`edit-form`}};case`network`:return{banner:`Couldn't reach GitHub. Try again?`,next:{kind:`edit-form`}};case`no-project`:return{banner:`Open a project first.`,next:{kind:`edit-form`}}}}async function rr(e=fetch){let t=await e(Yn,{method:`GET`});if(!t.ok)throw Error(`owners transport ${t.status}`);let n=await t.json(),r=B.safeParse(n);if(!r.success)throw Error(`owners response shape mismatch`);return r.data}async function ir(e,t,n=fetch){let r=await n(`${Xn}?owner=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`,{method:`GET`});if(!r.ok)throw Error(`name-check transport ${r.status}`);let i=await r.json(),a=V.safeParse(i);if(!a.success)throw Error(`name-check response shape mismatch`);return a.data}async function ar(e,t=fetch){let n=await t(Zn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(`publish transport ${n.status}`);let r=await n.json(),i=G.safeParse(r);if(!i.success)throw Error(`publish response shape mismatch`);return i.data}function or(e,t,n){return e.ok?e.available?{kind:`available`}:{kind:`taken`,owner:t,name:n}:e.error===`auth-required`?{kind:`error`,banner:`GitHub connection expired. Connect again to continue.`}:{kind:`error`,banner:`Couldn't reach GitHub. Try again?`}}function sr(e){return e.submitting||e.owner===null||e.sanitizedName.length===0?!1:e.nameCheck.kind===`available`}var cr=500;function lr(e){let t=(0,Z.c)(69),{open:n,onOpenChange:r}=e,{_:a}=c(),o=m(),{activeDocName:l}=i(),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(`private`),[j,M]=(0,Q.useState)(``),I;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(I={kind:`idle`},t[0]=I):I=t[0];let[L,R]=(0,Q.useState)(I),[z,B]=(0,Q.useState)(!1),[ee,V]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(!1),[W,G]=(0,Q.useState)(null),[K,q]=(0,Q.useState)(!1),[J,te]=(0,Q.useState)(null),[ne,re]=(0,Q.useState)(null),ie=(0,Q.useRef)(null),ae=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),se;t[1]===b?se=t[2]:(se=$n(b),t[1]=b,t[2]=se);let ce=se,le=u?.find(e=>e.login===_)??null,ue;t[3]!==a||t[4]!==_?(ue=async function(){p(!0),g(null);try{let e=await rr();if(!e.ok){e.error===`auth-required`?(U(!0),g(a({id:`6cyguR`}))):g(a({id:`UVLlMV`})),p(!1);return}d(e.owners),e.owners.length>0&&_===``&&y(er(e.owners))}catch{g(a({id:`UVLlMV`}))}p(!1)},t[3]=a,t[4]=_,t[5]=ue):ue=t[5];let Y=ue,de;t[6]!==Y||t[7]!==n||t[8]!==u||t[9]!==_||t[10]!==o?.contentDir?(de=()=>{n&&(R({kind:`idle`}),V(null),B(!1),g(null),G(null),q(!1),te(null),re(null),x($n(Bn(o?.contentDir??``))),A(`private`),M(``),u===null?Y():_===``&&u.length>0&&y(er(u)))},t[6]=Y,t[7]=n,t[8]=u,t[9]=_,t[10]=o?.contentDir,t[11]=de):de=t[11];let fe;t[12]===n?fe=t[13]:(fe=[n],t[12]=n,t[13]=fe),(0,Q.useEffect)(de,fe);let pe,me;t[14]!==a||t[15]!==n||t[16]!==ce||t[17]!==_?(pe=()=>{if(n){if(ie.current!==null&&clearTimeout(ie.current),_===``||ce===``){R({kind:`idle`});return}return R({kind:`pending`}),ie.current=setTimeout(async()=>{let e=_,t=ce;ae.current=`${e}|${t}`,R({kind:`checking`});try{let n=await ir(e,t);if(ae.current!==`${e}|${t}`)return;R(or(n,e,t))}catch{if(ae.current!==`${e}|${t}`)return;R({kind:`error`,banner:a({id:`UVLlMV`})})}},cr),()=>{ie.current!==null&&(clearTimeout(ie.current),ie.current=null)}}},me=[n,_,ce,a],t[14]=a,t[15]=n,t[16]=ce,t[17]=_,t[18]=pe,t[19]=me):(pe=t[18],me=t[19]),(0,Q.useEffect)(pe,me);let ge,_e;t[20]!==a||t[21]!==l||t[22]!==W?(ge=()=>{if(!W||!l)return;let e=!1;return(async()=>{try{let t=await Kn({kind:`doc`,docPath:Ae(l)});if(e)return;t.ok?te(t.shareUrl):re(qn(t.error,t.branch))}catch(t){let n=t;if(e)return;console.warn(`[share] action=prefetch-share-url result=failed`,n),re(a({id:`J6N5MX`}))}})(),()=>{e=!0}},_e=[W,l,a],t[20]=a,t[21]=l,t[22]=W,t[23]=ge,t[24]=_e):(ge=t[23],_e=t[24]),(0,Q.useEffect)(ge,_e);let ve;t[25]===Y?ve=t[26]:(ve=function(){U(!1),g(null),Y()},t[25]=Y,t[26]=ve);let we=ve,Te=async function(){if(sr({owner:le,sanitizedName:ce,nameCheck:L,submitting:z})){B(!0),V(null);try{let e=await ar({owner:_,name:ce,visibility:k,description:j.trim().length>0?j.trim():void 0});if(e.ok){G({ownerLogin:e.ownerLogin,repoName:e.repoName}),B(!1);return}let t=nr(e.error,_,ce);V({message:t.banner,next:t.next}),t.next.kind===`edit-name`?(oe.current?.focus(),oe.current?.select()):t.next.kind===`reauth`&&U(!0)}catch{V({message:a({id:`UVLlMV`}),next:{kind:`edit-form`}})}B(!1)}},Ee;t[27]!==a||t[28]!==K||t[29]!==r||t[30]!==J?(Ee=function(){!J||K||(q(!0),Be(J).then(()=>{De.success(a({id:`c1LZZH`})),r(!1)}).catch(e=>{if(console.warn(`[share] action=link-construct result=clipboard-failed`,e),Ve(e)&&window.self!==window.top){De.error(a({id:`Dub54T`}));return}De.error(a({id:`MQIM_Y`}))}).finally(()=>{q(!1)}))},t[27]=a,t[28]=K,t[29]=r,t[30]=J,t[31]=Ee):Ee=t[31];let X=Ee,ke;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ke=function(e){let t=window.okDesktop?.shell?.openExternal;t?t(e):window.open(e,`_blank`,`noopener`)},t[32]=ke):ke=t[32];let je=ke,Me;t[33]===r?Me=t[34]:(Me=function(){r(!1)},t[33]=r,t[34]=Me);let Ne=Me,Pe=!sr({owner:le,sanitizedName:ce,nameCheck:L,submitting:z}),Fe;t[35]!==a||t[36]!==l||t[37]!==ee||t[38]!==K||t[39]!==j||t[40]!==je||t[41]!==Ne||t[42]!==X||t[43]!==Te||t[44]!==Y||t[45]!==b||t[46]!==L||t[47]!==u||t[48]!==h||t[49]!==f||t[50]!==W||t[51]!==ce||t[52]!==_||t[53]!==J||t[54]!==ne||t[55]!==Pe||t[56]!==z||t[57]!==k?(Fe=(0,$.jsx)(w,{className:`sm:max-w-lg`,showCloseButton:!1,children:W?(0,$.jsx)(dr,{ownerLogin:W.ownerLogin,repoName:W.repoName,shareUrl:J,shareUrlError:ne,copying:K,canCopy:l!==null,onCopy:X,onClose:Ne}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[(0,$.jsx)(C,{children:(0,$.jsx)(s,{id:`qXsafh`})}),(0,$.jsx)(S,{children:(0,$.jsx)(s,{id:`Z1LF1M`})})]}),(0,$.jsxs)(T,{className:`flex flex-col gap-6`,children:[(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(N,{id:`publish-owner-label`,children:(0,$.jsx)(s,{id:`LtI9AS`})}),f&&u===null?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(he,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`Z3FXyt`})]}):h?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm text-destructive`,children:h}),(0,$.jsx)(v,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>Y(),children:(0,$.jsx)(s,{id:`6gRgw8`})})]}):(0,$.jsx)(F,{value:_,onValueChange:y,"aria-labelledby":`publish-owner-label`,"data-testid":`publish-owner-radio`,children:(u??[]).map(ur)})]}),(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(N,{htmlFor:`publish-name`,children:(0,$.jsx)(s,{id:`0xnmlQ`})}),(0,$.jsx)(Oe,{id:`publish-name`,ref:oe,"data-testid":`publish-name`,value:b,onChange:e=>x(e.target.value),onBlur:()=>{ae.current=null},placeholder:`my-knowledge-base`,autoComplete:`off`,spellCheck:!1}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-1sm`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:ce?(0,$.jsx)(s,{id:`Nn4GgW`,values:{sanitizedName:ce},components:{0:(0,$.jsx)(`code`,{className:`font-mono`})}}):(0,$.jsx)(s,{id:`Oxyd5f`})}),(0,$.jsx)(gr,{status:L})]})]}),(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(N,{id:`publish-visibility-label`,children:(0,$.jsx)(s,{id:`2q_Q7x`})}),(0,$.jsxs)(F,{value:k,onValueChange:e=>A(e===`public`?`public`:`private`),className:`sm:flex`,"aria-labelledby":`publish-visibility-label`,children:[(0,$.jsx)(be,{htmlFor:`publish-visibility-private`,children:(0,$.jsxs)(Ce,{orientation:`horizontal`,children:[(0,$.jsxs)(ye,{children:[(0,$.jsx)(Se,{children:(0,$.jsx)(s,{id:`zwBp5t`})}),(0,$.jsx)(xe,{className:`text-1sm`,children:(0,$.jsx)(s,{id:`D8OV7J`})})]}),(0,$.jsx)(P,{value:`private`,id:`publish-visibility-private`,"data-testid":`publish-visibility-private`})]})}),(0,$.jsx)(be,{htmlFor:`publish-visibility-public`,children:(0,$.jsxs)(Ce,{orientation:`horizontal`,children:[(0,$.jsxs)(ye,{children:[(0,$.jsx)(Se,{children:(0,$.jsx)(s,{id:`7d1a0d`})}),(0,$.jsx)(xe,{className:`text-1sm`,children:(0,$.jsx)(s,{id:`4jDd0j`})})]}),(0,$.jsx)(P,{value:`public`,id:`publish-visibility-public`,"data-testid":`publish-visibility-public`})]})})]})]}),(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(N,{htmlFor:`publish-description`,children:(0,$.jsx)(s,{id:`Fxf4jq`})}),(0,$.jsx)(ze,{id:`publish-description`,"data-testid":`publish-description`,rows:2,value:j,onChange:e=>M(e.target.value),placeholder:a({id:`c5rF4v`})})]}),ee&&(0,$.jsx)(hr,{banner:ee,onAuthorize:je,onRetryPush:Te})]}),(0,$.jsxs)(E,{children:[(0,$.jsx)(v,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:Ne,children:(0,$.jsx)(s,{id:`dEgA5A`})}),(0,$.jsx)(v,{type:`button`,onClick:Te,disabled:Pe,"data-testid":`publish-submit`,children:z?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(he,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`Bdha5y`})]}):(0,$.jsx)(s,{id:`EEYbdt`})})]})]})}),t[35]=a,t[36]=l,t[37]=ee,t[38]=K,t[39]=j,t[40]=je,t[41]=Ne,t[42]=X,t[43]=Te,t[44]=Y,t[45]=b,t[46]=L,t[47]=u,t[48]=h,t[49]=f,t[50]=W,t[51]=ce,t[52]=_,t[53]=J,t[54]=ne,t[55]=Pe,t[56]=z,t[57]=k,t[58]=Fe):Fe=t[58];let Ie;t[59]!==r||t[60]!==n||t[61]!==Fe?(Ie=(0,$.jsx)(O,{open:n,onOpenChange:r,children:Fe}),t[59]=r,t[60]=n,t[61]=Fe,t[62]=Ie):Ie=t[62];let Le;t[63]!==H||t[64]!==we?(Le=(0,$.jsx)(kt,{open:H,onOpenChange:U,onSuccess:we}),t[63]=H,t[64]=we,t[65]=Le):Le=t[65];let Re;return t[66]!==Ie||t[67]!==Le?(Re=(0,$.jsxs)($.Fragment,{children:[Ie,Le]}),t[66]=Ie,t[67]=Le,t[68]=Re):Re=t[68],Re}function ur(e){let t=`publish-owner-${e.login}`;return(0,$.jsx)(be,{htmlFor:t,children:(0,$.jsxs)(Ce,{orientation:`horizontal`,children:[(0,$.jsx)(ye,{children:(0,$.jsxs)(Se,{children:[e.avatarUrl?(0,$.jsx)(`img`,{src:e.avatarUrl,alt:``,"aria-hidden":!0,className:`size-4 rounded-full`}):null,(0,$.jsx)(`span`,{children:e.login})]})}),(0,$.jsx)(P,{value:e.login,id:t,"data-testid":`publish-owner-option-${e.login}`})]})},e.login)}function dr(e){let t=(0,Z.c)(36),{ownerLogin:n,repoName:r,shareUrl:i,shareUrlError:a,copying:o,canCopy:l,onCopy:u,onClose:d}=e,{_:f}=c(),p=(0,Q.useRef)(null),m,h;t[0]===i?(m=t[1],h=t[2]):(m=()=>{!i||!p.current||(p.current.focus(),p.current.select())},h=[i],t[0]=i,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(C,{children:(0,$.jsx)(s,{id:`u3wRF-`})}),t[3]=g):g=t[3];let _;t[4]!==n||t[5]!==r?(_={ownerLogin:n,repoName:r},t[4]=n,t[5]=r,t[6]=_):_=t[6];let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y={0:(0,$.jsx)(`code`,{className:`font-mono`})},t[7]=y):y=t[7];let b;t[8]===_?b=t[9]:(b=(0,$.jsxs)(D,{children:[g,(0,$.jsx)(S,{children:(0,$.jsx)(s,{id:`r871ed`,values:_,components:y})})]}),t[8]=_,t[9]=b);let x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(Y,{className:`mt-0.5 size-4 text-emerald-600`,"aria-hidden":!0}),t[10]=x):x=t[10];let w;t[11]===l?w=t[12]:(w=(0,$.jsxs)(`div`,{role:`status`,"data-testid":`publish-success`,className:`flex items-start gap-3 rounded-md border border-emerald-500/40 bg-emerald-500/5 p-3 text-sm`,children:[x,(0,$.jsx)(`span`,{className:`text-foreground`,children:l?(0,$.jsx)(s,{id:`cOrTMo`}):(0,$.jsx)(s,{id:`nTwL53`})})]}),t[11]=l,t[12]=w);let O;t[13]!==l||t[14]!==i||t[15]!==a?(O=l&&(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(N,{htmlFor:`publish-share-url`,children:(0,$.jsx)(s,{id:`5-FeN2`})}),a?(0,$.jsx)(`div`,{role:`alert`,"data-testid":`publish-share-url-error`,className:`rounded-md border border-destructive/50 bg-destructive/5 p-2 text-sm text-destructive`,children:a}):i?(0,$.jsx)(Oe,{id:`publish-share-url`,ref:p,"data-testid":`publish-share-url`,readOnly:!0,value:i,onFocus:mr,onClick:pr,onContextMenu:fr,className:`font-mono text-xs`}):(0,$.jsxs)(`div`,{"data-testid":`publish-share-url-loading`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(he,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`M9597s`})]})]}),t[13]=l,t[14]=i,t[15]=a,t[16]=O):O=t[16];let k;t[17]!==w||t[18]!==O?(k=(0,$.jsxs)(T,{className:`flex flex-col gap-4`,children:[w,O]}),t[17]=w,t[18]=O,t[19]=k):k=t[19];let A;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(s,{id:`DPfwMq`}),t[20]=A):A=t[20];let j;t[21]===d?j=t[22]:(j=(0,$.jsx)(v,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:d,"data-testid":`publish-success-done`,children:A}),t[21]=d,t[22]=j);let M;t[23]!==f||t[24]!==l||t[25]!==o||t[26]!==u||t[27]!==i?(M=l&&(0,$.jsx)(v,{type:`button`,onClick:u,disabled:o||!i,"data-testid":`publish-copy-link`,"aria-label":f({id:`RGCCrg`}),children:o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(he,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`OvEjsP`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),` `,(0,$.jsx)(s,{id:`RGCCrg`})]})}),t[23]=f,t[24]=l,t[25]=o,t[26]=u,t[27]=i,t[28]=M):M=t[28];let P;t[29]!==j||t[30]!==M?(P=(0,$.jsxs)(E,{children:[j,M]}),t[29]=j,t[30]=M,t[31]=P):P=t[31];let F;return t[32]!==k||t[33]!==P||t[34]!==b?(F=(0,$.jsxs)($.Fragment,{children:[b,k,P]}),t[32]=k,t[33]=P,t[34]=b,t[35]=F):F=t[35],F}function fr(e){return e.currentTarget.select()}function pr(e){return e.currentTarget.select()}function mr(e){return e.currentTarget.select()}function hr(e){let t=(0,Z.c)(13),{banner:n,onAuthorize:i,onRetryPush:a}=e,o=n.next,c;t[0]===n.message?c=t[1]:(c=(0,$.jsx)(`span`,{children:n.message}),t[0]=n.message,t[1]=c);let l;t[2]!==o.authorizeUrl||t[3]!==o.kind||t[4]!==i?(l=o.kind===`authorize-org`&&(0,$.jsxs)(v,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,"data-testid":`publish-authorize-org`,onClick:()=>i(o.authorizeUrl),children:[(0,$.jsx)(s,{id:`FyW0WO`}),` `,(0,$.jsx)(r,{className:`ml-1 size-3`,"aria-hidden":!0})]}),t[2]=o.authorizeUrl,t[3]=o.kind,t[4]=i,t[5]=l):l=t[5];let u;t[6]!==o.kind||t[7]!==a?(u=o.kind===`retry-push`&&(0,$.jsx)(v,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,"data-testid":`publish-retry-push`,onClick:a,children:(0,$.jsx)(s,{id:`NOHyEE`})}),t[6]=o.kind,t[7]=a,t[8]=u):u=t[8];let d;return t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,$.jsxs)(`div`,{role:`alert`,"data-testid":`publish-banner`,className:`flex flex-col gap-2 rounded-md border border-destructive/50 bg-destructive/5 p-3 text-sm`,children:[c,l,u]}),t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function gr(e){let t=(0,Z.c)(12),{status:r}=e;if(r.kind===`available`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":`available`,className:`flex items-center gap-1 text-emerald-600 dark:text-emerald-400`,children:[e,` `,(0,$.jsx)(s,{id:`csDS2L`})]}),t[1]=n):n=t[1],n}if(r.kind===`taken`){let{owner:e,name:i}=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==e?(o=(0,$.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":`taken`,className:`flex items-center gap-1 text-destructive`,children:[a,` `,(0,$.jsx)(s,{id:`LRgZAt`,values:{owner:e,name:i}})]}),t[3]=i,t[4]=e,t[5]=o):o=t[5],o}if(r.kind===`checking`||r.kind===`pending`){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(he,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),t[6]=e):e=t[6];let n;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(s,{id:`pWT04I`}),t[7]=n):n=t[7];let i;return t[8]===r.kind?i=t[9]:(i=(0,$.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":r.kind,className:`flex items-center gap-1 text-muted-foreground`,children:[e,` `,n]}),t[8]=r.kind,t[9]=i),i}if(r.kind===`error`){let e;return t[10]===r.banner?e=t[11]:(e=(0,$.jsx)(`span`,{"data-testid":`publish-name-check`,"data-status":`error`,className:`text-destructive`,children:r.banner}),t[10]=r.banner,t[11]=e),e}return null}function _r(e=`sync`){ie(e).catch(e=>{console.warn(`[sync-badge] manual sync trigger failed`,e instanceof Error?e.message:e)})}function vr(e){if(!e)return X._({id:`Zul8Ry`});let t=Date.now()-new Date(e).getTime();if(t<6e4)return X._({id:`xOTzt5`});if(t<36e5){let e=Math.floor(t/6e4);return X._({id:`LNum6A`,values:{minutes:e}})}if(t<864e5){let e=Math.floor(t/36e5);return X._({id:`nYeBmY`,values:{hours:e}})}return new Date(e).toLocaleDateString()}function yr(e){return e.syncMode===`follow`}function br(e){return yr(e)&&e.state===`idle`&&e.conflictCount>0?`conflict`:e.state}function xr(e){let t=(0,Z.c)(10),{status:n,paused:r}=e;if(r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ke,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}switch(br(n)){case`dormant`:{let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ue,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ge,{className:`size-3.5 text-muted-foreground`}),t[2]=e):e=t[2],e}let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ue,{className:`size-3.5 text-muted-foreground`}),t[3]=e):e=t[3],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ge,{className:`size-3.5 text-muted-foreground animate-spin`}),t[4]=e):e=t[4],e}case`conflict`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Te,{className:`size-3.5 text-amber-500`}),t[5]=e):e=t[5],e}case`offline`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(He,{className:`size-3.5 text-muted-foreground`}),t[6]=e):e=t[6],e}case`auth-error`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(We,{className:`size-3.5 text-destructive`}),t[7]=e):e=t[7],e}case`disabled`:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Te,{className:`size-3.5 text-amber-500`}),t[8]=e):e=t[8],e}default:{let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ue,{className:`size-3.5 text-muted-foreground`}),t[9]=e):e=t[9],e}}}function Sr(e){switch(br(e)){case`idle`:return!yr(e)&&e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function Cr(e,t=!1){switch(e){case`dormant`:return X._({id:`RmBY0A`});case`idle`:return t?X._({id:`j5CWO4`}):X._({id:`N2FcBE`});case`fetching`:return t?X._({id:`7IsvrP`}):X._({id:`Wgmlsw`});case`pulling`:return t?X._({id:`JL3si7`}):X._({id:`4uNLmk`});case`pushing`:return X._({id:`iycx_A`});case`conflict`:return X._({id:`IInnZo`});case`offline`:return X._({id:`6Aih4U`});case`auth-error`:return X._({id:`mHVPm5`});case`disabled`:return X._({id:`DrYM2Z`});default:return e}}function wr(e){switch(e){case`external-changes-pending`:return X._({id:`W9_Bub`});case`dirty-tree`:return X._({id:`a5Gha5`});case`non-content-merge-failure`:return X._({id:`sIxSSP`});case`detached-head`:return X._({id:`uQNW00`});case`diverged-local-commits`:return X._({id:`LQsCPn`});case`auth-error`:return X._({id:`mHVPm5`});case`protected-branch`:return X._({id:`8fc_3j`});case`no-push-permission`:return X._({id:`ChAtFg`});default:return e}}function Tr(e){switch(e){case`not-authenticated`:return X._({id:`ycIX5i`});case`no-collaborator`:return X._({id:`ChAtFg`});case`private-no-access`:return X._({id:`07gHun`});case`repo-not-found`:return X._({id:`uksqrP`});default:return X._({id:`ChAtFg`})}}function Er(e){return e?.checkStatus===`denied`&&e.deniedReason===`not-authenticated`}function Dr(e){switch(e){case`auth-403`:return X._({id:`EiVgl5`});case`auth-401`:return X._({id:`-Qw-1t`});case`auth-scope-mismatch`:return X._({id:`Zue_jx`});case`auth-no-credential`:return X._({id:`uCaIdy`});case`semantic-protected-branch`:return X._({id:`T0OVm7`});default:return X._({id:`1AumWo`})}}function Or(e){switch(e){case`auth-403`:return X._({id:`RgbKEe`});case`auth-401`:return X._({id:`-Qw-1t`});case`auth-scope-mismatch`:return X._({id:`Zue_jx`});case`auth-no-credential`:return X._({id:`uCaIdy`});default:return X._({id:`jZ_E5M`})}}function kr(e){switch(e){case`auth-403`:return X._({id:`RgbKEe`});case`auth-401`:return X._({id:`-Qw-1t`});case`auth-scope-mismatch`:return X._({id:`Zue_jx`});case`auth-no-credential`:return X._({id:`uCaIdy`});case`semantic-protected-branch`:return X._({id:`T0OVm7`});default:return X._({id:`cUk6TF`})}}function Ar(e){let t=e.pushErrorCode!=null||e.pushError!=null,n=e.pullErrorCode!=null||e.pullError!=null;if(t&&n&&(e.pushErrorCode==null?e.pullErrorCode==null&&e.pushError===e.pullError:e.pushErrorCode===e.pullErrorCode))return[{key:`sync`,direction:null,message:e.pushErrorCode==null?e.pushError:kr(e.pushErrorCode)}];let r=t&&n,i=[];return t&&i.push({key:`push`,direction:r?`push`:null,message:e.pushErrorCode?Dr(e.pushErrorCode):e.pushError}),n&&i.push({key:`pull`,direction:r?`pull`:null,message:e.pullErrorCode?Or(e.pullErrorCode):e.pullError}),i}function jr(e){return e?.checkStatus===`unknown`&&e.unknownError===`token-invalid`}function Mr(e,t=!1){if(t)return X._({id:`U6wmNc`});let n=yr(e);if(!e.syncEnabled&&!n)return X._({id:`kUn-CN`});let r=br(e);if(r===`conflict`&&e.conflictCount>0){let{conflictCount:t}=e;return X._({id:`cUK8lW`,values:{conflictCount:t}})}if(r===`idle`){let{ahead:t,behind:r}=e;return n?r>0?X._({id:`9o1bIV`,values:{behind:r}}):X._({id:`j5CWO4`}):t>0&&r>0?X._({id:`5F5HYj`,values:{ahead:t,behind:r}}):t>0?X._({id:`PdA9NZ`,values:{ahead:t}}):r>0?X._({id:`9o1bIV`,values:{behind:r}}):X._({id:`N2FcBE`})}return Cr(r,n)}function Nr(e){let t=(0,Z.c)(69),{status:n,onSignIn:r,onSetIdentity:i}=e,{_:a}=c(),{behind:o,conflictCount:l}=n,{projectLocalConfig:u,projectLocalSynced:d}=Le(),f=u?.autoSync,{active:p,paused:m,everEnabled:h,toggleMode:g,confirmOpen:_,setConfirmOpen:y,pendingMode:b,strandedCommitCount:x,onToggleActive:S,onModeSelect:C,onConfirm:w}=ae(f,n.ahead),T=H(f)??`off`,E=yr(n),D=br(n),O=vr(n.lastSyncUtc),k=!(n.pushPermission?.checkStatus===`denied`&&n.pushPermission.deniedReason!==`not-authenticated`),{conflicts:A}=zn(),j=A[0]??null,M=!m&&D===`conflict`&&j!==null,N=!m&&D===`auth-error`,P=h&&!M&&!N&&(m||D!==`dormant`),F=p&&T===`full`?`sync`:`pull`,z;t[0]!==m||t[1]!==n?(z=(0,$.jsx)(xr,{status:n,paused:m}),t[0]=m,t[1]=n,t[2]=z):z=t[2];let B=m?a({id:`U6wmNc`}):Cr(D,E),ee;t[3]===B?ee=t[4]:(ee=(0,$.jsx)(`span`,{className:`text-1sm font-medium truncate`,children:B}),t[3]=B,t[4]=ee);let V;t[5]!==z||t[6]!==ee?(V=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[z,ee]}),t[5]=z,t[6]=ee,t[7]=V):V=t[7];let U=!d,W;t[8]!==a||t[9]!==p?(W=a(p?{id:`MGBNwj`}:{id:`rn7n0G`}),t[8]=a,t[9]=p,t[10]=W):W=t[10];let G;t[11]!==p||t[12]!==S||t[13]!==U||t[14]!==W?(G=(0,$.jsx)(I,{checked:p,disabled:U,onCheckedChange:S,"aria-label":W}),t[11]=p,t[12]=S,t[13]=U,t[14]=W,t[15]=G):G=t[15];let K;t[16]!==V||t[17]!==G?(K=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[V,G]}),t[16]=V,t[17]=G,t[18]=K):K=t[18];let q=b??`full`,J;t[19]!==_||t[20]!==w||t[21]!==y||t[22]!==x||t[23]!==q?(J=(0,$.jsx)(oe,{open:_,onOpenChange:y,onConfirm:w,variant:q,strandedCommitCount:x}),t[19]=_,t[20]=w,t[21]=y,t[22]=x,t[23]=q,t[24]=J):J=t[24];let ne;t[25]!==a||t[26]!==p||t[27]!==E||t[28]!==r||t[29]!==m||t[30]!==n?(ne=m?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-paused-line`,children:(0,$.jsx)(s,{id:`PTb1Nx`})}):(0,$.jsxs)($.Fragment,{children:[Ar(n).map(e=>(0,$.jsx)(`p`,{className:`text-xs text-destructive`,children:e.direction===`push`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`font-medium`,children:[a({id:`uO9WLl`}),`: `]}),e.message]}):e.direction===`pull`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`font-medium`,children:[a({id:`e4GHWP`}),`: `]}),e.message]}):e.message},e.key)),!E&&Er(n.pushPermission)?(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground flex-1 min-w-0`,children:(0,$.jsx)(s,{id:`ycIX5i`})}),r&&(0,$.jsx)(v,{variant:`outline`,size:`xs`,className:`self-start`,onClick:r,children:(0,$.jsx)(s,{id:`5lWFkC`})})]}):n.pausedReason?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:wr(n.pausedReason)}):E?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-mode-line`,children:(0,$.jsx)(s,{id:`-imiMK`})}):p?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-mode-line`,children:(0,$.jsx)(s,{id:`iy64Li`})}):n.pushPermission?.checkStatus===`denied`?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:Tr(n.pushPermission.deniedReason)}):jr(n.pushPermission)?(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground flex-1 min-w-0`,children:(0,$.jsx)(s,{id:`C_cPoW`})}),r&&(0,$.jsx)(v,{variant:`outline`,size:`xs`,className:`self-start`,onClick:r,children:(0,$.jsx)(s,{id:`5lWFkC`})})]}):null]}),t[25]=a,t[26]=p,t[27]=E,t[28]=r,t[29]=m,t[30]=n,t[31]=ne):ne=t[31];let re;t[32]!==E||t[33]!==m||t[34]!==D?(re=!m&&D===`conflict`&&(0,$.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:E?(0,$.jsx)(s,{id:`ko386X`}):(0,$.jsx)(s,{id:`t2TkQ3`})}),t[32]=E,t[33]=m,t[34]=D,t[35]=re):re=t[35];let ie;t[36]!==a||t[37]!==n.remote?(ie=n.remote&&(0,$.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,$.jsx)(s,{id:`IreQBq`})}),n.remote.webUrl?(0,$.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-0.5 text-foreground hover:text-primary hover:underline`,"aria-label":a({id:`1nke1r`,values:{0:n.remote.label}}),children:[(0,$.jsx)(`span`,{className:`truncate`,children:n.remote.label}),(0,$.jsx)(ce,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,$.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:n.remote.label})]}),t[36]=a,t[37]=n.remote,t[38]=ie):ie=t[38];let se;t[39]!==p||t[40]!==o||t[41]!==E||t[42]!==n.behind?(se=p&&!E&&n.behind>0&&(0,$.jsx)(`div`,{children:(0,$.jsx)(s,{id:`YsEYYS`,values:{behind:o}})}),t[39]=p,t[40]=o,t[41]=E,t[42]=n.behind,t[43]=se):se=t[43];let le;t[44]!==l||t[45]!==n.conflictCount?(le=n.conflictCount>0&&(0,$.jsx)(`div`,{children:(0,$.jsx)(s,{id:`B4_ipX`,values:{conflictCount:l}})}),t[44]=l,t[45]=n.conflictCount,t[46]=le):le=t[46];let ue;t[47]!==a||t[48]!==k||t[49]!==C||t[50]!==g?(ue=k&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-0.5`,children:[(0,$.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,$.jsx)(s,{id:`zz_Wd_`})}),(0,$.jsxs)(R,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,value:g,onValueChange:e=>{te(e)&&C(e)},"aria-label":a({id:`CnOGgs`}),"data-testid":`sync-popover-mode-toggle`,children:[(0,$.jsx)(L,{value:`full`,"data-testid":`sync-popover-mode-full`,children:(0,$.jsx)(s,{id:`g2Tj8R`})}),(0,$.jsx)(L,{value:`follow`,"data-testid":`sync-popover-mode-follow`,children:(0,$.jsx)(s,{id:`MKEPCY`})})]})]}),t[47]=a,t[48]=k,t[49]=C,t[50]=g,t[51]=ue):ue=t[51];let Y;t[52]!==ie||t[53]!==se||t[54]!==le||t[55]!==ue?(Y=(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-2 border-t pt-3`,children:[ie,se,le,ue]}),t[52]=ie,t[53]=se,t[54]=le,t[55]=ue,t[56]=Y):Y=t[56];let de;t[57]!==i||t[58]!==m||t[59]!==n.identityUnresolved?(de=!m&&n.identityUnresolved&&i&&(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,$.jsx)(qe,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:(0,$.jsx)(s,{id:`nrGWJ7`})}),(0,$.jsx)(v,{variant:`outline`,size:`xs`,className:`self-start`,onClick:i,children:(0,$.jsx)(s,{id:`keNFEd`})})]})]}),t[57]=i,t[58]=m,t[59]=n.identityUnresolved,t[60]=de):de=t[60];let fe=(P||N||M||p&&D!==`dormant`)&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[p&&D!==`dormant`?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-last-sync`,children:a(E?{id:`4DcimZ`,values:{lastSyncedRelative:O}}:{id:`g85bAo`,values:{lastSyncedRelative:O}})}):(0,$.jsx)(`span`,{}),(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-1`,children:[P&&(0,$.jsx)(v,{variant:`outline`,size:`xs`,onClick:()=>_r(F),children:(0,$.jsx)(s,{id:`Nu4DdT`})}),N&&(0,$.jsx)(v,{variant:`outline`,size:`xs`,onClick:r,children:(0,$.jsx)(s,{id:`5lWFkC`})}),M&&j&&(0,$.jsx)(v,{variant:`outline`,size:`xs`,onClick:()=>{if(typeof window>`u`)return;let e=ke(je(j.file));window.location.hash!==e&&(window.location.hash=e)},children:(0,$.jsx)(s,{id:`0yL--g`})})]})]}),pe;return t[61]!==J||t[62]!==ne||t[63]!==re||t[64]!==Y||t[65]!==de||t[66]!==fe||t[67]!==K?(pe=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[K,J,ne,re,Y,de,fe]}),t[61]=J,t[62]=ne,t[63]=re,t[64]=Y,t[65]=de,t[66]=fe,t[67]=K,t[68]=pe):pe=t[68],pe}function Pr(e){let t=(0,Z.c)(74),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onSetIdentity:i}=n,{_:a}=c(),{status:o,fetchError:l}=re(),{projectLocalConfig:p}=Le(),m=p?.autoSync,h;t[2]===m?h=t[3]:(h=ee(m),t[2]=m,t[3]=h);let g=h,_=te(H(p?.autoSync));if(!o){if(l){let e;t[4]===a?e=t[5]:(e=a({id:`iqIDv4`}),t[4]=a,t[5]=e);let n;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(He,{className:`size-3.5`}),t[6]=n):n=t[6];let r;t[7]===e?r=t[8]:(r=(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":e,disabled:!0,children:n})}),t[7]=e,t[8]=r);let i;t[9]===l?i=t[10]:(i=(0,$.jsx)(b,{children:l===`network`?(0,$.jsx)(s,{id:`I5AfhE`}):(0,$.jsx)(s,{id:`uKRYiW`})}),t[9]=l,t[10]=i);let o;return t[11]!==r||t[12]!==i?(o=(0,$.jsxs)(x,{children:[r,i]}),t[11]=r,t[12]=i,t[13]=o):o=t[13],o}return null}if(o.state===`dormant`&&!o.hasRemote||o.state===`disabled`&&!o.pausedReason&&o.syncMode!==`follow`&&!g&&!_)return null;let S;t[14]!==g||t[15]!==o?(S=g?``:Sr(o),t[14]=g,t[15]=o,t[16]=S):S=t[16];let C=S,w,T,E,D,O,k,A,j,M,N,P,F;if(t[17]!==a||t[18]!==g||t[19]!==o){let e=g?a({id:`U6wmNc`}):Cr(br(o),yr(o));k=!!o.identityUnresolved,O=u,D=x,E=y,A=!0,T=d,F=!0,w=v,j=`ghost`,M=`icon-sm`,N=`text-muted-foreground relative`,P=a(k?{id:`DFfRbX`,values:{syncStateLabel:e}}:{id:`F4vEsL`,values:{syncStateLabel:e}}),t[17]=a,t[18]=g,t[19]=o,t[20]=w,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k,t[26]=A,t[27]=j,t[28]=M,t[29]=N,t[30]=P,t[31]=F}else w=t[20],T=t[21],E=t[22],D=t[23],O=t[24],k=t[25],A=t[26],j=t[27],M=t[28],N=t[29],P=t[30],F=t[31];let I;t[32]!==g||t[33]!==o?(I=(0,$.jsx)(xr,{status:o,paused:g}),t[32]=g,t[33]=o,t[34]=I):I=t[34];let L;t[35]===C?L=t[36]:(L=C&&(0,$.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:C}),t[35]=C,t[36]=L);let R;t[37]!==C||t[38]!==k?(R=!C&&k&&(0,$.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[37]=C,t[38]=k,t[39]=R):R=t[39];let z;t[40]!==w||t[41]!==I||t[42]!==L||t[43]!==R||t[44]!==j||t[45]!==M||t[46]!==N||t[47]!==P?(z=(0,$.jsxs)(w,{variant:j,size:M,className:N,"aria-label":P,children:[I,L,R]}),t[40]=w,t[41]=I,t[42]=L,t[43]=R,t[44]=j,t[45]=M,t[46]=N,t[47]=P,t[48]=z):z=t[48];let B;t[49]!==T||t[50]!==z||t[51]!==F?(B=(0,$.jsx)(T,{asChild:F,children:z}),t[49]=T,t[50]=z,t[51]=F,t[52]=B):B=t[52];let V;t[53]!==E||t[54]!==A||t[55]!==B?(V=(0,$.jsx)(E,{asChild:A,children:B}),t[53]=E,t[54]=A,t[55]=B,t[56]=V):V=t[56];let U;t[57]!==g||t[58]!==o?(U=Mr(o,g),t[57]=g,t[58]=o,t[59]=U):U=t[59];let W;t[60]===U?W=t[61]:(W=(0,$.jsx)(b,{children:U}),t[60]=U,t[61]=W);let G;t[62]!==D||t[63]!==V||t[64]!==W?(G=(0,$.jsxs)(D,{children:[V,W]}),t[62]=D,t[63]=V,t[64]=W,t[65]=G):G=t[65];let K;t[66]!==i||t[67]!==r||t[68]!==o?(K=(0,$.jsx)(f,{align:`end`,className:`w-80 p-3`,children:(0,$.jsx)(Nr,{status:o,onSignIn:r,onSetIdentity:i})}),t[66]=i,t[67]=r,t[68]=o,t[69]=K):K=t[69];let q;return t[70]!==O||t[71]!==G||t[72]!==K?(q=(0,$.jsxs)(O,{children:[G,K]}),t[70]=O,t[71]=G,t[72]=K,t[73]=q):q=t[73],q}function Fr(e){let t=e.trim();return t.length===0?{kind:`blank`,raw:e}:t.startsWith(`#`)?{kind:`comment`,raw:e}:{kind:`pattern`,raw:e,text:t}}function Ir(e){return{lines:e.split(`
|
|
10
10
|
`).map(Fr)}}function Lr(e){return e.lines.map(e=>e.raw).join(`
|
|
11
11
|
`)}function Rr(e){return e.lines.filter(e=>e.kind===`pattern`)}function zr(e,t){let n=t.trim();if(n.length===0)return e;for(let t of e.lines)if(t.kind===`pattern`&&t.text===n)return e;let r={kind:`pattern`,raw:n,text:n},i=e.lines.slice(),a=i[i.length-1];return a&&a.kind===`blank`&&a.raw===``?i.splice(i.length-1,0,r):i.push(r,{kind:`blank`,raw:``}),{lines:i}}function Br(e,t){let n=t.trim();if(n.length===0)return-1;let r=0;for(let t of e.lines)if(t.kind===`pattern`){if(t.text===n)return r;r++}return-1}function Vr(e,t,n){let r=n.trim();if(r.length===0)return Hr(e,t);let i=Wr(e,t);if(i<0)return e;let a=e.lines.slice();return a[i]={kind:`pattern`,raw:r,text:r},{lines:a}}function Hr(e,t){let n=Wr(e,t);if(n<0)return e;let r=e.lines.slice();return r.splice(n,1),{lines:r}}function Ur(e,t,n){if(t===n)return e;let r=[],i=[];if(e.lines.forEach((e,t)=>{e.kind===`pattern`&&(r.push(t),i.push(e))}),t<0||t>=i.length||n<0||n>=i.length)return e;let a=i.slice(),[o]=a.splice(t,1);if(!o)return e;a.splice(n,0,o);let s=e.lines.slice();return r.forEach((e,t)=>{let n=a[t];n&&(s[e]=n)}),{lines:s}}function Wr(e,t){if(t<0)return-1;let n=0;for(let r=0;r<e.lines.length;r++)if(e.lines[r]?.kind===`pattern`){if(n===t)return r;n++}return-1}var Gr=`npx @inkeep/open-knowledge cowork`,Kr=`https://openknowledge.ai/docs/integrations/claude-code`;function qr(){return typeof window<`u`&&typeof window.okDesktop?.skill==`object`}function Jr(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 font-mono text-[0.85em]`,children:n}),t[0]=n,t[1]=r),r}function Yr(e){let t=(0,Z.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=p(`font-mono tracking-wide uppercase text-primary font-medium text-xs`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,$.jsx)(`p`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Xr(e){let t=(0,Z.c)(4),{n}=e,r;t[0]===n?r=t[1]:(r=n.toString().padStart(2,`0`),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-5 w-5 shrink-0 items-center justify-center text-xs font-medium text-muted-foreground font-mono tabular-nums`,children:r}),t[2]=r,t[3]=i),i}function Zr(){let e=(0,Z.c)(8),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Yr,{children:(0,$.jsx)(s,{id:`cIptmH`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Xr,{n:1}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`li`,{className:`flex gap-3`,children:[n,(0,$.jsx)(`span`,{children:(0,$.jsx)(s,{id:`pHYP6v`,components:{0:(0,$.jsx)(`strong`,{className:`font-medium`}),1:(0,$.jsx)(se,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),2:(0,$.jsx)(`strong`,{className:`font-medium`})}})})]}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(Xr,{n:2}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsxs)(`li`,{className:`flex gap-3`,children:[i,(0,$.jsx)(`span`,{children:(0,$.jsx)(s,{id:`gGVP4q`,components:{0:(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center font-medium border h-5 w-5 rounded-md text-xs`}),1:(0,$.jsx)(se,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),2:(0,$.jsx)(`strong`,{className:`font-medium`}),3:(0,$.jsx)(se,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),4:(0,$.jsx)(`strong`,{className:`font-medium`})}})})]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(Xr,{n:3}),e[5]=o):o=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsxs)(`ol`,{className:`flex flex-col gap-4 text-sm`,children:[r,a,(0,$.jsxs)(`li`,{className:`flex gap-3`,children:[o,(0,$.jsx)(`span`,{children:(0,$.jsx)(s,{id:`COr1Y7`,components:{0:(0,$.jsx)(Jr,{}),1:(0,$.jsx)(`strong`,{className:`font-medium`})}})})]})]}),e[6]=c):c=e[6];let l;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t,c,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground mt-4`,children:(0,$.jsx)(s,{id:`kV2YZv`,components:{0:(0,$.jsx)(`strong`,{className:`font-medium`}),1:(0,$.jsx)(`strong`,{className:`font-medium`}),2:(0,$.jsx)(se,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),3:(0,$.jsx)(se,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`})}})})]}),e[7]=l):l=e[7],l}function Qr(e){let t=(0,Z.c)(74),{open:n,onOpenChange:r,reinstall:i}=e,a=i===void 0?!1:i,{_:o}=c(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={kind:`idle`},t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(!1),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{n||(d({kind:`idle`}),p(!1))},h=[n],t[1]=n,t[2]=m,t[3]=h),(0,Q.useEffect)(m,h);let g;t[4]===o?g=t[5]:(g=async function(){d({kind:`downloading`});let e=window.okDesktop?.skill;if(!e){d({kind:`error`,message:o({id:`y46m5r`})});return}let t=await e.buildAndOpen();if(t.ok)d({kind:`handed-off`,path:t.path});else{let e=t.message??t.reason;De.error(o({id:`hSySVc`,values:{msg:e}})),d({kind:`error`,message:t.reason===`open-failed`?o({id:`IA1wNb`,values:{msg:e}}):`${t.reason}: ${e}`})}},t[4]=o,t[5]=g);let _=g,y;t[6]===o?y=t[7]:(y=async function(){try{await navigator.clipboard.writeText(Gr),p(!0),setTimeout(()=>p(!1),2e3)}catch(e){let t=e,n=t instanceof Error?t.message:String(t);De.error(o({id:`Uw6ERJ`,values:{detail:n}}))}},t[6]=o,t[7]=y);let b=y,x;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(x=qr(),t[8]=x):x=t[8];let k=x,A;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(de,{"aria-hidden":`true`,className:`h-4 w-4`}),t[9]=A):A=t[9];let j;t[10]===a?j=t[11]:(j=(0,$.jsxs)(C,{className:`flex items-center gap-2`,children:[A,a?(0,$.jsx)(s,{id:`xNyj3h`}):(0,$.jsx)(s,{id:`7qRHf0`})]}),t[10]=a,t[11]=j);let M;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(S,{children:(0,$.jsx)(s,{id:`9V0W-R`,components:{0:(0,$.jsx)(`strong`,{className:`font-medium text-foreground`})}})}),t[12]=M):M=t[12];let N;t[13]===j?N=t[14]:(N=(0,$.jsxs)(D,{children:[j,M]}),t[13]=j,t[14]=N);let P;t[15]===u.kind?P=t[16]:(P=u.kind===`idle`&&k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(Yr,{className:`text-muted-foreground`,children:(0,$.jsx)(s,{id:`Dnn2XG`})}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`RN62Q8`,components:{0:(0,$.jsx)(Jr,{}),1:(0,$.jsx)(Jr,{})}})})]}),(0,$.jsx)(Zr,{})]}),t[15]=u.kind,t[16]=P);let F;t[17]!==o||t[18]!==f||t[19]!==b||t[20]!==u.kind?(F=u.kind===`idle`&&!k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(Yr,{children:(0,$.jsx)(s,{id:`L8fKuc`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border bg-muted/40 p-2`,children:[(0,$.jsx)(`code`,{className:`flex-1 font-mono text-xs`,children:Gr}),(0,$.jsx)(v,{variant:`ghost`,size:`sm`,onClick:b,"aria-label":o({id:`Oos8fo`}),className:`h-7 gap-1`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{"aria-hidden":`true`,className:`h-3 w-3`}),(0,$.jsx)(s,{id:`6V3Ea3`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ue,{"aria-hidden":`true`,className:`h-3 w-3`}),(0,$.jsx)(s,{id:`he3ygx`})]})})]}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`z60Lgn`,components:{0:(0,$.jsx)(Jr,{})}})})]}),(0,$.jsx)(Zr,{})]}),t[17]=o,t[18]=f,t[19]=b,t[20]=u.kind,t[21]=F):F=t[21];let I;t[22]===u.kind?I=t[23]:(I=u.kind===`downloading`&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.jsx)(he,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,$.jsx)(s,{id:`bwil08`,components:{0:(0,$.jsx)(Jr,{})}})]}),t[22]=u.kind,t[23]=I);let L;t[24]!==u.kind||t[25]!==u.path?(L=u.kind===`handed-off`&&k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,$.jsx)(Y,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(s,{id:`r51jLC`})}),(0,$.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground`,children:u.path??`~/Downloads/openknowledge.skill`})]})]}),(0,$.jsx)(Zr,{})]}),t[24]=u.kind,t[25]=u.path,t[26]=L):L=t[26];let R;t[27]===u.kind?R=t[28]:(R=u.kind===`handed-off`&&!k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,$.jsx)(Y,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(s,{id:`hynz2K`})}),(0,$.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`qXg5W9`,components:{0:(0,$.jsx)(Jr,{})}})})]})]}),(0,$.jsx)(Zr,{})]}),t[27]=u.kind,t[28]=R);let z;t[29]!==u.kind||t[30]!==u.message?(z=u.kind===`error`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`text-destructive`,children:u.message}),(0,$.jsx)(`a`,{href:Kr,target:`_blank`,rel:`noopener noreferrer`,onClick:ni,onAuxClick:ti,className:`text-xs underline underline-offset-2 hover:text-foreground`,children:(0,$.jsx)(s,{id:`mGaZwZ`})})]}),t[29]=u.kind,t[30]=u.message,t[31]=z):z=t[31];let B;t[32]!==P||t[33]!==F||t[34]!==I||t[35]!==L||t[36]!==R||t[37]!==z?(B=(0,$.jsx)(T,{children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-6 py-2`,children:[P,F,I,L,R,z]})}),t[32]=P,t[33]=F,t[34]=I,t[35]=L,t[36]=R,t[37]=z,t[38]=B):B=t[38];let ee;t[39]===u.kind?ee=t[40]:(ee=u.kind!==`error`&&(0,$.jsxs)(`a`,{href:Kr,target:`_blank`,rel:`noopener noreferrer`,onClick:ei,onAuxClick:$r,className:`inline-flex items-center gap-1 self-center text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground sm:mr-auto font-mono tracking-wide uppercase`,children:[(0,$.jsx)(s,{id:`U3IvM5`}),(0,$.jsx)(Ge,{"aria-hidden":`true`,className:`h-3 w-3`})]}),t[39]=u.kind,t[40]=ee);let V;t[41]!==_||t[42]!==r||t[43]!==u.kind||t[44]!==a?(V=u.kind===`idle`&&k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(v,{className:`uppercase font-mono`,variant:`outline`,onClick:()=>r(!1),children:(0,$.jsx)(s,{id:`dEgA5A`})}),(0,$.jsxs)(v,{onClick:_,children:[(0,$.jsx)(de,{"aria-hidden":`true`,className:`h-4 w-4`}),a?(0,$.jsx)(s,{id:`YGIi_c`}):(0,$.jsx)(s,{id:`TKQ7K-`})]})]}),t[41]=_,t[42]=r,t[43]=u.kind,t[44]=a,t[45]=V):V=t[45];let H;t[46]!==r||t[47]!==u.kind?(H=u.kind===`idle`&&!k&&(0,$.jsx)(v,{className:`uppercase font-mono`,variant:`outline`,onClick:()=>r(!1),children:(0,$.jsx)(s,{id:`yz7wBu`})}),t[46]=r,t[47]=u.kind,t[48]=H):H=t[48];let U;t[49]!==_||t[50]!==r||t[51]!==u.kind?(U=u.kind===`error`&&k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(v,{className:`uppercase font-mono`,variant:`outline`,onClick:()=>r(!1),children:(0,$.jsx)(s,{id:`dEgA5A`})}),(0,$.jsxs)(v,{onClick:_,children:[(0,$.jsx)(de,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,$.jsx)(s,{id:`KDw4GX`})]})]}),t[49]=_,t[50]=r,t[51]=u.kind,t[52]=U):U=t[52];let W;t[53]!==u.kind||t[54]!==a?(W=u.kind===`downloading`&&(0,$.jsxs)(v,{disabled:!0,children:[(0,$.jsx)(he,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),a?(0,$.jsx)(s,{id:`fIgqfQ`}):(0,$.jsx)(s,{id:`Wtw22s`})]}),t[53]=u.kind,t[54]=a,t[55]=W):W=t[55];let G;t[56]!==r||t[57]!==u.kind?(G=u.kind===`handed-off`&&(0,$.jsx)(v,{onClick:()=>r(!1),children:(0,$.jsx)(s,{id:`DPfwMq`})}),t[56]=r,t[57]=u.kind,t[58]=G):G=t[58];let K;t[59]!==ee||t[60]!==V||t[61]!==H||t[62]!==U||t[63]!==W||t[64]!==G?(K=(0,$.jsxs)(E,{children:[ee,V,H,U,W,G]}),t[59]=ee,t[60]=V,t[61]=H,t[62]=U,t[63]=W,t[64]=G,t[65]=K):K=t[65];let q;t[66]!==N||t[67]!==B||t[68]!==K?(q=(0,$.jsxs)(w,{className:`sm:max-w-lg`,"data-ok-layer-spawned":``,children:[N,B,K]}),t[66]=N,t[67]=B,t[68]=K,t[69]=q):q=t[69];let J;return t[70]!==r||t[71]!==n||t[72]!==q?(J=(0,$.jsx)(O,{open:n,onOpenChange:r,children:q}),t[70]=r,t[71]=n,t[72]=q,t[73]=J):J=t[73],J}function $r(e){return Re(e,Kr)}function ei(e){return Re(e,Kr)}function ti(e){return Re(e,Kr)}function ni(e){return Re(e,Kr)}var ri=new Set;function ii(e){for(let t of ri)try{t(e)}catch(e){console.warn(`[config-ignore-nested-error-events] listener threw:`,e)}}function ai(e){return ri.add(e),()=>{ri.delete(e)}}var oi=new Set;function si(e){for(let t of oi)try{t(e)}catch(e){console.warn(`[config-validation-events] listener threw:`,e)}}function ci(e){return oi.add(e),()=>{oi.delete(e)}}var li=null;function ui(){return li}function di(e){li=e}export{Mn as A,it as B,Un as C,In as D,zn as E,kt as F,Je as H,Ct as I,ht as L,Zt as M,Xt as N,Fn as O,qt as P,ft as R,Hn as S,Bn as T,Ue as U,$e as V,wr as _,ii as a,lr as b,zr as c,Rr as d,Ir as f,Pr as g,Lr as h,ci as i,Qt as j,Ln as k,Vr as l,Ur as m,di as n,ai as o,Hr as p,si as r,Qr as s,ui as t,Br as u,Er as v,Jn as w,Gn as x,jr as y,pt as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dn as e,un as t}from"./dist-
|
|
1
|
+
import{dn as e,un as t}from"./dist-5ovMzVKN2.js";var n={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.46.2`}?.VITE_APP_VERSION??`0.0.0-unknown`;function r(){return t({kind:`web`,runtimeVersion:n})}function i(){return e({kind:`web`,runtimeVersion:n})}export{r as n,i as r,n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{Io as r,Mo as i,No as a,Oo as o,Za as s,bo as c,do as l,h as u,lt as d,m as f}from"./dist-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{Io as r,Mo as i,No as a,Oo as o,Za as s,bo as c,do as l,h as u,lt as d,m as f}from"./dist-5ovMzVKN2.js";var p=e(t(),1),m=n(),h=new Map(d.map(e=>[e.name,e]));function g(e,t){let n=h.get(e);if(!n)throw Error(`color-themes: ${e} is not a generated base-theme token`);return n[t]}function _(e){return{sidebar:e===`dark`?f:u,background:g(`--background`,e),primary:g(`--primary`,e),border:g(`--border`,e),"syntax-string":g(`--chart-2`,e),"syntax-keyword":g(`--chart-4`,e),"syntax-atom":g(`--chart-3`,e)}}var v={name:`Custom`,variant:`dark`,palette:{base00:`#0f172a`,base01:`#1e293b`,base02:`#334155`,base03:`#64748b`,base04:`#94a3b8`,base05:`#e2e8f0`,base06:`#f1f5f9`,base07:`#f8fafc`,base08:`#e5534b`,base09:`#db8d3f`,base0A:`#d29922`,base0B:`#3fb950`,base0C:`#22d3ee`,base0D:`#6366f1`,base0E:`#a78bfa`,base0F:`#c2703f`}},y=[`background`,`surface`,`foreground`,`primary`,`accent`,`border`];function b(e){let{background:t,foreground:n}=e;return{name:`Custom`,variant:i(t)<i(n)?`dark`:`light`,palette:{base00:t,base01:e.surface,base02:e.border,base03:o(t,n,.4),base04:o(t,n,.55),base05:n,base06:o(n,`#ffffff`,.3),base07:o(n,`#ffffff`,.6),base08:`#e5534b`,base09:`#db8d3f`,base0A:`#d29922`,base0B:`#3fb950`,base0C:e.accent,base0D:e.primary,base0E:e.accent,base0F:o(`#e5534b`,t,.35)}}}function x(e){return c(e)}function S(){let e=v.palette;return{background:e.base00,surface:e.base01,foreground:e.base05,primary:e.base0D,accent:e.base0C,border:e.base02}}function C(e){let t=S(),n=!1;for(let r of y){let i=e[r];c(i)&&(t[r]=i,n=!0)}return n?t:null}function w(e){return e?y.some(t=>c(e[t])):!1}function T(e){if(!e)return v;let t=C(e),n={...(t?b(t):v).palette};for(let t of s){let r=e[t];c(r)&&(n[t]=r)}let r=e.variant===`light`||e.variant===`dark`?e.variant:i(n.base00)<i(n.base05)?`dark`:`light`;return{name:typeof e.name==`string`&&e.name.trim()?e.name.trim():`Custom`,author:typeof e.author==`string`?e.author:void 0,variant:r,palette:n}}function E(e){let t={name:e.name,author:e.author??null,variant:e.variant};for(let n of s)t[n]=e.palette[n];for(let e of y)t[e]=null;return t}function D(e){return e.variant}function O(e){return a(`html[data-color-theme="custom"]`,e.variant,l(e))}var k=`ok-color-theme-v1`,A=`ok-custom-theme-v1`,j=`data-color-theme`,M=`ok-custom-theme`;function N(e){let t=document.getElementById(M);t||(t=document.createElement(`style`),t.id=M,document.head.appendChild(t)),t.textContent!==e&&(t.textContent=e)}function P(){document.getElementById(M)?.remove()}function F(e,t,n=!0){if(typeof document>`u`)return;let i=r(n?e:`default`),a=document.documentElement;i.id===`default`?a.removeAttribute(j):a.setAttribute(j,i.id);let o=null;if(i.id===`custom`){let e=T(t),n=O(e);N(n),o=JSON.stringify({css:n,dark:D(e)===`dark`})}else P();try{i.id===`default`?localStorage.removeItem(k):localStorage.setItem(k,i.id),o?localStorage.setItem(A,o):localStorage.removeItem(A)}catch{}}function I(e,t,n){let r=(0,m.c)(12),i=n===void 0?!0:n,a;r[0]!==e||r[1]!==t||r[2]!==i?(a=i&&e===`custom`?JSON.stringify(t??null):``,r[0]=e,r[1]=t,r[2]=i,r[3]=a):a=r[3];let o=a,s;r[4]!==e||r[5]!==t||r[6]!==i?(s=()=>{F(e,t,i)},r[4]=e,r[5]=t,r[6]=i,r[7]=s):s=r[7];let c;r[8]!==e||r[9]!==i||r[10]!==o?(c=[e,o,i],r[8]=e,r[9]=i,r[10]=o,r[11]=c):c=r[11],(0,p.useEffect)(s,c)}var L=(0,p.createContext)(null);function R(){let e=(0,p.use)(L);if(!e)throw Error(`useConfigContext must be used within <ConfigProvider />`);return e}function z(){return(0,p.use)(L)}export{F as a,D as c,w as d,x as f,j as i,E as l,R as n,I as o,T as p,z as r,v as s,L as t,_ as u};
|