@cryptiklemur/lattice 5.5.0 → 5.6.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/client/assets/{angular-html-Bmjy4gNc.js → angular-html-B_LrO4d_.js} +1 -1
- package/dist/client/assets/{angular-ts-10l13C4C.js → angular-ts-DG2-AEn3.js} +1 -1
- package/dist/client/assets/{apl--Bn7yH0T.js → apl-D9AV-2KJ.js} +1 -1
- package/dist/client/assets/{astro-C8P9TQkP.js → astro-D55z-bYO.js} +1 -1
- package/dist/client/assets/{blade-DQiHYnIS.js → blade-Bs-tcMis.js} +1 -1
- package/dist/client/assets/{c-BFny-WnE.js → c-CAs-oCwZ.js} +1 -1
- package/dist/client/assets/{cobol-hGEexMYH.js → cobol-0B2WKsi0.js} +1 -1
- package/dist/client/assets/{coffee-j3W4ZALV.js → coffee-BLi0y75x.js} +1 -1
- package/dist/client/assets/{cpp-DquWJNps.js → cpp-CTXpwK-o.js} +1 -1
- package/dist/client/assets/{crystal-CWL31dIV.js → crystal-B_OPrNIv.js} +1 -1
- package/dist/client/assets/{css-Di4GSq8V.js → css-C9nlz4Z2.js} +1 -1
- package/dist/client/assets/{dist-CaJdL3Va.js → dist-CzUlrFrL.js} +2 -2
- package/dist/client/assets/{edge-rK4d050l.js → edge-DE3SfmPJ.js} +1 -1
- package/dist/client/assets/{elixir-BMFKKu5z.js → elixir-BS_1fIPf.js} +1 -1
- package/dist/client/assets/{elm-B0QVlW3-.js → elm-CrfkxZpb.js} +1 -1
- package/dist/client/assets/{erb-C9w9QbhL.js → erb-B6Ab2Y07.js} +1 -1
- package/dist/client/assets/{git-rebase-FaylS7Vl.js → git-rebase-RkfMNUtm.js} +1 -1
- package/dist/client/assets/{glimmer-js-Bi2XnbHi.js → glimmer-js-CBA96B3V.js} +1 -1
- package/dist/client/assets/{glimmer-ts-DOdxK6E6.js → glimmer-ts-WPYNrOak.js} +1 -1
- package/dist/client/assets/{glsl-BiGDIGbZ.js → glsl-BVPbkPwC.js} +1 -1
- package/dist/client/assets/{graphql-CZJB8KIP.js → graphql-CplPyf-J.js} +1 -1
- package/dist/client/assets/{hack-CNGYBFqH.js → hack-Bqnr1D44.js} +1 -1
- package/dist/client/assets/{haml-pf3Zh5MH.js → haml-Bk9H5oqC.js} +1 -1
- package/dist/client/assets/{handlebars-BsQwsvPC.js → handlebars-Dho-7JSJ.js} +1 -1
- package/dist/client/assets/{html-Dj4Hvv69.js → html-Dx1dAJ5K.js} +1 -1
- package/dist/client/assets/{html-derivative-CE7dQ_mI.js → html-derivative-DMEkbacz.js} +1 -1
- package/dist/client/assets/{http-DjOuMI1u.js → http-yzZRblhh.js} +1 -1
- package/dist/client/assets/{hurl-BH_MQrQo.js → hurl-DwA-puXE.js} +1 -1
- package/dist/client/assets/{index-DA8ZBSYW.js → index-BV9isded.js} +2 -2
- package/dist/client/assets/{java-CnpykAva.js → java-da4cNL_S.js} +1 -1
- package/dist/client/assets/{javascript-BbqQ1sQM.js → javascript-BRBtsTGZ.js} +1 -1
- package/dist/client/assets/{jinja-DddpvWwk.js → jinja-KYkTqvLF.js} +1 -1
- package/dist/client/assets/{jison-Bd3G2n4x.js → jison-CpJZ2qu3.js} +1 -1
- package/dist/client/assets/{json-F0eTFQKP.js → json-1ZKXsOcj.js} +1 -1
- package/dist/client/assets/{jsx-B-wB5nUs.js → jsx-Ci3IutCK.js} +1 -1
- package/dist/client/assets/{julia-9Lfz4b5s.js → julia-8BIB33ff.js} +1 -1
- package/dist/client/assets/{just-BVE1sBJx.js → just-BlxIBqAl.js} +1 -1
- package/dist/client/assets/{latex-SF3xMSWG.js → latex-Dt6aIDIN.js} +1 -1
- package/dist/client/assets/{liquid-CLkbZ0ZV.js → liquid-rNU0f2fO.js} +1 -1
- package/dist/client/assets/{lua-DNph6TL8.js → lua-9O59duWh.js} +1 -1
- package/dist/client/assets/{marko-CGqdEtbF.js → marko-cSK6Q4M9.js} +1 -1
- package/dist/client/assets/{mdc-BLpzcq82.js → mdc-DD0DONjK.js} +1 -1
- package/dist/client/assets/{nginx-s7ciyZD1.js → nginx-Bfzt7qPl.js} +1 -1
- package/dist/client/assets/{nim-C4FeZI3R.js → nim-DOD72OhS.js} +1 -1
- package/dist/client/assets/{perl-GDfD5AIi.js → perl-1cg42R6O.js} +1 -1
- package/dist/client/assets/{php-CusAuy6y.js → php-DfG0eJE0.js} +1 -1
- package/dist/client/assets/{pug-DCKuXO7x.js → pug-BJ4ktrjh.js} +1 -1
- package/dist/client/assets/{qml-rp1ZHoeo.js → qml-BwGhenQ4.js} +1 -1
- package/dist/client/assets/{r-CwNbYaVb.js → r-DSKy_gZ9.js} +1 -1
- package/dist/client/assets/{razor-CinY5yf4.js → razor-morGoSMw.js} +1 -1
- package/dist/client/assets/{regexp-CxVI4rKV.js → regexp-DSQzd7Gw.js} +1 -1
- package/dist/client/assets/{rst-BrBmBgUr.js → rst-CQ4DB61w.js} +1 -1
- package/dist/client/assets/{ruby-BzNCpRio.js → ruby-dcUoNsdX.js} +1 -1
- package/dist/client/assets/{sas-B4IAap7m.js → sas-BckOIwmR.js} +1 -1
- package/dist/client/assets/{scss-eNAsUEA1.js → scss-CIDQomQQ.js} +1 -1
- package/dist/client/assets/{shellscript-BwH0aChW.js → shellscript-DscXCB_p.js} +1 -1
- package/dist/client/assets/{shellsession-B5ibJBbh.js → shellsession-C9EjZURj.js} +1 -1
- package/dist/client/assets/{soy-BrqReQP3.js → soy-CVzyKHIE.js} +1 -1
- package/dist/client/assets/{sql-KIDgTieS.js → sql-Ddk-vRG3.js} +1 -1
- package/dist/client/assets/{stata-D6yim7Rr.js → stata-BGl5cxb8.js} +1 -1
- package/dist/client/assets/{surrealql-C51iMPEA.js → surrealql-3IZgL_Ze.js} +1 -1
- package/dist/client/assets/{svelte-DYs5QSVt.js → svelte-BRM0niF5.js} +1 -1
- package/dist/client/assets/{templ-CLDdaEXl.js → templ-qbgb30u-.js} +1 -1
- package/dist/client/assets/{tex-D16HBCoj.js → tex-Ct_-hpJo.js} +1 -1
- package/dist/client/assets/{ts-tags-DTcB2bBd.js → ts-tags-C85B12Rc.js} +1 -1
- package/dist/client/assets/{tsx-BxGfVt8a.js → tsx-d401eVG9.js} +1 -1
- package/dist/client/assets/{twig-BUC08jwe.js → twig-CEvQ_MDP.js} +1 -1
- package/dist/client/assets/{typescript-CuPGT2MR.js → typescript-y2NNcyKH.js} +1 -1
- package/dist/client/assets/{vue-_ip8-SIk.js → vue-CiTZbygT.js} +1 -1
- package/dist/client/assets/{vue-html-D-I9-U-x.js → vue-html-B4nYUWKJ.js} +1 -1
- package/dist/client/assets/{vue-vine-7AONB1tt.js → vue-vine-DdfbYtGV.js} +1 -1
- package/dist/client/assets/{xml-D2ZUDsPU.js → xml-1B2HtnyO.js} +1 -1
- package/dist/client/assets/{xsl-GlFKKlLy.js → xsl-DoRYSDxo.js} +1 -1
- package/dist/client/assets/{yaml-BnuTxWck.js → yaml-DpbRFfH9.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/client/sw.js +1 -1
- package/dist/server/daemon.js +60 -27
- package/dist/server/handlers/attachment.js +66 -29
- package/dist/server/handlers/fs.js +58 -72
- package/dist/server/handlers/memory.js +37 -52
- package/dist/server/handlers/mesh.js +4 -1
- package/dist/server/handlers/session.js +38 -57
- package/dist/server/mesh/connector.js +85 -1
- package/dist/server/project/file-browser.js +14 -14
- package/dist/server/project/session.js +7 -4
- package/dist/server/ws/broadcast.js +60 -0
- package/package.json +1 -1
|
@@ -112,7 +112,7 @@ ${s.join(`
|
|
|
112
112
|
`).slice(2,3).join(`
|
|
113
113
|
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);aU.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*rU<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||uH;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof nU)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},sU=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},cU=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),lU;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof uU?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:KH.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:cU})})(lU||={});var uU=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?cU:(this._emitter||=new oU,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},dU=`en`,fU=!1,pU=!1,mU=dU,hU,gU=globalThis,_U;typeof gU.vscode<`u`&&typeof gU.vscode.process<`u`?_U=gU.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(_U=process);var vU=typeof _U?.versions?.electron==`string`&&_U?.type===`renderer`;if(typeof _U==`object`){_U.platform,_U.platform,fU=_U.platform===`linux`,fU&&_U.env.SNAP&&_U.env.SNAP_REVISION,_U.env.CI||_U.env.BUILD_ARTIFACTSTAGINGDIRECTORY,mU=dU;let e=_U.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,mU=t.resolvedLanguage||dU,t.languagePack?.translationsConfigFile}catch{}}else typeof navigator==`object`&&!vU?(hU=navigator.userAgent,hU.indexOf(`Windows`),hU.indexOf(`Macintosh`),(hU.indexOf(`Macintosh`)>=0||hU.indexOf(`iPad`)>=0||hU.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,fU=hU.indexOf(`Linux`)>=0,hU?.indexOf(`Mobi`),pU=!0,mU=globalThis._VSCODE_NLS_LANGUAGE||dU,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);pU&&typeof gU.importScripts==`function`&&gU.origin;var yU=hU,bU=mU,xU;(e=>{function t(){return bU}e.value=t;function n(){return bU.length===2?bU===`en`:bU.length>=3?bU[0]===`e`&&bU[1]===`n`&&bU[2]===`-`:!1}e.isDefaultVariant=n;function r(){return bU===`en`}e.isDefault=r})(xU||={});var SU=typeof gU.postMessage==`function`&&!gU.importScripts;(()=>{if(SU){let e=[];gU.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),gU.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var CU=!!(yU&&yU.indexOf(`Chrome`)>=0);yU&&yU.indexOf(`Firefox`),!CU&&yU&&yU.indexOf(`Safari`),yU&&yU.indexOf(`Edg/`),yU&&yU.indexOf(`Android`);function wU(e,t=0,n){let r=setTimeout(()=>{e(),n&&i.dispose()},t),i=FH(()=>{clearTimeout(r),n?.deleteAndLeak(i)});return n?.add(i),i}(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var TU;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(TU||={});var EU=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new oU,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await KH.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};EU.EMPTY=EU.fromArray([]);var DU=class extends RH{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new zH),this._linesCacheDisposables=this._register(new zH),this._register(FH(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=PH(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=wU(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let n=[],r=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let a=this._terminal.buffer.active.getLine(e+1),o=a?a.isWrapped:!1,s=i.translateToString(!o&&t);if(o&&a){let e=i.getCell(i.length-1);e&&e.getCode()===0&&e.getWidth()===1&&a.getCell(0)?.getWidth()===2&&(s=s.slice(0,-1))}if(n.push(s),o)r.push(r[r.length-1]+s.length);else break;e++,i=a}return[n.join(``),r]}},OU=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},kU=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,n,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let i={startRow:t,startCol:n},a=this._findInLine(e,i,r);if(!a)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(i.startRow=n,i.startCol=0,a=this._findInLine(e,i,r),!a);n++);return a}findNextWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=0,a=0;r&&(n===e?(i=r.end.x,a=r.end.y):(i=r.start.x,a=r.start.y)),this._lineCache.initLinesCache();let o={startRow:a,startCol:i},s=this._findInLine(e,o,t);if(!s)for(let n=a+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);if(!s&&a!==0)for(let n=0;n<a&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);return!s&&r&&(o.startRow=r.start.y,o.startCol=0,s=this._findInLine(e,o,t)),s}findPreviousWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=this._terminal.buffer.active.baseY+this._terminal.rows-1,a=this._terminal.cols;this._lineCache.initLinesCache();let o={startRow:i,startCol:a},s;if(r&&(o.startRow=i=r.start.y,o.startCol=a=r.start.x,n!==e&&(s=this._findInLine(e,o,t,!1),s||(o.startRow=i=r.end.y,o.startCol=a=r.end.x))),s||=this._findInLine(e,o,t,!0),!s){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let n=i-1;n>=0&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);}if(!s&&i!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=i&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);return s}_isWholeWord(e,t,n){return(e===0||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e-1]))&&(e+n.length===t.length||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=t.startRow,a=t.startCol;if(this._terminal.buffer.active.getLine(i)?.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,n)}let o=this._lineCache.getLineFromCache(i);o||(o=this._lineCache.translateBufferLineToStringWithWrap(i,!0),this._lineCache.setLineInCache(i,o));let[s,c]=o,l=this._bufferColsToStringOffset(i,a),u=e,d=s;n.regex||(u=n.caseSensitive?e:e.toLowerCase(),d=n.caseSensitive?s:s.toLowerCase());let f=-1;if(n.regex){let t=RegExp(u,n.caseSensitive?`g`:`gi`),i;if(r)for(;i=t.exec(d.slice(0,l));)f=t.lastIndex-i[0].length,e=i[0],t.lastIndex-=e.length-1;else i=t.exec(d.slice(l)),i&&i[0].length>0&&(f=l+(t.lastIndex-i[0].length),e=i[0])}else r?l-u.length>=0&&(f=d.lastIndexOf(u,l-u.length)):f=d.indexOf(u,l);if(f>=0){if(n.wholeWord&&!this._isWholeWord(f,d,e))return;let t=0;for(;t<c.length-1&&f>=c[t+1];)t++;let r=t;for(;r<c.length-1&&f+e.length>=c[r+1];)r++;let a=f-c[t],o=f+e.length-c[r],s=this._stringLengthToBufferSize(i+t,a),l=this._stringLengthToBufferSize(i+r,o)-s+this._terminal.cols*(r-t);return{term:e,col:s,row:i+t,size:l}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e<t;e++){let r=n.getCell(e);if(!r)break;let i=r.getChars();i.length>1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=e,r=0,i=this._terminal.buffer.active.getLine(n);for(;t>0&&i;){for(let e=0;e<t&&e<this._terminal.cols;e++){let t=i.getCell(e);if(!t)break;t.getWidth()&&(r+=t.getCode()===0?1:t.getChars().length)}if(n++,i=this._terminal.buffer.active.getLine(n),i&&!i.isWrapped)break;t-=this._terminal.cols}return r}},AU=class extends RH{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(FH(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let n of e){let e=this._createResultDecorations(n,t,!1);if(e)for(let t of e)this._storeDecoration(t,n)}}createActiveDecoration(e,t){let n=this._createResultDecorations(e,t,!0);if(n)return{decorations:n,match:e,dispose(){NH(n)}}}clearHighlightDecorations(){NH(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecorations(e,t,n){let r=[],i=e.col,a=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;a>0;){let e=Math.min(this._terminal.cols-i,a);r.push([o,i,e]),i=0,a-=e,o++}let s=[];for(let e of r){let r=this._terminal.registerMarker(e[0]),i=this._terminal.registerDecoration({marker:r,x:e[1],width:e[2],backgroundColor:n?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:n?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:`center`}});if(i){let e=[];e.push(r),e.push(i.onRender(e=>this._applyStyles(e,n?t.activeMatchBorder:t.matchBorder,!1))),e.push(i.onDispose(()=>NH(e))),s.push(i)}}return s.length===0?void 0:s}},jU=class extends RH{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new oU)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&=(this._selectedDecoration.dispose(),void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let n=this._searchResults[t];if(n.row===e.row&&n.col===e.col&&n.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},MU=class extends RH{constructor(e){super(),this._highlightTimeout=this._register(new zH),this._lineCache=this._register(new zH),this._state=new OU,this._resultTracker=this._register(new jU),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new DU(e),this._engine=new kU(e,this._lineCache.value),this._decorationManager=new AU(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(FH(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=wU(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error(`Cannot use addon until it has been loaded`);if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],r,i=this._engine.find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(n,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(n,t.decorations)}_findNextAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}findPrevious(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}_selectResult(e,t,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!n&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let t=e.row-this._terminal.buffer.active.viewportY;t-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(t)}return!0}};function NU(){var e=document.documentElement,t=getComputedStyle(e);function n(e,n){return t.getPropertyValue(e).trim()||n}return{background:n(`--base00`,`#0d0d0d`),foreground:n(`--base05`,`#d4d4d4`),cursor:n(`--base05`,`#d4d4d4`),selectionBackground:n(`--base02`,`#264f78`),black:n(`--base00`,`#1e1e1e`),red:n(`--base08`,`#f44747`),green:n(`--base0B`,`#4ec9b0`),yellow:n(`--base0A`,`#dcdcaa`),blue:n(`--base0D`,`#569cd6`),magenta:n(`--base0E`,`#c586c0`),cyan:n(`--base0C`,`#9cdcfe`),white:n(`--base05`,`#d4d4d4`),brightBlack:n(`--base03`,`#808080`),brightRed:n(`--base08`,`#f44747`),brightGreen:n(`--base0B`,`#4ec9b0`),brightYellow:n(`--base0A`,`#dcdcaa`),brightBlue:n(`--base0D`,`#569cd6`),brightMagenta:n(`--base0E`,`#c586c0`),brightCyan:n(`--base0C`,`#9cdcfe`),brightWhite:n(`--base07`,`#ffffff`)}}function PU({instanceId:e,visible:t}){var n=(0,x.useRef)(null),r=(0,x.useRef)(null),i=(0,x.useRef)(null),a=(0,x.useRef)(null),o=(0,x.useRef)(null),{activeProjectSlug:s}=Yw(),{send:c,subscribe:l,unsubscribe:u}=z();return(0,x.useEffect)(function(){if(!n.current)return;var e=new $V({cursorBlink:!0,fontFamily:getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||`JetBrains Mono, monospace`,fontSize:13,theme:NU()}),t=new nH,d=new cH,f=new MU;e.loadAddon(t),e.loadAddon(d),e.loadAddon(f),e.open(n.current),t.fit(),r.current=e,i.current=t,a.current=f;var p=!0;function m(e){p&&(p=!1,o.current=e.termId)}function h(e){var t=e;r.current&&t.termId===o.current&&r.current.write(t.data)}function g(e){var t=e;r.current&&t.termId===o.current&&r.current.write(`\r
|
|
114
114
|
\x1B[31m[process exited]\x1B[0m\r
|
|
115
|
-
`)}l(`terminal:created`,m),l(`terminal:output`,h),l(`terminal:exited`,g),c({type:`terminal:create`,projectSlug:s||void 0}),e.onData(function(e){var t=o.current;t&&c({type:`terminal:input`,termId:t,data:e})});var _=new ResizeObserver(function(){if(i.current){i.current.fit();var e=o.current,t=i.current.proposeDimensions();e&&t&&c({type:`terminal:resize`,termId:e,cols:t.cols,rows:t.rows})}});return n.current&&_.observe(n.current),function(){u(`terminal:created`,m),u(`terminal:output`,h),u(`terminal:exited`,g),_.disconnect(),e.dispose(),r.current=null,i.current=null,a.current=null}},[]),(0,x.useEffect)(function(){if(t&&i.current){var e=setTimeout(function(){if(i.current){i.current.fit();var e=o.current,t=i.current.proposeDimensions();e&&t&&c({type:`terminal:resize`,termId:e,cols:t.cols,rows:t.rows})}},50);return function(){clearTimeout(e)}}},[t]),(0,b.jsx)(`div`,{ref:n,className:`w-full h-full overflow-hidden bg-base-100`,style:{display:t?`block`:`none`},"data-instance-id":e})}var FU=1;function IU(){var e=FU++;return{id:`term-${e}-${Date.now()}`,label:`Terminal ${e}`}}function LU(){var e=IU(),[t,n]=(0,x.useState)([e]),[r,i]=(0,x.useState)(e.id);function a(){var e=IU();n(function(t){return[...t,e]}),i(e.id)}function o(e){n(function(t){if(t.length===1){var n=IU();return i(n.id),[n]}var a=t.filter(function(t){return t.id!==e});if(e===r){var o=t.findIndex(function(t){return t.id===e}),s=a[Math.min(o,a.length-1)];i(s.id)}return a})}return(0,b.jsxs)(`div`,{className:`flex flex-col h-full w-full overflow-hidden`,children:[(0,b.jsxs)(`div`,{role:`tablist`,className:`flex items-center h-8 bg-base-200 border-b border-base-content/15 flex-shrink-0 overflow-x-auto`,children:[t.map(function(e){var n=e.id===r;return(0,b.jsxs)(`div`,{tabIndex:0,role:`tab`,"aria-selected":n,className:[`flex items-center gap-1 px-3 h-full text-[12px] cursor-pointer select-none border-r border-base-content/15 flex-shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,n?`bg-base-100 text-base-content`:`text-base-content/50 hover:text-base-content hover:bg-base-100/50`].join(` `),onClick:function(){i(e.id)},onKeyDown:function(t){(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),i(e.id))},children:[(0,b.jsx)(`span`,{children:e.label}),t.length>1&&(0,b.jsx)(`button`,{className:`ml-1 rounded hover:bg-base-300 p-1 sm:p-0.5 outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,"aria-label":`Close `+e.label,onClick:function(t){t.stopPropagation(),o(e.id)},children:(0,b.jsx)(iw,{className:`!size-3`})})]},e.id)}),(0,b.jsx)(`button`,{className:`flex items-center justify-center w-10 sm:w-8 h-full text-base-content/50 hover:text-base-content hover:bg-base-100/50 flex-shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,"aria-label":`New terminal`,onClick:a,title:`New terminal`,children:(0,b.jsx)($b,{className:`!size-4`})})]}),(0,b.jsx)(`div`,{className:`flex-1 min-h-0 relative`,children:t.map(function(e){return(0,b.jsx)(`div`,{className:`absolute inset-0`,style:{display:e.id===r?`block`:`none`},children:(0,b.jsx)(PU,{instanceId:e.id,visible:e.id===r})},e.id)})})]})}function RU(e){return e.map(function(e){return{entry:e,children:null,expanded:!1}})}function zU(e){var{node:t,depth:n,selectedPath:r,onToggle:i,onSelect:a}=e,o=r===t.entry.path,s=t.entry.isDirectory;function c(){s?i(t.entry.path):a(t.entry.path)}function l(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())}return(0,b.jsxs)(`div`,{role:`treeitem`,"aria-expanded":s?t.expanded:void 0,"aria-selected":o,children:[(0,b.jsxs)(`div`,{tabIndex:0,onClick:c,onKeyDown:l,className:`flex items-center gap-1.5 py-[3px] pr-2 cursor-pointer text-[13px] rounded select-none outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200 `+(o?`bg-base-300 text-primary`:`text-base-content hover:bg-base-200`),style:{paddingLeft:8+n*16+`px`},children:[s?(0,b.jsx)(ou,{size:12,className:`flex-shrink-0 text-base-content/40 transition-transform duration-[120ms]`,style:{transform:t.expanded?`rotate(90deg)`:`none`}}):(0,b.jsx)(Um,{size:12,className:`flex-shrink-0 text-base-content/40`}),(0,b.jsx)(`span`,{className:`truncate `+(s?`text-info`:`text-base-content`),children:t.entry.name})]}),s&&t.expanded&&t.children&&(0,b.jsx)(`div`,{role:`group`,children:t.children.map(function(e){return(0,b.jsx)(zU,{node:e,depth:n+1,selectedPath:r,onToggle:i,onSelect:a},e.entry.path)})})]})}function BU(e){var{nodes:t,selectedPath:n,onToggle:r,onSelect:i}=e;return(0,b.jsx)(`div`,{role:`tree`,"aria-label":`File tree`,children:t.length===0?(0,b.jsx)(`div`,{className:`px-2 py-3 text-[12px] text-base-content/40`,children:`Loading...`}):t.map(function(e){return(0,b.jsx)(zU,{node:e,depth:0,selectedPath:n,onToggle:r,onSelect:i},e.entry.path)})})}var VU=`modulepreload`,HU=function(e){return`/`+e},UU={},WU=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=HU(t,n),t in UU)return;UU[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:VU,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},GU=null,KU=new Set;function qU(){return GU||=WU(()=>import(`./dist-
|
|
115
|
+
`)}l(`terminal:created`,m),l(`terminal:output`,h),l(`terminal:exited`,g),c({type:`terminal:create`,projectSlug:s||void 0}),e.onData(function(e){var t=o.current;t&&c({type:`terminal:input`,termId:t,data:e})});var _=new ResizeObserver(function(){if(i.current){i.current.fit();var e=o.current,t=i.current.proposeDimensions();e&&t&&c({type:`terminal:resize`,termId:e,cols:t.cols,rows:t.rows})}});return n.current&&_.observe(n.current),function(){u(`terminal:created`,m),u(`terminal:output`,h),u(`terminal:exited`,g),_.disconnect(),e.dispose(),r.current=null,i.current=null,a.current=null}},[]),(0,x.useEffect)(function(){if(t&&i.current){var e=setTimeout(function(){if(i.current){i.current.fit();var e=o.current,t=i.current.proposeDimensions();e&&t&&c({type:`terminal:resize`,termId:e,cols:t.cols,rows:t.rows})}},50);return function(){clearTimeout(e)}}},[t]),(0,b.jsx)(`div`,{ref:n,className:`w-full h-full overflow-hidden bg-base-100`,style:{display:t?`block`:`none`},"data-instance-id":e})}var FU=1;function IU(){var e=FU++;return{id:`term-${e}-${Date.now()}`,label:`Terminal ${e}`}}function LU(){var e=IU(),[t,n]=(0,x.useState)([e]),[r,i]=(0,x.useState)(e.id);function a(){var e=IU();n(function(t){return[...t,e]}),i(e.id)}function o(e){n(function(t){if(t.length===1){var n=IU();return i(n.id),[n]}var a=t.filter(function(t){return t.id!==e});if(e===r){var o=t.findIndex(function(t){return t.id===e}),s=a[Math.min(o,a.length-1)];i(s.id)}return a})}return(0,b.jsxs)(`div`,{className:`flex flex-col h-full w-full overflow-hidden`,children:[(0,b.jsxs)(`div`,{role:`tablist`,className:`flex items-center h-8 bg-base-200 border-b border-base-content/15 flex-shrink-0 overflow-x-auto`,children:[t.map(function(e){var n=e.id===r;return(0,b.jsxs)(`div`,{tabIndex:0,role:`tab`,"aria-selected":n,className:[`flex items-center gap-1 px-3 h-full text-[12px] cursor-pointer select-none border-r border-base-content/15 flex-shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,n?`bg-base-100 text-base-content`:`text-base-content/50 hover:text-base-content hover:bg-base-100/50`].join(` `),onClick:function(){i(e.id)},onKeyDown:function(t){(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),i(e.id))},children:[(0,b.jsx)(`span`,{children:e.label}),t.length>1&&(0,b.jsx)(`button`,{className:`ml-1 rounded hover:bg-base-300 p-1 sm:p-0.5 outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,"aria-label":`Close `+e.label,onClick:function(t){t.stopPropagation(),o(e.id)},children:(0,b.jsx)(iw,{className:`!size-3`})})]},e.id)}),(0,b.jsx)(`button`,{className:`flex items-center justify-center w-10 sm:w-8 h-full text-base-content/50 hover:text-base-content hover:bg-base-100/50 flex-shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,"aria-label":`New terminal`,onClick:a,title:`New terminal`,children:(0,b.jsx)($b,{className:`!size-4`})})]}),(0,b.jsx)(`div`,{className:`flex-1 min-h-0 relative`,children:t.map(function(e){return(0,b.jsx)(`div`,{className:`absolute inset-0`,style:{display:e.id===r?`block`:`none`},children:(0,b.jsx)(PU,{instanceId:e.id,visible:e.id===r})},e.id)})})]})}function RU(e){return e.map(function(e){return{entry:e,children:null,expanded:!1}})}function zU(e){var{node:t,depth:n,selectedPath:r,onToggle:i,onSelect:a}=e,o=r===t.entry.path,s=t.entry.isDirectory;function c(){s?i(t.entry.path):a(t.entry.path)}function l(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())}return(0,b.jsxs)(`div`,{role:`treeitem`,"aria-expanded":s?t.expanded:void 0,"aria-selected":o,children:[(0,b.jsxs)(`div`,{tabIndex:0,onClick:c,onKeyDown:l,className:`flex items-center gap-1.5 py-[3px] pr-2 cursor-pointer text-[13px] rounded select-none outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200 `+(o?`bg-base-300 text-primary`:`text-base-content hover:bg-base-200`),style:{paddingLeft:8+n*16+`px`},children:[s?(0,b.jsx)(ou,{size:12,className:`flex-shrink-0 text-base-content/40 transition-transform duration-[120ms]`,style:{transform:t.expanded?`rotate(90deg)`:`none`}}):(0,b.jsx)(Um,{size:12,className:`flex-shrink-0 text-base-content/40`}),(0,b.jsx)(`span`,{className:`truncate `+(s?`text-info`:`text-base-content`),children:t.entry.name})]}),s&&t.expanded&&t.children&&(0,b.jsx)(`div`,{role:`group`,children:t.children.map(function(e){return(0,b.jsx)(zU,{node:e,depth:n+1,selectedPath:r,onToggle:i,onSelect:a},e.entry.path)})})]})}function BU(e){var{nodes:t,selectedPath:n,onToggle:r,onSelect:i}=e;return(0,b.jsx)(`div`,{role:`tree`,"aria-label":`File tree`,children:t.length===0?(0,b.jsx)(`div`,{className:`px-2 py-3 text-[12px] text-base-content/40`,children:`Loading...`}):t.map(function(e){return(0,b.jsx)(zU,{node:e,depth:0,selectedPath:n,onToggle:r,onSelect:i},e.entry.path)})})}var VU=`modulepreload`,HU=function(e){return`/`+e},UU={},WU=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=HU(t,n),t in UU)return;UU[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:VU,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},GU=null,KU=new Set;function qU(){return GU||=WU(()=>import(`./dist-CzUlrFrL.js`).then(function(e){return e.createHighlighter({themes:[`css-variables`],langs:[]})}),[]),GU}async function JU(e,t){var n=await qU(),r=t===`text`?`text`:t;if(r!==`text`&&!KU.has(r))try{await n.loadLanguage(r),KU.add(r)}catch{r=`text`}return n.codeToHtml(e,{lang:r,theme:`css-variables`})}var YU={ts:`typescript`,tsx:`tsx`,js:`javascript`,jsx:`jsx`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,xml:`xml`,yaml:`yaml`,yml:`yaml`,toml:`toml`,py:`python`,rs:`rust`,go:`go`,sh:`bash`,bash:`bash`,zsh:`bash`,sql:`sql`,graphql:`graphql`,dockerfile:`dockerfile`,makefile:`makefile`,vue:`vue`,svelte:`svelte`,lua:`lua`,rb:`ruby`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,cs:`csharp`};function XU(e){var t=e.split(`/`).pop()||``,n=t.toLowerCase();return n===`dockerfile`?`dockerfile`:n===`makefile`?`makefile`:YU[t.split(`.`).pop()?.toLowerCase()||``]||`text`}function ZU(e){return e.toLowerCase().endsWith(`.md`)}function QU(e){var{path:t,content:n,editorUrl:r}=e,[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(!0),u=(0,x.useRef)(null),d=XU(t),f=n.split(`
|
|
116
116
|
`).length,p=ZU(t),m=t.split(`/`).pop()||t;(0,x.useEffect)(function(){if(a(null),!(p&&c)){var e=!1;return JU(n,d).then(function(t){e||a(t)}).catch(function(){}),function(){e=!0}}},[n,d,p,c]);function h(){navigator.clipboard.writeText(n),s(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(function(){s(!1)},2e3)}return(0,b.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,b.jsxs)(`div`,{className:`h-9 flex-shrink-0 flex items-center gap-2 px-4 border-b border-base-content/15 bg-base-200`,children:[(0,b.jsx)(Bm,{size:13,className:`text-base-content/40 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`text-[12px] font-mono text-base-content/60 truncate`,children:m}),(0,b.jsx)(`span`,{className:`text-[10px] font-mono px-1.5 py-0.5 rounded bg-base-300 text-base-content/40 uppercase flex-shrink-0`,children:d}),(0,b.jsxs)(`span`,{className:`text-[10px] font-mono text-base-content/30 flex-shrink-0`,children:[f,` lines`]}),(0,b.jsx)(`div`,{className:`flex-1`}),p&&(0,b.jsxs)(`button`,{onClick:function(){l(!c)},className:`btn btn-ghost btn-xs gap-1 text-[11px] `+(c?`text-primary`:`text-base-content/50`),title:c?`Show source`:`Show rendered`,children:[(0,b.jsx)(wm,{size:13}),c?`Source`:`Rendered`]}),(0,b.jsx)(`button`,{onClick:h,className:`btn btn-ghost btn-xs text-base-content/50 hover:text-base-content`,title:`Copy to clipboard`,children:o?(0,b.jsx)(R,{size:13,className:`text-success`}):(0,b.jsx)(qf,{size:13})}),r&&(0,b.jsx)(`a`,{href:r,className:`btn btn-ghost btn-xs text-base-content/50 hover:text-base-content`,title:`Open in editor`,children:(0,b.jsx)(xm,{size:13})})]}),(0,b.jsx)(`div`,{className:`flex-1 overflow-auto`,children:p&&c?(0,b.jsx)(`div`,{className:`prose prose-sm max-w-none p-4`,children:(0,b.jsx)(dk,{children:n})}):i?(0,b.jsx)(`div`,{className:`p-4 text-[13px] leading-relaxed [&_pre]:!bg-transparent [&_pre]:!m-0 [&_pre]:!p-0 [&_code]:!bg-transparent`,style:{"--shiki-foreground":`var(--base05)`,"--shiki-background":`transparent`,"--shiki-token-constant":`var(--base09)`,"--shiki-token-string":`var(--base0B)`,"--shiki-token-comment":`var(--base03)`,"--shiki-token-keyword":`var(--base0E)`,"--shiki-token-parameter":`var(--base08)`,"--shiki-token-function":`var(--base0D)`,"--shiki-token-string-expression":`var(--base0B)`,"--shiki-token-punctuation":`var(--base05)`,"--shiki-token-link":`var(--base0D)`},dangerouslySetInnerHTML:{__html:i}}):(0,b.jsx)(`pre`,{className:`m-0 p-4 text-[13px] font-mono text-base-content leading-relaxed whitespace-pre-wrap break-words`,children:n})})]})}function $U(){var{send:e,subscribe:t,unsubscribe:n}=z(),{activeProjectSlug:r}=Yw(),{activeProject:i}=Gw(),{editorType:a,wslDistro:o}=UT(),s=(0,x.useRef)(null);s.current=r;var[c,l]=(0,x.useState)([]),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(!1),v=(0,x.useRef)([]);v.current=c;var y=(0,x.useCallback)(function(e){var t=e,n=RU(t.entries);if(t.path===``||t.path===`.`){l(n);return}function r(e){return e.map(function(e){return e.entry.path===t.path?Object.assign({},e,{children:n,expanded:!0}):e.children?Object.assign({},e,{children:r(e.children)}):e})}l(function(e){return r(e)})},[]),S=(0,x.useCallback)(function(e){p(e.content),h(!1)},[]),C=(0,x.useRef)(null);C.current=u;var w=(0,x.useCallback)(function(t){var n=t.path;n===C.current&&e({type:`fs:read`,path:n,projectSlug:s.current||void 0})},[e]);(0,x.useEffect)(function(){return t(`fs:list_result`,y),t(`fs:read_result`,S),t(`fs:changed`,w),e({type:`fs:list`,path:`.`,projectSlug:s.current||void 0}),function(){n(`fs:list_result`,y),n(`fs:read_result`,S),n(`fs:changed`,w)}},[y,S,w,e,t,n]);function T(t){function n(r){return r.map(function(r){return r.entry.path===t?!r.expanded&&!r.children?(e({type:`fs:list`,path:t,projectSlug:s.current||void 0}),Object.assign({},r,{expanded:!0})):Object.assign({},r,{expanded:!r.expanded}):r.children?Object.assign({},r,{children:n(r.children)}):r})}l(function(e){return n(e)})}function E(t){d(t),p(null),h(!0),_(!0),e({type:`fs:read`,path:t,projectSlug:r||void 0})}var D=u&&i?GT(a,i.path,u,void 0,o,i.ideProjectName):null;return(0,b.jsxs)(`div`,{className:`flex h-full w-full overflow-hidden bg-base-100`,children:[(0,b.jsxs)(`div`,{className:`w-full sm:w-[220px] sm:flex-shrink-0 sm:border-r sm:border-base-content/15 overflow-y-auto p-2`+(g?` hidden sm:block`:` block`),children:[(0,b.jsx)(`div`,{className:`text-[11px] font-semibold tracking-[0.06em] uppercase text-base-content/40 px-2 pb-2 pt-1`,children:`Files`}),(0,b.jsx)(BU,{nodes:c,selectedPath:u,onToggle:T,onSelect:E})]}),(0,b.jsxs)(`div`,{className:`flex-1 flex-col overflow-hidden`+(g?` flex`:` hidden sm:flex`),children:[u&&(0,b.jsxs)(`button`,{className:`sm:hidden flex items-center gap-1 px-2 py-1.5 text-[12px] text-base-content/60 hover:text-base-content border-b border-base-content/15`,onClick:function(){_(!1)},children:[(0,b.jsx)(ya,{size:14}),(0,b.jsx)(`span`,{children:`Back to files`})]}),!u&&(0,b.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center gap-3`,children:[(0,b.jsx)(Bm,{size:28,className:`text-base-content/15`}),(0,b.jsx)(`div`,{className:`text-base-content/40 text-[13px]`,children:`Select a file from the tree to view its contents`})]}),u&&m&&(0,b.jsx)(`div`,{className:`h-full flex items-center justify-center text-base-content/40 text-[13px]`,children:`Loading...`}),u&&!m&&f!==null&&(0,b.jsx)(QU,{path:u,content:f,editorUrl:D}),u&&!m&&f===null&&(0,b.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center gap-3`,children:[(0,b.jsx)(Hm,{size:28,className:`text-base-content/15`}),(0,b.jsx)(`div`,{className:`text-base-content/40 text-[13px]`,children:`Cannot display this file`}),(0,b.jsx)(`div`,{className:`text-base-content/30 text-[11px]`,children:`Binary files and files over 512KB are not shown`})]})]})]})}function eW(e){var{note:t,onUpdate:n,onDelete:r,disabled:i}=e,[a,o]=(0,x.useState)(!t.content),[s,c]=(0,x.useState)(t.content),[l,u]=(0,x.useState)(!1),d=(0,x.useRef)(t.content);function f(){i||a||(d.current=t.content,c(t.content),o(!0))}function p(){a&&(s.trim()&&s.trim()!==d.current&&n(t.id,s.trim()),o(!1))}function m(e){e.key===`Escape`&&(c(d.current),o(!1)),e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),p())}var h=new Date(t.updatedAt).toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`});return(0,b.jsx)(`div`,{className:`card bg-base-200 border border-base-content/15 outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,tabIndex:a?void 0:0,role:a?void 0:`button`,onClick:a?void 0:f,onKeyDown:a?void 0:function(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f())},style:{cursor:a?`default`:`pointer`},children:(0,b.jsxs)(`div`,{className:`card-body p-3`,children:[a?(0,b.jsx)(`textarea`,{autoFocus:!0,value:s,onChange:function(e){c(e.target.value)},onBlur:p,onKeyDown:m,placeholder:`Type your note...`,"aria-label":`Note content`,className:`textarea textarea-bordered w-full min-h-[80px] bg-base-300 text-base-content text-[13px] resize-y leading-relaxed`}):(0,b.jsx)(`div`,{className:`text-[13px] whitespace-pre-wrap break-words leading-relaxed min-h-12`,children:t.content?(0,b.jsx)(`span`,{className:`text-base-content`,children:t.content}):(0,b.jsx)(`span`,{className:`text-base-content/30 italic`,children:`Click to add a note...`})}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between mt-2`,children:[(0,b.jsx)(`span`,{className:`text-[11px] text-base-content/40`,children:h}),l?(0,b.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,b.jsx)(`button`,{onClick:function(e){e.stopPropagation(),r(t.id)},className:`btn btn-error btn-xs outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,children:`Delete`}),(0,b.jsx)(`button`,{onClick:function(e){e.stopPropagation(),u(!1)},className:`btn btn-ghost btn-xs border border-base-content/15 outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,children:`Cancel`})]}):(0,b.jsx)(`button`,{onClick:function(e){e.stopPropagation(),u(!0)},disabled:i,className:`btn btn-ghost btn-xs border border-base-content/15 text-base-content/50 outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,"aria-label":`Delete note`,children:(0,b.jsx)(XC,{className:`!size-3`})})]})]})})}function tW(){var{send:e,subscribe:t,unsubscribe:n}=z(),{activeProjectSlug:r}=ST(),i=CT(),[a,o]=(0,x.useState)([]),s=(0,x.useCallback)(function(e){if(e.type===`notes:list_result`){o(e.notes);return}if(e.type===`notes:created`){o(function(t){return[...t,e.note]});return}if(e.type===`notes:updated`){o(function(t){return t.map(function(t){return t.id===e.note.id?e.note:t})});return}if(e.type===`notes:deleted`){o(function(t){return t.filter(function(t){return t.id!==e.id})});return}},[]);(0,x.useEffect)(function(){return t(`notes:list_result`,s),t(`notes:created`,s),t(`notes:updated`,s),t(`notes:deleted`,s),e({type:`notes:list`,projectSlug:r??void 0}),function(){n(`notes:list_result`,s),n(`notes:created`,s),n(`notes:updated`,s),n(`notes:deleted`,s)}},[e,t,n,s,r]);function c(){e({type:`notes:create`,content:``,projectSlug:r??void 0})}function l(t,n){e({type:`notes:update`,id:t,content:n})}function u(t){e({type:`notes:delete`,id:t})}return(0,b.jsxs)(`div`,{className:`flex flex-col h-full bg-base-100`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-base-content/15`,children:[(0,b.jsx)(`span`,{className:`text-[13px] font-semibold text-base-content`,children:`Notes`}),(0,b.jsx)(`button`,{onClick:c,disabled:!i,className:`btn btn-primary btn-xs`,children:`New Note`})]}),(0,b.jsx)(`div`,{className:`flex-1 overflow-auto p-3`,children:a.length===0?(0,b.jsxs)(`div`,{className:`flex flex-col items-center justify-center text-center mt-16 gap-3`,children:[(0,b.jsx)(KC,{size:28,className:`text-base-content/15`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[13px] text-base-content/40`,children:`No notes for this project`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30 mt-1`,children:`Quick-capture ideas, reminders, or context. Click "New Note" to start.`})]})]}):(0,b.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2.5`,children:a.map(function(e){return(0,b.jsx)(eW,{note:e,onUpdate:l,onDelete:u,disabled:!i},e.id)})})})]})}var nW=l(o(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define(`cronstrue`,[],r):typeof e==`object`?e.cronstrue=r():n.cronstrue=r()})(globalThis,()=>(()=>{var e={949(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.CronParser=void 0;var r=n(515);t.CronParser=function(){function e(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=n}return e.prototype.parse=function(){var e,t=this.expression??``;if(t===`@reboot`)return e=[`@reboot`,``,``,``,``,``,``],e;if(t.startsWith(`@`)){var n=this.parseSpecial(this.expression);e=this.extractParts(n)}else e=this.extractParts(this.expression);return this.normalize(e),this.validate(e),e},e.prototype.parseSpecial=function(e){var t={"@yearly":`0 0 1 1 *`,"@annually":`0 0 1 1 *`,"@monthly":`0 0 1 * *`,"@weekly":`0 0 * * 0`,"@daily":`0 0 * * *`,"@midnight":`0 0 * * *`,"@hourly":`0 * * * *`,"@reboot":`@reboot`}[e];if(!t)throw Error(`Unknown special expression.`);return t},e.prototype.extractParts=function(e){if(!this.expression)throw Error(`cron expression is empty`);for(var t=e.trim().split(/[ ]+/),n=0;n<t.length;n++)if(t[n].includes(`,`)){var r=t[n].split(`,`).map(function(e){return e.trim()}).filter(function(e){return e!==``}).map(function(e){return isNaN(Number(e))?e:Number(e)}).filter(function(e){return e!==null&&e!==``});r.length===0&&r.push(`*`),r.sort(function(e,t){return e!==null&&t!==null?e-t:0}),t[n]=r.map(function(e){return e===null?``:e.toString()}).join(`,`)}if(t.length<5)throw Error(`Expression has only ${t.length} part${t.length==1?``:`s`}. At least 5 parts are required.`);if(t.length==5)t.unshift(``),t.push(``);else if(t.length==6)/\d{4}$/.test(t[5])||t[4]==`?`||t[2]==`?`?t.unshift(``):t.push(``);else if(t.length>7)throw Error(`Expression has ${t.length} parts; too many!`);return t},e.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace(`?`,`*`),e[5]=e[5].replace(`?`,`*`),e[2]=e[2].replace(`?`,`*`),e[0].indexOf(`0/`)==0&&(e[0]=e[0].replace(`0/`,`*/`)),e[1].indexOf(`0/`)==0&&(e[1]=e[1].replace(`0/`,`*/`)),e[2].indexOf(`0/`)==0&&(e[2]=e[2].replace(`0/`,`*/`)),e[3].indexOf(`1/`)==0&&(e[3]=e[3].replace(`1/`,`*/`)),e[4].indexOf(`1/`)==0&&(e[4]=e[4].replace(`1/`,`*/`)),e[6].indexOf(`1/`)==0&&(e[6]=e[6].replace(`1/`,`*/`)),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,function(e){var n=e.replace(/\D/,``),r=n;return t.dayOfWeekStartIndexZero?n==`7`&&(r=`0`):r=(parseInt(n)-1).toString(),e.replace(n,r)}),e[5]==`L`&&(e[5]=`6`),e[3]==`?`&&(e[3]=`*`),e[3].indexOf(`W`)>-1&&(e[3].indexOf(`,`)>-1||e[3].indexOf(`-`)>-1))throw Error(`The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.`);var n={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var r in n)e[5]=e[5].replace(new RegExp(r,`gi`),n[r].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(e){var n=e.replace(/\D/,``),r=n;return t.monthStartIndexZero&&(r=(parseInt(n)+1).toString()),e.replace(n,r)});var i={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in i)e[4]=e[4].replace(new RegExp(a,`gi`),i[a].toString());e[0]==`0`&&(e[0]=``),!/\*|\-|\,|\//.test(e[2])&&(/\*|\//.test(e[1])||/\*|\//.test(e[0]))&&(e[2]+=`-${e[2]}`);for(var o=0;o<e.length;o++)if(e[o].indexOf(`,`)!=-1&&(e[o]=e[o].split(`,`).filter(function(e){return e!==``}).join(`,`)||`*`),e[o]==`*/1`&&(e[o]=`*`),e[o].indexOf(`/`)>-1&&!/^\*|\-|\,/.test(e[o])){var s=null;switch(o){case 4:s=`12`;break;case 5:s=`6`;break;case 6:s=`9999`;break;default:s=null;break}if(s!==null){var c=e[o].split(`/`);e[o]=`${c[0]}-${s}/${c[1]}`}}},e.prototype.validate=function(e){var t=`0-9,\\-*/`;this.validateOnlyExpectedCharactersFound(e[0],t),this.validateOnlyExpectedCharactersFound(e[1],t),this.validateOnlyExpectedCharactersFound(e[2],t),this.validateOnlyExpectedCharactersFound(e[3],`0-9,\\-*/LW`),this.validateOnlyExpectedCharactersFound(e[4],t),this.validateOnlyExpectedCharactersFound(e[5],`0-9,\\-*/L#`),this.validateOnlyExpectedCharactersFound(e[6],t),this.validateAnyRanges(e)},e.prototype.validateAnyRanges=function(e){r.default.secondRange(e[0]),r.default.minuteRange(e[1]),r.default.hourRange(e[2]),r.default.dayOfMonthRange(e[3]),r.default.monthRange(e[4],this.monthStartIndexZero),r.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},e.prototype.validateOnlyExpectedCharactersFound=function(e,t){var n=e.match(RegExp(`[^${t}]+`,`gi`));if(n&&n.length)throw Error(`Expression contains invalid values: '${n.toString()}'`)},e}()},333(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.ExpressionDescriptor=void 0;var r=n(823),i=n(949);t.ExpressionDescriptor=function(){function e(t,n){if(this.expression=t,this.options=n,this.expressionParts=[,,,,,],!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var r=Object.keys(e.locales)[0];console.warn(`Locale '${this.options.locale}' could not be found; falling back to '${r}'.`),this.options.locale=r}this.i18n=e.locales[this.options.locale],n.use24HourTimeFormat===void 0&&(n.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,n){var r=n===void 0?{}:n,i=r.throwExceptionOnParseError,a=i===void 0?!0:i,o=r.verbose,s=o===void 0?!1:o,c=r.dayOfWeekStartIndexZero,l=c===void 0?!0:c,u=r.monthStartIndexZero,d=u===void 0?!1:u,f=r.use24HourTimeFormat,p=r.trimHoursLeadingZero,m=p===void 0?!1:p,h=r.locale,g=h===void 0?null:h,_=r.logicalAndDayFields,v={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:l,monthStartIndexZero:d,use24HourTimeFormat:f,trimHoursLeadingZero:m,locale:g,logicalAndDayFields:_===void 0?!1:_};return v.tzOffset&&console.warn(`'tzOffset' option has been deprecated and is no longer supported.`),new e(t,v).getFullDescription()},e.initialize=function(t,n){n===void 0&&(n=`en`),e.specialCharacters=[`/`,`-`,`,`,`*`],e.defaultLocale=n,t.load(e.locales)},e.prototype.getFullDescription=function(){var e,t=``;try{if(this.expressionParts=new i.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero).parse(),this.expressionParts[0]===`@reboot`)return(e=this.i18n).atReboot?.call(e)||`Run once, at startup`;var n=this.getTimeOfDayDescription(),r=this.getDayOfMonthDescription(),a=this.getMonthDescription(),o=this.getDayOfWeekDescription(),s=this.getYearDescription();t+=n+r+o+a+s,t=this.transformVerbosity(t,!!this.options.verbose),t=t.charAt(0).toLocaleUpperCase()+t.substr(1)}catch(e){if(!this.options.throwExceptionOnParseError)t=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw`${e}`}return t},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],n=this.expressionParts[1],i=this.expressionParts[2],a=``;if(!r.StringUtilities.containsAny(n,e.specialCharacters)&&!r.StringUtilities.containsAny(i,e.specialCharacters)&&!r.StringUtilities.containsAny(t,e.specialCharacters))a+=this.i18n.atSpace()+this.formatTime(i,n,t);else if(!t&&n.indexOf(`-`)>-1&&!(n.indexOf(`,`)>-1)&&!(n.indexOf(`/`)>-1)&&!r.StringUtilities.containsAny(i,e.specialCharacters)){var o=n.split(`-`);a+=r.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(i,o[0],``),this.formatTime(i,o[1],``))}else if(!t&&i.indexOf(`,`)>-1&&i.indexOf(`-`)==-1&&i.indexOf(`/`)==-1&&!r.StringUtilities.containsAny(n,e.specialCharacters)){var s=i.split(`,`);a+=this.i18n.at();for(var c=0;c<s.length;c++)a+=` `,a+=this.formatTime(s[c],n,``),c<s.length-2&&(a+=`,`),c==s.length-2&&(a+=this.i18n.spaceAnd())}else{var l=this.getSecondsDescription(),u=this.getMinutesDescription(),d=this.getHoursDescription();if(a+=l,a&&u&&(a+=`, `),a+=u,u===d)return a;a&&d&&(a+=`, `),a+=d}return a},e.prototype.getSecondsDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Seconds(t),t)},function(t){return e.i18n.secondsX0ThroughX1PastTheMinute()},function(t){return t==`0`?``:parseInt(t)<20?e.i18n.atX0SecondsPastTheMinute(t):e.i18n.atX0SecondsPastTheMinuteGt20()||e.i18n.atX0SecondsPastTheMinute(t)})},e.prototype.getMinutesDescription=function(){var e=this,t=this.expressionParts[0],n=this.expressionParts[2];return this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Minutes(t),t)},function(t){return e.i18n.minutesX0ThroughX1PastTheHour()},function(r){var i;try{return r==`0`&&n.indexOf(`/`)==-1&&t==``?e.i18n.everyHour():r==`0`?(i=e.i18n).onTheHour?.call(i)||e.i18n.atX0MinutesPastTheHour(r):parseInt(r)<20?e.i18n.atX0MinutesPastTheHour(r):e.i18n.atX0MinutesPastTheHourGt20()||e.i18n.atX0MinutesPastTheHour(r)}catch{return e.i18n.atX0MinutesPastTheHour(r)}})},e.prototype.getHoursDescription=function(){var e=this,t=this.expressionParts[2],n=0,i=[];t.split(`/`)[0].split(`,`).forEach(function(e){var t=e.split(`-`);t.length===2&&i.push({value:t[1],index:n+1}),n+=t.length});var a=0;return this.getSegmentDescription(t,this.i18n.everyHour(),function(t){var n=i.find(function(e){return e.value===t&&e.index===a})&&e.expressionParts[1]!==`0`;return a++,n?e.formatTime(t,`59`,``):e.formatTime(t,`0`,``)},function(t){return r.StringUtilities.format(e.i18n.everyX0Hours(t),t)},function(t){return e.i18n.betweenX0AndX1()},function(t){return e.i18n.atX0()})},e.prototype.getDayOfWeekDescription=function(){var e=this,t=this.i18n.daysOfTheWeek(),n=null;return n=this.expressionParts[5]==`*`?``:this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(n,r){var i=n;n.indexOf(`#`)>-1?i=n.substring(0,n.indexOf(`#`)):n.indexOf(`L`)>-1&&(i=i.replace(`L`,``));var a=parseInt(i),o=e.i18n.daysOfTheWeekInCase?e.i18n.daysOfTheWeekInCase(r)[a]:t[a];if(n.indexOf(`#`)>-1){var s=null,c=n.substring(n.indexOf(`#`)+1),l=n.substring(0,n.indexOf(`#`));switch(c){case`1`:s=e.i18n.first(l);break;case`2`:s=e.i18n.second(l);break;case`3`:s=e.i18n.third(l);break;case`4`:s=e.i18n.fourth(l);break;case`5`:s=e.i18n.fifth(l);break}o=s+` `+o}return o},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0DaysOfTheWeek(t),t)},function(t){var n=t.substring(0,t.indexOf(`-`));return e.expressionParts[3]==`*`?e.i18n.commaX0ThroughX1(n):e.i18n.commaAndX0ThroughX1(n)},function(t){var n=null;if(t.indexOf(`#`)>-1){var r=t.substring(t.indexOf(`#`)+1),i=t.substring(0,t.indexOf(`#`));n=e.i18n.commaOnThe(r,i).trim()+e.i18n.spaceX0OfTheMonth()}else n=t.indexOf(`L`)>-1?e.i18n.commaOnTheLastX0OfTheMonth(t.replace(`L`,``)):e.expressionParts[3]==`*`||e.options.logicalAndDayFields?e.i18n.commaOnlyOnX0(t):e.i18n.commaAndOnX0();return n}),n},e.prototype.getMonthDescription=function(){var e=this,t=this.i18n.monthsOfTheYear();return this.getSegmentDescription(this.expressionParts[4],``,function(n,r){return r&&e.i18n.monthsOfTheYearInCase?e.i18n.monthsOfTheYearInCase(r)[parseInt(n)-1]:t[parseInt(n)-1]},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0Months(t),t)},function(t){return e.i18n.commaMonthX0ThroughMonthX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInMonthX0?e.i18n.commaOnlyInMonthX0():e.i18n.commaOnlyInX0()})},e.prototype.getDayOfMonthDescription=function(){var e=this,t=null,n=this.expressionParts[3];switch(n){case`L`:t=this.i18n.commaOnTheLastDayOfTheMonth();break;case`WL`:case`LW`:t=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var i=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(i){var a=parseInt(i[0].replace(`W`,``)),o=a==1?this.i18n.firstWeekday():r.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());t=r.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),o);break}else{var s=n.match(/L-(\d{1,2})/);if(s){var c=s[1];t=r.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(c),c);break}else if(n==`*`&&this.expressionParts[5]!=`*`)return``;else t=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(t){return t==`L`?e.i18n.lastDay():e.i18n.dayX0?r.StringUtilities.format(e.i18n.dayX0(),t):t},function(t){return t==`1`?e.i18n.commaEveryDay():e.i18n.commaEveryX0Days(t)},function(t){return e.i18n.commaBetweenDayX0AndX1OfTheMonth(t)},function(t){return e.i18n.commaOnDayX0OfTheMonth(t)});break}}return t},e.prototype.getYearDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[6],``,function(e){return/^\d+$/.test(e)?new Date(parseInt(e),1).getFullYear().toString():e},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0Years(t),t)},function(t){return e.i18n.commaYearX0ThroughYearX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInYearX0?e.i18n.commaOnlyInYearX0():e.i18n.commaOnlyInX0()})},e.prototype.getSegmentDescription=function(e,t,n,i,a,o){var s=null,c=e.indexOf(`/`)>-1,l=e.indexOf(`-`)>-1,u=e.indexOf(`,`)>-1;if(!e)s=``;else if(e===`*`)s=t;else if(!c&&!l&&!u)s=r.StringUtilities.format(o(e),n(e));else if(u){for(var d=e.split(`,`),f=``,p=0;p<d.length;p++)if(p>0&&d.length>2&&(f+=`,`,p<d.length-1&&(f+=` `)),p>0&&d.length>1&&(p==d.length-1||d.length==2)&&(f+=`${this.i18n.spaceAnd()} `),d[p].indexOf(`/`)>-1||d[p].indexOf(`-`)>-1){var m=d[p].indexOf(`-`)>-1&&d[p].indexOf(`/`)==-1,h=this.getSegmentDescription(d[p],t,n,i,m?this.i18n.commaX0ThroughX1:a,o);m&&(h=h.replace(`, `,``)),f+=h}else if(!c)f+=n(d[p]);else{var g=this.getSegmentDescription(d[p],t,n,i,a,o);g&&g.startsWith(`, `)&&(g=g.substring(2)),f+=g}s=c?f:r.StringUtilities.format(o(e),f)}else if(c){var d=e.split(`/`);if(s=r.StringUtilities.format(i(d[1]),d[1]),d[0].indexOf(`-`)>-1){var _=this.generateRangeSegmentDescription(d[0],a,n);_.indexOf(`, `)!=0&&(s+=`, `),s+=_}else if(d[0].indexOf(`*`)==-1){var v=r.StringUtilities.format(o(d[0]),n(d[0]));v=v.replace(`, `,``),s+=r.StringUtilities.format(this.i18n.commaStartingX0(),v)}}else l&&(s=this.generateRangeSegmentDescription(e,a,n));return s},e.prototype.generateRangeSegmentDescription=function(e,t,n){var i=``,a=e.split(`-`),o=n(a[0],1),s=n(a[1],2),c=t(e);return i+=r.StringUtilities.format(c,o,s),i},e.prototype.formatTime=function(e,t,n){var r=0,i=0,a=parseInt(e)+r,o=parseInt(t)+i;o>=60?(o-=60,a+=1):o<0&&(o+=60,--a),a>=24?a-=24:a<0&&(a=24+a);var s=``,c=!1;this.options.use24HourTimeFormat||(c=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),s=c?`${this.getPeriod(a)} `:` ${this.getPeriod(a)}`,a>12&&(a-=12),a===0&&(a=12));var l=``;n&&(l=`:${(`00`+n).substring(n.length)}`);var u=a.toString(),d=(`00`+u).substring(u.length),f=o.toString(),p=(`00`+f).substring(f.length),m=this.options.trimHoursLeadingZero?u:d;return`${c?s:``}${m}:${p}${l}${c?``:s}`},e.prototype.transformVerbosity=function(e,t){if(!t&&(e=e.replace(RegExp(`, ${this.i18n.everyMinute()}`,`g`),``),e=e.replace(RegExp(`, ${this.i18n.everyHour()}`,`g`),``),e=e.replace(new RegExp(this.i18n.commaEveryDay(),`g`),``),e=e.replace(/\, ?$/,``),this.i18n.conciseVerbosityReplacements))for(var n=0,r=Object.entries(this.i18n.conciseVerbosityReplacements());n<r.length;n++){var i=r[n],a=i[0],o=i[1];e=e.replace(new RegExp(a,`g`),o)}return e},e.prototype.getPeriod=function(e){return e>=12?this.i18n.pm&&this.i18n.pm()||`PM`:this.i18n.am&&this.i18n.am()||`AM`},e.locales={},e}()},747(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.enLocaleLoader=void 0;var r=n(486);t.enLocaleLoader=function(){function e(){}return e.prototype.load=function(e){e.en=new r.en},e}()},486(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.en=void 0,t.en=function(){function e(){}return e.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},e.prototype.atX0MinutesPastTheHourGt20=function(){return null},e.prototype.commaMonthX0ThroughMonthX1=function(){return null},e.prototype.commaYearX0ThroughYearX1=function(){return null},e.prototype.use24HourTimeFormatByDefault=function(){return!1},e.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return`An error occurred when generating the expression description. Check the cron expression syntax.`},e.prototype.everyMinute=function(){return`every minute`},e.prototype.everyHour=function(){return`every hour`},e.prototype.atSpace=function(){return`At `},e.prototype.everyMinuteBetweenX0AndX1=function(){return`Every minute between %s and %s`},e.prototype.at=function(){return`At`},e.prototype.spaceAnd=function(){return` and`},e.prototype.everySecond=function(){return`every second`},e.prototype.everyX0Seconds=function(){return`every %s seconds`},e.prototype.secondsX0ThroughX1PastTheMinute=function(){return`seconds %s through %s past the minute`},e.prototype.atX0SecondsPastTheMinute=function(){return`at %s seconds past the minute`},e.prototype.everyX0Minutes=function(){return`every %s minutes`},e.prototype.minutesX0ThroughX1PastTheHour=function(){return`minutes %s through %s past the hour`},e.prototype.atX0MinutesPastTheHour=function(){return`at %s minutes past the hour`},e.prototype.everyX0Hours=function(){return`every %s hours`},e.prototype.betweenX0AndX1=function(){return`between %s and %s`},e.prototype.atX0=function(){return`at %s`},e.prototype.commaEveryDay=function(){return`, every day`},e.prototype.commaEveryX0DaysOfTheWeek=function(){return`, every %s days of the week`},e.prototype.commaX0ThroughX1=function(){return`, %s through %s`},e.prototype.commaAndX0ThroughX1=function(){return`, %s through %s`},e.prototype.first=function(){return`first`},e.prototype.second=function(){return`second`},e.prototype.third=function(){return`third`},e.prototype.fourth=function(){return`fourth`},e.prototype.fifth=function(){return`fifth`},e.prototype.commaOnThe=function(){return`, on the `},e.prototype.spaceX0OfTheMonth=function(){return` %s of the month`},e.prototype.lastDay=function(){return`the last day`},e.prototype.commaOnTheLastX0OfTheMonth=function(){return`, on the last %s of the month`},e.prototype.commaOnlyOnX0=function(){return`, only on %s`},e.prototype.commaAndOnX0=function(){return`, and on %s`},e.prototype.commaEveryX0Months=function(){return`, every %s months`},e.prototype.commaOnlyInX0=function(){return`, only in %s`},e.prototype.commaOnTheLastDayOfTheMonth=function(){return`, on the last day of the month`},e.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return`, on the last weekday of the month`},e.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return`, %s days before the last day of the month`},e.prototype.firstWeekday=function(){return`first weekday`},e.prototype.weekdayNearestDayX0=function(){return`weekday nearest day %s`},e.prototype.commaOnTheX0OfTheMonth=function(){return`, on the %s of the month`},e.prototype.commaEveryX0Days=function(){return`, every %s days in a month`},e.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return`, between day %s and %s of the month`},e.prototype.commaOnDayX0OfTheMonth=function(){return`, on day %s of the month`},e.prototype.commaEveryHour=function(){return`, every hour`},e.prototype.commaEveryX0Years=function(){return`, every %s years`},e.prototype.commaStartingX0=function(){return`, starting %s`},e.prototype.daysOfTheWeek=function(){return[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},e.prototype.monthsOfTheYear=function(){return[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},e.prototype.atReboot=function(){return`Run once, at startup`},e.prototype.onTheHour=function(){return`on the hour`},e}()},515(e,t){Object.defineProperty(t,`__esModule`,{value:!0});function n(e,t){if(!e)throw Error(t)}t.default=function(){function e(){}return e.secondRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`seconds part must be >= 0 and <= 59`)}},e.minuteRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`minutes part must be >= 0 and <= 59`)}},e.hourRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=23,`hours part must be >= 0 and <= 23`)}},e.dayOfMonthRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=1&&i<=31,`DOM part must be >= 1 and <= 31`)}},e.monthRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=1&&a<=12,t?`month part must be >= 0 and <= 11`:`month part must be >= 1 and <= 12`)}},e.dayOfWeekRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=0&&a<=6,t?`DOW part must be >= 0 and <= 6`:`DOW part must be >= 1 and <= 7`)}},e}()},823(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.StringUtilities=void 0,t.StringUtilities=function(){function e(){}return e.format=function(e){var t=[...arguments].slice(1);return e.replace(/%s/g,function(e){return t.shift()})},e.containsAny=function(e,t){return t.some(function(t){return e.indexOf(t)>-1})},e}()}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.toString=void 0;var t=n(333),i=n(747);t.ExpressionDescriptor.initialize(new i.enLocaleLoader),e.default=t.ExpressionDescriptor,e.toString=t.ExpressionDescriptor.toString})(),r})())}))(),1);function rW(e){return e?new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):`—`}function iW(e){try{return nW.default.toString(e,{use24HourTimeFormat:!0})}catch{return e}}function aW(e){var{task:t,onToggle:n,onEdit:r,onDelete:i,disabled:a}=e,[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(!1);function u(e){e.stopPropagation(),s(function(e){return!e})}function d(e){e.stopPropagation(),c?i(t.id):l(!0)}function f(e){e.stopPropagation(),l(!1)}function p(e){e.stopPropagation(),r(t)}function m(e){e.stopPropagation(),n(t.id)}return(0,b.jsxs)(`div`,{className:`bg-base-200 border border-base-content/15 rounded-lg overflow-hidden`,children:[(0,b.jsxs)(`div`,{tabIndex:0,role:`button`,className:`flex items-center gap-2.5 px-3 py-2.5 cursor-pointer hover:bg-base-300/50 transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,onClick:u,onKeyDown:function(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s(function(e){return!e}))},"aria-expanded":o,children:[(0,b.jsx)(`span`,{className:`text-base-content/40 flex-shrink-0`,children:o?(0,b.jsx)(nu,{className:`!size-3.5`}):(0,b.jsx)(ou,{className:`!size-3.5`})}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,b.jsx)(`span`,{className:`text-[13px] font-medium truncate ${t.enabled?`text-base-content`:`text-base-content/40`}`,children:t.name})}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/40 truncate mt-0.5`,children:iW(t.cron)})]}),(0,b.jsx)(`label`,{className:`swap flex-shrink-0`,onClick:a?void 0:m,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-primary toggle-xs`,checked:t.enabled,disabled:a,"aria-label":`Toggle `+t.name,onChange:function(){}})})]}),o&&(0,b.jsx)(`div`,{className:`px-3 pb-3 border-t border-base-content/15 bg-base-100/50`,children:(0,b.jsxs)(`div`,{className:`pt-2.5 space-y-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{className:`text-[11px] text-base-content/40 uppercase tracking-wider`,children:`Prompt`}),(0,b.jsx)(`p`,{className:`text-[12px] text-base-content/80 mt-0.5 whitespace-pre-wrap break-words leading-relaxed`,children:t.prompt})]}),(0,b.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{className:`text-[11px] text-base-content/40 uppercase tracking-wider`,children:`Last Run`}),(0,b.jsx)(`p`,{className:`text-[12px] text-base-content/70 mt-0.5`,children:rW(t.lastRunAt)})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{className:`text-[11px] text-base-content/40 uppercase tracking-wider`,children:`Next Run`}),(0,b.jsx)(`p`,{className:`text-[12px] text-base-content/70 mt-0.5`,children:rW(t.nextRunAt)})]})]}),!a&&(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 pt-1`,children:[(0,b.jsxs)(`button`,{onClick:p,className:`btn btn-ghost btn-xs border border-base-content/15 text-base-content/70 gap-1 outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,children:[(0,b.jsx)(bb,{className:`!size-3`}),`Edit`]}),c?(0,b.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,b.jsx)(`button`,{onClick:d,className:`btn btn-error btn-xs outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,children:`Confirm Delete`}),(0,b.jsx)(`button`,{onClick:f,className:`btn btn-ghost btn-xs border border-base-content/15 outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,children:`Cancel`})]}):(0,b.jsx)(`button`,{onClick:d,className:`btn btn-ghost btn-xs border border-base-content/15 text-base-content/50 outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-base-200`,"aria-label":`Delete task`,children:(0,b.jsx)(XC,{className:`!size-3`})})]})]})})]})}function oW(e){if(!e.trim())return``;try{return nW.default.toString(e.trim(),{use24HourTimeFormat:!0})}catch{return`Invalid cron expression`}}function sW(e){var{task:t,onSave:n,onClose:r}=e,[i,a]=(0,x.useState)(t?t.name:``),[o,s]=(0,x.useState)(t?t.prompt:``),[c,l]=(0,x.useState)(t?t.cron:`0 9 * * 1-5`),u=(0,x.useRef)(null);Ur(u,(0,x.useCallback)(function(){r()},[r]));var d=oW(c),f=d!==`Invalid cron expression`&&d!==``;function p(e){e.preventDefault(),!(!i.trim()||!o.trim()||!f)&&n({name:i.trim(),prompt:o.trim(),cron:c.trim()})}function m(e){e.target===e.currentTarget&&r()}return(0,b.jsx)(`div`,{ref:u,className:`fixed inset-0 z-[9999] flex items-center justify-center bg-base-content/50 backdrop-blur-sm`,onClick:m,role:`dialog`,"aria-modal":`true`,"aria-label":t?`Edit Task`:`New Scheduled Task`,children:(0,b.jsxs)(`div`,{className:`bg-base-200 border border-base-content/15 rounded-2xl shadow-2xl w-full max-w-md mx-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-base-content/15`,children:[(0,b.jsx)(`h2`,{className:`text-[14px] font-semibold text-base-content`,children:t?`Edit Task`:`New Scheduled Task`}),(0,b.jsx)(`button`,{onClick:r,"aria-label":`Close`,className:`btn btn-ghost btn-xs btn-square text-base-content/50`,children:(0,b.jsx)(iw,{size:14})})]}),(0,b.jsxs)(`form`,{onSubmit:p,className:`p-5 space-y-4`,children:[(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(`label`,{htmlFor:`task-name`,className:`text-[12px] font-semibold text-base-content/40 uppercase tracking-wider`,children:`Name`}),(0,b.jsx)(`input`,{id:`task-name`,type:`text`,className:`w-full h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[13px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`,placeholder:`Daily standup summary`,value:i,onChange:function(e){a(e.target.value)},autoFocus:!0})]}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(`label`,{htmlFor:`task-prompt`,className:`text-[12px] font-semibold text-base-content/40 uppercase tracking-wider`,children:`Prompt`}),(0,b.jsx)(`textarea`,{id:`task-prompt`,className:`w-full px-3 py-2.5 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[13px] min-h-[96px] resize-y leading-relaxed focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`,placeholder:`Summarize yesterday's work and create a plan for today...`,value:o,onChange:function(e){s(e.target.value)}})]}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(`label`,{htmlFor:`task-cron`,className:`text-[12px] font-semibold text-base-content/40 uppercase tracking-wider`,children:`Cron Expression`}),(0,b.jsx)(`input`,{id:`task-cron`,type:`text`,className:`w-full h-9 px-3 bg-base-300 border rounded-xl text-base-content text-[13px] font-mono focus:border-primary focus-visible:outline-none transition-colors duration-[120ms] ${c.trim()&&!f?`border-error`:`border-base-content/15`}`,placeholder:`0 9 * * 1-5`,value:c,onChange:function(e){l(e.target.value)},"aria-invalid":c.trim()&&!f?`true`:void 0,"aria-describedby":c.trim()?`cron-preview`:void 0}),c.trim()&&(0,b.jsx)(`p`,{id:`cron-preview`,className:`text-[11px] mt-1 ${f?`text-primary/80`:`text-error`}`,children:d})]}),(0,b.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,b.jsx)(`button`,{type:`submit`,className:`btn btn-primary btn-sm flex-1`,disabled:!i.trim()||!o.trim()||!f,children:t?`Save Changes`:`Create Task`}),(0,b.jsx)(`button`,{type:`button`,onClick:r,className:`btn btn-ghost btn-sm border border-base-content/15`,children:`Cancel`})]})]})]})})}function cW(){var{send:e,subscribe:t,unsubscribe:n}=z(),{activeProjectSlug:r}=ST(),i=CT(),[a,o]=(0,x.useState)([]),[s,c]=(0,x.useState)(void 0),l=(0,x.useCallback)(function(e){if(e.type===`scheduler:tasks`){o(e.tasks);return}if(e.type===`scheduler:task_created`){o(function(t){return[...t,e.task]});return}if(e.type===`scheduler:task_updated`){o(function(t){return t.map(function(t){return t.id===e.task.id?e.task:t})});return}},[]);(0,x.useEffect)(function(){return t(`scheduler:tasks`,l),t(`scheduler:task_created`,l),t(`scheduler:task_updated`,l),e({type:`scheduler:list`}),function(){n(`scheduler:tasks`,l),n(`scheduler:task_created`,l),n(`scheduler:task_updated`,l)}},[e,t,n,l]);var u=a.filter(function(e){return e.projectSlug===r});function d(t){e({type:`scheduler:toggle`,taskId:t})}function f(t){e({type:`scheduler:delete`,taskId:t}),o(function(e){return e.filter(function(e){return e.id!==t})})}function p(t){if(s===null){if(!r)return;e({type:`scheduler:create`,name:t.name,prompt:t.prompt,cron:t.cron,projectSlug:r})}else s&&e({type:`scheduler:update`,taskId:s.id,name:t.name,prompt:t.prompt,cron:t.cron});c(void 0)}return(0,b.jsxs)(`div`,{className:`flex flex-col h-full bg-base-100`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-base-content/15`,children:[(0,b.jsx)(`span`,{className:`text-[13px] font-semibold text-base-content`,children:`Scheduled Tasks`}),(0,b.jsx)(`button`,{onClick:function(){c(null)},disabled:!i,className:`btn btn-primary btn-xs`,children:`New Task`})]}),(0,b.jsx)(`div`,{className:`flex-1 overflow-auto p-3`,children:u.length===0?(0,b.jsxs)(`div`,{className:`flex flex-col items-center justify-center text-center mt-16 gap-3`,children:[(0,b.jsx)(Qc,{size:28,className:`text-base-content/15`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[13px] text-base-content/40`,children:`No scheduled tasks for this project`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30 mt-1`,children:`Automate Claude prompts on a cron schedule. Click "New Task" to create one.`})]})]}):(0,b.jsx)(`div`,{className:`space-y-2`,children:u.map(function(e){return(0,b.jsx)(aW,{task:e,onToggle:d,onEdit:function(e){c(e)},onDelete:f,disabled:!i},e.id)})})}),s!==void 0&&(0,b.jsx)(sW,{task:s,projectSlug:r??``,onSave:p,onClose:function(){c(void 0)}})]})}function lW(e){var t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return n+`s ago`;var r=Math.floor(n/60);if(r<60)return r+`m ago`;var i=Math.floor(r/60);return i<24?i+`h ago`:Math.floor(i/24)+`d ago`}function uW(){var{allBookmarks:e,requestAllBookmarks:t}=IN(),{activateSession:n}=ST(),{projects:r}=Gw();(0,x.useEffect)(function(){t()},[]);var i=(0,x.useMemo)(function(){for(var t=new Map,n=0;n<e.length;n++){var r=e[n];t.has(r.projectSlug)||t.set(r.projectSlug,new Map);var i=t.get(r.projectSlug);i.has(r.sessionId)||i.set(r.sessionId,[]),i.get(r.sessionId).push(r)}var a=[];return t.forEach(function(e,t){var n=[];e.forEach(function(e,t){n.push({sessionId:t,bookmarks:e})}),n.sort(function(e,t){return t.bookmarks[0].createdAt-e.bookmarks[0].createdAt}),a.push({projectSlug:t,sessions:n})}),a.sort(function(e,t){var n=e.sessions[0]?.bookmarks[0]?.createdAt??0;return(t.sessions[0]?.bookmarks[0]?.createdAt??0)-n}),a},[e]);function a(e){for(var t=0;t<r.length;t++)if(r[t].slug===e)return r[t].title;return e}function o(e){n(e.projectSlug,e.sessionId),hw(`chat`),setTimeout(function(){var t=document.getElementById(`msg-`+e.messageUuid);t&&(t.scrollIntoView({behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`,block:`center`}),t.classList.add(`ring-2`,`ring-warning/40`),setTimeout(function(){t.classList.remove(`ring-2`,`ring-warning/40`)},2e3))},500)}return(0,b.jsxs)(`div`,{className:`flex flex-col h-full w-full overflow-hidden`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 border-b border-base-content/10 bg-base-100 flex-shrink-0`,children:[(0,b.jsx)(Ys,{size:16,className:`text-warning`}),(0,b.jsx)(`span`,{className:`text-sm font-semibold text-base-content`,children:`Bookmarks`}),(0,b.jsxs)(`span`,{className:`text-[10px] font-mono text-base-content/30 ml-auto`,children:[e.length,` total`]})]}),(0,b.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:e.length===0?(0,b.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-base-content/30 gap-3`,children:[(0,b.jsx)(Ys,{size:32,className:`text-base-content/15`}),(0,b.jsx)(`div`,{className:`text-[13px] font-mono`,children:`No bookmarks yet`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/20 max-w-[260px] text-center`,children:`Bookmark messages in chat to quickly find them later.`})]}):(0,b.jsx)(`div`,{className:`flex flex-col gap-4`,children:i.map(function(e){return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[10px] uppercase tracking-widest text-base-content/40 font-mono font-bold mb-2`,children:a(e.projectSlug)}),(0,b.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.sessions.map(function(e){return(0,b.jsxs)(`div`,{className:`bg-base-200/50 border border-base-content/8 rounded-lg overflow-hidden`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-base-content/5`,children:[(0,b.jsx)(W_,{size:11,className:`text-base-content/30`}),(0,b.jsxs)(`span`,{className:`text-[11px] font-mono text-base-content/40 truncate`,children:[e.sessionId.slice(0,12),`...`]})]}),(0,b.jsx)(`div`,{className:`flex flex-col`,children:e.bookmarks.map(function(e){return(0,b.jsxs)(`button`,{type:`button`,onClick:function(){o(e)},className:`flex items-start gap-2 px-3 py-2 hover:bg-base-content/5 transition-colors text-left w-full`,children:[(0,b.jsx)(Ys,{size:10,className:`text-warning/60 mt-0.5 flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`div`,{className:`text-[12px] text-base-content/70 line-clamp-2`,children:e.messageText}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,b.jsx)(`span`,{className:`text-[9px] text-base-content/25 font-mono`,children:e.messageType}),(0,b.jsx)(`span`,{className:`text-[9px] text-base-content/20 font-mono`,children:lW(e.createdAt)})]})]}),(0,b.jsx)(xm,{size:10,className:`text-base-content/20 mt-1 flex-shrink-0`})]},e.id)})})]},e.sessionId)})})]},e.projectSlug)})})})]})}var dW=`
|
|
117
117
|
:root {
|
|
118
118
|
--bg-primary: oklch(var(--b1));
|
|
@@ -514,4 +514,4 @@ description: `+t+`
|
|
|
514
514
|
type: `+n+`
|
|
515
515
|
---
|
|
516
516
|
`+r}function GFe({memory:e,onClick:t,onDelete:n}){var[r,i]=(0,x.useState)(!1);return(0,b.jsxs)(`div`,{onClick:t,className:`flex items-start gap-3 px-3 py-2.5 bg-base-300 border border-base-content/15 rounded-xl transition-colors duration-[120ms] cursor-pointer hover:border-base-content/30 hover:bg-base-300/80`,role:`button`,tabIndex:0,onKeyDown:function(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},children:[(0,b.jsx)(cc,{size:14,className:`text-base-content/25 mt-0.5 flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-[13px] font-bold text-base-content truncate`,children:e.name||e.filename}),(0,b.jsx)(`span`,{className:`shrink-0 text-[10px] font-mono px-1.5 py-0.5 rounded-md bg-base-content/8 text-base-content/40`,children:e.type})]}),e.description&&(0,b.jsx)(`div`,{className:`text-[12px] text-base-content/40 mt-0.5 line-clamp-2`,children:e.description})]}),(0,b.jsx)(`div`,{className:`flex gap-1 flex-shrink-0 mt-0.5`,onClick:function(e){e.stopPropagation()},children:r?(0,b.jsxs)(`div`,{className:`flex gap-1`,children:[(0,b.jsx)(`button`,{onClick:function(){n(),i(!1)},className:`btn btn-error btn-xs`,children:`Delete`}),(0,b.jsx)(`button`,{onClick:function(){i(!1)},className:`btn btn-ghost btn-xs`,children:`Cancel`})]}):(0,b.jsx)(`button`,{onClick:function(){i(!0)},"aria-label":`Delete `+e.name,className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-error focus-visible:ring-2 focus-visible:ring-primary`,children:(0,b.jsx)(XC,{size:12})})})]})}function KFe({memory:e,content:t,onClose:n,onEdit:r}){var i=g9(t),a=Object.keys(i.meta).length>0,o=(0,x.useRef)(null);return Ur(o,(0,x.useCallback)(function(){n()},[n])),(0,b.jsxs)(`div`,{ref:o,className:`fixed inset-0 z-[9999] flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"aria-label":`Memory: `+(i.meta.name||e.filename),children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-base-content/50`,onClick:n}),(0,b.jsxs)(`div`,{className:`relative bg-base-200 border border-base-content/15 rounded-2xl shadow-2xl w-full max-w-2xl mx-4 max-h-[80vh] flex flex-col overflow-hidden`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-base-content/15 flex-shrink-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,b.jsx)(cc,{size:16,className:`text-primary flex-shrink-0`}),(0,b.jsx)(`h2`,{className:`text-[15px] font-mono font-bold text-base-content truncate`,children:i.meta.name||e.filename})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,b.jsxs)(`button`,{onClick:r,className:`btn btn-ghost btn-xs gap-1.5 text-base-content/50 hover:text-base-content`,children:[(0,b.jsx)(bb,{size:12}),`Edit`]}),(0,b.jsx)(`button`,{onClick:n,"aria-label":`Close`,className:`btn btn-ghost btn-xs btn-square text-base-content/40 hover:text-base-content`,children:(0,b.jsx)(iw,{size:16})})]})]}),(0,b.jsxs)(`div`,{className:`overflow-y-auto flex-1`,children:[a&&(0,b.jsx)(`div`,{className:`px-5 py-3 border-b border-base-content/10 bg-base-300/30`,children:(0,b.jsx)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1.5`,children:Object.entries(i.meta).map(function([e,t]){return(0,b.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-[11px] font-mono text-base-content/35 uppercase tracking-wider`,children:e}),(0,b.jsx)(`span`,{className:`text-[12px] text-base-content/70`,children:t})]},e)})})}),(0,b.jsx)(`div`,{className:`px-5 py-4`,children:(0,b.jsx)(`div`,{className:`prose prose-sm max-w-none prose-headings:text-base-content prose-headings:font-mono prose-p:text-base-content/70 prose-strong:text-base-content prose-code:text-base-content/60 prose-code:bg-base-100/50 prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:text-[11px] prose-pre:bg-base-100 prose-pre:text-base-content/70 prose-pre:text-[11px] prose-a:text-primary prose-li:text-base-content/70 prose-li:marker:text-base-content/30 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,children:(0,b.jsx)(dk,{remarkPlugins:[hM],children:i.body})})})]}),(0,b.jsx)(`div`,{className:`px-5 py-3 border-t border-base-content/15 flex-shrink-0`,children:(0,b.jsx)(`div`,{className:`text-[11px] font-mono text-base-content/30 truncate`,children:e.filename})})]})]})}function qFe({memory:e,initialContent:t,onClose:n,onSave:r,isSaving:i}){var a=e===null,o=g9(t),[s,c]=(0,x.useState)(o.meta.name||(e?e.name:``)),[l,u]=(0,x.useState)(o.meta.description||(e?e.description:``)),[d,f]=(0,x.useState)(o.meta.type||(e?e.type:`project`)),[p,m]=(0,x.useState)(o.body),h=(0,x.useRef)(null);Ur(h,(0,x.useCallback)(function(){n()},[n]));function g(){var t=WFe(s,l,d,p);r(a?UFe(s)+`.md`:e.filename,t)}return(0,b.jsxs)(`div`,{ref:h,className:`fixed inset-0 z-[9999] flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"aria-label":a?`New Memory`:`Edit Memory`,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-base-content/50`,onClick:n}),(0,b.jsxs)(`div`,{className:`relative bg-base-200 border border-base-content/15 rounded-2xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] flex flex-col overflow-hidden`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-base-content/15 flex-shrink-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(cc,{size:16,className:`text-primary flex-shrink-0`}),(0,b.jsx)(`h2`,{className:`text-[15px] font-mono font-bold text-base-content`,children:a?`New Memory`:`Edit Memory`})]}),(0,b.jsx)(`button`,{onClick:n,"aria-label":`Close`,className:`btn btn-ghost btn-xs btn-square text-base-content/40 hover:text-base-content`,children:(0,b.jsx)(iw,{size:16})})]}),(0,b.jsxs)(`div`,{className:`overflow-y-auto flex-1 px-5 py-4 space-y-4`,children:[(0,b.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,b.jsxs)(`div`,{className:`col-span-2`,children:[(0,b.jsx)(`label`,{className:`text-[11px] font-mono text-base-content/40 uppercase tracking-wider mb-1.5 block`,children:`Name`}),(0,b.jsx)(`input`,{type:`text`,value:s,onChange:function(e){c(e.target.value)},className:`input input-sm w-full bg-base-300 border-base-content/15 text-[13px]`,placeholder:`Memory name`})]}),(0,b.jsxs)(`div`,{className:`col-span-2`,children:[(0,b.jsx)(`label`,{className:`text-[11px] font-mono text-base-content/40 uppercase tracking-wider mb-1.5 block`,children:`Description`}),(0,b.jsx)(`input`,{type:`text`,value:l,onChange:function(e){u(e.target.value)},className:`input input-sm w-full bg-base-300 border-base-content/15 text-[13px]`,placeholder:`Brief description`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`text-[11px] font-mono text-base-content/40 uppercase tracking-wider mb-1.5 block`,children:`Type`}),(0,b.jsx)(`select`,{value:d,onChange:function(e){f(e.target.value)},className:`select select-sm w-full bg-base-300 border-base-content/15 text-[13px]`,children:HFe.map(function(e){return(0,b.jsx)(`option`,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e)})})]}),!a&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`text-[11px] font-mono text-base-content/40 uppercase tracking-wider mb-1.5 block`,children:`Filename`}),(0,b.jsx)(`input`,{type:`text`,value:e.filename,readOnly:!0,className:`input input-sm w-full bg-base-100/50 border-base-content/10 text-[13px] text-base-content/40 cursor-not-allowed`})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`text-[11px] font-mono text-base-content/40 uppercase tracking-wider mb-1.5 block`,children:`Content`}),(0,b.jsx)(`textarea`,{value:p,onChange:function(e){m(e.target.value)},className:`textarea w-full bg-base-300 border-base-content/15 text-[13px] font-mono resize-none min-h-[200px]`,placeholder:`Memory content (markdown supported)`})]})]}),(0,b.jsxs)(`div`,{className:`px-5 py-3 border-t border-base-content/15 flex items-center justify-end gap-2 flex-shrink-0`,children:[(0,b.jsx)(`button`,{onClick:n,className:`btn btn-ghost btn-sm`,children:`Cancel`}),(0,b.jsxs)(`button`,{onClick:g,disabled:i||!s.trim(),className:`btn btn-primary btn-sm gap-1.5`,children:[i&&(0,b.jsx)(gg,{size:12,className:`animate-spin`}),a?`Create`:`Save`]})]})]})]})}function _9({projectSlug:e}){var{send:t,subscribe:n,unsubscribe:r}=z(),[i,a]=(0,x.useState)([]),[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(null),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(!1),[m,h]=(0,x.useState)(null);(0,x.useEffect)(function(){function e(e){e.type===`memory:list_result`&&(a(e.memories),s(!1))}function t(e){if(e.type===`memory:view_result`){var t=e;h(function(e){return e&&l({memory:e,content:t.content}),null})}}function i(e){e.type===`memory:save_result`&&(p(!1),d(null),l(null))}function o(e){e.type}return n(`memory:list_result`,e),n(`memory:view_result`,t),n(`memory:save_result`,i),n(`memory:delete_result`,o),function(){r(`memory:list_result`,e),r(`memory:view_result`,t),r(`memory:save_result`,i),r(`memory:delete_result`,o)}},[]),(0,x.useEffect)(function(){e&&(s(!0),t({type:`memory:list`,projectSlug:e}))},[e]);function g(n){h(n),t({type:`memory:view`,projectSlug:e,filename:n.filename})}function _(n){t({type:`memory:delete`,projectSlug:e,filename:n.filename})}function v(n,r){p(!0),t({type:`memory:save`,projectSlug:e,filename:n,content:r})}function y(){c&&(d({memory:c.memory,content:c.content}),l(null))}for(var S={},C=0;C<i.length;C++){var w=i[C],T=w.type||`other`;S[T]||(S[T]=[]),S[T].push(w)}var E=Object.keys(S);return(0,b.jsxs)(`div`,{className:`py-2 space-y-6`,children:[(0,b.jsxs)(`a`,{href:`https://docs.anthropic.com/en/docs/claude-code/memory`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[11px] text-base-content/30 hover:text-primary/70 flex items-center gap-1 transition-colors`,children:[(0,b.jsx)(xm,{size:11}),`Claude Code docs`]}),(0,b.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,b.jsxs)(`button`,{onClick:function(){d({memory:null,content:``})},className:`btn btn-primary btn-sm gap-1.5`,children:[(0,b.jsx)($b,{size:13}),`New Memory`]})}),o&&(0,b.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,b.jsx)(gg,{size:18,className:`animate-spin text-base-content/30`})}),!o&&i.length===0&&(0,b.jsx)(`div`,{className:`py-12 text-center text-[13px] text-base-content/40`,children:`No memories found.`}),!o&&E.map(function(e){return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:e.charAt(0).toUpperCase()+e.slice(1)}),(0,b.jsx)(`div`,{className:`space-y-2`,children:S[e].map(function(e){return(0,b.jsx)(GFe,{memory:e,onClick:function(){g(e)},onDelete:function(){_(e)}},e.filename)})})]},e)}),c&&(0,b.jsx)(KFe,{memory:c.memory,content:c.content,onClose:function(){l(null)},onEdit:y}),u!==null&&(0,b.jsx)(qFe,{memory:u.memory,initialContent:u.content,onClose:function(){d(null)},onSave:v,isSaving:f})]})}function JFe(){return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`a`,{href:`https://docs.anthropic.com/en/docs/claude-code/memory`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[11px] text-base-content/30 hover:text-primary/70 flex items-center gap-1 mb-4 transition-colors`,children:[(0,b.jsx)(xm,{size:11}),`Claude Code docs`]}),(0,b.jsx)(_9,{projectSlug:`__global__`})]})}function YFe(){var{send:e,subscribe:t,unsubscribe:n}=z(),[r,i]=(0,x.useState)([]),[a,o]=(0,x.useState)([]),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(null),[d,f]=(0,x.useState)(``),[p,m]=(0,x.useState)([]),[h,g]=(0,x.useState)(!1),[_,v]=(0,x.useState)(!1),[y,S]=(0,x.useState)(null),[C,w]=(0,x.useState)(null),[T,E]=(0,x.useState)(null),[D,O]=(0,x.useState)(null),[k,A]=(0,x.useState)(null),[j,M]=(0,x.useState)([]),[N,ee]=(0,x.useState)([]),[te,P]=(0,x.useState)(!1),F=(0,x.useRef)(null);(0,x.useEffect)(function(){function r(e){e.type===`plugin:list_result`&&(i(e.plugins),c(!0))}function a(e){e.type===`plugin:marketplaces_result`&&o(e.marketplaces)}function s(e){e.type===`plugin:search_result`&&(m(e.plugins),g(!1),v(!0))}function l(e){if(e.type===`plugin:install_result`){var t=e;S(null),ne(t.message??(t.success?`Installed`:`Install failed`),t.success)}}function d(e){if(e.type===`plugin:uninstall_result`){var t=e;w(null),ne(t.message??(t.success?`Uninstalled`:`Uninstall failed`),t.success)}}function f(e){if(e.type===`plugin:update_result`){var t=e;E(null),ne(t.message??(t.success?`Updated`:`Update failed`),t.success)}}function p(e){e.type===`plugin:details_result`&&u(e.plugin)}function h(e){e.type===`plugin:errors_result`&&M(e.errors)}function _(e){e.type===`plugin:discover_result`&&(ee(e.plugins),P(!0))}return t(`plugin:list_result`,r),t(`plugin:marketplaces_result`,a),t(`plugin:search_result`,s),t(`plugin:install_result`,l),t(`plugin:uninstall_result`,d),t(`plugin:update_result`,f),t(`plugin:details_result`,p),t(`plugin:errors_result`,h),t(`plugin:discover_result`,_),e({type:`plugin:list`}),e({type:`plugin:marketplaces`}),e({type:`plugin:errors`}),e({type:`plugin:discover`}),function(){n(`plugin:list_result`,r),n(`plugin:marketplaces_result`,a),n(`plugin:search_result`,s),n(`plugin:install_result`,l),n(`plugin:uninstall_result`,d),n(`plugin:update_result`,f),n(`plugin:details_result`,p),n(`plugin:errors_result`,h),n(`plugin:discover_result`,_)}},[]);function ne(e,t){A({text:e,success:t}),setTimeout(function(){A(null)},3e3)}function re(t){e({type:`plugin:details`,name:t.name,marketplace:t.marketplace})}function ie(t,n){S(t+`@`+n),e({type:`plugin:install`,name:t,marketplace:n})}function ae(t){w(t.key),O(null),e({type:`plugin:uninstall`,name:t.name,marketplace:t.marketplace})}function oe(t){E(t.key),e({type:`plugin:update`,name:t.name,marketplace:t.marketplace})}var I=(0,x.useCallback)(function(t){if(f(t),F.current&&clearTimeout(F.current),!t.trim()){m([]),v(!1),g(!1);return}g(!0),F.current=setTimeout(function(){e({type:`plugin:search`,query:t.trim()})},300)},[e]);return s?(0,b.jsxs)(`div`,{className:`py-2 space-y-8`,children:[k&&(0,b.jsx)(`div`,{className:`text-[12px] px-3 py-2 rounded-lg border `+(k.success?`bg-success/10 border-success/20 text-success`:`bg-error/10 border-error/20 text-error`),children:k.text}),j.length>0&&(0,b.jsx)(tIe,{errors:j}),(0,b.jsx)(XFe,{plugins:r,updatingKey:T,uninstallingKey:C,confirmUninstall:D,onViewDetails:re,onUpdate:oe,onUninstall:ae,onConfirmUninstall:O}),(0,b.jsx)(QFe,{query:d,results:p,searching:h,hasSearched:_,installingKey:y,installedKeys:new Set(r.map(function(e){return e.key})),onSearch:I,onInstall:ie}),(0,b.jsx)(nIe,{plugins:N,loaded:te,installingKey:y,installedKeys:new Set(r.map(function(e){return e.key})),onInstall:ie}),(0,b.jsx)($Fe,{marketplaces:a}),l&&(0,b.jsx)(eIe,{plugin:l,onClose:function(){u(null)}})]}):(0,b.jsx)(`div`,{className:`py-4 space-y-3 animate-pulse`,children:[0,1,2].map(function(e){return(0,b.jsx)(`div`,{className:`bg-base-content/[0.03] rounded-xl h-16`},e)})})}function XFe({plugins:e,updatingKey:t,uninstallingKey:n,confirmUninstall:r,onViewDetails:i,onUpdate:a,onUninstall:o,onConfirmUninstall:s}){return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Installed Plugins`}),e.length===0?(0,b.jsxs)(`div`,{className:`py-6 text-center`,children:[(0,b.jsx)(`div`,{className:`text-[12px] text-base-content/30 mb-0.5`,children:`No plugins installed`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/20`,children:`Browse the marketplace or search below to add plugins.`})]}):(0,b.jsx)(`div`,{className:`space-y-2`,children:e.map(function(e){return(0,b.jsx)(ZFe,{plugin:e,isUpdating:t===e.key,isUninstalling:n===e.key,isConfirmingUninstall:r===e.key,onViewDetails:function(){i(e)},onUpdate:function(){a(e)},onUninstall:function(){o(e)},onConfirmUninstall:function(){s(e.key)},onCancelUninstall:function(){s(null)}},e.key)})})]})}function ZFe({plugin:e,isUpdating:t,isUninstalling:n,isConfirmingUninstall:r,onViewDetails:i,onUpdate:a,onUninstall:o,onConfirmUninstall:s,onCancelUninstall:c}){return(0,b.jsxs)(`div`,{onClick:i,className:`flex items-start gap-3 px-3 py-2.5 bg-base-300 border border-base-content/15 rounded-xl cursor-pointer hover:border-base-content/30 hover:bg-base-300/80 transition-colors duration-[120ms]`,role:`button`,tabIndex:0,onKeyDown:function(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},children:[(0,b.jsx)(us,{size:14,className:`text-base-content/25 mt-0.5 flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-[13px] font-bold text-base-content truncate`,children:e.name}),(0,b.jsxs)(`span`,{className:`shrink-0 text-[10px] font-mono px-1.5 py-0.5 rounded-md bg-base-content/8 text-base-content/40`,children:[`v`,e.version]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-3 mt-0.5`,children:[(0,b.jsx)(`span`,{className:`text-[11px] text-base-content/30`,children:e.marketplace}),(0,b.jsxs)(`span`,{className:`text-[11px] text-base-content/25`,children:[e.skillCount,` skill`,e.skillCount===1?``:`s`,e.hookCount>0?`, `+e.hookCount+` hook`+(e.hookCount===1?``:`s`):``,e.ruleCount>0?`, `+e.ruleCount+` rule`+(e.ruleCount===1?``:`s`):``]})]}),e.description&&(0,b.jsx)(`div`,{className:`text-[12px] text-base-content/40 mt-0.5 line-clamp-1`,children:e.description})]}),(0,b.jsxs)(`div`,{className:`flex gap-1 flex-shrink-0 mt-0.5`,onClick:function(e){e.stopPropagation()},children:[t?(0,b.jsx)(gg,{size:12,className:`text-primary animate-spin mt-1 mx-1`}):(0,b.jsx)(`button`,{onClick:a,"aria-label":`Update `+e.name,className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-info focus-visible:ring-2 focus-visible:ring-primary`,children:(0,b.jsx)(eS,{size:12})}),r?(0,b.jsxs)(`div`,{className:`flex gap-1`,children:[(0,b.jsx)(`button`,{onClick:o,className:`btn btn-error btn-xs`,disabled:n,children:n?(0,b.jsx)(gg,{size:10,className:`animate-spin`}):`Remove`}),(0,b.jsx)(`button`,{onClick:c,className:`btn btn-ghost btn-xs`,children:`Cancel`})]}):(0,b.jsx)(`button`,{onClick:s,"aria-label":`Remove `+e.name,className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-error focus-visible:ring-2 focus-visible:ring-primary`,children:(0,b.jsx)(XC,{size:12})})]})]})}function QFe({query:e,results:t,searching:n,hasSearched:r,installingKey:i,installedKeys:a,onSearch:o,onInstall:s}){return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Browse Marketplace`}),(0,b.jsxs)(`div`,{className:`relative mb-3`,children:[(0,b.jsx)(pC,{size:13,className:`absolute left-3 top-1/2 -translate-y-1/2 text-base-content/30 pointer-events-none`}),(0,b.jsx)(`input`,{type:`text`,value:e,onChange:function(e){o(e.target.value)},placeholder:`Search plugins...`,className:`w-full bg-base-300 border border-base-content/15 rounded-xl pl-8 pr-3 py-2.5 text-[13px] text-base-content placeholder:text-base-content/30 focus:outline-none focus:border-primary transition-colors`}),n&&(0,b.jsx)(gg,{size:13,className:`absolute right-3 top-1/2 -translate-y-1/2 text-primary animate-spin`})]}),r&&t.length===0&&!n&&(0,b.jsxs)(`div`,{className:`py-4 text-center text-[13px] text-base-content/30`,children:[`No plugins found for "`,e,`"`]}),t.length>0&&(0,b.jsx)(`div`,{className:`space-y-2`,children:t.map(function(e){var t=e.name+`@`+e.marketplace,n=a.has(t),r=i===t;return(0,b.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-2.5 bg-base-300/50 border border-base-content/10 rounded-xl`,children:[(0,b.jsx)(My,{size:14,className:`text-base-content/20 mt-0.5 flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-[13px] font-bold text-base-content truncate`,children:e.name}),(0,b.jsx)(`span`,{className:`text-[10px] font-mono text-base-content/30`,children:e.marketplace})]}),e.description&&(0,b.jsx)(`div`,{className:`text-[12px] text-base-content/40 mt-0.5 line-clamp-2`,children:e.description}),(0,b.jsxs)(`div`,{className:`flex items-center gap-3 mt-1`,children:[e.author&&(0,b.jsx)(`span`,{className:`text-[10px] text-base-content/25`,children:e.author.name}),e.installs!=null&&e.installs>0&&(0,b.jsxs)(`span`,{className:`text-[10px] text-base-content/25 flex items-center gap-0.5`,children:[(0,b.jsx)(em,{size:9}),y9(e.installs)]})]})]}),(0,b.jsx)(`div`,{className:`flex-shrink-0 mt-0.5`,onClick:function(e){e.stopPropagation()},children:n?(0,b.jsx)(`span`,{className:`text-[10px] font-mono px-2 py-1 rounded-md bg-success/10 text-success/70`,children:`Installed`}):r?(0,b.jsx)(gg,{size:14,className:`text-primary animate-spin mx-2`}):(0,b.jsx)(`button`,{onClick:function(){s(e.name,e.marketplace)},className:`btn btn-primary btn-xs`,children:`Install`})})]},t)})})]})}function $Fe({marketplaces:e}){return e.length===0?null:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Registered Marketplaces`}),(0,b.jsx)(`div`,{className:`space-y-1.5`,children:e.map(function(e){return(0,b.jsxs)(`div`,{className:`flex items-center gap-2.5 px-3 py-2 bg-base-300/30 border border-base-content/10 rounded-lg`,children:[(0,b.jsx)(My,{size:12,className:`text-base-content/20 flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsx)(`span`,{className:`text-[12px] font-bold text-base-content/60`,children:e.name}),(0,b.jsx)(`span`,{className:`text-[11px] text-base-content/25 ml-2`,children:e.source.repo})]})]},e.name)})})]})}function eIe({plugin:e,onClose:t}){return(0,x.useEffect)(function(){function e(e){e.key===`Escape`&&t()}return document.addEventListener(`keydown`,e),function(){document.removeEventListener(`keydown`,e)}},[t]),(0,b.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"aria-label":`Plugin: `+e.name,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-base-content/50`,onClick:t}),(0,b.jsxs)(`div`,{className:`relative bg-base-200 border border-base-content/15 rounded-2xl shadow-2xl w-full max-w-2xl mx-4 max-h-[80vh] flex flex-col overflow-hidden`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-base-content/15 flex-shrink-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,b.jsx)(us,{size:16,className:`text-primary flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`h2`,{className:`text-[15px] font-mono font-bold text-base-content truncate`,children:e.name}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,b.jsxs)(`span`,{className:`text-[10px] font-mono text-base-content/40`,children:[`v`,e.version]}),(0,b.jsx)(`span`,{className:`text-[10px] text-base-content/30`,children:e.marketplace})]})]})]}),(0,b.jsx)(`button`,{onClick:t,"aria-label":`Close`,className:`btn btn-ghost btn-xs btn-square text-base-content/40 hover:text-base-content`,children:(0,b.jsx)(iw,{size:16})})]}),(0,b.jsxs)(`div`,{className:`overflow-y-auto flex-1`,children:[(0,b.jsx)(`div`,{className:`px-5 py-3 border-b border-base-content/10 bg-base-300/30`,children:(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1.5`,children:[e.author&&(0,b.jsx)(v9,{label:`Author`,value:e.author.name}),e.license&&(0,b.jsx)(v9,{label:`License`,value:e.license}),(0,b.jsx)(v9,{label:`Installed`,value:b9(e.installedAt)}),(0,b.jsx)(v9,{label:`Updated`,value:b9(e.lastUpdated)}),e.homepage&&(0,b.jsxs)(`a`,{href:e.homepage,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 text-[11px] text-primary/60 hover:text-primary transition-colors`,children:[(0,b.jsx)(xm,{size:10}),`Homepage`]})]})}),e.description&&(0,b.jsx)(`div`,{className:`px-5 py-3 border-b border-base-content/10`,children:(0,b.jsx)(`p`,{className:`text-[13px] text-base-content/60`,children:e.description})}),e.keywords&&e.keywords.length>0&&(0,b.jsx)(`div`,{className:`px-5 py-3 border-b border-base-content/10`,children:(0,b.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.keywords.map(function(e){return(0,b.jsx)(`span`,{className:`text-[10px] font-mono px-1.5 py-0.5 rounded-md bg-base-content/8 text-base-content/40`,children:e},e)})})}),e.skills.length>0&&(0,b.jsxs)(`div`,{className:`px-5 py-3 border-b border-base-content/10`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-2`,children:[(0,b.jsx)(gx,{size:12,className:`text-base-content/30`}),(0,b.jsxs)(`span`,{className:`text-[11px] font-bold text-base-content/40 uppercase tracking-wider`,children:[`Skills (`,e.skills.length,`)`]})]}),(0,b.jsx)(`div`,{className:`space-y-1.5`,children:e.skills.map(function(e){return(0,b.jsxs)(`div`,{className:`flex items-start gap-2 py-1`,children:[(0,b.jsx)(ou,{size:10,className:`text-base-content/20 mt-0.5 flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`span`,{className:`text-[12px] font-bold text-base-content/70`,children:e.name}),e.description&&(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/35 line-clamp-1`,children:e.description})]})]},e.name)})})]}),Object.keys(e.hooks).length>0&&(0,b.jsxs)(`div`,{className:`px-5 py-3 border-b border-base-content/10`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-2`,children:[(0,b.jsx)(ew,{size:12,className:`text-base-content/30`}),(0,b.jsxs)(`span`,{className:`text-[11px] font-bold text-base-content/40 uppercase tracking-wider`,children:[`Hooks (`,Object.keys(e.hooks).length,`)`]})]}),(0,b.jsx)(`div`,{className:`space-y-1`,children:Object.keys(e.hooks).map(function(e){return(0,b.jsxs)(`div`,{className:`flex items-center gap-2 py-0.5`,children:[(0,b.jsx)(ou,{size:10,className:`text-base-content/20 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`text-[12px] font-mono text-base-content/50`,children:e})]},e)})})]}),e.rules.length>0&&(0,b.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-2`,children:[(0,b.jsx)(oC,{size:12,className:`text-base-content/30`}),(0,b.jsxs)(`span`,{className:`text-[11px] font-bold text-base-content/40 uppercase tracking-wider`,children:[`Rules (`,e.rules.length,`)`]})]}),(0,b.jsx)(`div`,{className:`space-y-1`,children:e.rules.map(function(e){return(0,b.jsxs)(`div`,{className:`flex items-center gap-2 py-0.5`,children:[(0,b.jsx)(ou,{size:10,className:`text-base-content/20 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`text-[12px] font-mono text-base-content/50`,children:e})]},e)})})]})]}),(0,b.jsx)(`div`,{className:`px-5 py-3 border-t border-base-content/15 flex-shrink-0`,children:(0,b.jsxs)(`div`,{className:`text-[11px] font-mono text-base-content/30 truncate`,children:[e.gitCommitSha.slice(0,8),` · `,e.installPath]})})]})]})}function tIe({errors:e}){return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-2`,children:[(0,b.jsx)(ZC,{size:12,className:`text-warning`}),(0,b.jsxs)(`span`,{className:`text-[12px] font-semibold text-warning/80`,children:[`Errors (`,e.length,`)`]})]}),(0,b.jsx)(`div`,{className:`space-y-2`,children:e.map(function(e){return(0,b.jsxs)(`div`,{className:`px-3 py-2.5 bg-warning/5 border border-warning/20 rounded-xl`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,b.jsx)(`span`,{className:`text-[13px] font-bold text-base-content`,children:e.name}),(0,b.jsx)(`span`,{className:`text-[10px] font-mono text-base-content/30`,children:e.marketplace})]}),e.errors.map(function(e,t){return(0,b.jsxs)(`div`,{className:`flex items-start gap-1.5 mt-0.5`,children:[(0,b.jsx)(ZC,{size:10,className:`text-warning/60 mt-0.5 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`text-[12px] text-warning/70`,children:e})]},t)})]},e.key)})})]})}function nIe({plugins:e,loaded:t,installingKey:n,installedKeys:r,onInstall:i}){var[a,o]=(0,x.useState)(!1),s=12;if(!t||e.length===0)return null;var c=a?e:e.slice(0,s);return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`flex items-center justify-between mb-2`,children:(0,b.jsxs)(`div`,{className:`text-[12px] font-semibold text-base-content/40`,children:[`Discover (`,e.length,` available)`]})}),(0,b.jsx)(`div`,{className:`space-y-2`,children:c.map(function(e){var t=e.name+`@`+e.marketplace,a=r.has(t),o=n===t;return(0,b.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-2.5 bg-base-300/50 border border-base-content/10 rounded-xl`,children:[(0,b.jsx)(My,{size:14,className:`text-base-content/20 mt-0.5 flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-[13px] font-bold text-base-content truncate`,children:e.name}),(0,b.jsx)(`span`,{className:`text-[10px] font-mono text-base-content/30`,children:e.marketplace})]}),e.description&&(0,b.jsx)(`div`,{className:`text-[12px] text-base-content/40 mt-0.5 line-clamp-2`,children:e.description}),(0,b.jsxs)(`div`,{className:`flex items-center gap-3 mt-1`,children:[e.author&&(0,b.jsx)(`span`,{className:`text-[10px] text-base-content/25`,children:e.author.name}),e.installs!=null&&e.installs>0&&(0,b.jsxs)(`span`,{className:`text-[10px] text-base-content/25 flex items-center gap-0.5`,children:[(0,b.jsx)(em,{size:9}),y9(e.installs)]})]})]}),(0,b.jsx)(`div`,{className:`flex-shrink-0 mt-0.5`,onClick:function(e){e.stopPropagation()},children:a?(0,b.jsx)(`span`,{className:`text-[10px] font-mono px-2 py-1 rounded-md bg-success/10 text-success/70`,children:`Installed`}):o?(0,b.jsx)(gg,{size:14,className:`text-primary animate-spin mx-2`}):(0,b.jsx)(`button`,{onClick:function(){i(e.name,e.marketplace)},className:`btn btn-primary btn-xs`,children:`Install`})})]},t)})}),!a&&e.length>s&&(0,b.jsxs)(`button`,{onClick:function(){o(!0)},className:`mt-3 text-[12px] text-primary/60 hover:text-primary transition-colors`,children:[`Show all `,e.length,` plugins`]}),a&&e.length>s&&(0,b.jsx)(`button`,{onClick:function(){o(!1)},className:`mt-3 text-[12px] text-primary/60 hover:text-primary transition-colors`,children:`Show less`})]})}function v9({label:e,value:t}){return(0,b.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-[11px] font-mono text-base-content/35 uppercase tracking-wider`,children:e}),(0,b.jsx)(`span`,{className:`text-[12px] text-base-content/70`,children:t})]})}function y9(e){return e>=1e6?(e/1e6).toFixed(1)+`M`:e>=1e3?(e/1e3).toFixed(1)+`k`:String(e)}function b9(e){try{return new Date(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}catch{return e}}function rIe(){var[e,t]=(0,x.useState)(function(){return localStorage.getItem(`lattice-notifications-enabled`)===`1`}),n=typeof Notification<`u`?Notification.permission:`denied`;function r(){e?(t(!1),localStorage.setItem(`lattice-notifications-enabled`,`0`)):n===`default`?Notification.requestPermission().then(function(e){e===`granted`&&(t(!0),localStorage.setItem(`lattice-notifications-enabled`,`1`))}):n===`granted`&&(t(!0),localStorage.setItem(`lattice-notifications-enabled`,`1`))}return{enabled:e,permission:n,toggle:r}}function x9(e,t,n,r){if(localStorage.getItem(`lattice-notifications-enabled`)===`1`&&!(typeof Notification>`u`||Notification.permission!==`granted`)){var i=new Notification(e,{body:t,icon:`/icons/icon-192.svg`,tag:n||`lattice`,silent:!1}),a=setTimeout(function(){i.close()},1e4);i.onclick=function(){clearTimeout(a),window.focus(),i.close(),r&&r()}}}function iIe(e){for(var t=(e+`=`.repeat((4-e.length%4)%4)).replace(/-/g,`+`).replace(/_/g,`/`),n=window.atob(t),r=new Uint8Array(n.length),i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}function aIe(){var[e,t]=(0,x.useState)(`unsupported`);(0,x.useEffect)(function(){if(!(`serviceWorker`in navigator)||!(`PushManager`in window)){t(`unsupported`);return}if(Notification.permission===`denied`){t(`denied`);return}navigator.serviceWorker.getRegistration(`/sw-push.js`).then(function(e){if(!e){t(`unsubscribed`);return}e.pushManager.getSubscription().then(function(e){t(e?`subscribed`:`unsubscribed`)})})},[]);async function n(){if(!(`serviceWorker`in navigator)||!(`PushManager`in window))return!1;try{if(await Notification.requestPermission()!==`granted`)return t(`denied`),!1;var e=await navigator.serviceWorker.register(`/sw-push.js`,{scope:`/`});await navigator.serviceWorker.ready;var n=await(await fetch(`/api/vapid-public-key`)).json(),r=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:iIe(n.publicKey)});return await fetch(`/api/push-subscribe`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r.toJSON())}),t(`subscribed`),!0}catch(e){return console.error(`Push subscription failed:`,e),!1}}async function r(){try{var e=await navigator.serviceWorker.getRegistration(`/sw-push.js`);if(e){var n=await e.pushManager.getSubscription();n&&await n.unsubscribe()}t(`unsubscribed`)}catch(e){console.error(`Push unsubscribe failed:`,e)}}return{status:e,subscribe:n,unsubscribe:r}}var oIe=[{key:`responses`,label:`Claude responses`,description:`When Claude finishes a response`},{key:`mesh`,label:`Mesh node changes`,description:`When nodes come online or go offline`},{key:`connection`,label:`Connection events`,description:`WebSocket connect and disconnect`}];function sIe(){try{var e=localStorage.getItem(`lattice-notification-types`);if(e)return JSON.parse(e)}catch{}return{responses:!0,mesh:!0,connection:!0}}function cIe(e){localStorage.setItem(`lattice-notification-types`,JSON.stringify(e))}function lIe(){var e=rIe(),t=aIe(),[n,r]=(0,x.useState)(sIe);function i(e){r(function(t){var n={...t,[e]:!t[e]};return cIe(n),n})}return(0,b.jsxs)(`div`,{className:`py-2 space-y-6`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Browser Notifications`}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between py-2 px-3 bg-base-300 border border-base-content/15 rounded-xl`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[13px] text-base-content`,children:`Enable notifications`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30 mt-0.5`,children:e.permission===`denied`?`Blocked by browser — update in browser settings`:`Get notified about events in Lattice`})]}),(0,b.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:e.enabled,onChange:e.toggle,disabled:e.permission===`denied`})]})]}),t.status!==`unsupported`&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Push Notifications`}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between py-2 px-3 bg-base-300 border border-base-content/15 rounded-xl`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[13px] text-base-content`,children:`Enable push notifications`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30 mt-0.5`,children:t.status===`denied`?`Blocked by browser — update in browser settings`:t.status===`subscribed`?`Receiving push notifications even when the tab is closed`:`Get notified even when Lattice is not open`})]}),(0,b.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:t.status===`subscribed`,onChange:function(){t.status===`subscribed`?t.unsubscribe():t.subscribe()},disabled:t.status===`denied`})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Notification Types`}),(0,b.jsx)(`div`,{className:`flex flex-col gap-2`,children:oIe.map(function(t){return(0,b.jsxs)(`div`,{className:`flex items-center justify-between py-2 px-3 bg-base-300 border border-base-content/15 rounded-xl`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[13px] text-base-content`,children:t.label}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30 mt-0.5`,children:t.description})]}),(0,b.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:n[t.key]!==!1,onChange:function(){i(t.key)},disabled:!e.enabled})]},t.key)})})]})]})}var uIe=[{id:`warning`,label:`Warning`,description:`Shows a warning but does not block`},{id:`soft-block`,label:`Confirm`,description:`Asks for confirmation before sending`},{id:`hard-block`,label:`Block`,description:`Prevents sending until tomorrow`}];function dIe(){var{send:e,subscribe:t,unsubscribe:n}=z(),r=Qn(oT(),function(e){return e.budgetStatus}),[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)(10),[c,l]=(0,x.useState)(`warning`),u=$7();(0,x.useEffect)(function(){function r(e){if(e.type===`settings:data`){var t=e.config;u.savingRef.current?(u.confirmSave(),t.costBudget||gT(null)):(t.costBudget?(a(!0),s(t.costBudget.dailyLimit),l(t.costBudget.enforcement)):(a(!1),s(10),l(`warning`),gT(null)),u.resetFromServer())}}return t(`settings:data`,r),e({type:`settings:get`}),function(){n(`settings:data`,r)}},[]);function d(){u.startSave(),e({type:`settings:update`,settings:{costBudget:i?{dailyLimit:o,enforcement:c}:null}})}return(0,b.jsxs)(`div`,{className:`py-2`,children:[(0,b.jsx)(`p`,{className:`text-[12px] text-base-content/40 mb-5`,children:`Set a daily spending limit to control API costs. The budget resets at midnight.`}),r&&(0,b.jsxs)(`div`,{className:`mb-5 p-3 rounded-xl bg-base-300 border border-base-content/10`,children:[(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/40 font-mono mb-1`,children:`Today's spend`}),(0,b.jsxs)(`div`,{className:`text-[18px] font-mono font-bold text-base-content`,children:[`$`,r.dailySpend.toFixed(2),r.dailyLimit>0&&(0,b.jsx)(`span`,{className:`text-[13px] text-base-content/30 font-normal`,children:` / $`+r.dailyLimit.toFixed(2)})]})]}),(0,b.jsx)(`div`,{className:`mb-5`,children:(0,b.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:i,onChange:function(e){a(e.target.checked),u.markDirty()},className:`toggle toggle-sm toggle-primary`}),(0,b.jsx)(`span`,{className:`text-[13px] text-base-content`,children:`Enable daily budget`})]})}),i&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`mb-5`,children:[(0,b.jsx)(`label`,{htmlFor:`budget-daily-limit`,className:`block text-[12px] font-semibold text-base-content/40 mb-2`,children:`Daily limit (USD)`}),(0,b.jsx)(`input`,{id:`budget-daily-limit`,type:`number`,min:.01,step:.5,value:o,onChange:function(e){var t=parseFloat(e.target.value);!isNaN(t)&&t>0&&(s(t),u.markDirty())},className:`w-full h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[13px] font-mono focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`})]}),(0,b.jsxs)(`div`,{className:`mb-6`,role:`radiogroup`,"aria-label":`Enforcement mode`,children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Enforcement`}),(0,b.jsx)(`div`,{className:`flex flex-col gap-2`,children:uIe.map(function(e){var t=c===e.id;return(0,b.jsxs)(`button`,{role:`radio`,"aria-checked":t,onClick:function(){l(e.id),u.markDirty()},className:`w-full text-left px-3 py-2.5 rounded-lg border text-[12px] transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100 `+(t?`border-primary bg-base-300 text-base-content`:`border-base-content/15 bg-base-300 text-base-content/40 hover:border-base-content/30 hover:text-base-content/60`),children:[(0,b.jsx)(`div`,{className:`font-semibold`,children:e.label}),(0,b.jsx)(`div`,{className:`text-[11px] mt-0.5 `+(t?`text-base-content/50`:`text-base-content/30`),children:e.description})]},e.id)})})]})]}),(0,b.jsx)(n9,{dirty:u.dirty,saving:u.saving,saveState:u.saveState,onSave:d})]})}var fIe={appearance:{title:`Appearance`},notifications:{title:`Notifications`},claude:{title:`Claude`},budget:{title:`Budget`},environment:{title:`Environment`},mcp:{title:`MCP Servers`},skills:{title:`Skills`},plugins:{title:`Plugins`},nodes:{title:`Mesh Nodes`},editor:{title:`Editor`},rules:{title:`Rules`},memory:{title:`Memory`}};function pIe(e){return e===`appearance`?(0,b.jsx)(wFe,{}):e===`notifications`?(0,b.jsx)(lIe,{}):e===`claude`?(0,b.jsx)(jFe,{}):e===`budget`?(0,b.jsx)(dIe,{}):e===`environment`?(0,b.jsx)(MFe,{}):e===`mcp`?(0,b.jsx)(FFe,{}):e===`skills`?(0,b.jsx)(RFe,{}):e===`plugins`?(0,b.jsx)(YFe,{}):e===`nodes`?(0,b.jsx)(PFe,{}):e===`editor`?(0,b.jsx)(BFe,{}):e===`rules`?(0,b.jsx)(VFe,{}):e===`memory`?(0,b.jsx)(JFe,{}):null}function mIe(){var{activeView:e,toggleDrawer:t}=Yw();if(e.type!==`settings`)return null;var n=e.section,r=fIe[n];return(0,b.jsxs)(`section`,{"aria-label":`Settings`,className:`flex-1 overflow-auto px-4 sm:px-8 py-4 sm:py-6 max-w-3xl`,children:[r&&(0,b.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-square lg:hidden`,"aria-label":`Toggle sidebar`,onClick:t,children:(0,b.jsx)(m_,{size:18})}),(0,b.jsx)(`h1`,{className:`text-lg font-mono font-bold text-base-content`,children:r.title})]}),pIe(n)]})}function S9(e){var{status:t,send:n,subscribe:r,unsubscribe:i}=z(),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(!0),[l,u]=(0,x.useState)(null);(0,x.useEffect)(function(){if(!e)return;function a(t){if(t.type===`project-settings:data`){var n=t;n.projectSlug===e&&(o(n.settings),c(!1),u(null))}}function s(t){if(t.type===`project-settings:error`){var n=t;n.projectSlug===e&&(u(n.message),c(!1))}}return r(`project-settings:data`,a),r(`project-settings:error`,s),t===`connected`&&(c(!0),n({type:`project-settings:get`,projectSlug:e})),function(){i(`project-settings:data`,a),i(`project-settings:error`,s)}},[e,t]);function d(t,r){e&&n({type:`project-settings:update`,projectSlug:e,section:t,settings:r})}return{settings:a,loading:s,error:l,updateSection:d}}function hIe(e){if(!e)return(0,b.jsx)(`div`,{className:`w-8 h-8 rounded-lg bg-base-300 border border-base-content/15 flex items-center justify-center text-base-content/30 text-[11px]`,children:`?`});if(e.type===`lucide`){var t=ow[e.name];return t?(0,b.jsx)(`div`,{className:`w-8 h-8 rounded-lg bg-base-300 border border-base-content/15 flex items-center justify-center text-base-content`,children:(0,b.jsx)(t,{size:18})}):null}return e.type===`text`?(0,b.jsx)(`div`,{className:`w-8 h-8 rounded-lg bg-base-300 border border-base-content/15 flex items-center justify-center text-[14px] font-bold`,style:e.color?{color:e.color}:void 0,children:e.value}):e.type===`image`?(0,b.jsx)(`img`,{src:e.path,alt:`icon`,className:`w-8 h-8 rounded-lg object-cover border border-base-content/15`,loading:`lazy`}):null}function gIe({value:e,onChange:t}){var n=e&&e.type===`emoji`?void 0:e,[r,i]=(0,x.useState)(n?.type===`text`?`text`:n?.type===`image`?`upload`:`lucide`),[a,o]=(0,x.useState)(``),[s,c]=(0,x.useState)(n?.type===`text`?n.value:``),[l,u]=(0,x.useState)(n?.type===`text`&&n.color||`#ffffff`),d=(0,x.useMemo)(function(){var e=Object.keys(ow);if(!a.trim())return e.slice(0,60);var t=a.toLowerCase();return e.filter(function(e){return e.toLowerCase().includes(t)}).slice(0,60)},[a]),f=[{id:`lucide`,label:`Lucide`},{id:`text`,label:`Text`},{id:`upload`,label:`Upload`}];function p(e){var n=e.target.files?.[0];if(n){var r=new FileReader;r.onload=function(e){var n=e.target?.result;t({type:`image`,path:n})},r.readAsDataURL(n)}}return(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[hIe(n),(0,b.jsx)(`span`,{className:`text-[11px] text-base-content/40`,children:`Current icon`})]}),(0,b.jsx)(`div`,{className:`flex gap-1`,children:f.map(function(e){return(0,b.jsx)(`button`,{type:`button`,onClick:function(){i(e.id)},className:`btn btn-xs `+(r===e.id?`btn-primary`:`btn-ghost`),children:e.label},e.id)})}),r===`lucide`&&(0,b.jsxs)(`div`,{className:`space-y-2`,children:[(0,b.jsx)(`input`,{type:`text`,value:a,onChange:function(e){o(e.target.value)},placeholder:`Search icons...`,"aria-label":`Search icons`,className:`w-full h-8 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[12px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`}),(0,b.jsx)(`div`,{className:`grid grid-cols-10 gap-1 max-h-48 overflow-y-auto`,children:d.map(function(e){var r=ow[e];return(0,b.jsx)(`button`,{type:`button`,title:e,onClick:function(){t({type:`lucide`,name:e})},className:`w-8 h-8 flex items-center justify-center rounded-lg text-base-content transition-colors duration-75 `+(n?.type===`lucide`&&n.name===e?`border border-primary bg-base-300`:`hover:bg-base-300`),children:(0,b.jsx)(r,{size:16})},e)})})]}),r===`text`&&(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(`input`,{type:`text`,value:s,maxLength:2,onChange:function(e){c(e.target.value),e.target.value&&t({type:`text`,value:e.target.value,color:l})},placeholder:`1-2 chars`,"aria-label":`Icon text`,className:`flex-1 h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[13px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`}),(0,b.jsx)(`input`,{type:`color`,value:l,onChange:function(e){u(e.target.value),s&&t({type:`text`,value:s,color:e.target.value})},className:`w-9 h-9 rounded-xl border border-base-content/15 bg-base-300 cursor-pointer`})]}),r===`upload`&&(0,b.jsxs)(`div`,{className:`space-y-2`,children:[(0,b.jsx)(`input`,{type:`file`,accept:`image/*`,onChange:p,className:`w-full text-[12px] text-base-content/60 file:mr-3 file:py-1.5 file:px-3 file:rounded-lg file:border-0 file:text-[12px] file:bg-base-300 file:text-base-content/60 file:cursor-pointer`}),n?.type===`image`&&(0,b.jsx)(`img`,{src:n.path,alt:`preview`,className:`w-16 h-16 rounded-xl object-cover border border-base-content/15`,loading:`lazy`})]})]})}function _Ie({settings:e,updateSection:t}){var[n,r]=(0,x.useState)(e.title),[i,a]=(0,x.useState)(e.icon),o=$7();(0,x.useEffect)(function(){o.savingRef.current?o.confirmSave():(r(e.title),a(e.icon),o.resetFromServer())},[e]);function s(e){r(e),o.markDirty()}function c(e){a(e),o.markDirty()}function l(){o.startSave(),t(`general`,{title:n,icon:i})}return(0,b.jsxs)(`div`,{className:`py-2`,children:[(0,b.jsxs)(`div`,{className:`mb-5`,children:[(0,b.jsx)(`label`,{htmlFor:`project-title`,className:`block text-[12px] font-semibold text-base-content/40 mb-2`,children:`Display Name`}),(0,b.jsx)(`input`,{id:`project-title`,type:`text`,value:n,onChange:function(e){s(e.target.value)},className:`w-full h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[13px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`})]}),(0,b.jsxs)(`div`,{className:`mb-5`,children:[(0,b.jsx)(`div`,{className:`block text-[12px] font-semibold text-base-content/40 mb-2`,children:`Icon`}),(0,b.jsx)(gIe,{value:i,onChange:c})]}),(0,b.jsxs)(`div`,{className:`mb-6`,children:[(0,b.jsx)(`div`,{className:`block text-[12px] font-semibold text-base-content/40 mb-2`,children:`Project Path`}),(0,b.jsx)(`div`,{className:`w-full h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content/60 text-[12px] font-mono flex items-center select-all`,children:e.path})]}),(0,b.jsx)(n9,{dirty:o.dirty,saving:o.saving,saveState:o.saveState,onSave:l})]})}var C9=[{id:`claude-opus-4-6`,label:`Claude Opus 4.6`},{id:`claude-sonnet-4-6`,label:`Claude Sonnet 4.6`},{id:`claude-haiku-4-5`,label:`Claude Haiku 4.5`},{id:`claude-opus-4-5`,label:`Claude Opus 4.5`},{id:`claude-sonnet-4-5`,label:`Claude Sonnet 4.5`}],vIe=[{id:`low`,label:`Low`},{id:`normal`,label:`Normal`},{id:`high`,label:`High`},{id:`max`,label:`Max`}],yIe=[{id:`adaptive`,label:`Adaptive`},{id:`enabled`,label:`Enabled`},{id:`disabled`,label:`Disabled`}],bIe=[{id:`default`,label:`Default`},{id:`acceptEdits`,label:`Accept Edits`},{id:`plan`,label:`Plan`},{id:`dontAsk`,label:`Don't Ask`}];function xIe(e){return!e||e.type===`adaptive`?`Adaptive`:e.type===`enabled`?`Enabled`:`Disabled`}function SIe(e){var t=C9.find(function(t){return t.id===e});return t?t.label:e}function CIe({settings:e,updateSection:t}){var[n,r]=(0,x.useState)(e.claudeMd??``),[i,a]=(0,x.useState)(e.defaultModel),[o,s]=(0,x.useState)(e.defaultEffort),[c,l]=(0,x.useState)(e.thinking),[u,d]=(0,x.useState)(e.permissionMode),[f,p]=(0,x.useState)(e.thinking?.type===`enabled`?e.thinking.budgetTokens??1e4:1e4),[m,h]=(0,x.useState)(!1),g=$7();(0,x.useEffect)(function(){g.savingRef.current?g.confirmSave():(r(e.claudeMd??``),a(e.defaultModel),s(e.defaultEffort),l(e.thinking),d(e.permissionMode),e.thinking?.type===`enabled`&&p(e.thinking.budgetTokens??1e4),g.resetFromServer())},[e]);function _(){g.startSave();var e=c;e?.type===`enabled`&&(e={type:`enabled`,budgetTokens:f}),t(`claude`,{claudeMd:n||void 0,defaultModel:i,defaultEffort:o,thinking:e,permissionMode:u})}var v=e.global.defaultModel||C9[0].id,y=e.global.defaultEffort||`normal`;return(0,b.jsxs)(`div`,{className:`py-2 space-y-6`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{htmlFor:`project-claude-md`,className:`block text-[12px] font-semibold text-base-content/40 mb-2`,children:`Project CLAUDE.md`}),(0,b.jsx)(`textarea`,{id:`project-claude-md`,value:n,onChange:function(e){r(e.target.value),g.markDirty()},placeholder:`# Project-specific instructions for Claude...`,rows:10,className:`w-full px-3 py-2.5 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[12px] font-mono leading-relaxed resize-y focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`}),(function(){var e=n?n.split(`
|
|
517
|
-
`).length:0,t=e>200;return(0,b.jsxs)(`div`,{className:`flex items-center justify-between mt-1.5`,children:[(0,b.jsxs)(`div`,{className:`text-[11px] `+(t?`text-warning`:`text-base-content/25`),children:[e,` line`,e===1?``:`s`,t?` — consider moving content to rules or imports`:``]}),t&&(0,b.jsx)(`div`,{className:`text-[10px] text-warning/70`,children:`soft limit: 200 lines`})]})})(),(0,b.jsxs)(`button`,{type:`button`,onClick:function(){h(!m)},className:`flex items-center gap-1.5 mt-2 text-[11px] text-base-content/40 hover:text-base-content/60 transition-colors`,children:[m?(0,b.jsx)(nu,{size:12}):(0,b.jsx)(ou,{size:12}),`Global CLAUDE.md (inherited)`]}),m&&(0,b.jsx)(`textarea`,{readOnly:!0,value:e.global.claudeMd,rows:8,className:`w-full mt-2 px-3 py-2.5 bg-base-300 border border-base-content/15 rounded-xl text-base-content/30 text-[12px] font-mono leading-relaxed resize-y cursor-default focus-visible:outline-none`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{htmlFor:`project-default-model`,className:`block text-[12px] font-semibold text-base-content/40 mb-2`,children:`Default Model`}),(0,b.jsxs)(`select`,{id:`project-default-model`,value:i??``,onChange:function(e){a(e.target.value||void 0),g.markDirty()},className:`w-full h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[13px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`,children:[(0,b.jsxs)(`option`,{value:``,className:`bg-base-300`,children:[`Use global default (`,SIe(v),`)`]}),C9.map(function(e){return(0,b.jsx)(`option`,{value:e.id,className:`bg-base-300`,children:e.label},e.id)})]}),i&&(0,b.jsx)(`button`,{type:`button`,onClick:function(){a(void 0),g.markDirty()},className:`mt-1.5 text-[11px] text-primary/70 hover:text-primary transition-colors`,children:`Clear override`})]}),(0,b.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Default Effort`,children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Default Effort`}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsxs)(`button`,{role:`radio`,"aria-checked":o===void 0,onClick:function(){s(void 0),g.markDirty()},className:`flex-1 py-2.5 sm:py-1.5 rounded-lg border text-[12px] transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100 `+(o===void 0?`border-primary bg-base-300 text-base-content font-semibold`:`border-base-content/15 bg-base-300 text-base-content/40 hover:border-base-content/30 hover:text-base-content/60`),children:[`Global (`,y,`)`]}),vIe.map(function(e){var t=o===e.id;return(0,b.jsx)(`button`,{role:`radio`,"aria-checked":t,onClick:function(){s(e.id),g.markDirty()},className:`flex-1 py-2.5 sm:py-1.5 rounded-lg border text-[12px] transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100 `+(t?`border-primary bg-base-300 text-base-content font-semibold`:`border-base-content/15 bg-base-300 text-base-content/40 hover:border-base-content/30 hover:text-base-content/60`),children:e.label},e.id)})]})]}),(0,b.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Thinking Mode`,children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Thinking Mode`}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsxs)(`button`,{role:`radio`,"aria-checked":c===void 0,onClick:function(){l(void 0),g.markDirty()},className:`flex-1 py-2.5 sm:py-1.5 rounded-lg border text-[12px] transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100 `+(c===void 0?`border-primary bg-base-300 text-base-content font-semibold`:`border-base-content/15 bg-base-300 text-base-content/40 hover:border-base-content/30 hover:text-base-content/60`),children:[`Global (`,xIe(e.global.thinking),`)`]}),yIe.map(function(e){var t=c?.type===e.id;return(0,b.jsx)(`button`,{role:`radio`,"aria-checked":t,onClick:function(){l(e.id===`enabled`?{type:`enabled`,budgetTokens:f}:{type:e.id}),g.markDirty()},className:`flex-1 py-2.5 sm:py-1.5 rounded-lg border text-[12px] transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100 `+(t?`border-primary bg-base-300 text-base-content font-semibold`:`border-base-content/15 bg-base-300 text-base-content/40 hover:border-base-content/30 hover:text-base-content/60`),children:e.label},e.id)})]}),c?.type===`enabled`&&(0,b.jsxs)(`div`,{className:`mt-3`,children:[(0,b.jsx)(`label`,{htmlFor:`budget-tokens`,className:`block text-[11px] text-base-content/40 mb-1.5`,children:`Budget Tokens`}),(0,b.jsx)(`input`,{id:`budget-tokens`,type:`number`,min:1e3,step:1e3,value:f,onChange:function(e){var t=parseInt(e.target.value,10);isNaN(t)||(p(t),l({type:`enabled`,budgetTokens:t}),g.markDirty())},className:`w-48 h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[13px] font-mono focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`})]})]}),(0,b.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Permission Mode`,children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Permission Mode`}),(0,b.jsx)(`div`,{className:`flex gap-2`,children:bIe.map(function(e){var t=(u??`default`)===e.id;return(0,b.jsx)(`button`,{role:`radio`,"aria-checked":t,onClick:function(){d(e.id===`default`?void 0:e.id),g.markDirty()},className:`flex-1 py-2.5 sm:py-1.5 rounded-lg border text-[12px] transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100 `+(t?`border-primary bg-base-300 text-base-content font-semibold`:`border-base-content/15 bg-base-300 text-base-content/40 hover:border-base-content/30 hover:text-base-content/60`),children:e.label},e.id)})})]}),(0,b.jsx)(n9,{dirty:g.dirty,saving:g.saving,saveState:g.saveState,onSave:_})]})}function w9(){return Math.random().toString(36).slice(2,10)}function wIe(e){var t={};return e.forEach(function(e){e.key.trim()&&(t[e.key.trim()]=e.value)}),t}function T9(e){return Object.entries(e).map(function([e,t]){return{id:w9(),key:e,value:t}})}function TIe({settings:e,updateSection:t}){var n=e.global.env??{},r=Object.entries(n),[i,a]=(0,x.useState)(function(){return T9(e.env??{})}),o=$7();(0,x.useEffect)(function(){o.savingRef.current?o.confirmSave():(a(T9(e.env??{})),o.resetFromServer())},[e]);var s=(0,x.useMemo)(function(){return new Set(Object.keys(n))},[n]),c=(0,x.useMemo)(function(){return i9(i)},[i]),l=c.size>0;function u(){a(function(e){return[...e,{id:w9(),key:``,value:``}]}),o.markDirty()}function d(e){a(function(t){return t.filter(function(t){return t.id!==e})}),o.markDirty()}function f(e,t){a(function(n){return n.map(function(n){return n.id===e?{...n,key:t}:n})}),o.markDirty()}function p(e,t){a(function(n){return n.map(function(n){return n.id===e?{...n,value:t}:n})}),o.markDirty()}function m(){o.startSave(),t(`environment`,{env:wIe(i)})}var h=`w-full h-9 sm:h-7 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content font-mono text-[12px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`;return(0,b.jsxs)(`div`,{className:`py-2`,children:[(0,b.jsxs)(`div`,{className:`mb-6`,children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Global Variables`}),r.length===0&&(0,b.jsx)(`div`,{className:`py-4 text-center text-[13px] text-base-content/30`,children:`No global environment variables.`}),r.length>0&&(0,b.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:r.map(function([e,t]){return(0,b.jsxs)(`div`,{className:`flex flex-col sm:grid sm:grid-cols-[1fr_1fr_auto] gap-1.5 sm:items-center`,children:[(0,b.jsx)(`div`,{className:`h-9 sm:h-7 px-3 bg-base-300/50 border border-base-content/10 rounded-xl flex items-center font-mono text-[12px] text-base-content/40`,children:e}),(0,b.jsx)(`div`,{className:`flex gap-1.5 items-center`,children:(0,b.jsx)(`div`,{className:`h-9 sm:h-7 px-3 bg-base-300/50 border border-base-content/10 rounded-xl flex items-center font-mono text-[12px] text-base-content/40 w-full`,children:String(t)})}),(0,b.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-base-content/30 w-7 text-center hidden sm:block`,children:`global`})]},e)})})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Project Variables`}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 sm:gap-1.5 mb-3`,children:[i.length===0&&(0,b.jsx)(`div`,{className:`py-4 text-center text-[13px] text-base-content/30`,children:`No project environment variables.`}),i.map(function(e,t){var n=e.key.trim()!==``&&c.has(e.key.trim()),r=e.key.trim()!==``&&s.has(e.key.trim());return(0,b.jsxs)(`div`,{className:`flex flex-col sm:grid sm:grid-cols-[1fr_1fr_auto] gap-1.5 sm:items-center`,children:[(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(`input`,{type:`text`,value:e.key,onChange:function(t){f(e.id,t.target.value)},placeholder:`VARIABLE_NAME`,"aria-label":`Variable name for row `+(t+1),"aria-invalid":n,className:`w-full h-9 sm:h-7 px-3 bg-base-300 border rounded-xl text-base-content font-mono text-[12px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms] `+(n?`border-warning`:`border-base-content/15`)}),n&&(0,b.jsxs)(`div`,{className:`flex items-center gap-1 mt-0.5 text-[10px] text-warning sm:absolute sm:-bottom-3.5 sm:left-0`,role:`alert`,children:[(0,b.jsx)(ZC,{size:9}),`Duplicate key`]}),!n&&r&&(0,b.jsx)(`div`,{className:`flex items-center gap-1 mt-0.5 text-[10px] text-warning/70 sm:absolute sm:-bottom-3.5 sm:left-0`,children:`overrides global`})]}),(0,b.jsxs)(`div`,{className:`flex gap-1.5 items-center`,children:[(0,b.jsx)(`input`,{type:`text`,value:e.value,onChange:function(t){p(e.id,t.target.value)},placeholder:`value`,"aria-label":`Value for `+(e.key||`row `+(t+1)),className:h}),(0,b.jsx)(`button`,{onClick:function(){d(e.id)},"aria-label":`Delete `+(e.key||`row `+(t+1)),title:`Delete`,className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-error w-9 h-9 flex-shrink-0 sm:hidden focus-visible:ring-2 focus-visible:ring-primary`,children:(0,b.jsx)(iw,{size:14})})]}),(0,b.jsx)(`button`,{onClick:function(){d(e.id)},"aria-label":`Delete `+(e.key||`row `+(t+1)),title:`Delete`,className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-error w-7 h-7 hidden sm:flex focus-visible:ring-2 focus-visible:ring-primary`,children:(0,b.jsx)(iw,{size:12})})]},e.id)})]}),(0,b.jsxs)(`button`,{onClick:u,className:`flex items-center gap-1.5 px-3 py-2.5 sm:py-1.5 rounded-xl border border-dashed border-base-content/20 bg-transparent text-base-content/40 text-[12px] hover:text-base-content/60 hover:border-base-content/30 transition-colors duration-[120ms] mb-5 cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100`,children:[(0,b.jsx)($b,{size:12}),`Add Variable`]}),(0,b.jsx)(n9,{dirty:o.dirty,saving:o.saving,saveState:o.saveState,onSave:m,extraStatus:l?`Duplicate keys will be merged`:void 0})]})]})}function E9({rules:e,onDelete:t,readOnly:n,labelPrefix:r}){return e.length===0?(0,b.jsx)(`div`,{className:`py-3 text-center text-[13px] text-base-content/30`,children:`No rules defined.`}):(0,b.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.map(function(e,i){return(0,b.jsxs)(`div`,{className:`flex items-center gap-2 h-9 sm:h-7 px-3 rounded-xl border font-mono text-[12px] `+(n?`bg-base-300/50 border-base-content/10 text-base-content/40`:`bg-base-300 border-base-content/15 text-base-content`),children:[(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e}),n&&(0,b.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-base-content/30 flex-shrink-0`,children:`global`}),!n&&t&&(0,b.jsx)(`button`,{onClick:function(){t(i)},"aria-label":`Delete `+(r||``)+` rule: `+e,title:`Delete`,className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-error flex-shrink-0 focus-visible:ring-2 focus-visible:ring-primary`,children:(0,b.jsx)(iw,{size:12})})]},e+`-`+i)})})}function D9({onAdd:e,label:t}){var[n,r]=(0,x.useState)(``);function i(){var t=n.trim();t&&(e(t),r(``))}function a(e){e.key===`Enter`&&(e.preventDefault(),i())}return(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1.5`,children:[(0,b.jsx)(`input`,{type:`text`,value:n,onChange:function(e){r(e.target.value)},onKeyDown:a,placeholder:`e.g. Bash(curl:*)`,"aria-label":t,className:`flex-1 h-9 sm:h-7 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content font-mono text-[12px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`}),(0,b.jsxs)(`button`,{onClick:i,disabled:!n.trim(),className:`flex items-center gap-1.5 px-3 h-9 sm:h-7 rounded-xl border border-dashed border-base-content/20 bg-transparent text-base-content/40 text-[12px] hover:text-base-content/60 hover:border-base-content/30 transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary`+(n.trim()?``:` opacity-50 cursor-not-allowed`),children:[(0,b.jsx)($b,{size:12}),`Add`]})]})}function EIe({settings:e,updateSection:t}){var[n,r]=(0,x.useState)(function(){return[...e.permissions.allow??[]]}),[i,a]=(0,x.useState)(function(){return[...e.permissions.deny??[]]}),o=$7();(0,x.useEffect)(function(){o.savingRef.current?o.confirmSave():(r([...e.permissions.allow??[]]),a([...e.permissions.deny??[]]),o.resetFromServer())},[e]);function s(e){r(function(t){var n=[...t];return n.splice(e,1),n}),o.markDirty()}function c(e){a(function(t){var n=[...t];return n.splice(e,1),n}),o.markDirty()}function l(e){r(function(t){return[...t,e]}),o.markDirty()}function u(e){a(function(t){return[...t,e]}),o.markDirty()}function d(){o.startSave(),t(`permissions`,{allow:n,deny:i})}var f=e.global.permissions?.allow??[],p=e.global.permissions?.deny??[];return(0,b.jsxs)(`div`,{className:`py-2`,children:[(0,b.jsxs)(`div`,{className:`mb-6`,children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Allow Rules`}),(0,b.jsx)(E9,{rules:n,onDelete:s,labelPrefix:`allow`}),(0,b.jsx)(D9,{onAdd:l,label:`New allow rule`})]}),(0,b.jsxs)(`div`,{className:`mb-6`,children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Deny Rules`}),(0,b.jsx)(E9,{rules:i,onDelete:c,labelPrefix:`deny`}),(0,b.jsx)(D9,{onAdd:u,label:`New deny rule`})]}),(0,b.jsx)(`div`,{className:`mb-8`,children:(0,b.jsx)(n9,{dirty:o.dirty,saving:o.saving,saveState:o.saveState,onSave:d})}),(f.length>0||p.length>0)&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Global Permissions`}),f.length>0&&(0,b.jsxs)(`div`,{className:`mb-4`,children:[(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/40 uppercase tracking-wider mb-1.5`,children:`Allow`}),(0,b.jsx)(E9,{rules:f,readOnly:!0})]}),p.length>0&&(0,b.jsxs)(`div`,{className:`mb-4`,children:[(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/40 uppercase tracking-wider mb-1.5`,children:`Deny`}),(0,b.jsx)(E9,{rules:p,readOnly:!0})]})]})]})}function DIe({settings:e,projectSlug:t}){var{send:n,subscribe:r,unsubscribe:i}=z(),a=e.global.skills,o=e.skills,s=a.length>0||o.length>0,[c,l]=(0,x.useState)(null);(0,x.useEffect)(function(){function e(e){if(e.type===`skills:view_result`){var t=e;l({path:t.path,content:t.content})}}return r(`skills:view_result`,e),function(){i(`skills:view_result`,e)}},[]);function u(e){n({type:`skills:view`,path:e})}return(0,b.jsxs)(`div`,{className:`py-2 space-y-6`,children:[!s&&(0,b.jsx)(`div`,{className:`py-12 text-center text-[13px] text-base-content/40`,children:`No skills found.`}),a.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Global Skills`}),(0,b.jsx)(`div`,{className:`space-y-2`,children:a.map(function(e){return(0,b.jsx)(m9,{skill:e,badge:`global`,onClick:function(){u(e.path)}},e.path)})})]}),o.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Project Skills`}),(0,b.jsx)(`div`,{className:`space-y-2`,children:o.map(function(e){return(0,b.jsx)(m9,{skill:e,onClick:function(){u(e.path)}},e.path)})})]}),(0,b.jsx)(p9,{defaultScope:`project`,defaultProjectSlug:t}),c&&(0,b.jsx)(h9,{path:c.path,content:c.content,onClose:function(){l(null)}})]})}function OIe({settings:e,updateSection:t}){var n=e.global.rules??[],[r,i]=(0,x.useState)(function(){return(e.rules??[]).map(function(e){return{filename:e.filename,content:e.content}})}),[a,o]=(0,x.useState)(new Set),[s,c]=(0,x.useState)(new Set),[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(``),[p,m]=(0,x.useState)(``),h=$7();(0,x.useEffect)(function(){h.savingRef.current?h.confirmSave():(i((e.rules??[]).map(function(e){return{filename:e.filename,content:e.content}})),h.resetFromServer())},[e]);function g(e){o(function(t){var n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function _(e){c(function(t){var n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function v(e,t){i(function(n){return n.map(function(n,r){return r===e?{...n,content:t}:n})}),h.markDirty()}function y(e){i(function(t){return t.filter(function(t,n){return n!==e})}),c(new Set),h.markDirty()}function S(){var e=d.trim();!e||!e.endsWith(`.md`)||(i(function(t){return[...t,{filename:e,content:p}]}),f(``),m(``),u(!1),h.markDirty())}function C(){u(!1),f(``),m(``)}function w(){h.startSave(),t(`rules`,{rules:r})}function T(e){var t=e.trim();return t.length<=80?t:t.slice(0,80)+`...`}var E=`w-full px-3 py-2 bg-base-300 border border-base-content/15 rounded-xl text-base-content font-mono text-[12px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms] resize-y min-h-[120px]`,D=`w-full h-9 sm:h-7 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content font-mono text-[12px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`;return(0,b.jsxs)(`div`,{className:`py-2`,children:[(0,b.jsxs)(`a`,{href:`https://docs.anthropic.com/en/docs/claude-code/memory`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[11px] text-base-content/30 hover:text-primary/70 flex items-center gap-1 mb-4 transition-colors`,children:[(0,b.jsx)(xm,{size:11}),`Claude Code docs`]}),(0,b.jsxs)(`div`,{className:`mb-6`,children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Global Rules`}),n.length===0&&(0,b.jsx)(`div`,{className:`py-4 text-center text-[13px] text-base-content/30`,children:`No global rules.`}),n.length>0&&(0,b.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:n.map(function(e,t){var n=a.has(t);return(0,b.jsxs)(`div`,{className:`border border-base-content/10 rounded-xl overflow-hidden`,children:[(0,b.jsxs)(`button`,{onClick:function(){g(t)},className:`w-full flex items-center gap-2 px-3 py-2 bg-base-300/50 hover:bg-base-300/70 transition-colors duration-[120ms] cursor-pointer text-left`,children:[n?(0,b.jsx)(nu,{size:12,className:`text-base-content/40 flex-shrink-0`}):(0,b.jsx)(ou,{size:12,className:`text-base-content/40 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`font-mono text-[12px] text-base-content/40 flex-1 truncate`,children:e.filename}),(0,b.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-base-content/30`,children:`global`})]}),!n&&(0,b.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-base-content/30 font-mono truncate`,children:T(e.content)}),n&&(0,b.jsx)(`pre`,{className:`px-3 py-2 text-[12px] text-base-content/40 font-mono whitespace-pre-wrap break-words bg-base-300/30 max-h-[300px] overflow-auto`,children:e.content})]},e.filename+`-`+t)})})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Project Rules`}),r.length===0&&!l&&(0,b.jsx)(`div`,{className:`py-4 text-center text-[13px] text-base-content/30 mb-3`,children:`No project rules.`}),r.length>0&&(0,b.jsx)(`div`,{className:`flex flex-col gap-1.5 mb-3`,children:r.map(function(e,t){var n=s.has(t);return(0,b.jsxs)(`div`,{className:`border border-base-content/15 rounded-xl overflow-hidden`,children:[(0,b.jsxs)(`div`,{className:`w-full flex items-center gap-2 px-3 py-2 bg-base-300 text-left`,children:[(0,b.jsxs)(`button`,{onClick:function(){_(t)},className:`flex items-center gap-2 flex-1 min-w-0 cursor-pointer hover:text-base-content/80 transition-colors`,children:[n?(0,b.jsx)(nu,{size:12,className:`text-base-content/60 flex-shrink-0`}):(0,b.jsx)(ou,{size:12,className:`text-base-content/60 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`font-mono text-[12px] text-base-content flex-1 truncate text-left`,children:e.filename})]}),(0,b.jsx)(`button`,{onClick:function(){y(t)},className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-error flex-shrink-0 focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":`Delete `+e.filename,children:(0,b.jsx)(iw,{size:14})})]}),!n&&(0,b.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-base-content/50 font-mono truncate`,children:T(e.content)}),n&&(0,b.jsx)(`div`,{className:`px-3 py-2 bg-base-300/30`,children:(0,b.jsx)(`textarea`,{value:e.content,onChange:function(e){v(t,e.target.value)},className:E,rows:8,"aria-label":`Content for `+e.filename})})]},e.filename+`-`+t)})}),l&&(0,b.jsxs)(`div`,{className:`border border-dashed border-base-content/20 rounded-xl p-3 mb-3 flex flex-col gap-2`,children:[(0,b.jsx)(`input`,{type:`text`,value:d,onChange:function(e){f(e.target.value)},placeholder:`filename.md`,"aria-label":`New rule filename`,className:D}),(0,b.jsx)(`textarea`,{value:p,onChange:function(e){m(e.target.value)},placeholder:`Rule content...`,"aria-label":`New rule content`,className:E,rows:5}),(0,b.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,b.jsx)(`button`,{onClick:C,className:`btn btn-ghost btn-sm text-[12px]`,children:`Cancel`}),(0,b.jsx)(`button`,{onClick:S,disabled:!d.trim()||!d.trim().endsWith(`.md`),className:`btn btn-sm btn-primary text-[12px]`+(!d.trim()||!d.trim().endsWith(`.md`)?` opacity-50 cursor-not-allowed`:``),children:`Add`})]})]}),!l&&(0,b.jsxs)(`button`,{onClick:function(){u(!0)},className:`flex items-center gap-1.5 px-3 py-2.5 sm:py-1.5 rounded-xl border border-dashed border-base-content/20 bg-transparent text-base-content/40 text-[12px] hover:text-base-content/60 hover:border-base-content/30 transition-colors duration-[120ms] mb-5 cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100`,children:[(0,b.jsx)($b,{size:12}),`Add Rule`]}),(0,b.jsx)(n9,{dirty:h.dirty,saving:h.saving,saveState:h.saveState,onSave:w})]})]})}function kIe({settings:e,updateSection:t}){var n=e.global.mcpServers??{},r=Object.entries(n),[i,a]=(0,x.useState)(function(){return{...e.mcpServers??{}}}),o=$7(),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(s9),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(s9),[h,g]=(0,x.useState)(null);(0,x.useEffect)(function(){o.savingRef.current?o.confirmSave():(a({...e.mcpServers??{}}),o.resetFromServer())},[e]);var _=Object.entries(i);function v(){var e=l.name.trim();e&&(a({...i,[e]:l9(l)}),c(!1),u(s9()),o.markDirty())}function y(e){f(e),m(c9(e,i[e])),c(!1),g(null)}function S(){if(d){var e=p.name.trim();if(e){var t={...i};e!==d&&delete t[d],t[e]=l9(p),a(t),f(null),o.markDirty()}}}function C(e){if(h!==e){g(e);return}var t={...i};delete t[e],a(t),d===e&&f(null),g(null),o.markDirty()}function w(){o.startSave(),t(`mcp`,{mcpServers:i})}var T=new Set(Object.keys(i)),E=new Set(Object.keys(i).filter(function(e){return e!==d}));return(0,b.jsxs)(`div`,{className:`py-2`,children:[(0,b.jsxs)(`div`,{className:`mb-6`,children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Global MCP Servers`}),r.length===0&&(0,b.jsx)(`div`,{className:`py-4 text-center text-[13px] text-base-content/30`,children:`No global MCP servers.`}),r.length>0&&(0,b.jsx)(`div`,{className:`flex flex-col gap-2`,children:r.map(function([e,t]){return(0,b.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 rounded-xl bg-base-300/50 border border-base-content/10`,children:[(0,b.jsx)(`span`,{className:`font-mono text-[12px] text-base-content/40 font-semibold flex-shrink-0`,children:e}),u9(t),(0,b.jsx)(`div`,{className:`flex-1 min-w-0`,children:d9(t)}),(0,b.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-base-content/30 flex-shrink-0`,children:`global`})]},e)})})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Project MCP Servers`}),_.length===0&&!s&&(0,b.jsx)(`div`,{className:`py-4 text-center text-[13px] text-base-content/30 mb-3`,children:`No project MCP servers.`}),(0,b.jsx)(`div`,{className:`flex flex-col gap-2 mb-3`,children:_.map(function([e,t]){if(d===e)return(0,b.jsx)(f9,{form:p,setForm:m,onSave:S,onCancel:function(){f(null)},existingNames:E,idPrefix:`mcp-edit`},e);var n=h===e;return(0,b.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 rounded-xl bg-base-300 border border-base-content/15`,children:[(0,b.jsx)(`span`,{className:`font-mono text-[12px] text-base-content font-semibold flex-shrink-0`,children:e}),u9(t),(0,b.jsx)(`div`,{className:`flex-1 min-w-0`,children:d9(t)}),n?(0,b.jsxs)(`div`,{className:`flex gap-1.5 flex-shrink-0`,children:[(0,b.jsx)(`button`,{onClick:function(){C(e)},className:`btn btn-error btn-xs`,children:`Confirm`}),(0,b.jsx)(`button`,{onClick:function(){g(null)},className:`btn btn-ghost btn-xs`,children:`Cancel`})]}):(0,b.jsxs)(`div`,{className:`flex gap-1 flex-shrink-0`,children:[(0,b.jsx)(`button`,{onClick:function(){y(e)},"aria-label":`Edit `+e,className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-primary focus-visible:ring-2 focus-visible:ring-primary`,children:(0,b.jsx)(bb,{size:12})}),(0,b.jsx)(`button`,{onClick:function(){C(e)},"aria-label":`Delete `+e,className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-error focus-visible:ring-2 focus-visible:ring-primary`,children:(0,b.jsx)(XC,{size:12})})]})]},e)})}),s&&(0,b.jsx)(`div`,{className:`mb-3`,children:(0,b.jsx)(f9,{form:l,setForm:u,onSave:v,onCancel:function(){c(!1),u(s9())},existingNames:T,idPrefix:`mcp-add`})}),!s&&(0,b.jsxs)(`button`,{onClick:function(){c(!0),f(null),g(null)},className:`flex items-center gap-1.5 px-3 py-2.5 sm:py-1.5 rounded-xl border border-dashed border-base-content/20 bg-transparent text-base-content/40 text-[12px] hover:text-base-content/60 hover:border-base-content/30 transition-colors duration-[120ms] mb-5 cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100`,children:[(0,b.jsx)($b,{size:12}),`Add Server`]}),(0,b.jsx)(n9,{dirty:o.dirty,saving:o.saving,saveState:o.saveState,onSave:w})]})]})}function AIe(e){return localStorage.getItem(`lattice-mute-`+e)===`1`}function jIe(e,t){localStorage.setItem(`lattice-mute-`+e,t?`1`:`0`)}function MIe({projectSlug:e}){var t=e??``,[n,r]=(0,x.useState)(function(){return AIe(t)});function i(){var e=!n;r(e),jIe(t,e)}return(0,b.jsx)(`div`,{className:`py-2 space-y-6`,children:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Project Notifications`}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between py-2 px-3 bg-base-300 border border-base-content/15 rounded-xl`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[13px] text-base-content`,children:`Mute all notifications`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30 mt-0.5`,children:`Suppress all browser notifications from this project`})]}),(0,b.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:n,onChange:i})]})]})})}function NIe({settings:e,updateSection:t}){var{send:n,subscribe:r,unsubscribe:i}=z(),[a,o]=(0,x.useState)([]),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(e.disabledPlugins??[]),[d,f]=(0,x.useState)(!1);(0,x.useEffect)(function(){function e(e){e.type===`plugin:list_result`&&(o(e.plugins),c(!0))}return r(`plugin:list_result`,e),n({type:`plugin:list`}),function(){i(`plugin:list_result`,e)}},[]),(0,x.useEffect)(function(){u(e.disabledPlugins??[])},[e.disabledPlugins]);function p(e){var n=l.indexOf(e)===-1?l.concat(e):l.filter(function(t){return t!==e});u(n),f(!0),t(`plugins`,{disabledPlugins:n}),setTimeout(function(){f(!1)},500)}if(!s)return(0,b.jsx)(`div`,{className:`text-[13px] text-base-content/40 py-4`,children:`Loading...`});if(a.length===0)return(0,b.jsx)(`div`,{className:`py-6 text-center text-[13px] text-base-content/30`,children:`No plugins installed. Install plugins from Global Settings to use them in projects.`});var m=a.length-l.length;return(0,b.jsxs)(`div`,{className:`py-2 space-y-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,b.jsx)(`p`,{className:`text-[12px] text-base-content/40`,children:`Toggle plugins on/off for this project. Disabled plugins won't load in new sessions.`}),d&&(0,b.jsx)(gg,{size:12,className:`text-primary animate-spin`})]}),(0,b.jsxs)(`div`,{className:`text-[11px] text-base-content/30 mb-1`,children:[m,` of `,a.length,` enabled`]}),(0,b.jsx)(`div`,{className:`space-y-1.5`,children:a.map(function(e){var t=l.indexOf(e.key)!==-1;return(0,b.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2.5 rounded-xl border transition-colors duration-[120ms] `+(t?`bg-base-300/30 border-base-content/8 opacity-50`:`bg-base-300 border-base-content/15`),children:[(0,b.jsx)(us,{size:14,className:`text-base-content/25 flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-[13px] font-bold text-base-content truncate`,children:e.name}),(0,b.jsxs)(`span`,{className:`text-[10px] font-mono px-1.5 py-0.5 rounded-md bg-base-content/8 text-base-content/40`,children:[`v`,e.version]})]}),(0,b.jsxs)(`div`,{className:`text-[11px] text-base-content/30 mt-0.5`,children:[e.marketplace,e.skillCount>0?` · `+e.skillCount+` skill`+(e.skillCount===1?``:`s`):``]})]}),(0,b.jsx)(`input`,{type:`checkbox`,checked:!t,onChange:function(){p(e.key)},className:`toggle toggle-sm toggle-primary`,"aria-label":(t?`Enable`:`Disable`)+` `+e.name})]},e.key)})})]})}var PIe={general:{title:`General`},notifications:{title:`Notifications`},claude:{title:`Claude`},environment:{title:`Environment`},mcp:{title:`MCP Servers`},skills:{title:`Skills`},plugins:{title:`Plugins`},rules:{title:`Rules`},permissions:{title:`Permissions`},memory:{title:`Memory`}};function FIe(e,t,n,r){return e===`general`?(0,b.jsx)(_Ie,{settings:t,updateSection:n}):e===`claude`?(0,b.jsx)(CIe,{settings:t,updateSection:n}):e===`environment`?(0,b.jsx)(TIe,{settings:t,updateSection:n}):e===`permissions`?(0,b.jsx)(EIe,{settings:t,updateSection:n}):e===`skills`?(0,b.jsx)(DIe,{settings:t,projectSlug:r}):e===`plugins`?(0,b.jsx)(NIe,{settings:t,updateSection:n}):e===`rules`?(0,b.jsx)(OIe,{settings:t,updateSection:n}):e===`mcp`?(0,b.jsx)(kIe,{settings:t,updateSection:n}):e===`memory`?(0,b.jsx)(_9,{projectSlug:r}):e===`notifications`?(0,b.jsx)(MIe,{projectSlug:r}):(0,b.jsxs)(`div`,{className:`py-2 text-[13px] text-base-content/40`,children:[e,` section coming soon.`]})}function IIe(){var{activeView:e,activeProjectSlug:t,toggleDrawer:n}=Yw();if(e.type!==`project-settings`)return null;var r=e.section,i=PIe[r],{settings:a,loading:o,error:s,updateSection:c}=S9(t);return(0,b.jsxs)(`section`,{"aria-label":`Project Settings`,className:`flex-1 overflow-auto px-4 sm:px-8 py-4 sm:py-6 max-w-3xl`,children:[i&&(0,b.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-square lg:hidden`,"aria-label":`Toggle sidebar`,onClick:n,children:(0,b.jsx)(m_,{size:18})}),(0,b.jsx)(`h1`,{className:`text-lg font-mono font-bold text-base-content`,children:i.title})]}),o&&(0,b.jsx)(`div`,{className:`text-[13px] text-base-content/40 py-4`,children:`Loading...`}),s&&(0,b.jsx)(`div`,{className:`text-[13px] text-error py-4`,children:s}),!o&&!s&&a&&FIe(r,a,c,t??void 0)]})}function LIe(e){var t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return n+`s ago`;var r=Math.floor(n/60);if(r<60)return r+`m ago`;var i=Math.floor(r/60);return i<24?i+`h ago`:Math.floor(i/24)+`d ago`}function RIe(){kT();var{nodes:e}=Jw(),{projects:t}=Gw(),n=Yw(),{send:r,subscribe:i,unsubscribe:a}=z(),[o,s]=(0,x.useState)([]),[c,l]=(0,x.useState)(null),u=(0,x.useMemo)(function(){return e.filter(function(e){return e.online})},[e]);(0,x.useEffect)(function(){function e(e){e.type===`session:list_all`&&s(e.sessions)}function t(e){e.type===`settings:data`&&l(e.config)}return i(`session:list_all`,e),i(`settings:data`,t),r({type:`session:list_all_request`}),r({type:`settings:get`}),function(){a(`session:list_all`,e),a(`settings:data`,t)}},[]);var d=(0,x.useMemo)(function(){for(var e=new Map,n=0;n<t.length;n++)e.set(t[n].slug,t[n].title);return e},[t]);function f(e){return d.get(e)||e}var p=(0,x.useMemo)(function(){for(var e=new Map,t=0;t<o.length;t++){var n=o[t],r=e.get(n.projectSlug);r||(r=[],e.set(n.projectSlug,r)),r.push(n)}return e},[o]),m=e.filter(function(e){return!e.isLocal});return(0,b.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,b.jsxs)(`div`,{className:`max-w-2xl mx-auto px-4 sm:px-8 py-6 sm:py-10`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-square lg:hidden`,"aria-label":`Toggle sidebar`,onClick:n.toggleDrawer,children:(0,b.jsx)(m_,{size:18})}),(0,b.jsx)(sw,{size:28}),(0,b.jsx)(`h1`,{className:`text-lg font-mono font-bold text-base-content`,children:`Lattice`})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] font-mono text-base-content/30 mb-10 ml-[43px]`,children:[(0,b.jsxs)(`span`,{children:[u.length,`/`,e.length,` nodes`]}),(0,b.jsx)(`span`,{className:`text-base-content/15`,children:`/`}),(0,b.jsxs)(`span`,{children:[t.length,` projects`]}),(0,b.jsx)(`span`,{className:`text-base-content/15`,children:`/`}),(0,b.jsxs)(`span`,{children:[o.length,` sessions`]})]}),(0,b.jsx)(`div`,{className:`mb-12`,children:(0,b.jsx)(p7,{})}),o.length>0&&(0,b.jsxs)(`div`,{className:`mb-12`,children:[(0,b.jsx)(`h2`,{className:`text-[11px] font-semibold tracking-wider uppercase text-base-content/40 mb-3`,children:`Recent Sessions`}),(0,b.jsx)(`div`,{className:`flex flex-col gap-1`,children:o.slice(0,8).map(function(e){return(0,b.jsxs)(`button`,{onClick:function(){gw(e.id,e.projectSlug,e.title),n.navigateToSession(e.projectSlug,e.id)},className:`flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-base-200 transition-colors duration-[120ms] cursor-pointer text-left focus-visible:ring-2 focus-visible:ring-primary group`,children:[(0,b.jsx)(W_,{size:12,className:`text-base-content/20 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`flex-1 text-[12px] text-base-content/70 truncate group-hover:text-base-content`,children:AT(e.title)||`Untitled`}),(0,b.jsx)(`span`,{className:`text-[10px] font-mono text-base-content/25 flex-shrink-0`,children:f(e.projectSlug)}),(0,b.jsx)(`span`,{className:`text-[10px] text-base-content/20 font-mono flex-shrink-0`,children:LIe(e.updatedAt)}),(0,b.jsx)(ou,{size:10,className:`text-base-content/15 flex-shrink-0 opacity-0 group-hover:opacity-100`})]},e.id)})})]}),t.length>0&&(0,b.jsxs)(`div`,{className:`mb-12`,children:[(0,b.jsx)(`h2`,{className:`text-[11px] font-semibold tracking-wider uppercase text-base-content/40 mb-3`,children:`Projects`}),(0,b.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:t.map(function(e){var t=p.get(e.slug)||[];return(0,b.jsxs)(`button`,{onClick:function(){n.setActiveProjectSlug(e.slug)},className:`flex items-center gap-3 px-3 py-2.5 rounded-lg hover:bg-base-200 transition-colors duration-[120ms] cursor-pointer text-left focus-visible:ring-2 focus-visible:ring-primary group`,children:[(0,b.jsx)(Wm,{size:14,className:`text-base-content/20 flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsx)(`div`,{className:`text-[13px] font-semibold text-base-content/70 truncate group-hover:text-base-content`,children:e.title}),(0,b.jsxs)(`div`,{className:`text-[10px] text-base-content/25 font-mono`,children:[t.length,` session`,t.length===1?``:`s`,e.isRemote&&(0,b.jsxs)(`span`,{className:`ml-1.5 text-base-content/20`,children:[`on `,e.nodeName]})]})]}),(0,b.jsx)(ou,{size:12,className:`text-base-content/15 flex-shrink-0 opacity-0 group-hover:opacity-100`})]},e.slug+`@`+e.nodeId)})})]}),m.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[11px] font-semibold tracking-wider uppercase text-base-content/40 mb-3`,children:`Mesh`}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:m.map(function(e){return(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.online?(0,b.jsx)(Bu,{size:10,className:`text-success flex-shrink-0`}):(0,b.jsx)(fd,{size:10,className:`text-base-content/20 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`text-[12px] text-base-content/50`,children:e.name}),(0,b.jsxs)(`span`,{className:`text-[10px] text-base-content/20 font-mono`,children:[e.projects.length,`p`]})]},e.id)})})]})]})})}function O9({label:e,value:t,icon:n,loading:r}){return(0,b.jsxs)(`div`,{className:`bg-base-300 rounded-xl border border-base-content/15 p-3 px-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[n,(0,b.jsx)(`span`,{className:`text-[11px] font-semibold tracking-wider uppercase text-base-content/40`,children:e})]}),r?(0,b.jsx)(`div`,{className:`h-7 w-10 bg-base-content/10 rounded animate-pulse`}):(0,b.jsx)(`div`,{className:`text-xl font-mono font-bold text-base-content`,children:t})]})}function k9({label:e,icon:t,onClick:n}){return(0,b.jsxs)(`button`,{onClick:n,className:`flex items-center gap-2.5 px-3 py-2 rounded-xl border border-base-content/15 bg-base-300 text-[12px] text-base-content/60 hover:text-base-content hover:border-base-content/30 transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary`,children:[t,(0,b.jsx)(`span`,{className:`flex-1 text-left`,children:e}),(0,b.jsx)(ou,{size:12,className:`text-base-content/30`})]})}function zIe(){var e=Yw();if(e.activeView.type!==`project-dashboard`)return null;var{settings:t,loading:n}=S9(e.activeProjectSlug),{projects:r}=Gw(),{send:i,subscribe:a,unsubscribe:o,status:s}=z(),[c,l]=(0,x.useState)([]),[u,d]=(0,x.useState)(!0),f=r.find(function(t){return t.slug===e.activeProjectSlug}),p=f?.title??e.activeProjectSlug??`Project`;(0,x.useEffect)(function(){if(!e.activeProjectSlug)return;function t(t){if(t.type===`session:list`){var n=t;n.projectSlug===e.activeProjectSlug&&(l(n.sessions.slice().sort(function(e,t){return t.updatedAt-e.updatedAt})),d(!1))}}return a(`session:list`,t),s===`connected`&&(d(!0),i({type:`session:list_request`,projectSlug:e.activeProjectSlug})),function(){o(`session:list`,t)}},[e.activeProjectSlug,s]);function m(t){e.openProjectSettings(t)}function h(t){f&&(gw(t.id,f.slug,t.title),e.setActiveSessionId(t.id))}var g=c.length,_=t?Object.keys(t.mcpServers).length:0,v=t?Object.keys(t.global.mcpServers).length:0,y=t?t.rules.length:0,S=t?t.global.rules.length:0,C=t?Object.keys(t.env).length:0;return(0,b.jsxs)(`div`,{className:`flex-1 overflow-auto px-4 sm:px-8 py-4 sm:py-6 max-w-3xl`,children:[(0,b.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-square lg:hidden`,"aria-label":`Toggle sidebar`,onClick:e.toggleDrawer,children:(0,b.jsx)(m_,{size:18})}),(0,b.jsx)(`h1`,{className:`text-lg font-mono font-bold text-base-content`,children:p})]}),(0,b.jsxs)(`div`,{className:`space-y-6`,children:[(0,b.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3`,children:[(0,b.jsx)(O9,{label:`Sessions`,value:g,icon:(0,b.jsx)(W_,{size:14,className:`text-primary`}),loading:u}),(0,b.jsx)(O9,{label:`MCP Servers`,value:_+v,icon:(0,b.jsx)(Qb,{size:14,className:`text-accent`}),loading:n}),(0,b.jsx)(O9,{label:`Rules`,value:y+S,icon:(0,b.jsx)(oC,{size:14,className:`text-info`}),loading:n}),(0,b.jsx)(O9,{label:`Env Vars`,value:C,icon:(0,b.jsx)(JC,{size:14,className:`text-success`}),loading:n})]}),n?(0,b.jsx)(`div`,{className:`bg-base-content/10 rounded-xl h-32 animate-pulse`}):t?.claudeMd?(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`CLAUDE.md`}),(0,b.jsx)(`div`,{className:`px-3 py-2.5 bg-base-300 border border-base-content/15 rounded-xl font-mono text-[11px] text-base-content/60 leading-relaxed max-h-48 overflow-y-auto`,children:(0,b.jsx)(`pre`,{className:`whitespace-pre-wrap`,children:t.claudeMd})})]}):null,(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Recent Sessions`}),u?(0,b.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[0,1,2].map(function(e){return(0,b.jsx)(`div`,{className:`bg-base-content/10 rounded-xl h-10 animate-pulse`},e)})}):c.length>0?(0,b.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:c.slice(0,5).map(function(e){return(0,b.jsxs)(`button`,{onClick:function(){h(e)},className:`flex items-center gap-3 px-3 py-2 rounded-xl border border-base-content/15 bg-base-300 hover:border-base-content/30 transition-colors duration-[120ms] cursor-pointer text-left focus-visible:ring-2 focus-visible:ring-primary`,children:[(0,b.jsx)(W_,{size:12,className:`text-base-content/30 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`flex-1 text-[12px] text-base-content truncate`,children:e.title||`Untitled`}),(0,b.jsx)(`span`,{className:`text-[10px] text-base-content/30 font-mono flex-shrink-0`,children:new Date(e.updatedAt).toLocaleDateString()}),(0,b.jsx)(ou,{size:12,className:`text-base-content/20 flex-shrink-0`})]},e.id)})}):(0,b.jsx)(`div`,{className:`text-[12px] text-base-content/30`,children:`No sessions yet`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Settings`}),(0,b.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 gap-2`,children:[(0,b.jsx)(k9,{label:`General`,icon:(0,b.jsx)(TC,{size:13,className:`text-base-content/40`}),onClick:function(){m(`general`)}}),(0,b.jsx)(k9,{label:`Claude`,icon:(0,b.jsx)(Vm,{size:13,className:`text-base-content/40`}),onClick:function(){m(`claude`)}}),(0,b.jsx)(k9,{label:`Environment`,icon:(0,b.jsx)(JC,{size:13,className:`text-base-content/40`}),onClick:function(){m(`environment`)}}),(0,b.jsx)(k9,{label:`MCP Servers`,icon:(0,b.jsx)(Qb,{size:13,className:`text-base-content/40`}),onClick:function(){m(`mcp`)}}),(0,b.jsx)(k9,{label:`Rules`,icon:(0,b.jsx)(oC,{size:13,className:`text-base-content/40`}),onClick:function(){m(`rules`)}}),(0,b.jsx)(k9,{label:`Permissions`,icon:(0,b.jsx)(HC,{size:13,className:`text-base-content/40`}),onClick:function(){m(`permissions`)}})]})]}),t&&(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30 font-mono truncate`,children:t.path})]})]})}function BIe({isOpen:e,onClose:t}){var{send:n,subscribe:r,unsubscribe:i}=z(),{nodes:a}=Jw(),o=$7(),s=a.find(function(e){return e.isLocal}),c=s?s.id:``,[l,u]=(0,x.useState)(null),[d,f]=(0,x.useState)(``),[p,m]=(0,x.useState)(7654),[h,g]=(0,x.useState)(!1),[_,v]=(0,x.useState)(!1),[y,S]=(0,x.useState)(!1),[C,w]=(0,x.useState)(`auto`),T=(0,x.useRef)(null),E=(0,x.useRef)(null);Ur(E,(0,x.useCallback)(function(){t()},[t]),e),(0,x.useEffect)(function(){if(!e)return;function t(e){if(e.type===`settings:data`){var t=e.config;u(t),o.saving?o.confirmSave():(f(t.name),m(t.port),g(t.tls),v(t.debug),w(t.wsl??`auto`),o.resetFromServer())}}return r(`settings:data`,t),n({type:`settings:get`}),function(){i(`settings:data`,t)}},[e]),(0,x.useEffect)(function(){return function(){T.current&&clearTimeout(T.current)}},[]);function D(){o.startSave(),n({type:`settings:update`,settings:{name:d,port:p,tls:h,debug:_,wsl:C}})}function O(){c&&(navigator.clipboard.writeText(c),S(!0),T.current&&clearTimeout(T.current),T.current=setTimeout(function(){S(!1)},2e3))}if(!e)return null;var k=`w-full h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[13px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`;return(0,b.jsxs)(`div`,{ref:E,className:`fixed inset-0 z-[9999] flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"aria-label":`Node Settings`,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-base-content/50`,onClick:t}),(0,b.jsxs)(`div`,{className:`relative bg-base-200 border border-base-content/15 rounded-2xl shadow-2xl w-full max-w-md mx-4 overflow-hidden`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-base-content/15`,children:[(0,b.jsx)(`h2`,{className:`text-[15px] font-mono font-bold text-base-content`,children:`Node Settings`}),(0,b.jsx)(`button`,{onClick:t,"aria-label":`Close`,className:`btn btn-ghost btn-xs btn-square text-base-content/40 hover:text-base-content`,children:(0,b.jsx)(iw,{size:16})})]}),(0,b.jsxs)(`div`,{className:`px-5 py-4 space-y-4 max-h-[70vh] overflow-y-auto`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{htmlFor:`node-id`,className:`block text-[12px] font-semibold text-base-content/40 mb-1.5`,children:`Node ID`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`div`,{className:`flex-1 h-9 px-3 bg-base-300/50 border border-base-content/10 rounded-xl font-mono text-[11px] text-base-content/50 flex items-center truncate select-all`,children:c||`Loading...`}),(0,b.jsx)(`button`,{onClick:O,disabled:!c,"aria-label":`Copy node ID`,className:`btn btn-ghost btn-sm btn-square text-base-content/30 hover:text-base-content flex-shrink-0`,children:y?(0,b.jsx)(R,{size:14,className:`text-success`}):(0,b.jsx)(qf,{size:14})})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{htmlFor:`node-name`,className:`block text-[12px] font-semibold text-base-content/40 mb-1.5`,children:`Node Name`}),(0,b.jsx)(`input`,{id:`node-name`,type:`text`,value:d,onChange:function(e){f(e.target.value),o.markDirty()},placeholder:`My Node`,className:k})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{htmlFor:`node-port`,className:`block text-[12px] font-semibold text-base-content/40 mb-1.5`,children:`Port`}),(0,b.jsx)(`input`,{id:`node-port`,type:`number`,value:p,onChange:function(e){var t=parseInt(e.target.value,10);isNaN(t)||(m(t),o.markDirty())},min:1,max:65535,className:k+` font-mono`})]}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40`,children:`TLS`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30`,children:`Encrypt connections between nodes`})]}),(0,b.jsx)(`input`,{type:`checkbox`,checked:h,onChange:function(e){g(e.target.checked),o.markDirty()},className:`toggle toggle-sm toggle-primary`,"aria-label":`Enable TLS`})]}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40`,children:`Debug Mode`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30`,children:`Enable verbose logging`})]}),(0,b.jsx)(`input`,{type:`checkbox`,checked:_,onChange:function(e){v(e.target.checked),o.markDirty()},className:`toggle toggle-sm toggle-primary`,"aria-label":`Enable debug mode`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-1.5`,children:`WSL Mode`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30 mb-2`,children:`Convert file paths for Windows editors when running under WSL`}),(0,b.jsxs)(`select`,{value:String(C),onChange:function(e){var t=e.target.value;w(t===`true`?!0:t===`false`?!1:`auto`),o.markDirty()},className:k,children:[(0,b.jsx)(`option`,{value:`auto`,children:`Auto-detect`}),(0,b.jsx)(`option`,{value:`true`,children:`Enabled`}),(0,b.jsx)(`option`,{value:`false`,children:`Disabled`})]})]})]}),(0,b.jsx)(`div`,{className:`px-5 py-3 border-t border-base-content/15`,children:(0,b.jsx)(n9,{dirty:o.dirty,saving:o.saving,saveState:o.saveState,onSave:D})})]})]})}function VIe({isOpen:e,onClose:t}){var{send:n,subscribe:r,unsubscribe:i}=z(),{projects:a}=Gw(),[o,s]=(0,x.useState)(``),[c,l]=(0,x.useState)([]),[u,d]=(0,x.useState)(``),[f,p]=(0,x.useState)(!1),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(-1),[v,y]=(0,x.useState)(null),[S,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)([]),[E,D]=(0,x.useState)(``),O=(0,x.useRef)(null),k=(0,x.useRef)(null),A=(0,x.useRef)(null),j=(0,x.useRef)(!1),M=(0,x.useRef)(!1),N=(0,x.useRef)(null);Ur(N,(0,x.useCallback)(function(){t()},[t]),e),(0,x.useEffect)(function(){if(!e)return;s(``),l([]),d(``),p(!1),h(!1),y(null),C(!1),T([]),M.current=!1,n({type:`browse:list`,path:`~`}),n({type:`browse:suggestions`});function a(e){if(e.type===`browse:list_result`){var t=e;l(t.entries),D(t.homedir),_(-1),j.current&&t.entries.length>0&&h(!0)}}function o(e){e.type===`browse:suggestions_result`&&T(e.suggestions)}function c(e){e.type===`projects:list`&&M.current&&(M.current=!1,C(!1),t())}return r(`browse:list_result`,a),r(`browse:suggestions_result`,o),r(`projects:list`,c),function(){i(`browse:list_result`,a),i(`browse:suggestions_result`,o),i(`projects:list`,c)}},[e]),(0,x.useEffect)(function(){if(!e)return;function t(e){A.current&&!A.current.contains(e.target)&&k.current&&!k.current.contains(e.target)&&h(!1)}return document.addEventListener(`mousedown`,t),function(){document.removeEventListener(`mousedown`,t)}},[e]),(0,x.useEffect)(function(){if(e){O.current&&clearTimeout(O.current);var t=o.trim();if(!t){n({type:`browse:list`,path:`~`});return}O.current=setTimeout(function(){var e=t;if(!t.endsWith(`/`)){var r=t.lastIndexOf(`/`);e=r>=0?t.slice(0,r+1):t}n({type:`browse:list`,path:e})},200)}},[o,e]);function ee(e){return e.startsWith(`~/`)&&E?E+e.slice(1):e===`~`&&E?E:e}function te(e){s(e.path+`/`),h(!1),y(null),f||(e.projectName?d(e.projectName):d(e.name)),n({type:`browse:list`,path:e.path}),k.current&&k.current.focus()}function P(e){d(e),p(e.length>0)}function F(){j.current=!0,re().length>0&&h(!0)}function ne(){j.current=!1}function re(){var e=o.trim();if(!e||e.endsWith(`/`))return c;var t=e.lastIndexOf(`/`),n=t>=0?e.slice(t+1).toLowerCase():e.toLowerCase();return n?c.filter(function(e){return e.name.toLowerCase().startsWith(n)}):c}function ie(){var e=o.trim();if(!e)return!1;var t=ee(e.endsWith(`/`)?e.slice(0,-1):e);return!a.some(function(e){return e.path===t})}function ae(){var e=o.trim();if(!e)return{type:`info`,text:`Type a path to browse directories`};var t=ee(e.endsWith(`/`)?e.slice(0,-1):e);return a.some(function(e){return e.path===t})?{type:`error`,text:`Already added as a project`}:null}function oe(e){var t=re();if(!m||t.length===0){e.key===`Enter`&&se&&(e.preventDefault(),ce());return}e.key===`ArrowDown`?(e.preventDefault(),_(function(e){var n=e+1;return n>=t.length&&(n=0),I(n),n})):e.key===`ArrowUp`?(e.preventDefault(),_(function(e){var n=e-1;return n<0&&(n=t.length-1),I(n),n})):e.key===`Tab`||e.key===`Enter`?g>=0&&g<t.length?(e.preventDefault(),te(t[g]),_(-1)):e.key===`Enter`&&se&&(e.preventDefault(),ce()):e.key===`Escape`&&(e.stopPropagation(),h(!1),_(-1))}function I(e){if(A.current){var t=A.current.children;t[e]&&t[e].scrollIntoView({block:`nearest`})}}var se=ie()&&!S;function ce(){var e=o.trim();if(!(!e||S)){var t=ee(e.endsWith(`/`)?e.slice(0,-1):e),r=u.trim()||t.split(`/`).pop()||`Untitled`;C(!0),M.current=!0,n({type:`settings:update`,settings:{projects:[{path:t,title:r}]}})}}if(!e)return null;var le=re(),ue=ae();return(0,b.jsxs)(`div`,{ref:N,className:`fixed inset-0 z-[9999] flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"aria-label":`Add Project`,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-base-content/50`,onClick:t}),(0,b.jsxs)(`div`,{className:`relative bg-base-200 border border-base-content/15 rounded-2xl shadow-2xl w-full max-w-3xl mx-4 overflow-hidden`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-base-content/15`,children:[(0,b.jsx)(`h2`,{className:`text-[15px] font-mono font-bold text-base-content`,children:`Add Project`}),(0,b.jsx)(`button`,{onClick:t,"aria-label":`Close`,className:`btn btn-ghost btn-xs btn-square text-base-content/40 hover:text-base-content`,children:(0,b.jsx)(iw,{size:16})})]}),(0,b.jsxs)(`div`,{className:`px-5 py-4 space-y-4`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{htmlFor:`project-path`,className:`block text-[12px] font-semibold text-base-content/40 mb-1.5`,children:`Project Path`}),(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(`input`,{ref:k,id:`project-path`,type:`text`,value:o,onChange:function(e){s(e.target.value),h(!0),_(-1),y(null)},onFocus:F,onBlur:ne,onKeyDown:oe,placeholder:`~/projects/my-app`,autoFocus:!0,className:`w-full h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content font-mono text-[12px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`}),m&&le.length>0&&(0,b.jsx)(`div`,{ref:A,className:`absolute top-full left-0 right-0 mt-1 z-50 bg-base-200 border border-base-content/15 rounded-xl shadow-lg max-h-48 overflow-y-auto`,children:le.map(function(e,t){return(0,b.jsxs)(`button`,{onMouseDown:function(e){e.preventDefault()},onClick:function(){te(e),_(-1)},onMouseEnter:function(){_(t)},className:`w-full flex items-center gap-2 px-3 py-2 text-left text-[12px] font-mono transition-colors duration-[80ms] `+(t===g?`bg-base-content/10 text-base-content`:`text-base-content/60 hover:bg-base-content/5 hover:text-base-content`),children:[(0,b.jsx)(Wm,{size:12,className:`text-base-content/25 flex-shrink-0`}),(0,b.jsxs)(`span`,{className:`flex-1 truncate`,children:[e.name,`/`]}),e.projectName&&(0,b.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-md bg-accent/15 text-accent/70 flex-shrink-0 truncate max-w-[100px]`,children:e.projectName}),e.hasClaudeMd&&(0,b.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[10px] px-1.5 py-0.5 rounded-md bg-primary/15 text-primary/70 flex-shrink-0`,children:[(0,b.jsx)(Vm,{size:8}),`CLAUDE.md`]})]},e.path)})})]}),(0,b.jsx)(`div`,{className:`text-[10px] text-base-content/25 mt-1`,children:`Type a path or click directories to navigate`}),!o.trim()&&w.length>0&&!m&&(0,b.jsxs)(`div`,{className:`mt-2`,children:[(0,b.jsx)(`div`,{className:`text-[11px] font-semibold text-base-content/30 mb-1.5`,children:`Projects Claude has worked in`}),(0,b.jsx)(`div`,{className:`flex flex-col gap-1 max-h-48 overflow-y-auto`,children:w.map(function(e){return(0,b.jsxs)(`button`,{title:e.path,onClick:function(){s(e.path+`/`),f||d(e.name),T([]),n({type:`browse:list`,path:e.path})},className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-[12px] font-mono text-base-content/50 hover:bg-base-content/5 hover:text-base-content rounded-lg transition-colors duration-[80ms]`,children:[(0,b.jsx)(Wm,{size:12,className:`text-base-content/25 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.path}),e.hasClaudeMd&&(0,b.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[10px] px-1.5 py-0.5 rounded-md bg-primary/15 text-primary/70 flex-shrink-0`,children:[(0,b.jsx)(Vm,{size:8}),`CLAUDE.md`]})]},e.path)})})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`label`,{htmlFor:`project-title`,className:`block text-[12px] font-semibold text-base-content/40 mb-1.5`,children:[`Title `,(0,b.jsx)(`span`,{className:`font-normal opacity-60`,children:`(optional)`})]}),(0,b.jsx)(`input`,{id:`project-title`,type:`text`,value:u,onChange:function(e){P(e.target.value)},placeholder:`Auto-derived from path`,className:`w-full h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[13px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`})]}),ue&&(0,b.jsx)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-xl border text-[11px] `+(ue.type===`error`?`bg-error/10 border-error/20 text-error`:ue.type===`success`?`bg-success/10 border-success/20 text-success`:`bg-base-content/5 border-base-content/10 text-base-content/40`),children:ue.text})]}),(0,b.jsxs)(`div`,{className:`px-5 py-3 border-t border-base-content/15 flex justify-end gap-2`,children:[(0,b.jsx)(`button`,{onClick:t,className:`btn btn-ghost btn-sm text-[12px]`,children:`Cancel`}),(0,b.jsx)(`button`,{onClick:ce,disabled:!se,className:`btn btn-primary btn-sm text-[12px]`+(se?``:` opacity-50 cursor-not-allowed`),children:S?(0,b.jsx)(gg,{size:14,className:`animate-spin`}):`Add Project`})]})]})]})}function HIe(){var{activeProject:e}=Gw(),{nodes:t}=Jw(),n=Yw();if(!e||!e.isRemote||n.activeView.type!==`chat`)return null;var r=t.find(function(t){return t.id===e.nodeId});return!r||r.online?null:(0,b.jsx)(`div`,{className:`absolute inset-0 z-40 flex items-center justify-center bg-base-100/80 backdrop-blur-sm`,children:(0,b.jsxs)(`div`,{className:`bg-base-300 border border-base-content/15 rounded-2xl shadow-2xl px-8 py-6 max-w-sm text-center`,children:[(0,b.jsx)(tw,{size:28,className:`text-warning mx-auto mb-3`}),(0,b.jsx)(`h3`,{className:`text-[15px] font-mono font-bold text-base-content mb-1`,children:`Node Disconnected`}),(0,b.jsxs)(`p`,{className:`text-[13px] text-base-content/50 mb-3`,children:[(0,b.jsx)(`span`,{className:`font-semibold text-base-content/70`,children:r.name}),` is unreachable.`]}),(0,b.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-[12px] text-base-content/40`,children:[(0,b.jsx)(gg,{size:12,className:`animate-spin`}),`Attempting to reconnect...`]}),(0,b.jsx)(`p`,{className:`text-[11px] text-base-content/25 mt-3`,children:`Session state preserved. Operations will resume on reconnect.`})]})})}var A9=15,j9=.35,UIe=.4,M9=`translate 0.25s cubic-bezier(0.4, 0, 0.2, 1)`,N9=`opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1)`,P9=`transform 0.25s cubic-bezier(0.4, 0, 0.2, 1)`;function WIe(e,t,n,r){var i=(0,x.useRef)({isOpen:t,onOpen:n,onClose:r});i.current={isOpen:t,onOpen:n,onClose:r},(0,x.useEffect)(function(){var t=0,n=0,r=0,a=0,o=0,s=!1,c=!1,l=null,u=null,d=null,f=null,p=0;function m(){var t=e.current;if(!t)return!1;u=t.querySelector(`:scope > *:not(.drawer-overlay)`),d=t.querySelector(`:scope > .drawer-overlay`);var n=t.parentElement;return n&&(f=n.querySelector(`:scope > .drawer-content`)),u&&(p=u.getBoundingClientRect().width),!!u}function h(e){if(u){var t=Math.max(-p,Math.min(0,e)),n=1+t/p;if(u.style.transition=`none`,u.style.translate=t+`px`,d&&(d.style.transition=`none`,d.style.opacity=String(n)),f){var r=1-n*.03;f.style.transition=`none`,f.style.transform=`scale(`+r+`)`,f.style.transformOrigin=`left center`}}}function g(){u&&(u.style.transition=``,u.style.translate=``),d&&(d.style.transition=``,d.style.opacity=``),f&&(f.style.transition=``,f.style.transform=``,f.style.transformOrigin=``)}function _(){u&&(u.style.transition=M9,u.style.translate=`0%`,d&&(d.style.transition=N9,d.style.opacity=`1`),f&&(f.style.transition=P9,f.style.transform=`scale(0.97)`,f.style.transformOrigin=`left center`))}function v(){u&&(u.style.transition=M9,u.style.translate=`-100%`,d&&(d.style.transition=N9,d.style.opacity=`0`),f&&(f.style.transition=P9,f.style.transform=`scale(1)`,f.style.transformOrigin=`left center`))}var y=null;function b(){y!==null&&(clearTimeout(y),y=null)}function x(){if(b(),u){var e=!1;function t(){e||(e=!0,u&&u.removeEventListener(`transitionend`,t),b(),g())}u.addEventListener(`transitionend`,t,{once:!0}),y=setTimeout(t,350)}else g()}function S(e){if(!(window.innerWidth>=1024)){var i=e.touches[0];t=i.clientX,n=i.clientY,r=i.clientX,a=Date.now(),o=0,s=!0,c=!1,l=null}}function C(u){if(s){var d=u.touches[0],f=Date.now(),g=f-a;if(g>0&&(o=(d.clientX-r)/g),r=d.clientX,a=f,l===null){var _=Math.abs(d.clientX-t),v=Math.abs(d.clientY-n);if(_>=A9||v>=A9)if(_>v){if(l=`h`,c=!0,!m()){s=!1;return}var y=e.current;y&&(y.style.visibility=`visible`,y.style.pointerEvents=`auto`,y.style.opacity=`1`)}else{l=`v`,s=!1;return}else return}if(c){var b=d.clientX-t;i.current.isOpen?h(Math.min(0,b)):h(-p+Math.max(0,b))}}}function w(){if(!s||!c){s=!1,l=null;return}var e=r-t,n=i.current.isOpen;s=!1,c=!1,l=null,(Math.abs(o)>UIe?o>0:n?e>-p*j9:e>p*j9)?(_(),n||i.current.onOpen()):(v(),n&&i.current.onClose()),x()}function T(){if(c){g();var t=e.current;t&&(t.style.visibility=``,t.style.pointerEvents=``,t.style.opacity=``),f&&(f.style.transition=``,f.style.transform=``,f.style.transformOrigin=``)}s=!1,c=!1,l=null}return document.addEventListener(`touchstart`,S,{passive:!0}),document.addEventListener(`touchmove`,C,{passive:!0}),document.addEventListener(`touchend`,w,{passive:!0}),document.addEventListener(`touchcancel`,T,{passive:!0}),function(){b(),document.removeEventListener(`touchstart`,S),document.removeEventListener(`touchmove`,C),document.removeEventListener(`touchend`,w),document.removeEventListener(`touchcancel`,T)}},[e])}function F9(){var e=z(),[t,n]=(0,x.useState)(!1),[r,i]=(0,x.useState)(!1),[a,o]=(0,x.useState)(!1),s=(0,x.useRef)(null),c=(0,x.useRef)(0);(0,x.useEffect)(function(){var e=setTimeout(function(){i(!0)},600);return function(){clearTimeout(e)}},[]),(0,x.useEffect)(function(){if(e.status!==`connected`)return;function t(){n(!0)}return e.subscribe(`projects:list`,t),function(){e.unsubscribe(`projects:list`,t)}},[e]);var l=t&&r,u=a&&e.status!==`connected`,d=l&&!u,f=!l||u;if((0,x.useEffect)(function(){if(l&&!a){var e=setTimeout(function(){o(!0)},300);return function(){clearTimeout(e)}}},[l,a]),(0,x.useEffect)(function(){var e=s.current;if(!e)return;var t=e.getContext(`2d`);if(!t)return;var n=9,r=26,i=3.5,a=20,o=a*2+(n-1)*r,l=window.devicePixelRatio||1;e.width=o*l,e.height=o*l,e.style.width=o+`px`,e.style.height=o+`px`,t.scale(l,l);for(var u=o/2,d=o/2,f=14,p=4,m=(f*2+p)/2,h=u-m,g=d-m,_=u+m,v=d+m,y=getComputedStyle(document.documentElement).getPropertyValue(`--color-primary`).trim(),b=y?`oklch(`+y+`)`:`oklch(55% 0.25 280)`,x=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,S=[],C=0;C<n;C++)for(var w=0;w<n;w++){var T=a+w*r,E=a+C*r,D=T+i>h&&T-i<_&&E+i>g&&E-i<v;S.push({x:T,y:E,col:w,row:C,hidden:D,brightness:.08})}var O=[],k=10,A=performance.now();function j(e){for(var t=S[e],r=[],i=-1;i<=1;i++)for(var a=-1;a<=1;a++)if(!(i===0&&a===0)){var o=t.row+i,s=t.col+a;if(o>=0&&o<n&&s>=0&&s<n){var c=o*n+s;S[c].hidden||r.push(c)}}return r}function M(){t.clearRect(0,0,o,o);for(var e=0;e<S.length;e++){var n=S[e];n.hidden||(t.beginPath(),t.arc(n.x,n.y,i,0,Math.PI*2),t.fillStyle=b,t.globalAlpha=.15,t.fill(),t.globalAlpha=1)}for(var r=[[h,g],[h+f+p,g],[h,g+f+p],[h+f+p,g+f+p]],a=0;a<r.length;a++)t.fillStyle=b,t.globalAlpha=.9,t.fillRect(r[a][0],r[a][1],f,f),t.globalAlpha=1}if(x){M();return}function N(){if(A=performance.now(),t.clearRect(0,0,o,o),O.length<k&&Math.random()<.04){for(var e=[],n=0;n<S.length;n++)S[n].hidden||e.push(n);for(var r=0;r<5&&O.length<k;){var a=e[Math.floor(Math.random()*e.length)],s=j(a);if(s.length>0){for(var l=s[Math.floor(Math.random()*s.length)],u=!1,d=0;d<O.length;d++)if(O[d].a===a&&O[d].b===l||O[d].a===l&&O[d].b===a){u=!0;break}if(!u){O.push({a,b:l,birth:A,duration:2e3+Math.random()*3e3,fadeIn:400,fadeOut:400});break}}r++}}for(var m=new Set,_=[],v=0;v<O.length;v++){var y=O[v],x=A-y.birth;if(!(x>y.duration)){_.push(y);var C=1;x<y.fadeIn?C=x/y.fadeIn:x>y.duration-y.fadeOut&&(C=(y.duration-x)/y.fadeOut),m.add(y.a),m.add(y.b);var w=S[y.a],T=S[y.b];t.beginPath(),t.moveTo(w.x,w.y),t.lineTo(T.x,T.y),t.strokeStyle=b,t.globalAlpha=C*.35,t.lineWidth=1.5,t.stroke(),t.globalAlpha=1}}O=_;for(var E=0;E<S.length;E++){var D=S[E];if(!D.hidden){var M=m.has(E)?.7:.08;D.brightness+=(M-D.brightness)*.08,t.beginPath(),t.arc(D.x,D.y,i,0,Math.PI*2),t.fillStyle=b,t.globalAlpha=D.brightness,t.fill(),t.globalAlpha=1}}for(var ee=.4+.2*Math.sin(A/800),te=[[h,g],[h+f+p,g],[h,g+f+p],[h+f+p,g+f+p]],P=0;P<te.length;P++){var F=te[P][0],ne=te[P][1];t.save(),t.shadowColor=b,t.shadowBlur=8+ee*6,t.fillStyle=b,t.globalAlpha=.85+ee*.15,t.fillRect(F,ne,f,f),t.restore()}c.current=requestAnimationFrame(N)}return c.current=requestAnimationFrame(N),function(){cancelAnimationFrame(c.current)}},[]),!f&&l)return null;var p=u?`Reconnecting...`:e.status===`connecting`?`Connecting...`:`Loading projects...`;return(0,b.jsx)(`div`,{className:`fixed inset-0 z-[9999] flex flex-col items-center justify-center `+(u?`bg-base-100/90`:`bg-base-100`),style:{opacity:d?0:1,transition:`opacity 300ms ease-out`,pointerEvents:d?`none`:`auto`},children:(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-7`,children:[(0,b.jsx)(`canvas`,{ref:s}),(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-[16px] font-mono font-bold text-base-content tracking-tight`,children:`Lattice`}),(0,b.jsx)(`span`,{className:`text-[12px] text-base-content/40`,children:p})]})]})})}function GIe(){var e=Yw(),t=z(),n=e.confirmRemoveSlug,r=(0,x.useRef)(null);return Ur(r,(0,x.useCallback)(function(){e.closeConfirmRemove()},[e.closeConfirmRemove]),!!n),n?((function(){try{return Iw().state}catch{return null}})(),(0,b.jsxs)(`div`,{ref:r,className:`fixed inset-0 z-[9999] flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"aria-label":`Remove Project`,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-base-content/50`,onClick:e.closeConfirmRemove}),(0,b.jsxs)(`div`,{className:`relative bg-base-200 border border-base-content/15 rounded-2xl shadow-2xl w-full max-w-sm mx-4 overflow-hidden`,children:[(0,b.jsx)(`div`,{className:`px-5 py-4 border-b border-base-content/15`,children:(0,b.jsx)(`h2`,{className:`text-[15px] font-mono font-bold text-base-content`,children:`Remove Project`})}),(0,b.jsx)(`div`,{className:`px-5 py-4`,children:(0,b.jsxs)(`p`,{className:`text-[13px] text-base-content/60`,children:[`Remove `,(0,b.jsx)(`span`,{className:`font-semibold text-base-content`,children:n}),` from Lattice? This won't delete any files on disk.`]})}),(0,b.jsxs)(`div`,{className:`px-5 py-3 border-t border-base-content/15 flex justify-end gap-2`,children:[(0,b.jsx)(`button`,{onClick:e.closeConfirmRemove,className:`btn btn-ghost btn-sm text-[12px]`,children:`Cancel`}),(0,b.jsx)(`button`,{onClick:function(){t.send({type:`settings:update`,settings:{removeProject:n}}),e.activeProjectSlug===n&&e.goToDashboard(),e.closeConfirmRemove()},className:`btn btn-error btn-sm text-[12px]`,children:`Remove`})]})]})]})):null}function KIe(){var[e,t]=(0,x.useState)(null),n=z();(0,x.useEffect)(function(){function e(e){e.type===`settings:data`&&t(e.config?.setupComplete===!0)}return n.subscribe(`settings:data`,e),n.status===`connected`&&n.send({type:`settings:get`}),function(){n.unsubscribe(`settings:data`,e)}},[n.status]);var r=Yw(),i=(0,x.useRef)(null);return WIe(i,r.drawerOpen,Uw,Ww),(0,x.useEffect)(function(){function e(e){e.key===`Escape`&&Iw().state.sidebarMode===`settings`&&Vw()}return document.addEventListener(`keydown`,e),window.addEventListener(`popstate`,Hw),function(){document.removeEventListener(`keydown`,e),window.removeEventListener(`popstate`,Hw)}},[]),e===null?(0,b.jsx)(F9,{}):e?(0,b.jsxs)(`div`,{className:`flex w-full h-full overflow-hidden bg-base-100`,children:[(0,b.jsx)(`a`,{href:`#main-content`,className:`sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[99999] focus:px-4 focus:py-2 focus:bg-primary focus:text-primary-content focus:rounded-lg focus:text-sm focus:font-semibold`,children:`Skip to content`}),(0,b.jsx)(F9,{}),(0,b.jsxs)(`div`,{className:`drawer lg:drawer-open h-full w-full`,children:[(0,b.jsx)(`input`,{id:`sidebar-drawer`,type:`checkbox`,className:`drawer-toggle`,checked:r.drawerOpen,readOnly:!0}),(0,b.jsxs)(`main`,{id:`main-content`,className:`drawer-content flex flex-col h-full min-w-0 overflow-hidden relative`,children:[(0,b.jsx)(Nr,{}),(0,b.jsx)(HIe,{})]}),(0,b.jsxs)(`div`,{ref:i,className:`drawer-side z-50 h-full`,children:[(0,b.jsx)(`label`,{htmlFor:`sidebar-drawer`,"aria-label":`close sidebar`,className:`drawer-overlay`,onClick:Ww}),(0,b.jsx)(`nav`,{"aria-label":`Sidebar navigation`,className:`h-full w-full lg:w-[284px] flex flex-col overflow-hidden`,children:(0,b.jsx)(Tpe,{onSessionSelect:Ww})})]})]}),(0,b.jsx)(BIe,{isOpen:r.nodeSettingsOpen,onClose:r.closeNodeSettings}),(0,b.jsx)(VIe,{isOpen:r.addProjectOpen,onClose:r.closeAddProject}),(0,b.jsx)(GIe,{})]}):(0,b.jsx)(uFe,{onComplete:function(){t(!0)}})}var qIe=class extends x.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[lattice] View error in `+this.props.viewName+`:`,e,t.componentStack)}render(){if(this.state.hasError){var e=this;return(0,b.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full bg-base-100 bg-lattice-grid gap-4 p-8`,children:[(0,b.jsx)(ZC,{size:32,className:`text-warning/50`}),(0,b.jsxs)(`div`,{className:`text-center max-w-[500px]`,children:[(0,b.jsxs)(`p`,{className:`text-[14px] font-mono text-base-content/60 mb-1`,children:[`Error in `,this.props.viewName]}),(0,b.jsx)(`p`,{className:`text-[12px] text-base-content/30 mb-4 font-mono break-all`,children:this.state.error?.message||`Unknown error`}),(0,b.jsxs)(`button`,{onClick:function(){e.setState({hasError:!1,error:null})},className:`btn btn-ghost btn-sm text-[12px] gap-1.5`,children:[(0,b.jsx)(eS,{size:12}),`Retry`]})]})]})}return this.props.children}};function I9(){var e=Yw(),t=YT(),n=e.activeView.type,r=t.panes.find(function(e){return e.id===t.activePaneId}),i=r?t.tabs.find(function(e){return e.id===r.activeTabId}):null;i&&i.id;var a=n===`settings`?(0,b.jsx)(mIe,{}):n===`project-settings`?(0,b.jsx)(IIe,{}):n===`dashboard`?(0,b.jsx)(RIe,{}):n===`project-dashboard`?(0,b.jsx)(zIe,{}):n===`analytics`?(0,b.jsx)(k7,{}):(0,b.jsx)(sFe,{});return(0,b.jsx)(qIe,{viewName:n,children:a})}var L9=wr({component:KIe}),R9=Sr({getParentRoute:function(){return L9},path:`/`,component:I9}),JIe=Sr({getParentRoute:function(){return L9},path:`/$projectSlug`,component:I9}),YIe=Sr({getParentRoute:function(){return L9},path:`/settings/$section`,component:I9}),XIe=Sr({getParentRoute:function(){return L9},path:`/settings`,component:I9}),ZIe=Sr({getParentRoute:function(){return L9},path:`/$projectSlug/settings/$section`,component:I9}),QIe=Sr({getParentRoute:function(){return L9},path:`/$projectSlug/settings`,component:I9}),$Ie=Rr({routeTree:L9.addChildren([R9,XIe,YIe,QIe,ZIe,JIe])}),eLe=3e4;function tLe(e){var[t,n]=(0,x.useState)(`connecting`),r=(0,x.useRef)(null),i=(0,x.useRef)(1e3),a=(0,x.useRef)(null),o=(0,x.useRef)(!1),s=(0,x.useRef)(new Map),c=(0,x.useRef)(!1),l=(0,x.useRef)([]);function u(){if(!o.current){var e=xde(),t=new WebSocket(e);r.current=t,n(`connecting`),t.onopen=function(){if(o.current){t.close();return}if(n(`connected`),i.current=1e3,c.current){t9(`Reconnected to daemon`,`info`),x9(`Lattice`,`Reconnected to daemon`,`connection`),t.send(JSON.stringify({type:`settings:get`}));var e=oT().state;e.activeProjectSlug&&e.activeSessionId&&t.send(JSON.stringify({type:`session:activate`,projectSlug:e.activeProjectSlug,sessionId:e.activeSessionId}))}c.current=!0,t.send(JSON.stringify({type:`brainstorm:status_request`}));var r=l.current;l.current=[],r.forEach(function(e){t.send(JSON.stringify(e))})},t.onmessage=function(e){try{var t=JSON.parse(e.data);t.type===`chat:done`&&document.hidden&&x9(`Claude responded`,oT().state.activeSessionTitle||`Session`,`chat-done`),t.type===`mesh:node_online`&&x9(`Lattice`,t.nodeId+` came online`,`mesh`),t.type===`mesh:node_offline`&&x9(`Lattice`,t.nodeId+` went offline`,`mesh`);var n=s.current.get(t.type);n&&n.forEach(function(e){e(t)})}catch(e){console.warn(`[lattice] Failed to parse WebSocket message:`,e)}},t.onclose=function(){o.current||(n(`disconnected`),r.current=null,c.current&&(t9(`Disconnected from daemon. Reconnecting automatically...`,`warning`),x9(`Lattice`,`Lost connection to daemon`,`connection`)),d())},t.onerror=function(){t.close()}}}function d(){if(!o.current){var e=i.current;a.current=setTimeout(function(){i.current=Math.min(i.current*2,eLe),u()},e)}}function f(){a.current!==null&&(clearTimeout(a.current),a.current=null),i.current=1e3,r.current&&=(r.current.close(),null),u()}function p(e){var t=r.current;t&&t.readyState===WebSocket.OPEN?t.send(JSON.stringify(e)):l.current.push(e)}function m(e,t){var n=s.current.get(e);n||(n=new Set,s.current.set(e,n)),n.add(t)}function h(e,t){var n=s.current.get(e);n&&(n.delete(t),n.size===0&&s.current.delete(e))}return(0,x.useEffect)(function(){function e(){hw(`brainstorm`)}function t(e){e.type===`brainstorm:status`&&e.active&&hw(`brainstorm`)}return m(`brainstorm:content`,e),m(`brainstorm:status`,t),function(){h(`brainstorm:content`,e),h(`brainstorm:status`,t)}},[]),(0,x.useEffect)(function(){return o.current=!1,u(),function(){o.current=!0,a.current!==null&&(clearTimeout(a.current),a.current=null),r.current&&=(r.current.close(),null)}},[]),(0,b.jsx)(cw.Provider,{value:{status:t,send:p,subscribe:m,unsubscribe:h,reconnectNow:f},children:e.children})}var nLe=class extends x.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[lattice] Render error:`,e,t.componentStack)}handleReload(){window.location.reload()}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,b.jsx)(`div`,{className:`min-h-screen bg-base-100 flex items-center justify-center`,children:(0,b.jsxs)(`div`,{className:`text-center max-w-[400px] p-8`,children:[(0,b.jsx)(`h2`,{className:`text-[20px] font-semibold text-error mb-3`,children:`Something went wrong`}),(0,b.jsx)(`p`,{className:`text-[14px] text-base-content/60 mb-5`,children:this.state.error?.message||`An unexpected error occurred.`}),(0,b.jsx)(`button`,{onClick:this.handleReload,className:`btn btn-primary btn-sm`,children:`Reload`})]})}):this.props.children}},rLe=(0,x.createContext)(null);function iLe(){return(0,x.useContext)(rLe)?.defaultOptions??{}}function z9(){if(typeof navigator>`u`)return`linux`;let e=navigator.platform?.toLowerCase()??``,t=navigator.userAgent?.toLowerCase()??``;return e.includes(`mac`)||t.includes(`mac`)?`mac`:e.includes(`win`)||t.includes(`win`)?`windows`:`linux`}var B9=[`Control`,`Alt`,`Shift`,`Meta`];new Set(B9);var V9={Control:`Control`,Ctrl:`Control`,control:`Control`,ctrl:`Control`,Shift:`Shift`,shift:`Shift`,Alt:`Alt`,Option:`Alt`,alt:`Alt`,option:`Alt`,Command:`Meta`,Cmd:`Meta`,Meta:`Meta`,command:`Meta`,cmd:`Meta`,meta:`Meta`,CommandOrControl:`Mod`,Mod:`Mod`,commandorcontrol:`Mod`,mod:`Mod`};function H9(e,t=z9()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var aLe=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),oLe=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),sLe=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),cLe=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),lLe=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),uLe=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),U9={Minus:`-`,Equal:`=`,Slash:`/`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Comma:`,`,Period:`.`,Backquote:"`",Semicolon:`;`};new Set([...aLe,...oLe,...sLe,...cLe,...lLe,...uLe]);var W9={Esc:`Escape`,esc:`Escape`,escape:`Escape`,Return:`Enter`,return:`Enter`,enter:`Enter`," ":`Space`,space:`Space`,Spacebar:`Space`,spacebar:`Space`,tab:`Tab`,backspace:`Backspace`,Del:`Delete`,del:`Delete`,delete:`Delete`,Up:`ArrowUp`,up:`ArrowUp`,arrowup:`ArrowUp`,Down:`ArrowDown`,down:`ArrowDown`,arrowdown:`ArrowDown`,Left:`ArrowLeft`,left:`ArrowLeft`,arrowleft:`ArrowLeft`,Right:`ArrowRight`,right:`ArrowRight`,arrowright:`ArrowRight`,home:`Home`,end:`End`,pageup:`PageUp`,pagedown:`PageDown`,PgUp:`PageUp`,PgDn:`PageDown`,pgup:`PageUp`,pgdn:`PageDown`};function G9(e){return/^\p{Letter}$/u.test(e)}function K9(e){if(e in W9)return W9[e];if(G9(e)){let t=e.toUpperCase();return t.length===1?t:e}let t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}function q9(e,t=z9()){let n=e.split(`+`),r=new Set,i=``;for(let e=0;e<n.length;e++){let a=n[e].trim();if(e===n.length-1)i=K9(a);else{let e=V9[a]??V9[a.toLowerCase()];if(e){let n=H9(e,t);r.add(n)}else n.length===1&&(i=K9(a))}}return!i&&n.length>0&&(i=K9(n[n.length-1].trim())),{key:i,ctrl:r.has(`Control`),shift:r.has(`Shift`),alt:r.has(`Alt`),meta:r.has(`Meta`),modifiers:B9.filter(e=>r.has(e))}}function J9(e,t=z9()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(H9(`Mod`,t)===`Control`?n=!0:a=!0);let o=B9.filter(e=>{switch(e){case`Control`:return n;case`Shift`:return r;case`Alt`:return i;case`Meta`:return a;default:return!1}});return{key:e.key,ctrl:n,shift:r,alt:i,meta:a,modifiers:o}}function Y9(e){let t=[];for(let n of B9)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join(`+`)}function X9(e,t,n=z9()){let r=typeof t==`string`?q9(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=K9(e.key),a=r.key;if(i!==`Dead`&&i.length===1&&a.length===1){if(i.toUpperCase()===a.toUpperCase())return!0;if(G9(i)&&(/^[A-Za-z]$/.test(i)||!e.altKey))return!1}if(e.code&&(i===`Dead`||i.length===1&&a.length===1)){if(e.code.startsWith(`Key`)){let t=e.code.slice(3);if(t.length===1&&/^[A-Za-z]$/.test(t))return t.toUpperCase()===a.toUpperCase()}if(e.code.startsWith(`Digit`)){let t=e.code.slice(5);if(t.length===1&&/^[0-9]$/.test(t))return t===a}return e.code in U9?U9[e.code]===a:!1}return i===a}var dLe={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function fLe(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function pLe(e){if(!e)return!1;if(e instanceof HTMLInputElement){let t=e.type.toLowerCase();return!(t===`button`||t===`submit`||t===`reset`)}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function mLe(e,t){return t===document||t===window?e.currentTarget===t||e.currentTarget===document.documentElement:t===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(t instanceof HTMLElement&&(e.currentTarget===t||e.target instanceof Node&&t.contains(e.target)))}function hLe(e,t,n,r){if(n!==`allow`){if(n===`warn`){console.warn(`'${t}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);return}if(n===`error`)throw Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}var gLe=0;function Z9(){return`hotkey_${++gLe}`}var _Le=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new Wn(new Map),this.#t=z9()}static getInstance(){return e.#e||=new e,e.#e}static resetInstance(){e.#e&&=(e.#e.destroy(),null)}register(e,t,n={}){if(typeof document>`u`&&!n.target){let e=t;return{id:Z9(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=Z9(),i=n.platform??this.#t,a=typeof e==`string`?q9(e,i):J9(e,i),o=typeof e==`string`?e:Y9(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&hLe(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??fLe(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...dLe,requireReset:!1,...n,platform:i,ignoreInputs:u},hasFired:!1,triggerCount:0,target:s};this.registrations.setState(e=>new Map(e).set(r,d)),this.#r.has(s)||this.#r.set(s,new Set),this.#r.get(s).add(r),this.#a(s);let f=this;return{get id(){return r},unregister:()=>{f.#i(r)},get callback(){return f.registrations.state.get(r)?.callback??t},set callback(e){let t=f.registrations.state.get(r);t&&(t.callback=e)},setOptions:e=>{f.registrations.setState(t=>{let n=t.get(r);if(n){let i=new Map(t);return i.set(r,{...n,options:{...n.options,...e}}),i}return t})},get isActive(){return f.registrations.state.has(r)}}}#i(e){let t=this.registrations.state.get(e);if(!t)return;let n=t.target;this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n});let r=this.#r.get(n);r&&(r.delete(e),r.size===0&&this.#o(n))}#a(e){if(typeof document>`u`||this.#n.has(e))return;let t=this.#l(e),n=this.#u(e);e.addEventListener(`keydown`,t),e.addEventListener(`keyup`,n),this.#n.set(e,{keydown:t,keyup:n})}#o(e){if(typeof document>`u`)return;let t=this.#n.get(e);t&&(e.removeEventListener(`keydown`,t.keydown),e.removeEventListener(`keyup`,t.keyup),this.#n.delete(e),this.#r.delete(e))}#s(e,t,n){let r=this.#r.get(t);if(r)for(let i of r){let r=this.registrations.state.get(i);if(r&&mLe(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&pLe(e.target)&&e.target!==r.target))if(n===`keydown`){if(r.options.eventType!==`keydown`)continue;X9(e,r.parsedHotkey,r.options.platform)&&(r.options.preventDefault&&e.preventDefault(),r.options.stopPropagation&&e.stopPropagation(),(!r.options.requireReset||!r.hasFired)&&(this.#c(r,e),r.options.requireReset&&(r.hasFired=!0)))}else r.options.eventType===`keyup`&&X9(e,r.parsedHotkey,r.options.platform)&&this.#c(r,e),r.options.requireReset&&r.hasFired&&this.#f(r,e)&&(r.hasFired=!1)}}#c(e,t){e.options.preventDefault&&t.preventDefault(),e.options.stopPropagation&&t.stopPropagation(),e.triggerCount++,this.registrations.setState(e=>new Map(e));let n={hotkey:e.hotkey,parsedHotkey:e.parsedHotkey};e.callback(t,n)}#l(e){return t=>{this.#s(t,e,`keydown`)}}#u(e){return t=>{this.#s(t,e,`keyup`)}}#d(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&n.target===t)return n;return null}#f(e,t){let n=e.parsedHotkey,r=K9(t.key),i=n.key.length===1?n.key.toUpperCase():n.key;return!!((r.length===1?r.toUpperCase():r)===i||n.ctrl&&r===`Control`||n.shift&&r===`Shift`||n.alt&&r===`Alt`||n.meta&&r===`Meta`)}triggerRegistration(e){let t=this.registrations.state.get(e);if(!t)return!1;let n=t.parsedHotkey,r=new KeyboardEvent(t.options.eventType??`keydown`,{key:n.key,ctrlKey:n.ctrl,shiftKey:n.shift,altKey:n.alt,metaKey:n.meta,bubbles:!0,cancelable:!0});return t.triggerCount++,this.registrations.setState(e=>new Map(e)),t.callback(r,{hotkey:t.hotkey,parsedHotkey:t.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&(t===void 0||n.target===t))return!0;return!1}destroy(){for(let e of this.#n.keys())this.#o(e);this.registrations.setState(()=>new Map),this.#n.clear(),this.#r.clear()}};function vLe(){return _Le.getInstance()}function Q9(e,t,n={}){let r={...iLe().hotkey,...n},i=vLe(),a=(0,x.useRef)(null),o=(0,x.useRef)(t),s=(0,x.useRef)(r),c=(0,x.useRef)(i);o.current=t,s.current=r,c.current=i;let l=(0,x.useRef)(null),u=(0,x.useRef)(null),d=r.platform??z9(),f=typeof e==`string`?e:Y9(J9(e,d)),{target:p,...m}=r;(0,x.useEffect)(()=>{let e=yLe(s.current.target)?s.current.target.current:s.current.target??(typeof document<`u`?document:null);if(!e)return;let t=l.current!==null&&l.current!==e,n=u.current!==null&&u.current!==f;return a.current?.isActive&&(t||n)&&(a.current.unregister(),a.current=null),(!a.current||!a.current.isActive)&&(a.current=c.current.register(f,o.current,{...s.current,target:e})),l.current=e,u.current=f,()=>{a.current?.isActive&&(a.current.unregister(),a.current=null)}},[f,n.enabled]),a.current?.isActive&&(a.current.callback=t,a.current.setOptions(m))}function yLe(e){return typeof e==`object`&&!!e&&`current`in e}function bLe(){var[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(``),[i,a]=(0,x.useState)(0),o=(0,x.useRef)(null),s=(0,x.useRef)(null),{projects:c,setActiveProject:l}=Gw(),u=aN(),{mode:d,toggleMode:f,allThemes:p,setTheme:m,currentThemeId:h}=RT(),g=z(),_=Yw(),v=(0,x.useCallback)(function(){t(!1),r(``),a(0)},[]);Q9(`Mod+K`,function(e){e.preventDefault(),t(function(e){return e&&(r(``),a(0)),!e})}),Q9(`Escape`,function(e){e.preventDefault(),v()},{enabled:e}),(0,x.useEffect)(function(){e&&o.current&&o.current.focus()},[e]);var y=(0,x.useMemo)(function(){var e=[];e.push({id:`nav:dashboard`,label:`Go to Dashboard`,group:`Navigation`,icon:(0,b.jsx)(ab,{size:14}),action:function(){_.goToDashboard(),v()},keywords:`home overview`}),c.forEach(function(t){e.push({id:`project:`+t.slug,label:t.title||t.slug,description:t.path,group:`Projects`,icon:(0,b.jsx)(Wm,{size:14}),action:function(){l(t),v()},keywords:`switch project `+t.slug})});var t=oT().state;t.activeProjectSlug&&e.push({id:`session:new`,label:`New Session`,group:`Session`,icon:(0,b.jsx)(W_,{size:14}),action:function(){g.send({type:`session:create`,projectSlug:t.activeProjectSlug}),v()},keywords:`create chat conversation`}),[{id:`appearance`,label:`Appearance`,keywords:`theme visual colors`},{id:`claude`,label:`Claude Settings`,keywords:`api model key`},{id:`environment`,label:`Environment`,keywords:`env variables config`},{id:`mcp`,label:`MCP Servers`,keywords:`model context protocol`},{id:`skills`,label:`Skills`,keywords:`capabilities commands`},{id:`nodes`,label:`Mesh Nodes`,keywords:`machines network`}].forEach(function(t){e.push({id:`settings:`+t.id,label:t.label,group:`Settings`,icon:(0,b.jsx)(TC,{size:14}),action:function(){_.openSettings(t.id),v()},keywords:t.keywords})}),e.push({id:`theme:toggle`,label:d===`dark`?`Switch to Light Mode`:`Switch to Dark Mode`,group:`Theme`,icon:d===`dark`?(0,b.jsx)(qC,{size:14}):(0,b.jsx)(Sv,{size:14}),action:function(){f(),v()},keywords:`dark light mode toggle`});var n=d===`dark`?`dark`:`light`;return p.filter(function(e){return e.theme.variant===n}).forEach(function(t){t.id!==h&&e.push({id:`theme:`+t.id,label:t.theme.name,group:`Theme`,icon:d===`dark`?(0,b.jsx)(Sv,{size:14}):(0,b.jsx)(qC,{size:14}),action:function(){m(t.id),v()},keywords:`color scheme `+t.theme.name})}),u.forEach(function(t){e.push({id:`skill:`+t.name,label:`/`+t.name,description:t.description,group:`Skills`,icon:(0,b.jsx)(aw,{size:14}),action:function(){var e=document.querySelector(`textarea[aria-label='Message input']`);e&&(e.value=`/`+t.name+` `,e.focus(),e.dispatchEvent(new Event(`input`,{bubbles:!0}))),v()},keywords:t.description})}),e.push({id:`system:restart`,label:`Restart Daemon`,group:`System`,icon:(0,b.jsx)(bS,{size:14}),action:function(){g.send({type:`settings:restart`}),v()},keywords:`reboot server`}),e},[c,u,d,p,h,_,g,v,l,f,m]),S=(0,x.useMemo)(function(){if(!n.trim())return y;var e=n.toLowerCase();return y.filter(function(t){for(var n=(t.label+` `+(t.description||``)+` `+(t.keywords||``)+` `+t.group).toLowerCase(),r=e.split(/\s+/),i=0;i<r.length;i++)if(!n.includes(r[i]))return!1;return!0})},[n,y]);(0,x.useEffect)(function(){a(0)},[S.length,n]),(0,x.useEffect)(function(){if(s.current){var e=s.current.querySelector(`[data-active='true']`);e&&e.scrollIntoView({block:`nearest`})}},[i]);function C(e){e.key===`ArrowDown`?(e.preventDefault(),a(function(e){return e<S.length-1?e+1:0})):e.key===`ArrowUp`?(e.preventDefault(),a(function(e){return e>0?e-1:S.length-1})):e.key===`Enter`&&(e.preventDefault(),S[i]&&S[i].action())}var w=(0,x.useMemo)(function(){var e=[],t=new Map,n=0;return S.forEach(function(r){var i=t.get(r.group);i||(i=[],t.set(r.group,i),e.push({name:r.group,items:i})),i.push(Object.assign({},r,{globalIndex:n})),n++}),e},[S]);return e?(0,b.jsxs)(`div`,{className:`fixed inset-0 z-[9998] flex items-start justify-center pt-[15vh]`,onClick:v,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-base-content/50`}),(0,b.jsxs)(`div`,{className:`relative w-full max-w-[520px] mx-4 bg-base-200 border border-base-content/10 rounded-xl shadow-2xl overflow-hidden`,onClick:function(e){e.stopPropagation()},children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 border-b border-base-content/10`,children:[(0,b.jsx)(pC,{size:16,className:`text-base-content/30 flex-shrink-0`}),(0,b.jsx)(`input`,{ref:o,type:`text`,value:n,onChange:function(e){r(e.target.value)},onKeyDown:C,placeholder:`Type a command...`,className:`flex-1 bg-transparent text-[14px] text-base-content outline-none placeholder:text-base-content/30`}),(0,b.jsx)(`kbd`,{className:`text-[10px] font-mono text-base-content/20 bg-base-300 px-1.5 py-0.5 rounded`,children:`ESC`})]}),(0,b.jsxs)(`div`,{ref:s,className:`max-h-[360px] overflow-y-auto py-1.5`,children:[w.length===0&&(0,b.jsx)(`div`,{className:`px-4 py-8 text-center text-[13px] text-base-content/30`,children:`No commands found`}),w.map(function(e){return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`px-4 pt-2 pb-1`,children:(0,b.jsx)(`span`,{className:`text-[9px] uppercase tracking-widest text-base-content/30 font-mono font-bold`,children:e.name})}),e.items.map(function(e){var t=e.globalIndex===i;return(0,b.jsxs)(`button`,{"data-active":t,onMouseEnter:function(){a(e.globalIndex)},onMouseDown:function(e){e.preventDefault()},onClick:function(){e.action()},className:`flex w-full items-center gap-3 px-4 py-2 text-left transition-colors `+(t?`bg-primary/10`:`hover:bg-base-content/5`),children:[(0,b.jsx)(`div`,{className:`flex-shrink-0 `+(t?`text-primary`:`text-base-content/30`),children:e.icon}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsx)(`div`,{className:`text-[13px] truncate `+(t?`text-base-content`:`text-base-content/70`),children:e.label}),e.description&&(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30 truncate`,children:e.description})]})]},e.id)})]},e.name)})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2 border-t border-base-content/10 text-[10px] text-base-content/25 font-mono`,children:[(0,b.jsx)(`span`,{children:`↑↓ navigate`}),(0,b.jsx)(`span`,{children:`↵ select`}),(0,b.jsx)(`span`,{children:`esc close`})]})]})]}):null}var xLe=[{name:`Chat`,shortcuts:[{keys:[`Enter`],description:`Send message`},{keys:[`Shift`,`Enter`],description:`New line`},{keys:[`↑`],description:`Previous input history`},{keys:[`↓`],description:`Next input history`},{keys:[`/`],description:`Slash commands`},{keys:[`Escape`],description:`Close autocomplete`}]},{name:`Navigation`,shortcuts:[{keys:[typeof navigator<`u`&&navigator.platform.indexOf(`Mac`)!==-1?`⌘`:`Ctrl`,`K`],description:`Command palette`},{keys:[`?`],description:`Keyboard shortcuts`},{keys:[`Escape`],description:`Close modal / exit settings`}]},{name:`Session`,shortcuts:[{keys:[`/clear`],description:`New session`},{keys:[`/copy`],description:`Copy last response`},{keys:[`/export`],description:`Export conversation`},{keys:[`/rename`],description:`Rename session`}]}];function $9(e){return(0,b.jsx)(`kbd`,{className:`bg-base-300 border border-base-content/20 rounded px-1.5 py-0.5 text-[11px] font-mono text-base-content/70 leading-none inline-flex items-center justify-center min-w-[22px]`,children:e.children})}function SLe(){var[e,t]=(0,x.useState)(!1);return(0,x.useEffect)(function(){function n(n){if(n.key===`?`&&!n.ctrlKey&&!n.metaKey&&!n.altKey){var r=n.target.tagName;if(r===`INPUT`||r===`TEXTAREA`||n.target.isContentEditable)return;n.preventDefault(),t(!0)}n.key===`Escape`&&e&&t(!1)}return document.addEventListener(`keydown`,n),function(){document.removeEventListener(`keydown`,n)}},[e]),e?(0,b.jsxs)(`div`,{className:`fixed inset-0 z-[9998] flex items-center justify-center`,onClick:function(){t(!1)},children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-base-content/50`}),(0,b.jsxs)(`div`,{className:`relative w-full max-w-[540px] mx-4 bg-base-200 border border-base-content/15 rounded-2xl shadow-xl overflow-hidden`,onClick:function(e){e.stopPropagation()},children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3.5 border-b border-base-content/10`,children:[(0,b.jsx)(`h2`,{className:`text-[14px] font-mono font-bold text-base-content tracking-tight`,children:`Keyboard Shortcuts`}),(0,b.jsx)(`button`,{onClick:function(){t(!1)},className:`w-6 h-6 rounded flex items-center justify-center text-base-content/30 hover:text-base-content/60 transition-colors`,children:(0,b.jsx)(iw,{size:14})})]}),(0,b.jsx)(`div`,{className:`px-5 py-4 max-h-[70vh] overflow-y-auto`,children:(0,b.jsx)(`div`,{className:`flex flex-col gap-5`,children:xLe.map(function(e){return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[9px] uppercase tracking-widest text-base-content/30 font-mono font-bold mb-2`,children:e.name}),(0,b.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.shortcuts.map(function(e,t){return(0,b.jsxs)(`div`,{className:`flex items-center justify-between py-1.5 px-2 rounded hover:bg-base-content/5 transition-colors`,children:[(0,b.jsx)(`span`,{className:`text-[13px] text-base-content/60`,children:e.description}),(0,b.jsx)(`div`,{className:`flex items-center gap-1 flex-shrink-0 ml-4`,children:e.keys.map(function(e,t){return(0,b.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t>0&&(0,b.jsx)(`span`,{className:`text-[10px] text-base-content/20`,children:`+`}),(0,b.jsx)($9,{children:e})]},t)})})]},t)})})]},e.name)})})}),(0,b.jsx)(`div`,{className:`px-5 py-2.5 border-t border-base-content/10 flex justify-end`,children:(0,b.jsxs)(`span`,{className:`text-[10px] font-mono text-base-content/20`,children:[`Press `,(0,b.jsx)($9,{children:`Esc`}),` to close`]})})]})]}):null}function CLe(){var[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(null);(0,x.useEffect)(function(){`serviceWorker`in navigator&&navigator.serviceWorker.ready.then(function(e){e.addEventListener(`updatefound`,function(){var n=e.installing;if(n){var i=n;i.addEventListener(`statechange`,function(){i.state===`installed`&&navigator.serviceWorker.controller&&(r(e),t(!0))})}})})},[]);function i(){n&&n.waiting&&n.waiting.postMessage({type:`SKIP_WAITING`}),window.location.reload()}return e?(0,b.jsxs)(`div`,{className:`fixed bottom-4 right-4 z-[9998] bg-base-300 border border-base-content/15 rounded-xl shadow-2xl px-4 py-3 flex items-center gap-3 max-w-sm`,children:[(0,b.jsx)(eS,{size:16,className:`text-primary flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsx)(`div`,{className:`text-[13px] text-base-content font-semibold`,children:`Update available`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/40`,children:`A new version of Lattice is ready.`})]}),(0,b.jsx)(`button`,{onClick:i,className:`btn btn-primary btn-xs`,children:`Reload`})]}):null}function wLe(){var e=z();(0,x.useEffect)(function(){function t(e){e.type===`theme:custom_list`&&upe((e.themes||[]).map(function(e){return{id:`custom:`+e.filename,theme:{name:e.name,author:e.author,variant:e.variant,...e.colors}}}))}function n(t){(t.type===`theme:saved`||t.type===`theme:deleted`)&&e.send({type:`theme:list_custom`})}return e.subscribe(`theme:custom_list`,t),e.subscribe(`theme:saved`,n),e.subscribe(`theme:deleted`,n),function(){e.unsubscribe(`theme:custom_list`,t),e.unsubscribe(`theme:saved`,n),e.unsubscribe(`theme:deleted`,n)}},[])}function TLe(){var{items:e,dismiss:t}=kFe();return wLe(),(0,x.useEffect)(function(){function e(e){e.target.closest(`[data-allow-context-menu]`)||e.preventDefault()}return document.addEventListener(`contextmenu`,e),function(){document.removeEventListener(`contextmenu`,e)}},[]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Vr,{router:$Ie}),(0,b.jsx)(bLe,{}),(0,b.jsx)(SLe,{}),(0,b.jsx)(OFe,{items:e,onDismiss:t}),(0,b.jsx)(CLe,{})]})}function ELe(){return(0,b.jsx)(nLe,{children:(0,b.jsx)(tLe,{children:(0,b.jsx)(TLe,{})})})}typeof crypto<`u`&&!crypto.randomUUID&&(crypto.randomUUID=function(){return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,function(e){var t=Number(e);return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)})}),(0,S.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(x.StrictMode,{children:(0,b.jsx)(ELe,{})}));export{PE as a,aE as c,NE as i,s as l,gk as n,ME as o,FE as r,sE as s,WU as t};
|
|
517
|
+
`).length:0,t=e>200;return(0,b.jsxs)(`div`,{className:`flex items-center justify-between mt-1.5`,children:[(0,b.jsxs)(`div`,{className:`text-[11px] `+(t?`text-warning`:`text-base-content/25`),children:[e,` line`,e===1?``:`s`,t?` — consider moving content to rules or imports`:``]}),t&&(0,b.jsx)(`div`,{className:`text-[10px] text-warning/70`,children:`soft limit: 200 lines`})]})})(),(0,b.jsxs)(`button`,{type:`button`,onClick:function(){h(!m)},className:`flex items-center gap-1.5 mt-2 text-[11px] text-base-content/40 hover:text-base-content/60 transition-colors`,children:[m?(0,b.jsx)(nu,{size:12}):(0,b.jsx)(ou,{size:12}),`Global CLAUDE.md (inherited)`]}),m&&(0,b.jsx)(`textarea`,{readOnly:!0,value:e.global.claudeMd,rows:8,className:`w-full mt-2 px-3 py-2.5 bg-base-300 border border-base-content/15 rounded-xl text-base-content/30 text-[12px] font-mono leading-relaxed resize-y cursor-default focus-visible:outline-none`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{htmlFor:`project-default-model`,className:`block text-[12px] font-semibold text-base-content/40 mb-2`,children:`Default Model`}),(0,b.jsxs)(`select`,{id:`project-default-model`,value:i??``,onChange:function(e){a(e.target.value||void 0),g.markDirty()},className:`w-full h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[13px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`,children:[(0,b.jsxs)(`option`,{value:``,className:`bg-base-300`,children:[`Use global default (`,SIe(v),`)`]}),C9.map(function(e){return(0,b.jsx)(`option`,{value:e.id,className:`bg-base-300`,children:e.label},e.id)})]}),i&&(0,b.jsx)(`button`,{type:`button`,onClick:function(){a(void 0),g.markDirty()},className:`mt-1.5 text-[11px] text-primary/70 hover:text-primary transition-colors`,children:`Clear override`})]}),(0,b.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Default Effort`,children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Default Effort`}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsxs)(`button`,{role:`radio`,"aria-checked":o===void 0,onClick:function(){s(void 0),g.markDirty()},className:`flex-1 py-2.5 sm:py-1.5 rounded-lg border text-[12px] transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100 `+(o===void 0?`border-primary bg-base-300 text-base-content font-semibold`:`border-base-content/15 bg-base-300 text-base-content/40 hover:border-base-content/30 hover:text-base-content/60`),children:[`Global (`,y,`)`]}),vIe.map(function(e){var t=o===e.id;return(0,b.jsx)(`button`,{role:`radio`,"aria-checked":t,onClick:function(){s(e.id),g.markDirty()},className:`flex-1 py-2.5 sm:py-1.5 rounded-lg border text-[12px] transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100 `+(t?`border-primary bg-base-300 text-base-content font-semibold`:`border-base-content/15 bg-base-300 text-base-content/40 hover:border-base-content/30 hover:text-base-content/60`),children:e.label},e.id)})]})]}),(0,b.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Thinking Mode`,children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Thinking Mode`}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsxs)(`button`,{role:`radio`,"aria-checked":c===void 0,onClick:function(){l(void 0),g.markDirty()},className:`flex-1 py-2.5 sm:py-1.5 rounded-lg border text-[12px] transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100 `+(c===void 0?`border-primary bg-base-300 text-base-content font-semibold`:`border-base-content/15 bg-base-300 text-base-content/40 hover:border-base-content/30 hover:text-base-content/60`),children:[`Global (`,xIe(e.global.thinking),`)`]}),yIe.map(function(e){var t=c?.type===e.id;return(0,b.jsx)(`button`,{role:`radio`,"aria-checked":t,onClick:function(){l(e.id===`enabled`?{type:`enabled`,budgetTokens:f}:{type:e.id}),g.markDirty()},className:`flex-1 py-2.5 sm:py-1.5 rounded-lg border text-[12px] transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100 `+(t?`border-primary bg-base-300 text-base-content font-semibold`:`border-base-content/15 bg-base-300 text-base-content/40 hover:border-base-content/30 hover:text-base-content/60`),children:e.label},e.id)})]}),c?.type===`enabled`&&(0,b.jsxs)(`div`,{className:`mt-3`,children:[(0,b.jsx)(`label`,{htmlFor:`budget-tokens`,className:`block text-[11px] text-base-content/40 mb-1.5`,children:`Budget Tokens`}),(0,b.jsx)(`input`,{id:`budget-tokens`,type:`number`,min:1e3,step:1e3,value:f,onChange:function(e){var t=parseInt(e.target.value,10);isNaN(t)||(p(t),l({type:`enabled`,budgetTokens:t}),g.markDirty())},className:`w-48 h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[13px] font-mono focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`})]})]}),(0,b.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Permission Mode`,children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Permission Mode`}),(0,b.jsx)(`div`,{className:`flex gap-2`,children:bIe.map(function(e){var t=(u??`default`)===e.id;return(0,b.jsx)(`button`,{role:`radio`,"aria-checked":t,onClick:function(){d(e.id===`default`?void 0:e.id),g.markDirty()},className:`flex-1 py-2.5 sm:py-1.5 rounded-lg border text-[12px] transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100 `+(t?`border-primary bg-base-300 text-base-content font-semibold`:`border-base-content/15 bg-base-300 text-base-content/40 hover:border-base-content/30 hover:text-base-content/60`),children:e.label},e.id)})})]}),(0,b.jsx)(n9,{dirty:g.dirty,saving:g.saving,saveState:g.saveState,onSave:_})]})}function w9(){return Math.random().toString(36).slice(2,10)}function wIe(e){var t={};return e.forEach(function(e){e.key.trim()&&(t[e.key.trim()]=e.value)}),t}function T9(e){return Object.entries(e).map(function([e,t]){return{id:w9(),key:e,value:t}})}function TIe({settings:e,updateSection:t}){var n=e.global.env??{},r=Object.entries(n),[i,a]=(0,x.useState)(function(){return T9(e.env??{})}),o=$7();(0,x.useEffect)(function(){o.savingRef.current?o.confirmSave():(a(T9(e.env??{})),o.resetFromServer())},[e]);var s=(0,x.useMemo)(function(){return new Set(Object.keys(n))},[n]),c=(0,x.useMemo)(function(){return i9(i)},[i]),l=c.size>0;function u(){a(function(e){return[...e,{id:w9(),key:``,value:``}]}),o.markDirty()}function d(e){a(function(t){return t.filter(function(t){return t.id!==e})}),o.markDirty()}function f(e,t){a(function(n){return n.map(function(n){return n.id===e?{...n,key:t}:n})}),o.markDirty()}function p(e,t){a(function(n){return n.map(function(n){return n.id===e?{...n,value:t}:n})}),o.markDirty()}function m(){o.startSave(),t(`environment`,{env:wIe(i)})}var h=`w-full h-9 sm:h-7 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content font-mono text-[12px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`;return(0,b.jsxs)(`div`,{className:`py-2`,children:[(0,b.jsxs)(`div`,{className:`mb-6`,children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Global Variables`}),r.length===0&&(0,b.jsx)(`div`,{className:`py-4 text-center text-[13px] text-base-content/30`,children:`No global environment variables.`}),r.length>0&&(0,b.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:r.map(function([e,t]){return(0,b.jsxs)(`div`,{className:`flex flex-col sm:grid sm:grid-cols-[1fr_1fr_auto] gap-1.5 sm:items-center`,children:[(0,b.jsx)(`div`,{className:`h-9 sm:h-7 px-3 bg-base-300/50 border border-base-content/10 rounded-xl flex items-center font-mono text-[12px] text-base-content/40`,children:e}),(0,b.jsx)(`div`,{className:`flex gap-1.5 items-center`,children:(0,b.jsx)(`div`,{className:`h-9 sm:h-7 px-3 bg-base-300/50 border border-base-content/10 rounded-xl flex items-center font-mono text-[12px] text-base-content/40 w-full`,children:String(t)})}),(0,b.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-base-content/30 w-7 text-center hidden sm:block`,children:`global`})]},e)})})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Project Variables`}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 sm:gap-1.5 mb-3`,children:[i.length===0&&(0,b.jsx)(`div`,{className:`py-4 text-center text-[13px] text-base-content/30`,children:`No project environment variables.`}),i.map(function(e,t){var n=e.key.trim()!==``&&c.has(e.key.trim()),r=e.key.trim()!==``&&s.has(e.key.trim());return(0,b.jsxs)(`div`,{className:`flex flex-col sm:grid sm:grid-cols-[1fr_1fr_auto] gap-1.5 sm:items-center`,children:[(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(`input`,{type:`text`,value:e.key,onChange:function(t){f(e.id,t.target.value)},placeholder:`VARIABLE_NAME`,"aria-label":`Variable name for row `+(t+1),"aria-invalid":n,className:`w-full h-9 sm:h-7 px-3 bg-base-300 border rounded-xl text-base-content font-mono text-[12px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms] `+(n?`border-warning`:`border-base-content/15`)}),n&&(0,b.jsxs)(`div`,{className:`flex items-center gap-1 mt-0.5 text-[10px] text-warning sm:absolute sm:-bottom-3.5 sm:left-0`,role:`alert`,children:[(0,b.jsx)(ZC,{size:9}),`Duplicate key`]}),!n&&r&&(0,b.jsx)(`div`,{className:`flex items-center gap-1 mt-0.5 text-[10px] text-warning/70 sm:absolute sm:-bottom-3.5 sm:left-0`,children:`overrides global`})]}),(0,b.jsxs)(`div`,{className:`flex gap-1.5 items-center`,children:[(0,b.jsx)(`input`,{type:`text`,value:e.value,onChange:function(t){p(e.id,t.target.value)},placeholder:`value`,"aria-label":`Value for `+(e.key||`row `+(t+1)),className:h}),(0,b.jsx)(`button`,{onClick:function(){d(e.id)},"aria-label":`Delete `+(e.key||`row `+(t+1)),title:`Delete`,className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-error w-9 h-9 flex-shrink-0 sm:hidden focus-visible:ring-2 focus-visible:ring-primary`,children:(0,b.jsx)(iw,{size:14})})]}),(0,b.jsx)(`button`,{onClick:function(){d(e.id)},"aria-label":`Delete `+(e.key||`row `+(t+1)),title:`Delete`,className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-error w-7 h-7 hidden sm:flex focus-visible:ring-2 focus-visible:ring-primary`,children:(0,b.jsx)(iw,{size:12})})]},e.id)})]}),(0,b.jsxs)(`button`,{onClick:u,className:`flex items-center gap-1.5 px-3 py-2.5 sm:py-1.5 rounded-xl border border-dashed border-base-content/20 bg-transparent text-base-content/40 text-[12px] hover:text-base-content/60 hover:border-base-content/30 transition-colors duration-[120ms] mb-5 cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100`,children:[(0,b.jsx)($b,{size:12}),`Add Variable`]}),(0,b.jsx)(n9,{dirty:o.dirty,saving:o.saving,saveState:o.saveState,onSave:m,extraStatus:l?`Duplicate keys will be merged`:void 0})]})]})}function E9({rules:e,onDelete:t,readOnly:n,labelPrefix:r}){return e.length===0?(0,b.jsx)(`div`,{className:`py-3 text-center text-[13px] text-base-content/30`,children:`No rules defined.`}):(0,b.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.map(function(e,i){return(0,b.jsxs)(`div`,{className:`flex items-center gap-2 h-9 sm:h-7 px-3 rounded-xl border font-mono text-[12px] `+(n?`bg-base-300/50 border-base-content/10 text-base-content/40`:`bg-base-300 border-base-content/15 text-base-content`),children:[(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e}),n&&(0,b.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-base-content/30 flex-shrink-0`,children:`global`}),!n&&t&&(0,b.jsx)(`button`,{onClick:function(){t(i)},"aria-label":`Delete `+(r||``)+` rule: `+e,title:`Delete`,className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-error flex-shrink-0 focus-visible:ring-2 focus-visible:ring-primary`,children:(0,b.jsx)(iw,{size:12})})]},e+`-`+i)})})}function D9({onAdd:e,label:t}){var[n,r]=(0,x.useState)(``);function i(){var t=n.trim();t&&(e(t),r(``))}function a(e){e.key===`Enter`&&(e.preventDefault(),i())}return(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1.5`,children:[(0,b.jsx)(`input`,{type:`text`,value:n,onChange:function(e){r(e.target.value)},onKeyDown:a,placeholder:`e.g. Bash(curl:*)`,"aria-label":t,className:`flex-1 h-9 sm:h-7 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content font-mono text-[12px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`}),(0,b.jsxs)(`button`,{onClick:i,disabled:!n.trim(),className:`flex items-center gap-1.5 px-3 h-9 sm:h-7 rounded-xl border border-dashed border-base-content/20 bg-transparent text-base-content/40 text-[12px] hover:text-base-content/60 hover:border-base-content/30 transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary`+(n.trim()?``:` opacity-50 cursor-not-allowed`),children:[(0,b.jsx)($b,{size:12}),`Add`]})]})}function EIe({settings:e,updateSection:t}){var[n,r]=(0,x.useState)(function(){return[...e.permissions.allow??[]]}),[i,a]=(0,x.useState)(function(){return[...e.permissions.deny??[]]}),o=$7();(0,x.useEffect)(function(){o.savingRef.current?o.confirmSave():(r([...e.permissions.allow??[]]),a([...e.permissions.deny??[]]),o.resetFromServer())},[e]);function s(e){r(function(t){var n=[...t];return n.splice(e,1),n}),o.markDirty()}function c(e){a(function(t){var n=[...t];return n.splice(e,1),n}),o.markDirty()}function l(e){r(function(t){return[...t,e]}),o.markDirty()}function u(e){a(function(t){return[...t,e]}),o.markDirty()}function d(){o.startSave(),t(`permissions`,{allow:n,deny:i})}var f=e.global.permissions?.allow??[],p=e.global.permissions?.deny??[];return(0,b.jsxs)(`div`,{className:`py-2`,children:[(0,b.jsxs)(`div`,{className:`mb-6`,children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Allow Rules`}),(0,b.jsx)(E9,{rules:n,onDelete:s,labelPrefix:`allow`}),(0,b.jsx)(D9,{onAdd:l,label:`New allow rule`})]}),(0,b.jsxs)(`div`,{className:`mb-6`,children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Deny Rules`}),(0,b.jsx)(E9,{rules:i,onDelete:c,labelPrefix:`deny`}),(0,b.jsx)(D9,{onAdd:u,label:`New deny rule`})]}),(0,b.jsx)(`div`,{className:`mb-8`,children:(0,b.jsx)(n9,{dirty:o.dirty,saving:o.saving,saveState:o.saveState,onSave:d})}),(f.length>0||p.length>0)&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Global Permissions`}),f.length>0&&(0,b.jsxs)(`div`,{className:`mb-4`,children:[(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/40 uppercase tracking-wider mb-1.5`,children:`Allow`}),(0,b.jsx)(E9,{rules:f,readOnly:!0})]}),p.length>0&&(0,b.jsxs)(`div`,{className:`mb-4`,children:[(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/40 uppercase tracking-wider mb-1.5`,children:`Deny`}),(0,b.jsx)(E9,{rules:p,readOnly:!0})]})]})]})}function DIe({settings:e,projectSlug:t}){var{send:n,subscribe:r,unsubscribe:i}=z(),a=e.global.skills,o=e.skills,s=a.length>0||o.length>0,[c,l]=(0,x.useState)(null);(0,x.useEffect)(function(){function e(e){if(e.type===`skills:view_result`){var t=e;l({path:t.path,content:t.content})}}return r(`skills:view_result`,e),function(){i(`skills:view_result`,e)}},[]);function u(e){n({type:`skills:view`,path:e})}return(0,b.jsxs)(`div`,{className:`py-2 space-y-6`,children:[!s&&(0,b.jsx)(`div`,{className:`py-12 text-center text-[13px] text-base-content/40`,children:`No skills found.`}),a.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Global Skills`}),(0,b.jsx)(`div`,{className:`space-y-2`,children:a.map(function(e){return(0,b.jsx)(m9,{skill:e,badge:`global`,onClick:function(){u(e.path)}},e.path)})})]}),o.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Project Skills`}),(0,b.jsx)(`div`,{className:`space-y-2`,children:o.map(function(e){return(0,b.jsx)(m9,{skill:e,onClick:function(){u(e.path)}},e.path)})})]}),(0,b.jsx)(p9,{defaultScope:`project`,defaultProjectSlug:t}),c&&(0,b.jsx)(h9,{path:c.path,content:c.content,onClose:function(){l(null)}})]})}function OIe({settings:e,updateSection:t}){var n=e.global.rules??[],[r,i]=(0,x.useState)(function(){return(e.rules??[]).map(function(e){return{filename:e.filename,content:e.content}})}),[a,o]=(0,x.useState)(new Set),[s,c]=(0,x.useState)(new Set),[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(``),[p,m]=(0,x.useState)(``),h=$7();(0,x.useEffect)(function(){h.savingRef.current?h.confirmSave():(i((e.rules??[]).map(function(e){return{filename:e.filename,content:e.content}})),h.resetFromServer())},[e]);function g(e){o(function(t){var n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function _(e){c(function(t){var n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function v(e,t){i(function(n){return n.map(function(n,r){return r===e?{...n,content:t}:n})}),h.markDirty()}function y(e){i(function(t){return t.filter(function(t,n){return n!==e})}),c(new Set),h.markDirty()}function S(){var e=d.trim();!e||!e.endsWith(`.md`)||(i(function(t){return[...t,{filename:e,content:p}]}),f(``),m(``),u(!1),h.markDirty())}function C(){u(!1),f(``),m(``)}function w(){h.startSave(),t(`rules`,{rules:r})}function T(e){var t=e.trim();return t.length<=80?t:t.slice(0,80)+`...`}var E=`w-full px-3 py-2 bg-base-300 border border-base-content/15 rounded-xl text-base-content font-mono text-[12px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms] resize-y min-h-[120px]`,D=`w-full h-9 sm:h-7 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content font-mono text-[12px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`;return(0,b.jsxs)(`div`,{className:`py-2`,children:[(0,b.jsxs)(`a`,{href:`https://docs.anthropic.com/en/docs/claude-code/memory`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[11px] text-base-content/30 hover:text-primary/70 flex items-center gap-1 mb-4 transition-colors`,children:[(0,b.jsx)(xm,{size:11}),`Claude Code docs`]}),(0,b.jsxs)(`div`,{className:`mb-6`,children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Global Rules`}),n.length===0&&(0,b.jsx)(`div`,{className:`py-4 text-center text-[13px] text-base-content/30`,children:`No global rules.`}),n.length>0&&(0,b.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:n.map(function(e,t){var n=a.has(t);return(0,b.jsxs)(`div`,{className:`border border-base-content/10 rounded-xl overflow-hidden`,children:[(0,b.jsxs)(`button`,{onClick:function(){g(t)},className:`w-full flex items-center gap-2 px-3 py-2 bg-base-300/50 hover:bg-base-300/70 transition-colors duration-[120ms] cursor-pointer text-left`,children:[n?(0,b.jsx)(nu,{size:12,className:`text-base-content/40 flex-shrink-0`}):(0,b.jsx)(ou,{size:12,className:`text-base-content/40 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`font-mono text-[12px] text-base-content/40 flex-1 truncate`,children:e.filename}),(0,b.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-base-content/30`,children:`global`})]}),!n&&(0,b.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-base-content/30 font-mono truncate`,children:T(e.content)}),n&&(0,b.jsx)(`pre`,{className:`px-3 py-2 text-[12px] text-base-content/40 font-mono whitespace-pre-wrap break-words bg-base-300/30 max-h-[300px] overflow-auto`,children:e.content})]},e.filename+`-`+t)})})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Project Rules`}),r.length===0&&!l&&(0,b.jsx)(`div`,{className:`py-4 text-center text-[13px] text-base-content/30 mb-3`,children:`No project rules.`}),r.length>0&&(0,b.jsx)(`div`,{className:`flex flex-col gap-1.5 mb-3`,children:r.map(function(e,t){var n=s.has(t);return(0,b.jsxs)(`div`,{className:`border border-base-content/15 rounded-xl overflow-hidden`,children:[(0,b.jsxs)(`div`,{className:`w-full flex items-center gap-2 px-3 py-2 bg-base-300 text-left`,children:[(0,b.jsxs)(`button`,{onClick:function(){_(t)},className:`flex items-center gap-2 flex-1 min-w-0 cursor-pointer hover:text-base-content/80 transition-colors`,children:[n?(0,b.jsx)(nu,{size:12,className:`text-base-content/60 flex-shrink-0`}):(0,b.jsx)(ou,{size:12,className:`text-base-content/60 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`font-mono text-[12px] text-base-content flex-1 truncate text-left`,children:e.filename})]}),(0,b.jsx)(`button`,{onClick:function(){y(t)},className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-error flex-shrink-0 focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":`Delete `+e.filename,children:(0,b.jsx)(iw,{size:14})})]}),!n&&(0,b.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-base-content/50 font-mono truncate`,children:T(e.content)}),n&&(0,b.jsx)(`div`,{className:`px-3 py-2 bg-base-300/30`,children:(0,b.jsx)(`textarea`,{value:e.content,onChange:function(e){v(t,e.target.value)},className:E,rows:8,"aria-label":`Content for `+e.filename})})]},e.filename+`-`+t)})}),l&&(0,b.jsxs)(`div`,{className:`border border-dashed border-base-content/20 rounded-xl p-3 mb-3 flex flex-col gap-2`,children:[(0,b.jsx)(`input`,{type:`text`,value:d,onChange:function(e){f(e.target.value)},placeholder:`filename.md`,"aria-label":`New rule filename`,className:D}),(0,b.jsx)(`textarea`,{value:p,onChange:function(e){m(e.target.value)},placeholder:`Rule content...`,"aria-label":`New rule content`,className:E,rows:5}),(0,b.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,b.jsx)(`button`,{onClick:C,className:`btn btn-ghost btn-sm text-[12px]`,children:`Cancel`}),(0,b.jsx)(`button`,{onClick:S,disabled:!d.trim()||!d.trim().endsWith(`.md`),className:`btn btn-sm btn-primary text-[12px]`+(!d.trim()||!d.trim().endsWith(`.md`)?` opacity-50 cursor-not-allowed`:``),children:`Add`})]})]}),!l&&(0,b.jsxs)(`button`,{onClick:function(){u(!0)},className:`flex items-center gap-1.5 px-3 py-2.5 sm:py-1.5 rounded-xl border border-dashed border-base-content/20 bg-transparent text-base-content/40 text-[12px] hover:text-base-content/60 hover:border-base-content/30 transition-colors duration-[120ms] mb-5 cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100`,children:[(0,b.jsx)($b,{size:12}),`Add Rule`]}),(0,b.jsx)(n9,{dirty:h.dirty,saving:h.saving,saveState:h.saveState,onSave:w})]})]})}function kIe({settings:e,updateSection:t}){var n=e.global.mcpServers??{},r=Object.entries(n),[i,a]=(0,x.useState)(function(){return{...e.mcpServers??{}}}),o=$7(),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(s9),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(s9),[h,g]=(0,x.useState)(null);(0,x.useEffect)(function(){o.savingRef.current?o.confirmSave():(a({...e.mcpServers??{}}),o.resetFromServer())},[e]);var _=Object.entries(i);function v(){var e=l.name.trim();e&&(a({...i,[e]:l9(l)}),c(!1),u(s9()),o.markDirty())}function y(e){f(e),m(c9(e,i[e])),c(!1),g(null)}function S(){if(d){var e=p.name.trim();if(e){var t={...i};e!==d&&delete t[d],t[e]=l9(p),a(t),f(null),o.markDirty()}}}function C(e){if(h!==e){g(e);return}var t={...i};delete t[e],a(t),d===e&&f(null),g(null),o.markDirty()}function w(){o.startSave(),t(`mcp`,{mcpServers:i})}var T=new Set(Object.keys(i)),E=new Set(Object.keys(i).filter(function(e){return e!==d}));return(0,b.jsxs)(`div`,{className:`py-2`,children:[(0,b.jsxs)(`div`,{className:`mb-6`,children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Global MCP Servers`}),r.length===0&&(0,b.jsx)(`div`,{className:`py-4 text-center text-[13px] text-base-content/30`,children:`No global MCP servers.`}),r.length>0&&(0,b.jsx)(`div`,{className:`flex flex-col gap-2`,children:r.map(function([e,t]){return(0,b.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 rounded-xl bg-base-300/50 border border-base-content/10`,children:[(0,b.jsx)(`span`,{className:`font-mono text-[12px] text-base-content/40 font-semibold flex-shrink-0`,children:e}),u9(t),(0,b.jsx)(`div`,{className:`flex-1 min-w-0`,children:d9(t)}),(0,b.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-base-content/30 flex-shrink-0`,children:`global`})]},e)})})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Project MCP Servers`}),_.length===0&&!s&&(0,b.jsx)(`div`,{className:`py-4 text-center text-[13px] text-base-content/30 mb-3`,children:`No project MCP servers.`}),(0,b.jsx)(`div`,{className:`flex flex-col gap-2 mb-3`,children:_.map(function([e,t]){if(d===e)return(0,b.jsx)(f9,{form:p,setForm:m,onSave:S,onCancel:function(){f(null)},existingNames:E,idPrefix:`mcp-edit`},e);var n=h===e;return(0,b.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 rounded-xl bg-base-300 border border-base-content/15`,children:[(0,b.jsx)(`span`,{className:`font-mono text-[12px] text-base-content font-semibold flex-shrink-0`,children:e}),u9(t),(0,b.jsx)(`div`,{className:`flex-1 min-w-0`,children:d9(t)}),n?(0,b.jsxs)(`div`,{className:`flex gap-1.5 flex-shrink-0`,children:[(0,b.jsx)(`button`,{onClick:function(){C(e)},className:`btn btn-error btn-xs`,children:`Confirm`}),(0,b.jsx)(`button`,{onClick:function(){g(null)},className:`btn btn-ghost btn-xs`,children:`Cancel`})]}):(0,b.jsxs)(`div`,{className:`flex gap-1 flex-shrink-0`,children:[(0,b.jsx)(`button`,{onClick:function(){y(e)},"aria-label":`Edit `+e,className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-primary focus-visible:ring-2 focus-visible:ring-primary`,children:(0,b.jsx)(bb,{size:12})}),(0,b.jsx)(`button`,{onClick:function(){C(e)},"aria-label":`Delete `+e,className:`btn btn-ghost btn-xs btn-square text-base-content/30 hover:text-error focus-visible:ring-2 focus-visible:ring-primary`,children:(0,b.jsx)(XC,{size:12})})]})]},e)})}),s&&(0,b.jsx)(`div`,{className:`mb-3`,children:(0,b.jsx)(f9,{form:l,setForm:u,onSave:v,onCancel:function(){c(!1),u(s9())},existingNames:T,idPrefix:`mcp-add`})}),!s&&(0,b.jsxs)(`button`,{onClick:function(){c(!0),f(null),g(null)},className:`flex items-center gap-1.5 px-3 py-2.5 sm:py-1.5 rounded-xl border border-dashed border-base-content/20 bg-transparent text-base-content/40 text-[12px] hover:text-base-content/60 hover:border-base-content/30 transition-colors duration-[120ms] mb-5 cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 focus-visible:ring-offset-base-100`,children:[(0,b.jsx)($b,{size:12}),`Add Server`]}),(0,b.jsx)(n9,{dirty:o.dirty,saving:o.saving,saveState:o.saveState,onSave:w})]})]})}function AIe(e){return localStorage.getItem(`lattice-mute-`+e)===`1`}function jIe(e,t){localStorage.setItem(`lattice-mute-`+e,t?`1`:`0`)}function MIe({projectSlug:e}){var t=e??``,[n,r]=(0,x.useState)(function(){return AIe(t)});function i(){var e=!n;r(e),jIe(t,e)}return(0,b.jsx)(`div`,{className:`py-2 space-y-6`,children:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[12px] font-semibold text-base-content/40 mb-3`,children:`Project Notifications`}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between py-2 px-3 bg-base-300 border border-base-content/15 rounded-xl`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[13px] text-base-content`,children:`Mute all notifications`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30 mt-0.5`,children:`Suppress all browser notifications from this project`})]}),(0,b.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:n,onChange:i})]})]})})}function NIe({settings:e,updateSection:t}){var{send:n,subscribe:r,unsubscribe:i}=z(),[a,o]=(0,x.useState)([]),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(e.disabledPlugins??[]),[d,f]=(0,x.useState)(!1);(0,x.useEffect)(function(){function e(e){e.type===`plugin:list_result`&&(o(e.plugins),c(!0))}return r(`plugin:list_result`,e),n({type:`plugin:list`}),function(){i(`plugin:list_result`,e)}},[]),(0,x.useEffect)(function(){u(e.disabledPlugins??[])},[e.disabledPlugins]);function p(e){var n=l.indexOf(e)===-1?l.concat(e):l.filter(function(t){return t!==e});u(n),f(!0),t(`plugins`,{disabledPlugins:n}),setTimeout(function(){f(!1)},500)}if(!s)return(0,b.jsx)(`div`,{className:`text-[13px] text-base-content/40 py-4`,children:`Loading...`});if(a.length===0)return(0,b.jsx)(`div`,{className:`py-6 text-center text-[13px] text-base-content/30`,children:`No plugins installed. Install plugins from Global Settings to use them in projects.`});var m=a.length-l.length;return(0,b.jsxs)(`div`,{className:`py-2 space-y-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,b.jsx)(`p`,{className:`text-[12px] text-base-content/40`,children:`Toggle plugins on/off for this project. Disabled plugins won't load in new sessions.`}),d&&(0,b.jsx)(gg,{size:12,className:`text-primary animate-spin`})]}),(0,b.jsxs)(`div`,{className:`text-[11px] text-base-content/30 mb-1`,children:[m,` of `,a.length,` enabled`]}),(0,b.jsx)(`div`,{className:`space-y-1.5`,children:a.map(function(e){var t=l.indexOf(e.key)!==-1;return(0,b.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2.5 rounded-xl border transition-colors duration-[120ms] `+(t?`bg-base-300/30 border-base-content/8 opacity-50`:`bg-base-300 border-base-content/15`),children:[(0,b.jsx)(us,{size:14,className:`text-base-content/25 flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-[13px] font-bold text-base-content truncate`,children:e.name}),(0,b.jsxs)(`span`,{className:`text-[10px] font-mono px-1.5 py-0.5 rounded-md bg-base-content/8 text-base-content/40`,children:[`v`,e.version]})]}),(0,b.jsxs)(`div`,{className:`text-[11px] text-base-content/30 mt-0.5`,children:[e.marketplace,e.skillCount>0?` · `+e.skillCount+` skill`+(e.skillCount===1?``:`s`):``]})]}),(0,b.jsx)(`input`,{type:`checkbox`,checked:!t,onChange:function(){p(e.key)},className:`toggle toggle-sm toggle-primary`,"aria-label":(t?`Enable`:`Disable`)+` `+e.name})]},e.key)})})]})}var PIe={general:{title:`General`},notifications:{title:`Notifications`},claude:{title:`Claude`},environment:{title:`Environment`},mcp:{title:`MCP Servers`},skills:{title:`Skills`},plugins:{title:`Plugins`},rules:{title:`Rules`},permissions:{title:`Permissions`},memory:{title:`Memory`}};function FIe(e,t,n,r){return e===`general`?(0,b.jsx)(_Ie,{settings:t,updateSection:n}):e===`claude`?(0,b.jsx)(CIe,{settings:t,updateSection:n}):e===`environment`?(0,b.jsx)(TIe,{settings:t,updateSection:n}):e===`permissions`?(0,b.jsx)(EIe,{settings:t,updateSection:n}):e===`skills`?(0,b.jsx)(DIe,{settings:t,projectSlug:r}):e===`plugins`?(0,b.jsx)(NIe,{settings:t,updateSection:n}):e===`rules`?(0,b.jsx)(OIe,{settings:t,updateSection:n}):e===`mcp`?(0,b.jsx)(kIe,{settings:t,updateSection:n}):e===`memory`?(0,b.jsx)(_9,{projectSlug:r}):e===`notifications`?(0,b.jsx)(MIe,{projectSlug:r}):(0,b.jsxs)(`div`,{className:`py-2 text-[13px] text-base-content/40`,children:[e,` section coming soon.`]})}function IIe(){var{activeView:e,activeProjectSlug:t,toggleDrawer:n}=Yw();if(e.type!==`project-settings`)return null;var r=e.section,i=PIe[r],{settings:a,loading:o,error:s,updateSection:c}=S9(t);return(0,b.jsxs)(`section`,{"aria-label":`Project Settings`,className:`flex-1 overflow-auto px-4 sm:px-8 py-4 sm:py-6 max-w-3xl`,children:[i&&(0,b.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-square lg:hidden`,"aria-label":`Toggle sidebar`,onClick:n,children:(0,b.jsx)(m_,{size:18})}),(0,b.jsx)(`h1`,{className:`text-lg font-mono font-bold text-base-content`,children:i.title})]}),o&&(0,b.jsx)(`div`,{className:`text-[13px] text-base-content/40 py-4`,children:`Loading...`}),s&&(0,b.jsx)(`div`,{className:`text-[13px] text-error py-4`,children:s}),!o&&!s&&a&&FIe(r,a,c,t??void 0)]})}function LIe(e){var t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return n+`s ago`;var r=Math.floor(n/60);if(r<60)return r+`m ago`;var i=Math.floor(r/60);return i<24?i+`h ago`:Math.floor(i/24)+`d ago`}function RIe(){kT();var{nodes:e}=Jw(),{projects:t}=Gw(),n=Yw(),{send:r,subscribe:i,unsubscribe:a}=z(),[o,s]=(0,x.useState)([]),[c,l]=(0,x.useState)(null),u=(0,x.useMemo)(function(){return e.filter(function(e){return e.online})},[e]);(0,x.useEffect)(function(){function e(e){e.type===`session:list_all`&&s(e.sessions)}function t(e){e.type===`settings:data`&&l(e.config)}return i(`session:list_all`,e),i(`settings:data`,t),r({type:`session:list_all_request`}),r({type:`settings:get`}),function(){a(`session:list_all`,e),a(`settings:data`,t)}},[]);var d=(0,x.useMemo)(function(){for(var e=new Map,n=0;n<t.length;n++)e.set(t[n].slug,t[n].title);return e},[t]);function f(e){return d.get(e)||e}var p=(0,x.useMemo)(function(){for(var e=new Map,t=0;t<o.length;t++){var n=o[t],r=e.get(n.projectSlug);r||(r=[],e.set(n.projectSlug,r)),r.push(n)}return e},[o]),m=e.filter(function(e){return!e.isLocal});return(0,b.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,b.jsxs)(`div`,{className:`max-w-2xl mx-auto px-4 sm:px-8 py-6 sm:py-10`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-square lg:hidden`,"aria-label":`Toggle sidebar`,onClick:n.toggleDrawer,children:(0,b.jsx)(m_,{size:18})}),(0,b.jsx)(sw,{size:28}),(0,b.jsx)(`h1`,{className:`text-lg font-mono font-bold text-base-content`,children:`Lattice`})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] font-mono text-base-content/30 mb-10 ml-[43px]`,children:[(0,b.jsxs)(`span`,{children:[u.length,`/`,e.length,` nodes`]}),(0,b.jsx)(`span`,{className:`text-base-content/15`,children:`/`}),(0,b.jsxs)(`span`,{children:[t.length,` projects`]}),(0,b.jsx)(`span`,{className:`text-base-content/15`,children:`/`}),(0,b.jsxs)(`span`,{children:[o.length,` sessions`]})]}),(0,b.jsx)(`div`,{className:`mb-12`,children:(0,b.jsx)(p7,{})}),o.length>0&&(0,b.jsxs)(`div`,{className:`mb-12`,children:[(0,b.jsx)(`h2`,{className:`text-[11px] font-semibold tracking-wider uppercase text-base-content/40 mb-3`,children:`Recent Sessions`}),(0,b.jsx)(`div`,{className:`flex flex-col gap-1`,children:o.slice(0,8).map(function(e){return(0,b.jsxs)(`button`,{onClick:function(){gw(e.id,e.projectSlug,e.title),n.navigateToSession(e.projectSlug,e.id)},className:`flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-base-200 transition-colors duration-[120ms] cursor-pointer text-left focus-visible:ring-2 focus-visible:ring-primary group`,children:[(0,b.jsx)(W_,{size:12,className:`text-base-content/20 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`flex-1 text-[12px] text-base-content/70 truncate group-hover:text-base-content`,children:AT(e.title)||`Untitled`}),(0,b.jsx)(`span`,{className:`text-[10px] font-mono text-base-content/25 flex-shrink-0`,children:f(e.projectSlug)}),(0,b.jsx)(`span`,{className:`text-[10px] text-base-content/20 font-mono flex-shrink-0`,children:LIe(e.updatedAt)}),(0,b.jsx)(ou,{size:10,className:`text-base-content/15 flex-shrink-0 opacity-0 group-hover:opacity-100`})]},e.id)})})]}),t.length>0&&(0,b.jsxs)(`div`,{className:`mb-12`,children:[(0,b.jsx)(`h2`,{className:`text-[11px] font-semibold tracking-wider uppercase text-base-content/40 mb-3`,children:`Projects`}),(0,b.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:t.map(function(e){var t=p.get(e.slug)||[];return(0,b.jsxs)(`button`,{onClick:function(){n.setActiveProjectSlug(e.slug)},className:`flex items-center gap-3 px-3 py-2.5 rounded-lg hover:bg-base-200 transition-colors duration-[120ms] cursor-pointer text-left focus-visible:ring-2 focus-visible:ring-primary group`,children:[(0,b.jsx)(Wm,{size:14,className:`text-base-content/20 flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsx)(`div`,{className:`text-[13px] font-semibold text-base-content/70 truncate group-hover:text-base-content`,children:e.title}),(0,b.jsxs)(`div`,{className:`text-[10px] text-base-content/25 font-mono`,children:[t.length,` session`,t.length===1?``:`s`,e.isRemote&&(0,b.jsxs)(`span`,{className:`ml-1.5 text-base-content/20`,children:[`on `,e.nodeName]})]})]}),(0,b.jsx)(ou,{size:12,className:`text-base-content/15 flex-shrink-0 opacity-0 group-hover:opacity-100`})]},e.slug+`@`+e.nodeId)})})]}),m.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-[11px] font-semibold tracking-wider uppercase text-base-content/40 mb-3`,children:`Mesh`}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:m.map(function(e){return(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.online?(0,b.jsx)(Bu,{size:10,className:`text-success flex-shrink-0`}):(0,b.jsx)(fd,{size:10,className:`text-base-content/20 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`text-[12px] text-base-content/50`,children:e.name}),(0,b.jsxs)(`span`,{className:`text-[10px] text-base-content/20 font-mono`,children:[e.projects.length,`p`]})]},e.id)})})]})]})})}function O9({label:e,value:t,icon:n,loading:r}){return(0,b.jsxs)(`div`,{className:`bg-base-300 rounded-xl border border-base-content/15 p-3 px-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[n,(0,b.jsx)(`span`,{className:`text-[11px] font-semibold tracking-wider uppercase text-base-content/40`,children:e})]}),r?(0,b.jsx)(`div`,{className:`h-7 w-10 bg-base-content/10 rounded animate-pulse`}):(0,b.jsx)(`div`,{className:`text-xl font-mono font-bold text-base-content`,children:t})]})}function k9({label:e,icon:t,onClick:n}){return(0,b.jsxs)(`button`,{onClick:n,className:`flex items-center gap-2.5 px-3 py-2 rounded-xl border border-base-content/15 bg-base-300 text-[12px] text-base-content/60 hover:text-base-content hover:border-base-content/30 transition-colors duration-[120ms] cursor-pointer focus-visible:ring-2 focus-visible:ring-primary`,children:[t,(0,b.jsx)(`span`,{className:`flex-1 text-left`,children:e}),(0,b.jsx)(ou,{size:12,className:`text-base-content/30`})]})}function zIe(){var e=Yw();if(e.activeView.type!==`project-dashboard`)return null;var{settings:t,loading:n}=S9(e.activeProjectSlug),{projects:r}=Gw(),{send:i,subscribe:a,unsubscribe:o,status:s}=z(),[c,l]=(0,x.useState)([]),[u,d]=(0,x.useState)(!0),f=r.find(function(t){return t.slug===e.activeProjectSlug}),p=f?.title??e.activeProjectSlug??`Project`;(0,x.useEffect)(function(){if(!e.activeProjectSlug)return;function t(t){if(t.type===`session:list`){var n=t;n.projectSlug===e.activeProjectSlug&&(l(n.sessions.slice().sort(function(e,t){return t.updatedAt-e.updatedAt})),d(!1))}}return a(`session:list`,t),s===`connected`&&(d(!0),i({type:`session:list_request`,projectSlug:e.activeProjectSlug})),function(){o(`session:list`,t)}},[e.activeProjectSlug,s]);function m(t){e.openProjectSettings(t)}function h(t){f&&(gw(t.id,f.slug,t.title),e.setActiveSessionId(t.id))}var g=c.length,_=t?Object.keys(t.mcpServers).length:0,v=t?Object.keys(t.global.mcpServers).length:0,y=t?t.rules.length:0,S=t?t.global.rules.length:0,C=t?Object.keys(t.env).length:0;return(0,b.jsxs)(`div`,{className:`flex-1 overflow-auto px-4 sm:px-8 py-4 sm:py-6 max-w-3xl`,children:[(0,b.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-square lg:hidden`,"aria-label":`Toggle sidebar`,onClick:e.toggleDrawer,children:(0,b.jsx)(m_,{size:18})}),(0,b.jsx)(`h1`,{className:`text-lg font-mono font-bold text-base-content`,children:p})]}),(0,b.jsxs)(`div`,{className:`space-y-6`,children:[(0,b.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3`,children:[(0,b.jsx)(O9,{label:`Sessions`,value:g,icon:(0,b.jsx)(W_,{size:14,className:`text-primary`}),loading:u}),(0,b.jsx)(O9,{label:`MCP Servers`,value:_+v,icon:(0,b.jsx)(Qb,{size:14,className:`text-accent`}),loading:n}),(0,b.jsx)(O9,{label:`Rules`,value:y+S,icon:(0,b.jsx)(oC,{size:14,className:`text-info`}),loading:n}),(0,b.jsx)(O9,{label:`Env Vars`,value:C,icon:(0,b.jsx)(JC,{size:14,className:`text-success`}),loading:n})]}),n?(0,b.jsx)(`div`,{className:`bg-base-content/10 rounded-xl h-32 animate-pulse`}):t?.claudeMd?(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`CLAUDE.md`}),(0,b.jsx)(`div`,{className:`px-3 py-2.5 bg-base-300 border border-base-content/15 rounded-xl font-mono text-[11px] text-base-content/60 leading-relaxed max-h-48 overflow-y-auto`,children:(0,b.jsx)(`pre`,{className:`whitespace-pre-wrap`,children:t.claudeMd})})]}):null,(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Recent Sessions`}),u?(0,b.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[0,1,2].map(function(e){return(0,b.jsx)(`div`,{className:`bg-base-content/10 rounded-xl h-10 animate-pulse`},e)})}):c.length>0?(0,b.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:c.slice(0,5).map(function(e){return(0,b.jsxs)(`button`,{onClick:function(){h(e)},className:`flex items-center gap-3 px-3 py-2 rounded-xl border border-base-content/15 bg-base-300 hover:border-base-content/30 transition-colors duration-[120ms] cursor-pointer text-left focus-visible:ring-2 focus-visible:ring-primary`,children:[(0,b.jsx)(W_,{size:12,className:`text-base-content/30 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`flex-1 text-[12px] text-base-content truncate`,children:e.title||`Untitled`}),(0,b.jsx)(`span`,{className:`text-[10px] text-base-content/30 font-mono flex-shrink-0`,children:new Date(e.updatedAt).toLocaleDateString()}),(0,b.jsx)(ou,{size:12,className:`text-base-content/20 flex-shrink-0`})]},e.id)})}):(0,b.jsx)(`div`,{className:`text-[12px] text-base-content/30`,children:`No sessions yet`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-2`,children:`Settings`}),(0,b.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 gap-2`,children:[(0,b.jsx)(k9,{label:`General`,icon:(0,b.jsx)(TC,{size:13,className:`text-base-content/40`}),onClick:function(){m(`general`)}}),(0,b.jsx)(k9,{label:`Claude`,icon:(0,b.jsx)(Vm,{size:13,className:`text-base-content/40`}),onClick:function(){m(`claude`)}}),(0,b.jsx)(k9,{label:`Environment`,icon:(0,b.jsx)(JC,{size:13,className:`text-base-content/40`}),onClick:function(){m(`environment`)}}),(0,b.jsx)(k9,{label:`MCP Servers`,icon:(0,b.jsx)(Qb,{size:13,className:`text-base-content/40`}),onClick:function(){m(`mcp`)}}),(0,b.jsx)(k9,{label:`Rules`,icon:(0,b.jsx)(oC,{size:13,className:`text-base-content/40`}),onClick:function(){m(`rules`)}}),(0,b.jsx)(k9,{label:`Permissions`,icon:(0,b.jsx)(HC,{size:13,className:`text-base-content/40`}),onClick:function(){m(`permissions`)}})]})]}),t&&(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30 font-mono truncate`,children:t.path})]})]})}function BIe({isOpen:e,onClose:t}){var{send:n,subscribe:r,unsubscribe:i}=z(),{nodes:a}=Jw(),o=$7(),s=a.find(function(e){return e.isLocal}),c=s?s.id:``,[l,u]=(0,x.useState)(null),[d,f]=(0,x.useState)(``),[p,m]=(0,x.useState)(7654),[h,g]=(0,x.useState)(!1),[_,v]=(0,x.useState)(!1),[y,S]=(0,x.useState)(!1),[C,w]=(0,x.useState)(`auto`),T=(0,x.useRef)(null),E=(0,x.useRef)(null);Ur(E,(0,x.useCallback)(function(){t()},[t]),e),(0,x.useEffect)(function(){if(!e)return;function t(e){if(e.type===`settings:data`){var t=e.config;u(t),o.saving?o.confirmSave():(f(t.name),m(t.port),g(t.tls),v(t.debug),w(t.wsl??`auto`),o.resetFromServer())}}return r(`settings:data`,t),n({type:`settings:get`}),function(){i(`settings:data`,t)}},[e]),(0,x.useEffect)(function(){return function(){T.current&&clearTimeout(T.current)}},[]);function D(){o.startSave(),n({type:`settings:update`,settings:{name:d,port:p,tls:h,debug:_,wsl:C}})}function O(){c&&(navigator.clipboard.writeText(c),S(!0),T.current&&clearTimeout(T.current),T.current=setTimeout(function(){S(!1)},2e3))}if(!e)return null;var k=`w-full h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[13px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`;return(0,b.jsxs)(`div`,{ref:E,className:`fixed inset-0 z-[9999] flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"aria-label":`Node Settings`,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-base-content/50`,onClick:t}),(0,b.jsxs)(`div`,{className:`relative bg-base-200 border border-base-content/15 rounded-2xl shadow-2xl w-full max-w-md mx-4 overflow-hidden`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-base-content/15`,children:[(0,b.jsx)(`h2`,{className:`text-[15px] font-mono font-bold text-base-content`,children:`Node Settings`}),(0,b.jsx)(`button`,{onClick:t,"aria-label":`Close`,className:`btn btn-ghost btn-xs btn-square text-base-content/40 hover:text-base-content`,children:(0,b.jsx)(iw,{size:16})})]}),(0,b.jsxs)(`div`,{className:`px-5 py-4 space-y-4 max-h-[70vh] overflow-y-auto`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{htmlFor:`node-id`,className:`block text-[12px] font-semibold text-base-content/40 mb-1.5`,children:`Node ID`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`div`,{className:`flex-1 h-9 px-3 bg-base-300/50 border border-base-content/10 rounded-xl font-mono text-[11px] text-base-content/50 flex items-center truncate select-all`,children:c||`Loading...`}),(0,b.jsx)(`button`,{onClick:O,disabled:!c,"aria-label":`Copy node ID`,className:`btn btn-ghost btn-sm btn-square text-base-content/30 hover:text-base-content flex-shrink-0`,children:y?(0,b.jsx)(R,{size:14,className:`text-success`}):(0,b.jsx)(qf,{size:14})})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{htmlFor:`node-name`,className:`block text-[12px] font-semibold text-base-content/40 mb-1.5`,children:`Node Name`}),(0,b.jsx)(`input`,{id:`node-name`,type:`text`,value:d,onChange:function(e){f(e.target.value),o.markDirty()},placeholder:`My Node`,className:k})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{htmlFor:`node-port`,className:`block text-[12px] font-semibold text-base-content/40 mb-1.5`,children:`Port`}),(0,b.jsx)(`input`,{id:`node-port`,type:`number`,value:p,onChange:function(e){var t=parseInt(e.target.value,10);isNaN(t)||(m(t),o.markDirty())},min:1,max:65535,className:k+` font-mono`})]}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40`,children:`TLS`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30`,children:`Encrypt connections between nodes`})]}),(0,b.jsx)(`input`,{type:`checkbox`,checked:h,onChange:function(e){g(e.target.checked),o.markDirty()},className:`toggle toggle-sm toggle-primary`,"aria-label":`Enable TLS`})]}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40`,children:`Debug Mode`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30`,children:`Enable verbose logging`})]}),(0,b.jsx)(`input`,{type:`checkbox`,checked:_,onChange:function(e){v(e.target.checked),o.markDirty()},className:`toggle toggle-sm toggle-primary`,"aria-label":`Enable debug mode`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[12px] font-semibold text-base-content/40 mb-1.5`,children:`WSL Mode`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30 mb-2`,children:`Convert file paths for Windows editors when running under WSL`}),(0,b.jsxs)(`select`,{value:String(C),onChange:function(e){var t=e.target.value;w(t===`true`?!0:t===`false`?!1:`auto`),o.markDirty()},className:k,children:[(0,b.jsx)(`option`,{value:`auto`,children:`Auto-detect`}),(0,b.jsx)(`option`,{value:`true`,children:`Enabled`}),(0,b.jsx)(`option`,{value:`false`,children:`Disabled`})]})]})]}),(0,b.jsx)(`div`,{className:`px-5 py-3 border-t border-base-content/15`,children:(0,b.jsx)(n9,{dirty:o.dirty,saving:o.saving,saveState:o.saveState,onSave:D})})]})]})}function VIe({isOpen:e,onClose:t}){var{send:n,subscribe:r,unsubscribe:i}=z(),{projects:a}=Gw(),[o,s]=(0,x.useState)(``),[c,l]=(0,x.useState)([]),[u,d]=(0,x.useState)(``),[f,p]=(0,x.useState)(!1),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(-1),[v,y]=(0,x.useState)(null),[S,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)([]),[E,D]=(0,x.useState)(``),O=(0,x.useRef)(null),k=(0,x.useRef)(null),A=(0,x.useRef)(null),j=(0,x.useRef)(!1),M=(0,x.useRef)(!1),N=(0,x.useRef)(null);Ur(N,(0,x.useCallback)(function(){t()},[t]),e),(0,x.useEffect)(function(){if(!e)return;s(``),l([]),d(``),p(!1),h(!1),y(null),C(!1),T([]),M.current=!1,n({type:`browse:list`,path:`~`}),n({type:`browse:suggestions`});function a(e){if(e.type===`browse:list_result`){var t=e;l(t.entries),D(t.homedir),_(-1),j.current&&t.entries.length>0&&h(!0)}}function o(e){e.type===`browse:suggestions_result`&&T(e.suggestions)}function c(e){e.type===`projects:list`&&M.current&&(M.current=!1,C(!1),t())}return r(`browse:list_result`,a),r(`browse:suggestions_result`,o),r(`projects:list`,c),function(){i(`browse:list_result`,a),i(`browse:suggestions_result`,o),i(`projects:list`,c)}},[e]),(0,x.useEffect)(function(){if(!e)return;function t(e){A.current&&!A.current.contains(e.target)&&k.current&&!k.current.contains(e.target)&&h(!1)}return document.addEventListener(`mousedown`,t),function(){document.removeEventListener(`mousedown`,t)}},[e]),(0,x.useEffect)(function(){if(e){O.current&&clearTimeout(O.current);var t=o.trim();if(!t){n({type:`browse:list`,path:`~`});return}O.current=setTimeout(function(){var e=t;if(!t.endsWith(`/`)){var r=t.lastIndexOf(`/`);e=r>=0?t.slice(0,r+1):t}n({type:`browse:list`,path:e})},200)}},[o,e]);function ee(e){return e.startsWith(`~/`)&&E?E+e.slice(1):e===`~`&&E?E:e}function te(e){s(e.path+`/`),h(!1),y(null),f||(e.projectName?d(e.projectName):d(e.name)),n({type:`browse:list`,path:e.path}),k.current&&k.current.focus()}function P(e){d(e),p(e.length>0)}function F(){j.current=!0,re().length>0&&h(!0)}function ne(){j.current=!1}function re(){var e=o.trim();if(!e||e.endsWith(`/`))return c;var t=e.lastIndexOf(`/`),n=t>=0?e.slice(t+1).toLowerCase():e.toLowerCase();return n?c.filter(function(e){return e.name.toLowerCase().startsWith(n)}):c}function ie(){var e=o.trim();if(!e)return!1;var t=ee(e.endsWith(`/`)?e.slice(0,-1):e);return!a.some(function(e){return e.path===t})}function ae(){var e=o.trim();if(!e)return{type:`info`,text:`Type a path to browse directories`};var t=ee(e.endsWith(`/`)?e.slice(0,-1):e);return a.some(function(e){return e.path===t})?{type:`error`,text:`Already added as a project`}:null}function oe(e){var t=re();if(!m||t.length===0){e.key===`Enter`&&se&&(e.preventDefault(),ce());return}e.key===`ArrowDown`?(e.preventDefault(),_(function(e){var n=e+1;return n>=t.length&&(n=0),I(n),n})):e.key===`ArrowUp`?(e.preventDefault(),_(function(e){var n=e-1;return n<0&&(n=t.length-1),I(n),n})):e.key===`Tab`||e.key===`Enter`?g>=0&&g<t.length?(e.preventDefault(),te(t[g]),_(-1)):e.key===`Enter`&&se&&(e.preventDefault(),ce()):e.key===`Escape`&&(e.stopPropagation(),h(!1),_(-1))}function I(e){if(A.current){var t=A.current.children;t[e]&&t[e].scrollIntoView({block:`nearest`})}}var se=ie()&&!S;function ce(){var e=o.trim();if(!(!e||S)){var t=ee(e.endsWith(`/`)?e.slice(0,-1):e),r=u.trim()||t.split(`/`).pop()||`Untitled`;C(!0),M.current=!0,n({type:`settings:update`,settings:{projects:[{path:t,title:r}]}})}}if(!e)return null;var le=re(),ue=ae();return(0,b.jsxs)(`div`,{ref:N,className:`fixed inset-0 z-[9999] flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"aria-label":`Add Project`,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-base-content/50`,onClick:t}),(0,b.jsxs)(`div`,{className:`relative bg-base-200 border border-base-content/15 rounded-2xl shadow-2xl w-full max-w-3xl mx-4 overflow-hidden`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-base-content/15`,children:[(0,b.jsx)(`h2`,{className:`text-[15px] font-mono font-bold text-base-content`,children:`Add Project`}),(0,b.jsx)(`button`,{onClick:t,"aria-label":`Close`,className:`btn btn-ghost btn-xs btn-square text-base-content/40 hover:text-base-content`,children:(0,b.jsx)(iw,{size:16})})]}),(0,b.jsxs)(`div`,{className:`px-5 py-4 space-y-4`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{htmlFor:`project-path`,className:`block text-[12px] font-semibold text-base-content/40 mb-1.5`,children:`Project Path`}),(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(`input`,{ref:k,id:`project-path`,type:`text`,value:o,onChange:function(e){s(e.target.value),h(!0),_(-1),y(null)},onFocus:F,onBlur:ne,onKeyDown:oe,placeholder:`~/projects/my-app`,autoFocus:!0,className:`w-full h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content font-mono text-[12px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`}),m&&le.length>0&&(0,b.jsx)(`div`,{ref:A,className:`absolute top-full left-0 right-0 mt-1 z-50 bg-base-200 border border-base-content/15 rounded-xl shadow-lg max-h-48 overflow-y-auto`,children:le.map(function(e,t){return(0,b.jsxs)(`button`,{onMouseDown:function(e){e.preventDefault()},onClick:function(){te(e),_(-1)},onMouseEnter:function(){_(t)},className:`w-full flex items-center gap-2 px-3 py-2 text-left text-[12px] font-mono transition-colors duration-[80ms] `+(t===g?`bg-base-content/10 text-base-content`:`text-base-content/60 hover:bg-base-content/5 hover:text-base-content`),children:[(0,b.jsx)(Wm,{size:12,className:`text-base-content/25 flex-shrink-0`}),(0,b.jsxs)(`span`,{className:`flex-1 truncate`,children:[e.name,`/`]}),e.projectName&&(0,b.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-md bg-accent/15 text-accent/70 flex-shrink-0 truncate max-w-[100px]`,children:e.projectName}),e.hasClaudeMd&&(0,b.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[10px] px-1.5 py-0.5 rounded-md bg-primary/15 text-primary/70 flex-shrink-0`,children:[(0,b.jsx)(Vm,{size:8}),`CLAUDE.md`]})]},e.path)})})]}),(0,b.jsx)(`div`,{className:`text-[10px] text-base-content/25 mt-1`,children:`Type a path or click directories to navigate`}),!o.trim()&&w.length>0&&!m&&(0,b.jsxs)(`div`,{className:`mt-2`,children:[(0,b.jsx)(`div`,{className:`text-[11px] font-semibold text-base-content/30 mb-1.5`,children:`Projects Claude has worked in`}),(0,b.jsx)(`div`,{className:`flex flex-col gap-1 max-h-48 overflow-y-auto`,children:w.map(function(e){return(0,b.jsxs)(`button`,{title:e.path,onClick:function(){s(e.path+`/`),f||d(e.name),T([]),n({type:`browse:list`,path:e.path})},className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-[12px] font-mono text-base-content/50 hover:bg-base-content/5 hover:text-base-content rounded-lg transition-colors duration-[80ms]`,children:[(0,b.jsx)(Wm,{size:12,className:`text-base-content/25 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.path}),e.hasClaudeMd&&(0,b.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[10px] px-1.5 py-0.5 rounded-md bg-primary/15 text-primary/70 flex-shrink-0`,children:[(0,b.jsx)(Vm,{size:8}),`CLAUDE.md`]})]},e.path)})})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`label`,{htmlFor:`project-title`,className:`block text-[12px] font-semibold text-base-content/40 mb-1.5`,children:[`Title `,(0,b.jsx)(`span`,{className:`font-normal opacity-60`,children:`(optional)`})]}),(0,b.jsx)(`input`,{id:`project-title`,type:`text`,value:u,onChange:function(e){P(e.target.value)},placeholder:`Auto-derived from path`,className:`w-full h-9 px-3 bg-base-300 border border-base-content/15 rounded-xl text-base-content text-[13px] focus:border-primary focus-visible:outline-none transition-colors duration-[120ms]`})]}),ue&&(0,b.jsx)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-xl border text-[11px] `+(ue.type===`error`?`bg-error/10 border-error/20 text-error`:ue.type===`success`?`bg-success/10 border-success/20 text-success`:`bg-base-content/5 border-base-content/10 text-base-content/40`),children:ue.text})]}),(0,b.jsxs)(`div`,{className:`px-5 py-3 border-t border-base-content/15 flex justify-end gap-2`,children:[(0,b.jsx)(`button`,{onClick:t,className:`btn btn-ghost btn-sm text-[12px]`,children:`Cancel`}),(0,b.jsx)(`button`,{onClick:ce,disabled:!se,className:`btn btn-primary btn-sm text-[12px]`+(se?``:` opacity-50 cursor-not-allowed`),children:S?(0,b.jsx)(gg,{size:14,className:`animate-spin`}):`Add Project`})]})]})]})}function HIe(){var{activeProject:e}=Gw(),{nodes:t}=Jw(),n=Yw();if(!e||!e.isRemote||n.activeView.type!==`chat`)return null;var r=t.find(function(t){return t.id===e.nodeId});return!r||r.online?null:(0,b.jsx)(`div`,{className:`absolute inset-0 z-40 flex items-center justify-center bg-base-100/80 backdrop-blur-sm`,children:(0,b.jsxs)(`div`,{className:`bg-base-300 border border-base-content/15 rounded-2xl shadow-2xl px-8 py-6 max-w-sm text-center`,children:[(0,b.jsx)(tw,{size:28,className:`text-warning mx-auto mb-3`}),(0,b.jsx)(`h3`,{className:`text-[15px] font-mono font-bold text-base-content mb-1`,children:`Node Disconnected`}),(0,b.jsxs)(`p`,{className:`text-[13px] text-base-content/50 mb-3`,children:[(0,b.jsx)(`span`,{className:`font-semibold text-base-content/70`,children:r.name}),` is unreachable.`]}),(0,b.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-[12px] text-base-content/40`,children:[(0,b.jsx)(gg,{size:12,className:`animate-spin`}),`Attempting to reconnect...`]}),(0,b.jsx)(`p`,{className:`text-[11px] text-base-content/25 mt-3`,children:`Session state preserved. Operations will resume on reconnect.`})]})})}var A9=15,j9=.35,UIe=.4,M9=`translate 0.25s cubic-bezier(0.4, 0, 0.2, 1)`,N9=`opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1)`,P9=`transform 0.25s cubic-bezier(0.4, 0, 0.2, 1)`;function WIe(e,t,n,r){var i=(0,x.useRef)({isOpen:t,onOpen:n,onClose:r});i.current={isOpen:t,onOpen:n,onClose:r},(0,x.useEffect)(function(){var t=0,n=0,r=0,a=0,o=0,s=!1,c=!1,l=null,u=null,d=null,f=null,p=0;function m(){var t=e.current;if(!t)return!1;u=t.querySelector(`:scope > *:not(.drawer-overlay)`),d=t.querySelector(`:scope > .drawer-overlay`);var n=t.parentElement;return n&&(f=n.querySelector(`:scope > .drawer-content`)),u&&(p=u.getBoundingClientRect().width),!!u}function h(e){if(u){var t=Math.max(-p,Math.min(0,e)),n=1+t/p;if(u.style.transition=`none`,u.style.translate=t+`px`,d&&(d.style.transition=`none`,d.style.opacity=String(n)),f){var r=1-n*.03;f.style.transition=`none`,f.style.transform=`scale(`+r+`)`,f.style.transformOrigin=`left center`}}}function g(){u&&(u.style.transition=``,u.style.translate=``),d&&(d.style.transition=``,d.style.opacity=``),f&&(f.style.transition=``,f.style.transform=``,f.style.transformOrigin=``)}function _(){u&&(u.style.transition=M9,u.style.translate=`0%`,d&&(d.style.transition=N9,d.style.opacity=`1`),f&&(f.style.transition=P9,f.style.transform=`scale(0.97)`,f.style.transformOrigin=`left center`))}function v(){u&&(u.style.transition=M9,u.style.translate=`-100%`,d&&(d.style.transition=N9,d.style.opacity=`0`),f&&(f.style.transition=P9,f.style.transform=`scale(1)`,f.style.transformOrigin=`left center`))}var y=null;function b(){y!==null&&(clearTimeout(y),y=null)}function x(){if(b(),u){var e=!1;function t(){e||(e=!0,u&&u.removeEventListener(`transitionend`,t),b(),g())}u.addEventListener(`transitionend`,t,{once:!0}),y=setTimeout(t,350)}else g()}function S(e){if(!(window.innerWidth>=1024)){var i=e.touches[0];t=i.clientX,n=i.clientY,r=i.clientX,a=Date.now(),o=0,s=!0,c=!1,l=null}}function C(u){if(s){var d=u.touches[0],f=Date.now(),g=f-a;if(g>0&&(o=(d.clientX-r)/g),r=d.clientX,a=f,l===null){var _=Math.abs(d.clientX-t),v=Math.abs(d.clientY-n);if(_>=A9||v>=A9)if(_>v){if(l=`h`,c=!0,!m()){s=!1;return}var y=e.current;y&&(y.style.visibility=`visible`,y.style.pointerEvents=`auto`,y.style.opacity=`1`)}else{l=`v`,s=!1;return}else return}if(c){var b=d.clientX-t;i.current.isOpen?h(Math.min(0,b)):h(-p+Math.max(0,b))}}}function w(){if(!s||!c){s=!1,l=null;return}var e=r-t,n=i.current.isOpen;s=!1,c=!1,l=null,(Math.abs(o)>UIe?o>0:n?e>-p*j9:e>p*j9)?(_(),n||i.current.onOpen()):(v(),n&&i.current.onClose()),x()}function T(){if(c){g();var t=e.current;t&&(t.style.visibility=``,t.style.pointerEvents=``,t.style.opacity=``),f&&(f.style.transition=``,f.style.transform=``,f.style.transformOrigin=``)}s=!1,c=!1,l=null}return document.addEventListener(`touchstart`,S,{passive:!0}),document.addEventListener(`touchmove`,C,{passive:!0}),document.addEventListener(`touchend`,w,{passive:!0}),document.addEventListener(`touchcancel`,T,{passive:!0}),function(){b(),document.removeEventListener(`touchstart`,S),document.removeEventListener(`touchmove`,C),document.removeEventListener(`touchend`,w),document.removeEventListener(`touchcancel`,T)}},[e])}function F9(){var e=z(),[t,n]=(0,x.useState)(!1),[r,i]=(0,x.useState)(!1),[a,o]=(0,x.useState)(!1),s=(0,x.useRef)(null),c=(0,x.useRef)(0);(0,x.useEffect)(function(){var e=setTimeout(function(){i(!0)},600);return function(){clearTimeout(e)}},[]),(0,x.useEffect)(function(){if(e.status!==`connected`)return;function t(){n(!0)}return e.subscribe(`projects:list`,t),function(){e.unsubscribe(`projects:list`,t)}},[e]);var l=t&&r,u=a&&e.status!==`connected`,d=l&&!u,f=!l||u;if((0,x.useEffect)(function(){if(l&&!a){var e=setTimeout(function(){o(!0)},300);return function(){clearTimeout(e)}}},[l,a]),(0,x.useEffect)(function(){var e=s.current;if(!e)return;var t=e.getContext(`2d`);if(!t)return;var n=9,r=26,i=3.5,a=20,o=a*2+(n-1)*r,l=window.devicePixelRatio||1;e.width=o*l,e.height=o*l,e.style.width=o+`px`,e.style.height=o+`px`,t.scale(l,l);for(var u=o/2,d=o/2,f=14,p=4,m=(f*2+p)/2,h=u-m,g=d-m,_=u+m,v=d+m,y=getComputedStyle(document.documentElement).getPropertyValue(`--color-primary`).trim(),b=y?`oklch(`+y+`)`:`oklch(55% 0.25 280)`,x=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,S=[],C=0;C<n;C++)for(var w=0;w<n;w++){var T=a+w*r,E=a+C*r,D=T+i>h&&T-i<_&&E+i>g&&E-i<v;S.push({x:T,y:E,col:w,row:C,hidden:D,brightness:.08})}var O=[],k=10,A=performance.now();function j(e){for(var t=S[e],r=[],i=-1;i<=1;i++)for(var a=-1;a<=1;a++)if(!(i===0&&a===0)){var o=t.row+i,s=t.col+a;if(o>=0&&o<n&&s>=0&&s<n){var c=o*n+s;S[c].hidden||r.push(c)}}return r}function M(){t.clearRect(0,0,o,o);for(var e=0;e<S.length;e++){var n=S[e];n.hidden||(t.beginPath(),t.arc(n.x,n.y,i,0,Math.PI*2),t.fillStyle=b,t.globalAlpha=.15,t.fill(),t.globalAlpha=1)}for(var r=[[h,g],[h+f+p,g],[h,g+f+p],[h+f+p,g+f+p]],a=0;a<r.length;a++)t.fillStyle=b,t.globalAlpha=.9,t.fillRect(r[a][0],r[a][1],f,f),t.globalAlpha=1}if(x){M();return}function N(){if(A=performance.now(),t.clearRect(0,0,o,o),O.length<k&&Math.random()<.04){for(var e=[],n=0;n<S.length;n++)S[n].hidden||e.push(n);for(var r=0;r<5&&O.length<k;){var a=e[Math.floor(Math.random()*e.length)],s=j(a);if(s.length>0){for(var l=s[Math.floor(Math.random()*s.length)],u=!1,d=0;d<O.length;d++)if(O[d].a===a&&O[d].b===l||O[d].a===l&&O[d].b===a){u=!0;break}if(!u){O.push({a,b:l,birth:A,duration:2e3+Math.random()*3e3,fadeIn:400,fadeOut:400});break}}r++}}for(var m=new Set,_=[],v=0;v<O.length;v++){var y=O[v],x=A-y.birth;if(!(x>y.duration)){_.push(y);var C=1;x<y.fadeIn?C=x/y.fadeIn:x>y.duration-y.fadeOut&&(C=(y.duration-x)/y.fadeOut),m.add(y.a),m.add(y.b);var w=S[y.a],T=S[y.b];t.beginPath(),t.moveTo(w.x,w.y),t.lineTo(T.x,T.y),t.strokeStyle=b,t.globalAlpha=C*.35,t.lineWidth=1.5,t.stroke(),t.globalAlpha=1}}O=_;for(var E=0;E<S.length;E++){var D=S[E];if(!D.hidden){var M=m.has(E)?.7:.08;D.brightness+=(M-D.brightness)*.08,t.beginPath(),t.arc(D.x,D.y,i,0,Math.PI*2),t.fillStyle=b,t.globalAlpha=D.brightness,t.fill(),t.globalAlpha=1}}for(var ee=.4+.2*Math.sin(A/800),te=[[h,g],[h+f+p,g],[h,g+f+p],[h+f+p,g+f+p]],P=0;P<te.length;P++){var F=te[P][0],ne=te[P][1];t.save(),t.shadowColor=b,t.shadowBlur=8+ee*6,t.fillStyle=b,t.globalAlpha=.85+ee*.15,t.fillRect(F,ne,f,f),t.restore()}c.current=requestAnimationFrame(N)}return c.current=requestAnimationFrame(N),function(){cancelAnimationFrame(c.current)}},[]),!f&&l)return null;var p=u?`Reconnecting...`:e.status===`connecting`?`Connecting...`:`Loading projects...`;return(0,b.jsx)(`div`,{className:`fixed inset-0 z-[9999] flex flex-col items-center justify-center `+(u?`bg-base-100/90`:`bg-base-100`),style:{opacity:d?0:1,transition:`opacity 300ms ease-out`,pointerEvents:d?`none`:`auto`},children:(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-7`,children:[(0,b.jsx)(`canvas`,{ref:s}),(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-[16px] font-mono font-bold text-base-content tracking-tight`,children:`Lattice`}),(0,b.jsx)(`span`,{className:`text-[12px] text-base-content/40`,children:p})]})]})})}function GIe(){var e=Yw(),t=z(),n=e.confirmRemoveSlug,r=(0,x.useRef)(null);return Ur(r,(0,x.useCallback)(function(){e.closeConfirmRemove()},[e.closeConfirmRemove]),!!n),n?((function(){try{return Iw().state}catch{return null}})(),(0,b.jsxs)(`div`,{ref:r,className:`fixed inset-0 z-[9999] flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"aria-label":`Remove Project`,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-base-content/50`,onClick:e.closeConfirmRemove}),(0,b.jsxs)(`div`,{className:`relative bg-base-200 border border-base-content/15 rounded-2xl shadow-2xl w-full max-w-sm mx-4 overflow-hidden`,children:[(0,b.jsx)(`div`,{className:`px-5 py-4 border-b border-base-content/15`,children:(0,b.jsx)(`h2`,{className:`text-[15px] font-mono font-bold text-base-content`,children:`Remove Project`})}),(0,b.jsx)(`div`,{className:`px-5 py-4`,children:(0,b.jsxs)(`p`,{className:`text-[13px] text-base-content/60`,children:[`Remove `,(0,b.jsx)(`span`,{className:`font-semibold text-base-content`,children:n}),` from Lattice? This won't delete any files on disk.`]})}),(0,b.jsxs)(`div`,{className:`px-5 py-3 border-t border-base-content/15 flex justify-end gap-2`,children:[(0,b.jsx)(`button`,{onClick:e.closeConfirmRemove,className:`btn btn-ghost btn-sm text-[12px]`,children:`Cancel`}),(0,b.jsx)(`button`,{onClick:function(){t.send({type:`settings:update`,settings:{removeProject:n}}),e.activeProjectSlug===n&&e.goToDashboard(),e.closeConfirmRemove()},className:`btn btn-error btn-sm text-[12px]`,children:`Remove`})]})]})]})):null}function KIe(){var[e,t]=(0,x.useState)(null),n=z();(0,x.useEffect)(function(){function e(e){e.type===`settings:data`&&t(e.config?.setupComplete===!0)}return n.subscribe(`settings:data`,e),n.status===`connected`&&n.send({type:`settings:get`}),function(){n.unsubscribe(`settings:data`,e)}},[n.status]);var r=Yw(),i=(0,x.useRef)(null);return WIe(i,r.drawerOpen,Uw,Ww),(0,x.useEffect)(function(){function e(e){e.key===`Escape`&&Iw().state.sidebarMode===`settings`&&Vw()}return document.addEventListener(`keydown`,e),window.addEventListener(`popstate`,Hw),function(){document.removeEventListener(`keydown`,e),window.removeEventListener(`popstate`,Hw)}},[]),e===null?(0,b.jsx)(F9,{}):e?(0,b.jsxs)(`div`,{className:`flex w-full h-full overflow-hidden bg-base-100`,children:[(0,b.jsx)(`a`,{href:`#main-content`,className:`sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[99999] focus:px-4 focus:py-2 focus:bg-primary focus:text-primary-content focus:rounded-lg focus:text-sm focus:font-semibold`,children:`Skip to content`}),(0,b.jsx)(F9,{}),(0,b.jsxs)(`div`,{className:`drawer lg:drawer-open h-full w-full`,children:[(0,b.jsx)(`input`,{id:`sidebar-drawer`,type:`checkbox`,className:`drawer-toggle`,checked:r.drawerOpen,readOnly:!0}),(0,b.jsxs)(`main`,{id:`main-content`,className:`drawer-content flex flex-col h-full min-w-0 overflow-hidden relative`,children:[(0,b.jsx)(Nr,{}),(0,b.jsx)(HIe,{})]}),(0,b.jsxs)(`div`,{ref:i,className:`drawer-side z-50 h-full`,children:[(0,b.jsx)(`label`,{htmlFor:`sidebar-drawer`,"aria-label":`close sidebar`,className:`drawer-overlay`,onClick:Ww}),(0,b.jsx)(`nav`,{"aria-label":`Sidebar navigation`,className:`h-full w-full lg:w-[284px] flex flex-col overflow-hidden`,children:(0,b.jsx)(Tpe,{onSessionSelect:Ww})})]})]}),(0,b.jsx)(BIe,{isOpen:r.nodeSettingsOpen,onClose:r.closeNodeSettings}),(0,b.jsx)(VIe,{isOpen:r.addProjectOpen,onClose:r.closeAddProject}),(0,b.jsx)(GIe,{})]}):(0,b.jsx)(uFe,{onComplete:function(){t(!0)}})}var qIe=class extends x.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[lattice] View error in `+this.props.viewName+`:`,e,t.componentStack)}render(){if(this.state.hasError){var e=this;return(0,b.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full bg-base-100 bg-lattice-grid gap-4 p-8`,children:[(0,b.jsx)(ZC,{size:32,className:`text-warning/50`}),(0,b.jsxs)(`div`,{className:`text-center max-w-[500px]`,children:[(0,b.jsxs)(`p`,{className:`text-[14px] font-mono text-base-content/60 mb-1`,children:[`Error in `,this.props.viewName]}),(0,b.jsx)(`p`,{className:`text-[12px] text-base-content/30 mb-4 font-mono break-all`,children:this.state.error?.message||`Unknown error`}),(0,b.jsxs)(`button`,{onClick:function(){e.setState({hasError:!1,error:null})},className:`btn btn-ghost btn-sm text-[12px] gap-1.5`,children:[(0,b.jsx)(eS,{size:12}),`Retry`]})]})]})}return this.props.children}};function I9(){var e=Yw(),t=YT(),n=e.activeView.type,r=t.panes.find(function(e){return e.id===t.activePaneId}),i=r?t.tabs.find(function(e){return e.id===r.activeTabId}):null;i&&i.id;var a=n===`settings`?(0,b.jsx)(mIe,{}):n===`project-settings`?(0,b.jsx)(IIe,{}):n===`dashboard`?(0,b.jsx)(RIe,{}):n===`project-dashboard`?(0,b.jsx)(zIe,{}):n===`analytics`?(0,b.jsx)(k7,{}):(0,b.jsx)(sFe,{});return(0,b.jsx)(qIe,{viewName:n,children:a})}var L9=wr({component:KIe}),R9=Sr({getParentRoute:function(){return L9},path:`/`,component:I9}),JIe=Sr({getParentRoute:function(){return L9},path:`/$projectSlug`,component:I9}),YIe=Sr({getParentRoute:function(){return L9},path:`/settings/$section`,component:I9}),XIe=Sr({getParentRoute:function(){return L9},path:`/settings`,component:I9}),ZIe=Sr({getParentRoute:function(){return L9},path:`/$projectSlug/settings/$section`,component:I9}),QIe=Sr({getParentRoute:function(){return L9},path:`/$projectSlug/settings`,component:I9}),$Ie=Rr({routeTree:L9.addChildren([R9,XIe,YIe,QIe,ZIe,JIe])}),eLe=3e4,tLe=100;function nLe(e){var[t,n]=(0,x.useState)(`connecting`),r=(0,x.useRef)(null),i=(0,x.useRef)(1e3),a=(0,x.useRef)(null),o=(0,x.useRef)(!1),s=(0,x.useRef)(new Map),c=(0,x.useRef)(!1),l=(0,x.useRef)([]);function u(){if(!o.current){var e=xde(),t=new WebSocket(e);r.current=t,n(`connecting`),t.onopen=function(){if(o.current){t.close();return}if(n(`connected`),i.current=1e3,c.current){t9(`Reconnected to daemon`,`info`),x9(`Lattice`,`Reconnected to daemon`,`connection`),t.send(JSON.stringify({type:`settings:get`}));var e=oT().state;e.activeProjectSlug&&e.activeSessionId&&t.send(JSON.stringify({type:`session:activate`,projectSlug:e.activeProjectSlug,sessionId:e.activeSessionId}))}c.current=!0,t.send(JSON.stringify({type:`brainstorm:status_request`}));var r=l.current;l.current=[],r.forEach(function(e){t.send(JSON.stringify(e))})},t.onmessage=function(e){try{var t=JSON.parse(e.data);t.type===`chat:done`&&document.hidden&&x9(`Claude responded`,oT().state.activeSessionTitle||`Session`,`chat-done`),t.type===`mesh:node_online`&&x9(`Lattice`,t.nodeId+` came online`,`mesh`),t.type===`mesh:node_offline`&&x9(`Lattice`,t.nodeId+` went offline`,`mesh`);var n=s.current.get(t.type);n&&n.forEach(function(e){e(t)})}catch(e){console.warn(`[lattice] Failed to parse WebSocket message:`,e)}},t.onclose=function(){o.current||(n(`disconnected`),r.current=null,c.current&&(t9(`Disconnected from daemon. Reconnecting automatically...`,`warning`),x9(`Lattice`,`Lost connection to daemon`,`connection`)),d())},t.onerror=function(){t.close()}}}function d(){if(!o.current){var e=i.current;a.current=setTimeout(function(){i.current=Math.min(i.current*2,eLe),u()},e)}}function f(){a.current!==null&&(clearTimeout(a.current),a.current=null),i.current=1e3,r.current&&=(r.current.close(),null),u()}function p(e){var t=r.current;t&&t.readyState===WebSocket.OPEN?t.send(JSON.stringify(e)):(l.current.length>=tLe&&l.current.shift(),l.current.push(e))}function m(e,t){var n=s.current.get(e);n||(n=new Set,s.current.set(e,n)),n.add(t)}function h(e,t){var n=s.current.get(e);n&&(n.delete(t),n.size===0&&s.current.delete(e))}return(0,x.useEffect)(function(){function e(){hw(`brainstorm`)}function t(e){e.type===`brainstorm:status`&&e.active&&hw(`brainstorm`)}return m(`brainstorm:content`,e),m(`brainstorm:status`,t),function(){h(`brainstorm:content`,e),h(`brainstorm:status`,t)}},[]),(0,x.useEffect)(function(){return o.current=!1,u(),function(){o.current=!0,a.current!==null&&(clearTimeout(a.current),a.current=null),r.current&&=(r.current.close(),null)}},[]),(0,b.jsx)(cw.Provider,{value:{status:t,send:p,subscribe:m,unsubscribe:h,reconnectNow:f},children:e.children})}var rLe=class extends x.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[lattice] Render error:`,e,t.componentStack)}handleReload(){window.location.reload()}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,b.jsx)(`div`,{className:`min-h-screen bg-base-100 flex items-center justify-center`,children:(0,b.jsxs)(`div`,{className:`text-center max-w-[400px] p-8`,children:[(0,b.jsx)(`h2`,{className:`text-[20px] font-semibold text-error mb-3`,children:`Something went wrong`}),(0,b.jsx)(`p`,{className:`text-[14px] text-base-content/60 mb-5`,children:this.state.error?.message||`An unexpected error occurred.`}),(0,b.jsx)(`button`,{onClick:this.handleReload,className:`btn btn-primary btn-sm`,children:`Reload`})]})}):this.props.children}},iLe=(0,x.createContext)(null);function aLe(){return(0,x.useContext)(iLe)?.defaultOptions??{}}function z9(){if(typeof navigator>`u`)return`linux`;let e=navigator.platform?.toLowerCase()??``,t=navigator.userAgent?.toLowerCase()??``;return e.includes(`mac`)||t.includes(`mac`)?`mac`:e.includes(`win`)||t.includes(`win`)?`windows`:`linux`}var B9=[`Control`,`Alt`,`Shift`,`Meta`];new Set(B9);var V9={Control:`Control`,Ctrl:`Control`,control:`Control`,ctrl:`Control`,Shift:`Shift`,shift:`Shift`,Alt:`Alt`,Option:`Alt`,alt:`Alt`,option:`Alt`,Command:`Meta`,Cmd:`Meta`,Meta:`Meta`,command:`Meta`,cmd:`Meta`,meta:`Meta`,CommandOrControl:`Mod`,Mod:`Mod`,commandorcontrol:`Mod`,mod:`Mod`};function H9(e,t=z9()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var oLe=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),sLe=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),cLe=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),lLe=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),uLe=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),dLe=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),U9={Minus:`-`,Equal:`=`,Slash:`/`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Comma:`,`,Period:`.`,Backquote:"`",Semicolon:`;`};new Set([...oLe,...sLe,...cLe,...lLe,...uLe,...dLe]);var W9={Esc:`Escape`,esc:`Escape`,escape:`Escape`,Return:`Enter`,return:`Enter`,enter:`Enter`," ":`Space`,space:`Space`,Spacebar:`Space`,spacebar:`Space`,tab:`Tab`,backspace:`Backspace`,Del:`Delete`,del:`Delete`,delete:`Delete`,Up:`ArrowUp`,up:`ArrowUp`,arrowup:`ArrowUp`,Down:`ArrowDown`,down:`ArrowDown`,arrowdown:`ArrowDown`,Left:`ArrowLeft`,left:`ArrowLeft`,arrowleft:`ArrowLeft`,Right:`ArrowRight`,right:`ArrowRight`,arrowright:`ArrowRight`,home:`Home`,end:`End`,pageup:`PageUp`,pagedown:`PageDown`,PgUp:`PageUp`,PgDn:`PageDown`,pgup:`PageUp`,pgdn:`PageDown`};function G9(e){return/^\p{Letter}$/u.test(e)}function K9(e){if(e in W9)return W9[e];if(G9(e)){let t=e.toUpperCase();return t.length===1?t:e}let t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}function q9(e,t=z9()){let n=e.split(`+`),r=new Set,i=``;for(let e=0;e<n.length;e++){let a=n[e].trim();if(e===n.length-1)i=K9(a);else{let e=V9[a]??V9[a.toLowerCase()];if(e){let n=H9(e,t);r.add(n)}else n.length===1&&(i=K9(a))}}return!i&&n.length>0&&(i=K9(n[n.length-1].trim())),{key:i,ctrl:r.has(`Control`),shift:r.has(`Shift`),alt:r.has(`Alt`),meta:r.has(`Meta`),modifiers:B9.filter(e=>r.has(e))}}function J9(e,t=z9()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(H9(`Mod`,t)===`Control`?n=!0:a=!0);let o=B9.filter(e=>{switch(e){case`Control`:return n;case`Shift`:return r;case`Alt`:return i;case`Meta`:return a;default:return!1}});return{key:e.key,ctrl:n,shift:r,alt:i,meta:a,modifiers:o}}function Y9(e){let t=[];for(let n of B9)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join(`+`)}function X9(e,t,n=z9()){let r=typeof t==`string`?q9(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=K9(e.key),a=r.key;if(i!==`Dead`&&i.length===1&&a.length===1){if(i.toUpperCase()===a.toUpperCase())return!0;if(G9(i)&&(/^[A-Za-z]$/.test(i)||!e.altKey))return!1}if(e.code&&(i===`Dead`||i.length===1&&a.length===1)){if(e.code.startsWith(`Key`)){let t=e.code.slice(3);if(t.length===1&&/^[A-Za-z]$/.test(t))return t.toUpperCase()===a.toUpperCase()}if(e.code.startsWith(`Digit`)){let t=e.code.slice(5);if(t.length===1&&/^[0-9]$/.test(t))return t===a}return e.code in U9?U9[e.code]===a:!1}return i===a}var fLe={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function pLe(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function mLe(e){if(!e)return!1;if(e instanceof HTMLInputElement){let t=e.type.toLowerCase();return!(t===`button`||t===`submit`||t===`reset`)}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function hLe(e,t){return t===document||t===window?e.currentTarget===t||e.currentTarget===document.documentElement:t===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(t instanceof HTMLElement&&(e.currentTarget===t||e.target instanceof Node&&t.contains(e.target)))}function gLe(e,t,n,r){if(n!==`allow`){if(n===`warn`){console.warn(`'${t}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);return}if(n===`error`)throw Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}var _Le=0;function Z9(){return`hotkey_${++_Le}`}var vLe=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new Wn(new Map),this.#t=z9()}static getInstance(){return e.#e||=new e,e.#e}static resetInstance(){e.#e&&=(e.#e.destroy(),null)}register(e,t,n={}){if(typeof document>`u`&&!n.target){let e=t;return{id:Z9(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=Z9(),i=n.platform??this.#t,a=typeof e==`string`?q9(e,i):J9(e,i),o=typeof e==`string`?e:Y9(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&gLe(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??pLe(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...fLe,requireReset:!1,...n,platform:i,ignoreInputs:u},hasFired:!1,triggerCount:0,target:s};this.registrations.setState(e=>new Map(e).set(r,d)),this.#r.has(s)||this.#r.set(s,new Set),this.#r.get(s).add(r),this.#a(s);let f=this;return{get id(){return r},unregister:()=>{f.#i(r)},get callback(){return f.registrations.state.get(r)?.callback??t},set callback(e){let t=f.registrations.state.get(r);t&&(t.callback=e)},setOptions:e=>{f.registrations.setState(t=>{let n=t.get(r);if(n){let i=new Map(t);return i.set(r,{...n,options:{...n.options,...e}}),i}return t})},get isActive(){return f.registrations.state.has(r)}}}#i(e){let t=this.registrations.state.get(e);if(!t)return;let n=t.target;this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n});let r=this.#r.get(n);r&&(r.delete(e),r.size===0&&this.#o(n))}#a(e){if(typeof document>`u`||this.#n.has(e))return;let t=this.#l(e),n=this.#u(e);e.addEventListener(`keydown`,t),e.addEventListener(`keyup`,n),this.#n.set(e,{keydown:t,keyup:n})}#o(e){if(typeof document>`u`)return;let t=this.#n.get(e);t&&(e.removeEventListener(`keydown`,t.keydown),e.removeEventListener(`keyup`,t.keyup),this.#n.delete(e),this.#r.delete(e))}#s(e,t,n){let r=this.#r.get(t);if(r)for(let i of r){let r=this.registrations.state.get(i);if(r&&hLe(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&mLe(e.target)&&e.target!==r.target))if(n===`keydown`){if(r.options.eventType!==`keydown`)continue;X9(e,r.parsedHotkey,r.options.platform)&&(r.options.preventDefault&&e.preventDefault(),r.options.stopPropagation&&e.stopPropagation(),(!r.options.requireReset||!r.hasFired)&&(this.#c(r,e),r.options.requireReset&&(r.hasFired=!0)))}else r.options.eventType===`keyup`&&X9(e,r.parsedHotkey,r.options.platform)&&this.#c(r,e),r.options.requireReset&&r.hasFired&&this.#f(r,e)&&(r.hasFired=!1)}}#c(e,t){e.options.preventDefault&&t.preventDefault(),e.options.stopPropagation&&t.stopPropagation(),e.triggerCount++,this.registrations.setState(e=>new Map(e));let n={hotkey:e.hotkey,parsedHotkey:e.parsedHotkey};e.callback(t,n)}#l(e){return t=>{this.#s(t,e,`keydown`)}}#u(e){return t=>{this.#s(t,e,`keyup`)}}#d(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&n.target===t)return n;return null}#f(e,t){let n=e.parsedHotkey,r=K9(t.key),i=n.key.length===1?n.key.toUpperCase():n.key;return!!((r.length===1?r.toUpperCase():r)===i||n.ctrl&&r===`Control`||n.shift&&r===`Shift`||n.alt&&r===`Alt`||n.meta&&r===`Meta`)}triggerRegistration(e){let t=this.registrations.state.get(e);if(!t)return!1;let n=t.parsedHotkey,r=new KeyboardEvent(t.options.eventType??`keydown`,{key:n.key,ctrlKey:n.ctrl,shiftKey:n.shift,altKey:n.alt,metaKey:n.meta,bubbles:!0,cancelable:!0});return t.triggerCount++,this.registrations.setState(e=>new Map(e)),t.callback(r,{hotkey:t.hotkey,parsedHotkey:t.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&(t===void 0||n.target===t))return!0;return!1}destroy(){for(let e of this.#n.keys())this.#o(e);this.registrations.setState(()=>new Map),this.#n.clear(),this.#r.clear()}};function yLe(){return vLe.getInstance()}function Q9(e,t,n={}){let r={...aLe().hotkey,...n},i=yLe(),a=(0,x.useRef)(null),o=(0,x.useRef)(t),s=(0,x.useRef)(r),c=(0,x.useRef)(i);o.current=t,s.current=r,c.current=i;let l=(0,x.useRef)(null),u=(0,x.useRef)(null),d=r.platform??z9(),f=typeof e==`string`?e:Y9(J9(e,d)),{target:p,...m}=r;(0,x.useEffect)(()=>{let e=bLe(s.current.target)?s.current.target.current:s.current.target??(typeof document<`u`?document:null);if(!e)return;let t=l.current!==null&&l.current!==e,n=u.current!==null&&u.current!==f;return a.current?.isActive&&(t||n)&&(a.current.unregister(),a.current=null),(!a.current||!a.current.isActive)&&(a.current=c.current.register(f,o.current,{...s.current,target:e})),l.current=e,u.current=f,()=>{a.current?.isActive&&(a.current.unregister(),a.current=null)}},[f,n.enabled]),a.current?.isActive&&(a.current.callback=t,a.current.setOptions(m))}function bLe(e){return typeof e==`object`&&!!e&&`current`in e}function xLe(){var[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(``),[i,a]=(0,x.useState)(0),o=(0,x.useRef)(null),s=(0,x.useRef)(null),{projects:c,setActiveProject:l}=Gw(),u=aN(),{mode:d,toggleMode:f,allThemes:p,setTheme:m,currentThemeId:h}=RT(),g=z(),_=Yw(),v=(0,x.useCallback)(function(){t(!1),r(``),a(0)},[]);Q9(`Mod+K`,function(e){e.preventDefault(),t(function(e){return e&&(r(``),a(0)),!e})}),Q9(`Escape`,function(e){e.preventDefault(),v()},{enabled:e}),(0,x.useEffect)(function(){e&&o.current&&o.current.focus()},[e]);var y=(0,x.useMemo)(function(){var e=[];e.push({id:`nav:dashboard`,label:`Go to Dashboard`,group:`Navigation`,icon:(0,b.jsx)(ab,{size:14}),action:function(){_.goToDashboard(),v()},keywords:`home overview`}),c.forEach(function(t){e.push({id:`project:`+t.slug,label:t.title||t.slug,description:t.path,group:`Projects`,icon:(0,b.jsx)(Wm,{size:14}),action:function(){l(t),v()},keywords:`switch project `+t.slug})});var t=oT().state;t.activeProjectSlug&&e.push({id:`session:new`,label:`New Session`,group:`Session`,icon:(0,b.jsx)(W_,{size:14}),action:function(){g.send({type:`session:create`,projectSlug:t.activeProjectSlug}),v()},keywords:`create chat conversation`}),[{id:`appearance`,label:`Appearance`,keywords:`theme visual colors`},{id:`claude`,label:`Claude Settings`,keywords:`api model key`},{id:`environment`,label:`Environment`,keywords:`env variables config`},{id:`mcp`,label:`MCP Servers`,keywords:`model context protocol`},{id:`skills`,label:`Skills`,keywords:`capabilities commands`},{id:`nodes`,label:`Mesh Nodes`,keywords:`machines network`}].forEach(function(t){e.push({id:`settings:`+t.id,label:t.label,group:`Settings`,icon:(0,b.jsx)(TC,{size:14}),action:function(){_.openSettings(t.id),v()},keywords:t.keywords})}),e.push({id:`theme:toggle`,label:d===`dark`?`Switch to Light Mode`:`Switch to Dark Mode`,group:`Theme`,icon:d===`dark`?(0,b.jsx)(qC,{size:14}):(0,b.jsx)(Sv,{size:14}),action:function(){f(),v()},keywords:`dark light mode toggle`});var n=d===`dark`?`dark`:`light`;return p.filter(function(e){return e.theme.variant===n}).forEach(function(t){t.id!==h&&e.push({id:`theme:`+t.id,label:t.theme.name,group:`Theme`,icon:d===`dark`?(0,b.jsx)(Sv,{size:14}):(0,b.jsx)(qC,{size:14}),action:function(){m(t.id),v()},keywords:`color scheme `+t.theme.name})}),u.forEach(function(t){e.push({id:`skill:`+t.name,label:`/`+t.name,description:t.description,group:`Skills`,icon:(0,b.jsx)(aw,{size:14}),action:function(){var e=document.querySelector(`textarea[aria-label='Message input']`);e&&(e.value=`/`+t.name+` `,e.focus(),e.dispatchEvent(new Event(`input`,{bubbles:!0}))),v()},keywords:t.description})}),e.push({id:`system:restart`,label:`Restart Daemon`,group:`System`,icon:(0,b.jsx)(bS,{size:14}),action:function(){g.send({type:`settings:restart`}),v()},keywords:`reboot server`}),e},[c,u,d,p,h,_,g,v,l,f,m]),S=(0,x.useMemo)(function(){if(!n.trim())return y;var e=n.toLowerCase();return y.filter(function(t){for(var n=(t.label+` `+(t.description||``)+` `+(t.keywords||``)+` `+t.group).toLowerCase(),r=e.split(/\s+/),i=0;i<r.length;i++)if(!n.includes(r[i]))return!1;return!0})},[n,y]);(0,x.useEffect)(function(){a(0)},[S.length,n]),(0,x.useEffect)(function(){if(s.current){var e=s.current.querySelector(`[data-active='true']`);e&&e.scrollIntoView({block:`nearest`})}},[i]);function C(e){e.key===`ArrowDown`?(e.preventDefault(),a(function(e){return e<S.length-1?e+1:0})):e.key===`ArrowUp`?(e.preventDefault(),a(function(e){return e>0?e-1:S.length-1})):e.key===`Enter`&&(e.preventDefault(),S[i]&&S[i].action())}var w=(0,x.useMemo)(function(){var e=[],t=new Map,n=0;return S.forEach(function(r){var i=t.get(r.group);i||(i=[],t.set(r.group,i),e.push({name:r.group,items:i})),i.push(Object.assign({},r,{globalIndex:n})),n++}),e},[S]);return e?(0,b.jsxs)(`div`,{className:`fixed inset-0 z-[9998] flex items-start justify-center pt-[15vh]`,onClick:v,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-base-content/50`}),(0,b.jsxs)(`div`,{className:`relative w-full max-w-[520px] mx-4 bg-base-200 border border-base-content/10 rounded-xl shadow-2xl overflow-hidden`,onClick:function(e){e.stopPropagation()},children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 border-b border-base-content/10`,children:[(0,b.jsx)(pC,{size:16,className:`text-base-content/30 flex-shrink-0`}),(0,b.jsx)(`input`,{ref:o,type:`text`,value:n,onChange:function(e){r(e.target.value)},onKeyDown:C,placeholder:`Type a command...`,className:`flex-1 bg-transparent text-[14px] text-base-content outline-none placeholder:text-base-content/30`}),(0,b.jsx)(`kbd`,{className:`text-[10px] font-mono text-base-content/20 bg-base-300 px-1.5 py-0.5 rounded`,children:`ESC`})]}),(0,b.jsxs)(`div`,{ref:s,className:`max-h-[360px] overflow-y-auto py-1.5`,children:[w.length===0&&(0,b.jsx)(`div`,{className:`px-4 py-8 text-center text-[13px] text-base-content/30`,children:`No commands found`}),w.map(function(e){return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`px-4 pt-2 pb-1`,children:(0,b.jsx)(`span`,{className:`text-[9px] uppercase tracking-widest text-base-content/30 font-mono font-bold`,children:e.name})}),e.items.map(function(e){var t=e.globalIndex===i;return(0,b.jsxs)(`button`,{"data-active":t,onMouseEnter:function(){a(e.globalIndex)},onMouseDown:function(e){e.preventDefault()},onClick:function(){e.action()},className:`flex w-full items-center gap-3 px-4 py-2 text-left transition-colors `+(t?`bg-primary/10`:`hover:bg-base-content/5`),children:[(0,b.jsx)(`div`,{className:`flex-shrink-0 `+(t?`text-primary`:`text-base-content/30`),children:e.icon}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsx)(`div`,{className:`text-[13px] truncate `+(t?`text-base-content`:`text-base-content/70`),children:e.label}),e.description&&(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/30 truncate`,children:e.description})]})]},e.id)})]},e.name)})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2 border-t border-base-content/10 text-[10px] text-base-content/25 font-mono`,children:[(0,b.jsx)(`span`,{children:`↑↓ navigate`}),(0,b.jsx)(`span`,{children:`↵ select`}),(0,b.jsx)(`span`,{children:`esc close`})]})]})]}):null}var SLe=[{name:`Chat`,shortcuts:[{keys:[`Enter`],description:`Send message`},{keys:[`Shift`,`Enter`],description:`New line`},{keys:[`↑`],description:`Previous input history`},{keys:[`↓`],description:`Next input history`},{keys:[`/`],description:`Slash commands`},{keys:[`Escape`],description:`Close autocomplete`}]},{name:`Navigation`,shortcuts:[{keys:[typeof navigator<`u`&&navigator.platform.indexOf(`Mac`)!==-1?`⌘`:`Ctrl`,`K`],description:`Command palette`},{keys:[`?`],description:`Keyboard shortcuts`},{keys:[`Escape`],description:`Close modal / exit settings`}]},{name:`Session`,shortcuts:[{keys:[`/clear`],description:`New session`},{keys:[`/copy`],description:`Copy last response`},{keys:[`/export`],description:`Export conversation`},{keys:[`/rename`],description:`Rename session`}]}];function $9(e){return(0,b.jsx)(`kbd`,{className:`bg-base-300 border border-base-content/20 rounded px-1.5 py-0.5 text-[11px] font-mono text-base-content/70 leading-none inline-flex items-center justify-center min-w-[22px]`,children:e.children})}function CLe(){var[e,t]=(0,x.useState)(!1);return(0,x.useEffect)(function(){function n(n){if(n.key===`?`&&!n.ctrlKey&&!n.metaKey&&!n.altKey){var r=n.target.tagName;if(r===`INPUT`||r===`TEXTAREA`||n.target.isContentEditable)return;n.preventDefault(),t(!0)}n.key===`Escape`&&e&&t(!1)}return document.addEventListener(`keydown`,n),function(){document.removeEventListener(`keydown`,n)}},[e]),e?(0,b.jsxs)(`div`,{className:`fixed inset-0 z-[9998] flex items-center justify-center`,onClick:function(){t(!1)},children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-base-content/50`}),(0,b.jsxs)(`div`,{className:`relative w-full max-w-[540px] mx-4 bg-base-200 border border-base-content/15 rounded-2xl shadow-xl overflow-hidden`,onClick:function(e){e.stopPropagation()},children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3.5 border-b border-base-content/10`,children:[(0,b.jsx)(`h2`,{className:`text-[14px] font-mono font-bold text-base-content tracking-tight`,children:`Keyboard Shortcuts`}),(0,b.jsx)(`button`,{onClick:function(){t(!1)},className:`w-6 h-6 rounded flex items-center justify-center text-base-content/30 hover:text-base-content/60 transition-colors`,children:(0,b.jsx)(iw,{size:14})})]}),(0,b.jsx)(`div`,{className:`px-5 py-4 max-h-[70vh] overflow-y-auto`,children:(0,b.jsx)(`div`,{className:`flex flex-col gap-5`,children:SLe.map(function(e){return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-[9px] uppercase tracking-widest text-base-content/30 font-mono font-bold mb-2`,children:e.name}),(0,b.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.shortcuts.map(function(e,t){return(0,b.jsxs)(`div`,{className:`flex items-center justify-between py-1.5 px-2 rounded hover:bg-base-content/5 transition-colors`,children:[(0,b.jsx)(`span`,{className:`text-[13px] text-base-content/60`,children:e.description}),(0,b.jsx)(`div`,{className:`flex items-center gap-1 flex-shrink-0 ml-4`,children:e.keys.map(function(e,t){return(0,b.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t>0&&(0,b.jsx)(`span`,{className:`text-[10px] text-base-content/20`,children:`+`}),(0,b.jsx)($9,{children:e})]},t)})})]},t)})})]},e.name)})})}),(0,b.jsx)(`div`,{className:`px-5 py-2.5 border-t border-base-content/10 flex justify-end`,children:(0,b.jsxs)(`span`,{className:`text-[10px] font-mono text-base-content/20`,children:[`Press `,(0,b.jsx)($9,{children:`Esc`}),` to close`]})})]})]}):null}function wLe(){var[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(null);(0,x.useEffect)(function(){`serviceWorker`in navigator&&navigator.serviceWorker.ready.then(function(e){e.addEventListener(`updatefound`,function(){var n=e.installing;if(n){var i=n;i.addEventListener(`statechange`,function(){i.state===`installed`&&navigator.serviceWorker.controller&&(r(e),t(!0))})}})})},[]);function i(){n&&n.waiting&&n.waiting.postMessage({type:`SKIP_WAITING`}),window.location.reload()}return e?(0,b.jsxs)(`div`,{className:`fixed bottom-4 right-4 z-[9998] bg-base-300 border border-base-content/15 rounded-xl shadow-2xl px-4 py-3 flex items-center gap-3 max-w-sm`,children:[(0,b.jsx)(eS,{size:16,className:`text-primary flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsx)(`div`,{className:`text-[13px] text-base-content font-semibold`,children:`Update available`}),(0,b.jsx)(`div`,{className:`text-[11px] text-base-content/40`,children:`A new version of Lattice is ready.`})]}),(0,b.jsx)(`button`,{onClick:i,className:`btn btn-primary btn-xs`,children:`Reload`})]}):null}function TLe(){var e=z();(0,x.useEffect)(function(){function t(e){e.type===`theme:custom_list`&&upe((e.themes||[]).map(function(e){return{id:`custom:`+e.filename,theme:{name:e.name,author:e.author,variant:e.variant,...e.colors}}}))}function n(t){(t.type===`theme:saved`||t.type===`theme:deleted`)&&e.send({type:`theme:list_custom`})}return e.subscribe(`theme:custom_list`,t),e.subscribe(`theme:saved`,n),e.subscribe(`theme:deleted`,n),function(){e.unsubscribe(`theme:custom_list`,t),e.unsubscribe(`theme:saved`,n),e.unsubscribe(`theme:deleted`,n)}},[])}function ELe(){var{items:e,dismiss:t}=kFe();return TLe(),(0,x.useEffect)(function(){function e(e){e.target.closest(`[data-allow-context-menu]`)||e.preventDefault()}return document.addEventListener(`contextmenu`,e),function(){document.removeEventListener(`contextmenu`,e)}},[]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Vr,{router:$Ie}),(0,b.jsx)(xLe,{}),(0,b.jsx)(CLe,{}),(0,b.jsx)(OFe,{items:e,onDismiss:t}),(0,b.jsx)(wLe,{})]})}function DLe(){return(0,b.jsx)(rLe,{children:(0,b.jsx)(nLe,{children:(0,b.jsx)(ELe,{})})})}typeof crypto<`u`&&!crypto.randomUUID&&(crypto.randomUUID=function(){return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,function(e){var t=Number(e);return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)})}),(0,S.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(x.StrictMode,{children:(0,b.jsx)(DLe,{})}));export{PE as a,aE as c,NE as i,s as l,gk as n,ME as o,FE as r,sE as s,WU as t};
|