@inkeep/open-knowledge 0.49.0-beta.23 → 0.49.0-beta.25
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-DHTPC2_O.mjs → acp-harness-probe-CXUSkPs7.mjs} +2 -2
- package/dist/cli.mjs +7 -7
- package/dist/constants-C5NoqrSd.mjs +2 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/init-B7-UnZpA.mjs +1 -0
- package/dist/{init-CnXGfQDq.mjs → init-BQkhn_WS.mjs} +3 -3
- package/dist/{launch-json-removal-DYcqJsTT.mjs → launch-json-removal-aa8-3i9S.mjs} +2 -2
- package/dist/{loader-DSPsVV22.mjs → loader-BX3kyQCe.mjs} +2 -2
- package/dist/loader-_dAu90ZE.mjs +1 -0
- package/dist/{open-browser-Dyp0opyo.mjs → open-browser-mQ1Bw0J9.mjs} +2 -2
- package/dist/{preview-DmH53NEV.mjs → preview-CRWW5yA8.mjs} +2 -2
- package/dist/preview-hkdLnhZQ.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-BrGODY2p.js → ActivityModeContent-C08FYohG.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-FmW0Jthq.js → AgentDiffPane-T499-ugv.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-rT5rNbdQ.js → ChangedOutsideBadge-GeQfL_b-.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-DlE2CeLE.js → CodeMirrorPropInput-3TWUbzXY.js} +1 -1
- package/dist/public/assets/{DocumentContext-Dne83XLH.js → DocumentContext-C-Lo65-_.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-COteammg.js → EditorModeToggle-BjgmECAn.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-B54Vd_6F.js → EnableSyncConfirmDialog-B1Eo_sVE.js} +1 -1
- package/dist/public/assets/FeedbackForm-C_A-lpjC.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-BCNx_uF4.js → ImportSkillDialog-ChsGV6eb.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-DjnEiT_w.js → LintConfigEditor-3f4-NF1O.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-nt-GCVB6.js → ManagedArtifactProperties-B1ZA0ofn.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-B_ecuboX.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-mVJYUSOz.js → MermaidDocEditor-C30-UfMg.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-D1wdCvtf.js → SchemaConfigEditor-DPK5XbMd.js} +1 -1
- package/dist/public/assets/{SessionsHost-B64xibFa.js → SessionsHost-BRUQMi7f.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-BehtaY5A.js → SettingsDialogBody-COTbFRqi.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-j1zpEPgU.js → ShareReceiveMissDialog-B03ClkaE.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-DB2qTJQy.js → SkillToolbarControls-PvRY_LHn.js} +1 -1
- package/dist/public/assets/{SourceEditor-BzCwwYJX.js → SourceEditor-Duqpede9.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-CEJqmPwc.js → TerminalWindowApp-CFxcrkfe.js} +1 -1
- package/dist/public/assets/{TextDocEditor-CwKsLSYj.js → TextDocEditor-CHDC5byq.js} +1 -1
- package/dist/public/assets/ThreadView-CAGruMiN.js +10 -0
- package/dist/public/assets/{TimelineDiffPane-BQQyzTIK.js → TimelineDiffPane-DnaRcvCk.js} +1 -1
- package/dist/public/assets/{agent-diff-store-C2OrIeX2.js → agent-diff-store-B7oQn7l7.js} +1 -1
- package/dist/public/assets/{auth-state-cache-C9jGBLXQ.js → auth-state-cache-BUYyIMUZ.js} +1 -1
- package/dist/public/assets/{comment-chips-CQarmZw-.js → comment-chips-BhvfCPCk.js} +1 -1
- package/dist/public/assets/{config-provider-DY4FjDlE.js → config-provider-B7dMDFNr.js} +3 -3
- package/dist/public/assets/{follow-file-Bnld7t21.js → follow-file-BymUhAtT.js} +1 -1
- package/dist/public/assets/i18n-CIRn0AvV.js +1 -0
- package/dist/public/assets/{index-DrvUuXnw.js → index-B-snLDY1.js} +8 -8
- package/dist/public/assets/messages-6Fd7I7zn.js +1 -0
- package/dist/public/assets/messages-BJIB1I1L.js +1 -0
- package/dist/public/assets/messages-BOXmrfhw.js +1 -0
- package/dist/public/assets/messages-BeOM8jWl.js +1 -0
- package/dist/public/assets/messages-CCWKIebo.js +1 -0
- package/dist/public/assets/messages-CQFityfC.js +1 -0
- package/dist/public/assets/messages-CzRXVtjz.js +1 -0
- package/dist/public/assets/messages-DYiuNk7y.js +1 -0
- package/dist/public/assets/messages-Db5U-G1d.js +1 -0
- package/dist/public/assets/messages-DohtKbKM.js +1 -0
- package/dist/public/assets/messages-WWFblTuV.js +1 -0
- package/dist/public/assets/{pending-receive-nav-store-CGk3bMB9.js → pending-receive-nav-store-SZ8w-xKW.js} +1 -1
- package/dist/public/assets/{selection-context-B4Z8zSar.js → selection-context-CSP8zK1H.js} +1 -1
- package/dist/public/assets/{skill-actions-ggcP_3dF.js → skill-actions-98H3SnCL.js} +1 -1
- package/dist/public/assets/{src-CiyQ3sov.js → src-VcUCSe0b.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-Cz38cmdR.js → typing-burst-detector-BOmjXV-P.js} +1 -1
- package/dist/public/assets/{uninstall-BgGdjAhC.js → uninstall-36twrq5C.js} +1 -1
- package/dist/public/assets/{use-activity-panel-BhetneWD.js → use-activity-panel-BwANCYjg.js} +1 -1
- package/dist/public/assets/{use-open-skill-B_JUaxIs.js → use-open-skill-DCSEJ3jJ.js} +1 -1
- package/dist/public/assets/use-settings-route-CKMxexs3.js +1 -0
- package/dist/public/assets/{use-skill-directory-5lm6x97m.js → use-skill-directory-D9S5f8By.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-CVALUkgl.js → use-terminal-enabled-Ctosnrg_.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CmSMq0O7.js → use-timeline-entry-diff-CB_cI1yy.js} +1 -1
- package/dist/public/index.html +21 -21
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-gt_xu8VR.mjs → repair-launch-json-Dw-DmM-7.mjs} +2 -2
- package/dist/{repair-mcp-configs-CZap0wph.mjs → repair-mcp-configs-_Crp3ld5.mjs} +2 -2
- package/dist/repair-skills-DERbFdPf.mjs +1 -0
- package/dist/{repair-skills-BKmAMyDn.mjs → repair-skills-pwgCyOxg.mjs} +2 -2
- package/dist/{skill-teardown-OyFyNPGz.mjs → skill-teardown-CdEzylv3.mjs} +2 -2
- package/dist/{src-BVdLRbuK.mjs → src-Cbll3h9C.mjs} +1 -1
- package/dist/{src-BdylDHZb.mjs → src-CyIFaiha.mjs} +394 -394
- package/dist/src-D1KYHbNb.mjs +20 -0
- package/dist/start-BYP9HnVP.mjs +1 -0
- package/dist/{start-DPV97Qyi.mjs → start-Dfs6ryKa.mjs} +3 -3
- package/dist/{write-project-skill-jv0sIzZJ.mjs → write-project-skill-BT83YFFS.mjs} +2 -2
- package/package.json +4 -4
- package/dist/constants-Db61uBoY.mjs +0 -2
- package/dist/init-Cg4cmiPF.mjs +0 -1
- package/dist/loader-h6m6KsF2.mjs +0 -1
- package/dist/preview-2nRdxeOJ.mjs +0 -1
- package/dist/public/assets/FeedbackForm-V1teW6On.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-BUuq-eWT.js +0 -1
- package/dist/public/assets/ThreadView-TiaaWpue.js +0 -10
- package/dist/public/assets/i18n-Ckp5vyuq.js +0 -1
- package/dist/public/assets/messages-B6_1Ejgf.js +0 -1
- package/dist/public/assets/messages-BIeTbEwr.js +0 -1
- package/dist/public/assets/messages-C5keGFu8.js +0 -1
- package/dist/public/assets/messages-CdE758JS.js +0 -1
- package/dist/public/assets/messages-DH9PADx7.js +0 -1
- package/dist/public/assets/messages-DjGb_ycu.js +0 -1
- package/dist/public/assets/messages-DododtZ5.js +0 -1
- package/dist/public/assets/messages-Du4LAkbI.js +0 -1
- package/dist/public/assets/messages-DumBz2db.js +0 -1
- package/dist/public/assets/messages-nrpTbeRu.js +0 -1
- package/dist/public/assets/messages-vu7QED0b.js +0 -1
- package/dist/public/assets/use-settings-route-DnETJDgF.js +0 -1
- package/dist/repair-skills-B8raYZKq.mjs +0 -1
- package/dist/src-CVfzGd-H.mjs +0 -20
- package/dist/start-CqvbbRHD.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{i as n,lr as r,wr as i,xr as a}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{i as n,lr as r,wr as i,xr as a}from"./DocumentContext-C-Lo65-_.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,o as d,r as f}from"./local-menu-action-bus-DLozq_c4.js";import{t as p}from"./utils-CPqDy6Hr.js";import{c as m,i as h,l as g}from"./ChangedOutsideBadge-GeQfL_b-.js";import{t as _}from"./button-RQ5o7P7w.js";import{i as v,n as y,t as b}from"./tooltip-x7BNUa3s.js";import{a as x,c as S,i as C,n as w,o as T,s as E,t as D}from"./dialog-eak3pI7G.js";import{a as O,m as k,r as A,t as j}from"./dropdown-menu-BhMtMvZp.js";import{t as M}from"./label-BT2yjpKR.js";import{n as N,t as P}from"./radio-group-CmCnommQ.js";import{t as F}from"./switch-0kSGDL9E.js";import{n as I,t as L}from"./toggle-group-DAYvcc1F.js";import{Dt as R,Et as z,Io as ee,Jo as te,Ot as B,Ro as V,Rt as H,eo as U,ht as W,jt as G,kt as K,no as q}from"./dist-PVtTd_Sj2.js";import{t as J}from"./createLucideIcon-BbftclCc.js";import{f as ne,n as re,r as ie,t as ae}from"./EnableSyncConfirmDialog-B1Eo_sVE.js";import{s as oe}from"./Mermaid-Cr48L9fH.js";import{t as se}from"./arrow-up-right-0IN5lFEX.js";import{t as ce}from"./check-BLuQ2zvV.js";import{n as le}from"./CopyButton-DysciFW5.js";import{s as Y}from"./prop-types-DoONHMUn.js";import{t as ue}from"./download-Bq4sKAdj.js";import{a as de,r as fe,t as pe}from"./folder-config-api-IGZhtkRo.js";import{t as me}from"./loader-circle-Coob8S41.js";import{t as he}from"./refresh-cw-REpEMEB2.js";import{t as ge}from"./trash-2-BSr7FcE8.js";import{t as _e}from"./triangle-alert-DNTyNeem.js";import{t as ve}from"./x-COTyTduF.js";import{n as ye}from"./dist-CEwo98ia.js";import{t as be}from"./input-BKUcczSW.js";import{t as X}from"./dist-C7IFraT6.js";import{f as xe,n as Se,u as Ce}from"./doc-paths-CH8QyanF.js";import{t as we}from"./parse-api-error-Cyn4P6OR.js";import{d as Te,o as Ee,p as De}from"./documents-events-COSAPFkC.js";import{a as Oe,i as ke,n as Ae,o as je,r as Me,s as Ne,t as Pe}from"./field-DN11CYjs.js";import"./config-provider-B7dMDFNr.js";import{b as Fe}from"./skills-api-qDbnaMmu.js";import{n as Ie}from"./config-context-DNY4at5d.js";import{t as Le}from"./external-link-BkNoUOYg.js";import{t as Re}from"./use-workspace--QTATo27.js";import{t as ze}from"./textarea-C5-cm3M6.js";import{n as Be,t as Ve}from"./clipboard-adapter-C4L1qX1X.js";var He=J(`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=J(`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=J(`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=J(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),Ke=J(`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=J(`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 De(()=>{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:X._({id:`_ci9Bj`})});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(we(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=()=>De(()=>{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=H.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:X._({id:`RLNIgv`})});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(we(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 Te(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=W.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)??X._({id:`sGZLfB`})};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||X._({id:`sGZLfB`})}}if(!r||!Array.isArray(r.repos))return{ok:!1,error:X._({id:`sGZLfB`})};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=W.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=W.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),[v,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(v/6e4),k=Math.floor(v%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=>Le(e,l),onAuxClick:e=>Le(e,l),className:`inline-flex items-center gap-0.5 text-foreground hover:text-primary hover:underline`}),1:(0,$.jsx)(`span`,{}),2:(0,$.jsx)(se,{className:`inline size-3.5`,"aria-hidden":!0})}})}),(0,$.jsxs)(_,{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)(ce,{className:`size-4`}):(0,$.jsx)(le,{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)(be,{"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)(be,{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)(_,{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=>Le(e,f),h=e=>Le(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 v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(se,{className:`inline size-3.5`,"aria-hidden":!0}),t[9]=v):v=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,v]}),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)(be,{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 v=g,[y,b]=(0,Q.useState)(`auth`),[x,O]=(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,ee]=(0,Q.useState)(void 0),[te,B]=(0,Q.useState)(void 0),V=d??z,H=!!V&&V!==`github.com`&&!!(f??te)&&typeof h.ghLogin==`function`,U=!a&&d===void 0,W,G;t[4]!==d||t[5]!==a||t[6]!==U||t[7]!==n?(W=()=>{n&&(O(null),A(``),M(``),P(``),I(null),R(!1),ee(void 0),B(void 0),b(a||U?`checking`:d&&d!==`github.com`?`pat`:`auth`))},G=[n,a,d,U],t[4]=d,t[5]=a,t[6]=U,t[7]=n,t[8]=W,t[9]=G):(W=t[8],G=t[9]),(0,Q.useLayoutEffect)(W,G);let K;t[10]!==a||t[11]!==n||t[12]!==v?(K=()=>{if(!n||!a)return;let e=!1,t=t=>{e||(e=!0,b(t))},r=setTimeout(()=>t(`auth`),Ot);return v.status().then(n=>{e||(n.authenticated?(O({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]=v,t[13]=K):K=t[13];let q;t[14]!==a||t[15]!==n?(q=[n,a],t[14]=a,t[15]=n,t[16]=q):q=t[16],(0,Q.useEffect)(K,q);let J;t[17]!==U||t[18]!==n||t[19]!==v?(J=()=>{if(!n||!U)return;let e=!1,t=t=>{e||(e=!0,b(t))},r=setTimeout(()=>t(`auth`),Ot);return v.status().then(n=>{if(e)return;let r=!!n.host&&n.host!==`github.com`;ee(n.host),B(n.ghAvailable),t(r?`pat`:`auth`)}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[17]=U,t[18]=n,t[19]=v,t[20]=J):J=t[20];let ne;t[21]!==U||t[22]!==n?(ne=[n,U],t[21]=U,t[22]=n,t[23]=ne):ne=t[23],(0,Q.useEffect)(J,ne);let re;t[24]!==p||t[25]!==a||t[26]!==r||t[27]!==i?(re=function(e){if(O(e),a)A(e.name??``),M(e.email??``),b(`identity`);else{b(`done`),i?.(e),r(!1);let t=e.login;ye.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]!==V||t[31]!==ie||t[32]!==L||t[33]!==N||t[34]!==h?(ae=async function(){let e=N.trim();if(!e||!V||L)return;if(!h.pat){I(p({id:`iMYFJM`}));return}R(!0),I(null);let t=await h.pat(V,e);R(!1),t.ok?ie({login:t.login??``}):I(t.error??p({id:`sNeKjP`}))},t[29]=p,t[30]=V,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;ye.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;ye.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 Y=le,ue;t[46]===r?ue=t[47]:(ue=function(){r(!1)},t[46]=r,t[47]=ue);let de=ue,fe;t[48]!==a||t[49]!==o||t[50]!==y?(fe=(0,$.jsx)(E,{children:(0,$.jsx)(S,{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)(w,{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)(w,{children:(0,$.jsx)(Tt,{onSuccess:ie,startFlow:()=>h.start()})}),(0,$.jsx)(T,{children:(0,$.jsx)(_,{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]!==H||t[60]!==V||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)(w,{children:(0,$.jsx)(Dt,{host:V??``,token:N,onTokenChange:P,error:F,onSubmit:oe,showGhOption:H,onGhSignIn:()=>b(`gh-device`)})}),(0,$.jsxs)(T,{children:[(0,$.jsx)(_,{variant:`outline`,className:`font-mono uppercase`,onClick:de,children:(0,$.jsx)(s,{id:`dEgA5A`})}),(0,$.jsx)(_,{onClick:oe,disabled:!N.trim()||L,children:L?(0,$.jsx)(s,{id:`9zb2WA`}):(0,$.jsx)(s,{id:`iSLIjg`})})]})]}),t[59]=H,t[60]=V,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]!==V||t[69]!==ie||t[70]!==de||t[71]!==h||t[72]!==y?(ge=y===`gh-device`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(w,{children:(0,$.jsx)(Tt,{onSuccess:ie,startFlow:()=>h.ghLogin?.(V??``)??h.start()})}),(0,$.jsxs)(T,{children:[(0,$.jsx)(_,{variant:`ghost`,onClick:()=>b(`pat`),children:(0,$.jsx)(s,{id:`hLKfZe`})}),(0,$.jsx)(_,{variant:`outline`,className:`font-mono uppercase`,onClick:de,children:(0,$.jsx)(s,{id:`dEgA5A`})})]})]}),t[68]=V,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]!==Y||t[77]!==j||t[78]!==k||t[79]!==y?(_e=y===`identity`&&x&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(w,{children:(0,$.jsx)(Et,{login:x.login,name:k,onNameChange:A,email:j,onEmailChange:M})}),(0,$.jsxs)(T,{children:[(0,$.jsx)(_,{variant:`ghost`,onClick:Y,children:(0,$.jsx)(s,{id:`6Uau97`})}),(0,$.jsx)(_,{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]=Y,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)(C,{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 be;return t[88]!==r||t[89]!==n||t[90]!==ve?(be=(0,$.jsx)(D,{open:n,onOpenChange:r,children:ve}),t[88]=r,t[89]=n,t[90]=ve,t[91]=be):be=t[91],be}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)(je,{htmlFor:u,children:d}),t[1]=u,t[2]=f);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(Me,{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)(Pe,{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 q(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(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BUgB2tll.js";import{En as t,G as n,On as r,Q as i,Qn as a,Y as o,dt as s,mt as c,pt as l}from"./DocumentContext-Dne83XLH.js";import{n as u,r as d}from"./dist-Nvb76hAm.js";import{t as f}from"./compiler-runtime-BfE3aGVn.js";import{c as p}from"./local-menu-action-bus-DLozq_c4.js";import{t as m}from"./utils-CPqDy6Hr.js";import{t as h}from"./button-RQ5o7P7w.js";import{T as g,it as _}from"./CodeMirrorPropInput-DlE2CeLE.js";import{t as v}from"./checkbox-V0IoPAe3.js";import{An as y,Gn as b,Yr as x,gn as S,hn as C}from"./dist-PVtTd_Sj2.js";import{t as w}from"./createLucideIcon-BbftclCc.js";import{t as ee}from"./chevron-down-DrpHBSgH.js";import{t as T}from"./x-COTyTduF.js";import{f as E}from"./doc-paths-CH8QyanF.js";var D=w(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),O=w(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),k=f(),A=`245,158,11`,te=A,ne={fill:.22,line:.7},re={fill:.45,line:1},ie=.45;function ae(e,t){let n=te,{fill:r,line:i}=t?re:ne;return[`border-radius:2px`,`padding-bottom:1px`,...e.id===null?[]:[`cursor:pointer`],`background-color:rgba(${n},${r})`,`box-shadow:inset 0 -2px 0 rgba(${n},${i})`,``].join(`;`)}function j(e){return e.map(e=>e.id??`·`).join(`|`)}function M(e){let t=null;for(let n of e)n.id!==null&&(t===null||n.to-n.from<t.to-t.from)&&(t=n);return t?.id??null}function N(e,t){return e.id===null||e.id===t}function oe(e,t=null){let n=[...e].filter(e=>e.from<e.to).sort((e,t)=>e.from-t.from||e.to-t.to||(e.id??``).localeCompare(t.id??``));if(n.length===0)return[];let r=[...new Set(n.flatMap(e=>[e.from,e.to]))].sort((e,t)=>e-t),i=[],a=null,o=()=>{if(a===null)return;let e=a.covering.find(e=>N(e,t));i.push({from:a.from,to:a.to,style:ae(e??a.covering[0],e!==void 0),threadId:M(a.covering)}),a=null};for(let e=0;e<r.length-1;e++){let t=r[e],i=r[e+1],s=n.filter(e=>e.from<=t&&e.to>=i);if(s.length===0){o();continue}if(a!==null&&a.to===t&&j(a.covering)===j(s)){a.to=i;continue}o(),a={from:t,to:i,covering:s}}return o(),i}var P=`data-comment-reveal`;function F(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e}function I(e){return e===``?null:document.querySelector(`[data-testid="property-row"][data-key="${F(e)}"]`)}function se(e){let t=I(e);if(t===null)return null;let n=t.getBoundingClientRect();return n.height===0&&n.width===0?null:n}function ce(e){I(e)?.scrollIntoView({block:`center`,behavior:`smooth`})}function L(e){if(e.quote===``)return!1;let t=e.path.length===0?e.key:e.path[e.path.length-1],n=Array.from(document.querySelectorAll(`[data-testid="property-row"][data-key="${F(String(t))}"]`)),r=Array.from(document.querySelectorAll(`[data-testid="property-row"]`));for(let t of[...n,...r]){let n=t.querySelector(`textarea, input`);if(n===null)continue;let r=le(n.value,e.quote,e.start,e.end);if(r!==null)return t.scrollIntoView({block:`center`,behavior:`smooth`}),n.focus(),n.setSelectionRange(r.start,r.end),ue(n),!0}return!1}function le(e,t,n,r){if(n!==void 0&&r!==void 0&&e.slice(n,r)===t)return{start:n,end:r};let i=e.indexOf(t);return i<0?null:{start:i,end:i+t.length}}function ue(e){e.style.setProperty(`--comment-reveal-fill`,`rgba(${A},${ie})`),e.setAttribute(P,`true`);let t=()=>{e.removeAttribute(P),e.style.removeProperty(`--comment-reveal-fill`)};e.addEventListener(`blur`,t,{once:!0}),e.addEventListener(`pointerdown`,t,{once:!0}),e.addEventListener(`keydown`,t,{once:!0})}function R(e,{includeBlockComponents:t=!1}={}){let n=``,r=[];return e.descendants((e,i)=>{if(e.isText&&e.text){for(let t=0;t<e.text.length;t++)n+=e.text[t],r.push(i+t);return!0}if(e.isBlock&&!t)return!0;let a=C(e);if(a.length>0){let t=i+e.nodeSize-1;for(let e=0;e<a.length;e++)n+=a[e],r.push(e===a.length-1?t:i)}return!0}),{text:n,positions:r}}function de(e,t){let n=[];if(t===``)return n;let r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1);return n}function z(e,t,n){let r=n?.prefix??``,i=n?.suffix??``;if(r===``&&i===``)return null;let a=r===``?[0]:b(e,r,{syntaxIn:`needle`}).map(e=>e.end),o=i===``?[e.length]:b(e,i,{syntaxIn:`needle`}).map(e=>e.start);if(a.length!==1||o.length!==1)return null;let s=a[0],c=o[0];for(;s<c&&/\s/.test(e[s]??``);)s+=1;for(;c>s&&/\s/.test(e[c-1]??``);)--c;if(c<=s)return null;let l=x(t.length);return c-s>l?null:{start:s,end:c}}function B(e,t){let n=e.positions[t.start],r=e.positions[t.end-1];return n==null||r==null?null:{from:n,to:r+1}}function V(e,t,n){if(t.length===0)return null;let r=de(e.text,t).map(e=>({start:e,end:e+t.length}));if(r.length===0&&(r=b(e.text,t,{syntaxIn:`needle`})),r.length===0){let r=z(e.text,t,n);return r===null?null:B(e,r)}if(r.length===1)return B(e,r[0]);let i=n?.prefix??``,a=n?.suffix??``,o=[],s=-1;for(let t of r){let n=y(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`});n>s?(s=n,o=[t]):n===s&&o.push(t)}return B(e,o[0])}var H=64;function fe(e,t,n){return{prefix:S(e,Math.max(0,t-H),t),suffix:S(e,n,Math.min(e.content.size,n+H))}}function U(e,t,n){return W(e)(t,n)}function W(e){let t=R(e),n=null;return(r,i)=>{let a=V(t,r,i);return a===null?(n??=R(e,{includeBlockComponents:!0}),V(n,r,i)):a}}var pe=220,me=24;function he(e){let t=e.viewTop+e.insetTop,n=e.viewBottom-pe;return e.anchorTop>=t&&e.anchorBottom<=n?0:e.anchorTop-(t+me)}function G(e){let t=e?.parentElement??null;for(;t;){let e=getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)return t;t=t.parentElement}return null}function K(e){let t=Number.parseFloat(getComputedStyle(e).scrollPaddingTop);return Number.isFinite(t)?t:0}function q(e,t){let n=g(e);if(!n)return;let r=G(n.dom);if(!r){e.commands.scrollIntoView();return}let i,a;try{i=n.coordsAtPos(t.from),a=n.coordsAtPos(t.to)}catch{return}let o=r.getBoundingClientRect(),s=he({anchorTop:i.top,anchorBottom:Math.max(i.bottom,a.bottom),viewTop:o.top,viewBottom:o.bottom,insetTop:K(r)});if(s===0)return;let c=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;r.scrollTo({top:r.scrollTop+s,behavior:c?`auto`:`smooth`})}var ge=1e4;function _e(e){let i=()=>{let r=t(e.docName);if(!r||r.isDestroyed)return!1;let i=U(r.state.doc,e.quote,e.context);return i&&(r.chain().focus().setTextSelection(i).run(),q(r,i)),n(e.threadId),!0};if(a(`comments`),i())return;window.location.assign(E(e.docName));let o=!1,s=()=>{o||(o=!0,c(),window.clearTimeout(l))},c=r(()=>{i()&&s()}),l=window.setTimeout(s,ge);i()&&s()}var J=e();function ve(){let e=(0,k.c)(2),t=l(),n;if(e[0]!==t){n=[];for(let e of t){let t=o(e);t!==null&&n.push(t)}e[0]=t,e[1]=n}else n=e[1];return n}function ye(){return c().length}function be(e){let t=(0,k.c)(34),{count:n,attached:r,expanded:i,onAttach:a,onToggleExpanded:o,onDismiss:s}=e,{_:c}=d();if(n===0)return null;if(!r){let e;t[0]===c?e=t[1]:(e=c({id:`UpOct_`}),t[0]=c,t[1]=e);let n,r,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=m(`h-auto min-h-0 gap-1 rounded-md border border-dashed bg-transparent px-1.5 py-0.5`,`text-xs font-normal text-muted-foreground hover:bg-muted/60 hover:text-foreground`),r=(0,J.jsx)(p,{className:`size-3`}),i=(0,J.jsx)(u,{id:`VbyRUy`}),t[2]=n,t[3]=r,t[4]=i):(n=t[2],r=t[3],i=t[4]);let o;return t[5]!==a||t[6]!==e?(o=(0,J.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-pressed":!1,"aria-label":e,onClick:a,"data-testid":`composer-context-chip-comments`,className:n,children:[r,i]}),t[5]=a,t[6]=e,t[7]=o):o=t[7],o}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=m(`inline-flex items-center gap-1 rounded-md border bg-muted/60 py-0.5 pr-0.5 pl-1.5`,`text-xs text-muted-foreground`),t[8]=l):l=t[8];let f;t[9]!==c||t[10]!==i?(f=c(i?{id:`kMKqP_`}:{id:`15MMFT`}),t[9]=c,t[10]=i,t[11]=f):f=t[11];let g;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,J.jsx)(D,{className:`size-3`}),t[12]=g):g=t[12];let _;t[13]===n?_=t[14]:(_=(0,J.jsx)(u,{id:`eiUA4k`,values:{count:n}}),t[13]=n,t[14]=_);let v=i&&`rotate-180`,y;t[15]===v?y=t[16]:(y=m(`size-3 transition-transform`,v),t[15]=v,t[16]=y);let b;t[17]===y?b=t[18]:(b=(0,J.jsx)(ee,{className:y}),t[17]=y,t[18]=b);let x;t[19]!==i||t[20]!==o||t[21]!==f||t[22]!==_||t[23]!==b?(x=(0,J.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-expanded":i,"aria-label":f,onClick:o,"data-testid":`composer-comments-peek`,className:`h-auto min-h-0 gap-1 px-0.5 py-0 text-xs font-normal text-muted-foreground hover:text-foreground`,children:[g,_,b]}),t[19]=i,t[20]=o,t[21]=f,t[22]=_,t[23]=b,t[24]=x):x=t[24];let S;t[25]===c?S=t[26]:(S=c({id:`pFRz_E`}),t[25]=c,t[26]=S);let C;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,J.jsx)(T,{className:`size-3`}),t[27]=C):C=t[27];let w;t[28]!==s||t[29]!==S?(w=(0,J.jsx)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":S,onClick:s,className:`size-4 p-0 text-muted-foreground hover:text-foreground`,children:C}),t[28]=s,t[29]=S,t[30]=w):w=t[30];let E;return t[31]!==w||t[32]!==x?(E=(0,J.jsxs)(`span`,{"data-testid":`composer-context-chip-comments`,className:l,children:[x,w]}),t[31]=w,t[32]=x,t[33]=E):E=t[33],E}function Y(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function X(e,t){let n=e;for(let e of t)n+=typeof e==`number`?`[${e}]`:`.${e}`;return n}function Z(e){let t=(0,k.c)(14),{thread:n,className:r}=e,i=n.anchor?.quote??``;if(n.target.kind===`property`){let e;t[0]!==n.target.key||t[1]!==n.target.path?(e=X(n.target.key,n.target.path),t[0]=n.target.key,t[1]=n.target.path,t[2]=e):e=t[2];let a=e,o;t[3]===r?o=t[4]:(o=m(`w-full truncate font-mono text-[11px] text-muted-foreground`,r),t[3]=r,t[4]=o);let s=i===``?``:` “${i}”`,c;return t[5]!==a||t[6]!==o||t[7]!==s?(c=(0,J.jsxs)(`span`,{className:o,children:[a,`:`,s]}),t[5]=a,t[6]=o,t[7]=s,t[8]=c):c=t[8],c}let a;t[9]===r?a=t[10]:(a=m(`w-full truncate font-mono text-[11px] text-muted-foreground`,r),t[9]=r,t[10]=a);let o;return t[11]!==i||t[12]!==a?(o=(0,J.jsxs)(`span`,{className:a,children:[`“`,i,`”`]}),t[11]=i,t[12]=a,t[13]=o):o=t[13],o}function Q(e){_e({docName:e.docName,quote:e.target.kind===`property`?``:e.anchor?.quote??``,threadId:e.id,context:e.anchor??void 0});let{target:t,anchor:n}=e;if(t.kind!==`property`||n===null)return;let r=0,i=()=>{L({key:t.key,path:t.path,quote:n.quote,start:n.start,end:n.end})||(r+=1,!(r>=xe)&&requestAnimationFrame(i))};requestAnimationFrame(i)}var xe=30;function Se(e){let t=(0,k.c)(9),{threads:n}=e,{_:r}=d(),a=c();if(n.length===0)return null;let o;if(t[0]!==r||t[1]!==a||t[2]!==n){let e;t[4]!==r||t[5]!==a?(e=e=>{let t=e.status===`orphaned`,n=a.includes(e.id);return(0,J.jsxs)(`li`,{className:m(`flex items-start gap-2 rounded-md border bg-background/60 px-2 py-1.5`,!n&&`opacity-50`),children:[(0,J.jsx)(v,{checked:n,onCheckedChange:()=>s(e.id),"aria-label":r({id:`Uoux8m`}),className:`mt-0.5`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1 rounded border px-1 py-px text-[10px] text-muted-foreground`,title:e.docName,children:[(0,J.jsx)(_,{className:`size-2.5 shrink-0`}),(0,J.jsx)(`span`,{className:`truncate`,children:Y(e.docName)})]}),t&&(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-[10px] text-amber-600 dark:text-amber-500`,title:r({id:`MBe6TE`}),children:[(0,J.jsx)(O,{className:`size-2.5`}),(0,J.jsx)(u,{id:`2UgoBZ`})]})]}),(0,J.jsxs)(h,{type:`button`,variant:`ghost`,"aria-label":r({id:`rscgd_`,values:{0:Y(e.docName)}}),onClick:()=>Q(e),className:`h-auto min-h-0 w-full min-w-0 flex-col items-start gap-1 px-0 py-0 text-left font-normal hover:bg-transparent`,children:[(0,J.jsx)(Z,{thread:e}),(0,J.jsx)(`span`,{className:`line-clamp-2 w-full text-xs whitespace-normal text-foreground/90`,children:e.body})]})]}),(0,J.jsx)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":r({id:`1jym2J`}),onClick:()=>i(e.id),className:`size-5 shrink-0 p-0 text-muted-foreground hover:text-foreground`,children:(0,J.jsx)(T,{className:`size-3`})})]},e.id)},t[4]=r,t[5]=a,t[6]=e):e=t[6],o=n.map(e),t[0]=r,t[1]=a,t[2]=n,t[3]=o}else o=t[3];let l;return t[7]===o?l=t[8]:(l=(0,J.jsx)(`ul`,{"data-testid":`composer-comments-list`,className:`mt-1 flex max-h-64 basis-full list-none flex-col gap-1 overflow-y-auto subtle-scrollbar`,children:o}),t[7]=o,t[8]=l),l}function Ce(e){return{docName:e.docName,body:e.instruction,propertyKey:e.property,quote:e.passage?.exact??``,anchorLost:e.anchorLost,prefix:e.passage?.prefix??``,suffix:e.passage?.suffix??``,repeats:e.passageRepeats}}var $=48;function we(e){let t=e.replace(/\s+/g,` `).trimStart();return t.length>$?`…${t.slice(-$)}`:t}function Te(e){let t=e.replace(/\s+/g,` `).trimEnd();return t.length>$?`${t.slice(0,$)}…`:t}function Ee(e){if(!e.repeats)return null;let t=we(e.prefix),n=Te(e.suffix);return t===``&&n===``?null:`(This text appears more than once in the file. The one meant is ${t===``?`at the start of the file, followed by "${n}"`:n===``?`at the end of the file, preceded by "${t}"`:`between "${t}" and "${n}"`} — match that context rather than the first occurrence.)`}function De(e,t,n){let r=t.trim(),i=[];if(i.push(r.length>0?r:`Address the following review comments by editing the documents directly.`),i.push(``),i.push(e.length===1?`The comment:`:`The ${e.length} comments:`),e.forEach((e,t)=>{if(i.push(``),e.propertyKey){let n=e.quote.trim();if(n===``)i.push(`${t+1}. In \`${e.docName}\`, on the \`${e.propertyKey}\` property (frontmatter):`),i.push(``),i.push(` ${e.body.trim()}`);else{i.push(`${t+1}. In \`${e.docName}\`, on this text within the \`${e.propertyKey}\` property (frontmatter):`),i.push(``);for(let e of n.split(`
|
|
1
|
+
import{t as e}from"./jsx-runtime-BUgB2tll.js";import{En as t,G as n,On as r,Q as i,Qn as a,Y as o,dt as s,mt as c,pt as l}from"./DocumentContext-C-Lo65-_.js";import{n as u,r as d}from"./dist-Nvb76hAm.js";import{t as f}from"./compiler-runtime-BfE3aGVn.js";import{c as p}from"./local-menu-action-bus-DLozq_c4.js";import{t as m}from"./utils-CPqDy6Hr.js";import{t as h}from"./button-RQ5o7P7w.js";import{T as g,it as _}from"./CodeMirrorPropInput-3TWUbzXY.js";import{t as v}from"./checkbox-V0IoPAe3.js";import{An as y,Gn as b,Yr as x,gn as S,hn as C}from"./dist-PVtTd_Sj2.js";import{t as w}from"./createLucideIcon-BbftclCc.js";import{t as ee}from"./chevron-down-DrpHBSgH.js";import{t as T}from"./x-COTyTduF.js";import{f as E}from"./doc-paths-CH8QyanF.js";var D=w(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),O=w(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),k=f(),A=`245,158,11`,te=A,ne={fill:.22,line:.7},re={fill:.45,line:1},ie=.45;function ae(e,t){let n=te,{fill:r,line:i}=t?re:ne;return[`border-radius:2px`,`padding-bottom:1px`,...e.id===null?[]:[`cursor:pointer`],`background-color:rgba(${n},${r})`,`box-shadow:inset 0 -2px 0 rgba(${n},${i})`,``].join(`;`)}function j(e){return e.map(e=>e.id??`·`).join(`|`)}function M(e){let t=null;for(let n of e)n.id!==null&&(t===null||n.to-n.from<t.to-t.from)&&(t=n);return t?.id??null}function N(e,t){return e.id===null||e.id===t}function oe(e,t=null){let n=[...e].filter(e=>e.from<e.to).sort((e,t)=>e.from-t.from||e.to-t.to||(e.id??``).localeCompare(t.id??``));if(n.length===0)return[];let r=[...new Set(n.flatMap(e=>[e.from,e.to]))].sort((e,t)=>e-t),i=[],a=null,o=()=>{if(a===null)return;let e=a.covering.find(e=>N(e,t));i.push({from:a.from,to:a.to,style:ae(e??a.covering[0],e!==void 0),threadId:M(a.covering)}),a=null};for(let e=0;e<r.length-1;e++){let t=r[e],i=r[e+1],s=n.filter(e=>e.from<=t&&e.to>=i);if(s.length===0){o();continue}if(a!==null&&a.to===t&&j(a.covering)===j(s)){a.to=i;continue}o(),a={from:t,to:i,covering:s}}return o(),i}var P=`data-comment-reveal`;function F(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e}function I(e){return e===``?null:document.querySelector(`[data-testid="property-row"][data-key="${F(e)}"]`)}function se(e){let t=I(e);if(t===null)return null;let n=t.getBoundingClientRect();return n.height===0&&n.width===0?null:n}function ce(e){I(e)?.scrollIntoView({block:`center`,behavior:`smooth`})}function L(e){if(e.quote===``)return!1;let t=e.path.length===0?e.key:e.path[e.path.length-1],n=Array.from(document.querySelectorAll(`[data-testid="property-row"][data-key="${F(String(t))}"]`)),r=Array.from(document.querySelectorAll(`[data-testid="property-row"]`));for(let t of[...n,...r]){let n=t.querySelector(`textarea, input`);if(n===null)continue;let r=le(n.value,e.quote,e.start,e.end);if(r!==null)return t.scrollIntoView({block:`center`,behavior:`smooth`}),n.focus(),n.setSelectionRange(r.start,r.end),ue(n),!0}return!1}function le(e,t,n,r){if(n!==void 0&&r!==void 0&&e.slice(n,r)===t)return{start:n,end:r};let i=e.indexOf(t);return i<0?null:{start:i,end:i+t.length}}function ue(e){e.style.setProperty(`--comment-reveal-fill`,`rgba(${A},${ie})`),e.setAttribute(P,`true`);let t=()=>{e.removeAttribute(P),e.style.removeProperty(`--comment-reveal-fill`)};e.addEventListener(`blur`,t,{once:!0}),e.addEventListener(`pointerdown`,t,{once:!0}),e.addEventListener(`keydown`,t,{once:!0})}function R(e,{includeBlockComponents:t=!1}={}){let n=``,r=[];return e.descendants((e,i)=>{if(e.isText&&e.text){for(let t=0;t<e.text.length;t++)n+=e.text[t],r.push(i+t);return!0}if(e.isBlock&&!t)return!0;let a=C(e);if(a.length>0){let t=i+e.nodeSize-1;for(let e=0;e<a.length;e++)n+=a[e],r.push(e===a.length-1?t:i)}return!0}),{text:n,positions:r}}function de(e,t){let n=[];if(t===``)return n;let r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1);return n}function z(e,t,n){let r=n?.prefix??``,i=n?.suffix??``;if(r===``&&i===``)return null;let a=r===``?[0]:b(e,r,{syntaxIn:`needle`}).map(e=>e.end),o=i===``?[e.length]:b(e,i,{syntaxIn:`needle`}).map(e=>e.start);if(a.length!==1||o.length!==1)return null;let s=a[0],c=o[0];for(;s<c&&/\s/.test(e[s]??``);)s+=1;for(;c>s&&/\s/.test(e[c-1]??``);)--c;if(c<=s)return null;let l=x(t.length);return c-s>l?null:{start:s,end:c}}function B(e,t){let n=e.positions[t.start],r=e.positions[t.end-1];return n==null||r==null?null:{from:n,to:r+1}}function V(e,t,n){if(t.length===0)return null;let r=de(e.text,t).map(e=>({start:e,end:e+t.length}));if(r.length===0&&(r=b(e.text,t,{syntaxIn:`needle`})),r.length===0){let r=z(e.text,t,n);return r===null?null:B(e,r)}if(r.length===1)return B(e,r[0]);let i=n?.prefix??``,a=n?.suffix??``,o=[],s=-1;for(let t of r){let n=y(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`});n>s?(s=n,o=[t]):n===s&&o.push(t)}return B(e,o[0])}var H=64;function fe(e,t,n){return{prefix:S(e,Math.max(0,t-H),t),suffix:S(e,n,Math.min(e.content.size,n+H))}}function U(e,t,n){return W(e)(t,n)}function W(e){let t=R(e),n=null;return(r,i)=>{let a=V(t,r,i);return a===null?(n??=R(e,{includeBlockComponents:!0}),V(n,r,i)):a}}var pe=220,me=24;function he(e){let t=e.viewTop+e.insetTop,n=e.viewBottom-pe;return e.anchorTop>=t&&e.anchorBottom<=n?0:e.anchorTop-(t+me)}function G(e){let t=e?.parentElement??null;for(;t;){let e=getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)return t;t=t.parentElement}return null}function K(e){let t=Number.parseFloat(getComputedStyle(e).scrollPaddingTop);return Number.isFinite(t)?t:0}function q(e,t){let n=g(e);if(!n)return;let r=G(n.dom);if(!r){e.commands.scrollIntoView();return}let i,a;try{i=n.coordsAtPos(t.from),a=n.coordsAtPos(t.to)}catch{return}let o=r.getBoundingClientRect(),s=he({anchorTop:i.top,anchorBottom:Math.max(i.bottom,a.bottom),viewTop:o.top,viewBottom:o.bottom,insetTop:K(r)});if(s===0)return;let c=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;r.scrollTo({top:r.scrollTop+s,behavior:c?`auto`:`smooth`})}var ge=1e4;function _e(e){let i=()=>{let r=t(e.docName);if(!r||r.isDestroyed)return!1;let i=U(r.state.doc,e.quote,e.context);return i&&(r.chain().focus().setTextSelection(i).run(),q(r,i)),n(e.threadId),!0};if(a(`comments`),i())return;window.location.assign(E(e.docName));let o=!1,s=()=>{o||(o=!0,c(),window.clearTimeout(l))},c=r(()=>{i()&&s()}),l=window.setTimeout(s,ge);i()&&s()}var J=e();function ve(){let e=(0,k.c)(2),t=l(),n;if(e[0]!==t){n=[];for(let e of t){let t=o(e);t!==null&&n.push(t)}e[0]=t,e[1]=n}else n=e[1];return n}function ye(){return c().length}function be(e){let t=(0,k.c)(34),{count:n,attached:r,expanded:i,onAttach:a,onToggleExpanded:o,onDismiss:s}=e,{_:c}=d();if(n===0)return null;if(!r){let e;t[0]===c?e=t[1]:(e=c({id:`UpOct_`}),t[0]=c,t[1]=e);let n,r,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=m(`h-auto min-h-0 gap-1 rounded-md border border-dashed bg-transparent px-1.5 py-0.5`,`text-xs font-normal text-muted-foreground hover:bg-muted/60 hover:text-foreground`),r=(0,J.jsx)(p,{className:`size-3`}),i=(0,J.jsx)(u,{id:`VbyRUy`}),t[2]=n,t[3]=r,t[4]=i):(n=t[2],r=t[3],i=t[4]);let o;return t[5]!==a||t[6]!==e?(o=(0,J.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-pressed":!1,"aria-label":e,onClick:a,"data-testid":`composer-context-chip-comments`,className:n,children:[r,i]}),t[5]=a,t[6]=e,t[7]=o):o=t[7],o}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=m(`inline-flex items-center gap-1 rounded-md border bg-muted/60 py-0.5 pr-0.5 pl-1.5`,`text-xs text-muted-foreground`),t[8]=l):l=t[8];let f;t[9]!==c||t[10]!==i?(f=c(i?{id:`kMKqP_`}:{id:`15MMFT`}),t[9]=c,t[10]=i,t[11]=f):f=t[11];let g;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,J.jsx)(D,{className:`size-3`}),t[12]=g):g=t[12];let _;t[13]===n?_=t[14]:(_=(0,J.jsx)(u,{id:`eiUA4k`,values:{count:n}}),t[13]=n,t[14]=_);let v=i&&`rotate-180`,y;t[15]===v?y=t[16]:(y=m(`size-3 transition-transform`,v),t[15]=v,t[16]=y);let b;t[17]===y?b=t[18]:(b=(0,J.jsx)(ee,{className:y}),t[17]=y,t[18]=b);let x;t[19]!==i||t[20]!==o||t[21]!==f||t[22]!==_||t[23]!==b?(x=(0,J.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-expanded":i,"aria-label":f,onClick:o,"data-testid":`composer-comments-peek`,className:`h-auto min-h-0 gap-1 px-0.5 py-0 text-xs font-normal text-muted-foreground hover:text-foreground`,children:[g,_,b]}),t[19]=i,t[20]=o,t[21]=f,t[22]=_,t[23]=b,t[24]=x):x=t[24];let S;t[25]===c?S=t[26]:(S=c({id:`pFRz_E`}),t[25]=c,t[26]=S);let C;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,J.jsx)(T,{className:`size-3`}),t[27]=C):C=t[27];let w;t[28]!==s||t[29]!==S?(w=(0,J.jsx)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":S,onClick:s,className:`size-4 p-0 text-muted-foreground hover:text-foreground`,children:C}),t[28]=s,t[29]=S,t[30]=w):w=t[30];let E;return t[31]!==w||t[32]!==x?(E=(0,J.jsxs)(`span`,{"data-testid":`composer-context-chip-comments`,className:l,children:[x,w]}),t[31]=w,t[32]=x,t[33]=E):E=t[33],E}function Y(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function X(e,t){let n=e;for(let e of t)n+=typeof e==`number`?`[${e}]`:`.${e}`;return n}function Z(e){let t=(0,k.c)(14),{thread:n,className:r}=e,i=n.anchor?.quote??``;if(n.target.kind===`property`){let e;t[0]!==n.target.key||t[1]!==n.target.path?(e=X(n.target.key,n.target.path),t[0]=n.target.key,t[1]=n.target.path,t[2]=e):e=t[2];let a=e,o;t[3]===r?o=t[4]:(o=m(`w-full truncate font-mono text-[11px] text-muted-foreground`,r),t[3]=r,t[4]=o);let s=i===``?``:` “${i}”`,c;return t[5]!==a||t[6]!==o||t[7]!==s?(c=(0,J.jsxs)(`span`,{className:o,children:[a,`:`,s]}),t[5]=a,t[6]=o,t[7]=s,t[8]=c):c=t[8],c}let a;t[9]===r?a=t[10]:(a=m(`w-full truncate font-mono text-[11px] text-muted-foreground`,r),t[9]=r,t[10]=a);let o;return t[11]!==i||t[12]!==a?(o=(0,J.jsxs)(`span`,{className:a,children:[`“`,i,`”`]}),t[11]=i,t[12]=a,t[13]=o):o=t[13],o}function Q(e){_e({docName:e.docName,quote:e.target.kind===`property`?``:e.anchor?.quote??``,threadId:e.id,context:e.anchor??void 0});let{target:t,anchor:n}=e;if(t.kind!==`property`||n===null)return;let r=0,i=()=>{L({key:t.key,path:t.path,quote:n.quote,start:n.start,end:n.end})||(r+=1,!(r>=xe)&&requestAnimationFrame(i))};requestAnimationFrame(i)}var xe=30;function Se(e){let t=(0,k.c)(9),{threads:n}=e,{_:r}=d(),a=c();if(n.length===0)return null;let o;if(t[0]!==r||t[1]!==a||t[2]!==n){let e;t[4]!==r||t[5]!==a?(e=e=>{let t=e.status===`orphaned`,n=a.includes(e.id);return(0,J.jsxs)(`li`,{className:m(`flex items-start gap-2 rounded-md border bg-background/60 px-2 py-1.5`,!n&&`opacity-50`),children:[(0,J.jsx)(v,{checked:n,onCheckedChange:()=>s(e.id),"aria-label":r({id:`Uoux8m`}),className:`mt-0.5`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1 rounded border px-1 py-px text-[10px] text-muted-foreground`,title:e.docName,children:[(0,J.jsx)(_,{className:`size-2.5 shrink-0`}),(0,J.jsx)(`span`,{className:`truncate`,children:Y(e.docName)})]}),t&&(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-[10px] text-amber-600 dark:text-amber-500`,title:r({id:`MBe6TE`}),children:[(0,J.jsx)(O,{className:`size-2.5`}),(0,J.jsx)(u,{id:`2UgoBZ`})]})]}),(0,J.jsxs)(h,{type:`button`,variant:`ghost`,"aria-label":r({id:`rscgd_`,values:{0:Y(e.docName)}}),onClick:()=>Q(e),className:`h-auto min-h-0 w-full min-w-0 flex-col items-start gap-1 px-0 py-0 text-left font-normal hover:bg-transparent`,children:[(0,J.jsx)(Z,{thread:e}),(0,J.jsx)(`span`,{className:`line-clamp-2 w-full text-xs whitespace-normal text-foreground/90`,children:e.body})]})]}),(0,J.jsx)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":r({id:`1jym2J`}),onClick:()=>i(e.id),className:`size-5 shrink-0 p-0 text-muted-foreground hover:text-foreground`,children:(0,J.jsx)(T,{className:`size-3`})})]},e.id)},t[4]=r,t[5]=a,t[6]=e):e=t[6],o=n.map(e),t[0]=r,t[1]=a,t[2]=n,t[3]=o}else o=t[3];let l;return t[7]===o?l=t[8]:(l=(0,J.jsx)(`ul`,{"data-testid":`composer-comments-list`,className:`mt-1 flex max-h-64 basis-full list-none flex-col gap-1 overflow-y-auto subtle-scrollbar`,children:o}),t[7]=o,t[8]=l),l}function Ce(e){return{docName:e.docName,body:e.instruction,propertyKey:e.property,quote:e.passage?.exact??``,anchorLost:e.anchorLost,prefix:e.passage?.prefix??``,suffix:e.passage?.suffix??``,repeats:e.passageRepeats}}var $=48;function we(e){let t=e.replace(/\s+/g,` `).trimStart();return t.length>$?`…${t.slice(-$)}`:t}function Te(e){let t=e.replace(/\s+/g,` `).trimEnd();return t.length>$?`${t.slice(0,$)}…`:t}function Ee(e){if(!e.repeats)return null;let t=we(e.prefix),n=Te(e.suffix);return t===``&&n===``?null:`(This text appears more than once in the file. The one meant is ${t===``?`at the start of the file, followed by "${n}"`:n===``?`at the end of the file, preceded by "${t}"`:`between "${t}" and "${n}"`} — match that context rather than the first occurrence.)`}function De(e,t,n){let r=t.trim(),i=[];if(i.push(r.length>0?r:`Address the following review comments by editing the documents directly.`),i.push(``),i.push(e.length===1?`The comment:`:`The ${e.length} comments:`),e.forEach((e,t)=>{if(i.push(``),e.propertyKey){let n=e.quote.trim();if(n===``)i.push(`${t+1}. In \`${e.docName}\`, on the \`${e.propertyKey}\` property (frontmatter):`),i.push(``),i.push(` ${e.body.trim()}`);else{i.push(`${t+1}. In \`${e.docName}\`, on this text within the \`${e.propertyKey}\` property (frontmatter):`),i.push(``);for(let e of n.split(`
|
|
2
2
|
`))i.push(` > ${e}`);i.push(``),i.push(` ${e.body.trim()}`)}e.anchorLost&&(i.push(``),i.push(n===``?` (Note: \`${e.propertyKey}\` is no longer in this document's frontmatter — it was renamed or removed since the comment was written. Do not apply this to a different property; if you cannot tell what it now refers to, say so instead of guessing.)`:` (Note: that text is no longer in \`${e.propertyKey}\` — the value was edited, reshaped, or removed since the comment was written. Do not apply this to a different property or a different part of the value; if you cannot tell what it now refers to, say so instead of guessing.)`));return}i.push(`${t+1}. In \`${e.docName}\`, on this passage:`),i.push(``);for(let t of e.quote.split(`
|
|
3
3
|
`))i.push(` > ${t}`);i.push(``),i.push(` ${e.body.trim()}`);let n=Ee(e);n!==null&&(i.push(``),i.push(` ${n}`)),e.anchorLost&&(i.push(``),i.push(` (Note: this passage is no longer in the document — it was edited or removed since the comment was written. Do not apply this to a different passage; if you cannot tell what it now refers to, say so instead of guessing.)`))}),n&&n.markdown.trim().length>0){i.push(``),i.push(`Also in scope, selected in \`${n.docName}\` (not a comment):`),i.push(``);for(let e of n.markdown.trim().split(`
|
|
4
4
|
`))i.push(`> ${e}`)}return i.join(`
|