@inkeep/open-knowledge 0.25.1 → 0.26.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/packs/entity-vault/SKILL.md +3 -3
- package/dist/assets/skills/packs/okf/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +7 -7
- package/dist/constants-CGs9ruPp.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-DH3vYggz.mjs +1 -0
- package/dist/{init-R9ER0TCm.mjs → init-fm1XSGxQ.mjs} +3 -3
- package/dist/loader-CEQ9VTk3.mjs +1 -0
- package/dist/{loader-C0niR-5Z.mjs → loader-lelgRASW.mjs} +2 -2
- package/dist/{preview-Dt1sozZV.mjs → preview-BNM38vHa.mjs} +2 -2
- package/dist/preview-BbLUDQAO.mjs +1 -0
- package/dist/public/assets/{SettingsDialogBody-BVNxduDH.js → SettingsDialogBody-BaKAyRZY.js} +1 -1
- package/dist/public/assets/{auth-state-cache-CaiWuhtJ.js → auth-state-cache-BQjQ1M5b.js} +1 -1
- package/dist/public/assets/index-BBDK8MxG.css +1 -0
- package/dist/public/assets/{index-BG8OZejR.js → index-Bb-u104I.js} +5 -5
- package/dist/public/index.html +3 -3
- package/dist/{repair-launch-json-DWqTLOI7.mjs → repair-launch-json-DRVr7IRA.mjs} +2 -2
- package/dist/{repair-mcp-configs-PFPEIRon.mjs → repair-mcp-configs-DcEFfod2.mjs} +2 -2
- package/dist/{src-DKLGL3-f.mjs → src-8ZRdEx5o.mjs} +2 -2
- package/dist/start-BdC2IcM2.mjs +1 -0
- package/dist/{start-CbT0Y9l8.mjs → start-DkTNTPNU.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-B2pYaUvy.mjs +0 -2
- package/dist/init-BB3oZvAP.mjs +0 -1
- package/dist/loader-Bm1wM8zu.mjs +0 -1
- package/dist/preview-BFKvS4_d.mjs +0 -1
- package/dist/public/assets/index-D53MQUCD.css +0 -1
- package/dist/start-Cxwqiqc4.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,s as t,t as n}from"./chunk-C94x7I9S.mjs";import{Aa as r,Ba as i,Bt as a,Et as o,Xi as s,bn as c,mt as l,yi as u,za as d}from"./server-lock-iLcBw_q0-CPFOrsBn.mjs";import{$n as f,D as p,Gn as m,K as h,O as g,Qn as _,Sa as v,Zn as y,_a as b,cr as x,d as S,ir as C,ma as w,na as T,ra as ee,ut as E,vn as te}from"./dist-D13xYuEX.mjs";import{r as D,t as O}from"./esm-CsQUg9js.mjs";import{t as ne}from"./constants-B2pYaUvy.mjs";import{a as re,g as ie,h as ae,l as k,n as oe,r as se,t as ce}from"./write-project-skill-4cQ_oGJO.mjs";import{t as A}from"./is-object-Cg453afR.mjs";import{i as j,n as M,o as N,r as P,s as F,t as I}from"./colors-8SzMRIVy.mjs";import{t as le}from"./preview-Dt1sozZV.mjs";import{createRequire as ue}from"node:module";import{execFileSync as de}from"node:child_process";import fe,{dirname as L,isAbsolute as pe,join as R,relative as z,resolve as me,sep as he}from"node:path";import B from"node:process";import{fileURLToPath as ge}from"node:url";import{homedir as _e}from"node:os";import{existsSync as V,lstatSync as ve,mkdirSync as ye,readFileSync as H,readlinkSync as be,realpathSync as xe,statSync as Se,writeFileSync as Ce}from"node:fs";import{randomUUID as we}from"node:crypto";import{inspect as Te,stripVTControlCharacters as Ee,styleText as U}from"node:util";import{AsyncLocalStorage as De,AsyncResource as Oe}from"node:async_hooks";import{createServer as ke,request as Ae}from"node:http";import*as je from"node:readline";import{connect as Me}from"node:net";const Ne=new Set([`emacs`,`vim`]);function Pe(e){return Ne.has(e)}function Fe(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(Pe))):[]}const Ie=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Le=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,Re=e=>e.name===`space`,ze=e=>e.name===`backspace`,Be=e=>`1234567890`.includes(e.name),Ve=e=>e.name===`enter`||e.name===`return`;var He=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Ue=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},We=class extends Error{name=`ExitPromptError`},Ge=class extends Error{name=`HookError`},Ke=class extends Error{name=`ValidationError`};const qe=new De;function Je(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function Ye(e,t){let n=Je(e);return qe.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function W(){let e=qe.getStore();if(!e)throw new Ge(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function Xe(){return W().rl}function Ze(e){return Oe.bind((...t)=>{let n=W(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function Qe(e){let t=W(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function $e(){W().handleChange()}const et={queue(e){let t=W(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(Xe());if(r!=null&&typeof r!=`function`)throw new Ke(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=W();Ze(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=W();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function tt(e){return typeof e==`function`}function G(e){return Qe(t=>{let n=Oe.bind(function(e){t.get()!==e&&(t.set(e),$e())});if(t.initialized)return[t.get(),n];let r=tt(e)?e():e;return t.set(r),[r,n]})}function nt(e,t){Qe(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&et.queue(e),n.set(t)})}function rt(){return B.platform.startsWith(`win`)?!!B.env.CI||!!B.env.WT_SESSION||!!B.env.TERMINUS_SUBLIME||B.env.ConEmuTask===`{cmd::Cmder}`||B.env.TERM_PROGRAM===`Terminus-Sublime`||B.env.TERM_PROGRAM===`vscode`||B.env.TERM===`xterm-256color`||B.env.TERM===`alacritty`||B.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:B.env.TERM!==`linux`}const it={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},at={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},ot={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},st={...it,...at},ct={...it,...ot},K=rt()?st:ct;Object.entries(at);const lt={prefix:{idle:U(`blue`,`?`),done:U(`green`,K.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>U(`yellow`,e))},keybindings:[],style:{answer:e=>U(`cyan`,e),message:e=>U(`bold`,e),error:e=>U(`red`,`> ${e}`),defaultAnswer:e=>U(`dim`,`(${e})`),help:e=>U(`dim`,e),highlight:e=>U(`cyan`,e),key:e=>U(`cyan`,U(`bold`,`<${e}>`))}};function ut(){return{...lt,keybindings:Fe()}}function dt(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function ft(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=dt(n)&&dt(r)?ft(n,r):r}return t}function pt(...e){return ft(ut(),...e.filter(e=>e!=null))}function mt({status:e=`idle`,theme:t}){let[n,r]=G(!1),[i,a]=G(0),{prefix:o,spinner:s}=pt(t);return nt(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function ht(e,t){return Qe(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function gt(e){return G({current:e})[0]}function _t(e){let t=gt(e);t.current=e,nt(e=>{let n=!1,r=Ze((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var vt=n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const yt=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),bt=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,xt=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,St=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ct=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,wt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Tt=/\t{1,1000}/y,Et=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Dt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Ot=/\p{M}+/gu,kt={limit:1/0,ellipsis:``},At=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?At(i,kt,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Dt,l],[St,0],[Ct,o],[Tt,s],[Et,c],[wt,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Ot,``)){let t=e.codePointAt(0)||0;if(S=bt(t)?2:xt(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===wt?yt(e.slice(p,n.lastIndex)):n===Et?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},jt={limit:1/0,ellipsis:``,ellipsisWidth:0},q=(e,t={})=>At(e,jt,t).width,Mt=`]8;;`,Nt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Mt}(?<uri>.*))`,`y`),Pt=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Ft=e=>`[${e}m`,It=e=>`${Mt}${e}`,Lt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:q(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=q(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(Mt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Rt=e=>{let t=e.split(` `),n=t.length;for(;n&&!q(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},zt=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=q(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=q(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Lt(s,r,t),c=q(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Lt(s,r,t),c=q(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Lt(s,r,t),c=q(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Rt(e)));let l=s.join(`
|
|
1
|
+
import{a as e,s as t,t as n}from"./chunk-C94x7I9S.mjs";import{Aa as r,Ba as i,Bt as a,Et as o,Xi as s,bn as c,mt as l,yi as u,za as d}from"./server-lock-iLcBw_q0-CPFOrsBn.mjs";import{$n as f,D as p,Gn as m,K as h,O as g,Qn as _,Sa as v,Zn as y,_a as b,cr as x,d as S,ir as C,ma as w,na as T,ra as ee,ut as E,vn as te}from"./dist-D13xYuEX.mjs";import{r as D,t as O}from"./esm-CsQUg9js.mjs";import{t as ne}from"./constants-CGs9ruPp.mjs";import{a as re,g as ie,h as ae,l as k,n as oe,r as se,t as ce}from"./write-project-skill-4cQ_oGJO.mjs";import{t as A}from"./is-object-Cg453afR.mjs";import{i as j,n as M,o as N,r as P,s as F,t as I}from"./colors-8SzMRIVy.mjs";import{t as le}from"./preview-BNM38vHa.mjs";import{createRequire as ue}from"node:module";import{execFileSync as de}from"node:child_process";import fe,{dirname as L,isAbsolute as pe,join as R,relative as z,resolve as me,sep as he}from"node:path";import B from"node:process";import{fileURLToPath as ge}from"node:url";import{homedir as _e}from"node:os";import{existsSync as V,lstatSync as ve,mkdirSync as ye,readFileSync as H,readlinkSync as be,realpathSync as xe,statSync as Se,writeFileSync as Ce}from"node:fs";import{randomUUID as we}from"node:crypto";import{inspect as Te,stripVTControlCharacters as Ee,styleText as U}from"node:util";import{AsyncLocalStorage as De,AsyncResource as Oe}from"node:async_hooks";import{createServer as ke,request as Ae}from"node:http";import*as je from"node:readline";import{connect as Me}from"node:net";const Ne=new Set([`emacs`,`vim`]);function Pe(e){return Ne.has(e)}function Fe(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(Pe))):[]}const Ie=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Le=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,Re=e=>e.name===`space`,ze=e=>e.name===`backspace`,Be=e=>`1234567890`.includes(e.name),Ve=e=>e.name===`enter`||e.name===`return`;var He=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Ue=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},We=class extends Error{name=`ExitPromptError`},Ge=class extends Error{name=`HookError`},Ke=class extends Error{name=`ValidationError`};const qe=new De;function Je(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function Ye(e,t){let n=Je(e);return qe.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function W(){let e=qe.getStore();if(!e)throw new Ge(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function Xe(){return W().rl}function Ze(e){return Oe.bind((...t)=>{let n=W(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function Qe(e){let t=W(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function $e(){W().handleChange()}const et={queue(e){let t=W(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(Xe());if(r!=null&&typeof r!=`function`)throw new Ke(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=W();Ze(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=W();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function tt(e){return typeof e==`function`}function G(e){return Qe(t=>{let n=Oe.bind(function(e){t.get()!==e&&(t.set(e),$e())});if(t.initialized)return[t.get(),n];let r=tt(e)?e():e;return t.set(r),[r,n]})}function nt(e,t){Qe(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&et.queue(e),n.set(t)})}function rt(){return B.platform.startsWith(`win`)?!!B.env.CI||!!B.env.WT_SESSION||!!B.env.TERMINUS_SUBLIME||B.env.ConEmuTask===`{cmd::Cmder}`||B.env.TERM_PROGRAM===`Terminus-Sublime`||B.env.TERM_PROGRAM===`vscode`||B.env.TERM===`xterm-256color`||B.env.TERM===`alacritty`||B.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:B.env.TERM!==`linux`}const it={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},at={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},ot={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},st={...it,...at},ct={...it,...ot},K=rt()?st:ct;Object.entries(at);const lt={prefix:{idle:U(`blue`,`?`),done:U(`green`,K.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>U(`yellow`,e))},keybindings:[],style:{answer:e=>U(`cyan`,e),message:e=>U(`bold`,e),error:e=>U(`red`,`> ${e}`),defaultAnswer:e=>U(`dim`,`(${e})`),help:e=>U(`dim`,e),highlight:e=>U(`cyan`,e),key:e=>U(`cyan`,U(`bold`,`<${e}>`))}};function ut(){return{...lt,keybindings:Fe()}}function dt(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function ft(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=dt(n)&&dt(r)?ft(n,r):r}return t}function pt(...e){return ft(ut(),...e.filter(e=>e!=null))}function mt({status:e=`idle`,theme:t}){let[n,r]=G(!1),[i,a]=G(0),{prefix:o,spinner:s}=pt(t);return nt(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function ht(e,t){return Qe(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function gt(e){return G({current:e})[0]}function _t(e){let t=gt(e);t.current=e,nt(e=>{let n=!1,r=Ze((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var vt=n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const yt=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),bt=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,xt=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,St=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ct=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,wt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Tt=/\t{1,1000}/y,Et=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Dt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Ot=/\p{M}+/gu,kt={limit:1/0,ellipsis:``},At=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?At(i,kt,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Dt,l],[St,0],[Ct,o],[Tt,s],[Et,c],[wt,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Ot,``)){let t=e.codePointAt(0)||0;if(S=bt(t)?2:xt(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===wt?yt(e.slice(p,n.lastIndex)):n===Et?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},jt={limit:1/0,ellipsis:``,ellipsisWidth:0},q=(e,t={})=>At(e,jt,t).width,Mt=`]8;;`,Nt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Mt}(?<uri>.*))`,`y`),Pt=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Ft=e=>`[${e}m`,It=e=>`${Mt}${e}`,Lt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:q(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=q(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(Mt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Rt=e=>{let t=e.split(` `),n=t.length;for(;n&&!q(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},zt=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=q(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=q(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Lt(s,r,t),c=q(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Lt(s,r,t),c=q(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Lt(s,r,t),c=q(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Rt(e)));let l=s.join(`
|
|
2
2
|
`),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===``){Nt.lastIndex=e+1;let t=Nt.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
|
|
3
3
|
`){a&&(r+=It(``));let e=i?Pt(i):void 0;i&&e&&(r+=Ft(e))}else t===`
|
|
4
4
|
`&&(i&&Pt(i)&&(r+=Ft(i)),a&&(r+=It(a)))}return r},Bt=/\r?\n/;function Vt(e,t,n){return String(e).normalize().split(Bt).map(e=>zt(e,t,n)).join(`
|
|
@@ -316,6 +316,6 @@ UIPORT="\${PORT:-${Vi}}"
|
|
|
316
316
|
unset PORT
|
|
317
317
|
exec node "${ae()}" start --ui-port "$UIPORT"`],port:Vi,autoPort:!0}:{name:ba,runtimeExecutable:`/bin/sh`,runtimeArgs:[`-l`,`-c`,Ca],port:Vi,autoPort:!0};try{if(ce(n,e),!V(n))return ye(L(n),{recursive:!0}),Ce(n,`${JSON.stringify({version:ya,configurations:[r]},null,2)}\n`,`utf-8`),{action:`created`,configPath:n};let t=H(n,`utf-8`).trim(),i=t?JSON.parse(t):{};if(!A(i))return{action:`failed`,configPath:n,error:`launch.json root is not an object`};let a=Array.isArray(i.configurations)?i.configurations:[],o=a.findIndex(e=>A(e)&&e.name===`open-knowledge-ui`);o>=0?a[o]=r:a.push(r);let s={...i,version:i.version??ya,configurations:a};return Ce(n,`${JSON.stringify(s,null,2)}\n`,`utf-8`),{action:o>=0?`merged`:`created`,configPath:n}}catch(e){return{action:`failed`,configPath:n,error:e instanceof Error?e.message:String(e)}}}function Ta(e,t,n){try{return V(e.detectPath?.(t,n)??L(e.configPath(t,n)))}catch{return!1}}function Ea(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0;if(!i&&s&&!Ta(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{ce(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}let c;try{c=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{ye(L(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let l={action:`written`},u;try{b(`${o}.lock`,()=>{let t=xi(o).writePath;if(ye(L(t),{recursive:!0}),e.format===`toml`){let n=ca(ki(),t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}let n=sa(t,e.topLevelKey,a,c,e.serverMapSubKey);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){u=e instanceof Error?e:Error(String(e))}return u?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:u.message,...i===void 0?{}:{configScope:`project`}}:l.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:l.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:l.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}function Da(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!V(n)))return{editorId:e.id,label:e.label,path:n}}async function Oa(e){let t=ie(e.editors),n={mode:`published`,skipAvailabilityCheck:!0};return t.map(t=>Ea(t,``,n,e.home))}function ka(e,t,n,r){let i=ja(e,t,n,r);return i.kind===`present`?i.entry:null}function Aa(e,t,n,r){let i=oa(e,t,r);if(!A(i))return{kind:`no-entry`};let a=i[n];return A(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function ja(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!V(i))return{kind:`absent`};try{if(Se(i).size>ta)return{kind:`decline`,reason:`oversize`}}catch{return{kind:`decline`,reason:`unparseable`}}let a;try{a=H(i,`utf-8`)}catch{return{kind:`decline`,reason:`unparseable`}}if(a.trim()===``)return{kind:`absent`};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=ki().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return Aa(t,e.topLevelKey,o,e.serverMapSubKey)}let s=Zi(a);return s?Qi(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:Aa(ur(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Ma(e={}){let t=me(e.cwd??process.cwd()),n=pi(t,{homeDir:e.home}),r=n.projectRoot,i=!V(R(r,`.ok`)),a=n.gitRootPromoted?z(r,t):void 0,o=e.contentDir===void 0?n.defaultContentDir:_a(e.contentDir,r,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&o===`.`&&process.stderr.write(`${F(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${a}/, but .ok/ lives at the git root (one .ok/ per git repo),\n so the whole repo is now the content scope. To narrow it, re-run with\n \`ok init --content-dir .\`, or set content.dir: ${a} in .ok/config.yml.\n`);let s={mode:e.devMcp?`dev`:`published`},c=await te(r),l;try{l=m(r,{contentDir:o})}catch(t){let i=k.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:c.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDirRequested:e.contentDir,contentScaffoldFailed:!0,mcpAction:`failed`,mcpPath:i,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`,sharing:{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:!1}}}let u=l.created.includes(ne),d=!1;if(c.didInit)try{d=ee(r)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${r}: ${e instanceof Error?e.message:String(e)}`)}let f=await fa({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),p=e.editors??Ra(r,e.home),h=e.editors??re.filter(e=>k[e].projectConfigPath!==void 0),g=ie(p),_=ie(h),v=e.mcp===!1||f===null,b=Array.from(new Map([...g,...v?[]:_].map(e=>[e.id,e])).values()),x=g.filter(t=>Ta(t,r,e.home)),C=[],w=[],D=new Set;for(let t of b){if(v){let n=``;try{n=t.configPath(r,e.home)}catch{}C.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(la(f)&&g.includes(t)&&C.push(Ea(t,r,s,e.home)),ua(f)&&_.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Ea(t,r,s,e.home,n);C.push(i),(i.action===`written`||i.action===`overwritten`)&&D.add(n)}}let O=new Set;for(let e of _){let t=e.projectSkillPath?.(r);!t||O.has(t)||(O.add(t),w.push(oe(e,r)))}let ae=!v&&f!==null&&ua(f)?_.filter(e=>!e.projectConfigPath).map(e=>e.label):void 0,ce=v?[]:x.map(e=>Da(e,r)).filter(e=>e!==void 0).filter(e=>!D.has(e.path)),A=x.some(e=>e.id===`claude`)&&!v?wa(r,s):void 0,j=e.installUserSkill??y,M=e.home??_e(),N=ga(e.skills),P=!1,I=!1,le=!1,ue=!1;for(let t of E){let n=N.has(t);if(await T(M,S[t],n).catch(()=>{}),n){P=!0;let n=await j({home:e.home,bundleId:t,force:!0});n===`installed`?I=!0:n===`failed`?le=!0:ue=!0}else try{se(M,t)}catch{}}let de=le?`failed`:I?`installed`:P&&ue?`skip-current`:`declined`,fe=v?`skipped-flag`:`skipped-missing`,L=C.find(e=>e.editorId===`claude`)??C[0]??{action:fe,configPath:k.claude.configPath(r,e.home)},pe=await Na({projectRoot:r,desiredMode:await ma({sharing:e.sharing,projectRoot:r,isTTY:e.isTTY,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:r,contentCreated:l.created,contentUpdated:l.updated,contentSkipped:l.skipped,editors:C,projectSkills:w,legacyProjectConfigs:ce,launchJson:A,skillInstall:de,didGitInit:c.didInit,rootGitignoreCreated:d,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDir:u?o:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:L.action,mcpPath:L.configPath,mcpError:`error`in L?L.error:void 0,projectScopeUnsupportedLabels:ae,sharing:pe}}async function Na(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=En(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=Cn(t);if(n===`local-only`){let e=wn(t,a);if(e.kind===`refused-tracked`){let t=e;return{kind:`refused-tracked`,tracked:t.tracked,remediation:t.remediation}}return e.kind===`no-exclude`?{kind:`no-exclude`,reason:e.reason,localOnlyRequested:r===`local-only`}:Pa(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=Tn(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:Pa(t,o,`remove`)}function Pa(e,t,n){let r=En(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:[]}:{kind:`applied`,mode:r,action:`removed`,appended:[],alreadyPresent:[],removed:t.removed}}function Fa(e){switch(e){case`oversize`:return`config too large to edit safely`;case`duplicate-container`:return`duplicate server block`;case`no-native-writer`:return`no format-preserving writer available`;default:return`config not readable`}}function Ia(e,t){let n=[],r=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),i=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),a=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),o=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`),s=e=>{let n=e.configPath.startsWith(t)?z(t,e.configPath):e.configPath;switch(e.action){case`created`:return` app preview server ${n} configured for Claude Code Desktop embedded browser`;case`merged`:return` app preview server ${n} updated for Claude Code Desktop embedded browser`;case`failed`:return` app preview server ${n} FAILED: ${e.error}`}};e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`),e.rootGitignoreCreated&&n.push(`Seeded .gitignore at ${t}/.gitignore (.DS_Store)`);let c=R(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(I(`Content scaffolded at ${c}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(I(`Content already present at ${c}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0)if(n.push(I(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`);else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(I(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(I(`MCP server configuration:`));for(let r of e.editors){let i=r.configPath.startsWith(t)?z(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),a=r.serverName===`open-knowledge`?``:` (${r.serverName})`,o=r.configScope===`project`?` (project)`:``,c=`${r.label}${o}`,l=` `.repeat(Math.max(1,20-c.length)),u=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${c}${l}${i} ${N(`registered`)}${a}${u}`);break;case`overwritten`:n.push(` ${c}${l}${i} ${N(`updated`)}${a}${u}`);break;case`skipped-missing`:n.push(` ${c}${l}${i} config root missing; skipped`);break;case`failed`:n.push(` ${c}${l}${i} ${P(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${c}${l}${i} left unchanged (${Fa(r.declineReason)})`);break;case`skipped-flag`:break;default:r.action}r.editorId===`claude`&&e.launchJson&&n.push(s(e.launchJson))}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(I(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?z(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${N(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${N(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${P(`FAILED`)}: ${r.error}`);break}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${z(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(I(`User-global skill:`)),e.skillInstall){case`installed`:n.push(` open-knowledge ${N(`installed to detected agent hosts`)} via \`npx skills\``);break;case`skip-current`:n.push(` open-knowledge ${N(`already installed at current version`)}`);break;case`declined`:n.push(` open-knowledge ${M(`skipped (opted out via --no-skills)`)}`);break;case`failed`:n.push(` ${F(`open-knowledge install failed — MCP still configured; run manually:`)}`),n.push(` ${F(` npx skills@~1.5.0 add <bundled-path> --agent '*' -g -y --copy`)}`);break}if(e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(F(`⚠ --content-dir ${e.contentDirRequested} ignored — .ok/config.yml already exists`)),n.push(` Edit .ok/config.yml → content.dir directly to change the content scope.`)):e.contentDir!==void 0&&e.contentDir!==`.`?(n.push(``),n.push(`Content scope set to ${e.contentDir}/ (content.dir in .ok/config.yml).`)):e.gitRootPromoted&&e.contentDir===`.`&&e.contentDirRequested===void 0&&(n.push(``),n.push(F(`⚠ Content scope promoted to the git repo root`)),n.push(` .ok/ was initialized at ${t} because it contains a .git folder (one .ok/ per git repo),`),n.push(` not the sub-folder you ran \`ok init\` in${e.promotedFromDir?` (${e.promotedFromDir})`:``}. The whole repo is now the content scope.`),e.promotedFromDir&&(n.push(" To scope to just that sub-folder, re-run `ok init --content-dir .` from there, or set"),n.push(` content.dir: ${e.promotedFromDir} in .ok/config.yml.`))),e.preview?(n.push(``),n.push(le(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...Va(e.sharing,t)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${N(`✓`)} ${I(`Next steps:`)}`),n.push(` 1. Open your editor (${j(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${j(`ok seed`)} — empty repo, Karpathy 3-layer`),n.push(` - ${j(`mcp__open-knowledge__discover`)} — existing repo, extract conventions`),n.push(` 4. Use the MCP workflow tools as you build the wiki:`),n.push(` - ${j(`mcp__open-knowledge__ingest`)} — capture an external source`),n.push(` - ${j(`mcp__open-knowledge__research`)} — gather sources and write findings`),n.push(` - ${j(`mcp__open-knowledge__consolidate`)} — promote research to canonical articles`)}return n.join(`
|
|
318
318
|
`)}function La(e,t){return{projectRoot:e.projectRoot,gitRootPromoted:e.gitRootPromoted,promotedFromDir:e.promotedFromDir??null,contentDir:t.contentDir,contentDirRequested:e.contentDirRequested??null,contentDirApplied:e.contentDir!==void 0,contentFileCount:t.contentFileCount,previewError:e.previewWarning??null,didGitInit:e.didGitInit,mcpAction:e.mcpAction,editors:e.editors.map(e=>({editorId:e.editorId,label:e.label,action:e.action,configPath:e.configPath,scope:e.configScope===`project`?`project`:`user`}))}}function Ra(e,t){let n=[];for(let r of re)Ta(k[r],e,t)&&n.push(r);return n}function za(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:Te(e)).join(` `)}\n`)};return console.log=t,console.info=t,console.debug=t,()=>{console.log=e.log,console.info=e.info,console.debug=e.debug}}function Ba(){return new O(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry using node + packages/cli/dist/cli.mjs with debug logging`).option(`--content-dir <dir>`,`Limit content to <dir> instead of the whole project. <dir> is interpreted relative to your current directory (e.g. "." = the folder you run the command in), then saved to .ok/config.yml as content.dir.`).option(`--json`,`Emit a structured JSON summary to stdout (diagnostics stay on stderr)`).option(`--skills <ids>`,`Install only the named user-global skill bundles (comma list: discovery,write-skill)`).option(`--no-skills`,`Do not install any user-global skill bundles`).addOption(new D(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new D(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new D(`--local-only`,`Keep OK config out of git via .git/info/exclude (per-clone, not committed)`).conflicts(`shared`)).action(async e=>{let t=process.cwd(),n=e.shared?`shared`:e.localOnly?`local-only`:void 0,r=e.json?za():null;try{let r;try{r=await Ma({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof ha){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof p||e instanceof g){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof h){process.stderr.write(`open-knowledge could not initialize a git repo for this project. Re-run, or run 'git init' yourself in the project folder.
|
|
319
|
-
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-
|
|
319
|
+
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-CEQ9VTk3.mjs`),{resolveContentDir:s}=await import(`./dist-D9WKY736.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-BbLUDQAO.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(La(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${Ia(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function Va(e,t){let n=[];switch(e.kind){case`applied`:return n.push(I(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?n.push(` ${N(`local-only`)} — appended ${e.appended.length} path(s) to ${I(`${t}/.git/info/exclude`)} (per-clone, not committed).`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${N(`local-only`)} — already excluded; nothing to do.`):n.push(` ${N(`local-only`)}`):e.action===`removed`?n.push(` ${N(`shared`)} — removed OK paths from ${I(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${N(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(F(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
|
|
320
320
|
`))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${j(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(F(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${j(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${j(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(F(`Sharing mode unavailable: ${e.reason}.`));return n}}export{ur as A,ln as B,qi as C,gr as D,Tr as E,Cn as F,Ve as G,mt as H,On as I,En as L,wn as M,kn as N,hr as O,Dn as P,Tn as R,Oa as S,pi as T,pt as U,_t as V,G as W,ma as _,Ca as a,ia as b,ja as c,Va as d,Ba as f,_a as g,fa as h,Sa as i,lr as j,_r as k,Ra as l,ga as m,ba as n,Na as o,ka as p,xa as r,La as s,ha as t,Ia as u,Ma as v,ki as w,Ea as x,wa as y,Sn as z};
|
|
321
|
-
//# sourceMappingURL=init-
|
|
321
|
+
//# sourceMappingURL=init-fm1XSGxQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./loader-lelgRASW.mjs";export{e as loadConfig};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$a as e,Wo as t,Xa as n,Ya as r}from"./server-lock-iLcBw_q0-CPFOrsBn.mjs";import{_ as i,ga as a,ha as o}from"./dist-D13xYuEX.mjs";import{t as s}from"./constants-
|
|
1
|
+
import{$a as e,Wo as t,Xa as n,Ya as r}from"./server-lock-iLcBw_q0-CPFOrsBn.mjs";import{_ as i,ga as a,ha as o}from"./dist-D13xYuEX.mjs";import{t as s}from"./constants-CGs9ruPp.mjs";import{t as c}from"./is-object-Cg453afR.mjs";import{resolve as l}from"node:path";import{existsSync as u,readFileSync as d}from"node:fs";import{realpath as f}from"node:fs/promises";async function p(e){let t=l(e);try{return await f(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}var m=t();function h(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];c(a)&&c(i)?n[r]=h(i,a):a!==void 0&&(n[r]=a)}return n}function g(e){if(!u(e))return{value:null,path:e,source:null,doc:null};let t;try{t=d(e,`utf-8`)}catch(t){return console.warn(`[config] Failed to read ${e}: ${t instanceof Error?t.message:t}`),{value:null,path:e,source:null,doc:null}}let n=(0,m.parseDocument)(t);if(n.errors.length>0)return console.warn(`[config] Failed to parse ${e}: ${n.errors.map(e=>e.message).join(`; `)}`),{value:null,path:e,source:t,doc:null};let r=n.toJSON();return c(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function _(t,n){return t.map(t=>{let r=t.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:t.message,issueCode:t.code};if(n.doc!==null&&n.source!==null){let t=e({file:n.path,source:n.source,doc:n.doc,path:r});if(t!==void 0)return{...i,source:t}}return i})}function v(e){let t=e??process.cwd(),c=[],u=a(`user`,t),d=o({absPath:u}),f={};d.valid&&d.source!==void 0?(f=h(f,d.value),c.push(u)):d.valid;let p=l(t,`.ok`,s),m=g(p);if(m.value!==null){let e=r({value:m.value,file:m.path,source:m.source,doc:m.doc});if(e.length>0)throw Error(e.map(n).join(`
|
|
2
2
|
|
|
3
3
|
`));f=h(f,m.value),c.push(p)}let v=i.safeParse(f);if(!v.success){let e={code:`SCHEMA_INVALID`,issues:_(v.error.issues,m)};throw Error(n(e))}return{config:v.data,sources:c}}function y(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??v,r=new Map,i=new Map,a=p(e.startupCwd);return async o=>{let s=await p(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{v as n,y as t};
|
|
4
|
-
//# sourceMappingURL=loader-
|
|
4
|
+
//# sourceMappingURL=loader-lelgRASW.mjs.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Yt as e}from"./dist-D13xYuEX.mjs";import"./constants-
|
|
1
|
+
import{Yt as e}from"./dist-D13xYuEX.mjs";import"./constants-CGs9ruPp.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);return a.push(``),r(t(i,`.ok`,`config.yml`))?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
|
|
2
2
|
`)}export{c as n,l as t};
|
|
3
|
-
//# sourceMappingURL=preview-
|
|
3
|
+
//# sourceMappingURL=preview-BNM38vHa.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./preview-BNM38vHa.mjs";export{t as formatPreviewBlock,e as previewContent};
|
package/dist/public/assets/{SettingsDialogBody-BVNxduDH.js → SettingsDialogBody-BaKAyRZY.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,t}from"./chunk-CFjPhJqf.js";import{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{C as a,E as o,Et as s,K as c,S as l,T as u,gn as d,in as f,on as p,sn as m,w as h,x as g,zn as _}from"./DocumentContext-WluK-pvu.js";import{n as v,r as y}from"./dist-CQw2y-s3.js";import{n as b}from"./dist-BVOt51sU.js";import{$ as x,Ct as S,Ii as C,Li as w,Mi as T,Ni as E,Pi as D,_ as O,br as k,bt as A,h as j,k as M,rt as N,wi as P}from"./dist-BkxMNfFN.js";import{a as F,i as I,t as L,u as R}from"./button-cneJOVxD.js";import{a as z,c as B,i as V,r as H,t as U}from"./EnableSyncConfirmDialog-BWfcC03w.js";import{t as W}from"./arrow-up-right-DoN2FmSd.js";import{t as G}from"./check-Dqb-7gfx.js";import{t as ee}from"./chevron-right-BfmqRYl8.js";import{i as te}from"./prop-types-PwAyvfNz.js";import{A as K,D as ne,O as q,b as re,c as ie,d as J,i as Y,k as ae,m as oe,r as se,s as ce,t as le,u as ue,w as de}from"./skill-actions-DmQL_HGK.js";import{$ as fe,A as pe,B as me,C as he,E as ge,H as _e,M as ve,Q as ye,S as be,T as xe,U as Se,V as Ce,W as we,_ as Te,at as Ee,c as De,d as Oe,f as ke,g as Ae,h as je,i as Me,j as Ne,l as Pe,lt as Fe,m as Ie,n as Le,o as Re,p as ze,q as Be,st as Ve,u as He,v as Ue,w as We,x as Ge,y as Ke,z as qe}from"./auth-state-cache-CaiWuhtJ.js";import{i as Je,t as Ye}from"./skill-scope-Bt2TwqtA.js";import"./config-provider-D-gGfmXm.js";import{n as Xe}from"./config-context-CVpOcWSZ.js";import{_ as Ze,b as Qe,d as $e,f as et,g as tt,h as nt,l as rt,m as it,o as at,t as ot,u as st,v as ct,y as lt}from"./open-managed-artifact-tab-TH1tyrz4.js";import{a as ut}from"./cursor-CGeB2PU5.js";import{t as dt}from"./triangle-alert-r1Ou0VrE.js";import{n as X,r as ft}from"./dist-IEs1iCqd.js";import{i as pt,n as mt,t as ht}from"./tooltip-C9Dd0rIc.js";import{n as gt,r as _t,t as vt}from"./collapsible-iVWLn36m.js";import{a as yt,c as bt,i as xt,n as St,o as Ct,r as wt,s as Tt,t as Et}from"./dialog-BiB39Lhy.js";import{t as Dt}from"./checkbox-P04sbGVQ.js";import{T as Ot,h as kt,p as At}from"./skills-api-T8UMKFuI.js";import{t as jt}from"./label-hTzLGQhh.js";import{n as Mt,r as Nt,t as Pt}from"./radio-group-1_2tsQbc.js";import{n as Ft,t as It}from"./toggle-group-IN7Np0Is.js";import{t as Lt}from"./input-D0MSkqYi.js";import{n as Rt}from"./dist-0Zj_lz7j.js";import{r as zt}from"./documents-events-D064jVvV.js";import{a as Bt,n as Vt,r as Ht,s as Ut,t as Wt}from"./keyboard-shortcuts-DiiTkD4P.js";var Gt=R(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Z=i(),Q=e(n(),1),$=r(),Kt=`settings-sharing-title`;function qt(){let e=(0,Z.c)(1),t=(typeof window<`u`?window.okDesktop:void 0)?.sharing,n;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=t===void 0?(0,$.jsx)(Jt,{}):(0,$.jsx)(Yt,{}),e[0]=n):n=e[0],n}function Jt(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`h3`,{id:Kt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`section`,{"aria-labelledby":Kt,className:`space-y-3`,children:(0,$.jsxs)(`div`,{className:`space-y-1`,children:[t,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`7YRrJ9`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{}),2:(0,$.jsx)(`code`,{})}})})]})}),e[1]=n):n=e[1],n}function Yt(){let e=(0,Z.c)(28),{_:t}=y(),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c;e[0]===t?c=e[1]:(c=async function(){let e=window.okDesktop?.sharing;if(e)try{r(await e.status())}catch(e){let n=e;X.error(n instanceof Error?n.message:t({id:`K0N7zS`})),r(Zt)}},e[0]=t,e[1]=c);let l=c,u;e[2]===l?u=e[3]:(u=()=>{l()},e[2]=l,e[3]=u);let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],e[4]=d):d=e[4],(0,Q.useEffect)(u,d);let f;e[5]!==t||e[6]!==i||e[7]!==l||e[8]!==n?(f=async function(e){let r=window.okDesktop?.sharing;if(!r||n===null||i||n.mode===e)return;a(!0),s(null);let o=null,c=null;try{o=await r.setMode(e)}catch(e){c=e}if(a(!1),c!==null){X.error(c instanceof Error?c.message:t({id:`qZv5ZR`}));return}o!==null&&(o.kind===`refused-tracked`?(s({tracked:o.tracked,remediation:o.remediation}),X.error(t({id:`z2JdQ-`}),{duration:5e3})):o.kind===`no-exclude`?X.warning(o.reason===`no-git`?t({id:`YSFv5w`}):t({id:`8cS0nH`,values:{0:o.reason}})):X.success(t(e===`local-only`?{id:`VvS_k_`}:{id:`k_pade`})),await l())},e[5]=t,e[6]=i,e[7]=l,e[8]=n,e[9]=f):f=e[9];let p=f;if(n===null){let t;return e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":Kt,className:`space-y-3`,children:[(0,$.jsx)(`h3`,{id:Kt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),(0,$.jsx)(Se,{className:`h-24`})]}),e[10]=t):t=e[10],t}let m=n.mode===`no-git`,h;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`h3`,{id:Kt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),(0,$.jsx)(Nt,{})]}),e[11]=h):h=e[11];let g;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[h,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`N55YNr`})})]}),e[12]=g):g=e[12];let _;e[13]!==i||e[14]!==m||e[15]!==p||e[16]!==n.mode?(_=m?(0,$.jsx)(`p`,{className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,role:`status`,"data-testid":`settings-sharing-no-git`,children:(0,$.jsx)(v,{id:`ju38ms`})}):(0,$.jsxs)(Pt,{value:n.mode,onValueChange:e=>void p(e),disabled:i,className:`gap-2`,"aria-labelledby":Kt,"data-testid":`settings-sharing-radiogroup`,children:[(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-shared`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(Mt,{id:`settings-sharing-shared`,value:`shared`,"data-testid":`settings-sharing-shared`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`0Gd0NU`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`dJw2_7`})})]})]}),(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-local-only`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(Mt,{id:`settings-sharing-local-only`,value:`local-only`,"data-testid":`settings-sharing-local-only`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`OgyJSr`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`cZ_8zB`})})]})]})]}),e[13]=i,e[14]=m,e[15]=p,e[16]=n.mode,e[17]=_):_=e[17];let b;e[18]===o?b=e[19]:(b=o===null?null:(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border border-destructive bg-destructive/10 p-3 text-sm`,role:`alert`,"data-testid":`settings-sharing-refusal`,children:[(0,$.jsx)(`p`,{className:`font-semibold`,children:(0,$.jsx)(v,{id:`Kgdbkt`})}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs leading-relaxed`,children:o.remediation}),(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>s(null),children:(0,$.jsx)(v,{id:`1QfxQT`})})]}),e[18]=o,e[19]=b);let x;e[20]!==o||e[21]!==n.mode||e[22]!==n.trackedUpstream?(x=n.trackedUpstream.length>0&&n.mode!==`no-git`&&o===null?(0,$.jsxs)(`div`,{className:`space-y-1 rounded-md border border-muted-foreground/30 bg-muted/40 p-3 text-sm`,"data-testid":`settings-sharing-tracked-info`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`LhWYpm`})}),(0,$.jsx)(`ul`,{className:`list-disc pl-5 font-mono text-xs text-muted-foreground`,children:n.trackedUpstream.map(Xt)}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`1XSMhZ`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]}):null,e[20]=o,e[21]=n.mode,e[22]=n.trackedUpstream,e[23]=x):x=e[23];let S;return e[24]!==_||e[25]!==b||e[26]!==x?(S=(0,$.jsxs)(`section`,{"aria-labelledby":Kt,className:`space-y-4`,"data-testid":`settings-sharing`,children:[g,_,b,x]}),e[24]=_,e[25]=b,e[26]=x,e[27]=S):S=e[27],S}function Xt(e){return(0,$.jsx)(`li`,{children:e},e)}function Zt(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[]}}var Qt=ge,$t=Q.createContext({}),en=e=>{let t=(0,Z.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;t[2]===n.name?r=t[3]:(r={name:n.name},t[2]=n.name,t[3]=r);let i;t[4]===n?i=t[5]:(i=(0,$.jsx)(xe,{...n}),t[4]=n,t[5]=i);let a;return t[6]!==r||t[7]!==i?(a=(0,$.jsx)($t.Provider,{value:r,children:i}),t[6]=r,t[7]=i,t[8]=a):a=t[8],a},tn=()=>{let e=(0,Z.c)(13),t=Q.use($t),n=Q.use(nn),{getFieldState:r}=Ne(),i;e[0]===t.name?i=e[1]:(i={name:t.name},e[0]=t.name,e[1]=i);let a=ve(i),o;e[2]!==t.name||e[3]!==a||e[4]!==r?(o=r(t.name,a),e[2]=t.name,e[3]=a,e[4]=r,e[5]=o):o=e[5];let s=o;if(!t)throw Error(`useFormField should be used within <FormField>`);let{id:c}=n,l=`${c}-form-item`,u=`${c}-form-item-description`,d=`${c}-form-item-message`,f;return e[6]!==t.name||e[7]!==s||e[8]!==c||e[9]!==l||e[10]!==u||e[11]!==d?(f={id:c,name:t.name,formItemId:l,formDescriptionId:u,formMessageId:d,...s},e[6]=t.name,e[7]=s,e[8]=c,e[9]=l,e[10]=u,e[11]=d,e[12]=f):f=e[12],f},nn=Q.createContext({});function rn(e){let t=(0,Z.c)(13),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=Q.useId(),a;t[3]===i?a=t[4]:(a={id:i},t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=I(`grid gap-2`,n),t[5]=n,t[6]=o);let s;t[7]!==r||t[8]!==o?(s=(0,$.jsx)(`div`,{"data-slot":`form-item`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(0,$.jsx)(nn.Provider,{value:a,children:s}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function an(e){let t=(0,Z.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{error:i,formItemId:a}=tn(),o=!!i,s;t[3]===n?s=t[4]:(s=I(`data-[error=true]:text-destructive`,n),t[3]=n,t[4]=s);let c;return t[5]!==a||t[6]!==r||t[7]!==o||t[8]!==s?(c=(0,$.jsx)(jt,{"data-slot":`form-label`,"data-error":o,className:s,htmlFor:a,...r}),t[5]=a,t[6]=r,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function on(e){let t=(0,Z.c)(7),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{error:r,formItemId:i,formDescriptionId:a,formMessageId:o}=tn(),s=r?`${a} ${o}`:`${a}`,c=!!r,l;return t[2]!==i||t[3]!==n||t[4]!==s||t[5]!==c?(l=(0,$.jsx)(F,{"data-slot":`form-control`,id:i,"aria-describedby":s,"aria-invalid":c,...n}),t[2]=i,t[3]=n,t[4]=s,t[5]=c,t[6]=l):l=t[6],l}function sn(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{formDescriptionId:i}=tn(),a;t[3]===n?a=t[4]:(a=I(`text-1sm text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==r||t[7]!==a?(o=(0,$.jsx)(`p`,{"data-slot":`form-description`,id:i,className:a,...r}),t[5]=i,t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function cn(e){let t=(0,Z.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{error:i,formMessageId:a}=tn(),o=i?String(i?.message??``):r.children;if(!o)return null;let s=i?`alert`:void 0,c;t[3]===n?c=t[4]:(c=I(`text-sm text-destructive`,n),t[3]=n,t[4]=c);let l;return t[5]!==o||t[6]!==a||t[7]!==r||t[8]!==s||t[9]!==c?(l=(0,$.jsx)(`p`,{"data-slot":`form-message`,id:a,role:s,className:c,...r,children:o}),t[5]=o,t[6]=a,t[7]=r,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function ln(e){let t=(0,Z.c)(30),{authQueryTransport:n,authTransport:r}=e,{_:i}=y(),a;t[0]===n?a=t[1]:(a=n??Be(),t[0]=n,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={phase:`loading`},t[2]=s):s=t[2];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(!1),_;t[3]===o?_=t[4]:(_=async function(){l({phase:`loading`});try{let e=await o.status();l({phase:`loaded`,result:e}),Le(e.authenticated)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),l({phase:`check-failed`})}},t[3]=o,t[4]=_);let b=_,x;t[5]===b?x=t[6]:(x=()=>{b()},t[5]=b,t[6]=x);let S;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[7]=S):S=t[7],(0,Q.useEffect)(x,S);let C;t[8]!==i||t[9]!==b||t[10]!==o?(C=async function(){if(g.current)return;g.current=!0,d(!1),p(!0),h(null);let e=null;try{let t=o.signout?await o.signout():{ok:!1,error:i({id:`8cpOa8`})};t.ok||(e=t.error??i({id:`8cpOa8`}))}catch(t){console.warn(`[AccountSection] GitHub disconnect failed`,t),e=i({id:`8cpOa8`})}await b(),e&&h(e),p(!1),g.current=!1},t[8]=i,t[9]=b,t[10]=o,t[11]=C):C=t[11];let w=C,T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(`h3`,{id:`settings-account-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`AeXO77`})}),t[12]=T):T=t[12];let E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[T,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`E6lrpp`})})]}),t[13]=E):E=t[13];let D;t[14]!==m||t[15]!==f||t[16]!==w||t[17]!==b||t[18]!==c.phase||t[19]!==c.result?(D=c.phase===`loading`?(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-loading`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`IWGfGF`})}),(0,$.jsx)(Se,{className:`h-4 w-40`}),(0,$.jsx)(Se,{className:`h-8 w-32`})]}):c.phase===`check-failed`?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-check-failed`,children:[(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`T_wG4n`})}),(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:(0,$.jsx)(v,{id:`KDw4GX`})})]}):c.result.authenticated?c.result.tier===`A`?(0,$.jsx)(dn,{login:c.result.login}):(0,$.jsx)(un,{login:c.result.login,disconnecting:f,error:m,onDisconnect:()=>void w()}):(0,$.jsx)(fn,{onConnect:()=>d(!0)}),t[14]=m,t[15]=f,t[16]=w,t[17]=b,t[18]=c.phase,t[19]=c.result,t[20]=D):D=t[20];let O;t[21]===b?O=t[22]:(O=()=>{b()},t[21]=b,t[22]=O);let k;t[23]!==u||t[24]!==r||t[25]!==O?(k=(0,$.jsx)(we,{open:u,onOpenChange:d,transport:r,onSuccess:O}),t[23]=u,t[24]=r,t[25]=O,t[26]=k):k=t[26];let A;return t[27]!==k||t[28]!==D?(A=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[E,D,k]}),t[27]=k,t[28]=D,t[29]=A):A=t[29],A}function un(e){let t=(0,Z.c)(20),{login:n,disconnecting:r,error:i,onDisconnect:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`nxlOpL`})}),t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[3]=o,t[4]=c);let l;t[5]===r?l=t[6]:(l=r?(0,$.jsx)(v,{id:`rppgXF`}):(0,$.jsx)(v,{id:`-K0AvT`}),t[5]=r,t[6]=l);let u;t[7]!==r||t[8]!==a||t[9]!==l?(u=(0,$.jsx)(L,{variant:`outline`,onClick:a,disabled:r,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:l}),t[7]=r,t[8]=a,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==c||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,$.jsx)(v,{id:`msOK6I`})}),t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-account-disconnect-error`,children:i}):null,t[15]=i,t[16]=p);let m;return t[17]!==d||t[18]!==p?(m=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[d,f,p]}),t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function dn(e){let t=(0,Z.c)(5),{login:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`ny6vNn`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-gh-cli`,children:(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[r,i]})}),t[3]=r,t[4]=a),a}function fn(e){let t=(0,Z.c)(5),{onConnect:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`S33tz3`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`EJuO7B`})})]}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(v,{id:`3jod3l`}),t[2]=a):a=t[2];let o;return t[3]===n?o=t[4]:(o=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-disconnected`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,(0,$.jsx)(L,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=o),o}async function pn(e){try{let t=N.safeParse(await e.json());if(t.success)return t.data.title}catch{}}async function mn(e,t){try{let n=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return n.ok?{ok:!0}:{ok:!1,error:await pn(n)}}catch{return{ok:!1}}}function hn(){return{setKey:e=>mn(`/api/local-op/embeddings/set-key`,{key:e}),clearKey:()=>mn(`/api/local-op/embeddings/clear-key`,{})}}function gn(e){let t=(0,Z.c)(29),{transport:n}=e,{_:r}=y(),i;t[0]===n?i=t[1]:(i=n??hn(),t[0]=n,t[1]=i);let a=i,{status:o,refresh:s}=fe(),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),m=o?.keyPresent??!1,h=o?.keySource??null,g=o?.keyHint??null,_;t[2]!==r||t[3]!==u||t[4]!==c||t[5]!==s||t[6]!==a?(_=async function(){let e=c.trim();if(!e||u)return;d(!0),p(null);let t=await a.setKey(e);d(!1),t.ok?(l(``),s()):p(t.error??r({id:`Ck9XRt`}))},t[2]=r,t[3]=u,t[4]=c,t[5]=s,t[6]=a,t[7]=_):_=t[7];let b=_,x;t[8]!==r||t[9]!==u||t[10]!==s||t[11]!==a?(x=async function(){if(u)return;d(!0),p(null);let e=await a.clearKey();d(!1),e.ok?s():p(e.error??r({id:`CSL0l1`}))},t[8]=r,t[9]=u,t[10]=s,t[11]=a,t[12]=x):x=t[12];let S=x,C;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(`h3`,{id:`settings-embeddings-key-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`nh3wwx`})}),t[13]=C):C=t[13];let w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[C,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`FOyCTr`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]}),t[14]=w):w=t[14];let T;t[15]!==r||t[16]!==u||t[17]!==g||t[18]!==c||t[19]!==m||t[20]!==h||t[21]!==S||t[22]!==b?(T=h===`env`?(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-embeddings-key-env`,children:(0,$.jsx)(v,{id:`KH5bQi`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}):(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,"data-testid":`settings-embeddings-key-set`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-1.5 text-sm font-medium`,children:(0,$.jsx)(v,{id:`AqnqMJ`})}),g?(0,$.jsxs)(`p`,{className:`truncate font-mono text-muted-foreground text-xs`,title:r({id:`qEIFZu`,values:{keyHint:g}}),"data-testid":`settings-embeddings-key-hint`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`••••••••`}),g]}):null,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`3TCafD`})})]}),(0,$.jsx)(L,{variant:`outline`,onClick:()=>void S(),disabled:u,"data-testid":`settings-embeddings-key-clear`,children:(0,$.jsx)(v,{id:`xCJdfg`})})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{htmlFor:`settings-embeddings-key-input`,className:`mb-2 block text-sm font-medium`,children:m?(0,$.jsx)(v,{id:`UW93oq`}):(0,$.jsx)(v,{id:`K6jxcj`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Lt,{id:`settings-embeddings-key-input`,type:`password`,value:c,onChange:e=>l(e.target.value),placeholder:r({id:`tsiTqO`}),autoComplete:`off`,spellCheck:!1,disabled:u,"data-testid":`settings-embeddings-key-input`,className:`h-8 font-mono text-sm`}),(0,$.jsx)(L,{onClick:()=>void b(),disabled:u||c.trim().length===0,"data-testid":`settings-embeddings-key-save`,children:u?(0,$.jsx)(v,{id:`uF9ruK`}):(0,$.jsx)(v,{id:`tfDRzk`})})]})]})]}),t[15]=r,t[16]=u,t[17]=g,t[18]=c,t[19]=m,t[20]=h,t[21]=S,t[22]=b,t[23]=T):T=t[23];let E;t[24]===f?E=t[25]:(E=f?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-embeddings-key-error`,children:f}):null,t[24]=f,t[25]=E);let D;return t[26]!==T||t[27]!==E?(D=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-embeddings-key-title`,className:`space-y-3`,"data-testid":`settings-embeddings-key`,children:[w,(0,$.jsxs)(`div`,{className:`space-y-3 rounded-md border p-3`,children:[T,E]})]}),t[26]=T,t[27]=E,t[28]=D):D=t[28],D}var _n=e(t(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}var r=``,i=` `,a=`\\`,o=/^\s+$/,s=/(?:[^\\]|^)\\$/,c=/^\\!/,l=/^\\#/,u=/\r?\n/g,d=/^\.*\/|^\.+$/,f=`/`,p=`node-ignore`;typeof Symbol<`u`&&(p=Symbol.for(`node-ignore`));var m=p,h=(e,t,n)=>Object.defineProperty(e,t,{value:n}),g=/([0-z])-([0-z])/g,_=()=>!1,v=e=>e.replace(g,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:r),y=e=>{let{length:t}=e;return e.slice(0,t-t%2)},b=[[/^\uFEFF/,()=>r],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?i:r)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+i}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>a],[/\\\\/g,()=>a],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===a?`\\[${n}${y(r)}${i}`:i===`]`&&r.length%2==0?`[${v(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],x=Object.create(null),S=(e,t)=>{let n=x[e];return n||(n=b.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),x[e]=n),t?new RegExp(n,`i`):new RegExp(n)},C=e=>typeof e==`string`,w=e=>e&&C(e)&&!o.test(e)&&!s.test(e)&&e.indexOf(`#`)!==0,T=e=>e.split(u),E=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}},D=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(c,`!`).replace(l,`#`);let i=S(e,t);return new E(n,e,r,i)},O=(e,t)=>{throw new t(e)},k=(e,t,n)=>C(e)?e?k.isNotRelative(e)?n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),A=e=>d.test(e);k.isNotRelative=A,k.convert=e=>e;var j=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){h(this,m,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[m]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(w(e)){let t=D(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(C(e)?T(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&k.convert(e);return k(i,e,this._allowRelativePaths?_:O),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(f),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(f)+f,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},M=e=>new j(e);if(M.isPathValid=e=>k(e&&k.convert(e),e,_),M.default=M,t.exports=M,typeof process<`u`&&({}.IGNORE_TEST_WIN32||process.platform===`win32`)){k.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;k.isNotRelative=t=>e.test(t)||A(t)}}))(),1),vn=new Map;function yn(e){let t=vn.get(e);if(t)return vn.delete(e),vn.set(e,t),t;let n=(0,_n.default)();if(n.add(e),vn.set(e,n),vn.size>256){let e=vn.keys().next().value;e!==void 0&&vn.delete(e)}return n}function bn(e,t){let n=e.trim();if(n.length===0||n.startsWith(`#`))return 0;let r=yn(n),i=0;for(let e of t)e.length!==0&&r.ignores(e)&&(i+=1);return i}var xn={"trailing-backslash":`Trailing backslash — line continuation isn't supported.`,"unmatched-bracket":`Unmatched [ — character class is open.`,"lone-bang":`Lone ! — negation needs a pattern after it.`,"leading-whitespace":`Leading whitespace — the rule may not match as expected.`,"embedded-newline":`Embedded line break — the row spans multiple lines.`};function Sn(e){let t=[];if(e.length===0||e.trimStart().startsWith(`#`))return t;/[\r\n]/.test(e)&&t.push({code:`embedded-newline`,message:xn[`embedded-newline`]}),/^\s/.test(e)&&t.push({code:`leading-whitespace`,message:xn[`leading-whitespace`]});let n=e.trim();return n===`!`&&t.push({code:`lone-bang`,message:xn[`lone-bang`]}),n.endsWith(`\\`)&&t.push({code:`trailing-backslash`,message:xn[`trailing-backslash`]}),Cn(n,`[`)>Cn(n,`]`)&&t.push({code:`unmatched-bracket`,message:xn[`unmatched-bracket`]}),t}function Cn(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}var wn=`https://openknowledge.ai/docs/features/ignore-patterns`,Tn=1200,En=150,Dn=150,On=5e3,kn=600,An=400,jn=`okignore-show-advanced`;function Mn(e){let t=(0,Z.c)(3),{binding:n,synced:r}=e;if(n===null||!r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Nn,{}),t[0]=e):e=t[0],e}let i;return t[1]===n?i=t[2]:(i=(0,$.jsx)(Pn,{binding:n}),t[1]=n,t[2]=i),i}function Nn(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-skeleton`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`3zyg_A`})}),(0,$.jsx)(Se,{className:`h-4 w-72`})]}),(0,$.jsx)(Se,{className:`h-20 w-full`})]}),e[0]=t):t=e[0],t}function Pn(e){let t=(0,Z.c)(72),{binding:n}=e,{_:r}=y(),i;t[0]===n?i=t[1]:(i=()=>n.current(),t[0]=n,t[1]=i);let[a,o]=(0,Q.useState)(i),s,c;t[2]===n?(s=t[3],c=t[4]):(s=()=>n.subscribe(e=>{o(e)}),c=[n],t[2]=n,t[3]=s,t[4]=c),(0,Q.useEffect)(s,c);let{pages:l,pageMeta:u,assetPaths:d}=te(),f;t[5]!==d||t[6]!==u||t[7]!==l?(f=tr(l,u,d),t[5]=d,t[6]=u,t[7]=l,t[8]=f):f=t[8];let p=f,m,h;t[9]===a?(m=t[10],h=t[11]):(m=Ie(a),h=ze(m),t[9]=a,t[10]=m,t[11]=h);let g=h,_=g.length===0,[b,x]=(0,Q.useState)(null),S=(0,Q.useRef)(null),C,w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>()=>{S.current&&clearTimeout(S.current)},w=[],t[12]=C,t[13]=w):(C=t[12],w=t[13]),(0,Q.useEffect)(C,w);let T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{x({key:e,ts:Date.now()}),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>x(null),Tn)},t[14]=T):T=t[14];let D=T,[O,k]=(0,Q.useState)(null),A=(0,Q.useRef)(null),j,M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>{A.current&&clearTimeout(A.current)},j=[],t[15]=j,t[16]=M):(j=t[15],M=t[16]),(0,Q.useEffect)(M,j);let N,P;t[17]===n?(N=t[18],P=t[19]):(N=()=>Me(e=>{e.docName===`__config__/okignore`&&n.notifyRejection(e.error)}),P=[n],t[17]=n,t[18]=N,t[19]=P),(0,Q.useEffect)(N,P);let F,I;t[20]===n?(F=t[21],I=t[22]):(F=()=>n.subscribeRejection(e=>{let{error:t}=e,n=Zn(t);k({message:n?.detail??E(t),lineNumber:n?.lineNumber,ts:Date.now()}),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>k(null),On)}),I=[n],t[20]=n,t[21]=F,t[22]=I),(0,Q.useEffect)(F,I);let L,R;t[23]===r?(L=t[24],R=t[25]):(L=()=>Re(e=>{let{path:t}=e;X.error(r({id:`3oh0nQ`,values:{path:t}}),{description:e.error,id:`okignore-nested-error:${e.path}`,duration:8e3})}),R=[r],t[23]=r,t[24]=L,t[25]=R),(0,Q.useEffect)(L,R);let z;t[26]===n?z=t[27]:(z=e=>{n.patch(e)},t[26]=n,t[27]=z);let B=z,V;t[28]!==B||t[29]!==m||t[30]!==g?(V=(e,t)=>{let n=t.trim(),r=g[e];if(r&&n!==r.text){if(n.length===0){B(Te(je(m,e)));return}B(Te(Oe(m,e,n))),D(Xn(n,e))}},t[28]=B,t[29]=m,t[30]=g,t[31]=V):V=t[31];let H=V,U;t[32]!==B||t[33]!==m?(U=e=>{B(Te(je(m,e)))},t[32]=B,t[33]=m,t[34]=U):U=t[34];let W=U,G;t[35]!==B||t[36]!==m||t[37]!==g.length?(G=e=>{let t=e.trim();if(t.length===0)return;let n=ke(m,t);if(n>=0){D(Xn(t,n));return}B(Te(He(m,t))),D(Xn(t,g.length))},t[35]=B,t[36]=m,t[37]=g.length,t[38]=G):G=t[38];let ee=G,K;t[39]!==B||t[40]!==m?(K=e=>{let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=Yn(t),i=Yn(n);r<0||i<0||r===i||B(Te(Ae(m,r,i)))},t[39]=B,t[40]=m,t[41]=K):K=t[41];let ne=K,q;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(q={activationConstraint:{distance:4}},t[42]=q):q=t[42];let re;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(re={coordinateGetter:rt},t[43]=re):re=t[43];let ie=ct(Ze(nt,q),Ze(it,re)),J=O===null?null:`rejection-${O.ts}`,[Y,ae]=ir(),oe;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`3zyg_A`})}),t[44]=oe):oe=t[44];let se;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[oe,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`Z5h97D`,components:{0:(0,$.jsx)(`a`,{href:wn,target:`_blank`,rel:`noreferrer noopener`,className:`text-primary underline-offset-2 hover:underline`,"data-testid":`settings-okignore-primer`})}})})]}),t[45]=se):se=t[45];let ce;t[46]===O?ce=t[47]:(ce=O===null?null:(0,$.jsx)(Ln,{rejection:O}),t[46]=O,t[47]=ce);let le;t[48]!==n||t[49]!==p||t[50]!==ee||t[51]!==ne||t[52]!==H||t[53]!==W||t[54]!==_||t[55]!==g||t[56]!==J||t[57]!==b||t[58]!==ie||t[59]!==Y||t[60]!==a?(le=Y?(0,$.jsx)(Fn,{binding:n,text:a}):_?(0,$.jsx)(Rn,{onAdd:ee,rejectionFlashKey:J,filePaths:p}):(0,$.jsx)(zn,{patterns:g,sensors:ie,onDragEnd:ne,onEdit:H,onRemove:W,onAdd:ee,savedFlash:b,rejectionFlashKey:J,filePaths:p}),t[48]=n,t[49]=p,t[50]=ee,t[51]=ne,t[52]=H,t[53]=W,t[54]=_,t[55]=g,t[56]=J,t[57]=b,t[58]=ie,t[59]=Y,t[60]=a,t[61]=le):le=t[61];let ue;t[62]!==ae||t[63]!==Y?(ue=()=>ae(!Y),t[62]=ae,t[63]=Y,t[64]=ue):ue=t[64];let de;t[65]!==Y||t[66]!==ue?(de=(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(In,{enabled:Y,onToggle:ue})}),t[65]=Y,t[66]=ue,t[67]=de):de=t[67];let fe;return t[68]!==ce||t[69]!==le||t[70]!==de?(fe=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-section`,children:[se,ce,le,de]}),t[68]=ce,t[69]=le,t[70]=de,t[71]=fe):fe=t[71],fe}function Fn(e){let t=(0,Z.c)(31),{binding:n,text:r}=e,{_:i}=y(),[a,o]=(0,Q.useState)(r),s=(0,Q.useRef)(r),c=(0,Q.useRef)(!1),l=(0,Q.useRef)(r),u=(0,Q.useRef)(null),d,f;t[0]===r?(d=t[1],f=t[2]):(d=()=>{c.current||r!==s.current&&(o(r),l.current=r,s.current=r)},f=[r],t[0]=r,t[1]=d,t[2]=f),(0,Q.useEffect)(d,f);let p,m;t[3]===a?(p=t[4],m=t[5]):(p=()=>{l.current=a},m=[a],t[3]=a,t[4]=p,t[5]=m),(0,Q.useEffect)(p,m);let h,g;t[6]===n?(h=t[7],g=t[8]):(h=()=>()=>{u.current&&(clearTimeout(u.current),u.current=null,l.current!==s.current&&(n.patch(l.current),s.current=l.current))},g=[n],t[6]=n,t[7]=h,t[8]=g),(0,Q.useEffect)(h,g);let _;t[9]===n?_=t[10]:(_=e=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,e!==s.current&&(s.current=e,n.patch(e))},An)},t[9]=n,t[10]=_);let v=_,b;t[11]===n?b=t[12]:(b=()=>{u.current&&=(clearTimeout(u.current),null),l.current!==s.current&&(s.current=l.current,n.patch(l.current))},t[11]=n,t[12]=b);let x=b,S;t[13]===v?S=t[14]:(S=e=>{o(e.target.value),v(e.target.value)},t[13]=v,t[14]=S);let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{c.current=!0},t[15]=C):C=t[15];let w;t[16]===x?w=t[17]:(w=()=>{c.current=!1,x()},t[16]=x,t[17]=w);let T;t[18]===a?T=t[19]:(T=a.split(`
|
|
1
|
+
import{o as e,t}from"./chunk-CFjPhJqf.js";import{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{C as a,E as o,Et as s,K as c,S as l,T as u,gn as d,in as f,on as p,sn as m,w as h,x as g,zn as _}from"./DocumentContext-WluK-pvu.js";import{n as v,r as y}from"./dist-CQw2y-s3.js";import{n as b}from"./dist-BVOt51sU.js";import{$ as x,Ct as S,Ii as C,Li as w,Mi as T,Ni as E,Pi as D,_ as O,br as k,bt as A,h as j,k as M,rt as N,wi as P}from"./dist-BkxMNfFN.js";import{a as F,i as I,t as L,u as R}from"./button-cneJOVxD.js";import{a as z,c as B,i as V,r as H,t as U}from"./EnableSyncConfirmDialog-BWfcC03w.js";import{t as W}from"./arrow-up-right-DoN2FmSd.js";import{t as G}from"./check-Dqb-7gfx.js";import{t as ee}from"./chevron-right-BfmqRYl8.js";import{i as te}from"./prop-types-PwAyvfNz.js";import{A as K,D as ne,O as q,b as re,c as ie,d as J,i as Y,k as ae,m as oe,r as se,s as ce,t as le,u as ue,w as de}from"./skill-actions-DmQL_HGK.js";import{$ as fe,A as pe,B as me,C as he,E as ge,H as _e,M as ve,Q as ye,S as be,T as xe,U as Se,V as Ce,W as we,_ as Te,at as Ee,c as De,d as Oe,f as ke,g as Ae,h as je,i as Me,j as Ne,l as Pe,lt as Fe,m as Ie,n as Le,o as Re,p as ze,q as Be,st as Ve,u as He,v as Ue,w as We,x as Ge,y as Ke,z as qe}from"./auth-state-cache-BQjQ1M5b.js";import{i as Je,t as Ye}from"./skill-scope-Bt2TwqtA.js";import"./config-provider-D-gGfmXm.js";import{n as Xe}from"./config-context-CVpOcWSZ.js";import{_ as Ze,b as Qe,d as $e,f as et,g as tt,h as nt,l as rt,m as it,o as at,t as ot,u as st,v as ct,y as lt}from"./open-managed-artifact-tab-TH1tyrz4.js";import{a as ut}from"./cursor-CGeB2PU5.js";import{t as dt}from"./triangle-alert-r1Ou0VrE.js";import{n as X,r as ft}from"./dist-IEs1iCqd.js";import{i as pt,n as mt,t as ht}from"./tooltip-C9Dd0rIc.js";import{n as gt,r as _t,t as vt}from"./collapsible-iVWLn36m.js";import{a as yt,c as bt,i as xt,n as St,o as Ct,r as wt,s as Tt,t as Et}from"./dialog-BiB39Lhy.js";import{t as Dt}from"./checkbox-P04sbGVQ.js";import{T as Ot,h as kt,p as At}from"./skills-api-T8UMKFuI.js";import{t as jt}from"./label-hTzLGQhh.js";import{n as Mt,r as Nt,t as Pt}from"./radio-group-1_2tsQbc.js";import{n as Ft,t as It}from"./toggle-group-IN7Np0Is.js";import{t as Lt}from"./input-D0MSkqYi.js";import{n as Rt}from"./dist-0Zj_lz7j.js";import{r as zt}from"./documents-events-D064jVvV.js";import{a as Bt,n as Vt,r as Ht,s as Ut,t as Wt}from"./keyboard-shortcuts-DiiTkD4P.js";var Gt=R(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Z=i(),Q=e(n(),1),$=r(),Kt=`settings-sharing-title`;function qt(){let e=(0,Z.c)(1),t=(typeof window<`u`?window.okDesktop:void 0)?.sharing,n;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=t===void 0?(0,$.jsx)(Jt,{}):(0,$.jsx)(Yt,{}),e[0]=n):n=e[0],n}function Jt(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`h3`,{id:Kt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`section`,{"aria-labelledby":Kt,className:`space-y-3`,children:(0,$.jsxs)(`div`,{className:`space-y-1`,children:[t,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`7YRrJ9`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{}),2:(0,$.jsx)(`code`,{})}})})]})}),e[1]=n):n=e[1],n}function Yt(){let e=(0,Z.c)(28),{_:t}=y(),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c;e[0]===t?c=e[1]:(c=async function(){let e=window.okDesktop?.sharing;if(e)try{r(await e.status())}catch(e){let n=e;X.error(n instanceof Error?n.message:t({id:`K0N7zS`})),r(Zt)}},e[0]=t,e[1]=c);let l=c,u;e[2]===l?u=e[3]:(u=()=>{l()},e[2]=l,e[3]=u);let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],e[4]=d):d=e[4],(0,Q.useEffect)(u,d);let f;e[5]!==t||e[6]!==i||e[7]!==l||e[8]!==n?(f=async function(e){let r=window.okDesktop?.sharing;if(!r||n===null||i||n.mode===e)return;a(!0),s(null);let o=null,c=null;try{o=await r.setMode(e)}catch(e){c=e}if(a(!1),c!==null){X.error(c instanceof Error?c.message:t({id:`qZv5ZR`}));return}o!==null&&(o.kind===`refused-tracked`?(s({tracked:o.tracked,remediation:o.remediation}),X.error(t({id:`z2JdQ-`}),{duration:5e3})):o.kind===`no-exclude`?X.warning(o.reason===`no-git`?t({id:`YSFv5w`}):t({id:`8cS0nH`,values:{0:o.reason}})):X.success(t(e===`local-only`?{id:`VvS_k_`}:{id:`k_pade`})),await l())},e[5]=t,e[6]=i,e[7]=l,e[8]=n,e[9]=f):f=e[9];let p=f;if(n===null){let t;return e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":Kt,className:`space-y-3`,children:[(0,$.jsx)(`h3`,{id:Kt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),(0,$.jsx)(Se,{className:`h-24`})]}),e[10]=t):t=e[10],t}let m=n.mode===`no-git`,h;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`h3`,{id:Kt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),(0,$.jsx)(Nt,{})]}),e[11]=h):h=e[11];let g;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[h,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`N55YNr`})})]}),e[12]=g):g=e[12];let _;e[13]!==i||e[14]!==m||e[15]!==p||e[16]!==n.mode?(_=m?(0,$.jsx)(`p`,{className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,role:`status`,"data-testid":`settings-sharing-no-git`,children:(0,$.jsx)(v,{id:`ju38ms`})}):(0,$.jsxs)(Pt,{value:n.mode,onValueChange:e=>void p(e),disabled:i,className:`gap-2`,"aria-labelledby":Kt,"data-testid":`settings-sharing-radiogroup`,children:[(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-shared`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(Mt,{id:`settings-sharing-shared`,value:`shared`,"data-testid":`settings-sharing-shared`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`0Gd0NU`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`dJw2_7`})})]})]}),(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-local-only`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(Mt,{id:`settings-sharing-local-only`,value:`local-only`,"data-testid":`settings-sharing-local-only`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`OgyJSr`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`cZ_8zB`})})]})]})]}),e[13]=i,e[14]=m,e[15]=p,e[16]=n.mode,e[17]=_):_=e[17];let b;e[18]===o?b=e[19]:(b=o===null?null:(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border border-destructive bg-destructive/10 p-3 text-sm`,role:`alert`,"data-testid":`settings-sharing-refusal`,children:[(0,$.jsx)(`p`,{className:`font-semibold`,children:(0,$.jsx)(v,{id:`Kgdbkt`})}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs leading-relaxed`,children:o.remediation}),(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>s(null),children:(0,$.jsx)(v,{id:`1QfxQT`})})]}),e[18]=o,e[19]=b);let x;e[20]!==o||e[21]!==n.mode||e[22]!==n.trackedUpstream?(x=n.trackedUpstream.length>0&&n.mode!==`no-git`&&o===null?(0,$.jsxs)(`div`,{className:`space-y-1 rounded-md border border-muted-foreground/30 bg-muted/40 p-3 text-sm`,"data-testid":`settings-sharing-tracked-info`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`LhWYpm`})}),(0,$.jsx)(`ul`,{className:`list-disc pl-5 font-mono text-xs text-muted-foreground`,children:n.trackedUpstream.map(Xt)}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`1XSMhZ`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]}):null,e[20]=o,e[21]=n.mode,e[22]=n.trackedUpstream,e[23]=x):x=e[23];let S;return e[24]!==_||e[25]!==b||e[26]!==x?(S=(0,$.jsxs)(`section`,{"aria-labelledby":Kt,className:`space-y-4`,"data-testid":`settings-sharing`,children:[g,_,b,x]}),e[24]=_,e[25]=b,e[26]=x,e[27]=S):S=e[27],S}function Xt(e){return(0,$.jsx)(`li`,{children:e},e)}function Zt(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[]}}var Qt=ge,$t=Q.createContext({}),en=e=>{let t=(0,Z.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;t[2]===n.name?r=t[3]:(r={name:n.name},t[2]=n.name,t[3]=r);let i;t[4]===n?i=t[5]:(i=(0,$.jsx)(xe,{...n}),t[4]=n,t[5]=i);let a;return t[6]!==r||t[7]!==i?(a=(0,$.jsx)($t.Provider,{value:r,children:i}),t[6]=r,t[7]=i,t[8]=a):a=t[8],a},tn=()=>{let e=(0,Z.c)(13),t=Q.use($t),n=Q.use(nn),{getFieldState:r}=Ne(),i;e[0]===t.name?i=e[1]:(i={name:t.name},e[0]=t.name,e[1]=i);let a=ve(i),o;e[2]!==t.name||e[3]!==a||e[4]!==r?(o=r(t.name,a),e[2]=t.name,e[3]=a,e[4]=r,e[5]=o):o=e[5];let s=o;if(!t)throw Error(`useFormField should be used within <FormField>`);let{id:c}=n,l=`${c}-form-item`,u=`${c}-form-item-description`,d=`${c}-form-item-message`,f;return e[6]!==t.name||e[7]!==s||e[8]!==c||e[9]!==l||e[10]!==u||e[11]!==d?(f={id:c,name:t.name,formItemId:l,formDescriptionId:u,formMessageId:d,...s},e[6]=t.name,e[7]=s,e[8]=c,e[9]=l,e[10]=u,e[11]=d,e[12]=f):f=e[12],f},nn=Q.createContext({});function rn(e){let t=(0,Z.c)(13),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=Q.useId(),a;t[3]===i?a=t[4]:(a={id:i},t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=I(`grid gap-2`,n),t[5]=n,t[6]=o);let s;t[7]!==r||t[8]!==o?(s=(0,$.jsx)(`div`,{"data-slot":`form-item`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(0,$.jsx)(nn.Provider,{value:a,children:s}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function an(e){let t=(0,Z.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{error:i,formItemId:a}=tn(),o=!!i,s;t[3]===n?s=t[4]:(s=I(`data-[error=true]:text-destructive`,n),t[3]=n,t[4]=s);let c;return t[5]!==a||t[6]!==r||t[7]!==o||t[8]!==s?(c=(0,$.jsx)(jt,{"data-slot":`form-label`,"data-error":o,className:s,htmlFor:a,...r}),t[5]=a,t[6]=r,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function on(e){let t=(0,Z.c)(7),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{error:r,formItemId:i,formDescriptionId:a,formMessageId:o}=tn(),s=r?`${a} ${o}`:`${a}`,c=!!r,l;return t[2]!==i||t[3]!==n||t[4]!==s||t[5]!==c?(l=(0,$.jsx)(F,{"data-slot":`form-control`,id:i,"aria-describedby":s,"aria-invalid":c,...n}),t[2]=i,t[3]=n,t[4]=s,t[5]=c,t[6]=l):l=t[6],l}function sn(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{formDescriptionId:i}=tn(),a;t[3]===n?a=t[4]:(a=I(`text-1sm text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==r||t[7]!==a?(o=(0,$.jsx)(`p`,{"data-slot":`form-description`,id:i,className:a,...r}),t[5]=i,t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function cn(e){let t=(0,Z.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{error:i,formMessageId:a}=tn(),o=i?String(i?.message??``):r.children;if(!o)return null;let s=i?`alert`:void 0,c;t[3]===n?c=t[4]:(c=I(`text-sm text-destructive`,n),t[3]=n,t[4]=c);let l;return t[5]!==o||t[6]!==a||t[7]!==r||t[8]!==s||t[9]!==c?(l=(0,$.jsx)(`p`,{"data-slot":`form-message`,id:a,role:s,className:c,...r,children:o}),t[5]=o,t[6]=a,t[7]=r,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function ln(e){let t=(0,Z.c)(30),{authQueryTransport:n,authTransport:r}=e,{_:i}=y(),a;t[0]===n?a=t[1]:(a=n??Be(),t[0]=n,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={phase:`loading`},t[2]=s):s=t[2];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(!1),_;t[3]===o?_=t[4]:(_=async function(){l({phase:`loading`});try{let e=await o.status();l({phase:`loaded`,result:e}),Le(e.authenticated)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),l({phase:`check-failed`})}},t[3]=o,t[4]=_);let b=_,x;t[5]===b?x=t[6]:(x=()=>{b()},t[5]=b,t[6]=x);let S;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[7]=S):S=t[7],(0,Q.useEffect)(x,S);let C;t[8]!==i||t[9]!==b||t[10]!==o?(C=async function(){if(g.current)return;g.current=!0,d(!1),p(!0),h(null);let e=null;try{let t=o.signout?await o.signout():{ok:!1,error:i({id:`8cpOa8`})};t.ok||(e=t.error??i({id:`8cpOa8`}))}catch(t){console.warn(`[AccountSection] GitHub disconnect failed`,t),e=i({id:`8cpOa8`})}await b(),e&&h(e),p(!1),g.current=!1},t[8]=i,t[9]=b,t[10]=o,t[11]=C):C=t[11];let w=C,T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(`h3`,{id:`settings-account-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`AeXO77`})}),t[12]=T):T=t[12];let E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[T,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`E6lrpp`})})]}),t[13]=E):E=t[13];let D;t[14]!==m||t[15]!==f||t[16]!==w||t[17]!==b||t[18]!==c.phase||t[19]!==c.result?(D=c.phase===`loading`?(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-loading`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`IWGfGF`})}),(0,$.jsx)(Se,{className:`h-4 w-40`}),(0,$.jsx)(Se,{className:`h-8 w-32`})]}):c.phase===`check-failed`?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-check-failed`,children:[(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`T_wG4n`})}),(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:(0,$.jsx)(v,{id:`KDw4GX`})})]}):c.result.authenticated?c.result.tier===`A`?(0,$.jsx)(dn,{login:c.result.login}):(0,$.jsx)(un,{login:c.result.login,disconnecting:f,error:m,onDisconnect:()=>void w()}):(0,$.jsx)(fn,{onConnect:()=>d(!0)}),t[14]=m,t[15]=f,t[16]=w,t[17]=b,t[18]=c.phase,t[19]=c.result,t[20]=D):D=t[20];let O;t[21]===b?O=t[22]:(O=()=>{b()},t[21]=b,t[22]=O);let k;t[23]!==u||t[24]!==r||t[25]!==O?(k=(0,$.jsx)(we,{open:u,onOpenChange:d,transport:r,onSuccess:O}),t[23]=u,t[24]=r,t[25]=O,t[26]=k):k=t[26];let A;return t[27]!==k||t[28]!==D?(A=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[E,D,k]}),t[27]=k,t[28]=D,t[29]=A):A=t[29],A}function un(e){let t=(0,Z.c)(20),{login:n,disconnecting:r,error:i,onDisconnect:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`nxlOpL`})}),t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[3]=o,t[4]=c);let l;t[5]===r?l=t[6]:(l=r?(0,$.jsx)(v,{id:`rppgXF`}):(0,$.jsx)(v,{id:`-K0AvT`}),t[5]=r,t[6]=l);let u;t[7]!==r||t[8]!==a||t[9]!==l?(u=(0,$.jsx)(L,{variant:`outline`,onClick:a,disabled:r,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:l}),t[7]=r,t[8]=a,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==c||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,$.jsx)(v,{id:`msOK6I`})}),t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-account-disconnect-error`,children:i}):null,t[15]=i,t[16]=p);let m;return t[17]!==d||t[18]!==p?(m=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[d,f,p]}),t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function dn(e){let t=(0,Z.c)(5),{login:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`ny6vNn`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-gh-cli`,children:(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[r,i]})}),t[3]=r,t[4]=a),a}function fn(e){let t=(0,Z.c)(5),{onConnect:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`S33tz3`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`EJuO7B`})})]}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(v,{id:`3jod3l`}),t[2]=a):a=t[2];let o;return t[3]===n?o=t[4]:(o=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-disconnected`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,(0,$.jsx)(L,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=o),o}async function pn(e){try{let t=N.safeParse(await e.json());if(t.success)return t.data.title}catch{}}async function mn(e,t){try{let n=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return n.ok?{ok:!0}:{ok:!1,error:await pn(n)}}catch{return{ok:!1}}}function hn(){return{setKey:e=>mn(`/api/local-op/embeddings/set-key`,{key:e}),clearKey:()=>mn(`/api/local-op/embeddings/clear-key`,{})}}function gn(e){let t=(0,Z.c)(29),{transport:n}=e,{_:r}=y(),i;t[0]===n?i=t[1]:(i=n??hn(),t[0]=n,t[1]=i);let a=i,{status:o,refresh:s}=fe(),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),m=o?.keyPresent??!1,h=o?.keySource??null,g=o?.keyHint??null,_;t[2]!==r||t[3]!==u||t[4]!==c||t[5]!==s||t[6]!==a?(_=async function(){let e=c.trim();if(!e||u)return;d(!0),p(null);let t=await a.setKey(e);d(!1),t.ok?(l(``),s()):p(t.error??r({id:`Ck9XRt`}))},t[2]=r,t[3]=u,t[4]=c,t[5]=s,t[6]=a,t[7]=_):_=t[7];let b=_,x;t[8]!==r||t[9]!==u||t[10]!==s||t[11]!==a?(x=async function(){if(u)return;d(!0),p(null);let e=await a.clearKey();d(!1),e.ok?s():p(e.error??r({id:`CSL0l1`}))},t[8]=r,t[9]=u,t[10]=s,t[11]=a,t[12]=x):x=t[12];let S=x,C;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(`h3`,{id:`settings-embeddings-key-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`nh3wwx`})}),t[13]=C):C=t[13];let w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[C,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`FOyCTr`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]}),t[14]=w):w=t[14];let T;t[15]!==r||t[16]!==u||t[17]!==g||t[18]!==c||t[19]!==m||t[20]!==h||t[21]!==S||t[22]!==b?(T=h===`env`?(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-embeddings-key-env`,children:(0,$.jsx)(v,{id:`KH5bQi`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}):(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,"data-testid":`settings-embeddings-key-set`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-1.5 text-sm font-medium`,children:(0,$.jsx)(v,{id:`AqnqMJ`})}),g?(0,$.jsxs)(`p`,{className:`truncate font-mono text-muted-foreground text-xs`,title:r({id:`qEIFZu`,values:{keyHint:g}}),"data-testid":`settings-embeddings-key-hint`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`••••••••`}),g]}):null,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`3TCafD`})})]}),(0,$.jsx)(L,{variant:`outline`,onClick:()=>void S(),disabled:u,"data-testid":`settings-embeddings-key-clear`,children:(0,$.jsx)(v,{id:`xCJdfg`})})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{htmlFor:`settings-embeddings-key-input`,className:`mb-2 block text-sm font-medium`,children:m?(0,$.jsx)(v,{id:`UW93oq`}):(0,$.jsx)(v,{id:`K6jxcj`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Lt,{id:`settings-embeddings-key-input`,type:`password`,value:c,onChange:e=>l(e.target.value),placeholder:r({id:`tsiTqO`}),autoComplete:`off`,spellCheck:!1,disabled:u,"data-testid":`settings-embeddings-key-input`,className:`h-8 font-mono text-sm`}),(0,$.jsx)(L,{onClick:()=>void b(),disabled:u||c.trim().length===0,"data-testid":`settings-embeddings-key-save`,children:u?(0,$.jsx)(v,{id:`uF9ruK`}):(0,$.jsx)(v,{id:`tfDRzk`})})]})]})]}),t[15]=r,t[16]=u,t[17]=g,t[18]=c,t[19]=m,t[20]=h,t[21]=S,t[22]=b,t[23]=T):T=t[23];let E;t[24]===f?E=t[25]:(E=f?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-embeddings-key-error`,children:f}):null,t[24]=f,t[25]=E);let D;return t[26]!==T||t[27]!==E?(D=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-embeddings-key-title`,className:`space-y-3`,"data-testid":`settings-embeddings-key`,children:[w,(0,$.jsxs)(`div`,{className:`space-y-3 rounded-md border p-3`,children:[T,E]})]}),t[26]=T,t[27]=E,t[28]=D):D=t[28],D}var _n=e(t(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}var r=``,i=` `,a=`\\`,o=/^\s+$/,s=/(?:[^\\]|^)\\$/,c=/^\\!/,l=/^\\#/,u=/\r?\n/g,d=/^\.*\/|^\.+$/,f=`/`,p=`node-ignore`;typeof Symbol<`u`&&(p=Symbol.for(`node-ignore`));var m=p,h=(e,t,n)=>Object.defineProperty(e,t,{value:n}),g=/([0-z])-([0-z])/g,_=()=>!1,v=e=>e.replace(g,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:r),y=e=>{let{length:t}=e;return e.slice(0,t-t%2)},b=[[/^\uFEFF/,()=>r],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?i:r)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+i}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>a],[/\\\\/g,()=>a],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===a?`\\[${n}${y(r)}${i}`:i===`]`&&r.length%2==0?`[${v(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],x=Object.create(null),S=(e,t)=>{let n=x[e];return n||(n=b.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),x[e]=n),t?new RegExp(n,`i`):new RegExp(n)},C=e=>typeof e==`string`,w=e=>e&&C(e)&&!o.test(e)&&!s.test(e)&&e.indexOf(`#`)!==0,T=e=>e.split(u),E=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}},D=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(c,`!`).replace(l,`#`);let i=S(e,t);return new E(n,e,r,i)},O=(e,t)=>{throw new t(e)},k=(e,t,n)=>C(e)?e?k.isNotRelative(e)?n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),A=e=>d.test(e);k.isNotRelative=A,k.convert=e=>e;var j=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){h(this,m,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[m]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(w(e)){let t=D(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(C(e)?T(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&k.convert(e);return k(i,e,this._allowRelativePaths?_:O),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(f),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(f)+f,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},M=e=>new j(e);if(M.isPathValid=e=>k(e&&k.convert(e),e,_),M.default=M,t.exports=M,typeof process<`u`&&({}.IGNORE_TEST_WIN32||process.platform===`win32`)){k.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;k.isNotRelative=t=>e.test(t)||A(t)}}))(),1),vn=new Map;function yn(e){let t=vn.get(e);if(t)return vn.delete(e),vn.set(e,t),t;let n=(0,_n.default)();if(n.add(e),vn.set(e,n),vn.size>256){let e=vn.keys().next().value;e!==void 0&&vn.delete(e)}return n}function bn(e,t){let n=e.trim();if(n.length===0||n.startsWith(`#`))return 0;let r=yn(n),i=0;for(let e of t)e.length!==0&&r.ignores(e)&&(i+=1);return i}var xn={"trailing-backslash":`Trailing backslash — line continuation isn't supported.`,"unmatched-bracket":`Unmatched [ — character class is open.`,"lone-bang":`Lone ! — negation needs a pattern after it.`,"leading-whitespace":`Leading whitespace — the rule may not match as expected.`,"embedded-newline":`Embedded line break — the row spans multiple lines.`};function Sn(e){let t=[];if(e.length===0||e.trimStart().startsWith(`#`))return t;/[\r\n]/.test(e)&&t.push({code:`embedded-newline`,message:xn[`embedded-newline`]}),/^\s/.test(e)&&t.push({code:`leading-whitespace`,message:xn[`leading-whitespace`]});let n=e.trim();return n===`!`&&t.push({code:`lone-bang`,message:xn[`lone-bang`]}),n.endsWith(`\\`)&&t.push({code:`trailing-backslash`,message:xn[`trailing-backslash`]}),Cn(n,`[`)>Cn(n,`]`)&&t.push({code:`unmatched-bracket`,message:xn[`unmatched-bracket`]}),t}function Cn(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}var wn=`https://openknowledge.ai/docs/features/ignore-patterns`,Tn=1200,En=150,Dn=150,On=5e3,kn=600,An=400,jn=`okignore-show-advanced`;function Mn(e){let t=(0,Z.c)(3),{binding:n,synced:r}=e;if(n===null||!r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Nn,{}),t[0]=e):e=t[0],e}let i;return t[1]===n?i=t[2]:(i=(0,$.jsx)(Pn,{binding:n}),t[1]=n,t[2]=i),i}function Nn(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-skeleton`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`3zyg_A`})}),(0,$.jsx)(Se,{className:`h-4 w-72`})]}),(0,$.jsx)(Se,{className:`h-20 w-full`})]}),e[0]=t):t=e[0],t}function Pn(e){let t=(0,Z.c)(72),{binding:n}=e,{_:r}=y(),i;t[0]===n?i=t[1]:(i=()=>n.current(),t[0]=n,t[1]=i);let[a,o]=(0,Q.useState)(i),s,c;t[2]===n?(s=t[3],c=t[4]):(s=()=>n.subscribe(e=>{o(e)}),c=[n],t[2]=n,t[3]=s,t[4]=c),(0,Q.useEffect)(s,c);let{pages:l,pageMeta:u,assetPaths:d}=te(),f;t[5]!==d||t[6]!==u||t[7]!==l?(f=tr(l,u,d),t[5]=d,t[6]=u,t[7]=l,t[8]=f):f=t[8];let p=f,m,h;t[9]===a?(m=t[10],h=t[11]):(m=Ie(a),h=ze(m),t[9]=a,t[10]=m,t[11]=h);let g=h,_=g.length===0,[b,x]=(0,Q.useState)(null),S=(0,Q.useRef)(null),C,w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>()=>{S.current&&clearTimeout(S.current)},w=[],t[12]=C,t[13]=w):(C=t[12],w=t[13]),(0,Q.useEffect)(C,w);let T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{x({key:e,ts:Date.now()}),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>x(null),Tn)},t[14]=T):T=t[14];let D=T,[O,k]=(0,Q.useState)(null),A=(0,Q.useRef)(null),j,M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>{A.current&&clearTimeout(A.current)},j=[],t[15]=j,t[16]=M):(j=t[15],M=t[16]),(0,Q.useEffect)(M,j);let N,P;t[17]===n?(N=t[18],P=t[19]):(N=()=>Me(e=>{e.docName===`__config__/okignore`&&n.notifyRejection(e.error)}),P=[n],t[17]=n,t[18]=N,t[19]=P),(0,Q.useEffect)(N,P);let F,I;t[20]===n?(F=t[21],I=t[22]):(F=()=>n.subscribeRejection(e=>{let{error:t}=e,n=Zn(t);k({message:n?.detail??E(t),lineNumber:n?.lineNumber,ts:Date.now()}),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>k(null),On)}),I=[n],t[20]=n,t[21]=F,t[22]=I),(0,Q.useEffect)(F,I);let L,R;t[23]===r?(L=t[24],R=t[25]):(L=()=>Re(e=>{let{path:t}=e;X.error(r({id:`3oh0nQ`,values:{path:t}}),{description:e.error,id:`okignore-nested-error:${e.path}`,duration:8e3})}),R=[r],t[23]=r,t[24]=L,t[25]=R),(0,Q.useEffect)(L,R);let z;t[26]===n?z=t[27]:(z=e=>{n.patch(e)},t[26]=n,t[27]=z);let B=z,V;t[28]!==B||t[29]!==m||t[30]!==g?(V=(e,t)=>{let n=t.trim(),r=g[e];if(r&&n!==r.text){if(n.length===0){B(Te(je(m,e)));return}B(Te(Oe(m,e,n))),D(Xn(n,e))}},t[28]=B,t[29]=m,t[30]=g,t[31]=V):V=t[31];let H=V,U;t[32]!==B||t[33]!==m?(U=e=>{B(Te(je(m,e)))},t[32]=B,t[33]=m,t[34]=U):U=t[34];let W=U,G;t[35]!==B||t[36]!==m||t[37]!==g.length?(G=e=>{let t=e.trim();if(t.length===0)return;let n=ke(m,t);if(n>=0){D(Xn(t,n));return}B(Te(He(m,t))),D(Xn(t,g.length))},t[35]=B,t[36]=m,t[37]=g.length,t[38]=G):G=t[38];let ee=G,K;t[39]!==B||t[40]!==m?(K=e=>{let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=Yn(t),i=Yn(n);r<0||i<0||r===i||B(Te(Ae(m,r,i)))},t[39]=B,t[40]=m,t[41]=K):K=t[41];let ne=K,q;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(q={activationConstraint:{distance:4}},t[42]=q):q=t[42];let re;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(re={coordinateGetter:rt},t[43]=re):re=t[43];let ie=ct(Ze(nt,q),Ze(it,re)),J=O===null?null:`rejection-${O.ts}`,[Y,ae]=ir(),oe;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`3zyg_A`})}),t[44]=oe):oe=t[44];let se;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[oe,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`Z5h97D`,components:{0:(0,$.jsx)(`a`,{href:wn,target:`_blank`,rel:`noreferrer noopener`,className:`text-primary underline-offset-2 hover:underline`,"data-testid":`settings-okignore-primer`})}})})]}),t[45]=se):se=t[45];let ce;t[46]===O?ce=t[47]:(ce=O===null?null:(0,$.jsx)(Ln,{rejection:O}),t[46]=O,t[47]=ce);let le;t[48]!==n||t[49]!==p||t[50]!==ee||t[51]!==ne||t[52]!==H||t[53]!==W||t[54]!==_||t[55]!==g||t[56]!==J||t[57]!==b||t[58]!==ie||t[59]!==Y||t[60]!==a?(le=Y?(0,$.jsx)(Fn,{binding:n,text:a}):_?(0,$.jsx)(Rn,{onAdd:ee,rejectionFlashKey:J,filePaths:p}):(0,$.jsx)(zn,{patterns:g,sensors:ie,onDragEnd:ne,onEdit:H,onRemove:W,onAdd:ee,savedFlash:b,rejectionFlashKey:J,filePaths:p}),t[48]=n,t[49]=p,t[50]=ee,t[51]=ne,t[52]=H,t[53]=W,t[54]=_,t[55]=g,t[56]=J,t[57]=b,t[58]=ie,t[59]=Y,t[60]=a,t[61]=le):le=t[61];let ue;t[62]!==ae||t[63]!==Y?(ue=()=>ae(!Y),t[62]=ae,t[63]=Y,t[64]=ue):ue=t[64];let de;t[65]!==Y||t[66]!==ue?(de=(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(In,{enabled:Y,onToggle:ue})}),t[65]=Y,t[66]=ue,t[67]=de):de=t[67];let fe;return t[68]!==ce||t[69]!==le||t[70]!==de?(fe=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-section`,children:[se,ce,le,de]}),t[68]=ce,t[69]=le,t[70]=de,t[71]=fe):fe=t[71],fe}function Fn(e){let t=(0,Z.c)(31),{binding:n,text:r}=e,{_:i}=y(),[a,o]=(0,Q.useState)(r),s=(0,Q.useRef)(r),c=(0,Q.useRef)(!1),l=(0,Q.useRef)(r),u=(0,Q.useRef)(null),d,f;t[0]===r?(d=t[1],f=t[2]):(d=()=>{c.current||r!==s.current&&(o(r),l.current=r,s.current=r)},f=[r],t[0]=r,t[1]=d,t[2]=f),(0,Q.useEffect)(d,f);let p,m;t[3]===a?(p=t[4],m=t[5]):(p=()=>{l.current=a},m=[a],t[3]=a,t[4]=p,t[5]=m),(0,Q.useEffect)(p,m);let h,g;t[6]===n?(h=t[7],g=t[8]):(h=()=>()=>{u.current&&(clearTimeout(u.current),u.current=null,l.current!==s.current&&(n.patch(l.current),s.current=l.current))},g=[n],t[6]=n,t[7]=h,t[8]=g),(0,Q.useEffect)(h,g);let _;t[9]===n?_=t[10]:(_=e=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,e!==s.current&&(s.current=e,n.patch(e))},An)},t[9]=n,t[10]=_);let v=_,b;t[11]===n?b=t[12]:(b=()=>{u.current&&=(clearTimeout(u.current),null),l.current!==s.current&&(s.current=l.current,n.patch(l.current))},t[11]=n,t[12]=b);let x=b,S;t[13]===v?S=t[14]:(S=e=>{o(e.target.value),v(e.target.value)},t[13]=v,t[14]=S);let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{c.current=!0},t[15]=C):C=t[15];let w;t[16]===x?w=t[17]:(w=()=>{c.current=!1,x()},t[16]=x,t[17]=w);let T;t[18]===a?T=t[19]:(T=a.split(`
|
|
2
2
|
`),t[18]=a,t[19]=T);let E=Math.max(6,Math.min(20,T.length+1)),D;t[20]===i?D=t[21]:(D=i({id:`rssK8c`}),t[20]=i,t[21]=D);let O;t[22]===i?O=t[23]:(O=i({id:`AeHuzT`}),t[22]=i,t[23]=O);let k;return t[24]!==a||t[25]!==w||t[26]!==E||t[27]!==D||t[28]!==O||t[29]!==S?(k=(0,$.jsx)(`textarea`,{value:a,onChange:S,onFocus:C,onBlur:w,spellCheck:!1,rows:E,"aria-label":D,placeholder:O,className:`min-h-32 w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-xs outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,"data-testid":`settings-okignore-advanced-textarea`}),t[24]=a,t[25]=w,t[26]=E,t[27]=D,t[28]=O,t[29]=S,t[30]=k):k=t[30],k}function In(e){let t=(0,Z.c)(6),{enabled:n,onToggle:r}=e,i;t[0]===n?i=t[1]:(i=n?(0,$.jsx)(v,{id:`9PQysm`}):(0,$.jsx)(v,{id:`Nv3mUj`}),t[0]=n,t[1]=i);let a;return t[2]!==n||t[3]!==r||t[4]!==i?(a=(0,$.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,"aria-pressed":n,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,"data-testid":`settings-okignore-show-advanced-toggle`,children:i}),t[2]=n,t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function Ln(e){let t=(0,Z.c)(7),{rejection:n}=e,{_:r}=y(),{lineNumber:i,message:a}=n,o;t[0]!==r||t[1]!==i||t[2]!==a?(o=r(i===void 0?{id:`G7-rf8`,values:{message:a}}:{id:`P3NS4G`,values:{lineNumber:i,message:a}}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3];let s=o,c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(dt,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0`}),t[4]=c):c=t[4];let l;return t[5]===s?l=t[6]:(l=(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":`settings-okignore-rejection-banner`,className:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive animate-in fade-in`,children:[c,(0,$.jsx)(`span`,{children:s})]}),t[5]=s,t[6]=l),l}function Rn(e){let t=(0,Z.c)(8),{onAdd:n,rejectionFlashKey:r,filePaths:i}=e,{_:a}=y(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`makN88`})}),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=a({id:`Gx0VS1`}),t[1]=a,t[2]=s);let c;return t[3]!==i||t[4]!==n||t[5]!==r||t[6]!==s?(c=(0,$.jsxs)(`div`,{className:`space-y-3 rounded-md border border-dashed p-4`,"data-testid":`settings-okignore-empty`,children:[o,(0,$.jsx)(Un,{onAdd:n,placeholder:s,rejectionFlashKey:r,filePaths:i})]}),t[3]=i,t[4]=n,t[5]=r,t[6]=s,t[7]=c):c=t[7],c}function zn(e){let t=(0,Z.c)(35),{patterns:n,sensors:r,onDragEnd:i,onEdit:a,onRemove:o,onAdd:s,savedFlash:c,rejectionFlashKey:l,filePaths:u}=e,{_:d}=y(),f;t[0]===n?f=t[1]:(f=n.map(Bn),t[0]=n,t[1]=f);let p=f,m;t[2]===d?m=t[3]:(m=d({id:`3zyg_A`}),t[2]=d,t[3]=m);let h;if(t[4]!==u||t[5]!==a||t[6]!==o||t[7]!==n||t[8]!==c){let e;t[10]!==u||t[11]!==a||t[12]!==o||t[13]!==c?(e=(e,t)=>{let n=Xn(e.text,t),r=c!==null&&c.key===n;return(0,$.jsx)(Vn,{sortableId:Jn(t),patternIndex:t,pattern:e,onEdit:a,onRemove:o,flashActive:r,filePaths:u},Jn(t))},t[10]=u,t[11]=a,t[12]=o,t[13]=c,t[14]=e):e=t[14],h=n.map(e),t[4]=u,t[5]=a,t[6]=o,t[7]=n,t[8]=c,t[9]=h}else h=t[9];let g;t[15]!==m||t[16]!==h?(g=(0,$.jsx)(`ul`,{"aria-label":m,className:`divide-y rounded-md border`,"data-testid":`settings-okignore-list`,children:h}),t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;t[18]!==p||t[19]!==g?(_=(0,$.jsx)(at,{items:p,strategy:$e,children:g}),t[18]=p,t[19]=g,t[20]=_):_=t[20];let v;t[21]!==i||t[22]!==r||t[23]!==_?(v=(0,$.jsx)(et,{sensors:r,collisionDetection:tt,onDragEnd:i,children:_}),t[21]=i,t[22]=r,t[23]=_,t[24]=v):v=t[24];let b;t[25]===d?b=t[26]:(b=d({id:`cZGNlb`}),t[25]=d,t[26]=b);let x;t[27]!==u||t[28]!==s||t[29]!==l||t[30]!==b?(x=(0,$.jsx)(Un,{onAdd:s,placeholder:b,rejectionFlashKey:l,filePaths:u}),t[27]=u,t[28]=s,t[29]=l,t[30]=b,t[31]=x):x=t[31];let S;return t[32]!==v||t[33]!==x?(S=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[v,x]}),t[32]=v,t[33]=x,t[34]=S):S=t[34],S}function Bn(e,t){return Jn(t)}function Vn(e){let t=(0,Z.c)(47),{sortableId:n,patternIndex:r,pattern:i,onEdit:a,onRemove:o,flashActive:s,filePaths:c}=e,{_:l}=y(),u;t[0]===n?u=t[1]:(u={id:n},t[0]=n,t[1]=u);let{attributes:d,listeners:f,setNodeRef:p,transform:m,transition:h,isDragging:g}=st(u),_=i.text,v;t[2]===m?v=t[3]:(v=lt.Transform.toString(m),t[2]=m,t[3]=v);let b=g?.5:void 0,x=g?1:void 0,S;t[4]!==v||t[5]!==b||t[6]!==x||t[7]!==h?(S={transform:v,transition:h,opacity:b,zIndex:x},t[4]=v,t[5]=b,t[6]=x,t[7]=h,t[8]=S):S=t[8];let C=S,w;t[9]!==l||t[10]!==_?(w=l({id:`7_bFEL`,values:{patternText:_}}),t[9]=l,t[10]=_,t[11]=w):w=t[11];let T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Qe,{className:`size-3.5`}),t[12]=T):T=t[12];let E;t[13]!==d||t[14]!==f||t[15]!==w?(E=(0,$.jsx)(L,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-testid":`settings-okignore-drag-handle`,"aria-label":w,...d,...f,className:`h-7 w-4 shrink-0 cursor-grab touch-none px-0 text-muted-foreground/40 hover:text-foreground focus-visible:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring active:cursor-grabbing`,children:T}),t[13]=d,t[14]=f,t[15]=w,t[16]=E):E=t[16];let D;t[17]!==a||t[18]!==r?(D=e=>a(r,e),t[17]=a,t[18]=r,t[19]=D):D=t[19];let O;t[20]!==c||t[21]!==i.text||t[22]!==r||t[23]!==D?(O=(0,$.jsx)(Hn,{patternIndex:r,initialText:i.text,onCommit:D,filePaths:c}),t[20]=c,t[21]=i.text,t[22]=r,t[23]=D,t[24]=O):O=t[24];let k;t[25]===s?k=t[26]:(k=(0,$.jsx)(qn,{visible:s}),t[25]=s,t[26]=k);let A;t[27]!==l||t[28]!==_?(A=l({id:`S9Vnum`,values:{patternText:_}}),t[27]=l,t[28]=_,t[29]=A):A=t[29];let j;t[30]!==o||t[31]!==r?(j=()=>o(r),t[30]=o,t[31]=r,t[32]=j):j=t[32];let M;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(ft,{className:`size-3.5`}),t[33]=M):M=t[33];let N;t[34]!==A||t[35]!==j?(N=(0,$.jsx)(L,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-testid":`settings-okignore-remove`,"aria-label":A,onClick:j,className:`h-7 w-7 shrink-0 text-muted-foreground hover:text-destructive`,children:M}),t[34]=A,t[35]=j,t[36]=N):N=t[36];let P;t[37]!==O||t[38]!==k||t[39]!==N||t[40]!==E?(P=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[E,O,k,N]}),t[37]=O,t[38]=k,t[39]=N,t[40]=E,t[41]=P):P=t[41];let F;return t[42]!==r||t[43]!==p||t[44]!==C||t[45]!==P?(F=(0,$.jsx)(`li`,{ref:p,style:C,className:`flex flex-col gap-0.5 px-2 py-1.5`,"data-testid":`settings-okignore-row`,"data-pattern-index":r,children:P}),t[42]=r,t[43]=p,t[44]=C,t[45]=P,t[46]=F):F=t[46],F}function Hn(e){let t=(0,Z.c)(31),{patternIndex:n,initialText:r,onCommit:i,filePaths:a}=e,{_:o}=y(),[s,c]=(0,Q.useState)(r),l=(0,Q.useRef)(r),u=(0,Q.useRef)(!1),d,f;t[0]===r?(d=t[1],f=t[2]):(d=()=>{u.current||r!==l.current&&(c(r),l.current=r)},f=[r],t[0]=r,t[1]=d,t[2]=f),(0,Q.useEffect)(d,f);let p=Qn(s),m=$n(s,a),h=n+1,g;t[3]!==s||t[4]!==i?(g=()=>{s!==l.current&&(l.current=s,i(s))},t[3]=s,t[4]=i,t[5]=g):g=t[5];let _=g,v,b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>c(e.target.value),b=()=>{u.current=!0},t[6]=v,t[7]=b):(v=t[6],b=t[7]);let x;t[8]===_?x=t[9]:(x=()=>{u.current=!1,_()},t[8]=_,t[9]=x);let S;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{e.key===`Enter`?(e.preventDefault(),e.currentTarget.blur()):e.key===`Escape`&&(e.preventDefault(),c(l.current),e.currentTarget.blur())},t[10]=S):S=t[10];let C;t[11]!==o||t[12]!==h?(C=o({id:`-YV1Uo`,values:{patternNumber:h}}),t[11]=o,t[12]=h,t[13]=C):C=t[13];let w=p.length>0?`border-amber-500/60 focus-visible:ring-amber-500/40`:``,T;t[14]===w?T=t[15]:(T=I(`h-7 flex-1 font-mono text-xs`,w),t[14]=w,t[15]=T);let E;t[16]!==s||t[17]!==T||t[18]!==x||t[19]!==C?(E=(0,$.jsx)(Lt,{value:s,onChange:v,onFocus:b,onBlur:x,onKeyDown:S,"aria-label":C,className:T,"data-testid":`settings-okignore-row-input`}),t[16]=s,t[17]=T,t[18]=x,t[19]=C,t[20]=E):E=t[20];let D;t[21]===p?D=t[22]:(D=(0,$.jsx)(Wn,{warnings:p}),t[21]=p,t[22]=D);let O;t[23]!==E||t[24]!==D?(O=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[E,D]}),t[23]=E,t[24]=D,t[25]=O):O=t[25];let k;t[26]===m?k=t[27]:(k=(0,$.jsx)(er,{count:m}),t[26]=m,t[27]=k);let A;return t[28]!==O||t[29]!==k?(A=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[O,k]}),t[28]=O,t[29]=k,t[30]=A):A=t[30],A}function Un(e){let t=(0,Z.c)(34),{onAdd:n,placeholder:r,rejectionFlashKey:i,filePaths:a}=e,{_:o}=y(),[s,c]=(0,Q.useState)(``),l=Qn(s),u=$n(s,a),d=or(i),f;t[0]!==n||t[1]!==s?(f=()=>{let e=s.trim();e.length!==0&&(n(e),c(``))},t[0]=n,t[1]=s,t[2]=f):f=t[2];let p=f,m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>c(e.target.value),t[3]=m):m=t[3];let h;t[4]===p?h=t[5]:(h=e=>{e.key===`Enter`&&(e.preventDefault(),p())},t[4]=p,t[5]=h);let g;t[6]===o?g=t[7]:(g=o({id:`p9sdCy`}),t[6]=o,t[7]=g);let _=d?`border-destructive ring-2 ring-destructive/30 focus-visible:ring-destructive/50`:l.length>0?`border-amber-500/60 focus-visible:ring-amber-500/40`:``,b;t[8]===_?b=t[9]:(b=I(`h-8 text-sm`,_),t[8]=_,t[9]=b);let x=d?`true`:void 0,S;t[10]!==s||t[11]!==r||t[12]!==h||t[13]!==g||t[14]!==b||t[15]!==x?(S=(0,$.jsx)(Lt,{value:s,onChange:m,onKeyDown:h,placeholder:r,"aria-label":g,className:b,"data-testid":`settings-okignore-add-input`,"data-rejection-flashing":x}),t[10]=s,t[11]=r,t[12]=h,t[13]=g,t[14]=b,t[15]=x,t[16]=S):S=t[16];let C;t[17]===l?C=t[18]:(C=(0,$.jsx)(Wn,{warnings:l}),t[17]=l,t[18]=C);let w;t[19]===s?w=t[20]:(w=s.trim(),t[19]=s,t[20]=w);let T=w.length===0,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(v,{id:`BY-g4_`}),t[21]=E):E=t[21];let D;t[22]!==p||t[23]!==T?(D=(0,$.jsx)(L,{size:`sm`,onClick:p,disabled:T,"data-testid":`settings-okignore-add-button`,children:E}),t[22]=p,t[23]=T,t[24]=D):D=t[24];let O;t[25]!==D||t[26]!==S||t[27]!==C?(O=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[S,C,D]}),t[25]=D,t[26]=S,t[27]=C,t[28]=O):O=t[28];let k;t[29]===u?k=t[30]:(k=(0,$.jsx)(er,{count:u}),t[29]=u,t[30]=k);let A;return t[31]!==O||t[32]!==k?(A=(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,"data-testid":`settings-okignore-add`,children:[O,k]}),t[31]=O,t[32]=k,t[33]=A):A=t[33],A}function Wn(e){let t=(0,Z.c)(31),{warnings:n}=e,{_:r}=y();if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`flex w-4 shrink-0 justify-center`,"data-testid":`settings-okignore-warning-indicator`,"data-warnings":`0`}),t[0]=e):e=t[0],e}let i,a,o,s,c,l,u;t[1]!==r||t[2]!==n?(o=n.map(Kn).join(` `),a=ht,i=pt,u=!0,s=`status`,c=`polite`,l=r({id:`NORKZU`,values:{summary:o}}),t[1]=r,t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u):(i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9]);let d=String(n.length),f;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(dt,{"aria-hidden":`true`,className:`size-3.5`}),t[10]=f):f=t[10];let p;t[11]===o?p=t[12]:(p=(0,$.jsx)(`span`,{className:`sr-only`,children:o}),t[11]=o,t[12]=p);let m;t[13]!==s||t[14]!==c||t[15]!==l||t[16]!==d||t[17]!==p?(m=(0,$.jsxs)(`span`,{role:s,"aria-live":c,"aria-label":l,className:`flex w-4 shrink-0 cursor-help justify-center text-amber-500`,"data-testid":`settings-okignore-warning-indicator`,"data-warnings":d,children:[f,p]}),t[13]=s,t[14]=c,t[15]=l,t[16]=d,t[17]=p,t[18]=m):m=t[18];let h;t[19]!==i||t[20]!==u||t[21]!==m?(h=(0,$.jsx)(i,{asChild:u,children:m}),t[19]=i,t[20]=u,t[21]=m,t[22]=h):h=t[22];let g;t[23]===n?g=t[24]:(g=n.map(Gn),t[23]=n,t[24]=g);let _;t[25]===g?_=t[26]:(_=(0,$.jsx)(mt,{side:`top`,className:`max-w-xs`,children:(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-4`,children:g})}),t[25]=g,t[26]=_);let v;return t[27]!==a||t[28]!==_||t[29]!==h?(v=(0,$.jsxs)(a,{children:[h,_]}),t[27]=a,t[28]=_,t[29]=h,t[30]=v):v=t[30],v}function Gn(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Kn(e){return e.message}function qn(e){let t=(0,Z.c)(4),{visible:n}=e,r;t[0]===n?r=t[1]:(r=n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(G,{"aria-hidden":`true`,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`idD8Ev`})})]}):null,t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`flex w-4 shrink-0 justify-center text-emerald-600`,"data-testid":`settings-okignore-saved-indicator`,children:r}),t[2]=r,t[3]=i),i}function Jn(e){return`okignore-pattern-${e}`}function Yn(e){let t=e.match(/^okignore-pattern-(\d+)$/);if(!t)return-1;let n=Number.parseInt(t[1]??``,10);return Number.isNaN(n)?-1:n}function Xn(e,t){return`${t}::${e}`}function Zn(e){return!D(e)||e.code!==`OKIGNORE_INVALID`?null:{detail:e.detail,lineNumber:e.lineNumber}}function Qn(e){let t=(0,Z.c)(5),n;t[0]===e?n=t[1]:(n=()=>e.length===0?[]:Sn(e),t[0]=e,t[1]=n);let[r,i]=(0,Q.useState)(n),a,o;return t[2]===e?(a=t[3],o=t[4]):(a=()=>{if(e.length===0){i([]);return}let t=setTimeout(()=>{i(Sn(e))},En);return()=>clearTimeout(t)},o=[e],t[2]=e,t[3]=a,t[4]=o),(0,Q.useEffect)(a,o),r}function $n(e,t){let n=(0,Z.c)(9),r;n[0]===e?r=n[1]:(r=e.trim(),n[0]=e,n[1]=r);let i=r,a;n[2]!==t||n[3]!==i?(a=()=>i.length===0?null:bn(i,t),n[2]=t,n[3]=i,n[4]=a):a=n[4];let[o,s]=(0,Q.useState)(a),c,l;return n[5]!==t||n[6]!==i?(c=()=>{if(i.length===0){s(null);return}let e=setTimeout(()=>{s(bn(i,t))},Dn);return()=>clearTimeout(e)},l=[i,t],n[5]=t,n[6]=i,n[7]=c,n[8]=l):(c=n[7],l=n[8]),(0,Q.useEffect)(c,l),o}function er(e){let t=(0,Z.c)(12),{count:n}=e;if(n===null){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`block h-3.5`,"data-testid":`settings-okignore-preview`,"data-preview-state":`hidden`}),t[0]=e):e=t[0],e}let r=n===0,i=String(n),a=r?`text-muted-foreground/70`:`text-muted-foreground`,o;t[1]===a?o=t[2]:(o=I(`block text-xs`,a),t[1]=a,t[2]=o);let s;t[3]===n?s=t[4]:(s=(0,$.jsx)(v,{id:`-3Qbv7`,values:{count:n}}),t[3]=n,t[4]=s);let c;t[5]===r?c=t[6]:(c=r?(0,$.jsx)(`span`,{className:`ml-1 text-muted-foreground/60`,children:(0,$.jsx)(v,{id:`5kWklo`})}):null,t[5]=r,t[6]=c);let l;return t[7]!==i||t[8]!==o||t[9]!==s||t[10]!==c?(l=(0,$.jsxs)(`span`,{role:`status`,"aria-live":`polite`,"data-testid":`settings-okignore-preview`,"data-preview-state":`visible`,"data-preview-count":i,className:o,children:[s,c]}),t[7]=i,t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function tr(e,t,n){let r=[];for(let n of e){let e=t.get(n)?.docExt??`.md`;r.push(n+e)}for(let e of n)r.push(e);return r}function nr(){try{return globalThis.localStorage?.getItem(jn)===`true`}catch{return!1}}function rr(e){try{globalThis.localStorage?.setItem(jn,e?`true`:`false`)}catch(e){console.debug(`[OkignoreSection] localStorage unavailable; advanced toggle will not persist:`,e)}}function ir(){let e=(0,Z.c)(3),[t,n]=(0,Q.useState)(ar),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=e=>{n(e),rr(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function ar(){return nr()}function or(e){let t=(0,Z.c)(3),[n,r]=(0,Q.useState)(!1),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(e===null)return;r(!0);let t=setTimeout(()=>r(!1),kn);return()=>clearTimeout(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a),n}function sr(e){let t=(0,Z.c)(68),{config:n}=e,{state:r,refresh:i}=Ve(``),[a,o]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u=ye(),f;t[0]===u?f=t[1]:(f=function(e,t){ot(s(e,t)),u.close()},t[0]=u,t[1]=f);let p=f,m,h,g,_,y,b,x,S,C;if(t[2]!==n||t[3]!==c||t[4]!==p||t[5]!==i||t[6]!==r){C=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r.status===`ready`?(r.data.folder.templates_available??[]).filter(e=>e.scope===n.scope).sort(lr):[];if(r.status===`error`){let{loadErrorTitle:e}=n,{message:a}=r,o=`settings-${n.testIdPrefix}-section`,s;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>l(!0),t[16]=s):s=t[16];let u;t[17]===n?u=t[18]:(u=(0,$.jsx)(ur,{config:n,onNewClick:s}),t[17]=n,t[18]=u);let d;t[19]!==e||t[20]!==a?(d=(0,$.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,$.jsx)(v,{id:`uH_S-u`,values:{loadErrorTitle:e,message:a}})}),t[19]=e,t[20]=a,t[21]=d):d=t[21];let f;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Set,t[22]=f):f=t[22];let m;t[23]!==p||t[24]!==i?(m=e=>{i(),p(``,e)},t[23]=p,t[24]=i,t[25]=m):m=t[25];let h;t[26]!==c||t[27]!==m?(h=(0,$.jsx)(_e,{folderPath:``,existingNames:f,open:c,onOpenChange:l,onCreated:m}),t[26]=c,t[27]=m,t[28]=h):h=t[28];let g;t[29]!==n.settingsId||t[30]!==o||t[31]!==u||t[32]!==d||t[33]!==h?(g=(0,$.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":n.settingsId,"data-testid":o,children:[u,d,h]}),t[29]=n.settingsId,t[30]=o,t[31]=u,t[32]=d,t[33]=h,t[34]=g):g=t[34],C=g;break bb0}if(r.status===`idle`||r.status===`loading`){let e=`settings-${n.testIdPrefix}-section`,r;t[35]===n?r=t[36]:(r=(0,$.jsx)(ur,{config:n}),t[35]=n,t[36]=r);let i;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`rounded-lg border bg-card p-3 space-y-2`,children:[(0,$.jsx)(Se,{className:`h-12 w-full`}),(0,$.jsx)(Se,{className:`h-12 w-full`})]}),t[37]=i):i=t[37];let a;t[38]!==n.settingsId||t[39]!==e||t[40]!==r?(a=(0,$.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":n.settingsId,"data-testid":e,children:[r,i]}),t[38]=n.settingsId,t[39]=e,t[40]=r,t[41]=a):a=t[41],C=a;break bb0}_=`space-y-3`,y=n.settingsId,b=`settings-${n.testIdPrefix}-section`;let a;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>l(!0),t[42]=a):a=t[42],t[43]===n?x=t[44]:(x=(0,$.jsx)(ur,{config:n,onNewClick:a}),t[43]=n,t[44]=x);let s=e.length===0?(0,$.jsx)(`p`,{className:`px-3 py-4 text-sm text-muted-foreground`,"data-testid":`settings-${n.testIdPrefix}-empty`,children:n.emptyMessage}):(0,$.jsx)(`ul`,{className:`space-y-1 p-2`,"data-testid":`settings-${n.testIdPrefix}-list`,children:e.map(e=>(0,$.jsx)(me,{template:e,onEdit:()=>p(e.source_folder,e.name),onDelete:()=>o(e),badge:(0,$.jsx)(d,{variant:n.badge.variant,className:`text-2xs`,children:n.badge.label})},e.name))});t[45]===s?S=t[46]:(S=(0,$.jsx)(`div`,{className:`rounded-lg border bg-card`,children:s}),t[45]=s,t[46]=S),m=_e,h=``,g=new Set(e.map(cr))}t[2]=n,t[3]=c,t[4]=p,t[5]=i,t[6]=r,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C}else m=t[7],h=t[8],g=t[9],_=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15];if(C!==Symbol.for(`react.early_return_sentinel`))return C;let w;t[47]!==p||t[48]!==i?(w=e=>{i(),p(``,e)},t[47]=p,t[48]=i,t[49]=w):w=t[49];let T;t[50]!==m||t[51]!==c||t[52]!==w||t[53]!==h||t[54]!==g?(T=(0,$.jsx)(m,{folderPath:h,existingNames:g,open:c,onOpenChange:l,onCreated:w}),t[50]=m,t[51]=c,t[52]=w,t[53]=h,t[54]=g,t[55]=T):T=t[55];let E;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||o(null)},t[56]=E):E=t[56];let D;t[57]!==a||t[58]!==i?(D=(0,$.jsx)(Ce,{template:a,onOpenChange:E,onDeleted:i}),t[57]=a,t[58]=i,t[59]=D):D=t[59];let O;return t[60]!==T||t[61]!==D||t[62]!==_||t[63]!==y||t[64]!==b||t[65]!==x||t[66]!==S?(O=(0,$.jsxs)(`section`,{className:_,"aria-labelledby":y,"data-testid":b,children:[x,S,T,D]}),t[60]=T,t[61]=D,t[62]=_,t[63]=y,t[64]=b,t[65]=x,t[66]=S,t[67]=O):O=t[67],O}function cr(e){return e.name}function lr(e,t){return(e.title??e.name).toLowerCase().localeCompare((t.title??t.name).toLowerCase())}function ur(e){let t=(0,Z.c)(14),{config:n,onNewClick:r}=e,i;t[0]!==n.settingsId||t[1]!==n.title?(i=(0,$.jsx)(`h3`,{id:n.settingsId,className:`text-base font-semibold`,children:n.title}),t[0]=n.settingsId,t[1]=n.title,t[2]=i):i=t[2];let a;t[3]===n.description?a=t[4]:(a=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description}),t[3]=n.description,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,$.jsxs)(`div`,{children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7];let s;t[8]!==n.testIdPrefix||t[9]!==r?(s=r?(0,$.jsxs)(L,{variant:`outline`,size:`sm`,className:`font-mono uppercase shrink-0`,onClick:r,"data-testid":`settings-${n.testIdPrefix}-new-button`,children:[(0,$.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(v,{id:`G1Gw0v`})]}):null,t[8]=n.testIdPrefix,t[9]=r,t[10]=s):s=t[10];let c;return t[11]!==o||t[12]!==s?(c=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,s]}),t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function dr(){let e=(0,Z.c)(16),{_:t}=y(),n;e[0]===t?n=e[1]:(n=t({id:`hBMK4W`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(v,{id:`nft48x`,components:{0:(0,$.jsx)(`code`,{className:`font-mono`})}}),e[2]=r):r=e[2];let i;e[3]===t?i=e[4]:(i=t({id:`6Pxqwv`}),e[3]=t,e[4]=i);let a;e[5]===t?a=e[6]:(a=t({id:`BD0XSC`}),e[5]=t,e[6]=a);let o;e[7]===t?o=e[8]:(o=t({id:`ysxgu8`}),e[7]=t,e[8]=o);let s;e[9]===o?s=e[10]:(s={label:o,variant:`gray`},e[9]=o,e[10]=s);let c;return e[11]!==n||e[12]!==i||e[13]!==a||e[14]!==s?(c=(0,$.jsx)(sr,{config:{scope:`local`,title:n,description:r,emptyMessage:i,loadErrorTitle:a,badge:s,settingsId:`settings-project-templates-title`,testIdPrefix:`project-templates`}}),e[11]=n,e[12]=i,e[13]=a,e[14]=s,e[15]=c):c=e[15],c}var fr=[2500,5e3];function pr(){let e=(0,Z.c)(48),{_:t}=y(),{projectLocalConfig:n,projectLocalSynced:r,projectLocalBinding:i}=Xe(),{status:a,refresh:o}=fe(),[s,c]=(0,Q.useState)(!1),l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],e[0]=l):l=e[0];let u=(0,Q.useRef)(l),d,f;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{for(let e of u.current)clearTimeout(e)},f=[],e[1]=d,e[2]=f):(d=e[1],f=e[2]),(0,Q.useEffect)(d,f);let p=n?.search?.semantic?.enabled??!1,m=r&&i!==null,h;e[3]===o?h=e[4]:(h=function(){for(let e of u.current)clearTimeout(e);u.current=fr.map(e=>setTimeout(o,e))},e[3]=o,e[4]=h);let _=h,b;e[5]!==t||e[6]!==i||e[7]!==o||e[8]!==_?(b=function(e){if(i===null)return X.error(t({id:`YW7Q86`})),!1;let n=i.patch({search:{semantic:{enabled:e}}});if(!n.ok){let r=E(n.error);return X.error(t(e?{id:`LYufDw`,values:{detail:r}}:{id:`5mksg0`,values:{detail:r}})),!1}return o(),_(),!0},e[5]=t,e[6]=i,e[7]=o,e[8]=_,e[9]=b):b=e[9];let x=b,S;e[10]===x?S=e[11]:(S=function(e){if(e){c(!0);return}x(!1)},e[10]=x,e[11]=S);let C=S,w;e[12]===x?w=e[13]:(w=function(){x(!0)&&c(!1)},e[12]=x,e[13]=w);let T=w,D=a?.enabled??!1,O=a?.keyPresent??!1,k=a?.ready??!1,A=a?.capable??!1,j=a?.embedded??0,M=a?.total??0,N;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(`h3`,{id:`settings-search-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`3y6XTb`})}),e[14]=N):N=e[14];let P;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[N,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`dUQ7_J`})})]}),e[15]=P):P=e[15];let F;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(`label`,{htmlFor:`settings-search-semantic-toggle`,className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`3y6XTb`})}),e[16]=F):F=e[16];let I;e[17]===p?I=e[18]:(I=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[F,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-search-body`,children:p?(0,$.jsx)(v,{id:`stlgky`}):(0,$.jsx)(v,{id:`kdzzOK`})})]}),e[17]=p,e[18]=I);let L=!m,R;e[19]!==t||e[20]!==p?(R=t(p?{id:`fNr-MX`}:{id:`Aif3E7`}),e[19]=t,e[20]=p,e[21]=R):R=e[21];let z;e[22]!==p||e[23]!==C||e[24]!==L||e[25]!==R?(z=(0,$.jsx)(g,{id:`settings-search-semantic-toggle`,checked:p,disabled:L,onCheckedChange:C,"aria-label":R,"data-testid":`settings-search-semantic-toggle`}),e[22]=p,e[23]=C,e[24]=L,e[25]=R,e[26]=z):z=e[26];let B;e[27]!==I||e[28]!==z?(B=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[I,z]}),e[27]=I,e[28]=z,e[29]=B):B=e[29];let V;e[30]!==A||e[31]!==j||e[32]!==p||e[33]!==O||e[34]!==k||e[35]!==D||e[36]!==a||e[37]!==M?(V=p?(0,$.jsx)(mr,{loaded:a!==null,serverEnabled:D,keyPresent:O,ready:k,capable:A,embedded:j,total:M}):null,e[30]=A,e[31]=j,e[32]=p,e[33]=O,e[34]=k,e[35]=D,e[36]=a,e[37]=M,e[38]=V):V=e[38];let H;e[39]!==B||e[40]!==V?(H=(0,$.jsxs)(`div`,{className:`rounded-md border p-3`,children:[B,V]}),e[39]=B,e[40]=V,e[41]=H):H=e[41];let U;e[42]!==s||e[43]!==T?(U=(0,$.jsx)(hr,{open:s,onOpenChange:c,onConfirm:T}),e[42]=s,e[43]=T,e[44]=U):U=e[44];let W;return e[45]!==H||e[46]!==U?(W=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-search-title`,className:`space-y-3`,"data-testid":`settings-search`,children:[P,H,U]}),e[45]=H,e[46]=U,e[47]=W):W=e[47],W}function mr(e){let t=(0,Z.c)(12),{loaded:n,serverEnabled:r,keyPresent:i,ready:a,capable:o,embedded:s,total:c}=e;if(!n||!r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`text-muted-foreground text-1sm mt-2`,"data-testid":`settings-search-settling`,children:(0,$.jsx)(v,{id:`AdcGcG`})}),t[0]=e):e=t[0],e}if(!i){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{role:`alert`,className:`mt-2 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-1sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`settings-search-needs-key`,children:(0,$.jsx)(v,{id:`dN20LW`,components:{0:(0,$.jsx)(`span`,{className:`font-medium`})}})}),t[1]=e):e=t[1],e}if(a&&!o){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{role:`alert`,className:`mt-2 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-1sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`settings-search-provider-error`,children:(0,$.jsx)(v,{id:`8BsGpU`,components:{0:(0,$.jsx)(`span`,{className:`font-medium`})}})}),t[2]=e):e=t[2],e}if(!a){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{role:`status`,className:`text-muted-foreground text-1sm mt-2`,"data-testid":`settings-search-pending`,children:(0,$.jsx)(v,{id:`VZSBXL`})}),t[3]=e):e=t[3],e}let l;t[4]!==s||t[5]!==c?(l=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`lVWEIL`,values:{embedded:s,total:c}})}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===s?u=t[8]:(u=s===0?(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`ku0yLQ`})}):null,t[7]=s,t[8]=u);let d;return t[9]!==l||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`mt-2 space-y-0.5`,"data-testid":`settings-search-coverage`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function hr(e){let t=(0,Z.c)(14),{open:n,onOpenChange:r,onConfirm:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(bt,{children:(0,$.jsx)(v,{id:`vhAnzJ`})}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(Tt,{children:[a,(0,$.jsx)(yt,{children:(0,$.jsx)(v,{id:`aENGMB`})})]}),t[1]=o):o=t[1];let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`mb-2 font-medium`,children:(0,$.jsx)(v,{id:`7PNNNs`})}),t[2]=s):s=t[2];let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`li`,{children:(0,$.jsx)(v,{id:`UfW9Kr`})}),t[3]=c):c=t[3];let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`li`,{children:(0,$.jsx)(v,{id:`Emz5BG`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-amber-100 px-1 py-0.5 font-mono text-xs dark:bg-amber-900`})}})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(St,{children:(0,$.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,children:[s,(0,$.jsxs)(`ul`,{className:`list-disc space-y-1.5 pl-5`,children:[c,l,(0,$.jsx)(`li`,{children:(0,$.jsx)(v,{id:`o5gfs1`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-amber-100 px-1 py-0.5 font-mono text-xs dark:bg-amber-900`})}})})]})]})}),t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(wt,{asChild:!0,children:(0,$.jsx)(L,{variant:`outline`,children:(0,$.jsx)(v,{id:`dEgA5A`})})}),t[6]=d):d=t[6];let f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(v,{id:`iMkWoF`}),t[7]=f):f=t[7];let p;t[8]===i?p=t[9]:(p=(0,$.jsxs)(xt,{className:`sm:max-w-lg`,"data-testid":`settings-search-confirm`,children:[o,u,(0,$.jsxs)(Ct,{children:[d,(0,$.jsx)(L,{onClick:i,"data-testid":`settings-search-confirm-enable`,children:f})]})]}),t[8]=i,t[9]=p);let m;return t[10]!==r||t[11]!==n||t[12]!==p?(m=(0,$.jsx)(Et,{open:n,onOpenChange:r,children:p}),t[10]=r,t[11]=n,t[12]=p,t[13]=m):m=t[13],m}function gr(e){let t=(0,Z.c)(19),{installStates:n,terminalLaunch:r,disabled:i,onPick:a,onLaunchTerminal:o}=e,{_:s}=y(),[c,l]=(0,Q.useState)(``),u;if(t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==c||t[4]!==o||t[5]!==a||t[6]!==r){let e;t[8]===n?e=t[9]:(e=e=>n[e.id]?.installed===!0,t[8]=n,t[9]=e);let d=q.filter(e),f=q.some(e=>n[e.id]?.installed==null),p=d.length>0,m=r!==null,h=p||m,g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>l(e.target.value),t[10]=g):g=t[10];let _;t[11]===s?_=t[12]:(_=s({id:`Rah7yq`}),t[11]=s,t[12]=_);let y;t[13]===s?y=t[14]:(y=s({id:`ZBt4rI`}),t[13]=s,t[14]=y);let b;t[15]!==c||t[16]!==_||t[17]!==y?(b=(0,$.jsx)(`div`,{className:`px-2 pt-2 pb-1.5`,children:(0,$.jsx)(Lt,{value:c,onChange:g,placeholder:_,"aria-label":y,"data-testid":`open-in-agent-instruction`})}),t[15]=c,t[16]=_,t[17]=y,t[18]=b):b=t[18],u=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[b,h?(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[m?(0,$.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-terminal-label`,children:(0,$.jsx)(v,{id:`ALhMYW`})}),ce.map(e=>{let{displayName:t}=S[e];return(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:i,"data-testid":`open-in-agent-terminal-${e}`,"aria-label":s({id:`QYfQdv`,values:{displayName:t}}),onClick:()=>o(e,c),children:[(0,$.jsx)(J,{id:ie(e),"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:t})]},e)})]}):null,p?(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsx)(Ee,{className:`my-1`}):null,(0,$.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-desktop-label`,children:(0,$.jsx)(v,{id:`BBqGS9`})}),d.map(e=>{let{displayName:t}=e;return(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:i,"data-testid":`open-in-agent-item-${e.id}`,"aria-label":s({id:`WqLq6M`,values:{displayName:t}}),onClick:()=>a(e,c),children:[(0,$.jsx)(J,{id:e.id,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:t})]},e.id)})]})]}):null]}):(0,$.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`open-in-agent-empty`,"aria-live":`polite`,children:f?(0,$.jsx)(v,{id:`EcR0fl`}):(0,$.jsx)(v,{id:`l6OXqI`})})]}),t[0]=s,t[1]=i,t[2]=n,t[3]=c,t[4]=o,t[5]=a,t[6]=r,t[7]=u}else u=t[7];return u}function _r(e){let t=(0,Z.c)(44),{input:n,open:r,onOpenChange:i}=e,{_:a}=y(),{states:o,refresh:s}=oe(),{dispatch:c}=de(),l=ue(),[u,d]=(0,Q.useState)(!1),h=(0,Q.useRef)(!1),g=ae(),_=r??u,b;t[0]===s?b=t[1]:(b=()=>{s()},t[0]=s,t[1]=b);let x=(0,Q.useEffectEvent)(b),S;t[2]!==_||t[3]!==x?(S=()=>{_&&x()},t[2]=_,t[3]=x,t[4]=S):S=t[4];let C;if(t[5]===_?C=t[6]:(C=[_],t[5]=_,t[6]=C),(0,Q.useEffect)(S,C),g)return null;let w=typeof window<`u`&&window.okDesktop!=null,T;t[7]!==i||t[8]!==r?(T=e=>{r===void 0&&d(e),i?.(e)},t[7]=i,t[8]=r,t[9]=T):T=t[9];let E=T,D=n===null,O;t[10]===n?O=t[11]:(O=e=>{if(n===null)return null;let t=e.trim();return t?{...n,instruction:t}:n},t[10]=n,t[11]=O);let k=O,A;t[12]!==c||t[13]!==E||t[14]!==k?(A=(e,t)=>{let n=k(t);n!==null&&(c(e.id,n),E(!1))},t[12]=c,t[13]=E,t[14]=k,t[15]=A):A=t[15];let j=A,M;t[16]!==E||t[17]!==k||t[18]!==l?(M=(e,t)=>{let n=k(t);n===null||l===null||(l.launchInTerminal(n,e),E(!1))},t[16]=E,t[17]=k,t[18]=l,t[19]=M):M=t[19];let N=M,P;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(P=w?()=>{h.current=!0}:void 0,t[20]=P):P=t[20];let F;t[21]===E?F=t[22]:(F=w?()=>{if(h.current){h.current=!1;return}E(!0)}:void 0,t[21]=E,t[22]=F);let I,R;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(ut,{className:`size-3.5`,"aria-hidden":`true`}),R=(0,$.jsx)(v,{id:`O7_W_a`}),t[23]=I,t[24]=R):(I=t[23],R=t[24]);let z;t[25]!==F||t[26]!==D?(z=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsxs)(L,{variant:`ghost`,size:`sm`,disabled:D,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:P,onClick:F,children:[I,R]})}),t[25]=F,t[26]=D,t[27]=z):z=t[27];let B;t[28]===a?B=t[29]:(B=a({id:`O7_W_a`}),t[28]=a,t[29]=B);let V=n===null,H;t[30]!==N||t[31]!==j||t[32]!==o||t[33]!==V||t[34]!==l?(H=(0,$.jsx)(gr,{installStates:o,terminalLaunch:l,disabled:V,onPick:j,onLaunchTerminal:N}),t[30]=N,t[31]=j,t[32]=o,t[33]=V,t[34]=l,t[35]=H):H=t[35];let U;t[36]!==B||t[37]!==H?(U=(0,$.jsx)(p,{align:`end`,className:`p-1`,"aria-label":B,"data-testid":`open-in-agent-menu`,children:H}),t[36]=B,t[37]=H,t[38]=U):U=t[38];let W;return t[39]!==E||t[40]!==_||t[41]!==z||t[42]!==U?(W=(0,$.jsxs)(f,{open:_,onOpenChange:E,children:[z,U]}),t[39]=E,t[40]=_,t[41]=z,t[42]=U,t[43]=W):W=t[43],W}function vr(e){let t=(0,Z.c)(50),{skill:n,onEdit:r,onDelete:i,onInstall:a,onUninstall:o,installing:s}=e,{_:c}=y(),l=ne(),u;t[0]!==n.name||t[1]!==n.scope||t[2]!==l?(u=re({skillName:n.name,scope:n.scope,workspace:l}),t[0]=n.name,t[1]=n.scope,t[2]=l,t[3]=u):u=t[3];let d=u,f=`skill-row-${n.name}`,p;t[4]===n.name?p=t[5]:(p=(0,$.jsx)(`code`,{className:`truncate font-mono font-medium`,children:n.name}),t[4]=n.name,t[5]=p);let m;t[6]===n.installed?m=t[7]:(m=(0,$.jsx)(De,{installed:n.installed,className:`text-2xs`}),t[6]=n.installed,t[7]=m);let h;t[8]!==p||t[9]!==m?(h=(0,$.jsxs)(`span`,{className:`flex w-full items-center gap-2`,children:[p,m]}),t[8]=p,t[9]=m,t[10]=h):h=t[10];let g;t[11]===n.description?g=t[12]:(g=n.description?(0,$.jsx)(`span`,{className:`block w-full truncate text-sm text-muted-foreground`,children:n.description}):(0,$.jsx)(`span`,{className:`block w-full truncate text-sm italic text-muted-foreground`,children:(0,$.jsx)(v,{id:`xnP32l`})}),t[11]=n.description,t[12]=g);let _;t[13]===n.hosts?_=t[14]:(_=n.hosts.length>0?(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1 pt-0.5`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`G_efLf`})}),n.hosts.map(yr)]}):null,t[13]=n.hosts,t[14]=_);let b;t[15]!==r||t[16]!==h||t[17]!==g||t[18]!==_?(b=(0,$.jsxs)(L,{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:[h,g,_]}),t[15]=r,t[16]=h,t[17]=g,t[18]=_,t[19]=b):b=t[19];let x;t[20]===d?x=t[21]:(x=(0,$.jsx)(`span`,{className:`shrink-0 self-center opacity-0 group-hover:opacity-100 focus-within:opacity-100 data-[state=open]:opacity-100`,children:(0,$.jsx)(_r,{input:d})}),t[20]=d,t[21]=x);let S=`skill-install-${n.name}`,C;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),t[22]=C):C=t[22];let w;t[23]===n.installed?w=t[24]:(w=n.installed?(0,$.jsx)(v,{id:`eQkgKV`}):(0,$.jsx)(v,{id:`TKQ7K-`}),t[23]=n.installed,t[24]=w);let T;t[25]!==s||t[26]!==a||t[27]!==S||t[28]!==w?(T=(0,$.jsxs)(L,{type:`button`,variant:`ghost`,size:`sm`,className:`shrink-0 self-center font-mono uppercase opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:a,disabled:s,"data-testid":S,children:[C,w]}),t[25]=s,t[26]=a,t[27]=S,t[28]=w,t[29]=T):T=t[29];let E;t[30]!==c||t[31]!==n.name?(E=c({id:`RlLl3G`,values:{0:n.name}}),t[30]=c,t[31]=n.name,t[32]=E):E=t[32];let D;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(Fe,{className:`size-4`,"aria-hidden":!0}),t[33]=D):D=t[33];let O;t[34]===E?O=t[35]:(O=(0,$.jsx)(Ot,{asChild:!0,children:(0,$.jsx)(L,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 self-center opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,"aria-label":E,children:D})}),t[34]=E,t[35]=O);let k;t[36]!==i||t[37]!==r||t[38]!==o||t[39]!==n?(k=(0,$.jsx)(kt,{align:`end`,className:`min-w-52`,children:(0,$.jsx)(le,{skill:n,onEdit:r,onUninstall:o,onDelete:i})}),t[36]=i,t[37]=r,t[38]=o,t[39]=n,t[40]=k):k=t[40];let A;t[41]!==O||t[42]!==k?(A=(0,$.jsxs)(At,{children:[O,k]}),t[41]=O,t[42]=k,t[43]=A):A=t[43];let j;return t[44]!==T||t[45]!==A||t[46]!==f||t[47]!==b||t[48]!==x?(j=(0,$.jsxs)(`li`,{className:`group flex items-start gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-muted/50`,"data-testid":f,children:[b,x,T,A]}),t[44]=T,t[45]=A,t[46]=f,t[47]=b,t[48]=x,t[49]=j):j=t[49],j}function yr(e){return(0,$.jsx)(d,{variant:`gray`,className:`text-2xs`,children:e},e)}function br(){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(wr).then(t=>{if(e)return;let n=A.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 fetch(`/api/skill-targets`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({targets:e})}).catch(Cr);if(!t?.ok){s(!1);let e=t?await t.json().catch(Sr):null;throw Error(Rt(e)??(t?`HTTP ${t.status}`:`Request failed`))}zt(),a(xr),s(!1)},e[4]=u):u=e[4];let d=u,f;return e[5]!==o||e[6]!==n?(f={state:n,save:d,saving:o},e[5]=o,e[6]=n,e[7]=f):f=e[7],f}function xr(e){return e+1}function Sr(){return null}function Cr(){return null}async function wr(e){if(!e.ok){let t=await e.json().catch(Tr);throw Error(Rt(t)??`HTTP ${e.status}`)}return e.json()}function Tr(){return null}function Er(){let e=(0,Z.c)(21),{_:t}=y(),{state:n,save:r,saving:i}=br(),a=x,o;e[0]!==n.data||e[1]!==n.status?(o=n.status===`ready`?new Set(n.data.targets):new Set,e[0]=n.data,e[1]=n.status,e[2]=o):o=e[2];let s=o,c;e[3]!==t||e[4]!==r||e[5]!==n.data||e[6]!==n.status?(c=async(e,i)=>{if(n.status!==`ready`)return;let a=new Set(n.data.targets);i?a.add(e):a.delete(e);try{await r([...a])}catch(e){let n=e;X.error(t({id:`XqNHcm`,values:{0:n instanceof Error?n.message:String(n)}}))}},e[3]=t,e[4]=r,e[5]=n.data,e[6]=n.status,e[7]=c):c=e[7];let l=c,u;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(`h4`,{id:`settings-skill-targets-heading`,className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`el312q`})}),e[8]=u):u=e[8];let d;e[9]!==n.data||e[10]!==n.status?(d=(0,$.jsxs)(`div`,{children:[u,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:n.status===`ready`&&!n.data.configured?(0,$.jsx)(v,{id:`4XL6N4`}):(0,$.jsx)(v,{id:`Ea1prf`})})]}),e[9]=n.data,e[10]=n.status,e[11]=d):d=e[11];let f;e[12]!==i||e[13]!==s||e[14]!==n.message||e[15]!==n.status||e[16]!==l?(f=n.status===`error`?(0,$.jsx)(`div`,{className:`text-1sm text-destructive`,role:`alert`,"data-testid":`skill-targets-error`,children:(0,$.jsx)(v,{id:`yitgD9`,values:{0:n.message}})}):n.status===`idle`||n.status===`loading`?(0,$.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,$.jsx)(Se,{className:`h-5 w-40`}),(0,$.jsx)(Se,{className:`h-5 w-40`})]}):(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2 pt-1`,disabled:i,children:[(0,$.jsx)(`legend`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`Sq8lf2`})}),a.map(e=>{let t=`skill-target-${e}`;return(0,$.jsxs)(jt,{htmlFor:t,className:`text-sm font-normal`,children:[(0,$.jsx)(Dt,{id:t,checked:s.has(e),onCheckedChange:t=>l(e,t===!0),disabled:i,"data-testid":`skill-target-${e}`}),(0,$.jsx)(`span`,{children:M[e]})]},e)})]}),e[12]=i,e[13]=s,e[14]=n.message,e[15]=n.status,e[16]=l,e[17]=f):f=e[17];let p;return e[18]!==d||e[19]!==f?(p=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-skill-targets-heading`,className:`space-y-2 rounded-lg border bg-card p-3`,"data-testid":`settings-skill-targets`,children:[d,f]}),e[18]=d,e[19]=f,e[20]=p):p=e[20],p}function Dr(){let e=(0,Z.c)(19),{_:t}=y(),n=Je(),r=n.global,i;e[0]===t?i=e[1]:(i=t({id:`2bVHbB`}),e[0]=t,e[1]=i);let a;e[2]===t?a=e[3]:(a=t({id:`MmqnGI`}),e[2]=t,e[3]=a);let o;e[4]!==n.global||e[5]!==i||e[6]!==a?(o={title:r,blurb:i,empty:a},e[4]=n.global,e[5]=i,e[6]=a,e[7]=o):o=e[7];let s=n.project,c;e[8]===t?c=e[9]:(c=t({id:`RXNu_r`}),e[8]=t,e[9]=c);let l;e[10]===t?l=e[11]:(l=t({id:`uFOL2y`}),e[10]=t,e[11]=l);let u;e[12]!==n.project||e[13]!==c||e[14]!==l?(u={title:s,blurb:c,empty:l},e[12]=n.project,e[13]=c,e[14]=l,e[15]=u):u=e[15];let d;return e[16]!==o||e[17]!==u?(d={global:o,project:u},e[16]=o,e[17]=u,e[18]=d):d=e[18],d}function Or(){let e=(0,Z.c)(26),t=Y(),n=Dr(),r=ye(),[i,a]=(0,Q.useState)(!1),o;e[0]===r?o=e[1]:(o=function(e,t){ot(k(e,t)),r.close()},e[0]=r,e[1]=o);let s=o,c=se(),l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`h3`,{id:`settings-skills-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`PCSkw2`})}),e[2]=l):l=e[2];let u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[l,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`wn8EJi`})})]}),e[3]=u):u=e[3];let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>a(!0),e[4]=d):d=e[4];let f,p;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[u,(0,$.jsxs)(L,{variant:`outline`,size:`sm`,className:`shrink-0 font-mono uppercase`,onClick:d,"data-testid":`settings-skills-new-button`,children:[(0,$.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(v,{id:`MdpSC1`})]})]}),p=(0,$.jsx)(Er,{}),e[5]=f,e[6]=p):(f=e[5],p=e[6]);let m;e[7]!==c.install||e[8]!==c.installingName||e[9]!==c.requestDelete||e[10]!==c.uninstall||e[11]!==n||e[12]!==s||e[13]!==t.data||e[14]!==t.message||e[15]!==t.status?(m=t.status===`error`?(0,$.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,"data-testid":`settings-skills-error`,children:(0,$.jsx)(v,{id:`OEu_0l`,values:{0:t.message}})}):t.status===`idle`||t.status===`loading`?(0,$.jsxs)(`div`,{className:`rounded-lg border bg-card p-3 space-y-2`,children:[(0,$.jsx)(Se,{className:`h-12 w-full`}),(0,$.jsx)(Se,{className:`h-12 w-full`})]}):Ye.map(e=>{let r=t.data.filter(t=>t.scope===e).sort(kr);return e===`global`&&r.length===0?null:(0,$.jsx)(Ar,{chrome:n[e],scope:e,skills:r,installingName:c.installingName,onEdit:e=>s(e.scope,e.name),onDelete:c.requestDelete,onInstall:c.install,onUninstall:c.uninstall},e)}),e[7]=c.install,e[8]=c.installingName,e[9]=c.requestDelete,e[10]=c.uninstall,e[11]=n,e[12]=s,e[13]=t.data,e[14]=t.message,e[15]=t.status,e[16]=m):m=e[16];let h;e[17]===s?h=e[18]:(h=e=>{let{scope:t,name:n}=e;return s(t,n)},e[17]=s,e[18]=h);let g;e[19]!==i||e[20]!==h?(g=(0,$.jsx)(Pe,{defaultScope:`project`,open:i,onOpenChange:a,onCreated:h}),e[19]=i,e[20]=h,e[21]=g):g=e[21];let y;return e[22]!==c.dialogs||e[23]!==m||e[24]!==g?(y=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-skills-title`,className:`space-y-4`,"data-testid":`settings-skills-section`,children:[f,p,m,c.dialogs,g]}),e[22]=c.dialogs,e[23]=m,e[24]=g,e[25]=y):y=e[25],y}function kr(e,t){return e.name.toLowerCase().localeCompare(t.name.toLowerCase())}function Ar(e){let t=(0,Z.c)(22),{chrome:n,scope:r,skills:i,installingName:a,onEdit:o,onDelete:s,onInstall:c,onUninstall:l}=e,u=`settings-skills-${r}-heading`,d=`skills-group-${r}`,f;t[0]!==n.title||t[1]!==u?(f=(0,$.jsx)(`h4`,{id:u,className:`text-sm font-medium`,children:n.title}),t[0]=n.title,t[1]=u,t[2]=f):f=t[2];let p;t[3]===n.blurb?p=t[4]:(p=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:n.blurb}),t[3]=n.blurb,t[4]=p);let m;t[5]!==f||t[6]!==p?(m=(0,$.jsxs)(`div`,{children:[f,p]}),t[5]=f,t[6]=p,t[7]=m):m=t[7];let h;t[8]!==n.empty||t[9]!==a||t[10]!==s||t[11]!==o||t[12]!==c||t[13]!==l||t[14]!==r||t[15]!==i?(h=(0,$.jsx)(`div`,{className:`rounded-lg border bg-card`,children:i.length===0?(0,$.jsx)(`p`,{className:`px-3 py-4 text-sm text-muted-foreground`,"data-testid":`skills-group-${r}-empty`,children:n.empty}):(0,$.jsx)(`ul`,{className:`space-y-1 p-2`,"data-testid":`skills-group-${r}-list`,children:i.map(e=>(0,$.jsx)(vr,{skill:e,installing:a===e.name,onEdit:()=>o(e),onDelete:()=>s(e),onInstall:()=>c(e),onUninstall:()=>l(e)},e.name))})}),t[8]=n.empty,t[9]=a,t[10]=s,t[11]=o,t[12]=c,t[13]=l,t[14]=r,t[15]=i,t[16]=h):h=t[16];let g;return t[17]!==u||t[18]!==d||t[19]!==m||t[20]!==h?(g=(0,$.jsxs)(`section`,{"aria-labelledby":u,className:`space-y-2`,"data-testid":d,children:[m,h]}),t[17]=u,t[18]=d,t[19]=m,t[20]=h,t[21]=g):g=t[21],g}function jr(e,t){if(e.length===0)throw Error(`buildPatch: path must be non-empty`);let[n,...r]=e;return r.length===0?{[String(n)]:t}:{[String(n)]:jr(r,t)}}function Mr(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(e?.type===`default`){let t=e.defaultValue;return typeof t==`function`?t():t}let n=t?._zod?.def?.innerType;if(n===void 0)return;t=n}}function Nr(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`default`||e.type===`optional`||e.type===`nullable`){t=e.innerType;continue}return e.type}}function Pr(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`enum`)return e.entries?Object.values(e.entries):void 0;if(e.innerType!==void 0){t=e.innerType;continue}return}}function Fr(){let e=(0,Z.c)(39),{_:t}=y(),{enabled:n,synced:r}=Ue(),i=Ke(),a=n!==!1,o;e[0]!==t||e[1]!==i?(o=function(e){if(i===null){X.error(t({id:`V_6bJ4`}));return}let n=i(e);n.ok||X.error(t(e?{id:`jKd3AP`,values:{0:n.error}}:{id:`pajIrl`,values:{0:n.error}}))},e[0]=t,e[1]=i,e[2]=o):o=e[2];let s=o,c;e[3]===t?c=e[4]:(c=t({id:`ALhMYW`}),e[3]=t,e[4]=c);let l;e[5]===c?l=e[6]:(l=(0,$.jsx)(`h3`,{id:`settings-terminal-title`,className:`text-base font-semibold`,children:c}),e[5]=c,e[6]=l);let u;e[7]===t?u=e[8]:(u=t({id:`FCAcjR`}),e[7]=t,e[8]=u);let d;e[9]===u?d=e[10]:(d=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:u}),e[9]=u,e[10]=d);let f;e[11]!==l||e[12]!==d?(f=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[l,d]}),e[11]=l,e[12]=d,e[13]=f):f=e[13];let p;e[14]===t?p=e[15]:(p=t({id:`E4XYYH`}),e[14]=t,e[15]=p);let m;e[16]===p?m=e[17]:(m=(0,$.jsx)(`label`,{htmlFor:`settings-terminal-toggle`,className:`text-sm font-medium`,children:p}),e[16]=p,e[17]=m);let h;e[18]!==t||e[19]!==a?(h=t(a?{id:`AQGtjK`}:{id:`R65q-K`}),e[18]=t,e[19]=a,e[20]=h):h=e[20];let _;e[21]===h?_=e[22]:(_=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-body`,children:h}),e[21]=h,e[22]=_);let v;e[23]!==m||e[24]!==_?(v=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[m,_]}),e[23]=m,e[24]=_,e[25]=v):v=e[25];let b=!r||i===null,x;e[26]===t?x=e[27]:(x=t({id:`E4XYYH`}),e[26]=t,e[27]=x);let S;e[28]!==s||e[29]!==a||e[30]!==b||e[31]!==x?(S=(0,$.jsx)(g,{id:`settings-terminal-toggle`,checked:a,onCheckedChange:s,disabled:b,"aria-label":x,"data-testid":`settings-terminal-toggle`}),e[28]=s,e[29]=a,e[30]=b,e[31]=x,e[32]=S):S=e[32];let C;e[33]!==v||e[34]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[v,S]}),e[33]=v,e[34]=S,e[35]=C):C=e[35];let w;return e[36]!==C||e[37]!==f?(w=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-terminal-title`,className:`space-y-3`,children:[f,C]}),e[36]=C,e[37]=f,e[38]=w):w=e[38],w}function Ir(e){let t=(0,Z.c)(14),n;t[0]===e?n=t[1]:(n=e.current(),t[0]=e,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i={defaultValues:r,mode:`onBlur`},t[2]=r,t[3]=i);let a=pe(i),o,s;t[4]!==e||t[5]!==a?(o=()=>e.subscribe(e=>{Lr(a,e)}),s=[e,a],t[4]=e,t[5]=a,t[6]=o,t[7]=s):(o=t[6],s=t[7]),(0,Q.useEffect)(o,s);let c;t[8]!==e||t[9]!==a?(c=t=>Rr(a,e,t),t[8]=e,t[9]=a,t[10]=c):c=t[10];let l=c,u;return t[11]!==l||t[12]!==a?(u={form:a,commitField:l},t[11]=l,t[12]=a,t[13]=u):u=t[13],u}function Lr(e,t){e.reset(t,{keepDirtyValues:!0,keepDirty:!0,keepTouched:!0})}function Rr(e,t,n){let r=e.getValues(n),i=jr(Vr(n),r),a=t.patch(i);if(a.ok)return e.clearErrors(n),e.resetField(n,{defaultValue:r,keepError:!1}),!0;if(D(a.error)&&a.error.code===`SCHEMA_INVALID`&&a.error.issues.length>0){e.clearErrors(n);for(let t of a.error.issues){let r=t.path.length>0?t.path.map(String).join(`.`):n;e.setError(r,{type:`config-binding`,message:t.message})}}else e.setError(n,{type:`config-binding`,message:zr(a.error,n)});return!1}function zr(e,t){if(D(e)&&e.code===`SCHEMA_INVALID`){let n=e.issues.find(e=>Br(e,t));if(n)return n.message}return E(e)}function Br(e,t){return e.path.map(String).join(`.`)===t}function Vr(e){return e.split(`.`)}var Hr=[{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`}}],Ur=`data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground data-[state=on]:hover:bg-primary/90`;function Wr(e){let t=(0,Z.c)(18),{activeId:n,userBinding:r,okignoreBinding:i,okignoreSynced:a}=e,{_:o}=y();if(n===`preferences`){let e;t[0]!==o||t[1]!==r?(e=r?(0,$.jsx)(Xr,{title:o({id:`Q6hhn8`}),description:o({id:`Y_kL7X`}),scope:`user`,binding:r,fields:Hr}):(0,$.jsx)(Kr,{}),t[0]=o,t[1]=r,t[2]=e):e=t[2];let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(ii,{}),t[3]=n):n=t[3];let i;return t[4]===e?i=t[5]:(i=(0,$.jsxs)(`div`,{className:`space-y-8`,children:[e,n]}),t[4]=e,t[5]=i),i}if(n===`hotkeys`){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Jr,{}),t[6]=e):e=t[6],e}if(n===`account`){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`div`,{className:`space-y-8`,children:[(0,$.jsx)(ln,{}),(0,$.jsx)(gn,{})]}),t[7]=e):e=t[7],e}if(n===`sync`){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(oi,{}),t[8]=e):e=t[8],e}if(n===`search`){let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(pr,{}),t[9]=e):e=t[9],e}if(n===`terminal`){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Fr,{}),t[10]=e):e=t[10],e}if(n===`project-templates`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(dr,{}),t[11]=e):e=t[11],e}if(n===`skills`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Or,{}),t[12]=e):e=t[12],e}if(n===`sharing`){let e;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(qt,{}),t[13]=e):e=t[13],e}if(n===`okignore`){let e;return t[14]!==i||t[15]!==a?(e=(0,$.jsx)(Mn,{binding:i,synced:a}),t[14]=i,t[15]=a,t[16]=e):e=t[16],e}if(n===`claude-desktop`){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(pi,{}),t[17]=e):e=t[17],e}return null}function Gr(e){if(!D(e)||e.code!==`SCHEMA_INVALID`)return null;let t=e.issues[0];return!t||t.path.length===0?null:t.path.map(String).join(`.`)}function Kr(){let e=(0,Z.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Se,{className:`h-5 w-32`}),n=(0,$.jsx)(Se,{className:`h-4 w-64`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`space-y-3`,children:[t,n,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(Se,{className:`h-9 w-full`}),(0,$.jsx)(Se,{className:`h-9 w-full`})]})]}),e[2]=r):r=e[2],r}function qr({binding:e}){return Bt(e).split(` / `).map((e,t)=>t===0?(0,$.jsx)(c,{"aria-label":Ut(e),children:e},`kbd-${e}`):(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`qEue6Q`})}),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` / `}),(0,$.jsx)(c,{"aria-label":Ut(e),children:e})]},`or-${e}`))}function Jr(){let e=(0,Z.c)(6),{_:t}=y(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`h3`,{id:`settings-hotkeys-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`4KmEoC`})}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[n,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`RaPMZv`})})]}),e[1]=r):r=e[1];let i;e[2]===t?i=e[3]:(i=Ht.map(e=>{let n=Wt.filter(t=>t.category===e);return n.length===0?null:(0,$.jsxs)(`section`,{"aria-labelledby":`settings-hotkeys-${e}`,children:[(0,$.jsx)(`h4`,{id:`settings-hotkeys-${e}`,className:`mb-2 font-mono text-muted-foreground text-xs uppercase tracking-wide`,children:t(Vt[e])}),(0,$.jsx)(`ul`,{"aria-labelledby":`settings-hotkeys-${e}`,className:`m-0 list-none overflow-hidden rounded-md border p-0`,children:n.map(e=>{let n=`settings-hotkey-${e.id}-title`,r=`settings-hotkey-${e.id}-description`,i=e.bindings.reduce(Yr,0)>4;return(0,$.jsxs)(`li`,{"aria-describedby":r,"aria-labelledby":n,className:I(`grid gap-2 border-border border-b px-3 py-3 last:border-b-0`,i?`sm:grid-cols-1`:`sm:grid-cols-[minmax(0,1fr)_minmax(0,auto)]`),"data-testid":`settings-hotkey-${e.id}`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`font-medium text-sm`,id:n,children:t(e.title)}),(0,$.jsxs)(d,{variant:`gray`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`iXTp5j`})}),t(e.scope)]})]}),(0,$.jsx)(`p`,{className:`text-muted-foreground text-sm`,id:r,children:t(e.description)})]}),(0,$.jsx)(`div`,{className:I(`flex min-w-0 max-w-full self-start content-start flex-wrap items-start gap-1.5`,i?`sm:justify-start`:`sm:max-w-[38rem] sm:justify-end`),children:e.bindings.map(t=>(0,$.jsx)(qr,{binding:t},`${e.id}-${t.mac}-${t.windowsLinux}`))})]},e.id)})})]},e)}),e[2]=t,e[3]=i);let a;return e[4]===i?a=e[5]:(a=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-hotkeys-title`,className:`space-y-5`,"data-testid":`settings-hotkeys`,children:[r,(0,$.jsx)(`div`,{className:`space-y-6`,"data-testid":`settings-hotkeys-list`,children:i})]}),e[4]=i,e[5]=a),a}function Yr(e,t){return e+Bt(t).split(` / `).length}function Xr(e){let t=(0,Z.c)(14),{title:n,description:r,scope:i,binding:a,fields:o}=e,{form:s,commitField:c}=Ir(a),[l,u]=(0,Q.useState)(null),d=(0,Q.useRef)(null),f,p;t[0]!==s||t[1]!==i?(f=()=>{let e=i===`project`?j:O,t=Me(t=>{if(t.docName!==e)return;X.error(E(t.error),{duration:8e3});let n=Gr(t.error);n&&(s.setError(n,{type:`config-validation-rejected`,message:zr(t.error,n)}),s.setFocus(n),u(n),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{u(null),s.clearErrors(n)},600))});return()=>{t(),d.current&&clearTimeout(d.current)}},p=[i,s],t[0]=s,t[1]=i,t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m;t[4]!==c||t[5]!==r||t[6]!==o||t[7]!==l||t[8]!==i||t[9]!==n?(m=(0,$.jsx)(Zr,{title:n,description:r,scope:i,fields:o,commitField:c,flashedPath:l}),t[4]=c,t[5]=r,t[6]=o,t[7]=l,t[8]=i,t[9]=n,t[10]=m):m=t[10];let h;return t[11]!==s||t[12]!==m?(h=(0,$.jsx)(Qt,{...s,children:m}),t[11]=s,t[12]=m,t[13]=h):h=t[13],h}function Zr(e){let t=(0,Z.c)(23),{title:n,description:r,scope:i,fields:a,commitField:o,flashedPath:s}=e,c=`settings-section-${i}-title`,l;t[0]!==n||t[1]!==c?(l=(0,$.jsx)(`h3`,{id:c,className:`text-base font-semibold`,children:n}),t[0]=n,t[1]=c,t[2]=l):l=t[2];let u;t[3]===r?u=t[4]:(u=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}),t[3]=r,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[l,u]}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;if(t[8]!==o||t[9]!==a||t[10]!==s||t[11]!==i){let e;t[13]!==o||t[14]!==s||t[15]!==i?(e=e=>(0,$.jsx)(si,{field:e,scope:i,commitField:o,isFlashed:s===e.path.join(`.`)},e.path.join(`.`)),t[13]=o,t[14]=s,t[15]=i,t[16]=e):e=t[16],f=a.map(e),t[8]=o,t[9]=a,t[10]=s,t[11]=i,t[12]=f}else f=t[12];let p;t[17]===f?p=t[18]:(p=(0,$.jsx)(`div`,{className:`space-y-10`,children:f}),t[17]=f,t[18]=p);let m;return t[19]!==d||t[20]!==p||t[21]!==c?(m=(0,$.jsxs)(`section`,{"aria-labelledby":c,className:`space-y-3`,children:[d,p]}),t[19]=d,t[20]=p,t[21]=c,t[22]=m):m=t[22],m}var Qr=`content.attachmentFolderPath`,$r=`attachments`;function ei(e){let t=C(e);return t===`./`?`same-folder`:t===`/`?`content-root`:t.startsWith(`./`)?`current-folder-subfolder`:`content-root-folder`}function ti(e){let t=C(e);return t===`./`||t===`/`?$r:t.startsWith(`./`)?t.slice(2)||$r:t}function ni(e){return e.trim().replace(/^(?:\.\/)+/,``).replace(/\/{2,}/g,`/`).replace(/\/+$/g,``)}function ri(e,t){let n=ni(t)||$r;return e===`same-folder`?`./`:e===`content-root`?`/`:e===`current-folder-subfolder`?`./${n}`:n}function ii(){let e=(0,Z.c)(4),{projectBinding:t,projectConfig:n,projectSynced:r}=Xe();if(!t||!r||!n){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Kr,{}),e[0]=t):t=e[0],t}let i=n.content.attachmentFolderPath??`./`,a;return e[1]!==i||e[2]!==t?(a=(0,$.jsx)(ai,{binding:t,value:i},i),e[1]=i,e[2]=t,e[3]=a):a=e[3],a}function ai(e){let t=(0,Z.c)(50),{binding:n,value:r}=e,{_:i}=y(),s;t[0]===r?s=t[1]:(s=()=>ei(r),t[0]=r,t[1]=s);let[c,d]=(0,Q.useState)(s),f;t[2]===r?f=t[3]:(f=()=>ti(r),t[2]=r,t[3]=f);let[p,m]=(0,Q.useState)(f),[g,_]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),w=(0,Q.useRef)(null),T=(0,Q.useRef)(null),D,O;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{w.current&&clearTimeout(w.current),T.current&&clearTimeout(T.current)},O=[],t[4]=D,t[5]=O):(D=t[4],O=t[5]),(0,Q.useEffect)(D,O);let k,A;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>Me(e=>{if(e.docName!==`__config__/project`||Gr(e.error)!==Qr)return;let t=zr(e.error,Qr);X.error(E(e.error),{duration:8e3}),_(t),C(!0),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{C(!1),_(null)},600)}),A=[],t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,Q.useEffect)(k,A);let j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{x(!0),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>x(!1),1200)},t[8]=j):j=t[8];let M=j,N;t[9]!==i||t[10]!==n?(N=e=>{let t=n.patch({content:{attachmentFolderPath:e}});if(t.ok){_(null),M();return}let r=zr(t.error,Qr);_(r),X.error(i({id:`eQxm13`,values:{detail:r}}))},t[9]=i,t[10]=n,t[11]=N):N=t[11];let P=N,F;t[12]!==P||t[13]!==p?(F=e=>{if(e!==`same-folder`&&e!==`content-root`&&e!==`current-folder-subfolder`&&e!==`content-root-folder`)return;let t=e,n=t===`current-folder-subfolder`||t===`content-root-folder`?p||$r:p;d(t),m(n),P(ri(t,n))},t[12]=P,t[13]=p,t[14]=F):F=t[14];let L=F,R;t[15]!==P||t[16]!==p||t[17]!==c?(R=()=>{let e=ri(c,p);m(ti(e)),P(e)},t[15]=P,t[16]=p,t[17]=c,t[18]=R):R=t[18];let z=R,B=c===`current-folder-subfolder`||c===`content-root-folder`,V;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(`h3`,{id:`settings-attachments-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`w_Sphq`})}),t[19]=V):V=t[19];let H;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[V,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`Hnl9nT`})})]}),t[20]=H):H=t[20];let U=S&&`animate-settings-flash`,W;t[21]===U?W=t[22]:(W=I(`rounded-md border p-3`,U),t[21]=U,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(`div`,{className:`text-sm font-medium`,id:`settings-attachments-location-label`,children:(0,$.jsx)(v,{id:`AsqRE_`})}),t[23]=G):G=t[23];let ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[G,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`vppAju`})})]}),t[24]=ee):ee=t[24];let te;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(u,{"aria-labelledby":`settings-attachments-location-label`,"data-testid":`settings-attachments-mode`,size:`sm`,children:(0,$.jsx)(o,{})}),t[25]=te):te=t[25];let K;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(h,{value:`same-folder`,children:(0,$.jsx)(v,{id:`Q7W-mC`})}),t[26]=K):K=t[26];let ne;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(h,{value:`content-root`,children:(0,$.jsx)(v,{id:`yWSvcf`})}),t[27]=ne):ne=t[27];let q;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(h,{value:`current-folder-subfolder`,children:(0,$.jsx)(v,{id:`0YUS3Q`})}),t[28]=q):q=t[28];let re;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsxs)(a,{children:[K,ne,q,(0,$.jsx)(h,{value:`content-root-folder`,children:(0,$.jsx)(v,{id:`qAx7xG`})})]}),t[29]=re):re=t[29];let ie;t[30]!==c||t[31]!==L?(ie=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(16rem,18rem)] sm:items-start`,children:[ee,(0,$.jsxs)(l,{value:c,onValueChange:L,children:[te,re]})]}),t[30]=c,t[31]=L,t[32]=ie):ie=t[32];let J;t[33]!==i||t[34]!==z||t[35]!==p||t[36]!==B?(J=B?(0,$.jsxs)(`div`,{className:`mt-3 max-w-sm space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:`settings-attachments-folder-input`,children:(0,$.jsx)(v,{id:`kNqMMd`})}),(0,$.jsx)(Lt,{id:`settings-attachments-folder-input`,value:p,placeholder:i({id:`OeAl1e`}),onChange:e=>m(e.target.value),onBlur:z,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),z())},className:`h-8 text-sm`,"data-testid":`settings-attachments-folder`})]}):null,t[33]=i,t[34]=z,t[35]=p,t[36]=B,t[37]=J):J=t[37];let Y;t[38]===g?Y=t[39]:(Y=g?(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,"data-field-error":Qr,role:`alert`,children:g}):null,t[38]=g,t[39]=Y);let ae;t[40]===b?ae=t[41]:(ae=(0,$.jsx)(fi,{visible:b}),t[40]=b,t[41]=ae);let oe;t[42]!==Y||t[43]!==ae?(oe=(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 items-center gap-2`,children:[Y,ae]}),t[42]=Y,t[43]=ae,t[44]=oe):oe=t[44];let se;return t[45]!==W||t[46]!==ie||t[47]!==J||t[48]!==oe?(se=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-attachments-title`,className:`space-y-3`,"data-testid":`settings-attachments`,children:[H,(0,$.jsxs)(`div`,{className:W,"data-field":Qr,"data-scope":`project`,children:[ie,J,oe]})]}),t[45]=W,t[46]=ie,t[47]=J,t[48]=oe,t[49]=se):se=t[49],se}function oi(){let e=(0,Z.c)(75),{_:t}=y(),n=B(),{projectConfig:r,projectLocalConfig:i,projectLocalSynced:a,projectSynced:o}=Xe(),s=z(),c=V(),{confirmOpen:l,setConfirmOpen:u,onToggleRequest:d,onConfirm:f}=H(s),[p,m]=(0,Q.useState)(!1),[h,_]=(0,Q.useState)(!1);if(n&&!n.hasRemote&&n.state===`dormant`){let t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`h3`,{id:`settings-sync-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`Nu4DdT`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[t,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`AiNMQ7`})})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`3_6U6f`})}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`i92eAT`})})]}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>m(!0),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[i,(0,$.jsx)(L,{onClick:a,"data-testid":`settings-sync-setup`,children:(0,$.jsx)(v,{id:`zkz0Fg`})})]}),e[5]=o):o=e[5];let s;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(_t,{asChild:!0,children:(0,$.jsxs)(L,{variant:`ghost`,size:`sm`,className:`group gap-1 px-1.5 text-muted-foreground`,children:[(0,$.jsx)(ee,{className:`size-3.5 transition-transform group-data-[state=open]:rotate-90`,"aria-hidden":!0}),(0,$.jsx)(v,{id:`6caB2T`})]})}),e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsxs)(vt,{children:[s,(0,$.jsx)(gt,{className:`px-1.5 pt-2 text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`44DSl0`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]}),e[7]=c):c=e[7];let l;return e[8]===p?l=e[9]:(l=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-sync-title`,className:`space-y-4`,"data-testid":`settings-sync-empty`,children:[n,o,c,(0,$.jsx)(We,{open:p,onOpenChange:m})]}),e[8]=p,e[9]=l),l}let b=i?.autoSync?.enabled??!1,x=n?.pushPermission?.checkStatus,S;e[10]!==a||e[11]!==x?(S=be(a,x),e[10]=a,e[11]=x,e[12]=S):S=e[12];let C=S,w=n?.pushPermission?.checkStatus===`denied`||n?.pausedReason===`no-push-permission`,T;e[13]!==w||e[14]!==n?(T=w||!n?.pausedReason?null:Ge(n.pausedReason),e[13]=w,e[14]=n,e[15]=T):T=e[15];let E=T,D=r?.autoSync?.default??null,O=D===!0?`on`:D===!1?`off`:`ask`,k;e[16]!==t||e[17]!==c?(k=function(e){if(e!==`ask`&&e!==`on`&&e!==`off`)return;if(c===null){X.error(t({id:`fiMNLl`}));return}let n=c(e===`on`?!0:e===`off`?!1:null);if(!n.ok){let e=n.error;X.error(t({id:`oAFVKX`,values:{detail:e}}))}},e[16]=t,e[17]=c,e[18]=k):k=e[18];let A=k,j;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(`h3`,{id:`settings-sync-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`Nu4DdT`})}),e[19]=j):j=e[19];let M;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[j,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`T67A0Y`})})]}),e[20]=M):M=e[20];let N;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(`label`,{htmlFor:`settings-sync-toggle`,className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`Nx7BWE`})}),e[21]=N):N=e[21];let P;e[22]!==b||e[23]!==w?(P=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-sync-body`,children:w?(0,$.jsx)(v,{id:`l8G3S9`}):b?(0,$.jsx)(v,{id:`-gdcIo`}):(0,$.jsx)(v,{id:`qUB_o_`})}),e[22]=b,e[23]=w,e[24]=P):P=e[24];let F;e[25]!==t||e[26]!==n?(F=n?.remote?(0,$.jsxs)(`p`,{className:`text-muted-foreground text-1sm truncate`,"data-testid":`settings-sync-remote`,children:[(0,$.jsx)(v,{id:`Q8A-U_`}),` `,n.remote.webUrl?(0,$.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-foreground hover:text-primary hover:underline inline-flex items-center gap-0.5`,"aria-label":t({id:`1nke1r`,values:{0:n.remote.label}}),"data-testid":`settings-sync-remote-link`,children:[(0,$.jsx)(`span`,{children:n.remote.label}),(0,$.jsx)(W,{className:`inline size-3.5`,"aria-hidden":!0})]}):(0,$.jsx)(`span`,{className:`font-medium text-foreground`,"data-testid":`settings-sync-remote-label`,children:n.remote.label})]}):null,e[25]=t,e[26]=n,e[27]=F):F=e[27];let I;e[28]!==P||e[29]!==F?(I=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[N,P,F]}),e[28]=P,e[29]=F,e[30]=I):I=e[30];let R;e[31]!==t||e[32]!==b||e[33]!==n?.pushPermission?.checkStatus?(R=n?.pushPermission?.checkStatus===`denied`?t({id:`FnMkli`}):t(b?{id:`OmHTGj`}:{id:`MKOVhz`}),e[31]=t,e[32]=b,e[33]=n?.pushPermission?.checkStatus,e[34]=R):R=e[34];let G;e[35]!==C||e[36]!==b||e[37]!==d||e[38]!==R?(G=(0,$.jsx)(g,{id:`settings-sync-toggle`,checked:b,disabled:C,onCheckedChange:d,"aria-label":R,"data-testid":`settings-sync-toggle`}),e[35]=C,e[36]=b,e[37]=d,e[38]=R,e[39]=G):G=e[39];let te;e[40]!==G||e[41]!==I?(te=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[I,G]}),e[40]=G,e[41]=I,e[42]=te):te=e[42];let K;e[43]===E?K=e[44]:(K=E!==null&&(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground mt-2`,"data-testid":`settings-sync-reason`,children:E}),e[43]=E,e[44]=K);let ne;e[45]===n?.pushPermission?ne=e[46]:(ne=he(n?.pushPermission)&&(0,$.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-signin-again`,children:[(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,$.jsx)(v,{id:`C_cPoW`})}),(0,$.jsx)(L,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>_(!0),children:(0,$.jsx)(v,{id:`5lWFkC`})})]}),e[45]=n?.pushPermission,e[46]=ne);let q;e[47]!==te||e[48]!==K||e[49]!==ne?(q=(0,$.jsxs)(`div`,{className:`rounded-md border p-3`,children:[te,K,ne]}),e[47]=te,e[48]=K,e[49]=ne,e[50]=q):q=e[50];let re;e[51]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`j_Z6g7`})}),e[51]=re):re=e[51];let ie;e[52]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[re,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`W3Xlpc`})})]}),e[52]=ie):ie=e[52];let J=!o,Y;e[53]===t?Y=e[54]:(Y=t({id:`dvGKu2`}),e[53]=t,e[54]=Y);let ae;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(Ft,{value:`ask`,className:Ur,"data-testid":`settings-sync-default-ask`,children:(0,$.jsx)(v,{id:`EdQY6l`})}),e[55]=ae):ae=e[55];let oe;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(Ft,{value:`on`,className:Ur,"data-testid":`settings-sync-default-on`,children:(0,$.jsx)(v,{id:`Z5HWHd`})}),e[56]=oe):oe=e[56];let se;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(Ft,{value:`off`,className:Ur,"data-testid":`settings-sync-default-off`,children:(0,$.jsx)(v,{id:`az8lvo`})}),e[57]=se):se=e[57];let ce;e[58]!==O||e[59]!==A||e[60]!==J||e[61]!==Y?(ce=(0,$.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2`,"data-testid":`settings-sync-default`,children:[ie,(0,$.jsxs)(It,{type:`single`,variant:`outline`,spacing:2,value:O,onValueChange:A,disabled:J,"aria-label":Y,"data-testid":`settings-sync-default-toggle`,children:[ae,oe,se]})]}),e[58]=O,e[59]=A,e[60]=J,e[61]=Y,e[62]=ce):ce=e[62];let le;e[63]!==l||e[64]!==f||e[65]!==u?(le=(0,$.jsx)(U,{open:l,onOpenChange:u,onConfirm:f}),e[63]=l,e[64]=f,e[65]=u,e[66]=le):le=e[66];let ue;e[67]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>_(!1),e[67]=ue):ue=e[67];let de;e[68]===h?de=e[69]:(de=(0,$.jsx)(we,{open:h,onOpenChange:_,onSuccess:ue}),e[68]=h,e[69]=de);let fe;return e[70]!==q||e[71]!==ce||e[72]!==le||e[73]!==de?(fe=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-sync-title`,className:`space-y-3`,children:[M,q,ce,le,de]}),e[70]=q,e[71]=ce,e[72]=le,e[73]=de,e[74]=fe):fe=e[74],fe}function si({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let{_:i}=y(),a=Ne(),o=w(P,e.path),s=o?Nr(o):void 0,c=o?Mr(o):void 0,l=o?Pr(o):void 0,u=o?T(o):void 0,d=u?.scope===`project`&&t!==`project`||u?.scope===`user`&&t!==`user`,f=e.path.join(`.`),p=i(e.label),[m,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]);let _=()=>{h(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(!1),1200)},b=()=>{let e=n(f);return e&&_(),e},x=()=>a.getFieldState(f).isDirty?b():!0,S=()=>{let e=c===void 0?null:c;a.setValue(f,e,{shouldDirty:!1}),b()},C=I(`relative`,r&&`animate-settings-flash`);return(0,$.jsx)(en,{control:a.control,name:f,render:({field:n})=>{let r=!d&&(c!==void 0||n.value!==void 0);return(0,$.jsxs)(rn,{className:C,"data-field":e.path.join(`.`),"data-scope":t,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(an,{className:`text-sm font-medium`,children:p}),r?(0,$.jsxs)(ht,{children:[(0,$.jsx)(pt,{asChild:!0,children:(0,$.jsx)(L,{variant:`ghost`,size:`icon`,className:`h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100`,onClick:S,"aria-label":i({id:`lhjq3G`,values:{labelText:p}}),children:(0,$.jsx)(Gt,{className:`size-3.5`})})}),(0,$.jsx)(mt,{children:(0,$.jsx)(v,{id:`L-rMC9`})})]}):null]}),e.description?(0,$.jsx)(sn,{className:`text-muted-foreground text-1sm`,children:i(e.description)}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(on,{children:(0,$.jsx)(ci,{field:e,ctl:n,typeTag:s,enumOptions:l,onCommit:x})}),(0,$.jsx)(fi,{visible:m})]}),(0,$.jsx)(cn,{"data-field-error":e.path.join(`.`)})]})}})}function ci({field:e,ctl:t,typeTag:n,enumOptions:r,onCommit:i,...a}){"use no memo";let{_:o}=y(),{setTheme:s}=b();if(n===`boolean`)return(0,$.jsx)(g,{...a,checked:!!t.value,ref:t.ref,onCheckedChange:e=>{t.onChange(e),i()},onBlur:t.onBlur});if(n===`enum`&&r&&r.length>0&&(e.control===`enum-toggle`||r.length<=4)){let{id:n,...c}=a,l=e.path[0]===`appearance`&&e.path[1]===`theme`;return(0,$.jsx)(It,{...c,type:`single`,value:typeof t.value==`string`?t.value:``,ref:t.ref,onValueChange:e=>{e&&(l&&s(e),t.onChange(e),i())},onBlur:t.onBlur,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,"aria-label":o(e.label),children:r.map((e,t)=>(0,$.jsx)(Ft,{value:e,id:t===0?n:void 0,className:`text-1sm capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(ui,{ctl:t,onCommit:i,...a}):n===`array`?(0,$.jsx)(di,{ctl:t,onCommit:i,...a}):(0,$.jsx)(li,{ctl:t,onCommit:i,...a})}function li({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(Lt,{...n,value:typeof e.value==`string`?e.value:``,ref:e.ref,onChange:t=>e.onChange(t.target.value),onBlur:()=>{e.onBlur(),t()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),t())},className:`h-8 text-sm`})}function ui({ctl:e,onCommit:t,...n}){"use no memo";let[r,i]=(0,Q.useState)(e.value===void 0?``:String(e.value)),a=(0,Q.useRef)(e.value);(0,Q.useEffect)(()=>{a.current!==e.value&&(i(e.value===void 0?``:String(e.value)),a.current=e.value)},[e.value]);let o=()=>{let n=Number(r);if(!Number.isFinite(n)){e.onChange(r),t();return}e.onChange(n),t(),a.current=n};return(0,$.jsx)(Lt,{...n,type:`number`,value:r,ref:e.ref,onChange:e=>i(e.target.value),onBlur:()=>{e.onBlur(),o()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())},className:`h-8 w-28 text-sm tabular-nums`})}function di({ctl:e,onCommit:t,...n}){"use no memo";let r=Array.isArray(e.value)?e.value.join(`
|
|
3
3
|
`):``,[i,a]=(0,Q.useState)(r),o=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{let t=Array.isArray(e.value)?e.value.join(`
|
|
4
4
|
`):``;t!==o.current&&(a(t),o.current=t)},[e.value]);let s=()=>{let n=i.split(`
|