@gbasin/agentboard-darwin-x64 0.13.0 → 0.14.1

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/bin/agentboard CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bin/agentboard
3
- size: 70516816 bytes
4
- sha256: 36609b3ef94711f1677399cd28396a6e30e1479c0878ad2ed765dd7ef83fbc6f
3
+ size: 70828112 bytes
4
+ sha256: ff67eab695b1022ffa92640fed17b808b42d850dbe79d260a947515c2f2405df
@@ -193,7 +193,7 @@ ${s.join(`
193
193
  `)),e.length=0)},3e3),EV=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var DV=class{constructor(e){this._size=0,this._options=e,this._leakageMon=gV>0||this._options?.leakWarningThreshold?new vV(e?.onListenerError??jB,this._options?.leakWarningThreshold??gV):void 0,this._perfMon=this._options?._profName?new hV(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(dV){let e=this._listeners;queueMicrotask(()=>{TV(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new xV(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||jB)(n),aV.None}if(this._disposed)return aV.None;t&&(e=e.bind(t));let r=new CV(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=yV.create(),i=this._leakageMon.check(r.stack,this._size+1)),dV&&(r.stack=yV.create()),this._listeners?this._listeners instanceof CV?(this._deliveryQueue??=new OV,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=nV(()=>{EV?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof iV?n.add(a):Array.isArray(n)&&n.push(a),EV){let e=Error().stack.split(`
194
194
  `).slice(2,3).join(`
195
195
  `).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);EV.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*wV<=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||jB;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 CV)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}},OV=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}},kV=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),AV;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof jV?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:pV.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:kV})})(AV||={});var jV=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?kV:(this._emitter||=new DV,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},MV=`en`,NV=!1,PV=!1,FV=MV,IV,LV=globalThis,RV;typeof LV.vscode<`u`&&typeof LV.vscode.process<`u`?RV=LV.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(RV=process);var zV=typeof RV?.versions?.electron==`string`&&RV?.type===`renderer`;if(typeof RV==`object`){RV.platform,RV.platform,NV=RV.platform===`linux`,NV&&RV.env.SNAP&&RV.env.SNAP_REVISION,RV.env.CI||RV.env.BUILD_ARTIFACTSTAGINGDIRECTORY,FV=MV;let e=RV.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,FV=t.resolvedLanguage||MV,t.languagePack?.translationsConfigFile}catch{}}else typeof navigator==`object`&&!zV?(IV=navigator.userAgent,IV.indexOf(`Windows`),IV.indexOf(`Macintosh`),(IV.indexOf(`Macintosh`)>=0||IV.indexOf(`iPad`)>=0||IV.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,NV=IV.indexOf(`Linux`)>=0,IV?.indexOf(`Mobi`),PV=!0,FV=globalThis._VSCODE_NLS_LANGUAGE||MV,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);PV&&typeof LV.importScripts==`function`&&LV.origin;var BV=IV,VV=FV,HV;(e=>{function t(){return VV}e.value=t;function n(){return VV.length===2?VV===`en`:VV.length>=3?VV[0]===`e`&&VV[1]===`n`&&VV[2]===`-`:!1}e.isDefaultVariant=n;function r(){return VV===`en`}e.isDefault=r})(HV||={});var UV=typeof LV.postMessage==`function`&&!LV.importScripts;(()=>{if(UV){let e=[];LV.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}),LV.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var WV=!!(BV&&BV.indexOf(`Chrome`)>=0);BV&&BV.indexOf(`Firefox`),!WV&&BV&&BV.indexOf(`Safari`),BV&&BV.indexOf(`Edg/`),BV&&BV.indexOf(`Android`);function GV(e,t=0,n){let r=setTimeout(()=>{e(),n&&i.dispose()},t),i=nV(()=>{clearTimeout(r),n?.deleteAndLeak(i)});return n?.add(i),i}(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var KV;(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})(KV||={});var qV=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 DV,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 pV.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())}};qV.EMPTY=qV.fromArray([]);var JV=class extends aV{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new oV),this._linesCacheDisposables=this._register(new oV),this._register(nV(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=tV(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=GV(()=>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]}},YV=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}},XV=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}},ZV=class extends aV{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(nV(()=>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(){eV(n)}}}clearHighlightDecorations(){eV(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(()=>eV(e))),s.push(i)}}return s.length===0?void 0:s}},QV=class extends aV{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new DV)}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()}},$V=class extends aV{constructor(e){super(),this._highlightTimeout=this._register(new oV),this._lineCache=this._register(new oV),this._state=new YV,this._resultTracker=this._register(new QV),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new JV(e),this._engine=new XV(e,this._lineCache.value),this._decorationManager=new ZV(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(nV(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=GV(()=>{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}},eH=0,tH=0,nH=0,rH=0,iH;(e=>{function t(e,t,n,r){return r===void 0?`#${lH(e)}${lH(t)}${lH(n)}`:`#${lH(e)}${lH(t)}${lH(n)}${lH(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(iH||={});var aH;(e=>{function t(e,t){if(rH=(t.rgba&255)/255,rH===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return eH=a+Math.round((n-a)*rH),tH=o+Math.round((r-o)*rH),nH=s+Math.round((i-s)*rH),{css:iH.toCss(eH,tH,nH),rgba:iH.toRgba(eH,tH,nH)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=cH.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return iH.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[eH,tH,nH]=cH.toChannels(t),{css:iH.toCss(eH,tH,nH),rgba:t}}e.opaque=i;function a(e,t){return rH=Math.round(t*255),[eH,tH,nH]=cH.toChannels(e.rgba),{css:iH.toCss(eH,tH,nH,rH),rgba:iH.toRgba(eH,tH,nH,rH)}}e.opacity=a;function o(e,t){return rH=e.rgba&255,a(e,rH*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(aH||={});var oH;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return eH=parseInt(e.slice(1,2).repeat(2),16),tH=parseInt(e.slice(2,3).repeat(2),16),nH=parseInt(e.slice(3,4).repeat(2),16),iH.toColor(eH,tH,nH);case 5:return eH=parseInt(e.slice(1,2).repeat(2),16),tH=parseInt(e.slice(2,3).repeat(2),16),nH=parseInt(e.slice(3,4).repeat(2),16),rH=parseInt(e.slice(4,5).repeat(2),16),iH.toColor(eH,tH,nH,rH);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return eH=parseInt(r[1]),tH=parseInt(r[2]),nH=parseInt(r[3]),rH=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),iH.toColor(eH,tH,nH,rH);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[eH,tH,nH,rH]=t.getImageData(0,0,1,1).data,rH!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:iH.toRgba(eH,tH,nH,rH),css:e}}e.toColor=r})(oH||={});var sH;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(sH||={});var cH;(e=>{function t(e,t){if(rH=(t&255)/255,rH===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return eH=a+Math.round((n-a)*rH),tH=o+Math.round((r-o)*rH),nH=s+Math.round((i-s)*rH),iH.toRgba(eH,tH,nH)}e.blend=t;function n(e,t,n){let a=sH.relativeLuminance(e>>8),o=sH.relativeLuminance(t>>8);if(uH(a,o)<n){if(o<a){let o=r(e,t,n),s=uH(a,sH.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>uH(a,sH.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=uH(a,sH.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>uH(a,sH.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=uH(sH.relativeLuminance2(o,s,c),sH.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=uH(sH.relativeLuminance2(o,s,c),sH.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=uH(sH.relativeLuminance2(o,s,c),sH.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=uH(sH.relativeLuminance2(o,s,c),sH.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(cH||={});function lH(e){let t=e.toString(16);return t.length<2?`0`+t:t}function uH(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var dH=Object.freeze((()=>{let e=[oH.toColor(`#2e3436`),oH.toColor(`#cc0000`),oH.toColor(`#4e9a06`),oH.toColor(`#c4a000`),oH.toColor(`#3465a4`),oH.toColor(`#75507b`),oH.toColor(`#06989a`),oH.toColor(`#d3d7cf`),oH.toColor(`#555753`),oH.toColor(`#ef2929`),oH.toColor(`#8ae234`),oH.toColor(`#fce94f`),oH.toColor(`#729fcf`),oH.toColor(`#ad7fa8`),oH.toColor(`#34e2e2`),oH.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:iH.toCss(r,i,a),rgba:iH.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:iH.toCss(n,n,n),rgba:iH.toRgba(n,n,n)})}return e})());function fH(e,t,n){return Math.max(t,Math.min(e,n))}function pH(e){switch(e){case`&`:return`&amp;`;case`<`:return`&lt;`}return e}var mH=class{constructor(e){this._buffer=e}serialize(e,t){let n=this._buffer.getNullCell(),r=this._buffer.getNullCell(),i=n,a=e.start.y,o=e.end.y,s=e.start.x,c=e.end.x;this._beforeSerialize(o-a,a,o);for(let t=a;t<=o;t++){let a=this._buffer.getLine(t);if(a){let o=t===e.start.y?s:0,l=t===e.end.y?c:a.length;for(let e=o;e<l;e++){let o=a.getCell(e,i===n?r:n);if(!o){console.warn(`Can't get cell at row=${t}, col=${e}`);continue}this._nextCell(o,i,t,e),i=o}}this._rowEnd(t,t===o)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,n,r){}_rowEnd(e,t){}_beforeSerialize(e,t,n){}_afterSerialize(){}_serializeString(e){return``}};function hH(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function gH(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function _H(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var vH=class extends mH{constructor(e,t){super(e),this._terminal=t,this._rowIndex=0,this._allRows=[],this._allRowSeparators=[],this._currentRow=``,this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(e,t,n){this._allRows=Array(e),this._lastContentCursorRow=t,this._lastCursorRow=t,this._firstRow=t}_rowEnd(e,t){this._nullCellCount>0&&!gH(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n=``;if(!t){e-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let t=this._buffer.getLine(e),r=this._buffer.getLine(e+1);if(!r.isWrapped)n=`\r
196
- `,this._lastCursorRow=e+1,this._lastCursorCol=0;else{n=``;let i=t.getCell(t.length-1,this._thisRowLastChar),a=t.getCell(t.length-2,this._thisRowLastSecondChar),o=r.getCell(0,this._nextRowFirstChar),s=o.getWidth()>1,c=!1;(o.getChars()&&s?this._nullCellCount<=1:this._nullCellCount<=0)&&((i.getChars()||i.getWidth()===0)&&gH(i,o)&&(c=!0),s&&(a.getChars()||a.getWidth()===0)&&gH(i,o)&&gH(a,o)&&(c=!0)),c||(n=`-`.repeat(this._nullCellCount+1),n+=`\x1B[1D\x1B[1X`,this._nullCellCount>0&&(n+=`\x1B[A`,n+=`\x1B[${t.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${t.length-this._nullCellCount}D`,n+=`\x1B[B`),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow=``,this._nullCellCount=0}_diffStyle(e,t){let n=[],r=!hH(e,t),i=!gH(e,t),a=!_H(e,t);if(r||i||a)if(e.isAttributeDefault())t.isAttributeDefault()||n.push(0);else{if(r){let t=e.getFgColor();e.isFgRGB()?n.push(38,2,t>>>16&255,t>>>8&255,t&255):e.isFgPalette()?t>=16?n.push(38,5,t):n.push(t&8?90+(t&7):30+(t&7)):n.push(39)}if(i){let t=e.getBgColor();e.isBgRGB()?n.push(48,2,t>>>16&255,t>>>8&255,t&255):e.isBgPalette()?t>=16?n.push(48,5,t):n.push(t&8?100+(t&7):40+(t&7)):n.push(49)}a&&(e.isInverse()!==t.isInverse()&&n.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&n.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&n.push(e.isUnderline()?4:24),e.isOverline()!==t.isOverline()&&n.push(e.isOverline()?53:55),e.isBlink()!==t.isBlink()&&n.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&n.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&n.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&n.push(e.isDim()?2:22),e.isStrikethrough()!==t.isStrikethrough()&&n.push(e.isStrikethrough()?9:29))}return n}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,this._cursorStyle);if(i?!gH(this._cursorStyle,e):a.length>0){this._nullCellCount>0&&(gH(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r,this._currentRow+=`\x1B[${a.join(`;`)}m`;let e=this._buffer.getLine(n);e!==void 0&&(e.getCell(r,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=r)}i?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(gH(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r+e.getWidth())}_serializeString(e){let t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n=``;for(let e=0;e<t;e++)n+=this._allRows[e],e+1<t&&(n+=this._allRowSeparators[e]);if(!e){let e=this._buffer.baseY+this._buffer.cursorY,t=this._buffer.cursorX;(e!==this._lastCursorRow||t!==this._lastCursorCol)&&((e=>{e>0?n+=`\x1B[${e}B`:e<0&&(n+=`\x1B[${-e}A`)})(e-this._lastCursorRow),(e=>{e>0?n+=`\x1B[${e}C`:e<0&&(n+=`\x1B[${-e}D`)})(t-this._lastCursorCol))}let r=this._terminal._core._inputHandler._curAttrData,i=this._diffStyle(r,this._cursorStyle);return i.length>0&&(n+=`\x1B[${i.join(`;`)}m`),n}},yH=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,t,n){let r=t.length,i=n===void 0?r:fH(n+e.rows,0,r);return this._serializeBufferByRange(e,t,{start:r-i,end:r-1},!1)}_serializeBufferByRange(e,t,n,r){return new vH(t,e).serialize({start:{x:0,y:typeof n.start==`number`?n.start:n.start.line},end:{x:e.cols,y:typeof n.end==`number`?n.end:n.end.line}},r)}_serializeBufferAsHTML(e,t){let n=e.buffer.active,r=new bH(n,e,t),i=t.onlySelection??!1,a=t.range;if(a)return r.serialize({start:{x:a.startCol,y:(a.startLine,a.startLine)},end:{x:e.cols,y:(a.endLine,a.endLine)}});if(!i){let i=n.length,a=t.scrollback,o=a===void 0?i:fH(a+e.rows,0,i);return r.serialize({start:{x:0,y:i-o},end:{x:e.cols,y:i-1}})}let o=this._terminal?.getSelectionPosition();return o===void 0?``:r.serialize({start:{x:o.start.x,y:o.start.y},end:{x:o.end.x,y:o.end.y}})}_serializeModes(e){let t=``,n=e.modes;if(n.applicationCursorKeysMode&&(t+=`\x1B[?1h`),n.applicationKeypadMode&&(t+=`\x1B[?66h`),n.bracketedPasteMode&&(t+=`\x1B[?2004h`),n.insertMode&&(t+=`\x1B[4h`),n.originMode&&(t+=`\x1B[?6h`),n.reverseWraparoundMode&&(t+=`\x1B[?45h`),n.sendFocusMode&&(t+=`\x1B[?1004h`),n.wraparoundMode===!1&&(t+=`\x1B[?7l`),n.mouseTrackingMode!==`none`)switch(n.mouseTrackingMode){case`x10`:t+=`\x1B[?9h`;break;case`vt200`:t+=`\x1B[?1000h`;break;case`drag`:t+=`\x1B[?1002h`;break;case`any`:t+=`\x1B[?1003h`;break}return t}serialize(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let t=e?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e?.scrollback);if(!e?.excludeAltBuffer&&this._terminal.buffer.active.type===`alternate`){let e=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);t+=`\x1B[?1049h\x1B[H${e}`}return e?.excludeModes||(t+=this._serializeModes(this._terminal)),t}serializeAsHTML(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},bH=class extends mH{constructor(e,t,n){super(e),this._terminal=t,this._options=n,this._currentRow=``,this._htmlContent=``,t._core._themeService?this._ansiColors=t._core._themeService.colors.ansi:this._ansiColors=dH}_padStart(e,t,n){return t>>=0,n??=` `,e.length>t?e:(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),n.slice(0,t)+e)}_beforeSerialize(e,t,n){this._htmlContent+=`<html><body><!--StartFragment--><pre>`;let r=`#000000`,i=`#ffffff`;(this._options.includeGlobalBackground??!1)&&(r=this._terminal.options.theme?.foreground??`#ffffff`,i=this._terminal.options.theme?.background??`#000000`);let a=[];a.push(`color: `+r+`;`),a.push(`background-color: `+i+`;`),a.push(`font-family: `+this._terminal.options.fontFamily+`;`),a.push(`font-size: `+this._terminal.options.fontSize+`px;`),this._htmlContent+=`<div style='`+a.join(` `)+`'>`}_afterSerialize(){this._htmlContent+=`</div>`,this._htmlContent+=`</pre><!--EndFragment--></body></html>`}_rowEnd(e,t){this._htmlContent+=`<div><span>`+this._currentRow+`</span></div>`,this._currentRow=``}_getHexColor(e,t){let n=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return`#`+[n>>16&255,n>>8&255,n&255].map(e=>this._padStart(e.toString(16),2,`0`)).join(``);if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[n].css}_diffStyle(e,t){let n=[],r=!hH(e,t),i=!gH(e,t),a=!_H(e,t);if(r||i||a){let t=this._getHexColor(e,!0);t&&n.push(`color: `+t+`;`);let r=this._getHexColor(e,!1);return r&&n.push(`background-color: `+r+`;`),e.isInverse()&&n.push(`color: #000000; background-color: #BFBFBF;`),e.isBold()&&n.push(`font-weight: bold;`),e.isUnderline()&&e.isOverline()?n.push(`text-decoration: overline underline;`):e.isUnderline()?n.push(`text-decoration: underline;`):e.isOverline()&&n.push(`text-decoration: overline;`),e.isBlink()&&n.push(`text-decoration: blink;`),e.isInvisible()&&n.push(`visibility: hidden;`),e.isItalic()&&n.push(`font-style: italic;`),e.isDim()&&n.push(`opacity: 0.5;`),e.isStrikethrough()&&n.push(`text-decoration: line-through;`),n}}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,t);a&&(this._currentRow+=a.length===0?`</span><span>`:`</span><span style='`+a.join(` `)+`'>`),i?this._currentRow+=` `:this._currentRow+=pH(e.getChars())}_serializeString(){return this._htmlContent}};function xH(e){let t=0;for(let n=0;n<e.length;++n){let r=e.charCodeAt(n);if(r<48||57<r)return-1;t=t*10+r-48}return t}var SH=class{constructor(){this._st=0,this._pr=0}dispose(){this._seqHandler?.dispose(),this._onChange?.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,e=>{if(!e.startsWith(`4;`))return!1;let t=e.split(`;`);if(t.length>3)return!0;t.length===2&&t.push(``);let n=xH(t[1]),r=xH(t[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(r<0)return!0;this.progress={state:n,value:r};break;case 2:case 4:if(r<0)return!0;this.progress={state:n,value:r||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){if(e.state<0||e.state>4){console.warn(`progress state out of bounds, not applied`);return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),this._onChange?.fire({state:this._st,value:this._pr})}};function CH(e){return`\x1b[200~${e}\x1b[201~`}function wH(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function TH(e,t){let n=wH(e);return t===`codex`?n:CH(n)}var EH=40*1024*1024,DH=`40 MB`;function OH(e){if(!e)return[];let t=Array.from(e.files??[]).filter(e=>e instanceof File);return t.length?t:Array.from(e.items??[]).filter(e=>e.kind===`file`).map(e=>e.getAsFile?.()).filter(e=>e instanceof File)}function kH(e){let t=e.find(e=>e.type.startsWith(`image/`)&&e.size===0);if(t)return`${t.name} contains no image data. Choose the file to upload it.`;let n=e.find(e=>e.size>EH);return n?`${n.name} exceeds the ${DH} limit`:null}async function AH(e,t){let n=kH([e]);if(n)throw Error(n);let r=new FormData,i=/^image\/(png|jpeg|gif|webp)$/.test(e.type);r.append(i?`image`:`file`,e,e.name);let a;try{a=await fetch(i?`/api/paste-image`:`/api/paste-file`,{method:`POST`,body:r,signal:t})}catch(n){throw t?.aborted?n:Error(`Could not upload ${e.name}. Check your connection and try again.`)}let o=await a.json().catch(()=>null);if(!a.ok||typeof o?.path!=`string`||!o.path.startsWith(`/`))throw Error(typeof o?.error==`string`?o.error:`Could not upload ${e.name}. Try again.`);return o.path}function jH(e){return`'${e.replace(/[\x00-\x1f\x7f]/g,``).replace(/'/g,`'\\''`)}'`}async function MH(){try{let e=await navigator.clipboard.read(),t=[],n=``;for(let r of e){let e=r.types.find(e=>e.startsWith(`image/`));e?t.push(new File([await r.getType(e)],`clipboard.${e.split(`/`)[1]||`png`}`,{type:e})):r.types.includes(`text/plain`)&&(n+=await(await r.getType(`text/plain`)).text())}return{text:n,files:t}}catch{return{text:await navigator.clipboard.readText(),files:[]}}}var NH=new Map,PH=20;function FH(e){NH.delete(e)}function IH(){NH.clear()}var LH=/https?:\/\/[^\s"'<>]+|\b(?:localhost|\d{1,3}(?:\.\d{1,3}){3}):\d{1,5}(?:\/[^\s"'<>]*)?\b/,RH=/[.,;:!?]+$/,zH=[[`(`,`)`],[`[`,`]`],[`{`,`}`]],BH=(e,t)=>e.split(t).length-1;function VH(e){let t=e.trim();if(!t)return t;let n=()=>{t=t.replace(RH,``)};n();let r=!0;for(;r;){r=!1;for(let[e,n]of zH){if(!t.endsWith(n))continue;let i=BH(t,e);BH(t,n)>i&&(t=t.slice(0,-1),r=!0)}}return n(),t}var HH=()=>typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.platform),UH=`\x1B[200~\x1B[201~`,WH=``,GH=`\x1B[?1000h\x1B[?1002h\x1B[?1006h`,KH=`\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l`;async function qH(e){try{let t=(e.type.split(`/`)[1]||`png`).toLowerCase(),n=new FormData;n.append(`image`,e,`paste.${t}`);let r=await fetch(`/api/paste-image`,{method:`POST`,body:n});if(!r.ok)return null;let i=await r.json();return typeof i.path==`string`?i.path:null}catch{return null}}async function JH(){try{let e=await fetch(`/api/clipboard-file-path`);if(!e.ok)return null;let t=await e.json();return t.isImage===!0&&typeof t.path==`string`?t.path:null}catch{return null}}async function YH(e,t){if(e===`codex`)return WH;let n=t.path??null;return!n&&t.blob&&(n=await qH(t.blob)),n||=await JH(),n?CH(wH(n)):UH}var XH=/\/Users\/[^/\n]+\/Library\/Group Containers\/group\.com\.apple\.coreservices\.useractivityd\/shared-pasteboard\/items\//;function ZH(e){return XH.test(e)}function QH(e){if(!e)return!1;for(let t of Array.from(e.files??[]))if(t?.type?.startsWith(`image/`))return!0;for(let t of Array.from(e.items??[]))if(t?.type?.startsWith(`image/`))return!0;return!1}function $H(e){if(!e)return null;for(let t of Array.from(e.files??[]))if(t?.type?.startsWith(`image/`))return t;for(let t of Array.from(e.items??[]))if(t?.kind===`file`&&t.type?.startsWith(`image/`)){let e=t.getAsFile?.();if(e)return e}return null}var eU=class{constructor(e={}){this.callbacks=e}async readText(e){if(e!==`c`)return``;try{return await navigator.clipboard.readText()}catch{return``}}async writeText(e,t){if(e!==`c`||!t?.trim())return;let n=performance.now();try{if(!navigator.clipboard?.writeText)throw Error(`navigator.clipboard.writeText unavailable`);await navigator.clipboard.writeText(t),J(`clipboard_write_success`,{source:`osc52`,chars:t.length,durationMs:Math.round(performance.now()-n)})}catch(e){J(`clipboard_write_failed`,{source:`osc52`,chars:t.length,error:e instanceof Error?e.message:String(e)},`warn`),this.callbacks.onWriteFailed?.(t,`osc52`)}}},tU=`︎`,nU=[`⏺`],rU=new RegExp(nU.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),`g`);function iU(e){for(let t of nU)if(e.indexOf(t)!==-1)return e.replace(rU,`$&${tU}`);return e}function aU({sessionId:e,tmuxTarget:t,agentType:n,allowAttach:r=!0,connectionStatus:i=`connected`,connectionEpoch:a=0,sendMessage:o,subscribe:s,theme:c,fontSize:l,lineHeight:u,letterSpacing:d,fontFamily:f,useWebGL:p,onScrollChange:m,onPasteFiles:h,onPasteError:g}){let _=(0,x.useRef)(h);_.current=h;let v=(0,x.useRef)(g);v.current=g;let y=()=>!_.current||typeof location<`u`&&[`localhost`,`127.0.0.1`,`[::1]`].includes(location.hostname),b=We(),S=(0,x.useRef)(null),C=(0,x.useRef)(null),w=(0,x.useRef)(!1),T=(0,x.useRef)(null),E=(0,x.useRef)(null),D=(0,x.useRef)(null),O=(0,x.useRef)(null),k=(0,x.useRef)(null),A=(0,x.useRef)(null),j=(0,x.useRef)(null),M=(0,x.useRef)(null),N=(0,x.useRef)(null),P=(0,x.useRef)(null),F=(0,x.useRef)(0),I=(0,x.useRef)(!1),[L,ee]=(0,x.useState)(!1),R=(0,x.useRef)(!1),z=(0,x.useRef)(!1),B=(0,x.useRef)(null),te=(0,x.useRef)(0),[V,ne]=(0,x.useState)(null),re=(0,x.useCallback)((e,t)=>{e?.trim()&&(te.current+=1,ne({id:te.current,text:e,source:t}))},[]),U=(0,x.useCallback)(()=>{V&&(zm(V.text),J(`clipboard_manual_copy`,{source:V.source,chars:V.text.length},`info`),ne(null))},[V]),ie=(0,x.useCallback)(()=>{ne(null)},[]),ae=(0,x.useRef)(null),oe=(0,x.useRef)(null),se=(0,x.useRef)(e&&r&&i===`connected`?e:null),ce=(0,x.useRef)(null),le=(0,x.useRef)(-1),ue=(0,x.useRef)(null),de=(0,x.useRef)(null),fe=(0,x.useRef)(o),pe=(0,x.useRef)(n),me=(0,x.useRef)(m),he=(0,x.useRef)(p),ge=(0,x.useRef)([]),_e=(0,x.useRef)(null),ve=(0,x.useRef)(null),ye=(0,x.useRef)(!1),[be,xe]=(0,x.useState)(!1),Se=(0,x.useRef)(null),Ce=(0,x.useRef)(null),we=(0,x.useRef)(null),Te=()=>{if(Se.current!==null&&(window.clearTimeout(Se.current),Se.current=null),Ce.current!==null&&(cancelAnimationFrame(Ce.current),Ce.current=null),we.current!==null){let e=S.current;e&&(e.style.display=we.current),we.current=null}},Ee=(e,t)=>{let n=S.current;n&&(Te(),J(`ios_repaint_schedule`,{delayMs:e,trigger:t,sessionId:oe.current}),Se.current=window.setTimeout(()=>{Se.current=null;let e=C.current;e&&e.refresh(0,e.rows-1),J(`ios_repaint_exec`,{trigger:t,hasContent:e?e.buffer.active.length>0:!1,bufferLines:e?.buffer.active.length??0,sessionId:oe.current}),we.current=n.style.display,n.style.display=`none`,Ce.current=requestAnimationFrame(()=>{Ce.current=requestAnimationFrame(()=>{Ce.current=null,n.style.display=we.current??``,we.current=null})})},e))};(0,x.useEffect)(()=>{fe.current=o},[o]),(0,x.useEffect)(()=>{pe.current=n},[n]),(0,x.useEffect)(()=>{me.current=m},[m]);let De=(0,x.useCallback)(()=>{let e=C.current;if(!e||!me.current)return;let t=e.buffer.active,n=!I.current&&t.viewportY>=t.baseY;me.current(n)},[]),Oe=(0,x.useCallback)(e=>{if(I.current===e)return;I.current=e,ee(e);let t=C.current;t&&e&&t.write(KH),De()},[De]),ke=(0,x.useCallback)(()=>{let e=se.current;e&&(B.current!==null&&window.clearTimeout(B.current),B.current=window.setTimeout(()=>{B.current=null,fe.current({type:`tmux-check-copy-mode`,sessionId:e})},150))},[]),Ae=(0,x.useCallback)(()=>{let e=C.current,t=T.current;if(!e||!t)return;t.fit();let n=oe.current;n&&fe.current({type:`terminal-resize`,sessionId:n,cols:e.cols,rows:e.rows})},[]);return(0,x.useEffect)(()=>{let t=S.current;if(!t||C.current)return;let n=!1;t.innerHTML=``;let r=new KP({fontFamily:f,fontSize:l,lineHeight:((e,t)=>Math.round(e*t)/e)(l,u),letterSpacing:d,scrollback:0,cursorBlink:!1,cursorStyle:`underline`,convertEol:!1,theme:c,screenReaderMode:b,minimumContrastRatio:4.5}),i=new YP;r.loadAddon(i),r.loadAddon(new DB(void 0,new eU({onWriteFailed:re})));let a=new $V;r.loadAddon(a),k.current=a;let o=new yH;r.loadAddon(o),A.current=o;let s=new SH;r.loadAddon(s),j.current=s;let p=()=>{if(!n){if(he.current)try{let t=new Lz;t.onContextLoss(()=>{J(`webgl_context_loss`,{sessionId:e},`info`);try{t.dispose()}catch{}E.current=null}),r.loadAddon(t),E.current=t}catch{}r.open(t),i.fit(),w.current||(w.current=!0,J(`terminal_init`,{isiOS:b,useWebGL:he.current,hasWebGL:!!E.current,userAgent:navigator.userAgent.slice(0,120),platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints},`info`)),m&&r.element&&r.element.appendChild(m)}};document.fonts?.ready?document.fonts.ready.then(p).catch(p):p();let m=null,h=null,g=null;typeof document<`u`&&document.createElement&&(m=document.createElement(`div`),m.className=`xterm-hover`,m.style.cssText=`
196
+ `,this._lastCursorRow=e+1,this._lastCursorCol=0;else{n=``;let i=t.getCell(t.length-1,this._thisRowLastChar),a=t.getCell(t.length-2,this._thisRowLastSecondChar),o=r.getCell(0,this._nextRowFirstChar),s=o.getWidth()>1,c=!1;(o.getChars()&&s?this._nullCellCount<=1:this._nullCellCount<=0)&&((i.getChars()||i.getWidth()===0)&&gH(i,o)&&(c=!0),s&&(a.getChars()||a.getWidth()===0)&&gH(i,o)&&gH(a,o)&&(c=!0)),c||(n=`-`.repeat(this._nullCellCount+1),n+=`\x1B[1D\x1B[1X`,this._nullCellCount>0&&(n+=`\x1B[A`,n+=`\x1B[${t.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${t.length-this._nullCellCount}D`,n+=`\x1B[B`),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow=``,this._nullCellCount=0}_diffStyle(e,t){let n=[],r=!hH(e,t),i=!gH(e,t),a=!_H(e,t);if(r||i||a)if(e.isAttributeDefault())t.isAttributeDefault()||n.push(0);else{if(r){let t=e.getFgColor();e.isFgRGB()?n.push(38,2,t>>>16&255,t>>>8&255,t&255):e.isFgPalette()?t>=16?n.push(38,5,t):n.push(t&8?90+(t&7):30+(t&7)):n.push(39)}if(i){let t=e.getBgColor();e.isBgRGB()?n.push(48,2,t>>>16&255,t>>>8&255,t&255):e.isBgPalette()?t>=16?n.push(48,5,t):n.push(t&8?100+(t&7):40+(t&7)):n.push(49)}a&&(e.isInverse()!==t.isInverse()&&n.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&n.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&n.push(e.isUnderline()?4:24),e.isOverline()!==t.isOverline()&&n.push(e.isOverline()?53:55),e.isBlink()!==t.isBlink()&&n.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&n.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&n.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&n.push(e.isDim()?2:22),e.isStrikethrough()!==t.isStrikethrough()&&n.push(e.isStrikethrough()?9:29))}return n}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,this._cursorStyle);if(i?!gH(this._cursorStyle,e):a.length>0){this._nullCellCount>0&&(gH(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r,this._currentRow+=`\x1B[${a.join(`;`)}m`;let e=this._buffer.getLine(n);e!==void 0&&(e.getCell(r,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=r)}i?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(gH(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r+e.getWidth())}_serializeString(e){let t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n=``;for(let e=0;e<t;e++)n+=this._allRows[e],e+1<t&&(n+=this._allRowSeparators[e]);if(!e){let e=this._buffer.baseY+this._buffer.cursorY,t=this._buffer.cursorX;(e!==this._lastCursorRow||t!==this._lastCursorCol)&&((e=>{e>0?n+=`\x1B[${e}B`:e<0&&(n+=`\x1B[${-e}A`)})(e-this._lastCursorRow),(e=>{e>0?n+=`\x1B[${e}C`:e<0&&(n+=`\x1B[${-e}D`)})(t-this._lastCursorCol))}let r=this._terminal._core._inputHandler._curAttrData,i=this._diffStyle(r,this._cursorStyle);return i.length>0&&(n+=`\x1B[${i.join(`;`)}m`),n}},yH=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,t,n){let r=t.length,i=n===void 0?r:fH(n+e.rows,0,r);return this._serializeBufferByRange(e,t,{start:r-i,end:r-1},!1)}_serializeBufferByRange(e,t,n,r){return new vH(t,e).serialize({start:{x:0,y:typeof n.start==`number`?n.start:n.start.line},end:{x:e.cols,y:typeof n.end==`number`?n.end:n.end.line}},r)}_serializeBufferAsHTML(e,t){let n=e.buffer.active,r=new bH(n,e,t),i=t.onlySelection??!1,a=t.range;if(a)return r.serialize({start:{x:a.startCol,y:(a.startLine,a.startLine)},end:{x:e.cols,y:(a.endLine,a.endLine)}});if(!i){let i=n.length,a=t.scrollback,o=a===void 0?i:fH(a+e.rows,0,i);return r.serialize({start:{x:0,y:i-o},end:{x:e.cols,y:i-1}})}let o=this._terminal?.getSelectionPosition();return o===void 0?``:r.serialize({start:{x:o.start.x,y:o.start.y},end:{x:o.end.x,y:o.end.y}})}_serializeModes(e){let t=``,n=e.modes;if(n.applicationCursorKeysMode&&(t+=`\x1B[?1h`),n.applicationKeypadMode&&(t+=`\x1B[?66h`),n.bracketedPasteMode&&(t+=`\x1B[?2004h`),n.insertMode&&(t+=`\x1B[4h`),n.originMode&&(t+=`\x1B[?6h`),n.reverseWraparoundMode&&(t+=`\x1B[?45h`),n.sendFocusMode&&(t+=`\x1B[?1004h`),n.wraparoundMode===!1&&(t+=`\x1B[?7l`),n.mouseTrackingMode!==`none`)switch(n.mouseTrackingMode){case`x10`:t+=`\x1B[?9h`;break;case`vt200`:t+=`\x1B[?1000h`;break;case`drag`:t+=`\x1B[?1002h`;break;case`any`:t+=`\x1B[?1003h`;break}return t}serialize(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let t=e?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e?.scrollback);if(!e?.excludeAltBuffer&&this._terminal.buffer.active.type===`alternate`){let e=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);t+=`\x1B[?1049h\x1B[H${e}`}return e?.excludeModes||(t+=this._serializeModes(this._terminal)),t}serializeAsHTML(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},bH=class extends mH{constructor(e,t,n){super(e),this._terminal=t,this._options=n,this._currentRow=``,this._htmlContent=``,t._core._themeService?this._ansiColors=t._core._themeService.colors.ansi:this._ansiColors=dH}_padStart(e,t,n){return t>>=0,n??=` `,e.length>t?e:(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),n.slice(0,t)+e)}_beforeSerialize(e,t,n){this._htmlContent+=`<html><body><!--StartFragment--><pre>`;let r=`#000000`,i=`#ffffff`;(this._options.includeGlobalBackground??!1)&&(r=this._terminal.options.theme?.foreground??`#ffffff`,i=this._terminal.options.theme?.background??`#000000`);let a=[];a.push(`color: `+r+`;`),a.push(`background-color: `+i+`;`),a.push(`font-family: `+this._terminal.options.fontFamily+`;`),a.push(`font-size: `+this._terminal.options.fontSize+`px;`),this._htmlContent+=`<div style='`+a.join(` `)+`'>`}_afterSerialize(){this._htmlContent+=`</div>`,this._htmlContent+=`</pre><!--EndFragment--></body></html>`}_rowEnd(e,t){this._htmlContent+=`<div><span>`+this._currentRow+`</span></div>`,this._currentRow=``}_getHexColor(e,t){let n=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return`#`+[n>>16&255,n>>8&255,n&255].map(e=>this._padStart(e.toString(16),2,`0`)).join(``);if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[n].css}_diffStyle(e,t){let n=[],r=!hH(e,t),i=!gH(e,t),a=!_H(e,t);if(r||i||a){let t=this._getHexColor(e,!0);t&&n.push(`color: `+t+`;`);let r=this._getHexColor(e,!1);return r&&n.push(`background-color: `+r+`;`),e.isInverse()&&n.push(`color: #000000; background-color: #BFBFBF;`),e.isBold()&&n.push(`font-weight: bold;`),e.isUnderline()&&e.isOverline()?n.push(`text-decoration: overline underline;`):e.isUnderline()?n.push(`text-decoration: underline;`):e.isOverline()&&n.push(`text-decoration: overline;`),e.isBlink()&&n.push(`text-decoration: blink;`),e.isInvisible()&&n.push(`visibility: hidden;`),e.isItalic()&&n.push(`font-style: italic;`),e.isDim()&&n.push(`opacity: 0.5;`),e.isStrikethrough()&&n.push(`text-decoration: line-through;`),n}}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,t);a&&(this._currentRow+=a.length===0?`</span><span>`:`</span><span style='`+a.join(` `)+`'>`),i?this._currentRow+=` `:this._currentRow+=pH(e.getChars())}_serializeString(){return this._htmlContent}};function xH(e){let t=0;for(let n=0;n<e.length;++n){let r=e.charCodeAt(n);if(r<48||57<r)return-1;t=t*10+r-48}return t}var SH=class{constructor(){this._st=0,this._pr=0}dispose(){this._seqHandler?.dispose(),this._onChange?.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,e=>{if(!e.startsWith(`4;`))return!1;let t=e.split(`;`);if(t.length>3)return!0;t.length===2&&t.push(``);let n=xH(t[1]),r=xH(t[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(r<0)return!0;this.progress={state:n,value:r};break;case 2:case 4:if(r<0)return!0;this.progress={state:n,value:r||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){if(e.state<0||e.state>4){console.warn(`progress state out of bounds, not applied`);return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),this._onChange?.fire({state:this._st,value:this._pr})}};function CH(e){return`\x1b[200~${e}\x1b[201~`}function wH(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function TH(e,t){let n=wH(e);return t===`codex`?n:CH(n)}var EH=40*1024*1024,DH=`40 MB`;function OH(e){if(!e)return[];let t=Array.from(e.files??[]).filter(e=>e instanceof File);return t.length?t:Array.from(e.items??[]).filter(e=>e.kind===`file`).map(e=>e.getAsFile?.()).filter(e=>e instanceof File)}function kH(e){let t=e.find(e=>e.type.startsWith(`image/`)&&e.size===0);if(t)return`${t.name} contains no image data. Choose the file to upload it.`;let n=e.find(e=>e.size>EH);return n?`${n.name} exceeds the ${DH} limit`:null}async function AH(e,t){let n=kH([e]);if(n)throw Error(n);let r=new FormData,i=/^image\/(png|jpeg|gif|webp)$/.test(e.type);r.append(i?`image`:`file`,e,e.name);let a;try{a=await fetch(i?`/api/paste-image`:`/api/paste-file`,{method:`POST`,body:r,signal:t})}catch(n){throw t?.aborted?n:Error(`Could not upload ${e.name}. Check your connection and try again.`)}let o=await a.json().catch(()=>null);if(!a.ok||typeof o?.path!=`string`||!o.path.startsWith(`/`))throw Error(typeof o?.error==`string`?o.error:`Could not upload ${e.name}. Try again.`);return o.path}function jH(e){return`'${e.replace(/[\x00-\x1f\x7f]/g,``).replace(/'/g,`'\\''`)}'`}async function MH(){try{let e=await navigator.clipboard.read(),t=[],n=``;for(let r of e){let e=r.types.find(e=>e.startsWith(`image/`));e?t.push(new File([await r.getType(e)],`clipboard.${e.split(`/`)[1]||`png`}`,{type:e})):r.types.includes(`text/plain`)&&(n+=await(await r.getType(`text/plain`)).text())}return{text:n,files:t}}catch{return{text:await navigator.clipboard.readText(),files:[]}}}var NH=new Map,PH=20;function FH(e){NH.delete(e)}function IH(){NH.clear()}var LH=/https?:\/\/[^\s"'<>]+|\b(?:localhost|\d{1,3}(?:\.\d{1,3}){3}):\d{1,5}(?:\/[^\s"'<>]*)?\b/,RH=/[.,;:!?]+$/,zH=[[`(`,`)`],[`[`,`]`],[`{`,`}`]],BH=(e,t)=>e.split(t).length-1;function VH(e){let t=e.trim();if(!t)return t;let n=()=>{t=t.replace(RH,``)};n();let r=!0;for(;r;){r=!1;for(let[e,n]of zH){if(!t.endsWith(n))continue;let i=BH(t,e);BH(t,n)>i&&(t=t.slice(0,-1),r=!0)}}return n(),t}var HH=()=>typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.platform),UH=`\x1B[200~\x1B[201~`,WH=``,GH=`\x1B[?1000h\x1B[?1002h\x1B[?1006h`,KH=`\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l`;async function qH(e){try{let t=(e.type.split(`/`)[1]||`png`).toLowerCase(),n=new FormData;n.append(`image`,e,`paste.${t}`);let r=await fetch(`/api/paste-image`,{method:`POST`,body:n});if(!r.ok)return null;let i=await r.json();return typeof i.path==`string`?i.path:null}catch{return null}}async function JH(){try{let e=await fetch(`/api/clipboard-file-path`);if(!e.ok)return null;let t=await e.json();return t.isImage===!0&&typeof t.path==`string`?t.path:null}catch{return null}}async function YH(e,t){if(e===`codex`)return WH;let n=t.path??null;return!n&&t.blob&&(n=await qH(t.blob)),n||=await JH(),n?CH(wH(n)):UH}var XH=/\/Users\/[^/\n]+\/Library\/Group Containers\/group\.com\.apple\.coreservices\.useractivityd\/shared-pasteboard\/items\//;function ZH(e){return XH.test(e)}function QH(e){if(!e)return!1;for(let t of Array.from(e.files??[]))if(t?.type?.startsWith(`image/`))return!0;for(let t of Array.from(e.items??[]))if(t?.type?.startsWith(`image/`))return!0;return!1}function $H(e){if(!e)return null;for(let t of Array.from(e.files??[]))if(t?.type?.startsWith(`image/`))return t;for(let t of Array.from(e.items??[]))if(t?.kind===`file`&&t.type?.startsWith(`image/`)){let e=t.getAsFile?.();if(e)return e}return null}var eU=class{constructor(e={}){this.callbacks=e}async readText(e){if(e!==`c`)return``;try{return await navigator.clipboard.readText()}catch{return``}}async writeText(e,t){if(e!==`c`||!t?.trim())return;let n=performance.now();try{if(!navigator.clipboard?.writeText)throw Error(`navigator.clipboard.writeText unavailable`);await navigator.clipboard.writeText(t),J(`clipboard_write_success`,{source:`osc52`,chars:t.length,durationMs:Math.round(performance.now()-n)})}catch(e){J(`clipboard_write_failed`,{source:`osc52`,chars:t.length,error:e instanceof Error?e.message:String(e)},`warn`),this.callbacks.onWriteFailed?.(t,`osc52`)}}},tU=`︎`,nU=[`⏺`],rU=new RegExp(nU.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),`g`);function iU(e){for(let t of nU)if(e.indexOf(t)!==-1)return e.replace(rU,`$&${tU}`);return e}function aU({sessionId:e,tmuxTarget:t,agentType:n,allowAttach:r=!0,connectionStatus:i=`connected`,connectionEpoch:a=0,sendMessage:o,subscribe:s,theme:c,fontSize:l,lineHeight:u,letterSpacing:d,fontFamily:f,useWebGL:p,onScrollChange:m,onPasteFiles:h,onPasteError:g}){let _=(0,x.useRef)(h);_.current=h;let v=(0,x.useRef)(g);v.current=g;let y=()=>!_.current||typeof location<`u`&&[`localhost`,`127.0.0.1`,`[::1]`].includes(location.hostname),b=We(),S=(0,x.useRef)(null),C=(0,x.useRef)(null),w=(0,x.useRef)(!1),T=(0,x.useRef)(null),E=(0,x.useRef)(null),D=(0,x.useRef)(null),O=(0,x.useRef)(null),k=(0,x.useRef)(null),A=(0,x.useRef)(null),j=(0,x.useRef)(null),M=(0,x.useRef)(null),N=(0,x.useRef)(null),P=(0,x.useRef)(null),F=(0,x.useRef)(0),I=(0,x.useRef)(!1),[L,ee]=(0,x.useState)(!1),R=(0,x.useRef)(!1),z=(0,x.useRef)(!1),B=(0,x.useRef)(null),te=(0,x.useRef)(0),[V,ne]=(0,x.useState)(null),re=(0,x.useCallback)((e,t)=>{e?.trim()&&(te.current+=1,ne({id:te.current,text:e,source:t}))},[]),U=(0,x.useCallback)(()=>{V&&(zm(V.text),J(`clipboard_manual_copy`,{source:V.source,chars:V.text.length},`info`),ne(null))},[V]),ie=(0,x.useCallback)(()=>{ne(null)},[]),ae=(0,x.useRef)(null),oe=(0,x.useRef)(null),se=(0,x.useRef)(e&&r&&i===`connected`?e:null),ce=(0,x.useRef)(null),le=(0,x.useRef)(-1),ue=(0,x.useRef)(null),de=(0,x.useRef)(null),fe=(0,x.useRef)(o),pe=(0,x.useRef)(n),me=(0,x.useRef)(m),he=(0,x.useRef)(p),ge=(0,x.useRef)([]),_e=(0,x.useRef)(null),ve=(0,x.useRef)(null),ye=(0,x.useRef)({count:0,bytes:0,lastEmit:0,timer:null,lastMessageSessionId:null}),be=(0,x.useRef)(!1),[xe,Se]=(0,x.useState)(!1),Ce=(0,x.useRef)(null),we=(0,x.useRef)(null),Te=(0,x.useRef)(null),Ee=()=>{if(Ce.current!==null&&(window.clearTimeout(Ce.current),Ce.current=null),we.current!==null&&(cancelAnimationFrame(we.current),we.current=null),Te.current!==null){let e=S.current;e&&(e.style.display=Te.current),Te.current=null}},De=(e,t)=>{let n=S.current;n&&(Ee(),J(`ios_repaint_schedule`,{delayMs:e,trigger:t,sessionId:oe.current}),Ce.current=window.setTimeout(()=>{Ce.current=null;let e=C.current;e&&e.refresh(0,e.rows-1),J(`ios_repaint_exec`,{trigger:t,hasContent:e?e.buffer.active.length>0:!1,bufferLines:e?.buffer.active.length??0,sessionId:oe.current}),Te.current=n.style.display,n.style.display=`none`,we.current=requestAnimationFrame(()=>{we.current=requestAnimationFrame(()=>{we.current=null,n.style.display=Te.current??``,Te.current=null})})},e))};(0,x.useEffect)(()=>{fe.current=o},[o]),(0,x.useEffect)(()=>{pe.current=n},[n]),(0,x.useEffect)(()=>{me.current=m},[m]);let Oe=(0,x.useCallback)(()=>{let e=C.current;if(!e||!me.current)return;let t=e.buffer.active,n=!I.current&&t.viewportY>=t.baseY;me.current(n)},[]),ke=(0,x.useCallback)(e=>{if(I.current===e)return;I.current=e,ee(e);let t=C.current;t&&e&&t.write(KH),Oe()},[Oe]),Ae=(0,x.useCallback)(()=>{let e=se.current;e&&(B.current!==null&&window.clearTimeout(B.current),B.current=window.setTimeout(()=>{B.current=null,fe.current({type:`tmux-check-copy-mode`,sessionId:e})},150))},[]),je=(0,x.useCallback)(()=>{let e=C.current,t=T.current;if(!e||!t)return;t.fit();let n=oe.current;n&&fe.current({type:`terminal-resize`,sessionId:n,cols:e.cols,rows:e.rows})},[]);return(0,x.useEffect)(()=>{let t=S.current;if(!t||C.current)return;let n=!1;t.innerHTML=``;let r=new KP({fontFamily:f,fontSize:l,lineHeight:((e,t)=>Math.round(e*t)/e)(l,u),letterSpacing:d,scrollback:0,cursorBlink:!1,cursorStyle:`underline`,convertEol:!1,theme:c,screenReaderMode:b,minimumContrastRatio:4.5}),i=new YP;r.loadAddon(i),r.loadAddon(new DB(void 0,new eU({onWriteFailed:re})));let a=new $V;r.loadAddon(a),k.current=a;let o=new yH;r.loadAddon(o),A.current=o;let s=new SH;r.loadAddon(s),j.current=s;let p=()=>{if(!n){if(he.current)try{let t=new Lz;t.onContextLoss(()=>{J(`webgl_context_loss`,{sessionId:e},`info`);try{t.dispose()}catch{}E.current=null}),r.loadAddon(t),E.current=t}catch{}r.open(t),i.fit(),w.current||(w.current=!0,J(`terminal_init`,{isiOS:b,useWebGL:he.current,hasWebGL:!!E.current,userAgent:navigator.userAgent.slice(0,120),platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints},`info`)),m&&r.element&&r.element.appendChild(m)}};document.fonts?.ready?document.fonts.ready.then(p).catch(p):p();let m=null,h=null,g=null;typeof document<`u`&&document.createElement&&(m=document.createElement(`div`),m.className=`xterm-hover`,m.style.cssText=`
197
197
  position: absolute;
198
198
  display: none;
199
199
  z-index: 20;
@@ -207,9 +207,9 @@ ${s.join(`
207
207
  pointer-events: none;
208
208
  max-width: 400px;
209
209
  word-break: break-all;
210
- `,h=document.createElement(`div`),m.appendChild(h),g=document.createElement(`div`),g.style.color=`var(--text-muted)`,g.style.marginTop=`2px`,g.style.fontSize=`11px`,m.appendChild(g),O.current=m);let x=(e,t)=>{if(!r.element||!m||!h||!g)return;let n=VH(t);if(!n)return;let i=r.element.getBoundingClientRect(),a=n.length>60?n.slice(0,57)+`...`:n;h.textContent=a,g.textContent=`${HH()?`⌘`:`Ctrl`}+click to open`,m.style.left=`${e.clientX-i.left+10}px`,m.style.top=`${e.clientY-i.top+10}px`,m.style.display=`block`},M=()=>{m&&(m.style.display=`none`)},P=null,L=!1,ee=null,z={activate:(e,t)=>{if(!L&&(e.metaKey||e.ctrlKey)){let e=VH(t);if(!e)return;window.open(e,`_blank`,`noopener`)}},hover:(e,t)=>{P=VH(t)||null,x(e,t)},leave:()=>{P=null,M()}},te=e=>{P&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.stopPropagation(),L=!0,window.open(P,`_blank`,`noopener`),ee&&clearTimeout(ee),ee=setTimeout(()=>{L=!1},100))};t.addEventListener(`mousedown`,te,!0),r.options.linkHandler=z;let V=new Uz((e,t)=>z.activate(e,t),{urlRegex:LH,hover:(e,t)=>z.hover(e,t),leave:()=>z.leave()});r.loadAddon(V),D.current=V;let ne=null,U=null,ie=HH()?`metaKey`:`ctrlKey`,ae=(e,t)=>{t&&oe.current===e&&se.current===e&&(I.current&&(fe.current({type:`tmux-cancel-copy-mode`,sessionId:e}),Oe(!1)),fe.current({type:`terminal-input`,sessionId:e,data:t}))};r.attachCustomKeyEventHandler(e=>{if(e.type===`keydown`&&/^Digit[1-9]$/.test(e.code)&&Xe(e,qe(H.getState().shortcutModifier)))return!1;if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`c`&&r.hasSelection()){let e=r.getSelection();return e?.trim()&&navigator.clipboard&&navigator.clipboard.writeText(e),!1}if(HH()&&!b&&e.ctrlKey&&!e.metaKey&&e.key.toLowerCase()===`v`&&e.type===`keydown`){let e=se.current;if(e){if(!y())return v.current?.(`Use browser paste or choose a file from this device.`),!1;I.current&&(fe.current({type:`tmux-cancel-copy-mode`,sessionId:e}),Oe(!1)),(async()=>{ae(e,await YH(pe.current,{}))})()}return!e}if(e[ie]&&e.key.toLowerCase()===`v`&&e.type===`keydown`){U!==null&&(clearTimeout(U),U=null),ne=null;let e=new Promise(e=>{U=setTimeout(()=>{U=null,ne=null,e(null)},100),ne=t=>{U!==null&&(clearTimeout(U),U=null),e(t)}});return(async()=>{try{let t=se.current;if(!t)return;let n=await e;if(!n&&_.current)return;let r=n?.text??null;if(r===null)try{r=await navigator.clipboard.readText()}catch{r=``}if(n?.files.length&&_.current){if(oe.current===t&&se.current===t){let e=n.files.map(e=>e.name).join(`
211
- `);_.current({files:n.files,text:r.trim()===e?``:r})}return}if(n?.hasImage&&HH()&&!b){if(!y()){if(n.imageBlob){let e=n.imageBlob;_.current?.({text:``,files:[new File([e],`clipboard.${e.type.split(`/`)[1]||`png`}`,{type:e.type})]})}else v.current?.(`The browser did not provide image data. Choose the file to upload it.`);return}ae(t,await YH(pe.current,{blob:n.imageBlob}));return}if(n?.hasFiles&&!y()){v.current?.(`The browser did not provide file data. Drop the file onto the terminal or choose it to upload.`);return}if((!r||n?.hasFiles)&&HH()&&!b&&y())try{let e=await fetch(`/api/clipboard-file-path`);if(e.ok){let{path:n,isImage:r}=await e.json();if(n){if(r){ae(t,await YH(pe.current,{path:n}));return}ae(t,wH(n)+` `);return}}}catch{}if(r&&!ZH(r)){oe.current===t&&se.current===t&&(I.current&&(fe.current({type:`tmux-cancel-copy-mode`,sessionId:t}),Oe(!1)),fe.current({type:`terminal-paste`,sessionId:t,data:r}));return}HH()&&!b&&y()&&ae(t,await YH(pe.current,{}))}finally{ne=null}})(),!!_.current&&ie===`metaKey`}if(e.ctrlKey&&e.key===`Backspace`&&e.type===`keydown`){let e=se.current;return e&&fe.current({type:`terminal-input`,sessionId:e,data:``}),!1}return!0});let ce=e=>{if(!ne){let t=OH(e.clipboardData),n=e.clipboardData?.getData(`text/plain`)??``;if(!t.length&&!n||!_.current)return;if(e.preventDefault(),e.stopPropagation(),se.current&&se.current===oe.current){let e=t.map(e=>e.name).join(`
212
- `);_.current({text:t.length&&n.trim()===e?``:n,files:t})}return}e.preventDefault(),e.stopPropagation();let t=e.clipboardData?.getData(`text/plain`)??``,n=$H(e.clipboardData),r=n!==null||QH(e.clipboardData),i=ne;ne=null,i({text:t,hasImage:r,hasFiles:(e.clipboardData?.files?.length??0)>0||Array.from(e.clipboardData?.items??[]).some(e=>e.kind===`file`)||Array.from(e.clipboardData?.types??[]).includes(`Files`),imageBlob:n,files:OH(e.clipboardData)})};return t.addEventListener(`paste`,ce,{capture:!0}),r.onData(e=>{let t=se.current;if(t){let n=/^\x1b\[(<[\d;]+[Mm]|[\d;]+M|M[\x20-\xff]{3})$/.test(e);if(I.current&&n)return;I.current&&(fe.current({type:`tmux-cancel-copy-mode`,sessionId:t}),Oe(!1)),fe.current({type:`terminal-input`,sessionId:t,data:e})}}),r.attachCustomWheelEventHandler(e=>{let t=se.current;if(!t||e.target?.closest(`input, textarea, [contenteditable="true"], .xterm-hover`)||r.hasSelection()||e.shiftKey)return!0;F.current+=e.deltaY;let n=r.cols,i=r.rows,a=Math.floor(n/2),o=Math.floor(i/2),s=!1,c=!1;for(;Math.abs(F.current)>=30;){c=!0;let e=F.current>0;F.current+=e?-30:30;let n=e?65:64;e||(s=!0),fe.current({type:`terminal-input`,sessionId:t,data:`\x1b[<${n};${a};${o}M`})}return s&&!R.current&&Oe(!0),c&&!R.current&&ke(),!1}),C.current=r,T.current=i,()=>{if(n=!0,ee&&clearTimeout(ee),P=null,t.removeEventListener(`mousedown`,te,!0),t.removeEventListener(`paste`,ce,!0),U!==null&&(clearTimeout(U),U=null),ne=null,O.current&&=(O.current.remove(),null),D.current){try{D.current.dispose()}catch{}D.current=null}if(E.current){try{E.current.dispose()}catch{}E.current=null}try{r.dispose()}catch{}t&&(t.innerHTML=``),C.current=null,T.current=null,k.current=null,A.current=null,j.current=null,N.current&&window.clearTimeout(N.current),B.current!==null&&window.clearTimeout(B.current)}},[Ae]),(0,x.useEffect)(()=>{C.current&&(C.current.options.theme=c)},[c]),(0,x.useEffect)(()=>{let e=C.current,t=T.current;if(e&&t){e.options.fontFamily=f,e.options.fontSize=l,e.options.lineHeight=Math.round(l*u)/l,e.options.letterSpacing=d,t.fit();let n=oe.current;n&&fe.current({type:`terminal-resize`,sessionId:n,cols:e.cols,rows:e.rows})}},[l,u,d,f]),(0,x.useEffect)(()=>{let e=C.current;if(!e)return;let t=he.current;if(he.current=p,t!==p){if(p){if(!E.current)try{let t=new Lz;t.onContextLoss(()=>{try{t.dispose()}catch{}E.current=null}),e.loadAddon(t),E.current=t}catch{}}else if(E.current){try{E.current.dispose()}catch{}E.current=null}}},[p]),(0,x.useLayoutEffect)(()=>{(se.current!==e||!r||i!==`connected`||le.current>=0&&le.current!==a)&&(se.current=null,e&&r&&i===`connected`&&xe(!0))},[e,r,i,a]),(0,x.useEffect)(()=>{let n=C.current;if(!n)return;let o=oe.current,s=ce.current;if(!r){se.current=null,P.current!==null&&(window.clearTimeout(P.current),P.current=null),o&&(fe.current({type:`terminal-detach`,sessionId:o}),oe.current=null,ce.current=null,le.current=-1,ue.current=null,Oe(!1)),n.reset(),ye.current=!1,xe(!1);return}if(i!==`connected`){se.current=null,P.current!==null&&(window.clearTimeout(P.current),P.current=null),o&&(J(`terminal_detach_on_disconnect`,{connectionStatus:i,prevAttached:o}),oe.current=null,ce.current=null,le.current=-1,ue.current=null,Oe(!1)),IH(),ye.current=!1,xe(!1);return}if(o&&o!==e){se.current=null;try{let e=A.current?.serialize();if(e&&(NH.set(o,e),NH.size>PH)){let e=NH.keys().next().value;e&&NH.delete(e)}}catch{}fe.current({type:`terminal-detach`,sessionId:o}),oe.current=null,ce.current=null,le.current=-1,ue.current=null,Oe(!1)}let c=le.current,l=a!==c;if(e&&(e!==o||t!==s||l)){J(`terminal_attach`,{sessionId:e,tmuxTarget:t,prevAttached:o,prevTarget:s,connectionStatus:i,connectionEpoch:a,attachedEpoch:c});let r=performance.now();ge.current=[],_e.current!==null&&(window.clearTimeout(_e.current),_e.current=null),ve.current!==null&&(window.clearTimeout(ve.current),ve.current=null),ye.current=!0,xe(!0),o!==null&&(se.current=null);let l=NH.get(e);l&&(n.reset(),n.write(l));let u=T.current;u&&u.fit();let d=performance.now();oe.current=e,ce.current=t??null,le.current=a,ue.current=e,de.current=r,P.current!==null&&(window.clearTimeout(P.current),P.current=null);let f={type:`terminal-attach`,sessionId:e,tmuxTarget:t??void 0,cols:n.cols,rows:n.rows},p=o!==null&&o!==e;if(p){let t=e;queueMicrotask(()=>{oe.current===t&&(fe.current(f),fe.current({type:`tmux-check-copy-mode`,sessionId:e}))})}else P.current=window.setTimeout(()=>{P.current=null,fe.current(f),fe.current({type:`tmux-check-copy-mode`,sessionId:e})},50);J(`switch_attach_sent`,{sessionId:e,fitMs:Math.round(d-r),totalMs:Math.round(performance.now()-r),from:o??null,immediate:p})}return e&&e===o&&t===s&&!l&&J(`terminal_attach_skip`,{sessionId:e,prevAttached:o,connectionStatus:i,connectionEpoch:a,attachedEpoch:c}),!e&&o&&(P.current!==null&&(window.clearTimeout(P.current),P.current=null),oe.current=null,ce.current=null,le.current=-1,ue.current=null,se.current=null),()=>{P.current!==null&&(J(`attach_debounce_cancelled`,{sessionId:e,attachedSession:oe.current},`info`),window.clearTimeout(P.current),P.current=null)}},[e,t,r,i,a,De,Oe]),(0,x.useEffect)(()=>{if(ae.current!==null&&(globalThis.clearInterval(ae.current),ae.current=null),!(!e||!r||i!==`connected`))return ae.current=globalThis.setInterval(()=>{oe.current===e&&fe.current({type:`tmux-check-copy-mode`,sessionId:e})},750),()=>{ae.current!==null&&(globalThis.clearInterval(ae.current),ae.current=null)}},[e,r,i]),(0,x.useEffect)(()=>{let e=()=>{_e.current!==null&&(window.clearTimeout(_e.current),_e.current=null),ve.current!==null&&(window.clearTimeout(ve.current),ve.current=null);let e=C.current,t=ge.current;if(!e||t.length===0)return;ge.current=[];let n=t.join(``);ye.current&&=(e.reset(),!1);let r=performance.now(),i=n.length;e.write(n,()=>{let e=Math.round(performance.now()-r);e>50&&J(`switch_write_slow`,{sessionId:oe.current,writeMs:e,bytes:i}),b&&e>50&&J(`ios_write_slow`,{sessionId:oe.current,writeMs:e,bytes:i}),De()})},t=()=>{_e.current!==null&&window.clearTimeout(_e.current),_e.current=window.setTimeout(e,2),ve.current===null&&(ve.current=window.setTimeout(e,16))},n=s(n=>{let r=oe.current;if(n.type===`terminal-output`&&(!r||n.sessionId!==r)&&J(`terminal_output_dropped`,{messageSessionId:n.sessionId,attachedSession:r,bytes:n.data.length,hasSwitchStart:de.current!==null},`info`),n.type===`terminal-output`&&r&&n.sessionId===r){let e=de.current;e&&(J(`switch_first_output`,{sessionId:n.sessionId,serverRoundtripMs:Math.round(performance.now()-e),bytes:n.data.length,parseMs:n._parseMs??-1,rawLength:n._rawLength??-1}),de.current=null),ge.current.push(b?iU(n.data):n.data),t()}if(n.type===`terminal-ready`&&r&&n.sessionId===r){se.current=n.sessionId,ye.current&&ge.current.length>0?e():ye.current&&=(C.current?.reset(),!1),xe(!1);let t=de.current;t&&(J(`switch_ready`,{sessionId:n.sessionId,totalMs:Math.round(performance.now()-t)}),de.current=null),ue.current===n.sessionId&&(C.current?.focus(),ue.current=null),b&&(e(),Ee(50,`terminal-ready`))}if(n.type===`terminal-error`&&r&&(!n.sessionId||n.sessionId===r)&&(se.current=null,ye.current=!1,xe(!1)),n.type===`clipboard-offer`&&r&&n.sessionId===r){let e=n.text;if(!e?.trim())return;if(!b&&navigator.clipboard?.writeText){let t=performance.now();navigator.clipboard.writeText(e).then(()=>{J(`clipboard_write_success`,{source:n.source,chars:e.length,durationMs:Math.round(performance.now()-t)})}).catch(t=>{J(`clipboard_write_failed`,{source:n.source,chars:e.length,error:t instanceof Error?t.message:String(t)},`warn`),re(e,n.source)})}else re(e,n.source)}if(n.type===`tmux-copy-mode-status`&&r&&n.sessionId===r){let e=n.appMouse===!0&&!n.inCopyMode,t=R.current;R.current=e,z.current=n.altScreen===!0,!t&&e&&C.current?.write(GH),Oe(n.inCopyMode)}});return()=>{n(),e(),Te()}},[s,De,Oe,re]),(0,x.useEffect)(()=>{let e=S.current,t=C.current,n=T.current;if(!e||!t||!n)return;let r=()=>{M.current&&window.clearTimeout(M.current),M.current=window.setTimeout(()=>{Ae()},150)},i=new ResizeObserver(r);return i.observe(e),r(),()=>{i.disconnect(),M.current&&window.clearTimeout(M.current)}},[]),(0,x.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=()=>{document.visibilityState!==`hidden`&&J(`terminal_visibility_resume`,{isiOS:b,hasWebGL:!!E.current,useWebGL:he.current,hasTerminal:!!C.current,bufferLines:C.current?.buffer.active.length??0,sessionId:oe.current},`info`)};if(document.addEventListener(`visibilitychange`,e),!b)return()=>{document.removeEventListener(`visibilitychange`,e)};let t=e=>{let t=C.current;if(t&&E.current&&he.current){try{E.current.dispose()}catch{}E.current=null;try{let n=new Lz;n.onContextLoss(()=>{J(`webgl_context_loss`,{sessionId:oe.current},`info`);try{n.dispose()}catch{}E.current=null}),t.loadAddon(n),E.current=n,J(`ios_webgl_recreated`,{trigger:e},`info`)}catch{J(`ios_webgl_recreate_failed`,{trigger:e},`info`)}}},n=()=>{document.visibilityState!==`hidden`&&(t(`visibilitychange`),Ee(200,`visibilitychange`))},r=e=>{e.persisted&&(t(`pageshow`),Ee(200,`pageshow`))},i=()=>{t(`focus`),Ee(200,`focus`)};return document.addEventListener(`visibilitychange`,n),window.addEventListener(`pageshow`,r),window.addEventListener(`focus`,i),()=>{document.removeEventListener(`visibilitychange`,e),document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`pageshow`,r),window.removeEventListener(`focus`,i),Te()}},[]),{containerRef:S,terminalRef:C,searchAddonRef:k,serializeAddonRef:A,progressAddonRef:j,inTmuxCopyModeRef:I,isTmuxCopyMode:L,appMouseRef:R,setTmuxCopyMode:Oe,isSwitching:be,isInputReady:!!e&&r&&i===`connected`&&se.current===e,pendingClipboardOffer:V,copyPendingClipboardOffer:U,dismissPendingClipboardOffer:ie}}function oU(e=`(max-width: 767px)`){let[t,n]=(0,x.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(e).matches);return(0,x.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))},[e]),t}function sU(e,t,n){(0,x.useEffect)(()=>{if(!t)return;let r=t=>{e.current&&!e.current.contains(t.target)&&n()};return document.addEventListener(`mousedown`,r),document.addEventListener(`touchstart`,r),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`touchstart`,r)}},[e,t,n])}function cU(e,t){(0,x.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t])}function lU({enabled:e,isOpen:t,onOpen:n,edgeThresholdPx:r=30,swipeDistancePx:i=50,swipeRatio:a=1.5}){let o=(0,x.useRef)(!1);return(0,x.useEffect)(()=>{if(!e)return;let s=0,c=0,l=!1,u=e=>{if(t)return;let n=e.touches[0];n.clientX<=r?(s=n.clientX,c=n.clientY,l=!0,o.current=!0):l=!1},d=e=>{if(o.current=!1,!l||t)return;let r=e.changedTouches[0],u=r.clientX-s,d=Math.abs(r.clientY-c);u>=i&&u>d*a&&n(),l=!1};return document.addEventListener(`touchstart`,u,{passive:!0}),document.addEventListener(`touchend`,d,{passive:!0}),()=>{o.current=!1,document.removeEventListener(`touchstart`,u),document.removeEventListener(`touchend`,d)}},[e,t,n,r,i,a]),o}var uU=T()(k(e=>({theme:`dark`,setTheme:t=>e({theme:t}),toggleTheme:()=>e(e=>({theme:e.theme===`dark`?`light`:`dark`}))}),{name:`agentboard-theme`,storage:D(()=>M)})),dU={dark:{background:`#2d2d2d`,foreground:`#d4d4d4`,cursor:`#3b82f6`,cursorAccent:`#2d2d2d`,selectionBackground:`rgba(59, 130, 246, 0.35)`,selectionForeground:`#ffffff`,black:`#808080`,red:`#f87171`,green:`#4ade80`,yellow:`#fbbf24`,blue:`#60a5fa`,magenta:`#c084fc`,cyan:`#22d3ee`,white:`#d4d4d4`,brightBlack:`#a0a0a0`,brightRed:`#fca5a5`,brightGreen:`#86efac`,brightYellow:`#fde047`,brightBlue:`#93c5fd`,brightMagenta:`#d8b4fe`,brightCyan:`#67e8f9`,brightWhite:`#ffffff`},light:{background:`#fafafa`,foreground:`#171717`,cursor:`#2563eb`,cursorAccent:`#fafafa`,selectionBackground:`rgba(37, 99, 235, 0.2)`,selectionForeground:`#000000`,black:`#171717`,red:`#dc2626`,green:`#16a34a`,yellow:`#ca8a04`,blue:`#2563eb`,magenta:`#9333ea`,cyan:`#0891b2`,white:`#f5f5f5`,brightBlack:`#737373`,brightRed:`#ef4444`,brightGreen:`#22c55e`,brightYellow:`#eab308`,brightBlue:`#3b82f6`,brightMagenta:`#a855f7`,brightCyan:`#06b6d4`,brightWhite:`#ffffff`}},fU=new WeakSet;function pU(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return!n?.get||!n.set?null:{get:n.get,set:n.set,enumerable:n.enumerable??!0,configurable:n.configurable??!0}}var mU=!1,hU=null,gU=null;function _U(){mU||(mU=!0,!(typeof Node>`u`||typeof HTMLElement>`u`)&&(hU=pU(Node.prototype,`textContent`),gU=pU(HTMLElement.prototype,`innerText`)))}function vU(e){if(fU.has(e))return;fU.add(e);let t=hU?.get;if(t)for(let[n,r]of[[`textContent`,hU],[`innerText`,gU]])r&&Object.defineProperty(e,n,{configurable:r.configurable,enumerable:r.enumerable,get(){return r.get.call(this)},set(e){t.call(this)!==e&&r.set.call(this,e)}})}function yU(e){_U();let t=()=>{for(let t of Array.from(e.children))t instanceof HTMLElement&&vU(t)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0}),()=>n.disconnect()}function bU(e,t){let n=(0,x.useRef)(!1);return(0,x.useEffect)(()=>{if(n.current=!1,t||typeof document>`u`)return;let e=document,r=window,i=e=>{e.key===`Shift`&&(n.current=!0)},a=e=>{e.key===`Shift`&&(n.current=!1)},o=()=>{n.current=!1},s=()=>{e.visibilityState===`hidden`&&o()};return e.addEventListener(`keydown`,i,!0),e.addEventListener(`keyup`,a,!0),e.addEventListener(`focusout`,o,!0),e.addEventListener(`visibilitychange`,s),r.addEventListener(`blur`,o),()=>{o(),e.removeEventListener(`keydown`,i,!0),e.removeEventListener(`keyup`,a,!0),e.removeEventListener(`focusout`,o,!0),e.removeEventListener(`visibilitychange`,s),r.removeEventListener(`blur`,o)}},[e,t]),n}var xU={up:`\x1B[A`,down:`\x1B[B`,left:`\x1B[D`,right:`\x1B[C`},SU={up:`\x1B[1;2A`,down:`\x1B[1;2B`,left:`\x1B[1;2D`,right:`\x1B[1;2C`},CU=44,wU=6,TU=8,EU=10,DU=8,OU=700;3*CU+2*wU+2*TU,2*CU+wU+2*TU;var kU={up:`↑`,down:`↓`,left:`←`,right:`→`},AU={up:`1 / 2 / 2 / 3`,left:`2 / 1 / 3 / 2`,down:`2 / 2 / 3 / 3`,right:`2 / 3 / 3 / 4`};function jU(e=10){typeof navigator<`u`&&`vibrate`in navigator&&navigator.vibrate(e)}function MU(e,t){let n=e.left-t.left+e.width/2,r=DU+160/2,i=t.width-DU-160/2;return r>i?t.width/2:Math.max(r,Math.min(i,n))}function NU({onSendKey:e,disabled:t=!1,onRefocus:n,isKeyboardVisible:r,sessionKey:i=null}){let[a,o]=(0,x.useState)(!1),[s,c]=(0,x.useState)(0),[l,u]=(0,x.useState)(null),d=(0,x.useId)(),f=bU(i,t),p=(0,x.useRef)(null),m=(0,x.useRef)(!1),h=(0,x.useRef)(null),g=(0,x.useRef)(null),_=(0,x.useRef)(null),v=(0,x.useRef)(null),y=(0,x.useRef)(0),b=(0,x.useRef)(e),S=(0,x.useRef)(t);b.current=e,S.current=t;let C=(0,x.useCallback)(()=>{h.current&&=(clearTimeout(h.current),null),g.current&&=(clearInterval(g.current),null),_.current=null,v.current=null},[]),w=(0,x.useCallback)(()=>{C(),u(null)},[C]),T=(0,x.useCallback)(()=>{w(),o(!1),m.current&&n?.()},[w,n]),E=(0,x.useCallback)(()=>{let e=p.current,t=e?.getBoundingClientRect?.(),n=e?.closest?.(`.terminal-controls`)?.getBoundingClientRect?.();if(!t||!n){c(160/2+DU);return}c(MU(t,n))},[]),D=(0,x.useCallback)(()=>{m.current=r?.()??!1,E(),o(!0)},[r,E]),O=(0,x.useCallback)(()=>{t||(jU(),a?T():D())},[t,a,T,D]),k=(0,x.useCallback)(e=>{e.preventDefault(),y.current=Date.now(),O()},[O]),A=(0,x.useCallback)(()=>Date.now()-y.current<OU,[]),j=(0,x.useCallback)(e=>{A()||O()},[A,O]),M=(0,x.useCallback)(e=>{if(S.current)return;let t=f.current?SU:xU;b.current(t[e])},[f]),N=(0,x.useCallback)(e=>{C(),_.current=e,u(e),jU(8),M(e),h.current=setTimeout(()=>{g.current=setInterval(()=>{_.current===e&&(jU(5),M(e))},100)},400)},[C,M]),P=(0,x.useCallback)(e=>n=>{t||(n.preventDefault(),v.current===null&&(n.currentTarget.setPointerCapture?.(n.pointerId),y.current=Date.now(),N(e),v.current=n.pointerId))},[t,N]),F=(0,x.useCallback)(e=>{e.preventDefault(),!(v.current!==null&&e.pointerId!==v.current)&&w()},[w]),I=(0,x.useCallback)(e=>n=>{t||A()||(jU(8),M(e))},[t,A,M]),L=(0,x.useCallback)(e=>{e.preventDefault(),T()},[T]);(0,x.useEffect)(()=>{t&&a&&T()},[t,a,T]);let ee=(0,x.useRef)(i);return(0,x.useEffect)(()=>{ee.current!==i&&(ee.current=i,w())},[i,w]),(0,x.useEffect)(()=>{if(!a)return;let e=p.current?.parentElement;if(e?.addEventListener)return e.addEventListener(`scroll`,E,{passive:!0}),()=>e.removeEventListener(`scroll`,E)},[a,E]),(0,x.useEffect)(()=>C,[C]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{ref:p,type:`button`,"aria-label":`Arrow keys`,"aria-haspopup":`true`,"aria-expanded":a,"aria-controls":a?d:void 0,className:`
210
+ `,h=document.createElement(`div`),m.appendChild(h),g=document.createElement(`div`),g.style.color=`var(--text-muted)`,g.style.marginTop=`2px`,g.style.fontSize=`11px`,m.appendChild(g),O.current=m);let x=(e,t)=>{if(!r.element||!m||!h||!g)return;let n=VH(t);if(!n)return;let i=r.element.getBoundingClientRect(),a=n.length>60?n.slice(0,57)+`...`:n;h.textContent=a,g.textContent=`${HH()?`⌘`:`Ctrl`}+click to open`,m.style.left=`${e.clientX-i.left+10}px`,m.style.top=`${e.clientY-i.top+10}px`,m.style.display=`block`},M=()=>{m&&(m.style.display=`none`)},P=null,L=!1,ee=null,z={activate:(e,t)=>{if(!L&&(e.metaKey||e.ctrlKey)){let e=VH(t);if(!e)return;window.open(e,`_blank`,`noopener`)}},hover:(e,t)=>{P=VH(t)||null,x(e,t)},leave:()=>{P=null,M()}},te=e=>{P&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.stopPropagation(),L=!0,window.open(P,`_blank`,`noopener`),ee&&clearTimeout(ee),ee=setTimeout(()=>{L=!1},100))};t.addEventListener(`mousedown`,te,!0),r.options.linkHandler=z;let V=new Uz((e,t)=>z.activate(e,t),{urlRegex:LH,hover:(e,t)=>z.hover(e,t),leave:()=>z.leave()});r.loadAddon(V),D.current=V;let ne=null,U=null,ie=HH()?`metaKey`:`ctrlKey`,ae=(e,t)=>{t&&oe.current===e&&se.current===e&&(I.current&&(fe.current({type:`tmux-cancel-copy-mode`,sessionId:e}),ke(!1)),fe.current({type:`terminal-input`,sessionId:e,data:t}))};r.attachCustomKeyEventHandler(e=>{if(e.type===`keydown`&&/^Digit[1-9]$/.test(e.code)&&Xe(e,qe(H.getState().shortcutModifier)))return!1;if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`c`&&r.hasSelection()){let e=r.getSelection();return e?.trim()&&navigator.clipboard&&navigator.clipboard.writeText(e),!1}if(HH()&&!b&&e.ctrlKey&&!e.metaKey&&e.key.toLowerCase()===`v`&&e.type===`keydown`){let e=se.current;if(e){if(!y())return v.current?.(`Use browser paste or choose a file from this device.`),!1;I.current&&(fe.current({type:`tmux-cancel-copy-mode`,sessionId:e}),ke(!1)),(async()=>{ae(e,await YH(pe.current,{}))})()}return!e}if(e[ie]&&e.key.toLowerCase()===`v`&&e.type===`keydown`){U!==null&&(clearTimeout(U),U=null),ne=null;let e=new Promise(e=>{U=setTimeout(()=>{U=null,ne=null,e(null)},100),ne=t=>{U!==null&&(clearTimeout(U),U=null),e(t)}});return(async()=>{try{let t=se.current;if(!t)return;let n=await e;if(!n&&_.current)return;let r=n?.text??null;if(r===null)try{r=await navigator.clipboard.readText()}catch{r=``}if(n?.files.length&&_.current){if(oe.current===t&&se.current===t){let e=n.files.map(e=>e.name).join(`
211
+ `);_.current({files:n.files,text:r.trim()===e?``:r})}return}if(n?.hasImage&&HH()&&!b){if(!y()){if(n.imageBlob){let e=n.imageBlob;_.current?.({text:``,files:[new File([e],`clipboard.${e.type.split(`/`)[1]||`png`}`,{type:e.type})]})}else v.current?.(`The browser did not provide image data. Choose the file to upload it.`);return}ae(t,await YH(pe.current,{blob:n.imageBlob}));return}if(n?.hasFiles&&!y()){v.current?.(`The browser did not provide file data. Drop the file onto the terminal or choose it to upload.`);return}if((!r||n?.hasFiles)&&HH()&&!b&&y())try{let e=await fetch(`/api/clipboard-file-path`);if(e.ok){let{path:n,isImage:r}=await e.json();if(n){if(r){ae(t,await YH(pe.current,{path:n}));return}ae(t,wH(n)+` `);return}}}catch{}if(r&&!ZH(r)){oe.current===t&&se.current===t&&(I.current&&(fe.current({type:`tmux-cancel-copy-mode`,sessionId:t}),ke(!1)),fe.current({type:`terminal-paste`,sessionId:t,data:r}));return}HH()&&!b&&y()&&ae(t,await YH(pe.current,{}))}finally{ne=null}})(),!!_.current&&ie===`metaKey`}if(e.ctrlKey&&e.key===`Backspace`&&e.type===`keydown`){let e=se.current;return e&&fe.current({type:`terminal-input`,sessionId:e,data:``}),!1}return!0});let ce=e=>{if(!ne){let t=OH(e.clipboardData),n=e.clipboardData?.getData(`text/plain`)??``;if(!t.length&&!n||!_.current)return;if(e.preventDefault(),e.stopPropagation(),se.current&&se.current===oe.current){let e=t.map(e=>e.name).join(`
212
+ `);_.current({text:t.length&&n.trim()===e?``:n,files:t})}return}e.preventDefault(),e.stopPropagation();let t=e.clipboardData?.getData(`text/plain`)??``,n=$H(e.clipboardData),r=n!==null||QH(e.clipboardData),i=ne;ne=null,i({text:t,hasImage:r,hasFiles:(e.clipboardData?.files?.length??0)>0||Array.from(e.clipboardData?.items??[]).some(e=>e.kind===`file`)||Array.from(e.clipboardData?.types??[]).includes(`Files`),imageBlob:n,files:OH(e.clipboardData)})};return t.addEventListener(`paste`,ce,{capture:!0}),r.onData(e=>{let t=se.current;if(t){let n=/^\x1b\[(<[\d;]+[Mm]|[\d;]+M|M[\x20-\xff]{3})$/.test(e);if(I.current&&n)return;I.current&&(fe.current({type:`tmux-cancel-copy-mode`,sessionId:t}),ke(!1)),fe.current({type:`terminal-input`,sessionId:t,data:e})}}),r.attachCustomWheelEventHandler(e=>{let t=se.current;if(!t||e.target?.closest(`input, textarea, [contenteditable="true"], .xterm-hover`)||r.hasSelection()||e.shiftKey)return!0;F.current+=e.deltaY;let n=r.cols,i=r.rows,a=Math.floor(n/2),o=Math.floor(i/2),s=!1,c=!1;for(;Math.abs(F.current)>=30;){c=!0;let e=F.current>0;F.current+=e?-30:30;let n=e?65:64;e||(s=!0),fe.current({type:`terminal-input`,sessionId:t,data:`\x1b[<${n};${a};${o}M`})}return s&&!R.current&&ke(!0),c&&!R.current&&Ae(),!1}),C.current=r,T.current=i,()=>{if(n=!0,ee&&clearTimeout(ee),P=null,t.removeEventListener(`mousedown`,te,!0),t.removeEventListener(`paste`,ce,!0),U!==null&&(clearTimeout(U),U=null),ne=null,O.current&&=(O.current.remove(),null),D.current){try{D.current.dispose()}catch{}D.current=null}if(E.current){try{E.current.dispose()}catch{}E.current=null}try{r.dispose()}catch{}t&&(t.innerHTML=``),C.current=null,T.current=null,k.current=null,A.current=null,j.current=null,N.current&&window.clearTimeout(N.current),B.current!==null&&window.clearTimeout(B.current)}},[je]),(0,x.useEffect)(()=>{C.current&&(C.current.options.theme=c)},[c]),(0,x.useEffect)(()=>{let e=C.current,t=T.current;if(e&&t){e.options.fontFamily=f,e.options.fontSize=l,e.options.lineHeight=Math.round(l*u)/l,e.options.letterSpacing=d,t.fit();let n=oe.current;n&&fe.current({type:`terminal-resize`,sessionId:n,cols:e.cols,rows:e.rows})}},[l,u,d,f]),(0,x.useEffect)(()=>{let e=C.current;if(!e)return;let t=he.current;if(he.current=p,t!==p){if(p){if(!E.current)try{let t=new Lz;t.onContextLoss(()=>{try{t.dispose()}catch{}E.current=null}),e.loadAddon(t),E.current=t}catch{}}else if(E.current){try{E.current.dispose()}catch{}E.current=null}}},[p]),(0,x.useLayoutEffect)(()=>{(se.current!==e||!r||i!==`connected`||le.current>=0&&le.current!==a)&&(se.current=null,e&&r&&i===`connected`&&Se(!0))},[e,r,i,a]),(0,x.useEffect)(()=>{let n=C.current;if(!n)return;let o=oe.current,s=ce.current;if(!r){se.current=null,P.current!==null&&(window.clearTimeout(P.current),P.current=null),o&&(fe.current({type:`terminal-detach`,sessionId:o}),oe.current=null,ce.current=null,le.current=-1,ue.current=null,ke(!1)),n.reset(),be.current=!1,Se(!1);return}if(i!==`connected`){se.current=null,P.current!==null&&(window.clearTimeout(P.current),P.current=null),o&&(J(`terminal_detach_on_disconnect`,{connectionStatus:i,prevAttached:o}),oe.current=null,ce.current=null,le.current=-1,ue.current=null,ke(!1)),IH(),be.current=!1,Se(!1);return}if(o&&o!==e){se.current=null;try{let e=A.current?.serialize();if(e&&(NH.set(o,e),NH.size>PH)){let e=NH.keys().next().value;e&&NH.delete(e)}}catch{}fe.current({type:`terminal-detach`,sessionId:o}),oe.current=null,ce.current=null,le.current=-1,ue.current=null,ke(!1)}let c=le.current,l=a!==c;if(e&&(e!==o||t!==s||l)){J(`terminal_attach`,{sessionId:e,tmuxTarget:t,prevAttached:o,prevTarget:s,connectionStatus:i,connectionEpoch:a,attachedEpoch:c});let r=performance.now();ge.current=[],_e.current!==null&&(window.clearTimeout(_e.current),_e.current=null),ve.current!==null&&(window.clearTimeout(ve.current),ve.current=null),be.current=!0,Se(!0),o!==null&&(se.current=null);let l=NH.get(e);l&&(n.reset(),n.write(l));let u=T.current;u&&u.fit();let d=performance.now();oe.current=e,ce.current=t??null,le.current=a,ue.current=e,de.current=r,P.current!==null&&(window.clearTimeout(P.current),P.current=null);let f={type:`terminal-attach`,sessionId:e,tmuxTarget:t??void 0,cols:n.cols,rows:n.rows},p=o!==null&&o!==e;if(p){let t=e;queueMicrotask(()=>{oe.current===t&&(fe.current(f),fe.current({type:`tmux-check-copy-mode`,sessionId:e}))})}else P.current=window.setTimeout(()=>{P.current=null,fe.current(f),fe.current({type:`tmux-check-copy-mode`,sessionId:e})},50);J(`switch_attach_sent`,{sessionId:e,fitMs:Math.round(d-r),totalMs:Math.round(performance.now()-r),from:o??null,immediate:p})}return e&&e===o&&t===s&&!l&&J(`terminal_attach_skip`,{sessionId:e,prevAttached:o,connectionStatus:i,connectionEpoch:a,attachedEpoch:c}),!e&&o&&(P.current!==null&&(window.clearTimeout(P.current),P.current=null),oe.current=null,ce.current=null,le.current=-1,ue.current=null,se.current=null),()=>{P.current!==null&&(J(`attach_debounce_cancelled`,{sessionId:e,attachedSession:oe.current},`info`),window.clearTimeout(P.current),P.current=null)}},[e,t,r,i,a,Oe,ke]),(0,x.useEffect)(()=>{if(ae.current!==null&&(globalThis.clearInterval(ae.current),ae.current=null),!(!e||!r||i!==`connected`))return ae.current=globalThis.setInterval(()=>{oe.current===e&&fe.current({type:`tmux-check-copy-mode`,sessionId:e})},750),()=>{ae.current!==null&&(globalThis.clearInterval(ae.current),ae.current=null)}},[e,r,i]),(0,x.useEffect)(()=>{let e=()=>{_e.current!==null&&(window.clearTimeout(_e.current),_e.current=null),ve.current!==null&&(window.clearTimeout(ve.current),ve.current=null);let e=C.current,t=ge.current;if(!e||t.length===0)return;ge.current=[];let n=t.join(``);be.current&&=(e.reset(),!1);let r=performance.now(),i=n.length;e.write(n,()=>{let e=Math.round(performance.now()-r);e>50&&J(`switch_write_slow`,{sessionId:oe.current,writeMs:e,bytes:i}),b&&e>50&&J(`ios_write_slow`,{sessionId:oe.current,writeMs:e,bytes:i}),Oe()})},t=()=>{_e.current!==null&&window.clearTimeout(_e.current),_e.current=window.setTimeout(e,2),ve.current===null&&(ve.current=window.setTimeout(e,16))},n=()=>{let e=ye.current;e.timer=null,e.count!==0&&(J(`terminal_output_dropped`,{messageSessionId:e.lastMessageSessionId,attachedSession:oe.current,drops:e.count,bytes:e.bytes,hasSwitchStart:de.current!==null},`info`),e.count=0,e.bytes=0,e.lastEmit=performance.now())},r=s(r=>{let i=oe.current;if(r.type===`terminal-output`&&(!i||r.sessionId!==i)){let e=ye.current;e.count+=1,e.bytes+=r.data.length,e.lastMessageSessionId=r.sessionId;let t=performance.now();t-e.lastEmit>=1e3?n():e.timer===null&&(e.timer=window.setTimeout(n,1e3-(t-e.lastEmit)))}if(r.type===`terminal-output`&&i&&r.sessionId===i){let e=de.current;e&&(J(`switch_first_output`,{sessionId:r.sessionId,serverRoundtripMs:Math.round(performance.now()-e),bytes:r.data.length,parseMs:r._parseMs??-1,rawLength:r._rawLength??-1}),de.current=null),ge.current.push(b?iU(r.data):r.data),t()}if(r.type===`terminal-ready`&&i&&r.sessionId===i){se.current=r.sessionId,be.current&&ge.current.length>0?e():be.current&&=(C.current?.reset(),!1),Se(!1);let t=de.current;t&&(J(`switch_ready`,{sessionId:r.sessionId,totalMs:Math.round(performance.now()-t)}),de.current=null),ue.current===r.sessionId&&(C.current?.focus(),ue.current=null),b&&(e(),De(50,`terminal-ready`))}if(r.type===`terminal-error`&&i&&(!r.sessionId||r.sessionId===i)&&(se.current=null,be.current=!1,Se(!1)),r.type===`clipboard-offer`&&i&&r.sessionId===i){let e=r.text;if(!e?.trim())return;if(!b&&navigator.clipboard?.writeText){let t=performance.now();navigator.clipboard.writeText(e).then(()=>{J(`clipboard_write_success`,{source:r.source,chars:e.length,durationMs:Math.round(performance.now()-t)})}).catch(t=>{J(`clipboard_write_failed`,{source:r.source,chars:e.length,error:t instanceof Error?t.message:String(t)},`warn`),re(e,r.source)})}else re(e,r.source)}if(r.type===`tmux-copy-mode-status`&&i&&r.sessionId===i){let e=r.appMouse===!0&&!r.inCopyMode,t=R.current;R.current=e,z.current=r.altScreen===!0,!t&&e&&C.current?.write(GH),ke(r.inCopyMode)}});return()=>{r(),e(),Ee(),ye.current.timer!==null&&window.clearTimeout(ye.current.timer),n()}},[s,Oe,ke,re]),(0,x.useEffect)(()=>{let e=S.current,t=C.current,n=T.current;if(!e||!t||!n)return;let r=()=>{M.current&&window.clearTimeout(M.current),M.current=window.setTimeout(()=>{je()},150)},i=new ResizeObserver(r);return i.observe(e),r(),()=>{i.disconnect(),M.current&&window.clearTimeout(M.current)}},[]),(0,x.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=()=>{document.visibilityState!==`hidden`&&J(`terminal_visibility_resume`,{isiOS:b,hasWebGL:!!E.current,useWebGL:he.current,hasTerminal:!!C.current,bufferLines:C.current?.buffer.active.length??0,sessionId:oe.current},`info`)};if(document.addEventListener(`visibilitychange`,e),!b)return()=>{document.removeEventListener(`visibilitychange`,e)};let t=e=>{let t=C.current;if(t&&E.current&&he.current){try{E.current.dispose()}catch{}E.current=null;try{let n=new Lz;n.onContextLoss(()=>{J(`webgl_context_loss`,{sessionId:oe.current},`info`);try{n.dispose()}catch{}E.current=null}),t.loadAddon(n),E.current=n,J(`ios_webgl_recreated`,{trigger:e},`info`)}catch{J(`ios_webgl_recreate_failed`,{trigger:e},`info`)}}},n=()=>{document.visibilityState!==`hidden`&&(t(`visibilitychange`),De(200,`visibilitychange`))},r=e=>{e.persisted&&(t(`pageshow`),De(200,`pageshow`))},i=()=>{t(`focus`),De(200,`focus`)};return document.addEventListener(`visibilitychange`,n),window.addEventListener(`pageshow`,r),window.addEventListener(`focus`,i),()=>{document.removeEventListener(`visibilitychange`,e),document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`pageshow`,r),window.removeEventListener(`focus`,i),Ee()}},[]),{containerRef:S,terminalRef:C,searchAddonRef:k,serializeAddonRef:A,progressAddonRef:j,inTmuxCopyModeRef:I,isTmuxCopyMode:L,appMouseRef:R,setTmuxCopyMode:ke,isSwitching:xe,isInputReady:!!e&&r&&i===`connected`&&se.current===e,pendingClipboardOffer:V,copyPendingClipboardOffer:U,dismissPendingClipboardOffer:ie}}function oU(e=`(max-width: 767px)`){let[t,n]=(0,x.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(e).matches);return(0,x.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))},[e]),t}function sU(e,t,n){(0,x.useEffect)(()=>{if(!t)return;let r=t=>{e.current&&!e.current.contains(t.target)&&n()};return document.addEventListener(`mousedown`,r),document.addEventListener(`touchstart`,r),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`touchstart`,r)}},[e,t,n])}function cU(e,t){(0,x.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t])}function lU({enabled:e,isOpen:t,onOpen:n,edgeThresholdPx:r=30,swipeDistancePx:i=50,swipeRatio:a=1.5}){let o=(0,x.useRef)(!1);return(0,x.useEffect)(()=>{if(!e)return;let s=0,c=0,l=!1,u=e=>{if(t)return;let n=e.touches[0];n.clientX<=r?(s=n.clientX,c=n.clientY,l=!0,o.current=!0):l=!1},d=e=>{if(o.current=!1,!l||t)return;let r=e.changedTouches[0],u=r.clientX-s,d=Math.abs(r.clientY-c);u>=i&&u>d*a&&n(),l=!1};return document.addEventListener(`touchstart`,u,{passive:!0}),document.addEventListener(`touchend`,d,{passive:!0}),()=>{o.current=!1,document.removeEventListener(`touchstart`,u),document.removeEventListener(`touchend`,d)}},[e,t,n,r,i,a]),o}var uU=T()(k(e=>({theme:`dark`,setTheme:t=>e({theme:t}),toggleTheme:()=>e(e=>({theme:e.theme===`dark`?`light`:`dark`}))}),{name:`agentboard-theme`,storage:D(()=>M)})),dU={dark:{background:`#2d2d2d`,foreground:`#d4d4d4`,cursor:`#3b82f6`,cursorAccent:`#2d2d2d`,selectionBackground:`rgba(59, 130, 246, 0.35)`,selectionForeground:`#ffffff`,black:`#808080`,red:`#f87171`,green:`#4ade80`,yellow:`#fbbf24`,blue:`#60a5fa`,magenta:`#c084fc`,cyan:`#22d3ee`,white:`#d4d4d4`,brightBlack:`#a0a0a0`,brightRed:`#fca5a5`,brightGreen:`#86efac`,brightYellow:`#fde047`,brightBlue:`#93c5fd`,brightMagenta:`#d8b4fe`,brightCyan:`#67e8f9`,brightWhite:`#ffffff`},light:{background:`#fafafa`,foreground:`#171717`,cursor:`#2563eb`,cursorAccent:`#fafafa`,selectionBackground:`rgba(37, 99, 235, 0.2)`,selectionForeground:`#000000`,black:`#171717`,red:`#dc2626`,green:`#16a34a`,yellow:`#ca8a04`,blue:`#2563eb`,magenta:`#9333ea`,cyan:`#0891b2`,white:`#f5f5f5`,brightBlack:`#737373`,brightRed:`#ef4444`,brightGreen:`#22c55e`,brightYellow:`#eab308`,brightBlue:`#3b82f6`,brightMagenta:`#a855f7`,brightCyan:`#06b6d4`,brightWhite:`#ffffff`}},fU=new WeakSet;function pU(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return!n?.get||!n.set?null:{get:n.get,set:n.set,enumerable:n.enumerable??!0,configurable:n.configurable??!0}}var mU=!1,hU=null,gU=null;function _U(){mU||(mU=!0,!(typeof Node>`u`||typeof HTMLElement>`u`)&&(hU=pU(Node.prototype,`textContent`),gU=pU(HTMLElement.prototype,`innerText`)))}function vU(e){if(fU.has(e))return;fU.add(e);let t=hU?.get;if(t)for(let[n,r]of[[`textContent`,hU],[`innerText`,gU]])r&&Object.defineProperty(e,n,{configurable:r.configurable,enumerable:r.enumerable,get(){return r.get.call(this)},set(e){t.call(this)!==e&&r.set.call(this,e)}})}function yU(e){_U();let t=()=>{for(let t of Array.from(e.children))t instanceof HTMLElement&&vU(t)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0}),()=>n.disconnect()}function bU(e,t){let n=(0,x.useRef)(!1);return(0,x.useEffect)(()=>{if(n.current=!1,t||typeof document>`u`)return;let e=document,r=window,i=e=>{e.key===`Shift`&&(n.current=!0)},a=e=>{e.key===`Shift`&&(n.current=!1)},o=()=>{n.current=!1},s=()=>{e.visibilityState===`hidden`&&o()};return e.addEventListener(`keydown`,i,!0),e.addEventListener(`keyup`,a,!0),e.addEventListener(`focusout`,o,!0),e.addEventListener(`visibilitychange`,s),r.addEventListener(`blur`,o),()=>{o(),e.removeEventListener(`keydown`,i,!0),e.removeEventListener(`keyup`,a,!0),e.removeEventListener(`focusout`,o,!0),e.removeEventListener(`visibilitychange`,s),r.removeEventListener(`blur`,o)}},[e,t]),n}var xU={up:`\x1B[A`,down:`\x1B[B`,left:`\x1B[D`,right:`\x1B[C`},SU={up:`\x1B[1;2A`,down:`\x1B[1;2B`,left:`\x1B[1;2D`,right:`\x1B[1;2C`},CU=44,wU=6,TU=8,EU=10,DU=8,OU=700;3*CU+2*wU+2*TU,2*CU+wU+2*TU;var kU={up:`↑`,down:`↓`,left:`←`,right:`→`},AU={up:`1 / 2 / 2 / 3`,left:`2 / 1 / 3 / 2`,down:`2 / 2 / 3 / 3`,right:`2 / 3 / 3 / 4`};function jU(e=10){typeof navigator<`u`&&`vibrate`in navigator&&navigator.vibrate(e)}function MU(e,t){let n=e.left-t.left+e.width/2,r=DU+160/2,i=t.width-DU-160/2;return r>i?t.width/2:Math.max(r,Math.min(i,n))}function NU({onSendKey:e,disabled:t=!1,onRefocus:n,isKeyboardVisible:r,sessionKey:i=null}){let[a,o]=(0,x.useState)(!1),[s,c]=(0,x.useState)(0),[l,u]=(0,x.useState)(null),d=(0,x.useId)(),f=bU(i,t),p=(0,x.useRef)(null),m=(0,x.useRef)(!1),h=(0,x.useRef)(null),g=(0,x.useRef)(null),_=(0,x.useRef)(null),v=(0,x.useRef)(null),y=(0,x.useRef)(0),b=(0,x.useRef)(e),S=(0,x.useRef)(t);b.current=e,S.current=t;let C=(0,x.useCallback)(()=>{h.current&&=(clearTimeout(h.current),null),g.current&&=(clearInterval(g.current),null),_.current=null,v.current=null},[]),w=(0,x.useCallback)(()=>{C(),u(null)},[C]),T=(0,x.useCallback)(()=>{w(),o(!1),m.current&&n?.()},[w,n]),E=(0,x.useCallback)(()=>{let e=p.current,t=e?.getBoundingClientRect?.(),n=e?.closest?.(`.terminal-controls`)?.getBoundingClientRect?.();if(!t||!n){c(160/2+DU);return}c(MU(t,n))},[]),D=(0,x.useCallback)(()=>{m.current=r?.()??!1,E(),o(!0)},[r,E]),O=(0,x.useCallback)(()=>{t||(jU(),a?T():D())},[t,a,T,D]),k=(0,x.useCallback)(e=>{e.preventDefault(),y.current=Date.now(),O()},[O]),A=(0,x.useCallback)(()=>Date.now()-y.current<OU,[]),j=(0,x.useCallback)(e=>{A()||O()},[A,O]),M=(0,x.useCallback)(e=>{if(S.current)return;let t=f.current?SU:xU;b.current(t[e])},[f]),N=(0,x.useCallback)(e=>{C(),_.current=e,u(e),jU(8),M(e),h.current=setTimeout(()=>{g.current=setInterval(()=>{_.current===e&&(jU(5),M(e))},100)},400)},[C,M]),P=(0,x.useCallback)(e=>n=>{t||(n.preventDefault(),v.current===null&&(n.currentTarget.setPointerCapture?.(n.pointerId),y.current=Date.now(),N(e),v.current=n.pointerId))},[t,N]),F=(0,x.useCallback)(e=>{e.preventDefault(),!(v.current!==null&&e.pointerId!==v.current)&&w()},[w]),I=(0,x.useCallback)(e=>n=>{t||A()||(jU(8),M(e))},[t,A,M]),L=(0,x.useCallback)(e=>{e.preventDefault(),T()},[T]);(0,x.useEffect)(()=>{t&&a&&T()},[t,a,T]);let ee=(0,x.useRef)(i);return(0,x.useEffect)(()=>{ee.current!==i&&(ee.current=i,w())},[i,w]),(0,x.useEffect)(()=>{if(!a)return;let e=p.current?.parentElement;if(e?.addEventListener)return e.addEventListener(`scroll`,E,{passive:!0}),()=>e.removeEventListener(`scroll`,E)},[a,E]),(0,x.useEffect)(()=>C,[C]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{ref:p,type:`button`,"aria-label":`Arrow keys`,"aria-haspopup":`true`,"aria-expanded":a,"aria-controls":a?d:void 0,className:`
213
213
  terminal-key
214
214
  flex items-center justify-center
215
215
  size-[44px] p-0
@@ -303,4 +303,4 @@ ${s.join(`
303
303
  active:scale-95 transition-all duration-75
304
304
  select-none touch-manipulation
305
305
  ${r?pW[t.status]:fW[t.status]}
306
- `,onClick:()=>{mW(),u(t.id)},title:lt?t.name:void 0,children:i},t.id)})})]}),(0,W.jsxs)(`div`,{className:`relative flex-1`,children:[(0,W.jsx)(`div`,{ref:we,className:`absolute inset-0`,style:{backgroundColor:S.background}}),Me&&e&&(0,W.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-2 z-50 flex items-center gap-1.5 rounded-lg bg-black/60 px-2.5 py-1.5 text-xs text-white/90 shadow-lg backdrop-blur-md`,children:[(0,W.jsxs)(`svg`,{className:`h-3 w-3 animate-spin`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,W.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,W.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]}),`Loading`]}),Fe&&e&&(0,W.jsxs)(`div`,{className:`absolute ${j&&!N?`bottom-20`:`bottom-8`} left-1/2 z-30 flex max-w-[calc(100%-2rem)] -translate-x-1/2 items-center gap-2 rounded-lg border border-border bg-elevated/95 px-2 py-2 shadow-lg backdrop-blur-sm md:left-auto md:right-4 md:translate-x-0`,children:[(0,W.jsx)(`span`,{className:`max-w-[12rem] truncate text-xs text-secondary md:max-w-[18rem]`,children:`Selection ready`}),(0,W.jsxs)(`button`,{type:`button`,onClick:Ie,className:`flex h-8 shrink-0 items-center justify-center gap-1.5 rounded bg-accent px-2.5 text-xs font-medium text-white hover:bg-accent/90 active:scale-95 transition-all`,title:`Copy selection`,"aria-label":`Copy selection`,children:[(0,W.jsx)(de,{width:14,height:14}),`Copy`]}),(0,W.jsx)(`button`,{type:`button`,onClick:Re,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,W.jsx)(Ue,{width:14,height:14})})]}),!e&&(0,W.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-muted`,children:n?null:`Select a session to view terminal`}),e&&ve&&(0,W.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-center text-sm text-muted`,children:`Remote session (read-only). Use SSH to attach on the host.`}),n&&(0,W.jsx)(`div`,{className:`absolute inset-0 z-10 overflow-y-auto bg-base`,children:(0,W.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col gap-4 p-4 md:p-6`,children:[(0,W.jsx)(`div`,{className:`border-b border-border pb-4`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,W.jsx)(`h2`,{className:`min-w-0 truncate text-lg font-semibold text-primary`,children:be}),(0,W.jsx)(`span`,{className:`rounded-full bg-blue-500/15 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),xe&&(0,W.jsx)(`span`,{className:`text-muted`,children:xe}),(0,W.jsxs)(`span`,{className:`text-muted`,children:[`Last active `,Se]})]}),n.lastResumeError&&(0,W.jsxs)(`div`,{className:`inline-flex items-center gap-1 rounded bg-amber-500/15 px-2 py-1 text-xs text-amber-400`,title:`Last wake failed: ${n.lastResumeError}`,children:[(0,W.jsx)(ae,{width:12,height:12}),`Last wake failed`]}),n.lastUserMessage&&(0,W.jsx)(`p`,{className:`max-h-28 max-w-3xl overflow-y-auto whitespace-pre-wrap break-words pr-2 text-sm leading-6 text-secondary`,children:n.lastUserMessage})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>h(n.sessionId),className:`btn btn-primary hidden md:inline-flex`,children:`Wake`}),_&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>_(n.sessionId),className:`btn btn-secondary`,children:`Move to History`})]})]})}),(0,W.jsx)(fE,{session:n})]})}),ke&&e&&!N?(0,W.jsxs)(`button`,{type:`button`,onClick:ze,className:`absolute bottom-14 left-1/2 z-20 flex h-10 items-center justify-center overflow-hidden rounded-full border border-amber-400/35 bg-amber-500/20 text-amber-100 shadow-lg backdrop-blur-sm transition-all hover:bg-amber-500/30 active:scale-95 md:bottom-8`,style:{transform:`translateX(-50%)`},title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,W.jsx)(`span`,{className:`px-3 text-[11px] font-semibold uppercase tracking-wide`,children:`Copy mode`}),(0,W.jsx)(`span`,{className:`self-stretch border-l border-amber-400/25`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`px-3 text-sm font-medium`,children:`Exit`})]}):j&&e&&!N?(0,W.jsxs)(`button`,{type:`button`,onClick:ze,className:`absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all`,style:{transform:`translateX(-50%)`},title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M12 5v14M5 12l7 7 7-7`})}),(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`Jump to bottom`})]}):null]}),(0,W.jsx)(JU,{...ot}),e&&(0,W.jsx)(cW,{onSendKey:nt,onPasteText:rt,onPasteImage:it,disabled:a!==`connected`||ve||!Pe,sessions:t.map(e=>({id:e.id,name:e.name,status:e.status})),currentSessionId:e.id,agentType:e.agentType,fileUploadsAllowed:!fe,onSelectSession:u,hideSessionSwitcher:!0,onRefocus:at,isKeyboardVisible:ct,onEnterTextMode:st}),(A||k)&&(0,W.jsx)(lW,{isOpen:z,onClose:()=>B(!1),sessions:t,hibernatingSessions:r,historySessions:i,selectedSessionId:e?.id??null,selectedHibernatingSessionId:n?.sessionId??null,onSelect:u,onSelectHibernating:d,onRename:m,onResume:h,onHibernate:g,onMoveToHistory:_,onNewSession:f,loading:y,error:b}),F&&e&&(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,children:(0,W.jsxs)(`div`,{className:`mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl`,children:[(0,W.jsx)(`h3`,{className:`text-base font-medium text-primary mb-2 text-balance`,children:`Kill Session`}),(0,W.jsxs)(`p`,{className:`text-sm text-secondary mb-4 text-pretty`,children:[`Kill "`,e.agentSessionName||e.name,`"? The process will be terminated. Conversation history is preserved in logs.`]}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,W.jsx)(`button`,{onClick:()=>I(!1),className:`btn py-1.5 px-3 text-sm`,children:`Cancel`}),(0,W.jsx)(`button`,{ref:ce,onClick:He,className:`btn btn-danger py-1.5 px-3 text-sm`,children:`Kill Session`})]})]})})]})}function gW({onSelect:e,onCancel:t,initialPath:n}){let[r,i]=(0,x.useState)(n||`~`),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(!0),[d,f]=(0,x.useState)(-1),p=(0,x.useRef)(null),m=H(e=>e.recentPaths),h=(0,x.useCallback)(async e=>{p.current?.abort();let t=new AbortController;p.current=t;let{signal:n}=t;u(!0),c(null),o(null),f(-1),i(e);try{let r=await fetch(`/api/directories?path=${encodeURIComponent(e)}`,{signal:n});if(!r.ok){let e=await r.json();throw Error(e.message||`Failed to load directory`)}let a=await r.json();if(p.current!==t)return;o(a),i(a.path)}catch(e){if(p.current!==t)return;let n=e;n?.name!==`AbortError`&&c(n?.message||`Failed to load directory`)}finally{p.current===t&&u(!1)}},[]);(0,x.useEffect)(()=>(h(n||`~`),()=>{p.current?.abort()}),[h,n]);let g=a?.directories??[],_=a?.path||r,v=a?.parent;return(0,x.useEffect)(()=>{let n=n=>{if(n.key===`Escape`){n.preventDefault(),t();return}if(!l){if(n.key===`ArrowDown`){n.preventDefault(),f(e=>g.length===0?-1:e<0?0:Math.min(e+1,g.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),f(e=>g.length===0?-1:e<0?g.length-1:Math.max(e-1,0));return}if(n.key===`Enter`){n.preventDefault();let t=g[d];t?h(t.path):_&&e(_);return}n.key===`Backspace`&&v&&(n.preventDefault(),h(v))}};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[g,_,h,d,l,t,e,v]),(0,W.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Directory browser`,className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},"data-testid":`directory-browser`,children:(0,W.jsxs)(`div`,{className:`w-full max-w-lg border border-border bg-elevated p-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border pb-2`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{v&&h(v)},disabled:!v||l,children:`Up`}),(0,W.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-xs font-mono text-secondary`,title:_,"data-testid":`directory-current-path`,children:_})]}),(0,W.jsx)(`div`,{className:`mt-3 max-h-60 overflow-y-auto border border-border bg-surface`,children:l?(0,W.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-loading`,children:`Loading directories...`}):s?(0,W.jsxs)(`div`,{className:`px-3 py-4 text-xs`,"data-testid":`directory-error`,children:[(0,W.jsx)(`p`,{className:`text-danger`,children:s}),(0,W.jsx)(`button`,{type:`button`,className:`btn mt-3`,onClick:()=>h(r),children:`Retry`})]}):g.length===0?(0,W.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-empty`,children:`No subdirectories`}):(0,W.jsx)(`div`,{className:`py-1`,children:g.map((e,t)=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>h(e.path),onMouseEnter:()=>f(t),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${t===d?`bg-hover text-primary`:`text-secondary`}`,"data-testid":`directory-entry`,"data-entry-name":e.name,"data-entry-path":e.path,children:[(0,W.jsx)(xe,{width:14,height:14,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))})}),a?.truncated?(0,W.jsx)(`p`,{className:`mt-2 text-[10px] text-muted`,children:`Showing first 200 directories.`}):null,(0,W.jsxs)(`div`,{className:`mt-4 border-t border-border pt-3`,children:[(0,W.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-secondary`,children:`Recent`}),m.length===0?(0,W.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:`No recent paths yet.`}):(0,W.jsx)(`div`,{className:`mt-2 space-y-1`,children:m.map(e=>(0,W.jsx)(`button`,{type:`button`,className:`block w-full truncate text-left text-xs text-secondary hover:text-primary`,onClick:()=>h(e),title:e,"data-testid":`directory-recent`,"data-recent-path":e,children:e},e))})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{_&&e(_)},className:`btn btn-primary`,disabled:l||!_,children:`Select`})]})]})})}function _W(e){let t=e.trim();if(t.length>=2){let e=t[0],n=t[t.length-1];if(e===`'`&&n===`'`)return t.slice(1,-1).replace(/'\\''/g,`'`);if(e===`"`&&n===`"`)return t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`)}return t}function vW(e){let t=e.trim(),n=t.search(/\s/);if(n===-1||t.slice(0,n).split(`/`).pop()!==`bash`)return null;let r=n;for(;r<t.length&&/\s/.test(t[r]);)r++;let i=!1,a=!1;for(;r<t.length;){let e=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let n=t.slice(e,r);for(;r<t.length&&/\s/.test(t[r]);)r++;if(!n.startsWith(`-`)||n===`-`)return null;if(n===`--`)break;if(n.startsWith(`--`)||!/^-[a-zA-Z]+$/.test(n))continue;let o=n.slice(1);if(o.includes(`l`)&&(i=!0),o.includes(`c`)){a=!0;break}}if(!i||!a)return null;let o=t.slice(r).trim();return o?_W(o):null}function yW(e){return e?e===`claude-rp`?`claude`:e:null}function bW(e){let t=e.trim();if(!t)return``;let n=_W(t);return vW(n)??n}function xW(e){if(e===`claude`)return`claude`;if(e===`codex`)return`codex`;if(e===`pi`)return`pi`;if(e===`devin`||e===`devin-cli`)return`devin`;if(e===`grok`||e.startsWith(`grok-`))return`grok`;if(e===`omp`)return`omp`}function SW(e){let t=/\S+/g,n;for(;n=t.exec(e);){let e=n[0].toLowerCase().replace(/^["']+|["']+$/g,``);if([`npx`,`bunx`,`pnpm`,`yarn`,`env`].includes(e)||e.includes(`=`)||e.startsWith(`-`))continue;let t=e.includes(`@oh-my-pi/`)?`omp`:xW(e.split(`/`).pop()||e);return t?{agentType:t,end:n.index+n[0].length}:void 0}}function CW(e){let t=bW(e);if(t)return SW(t.toLowerCase().trim().replace(/^["']|["']$/g,``))?.agentType}var wW={claude:`--dangerously-skip-permissions`,codex:`--yolo`,grok:`--always-approve`,devin:`--permission-mode dangerous`,pi:null,omp:`--auto-approve`},TW={claude:[`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],codex:[`--yolo`,`--dangerously-bypass-approvals-and-sandbox`],grok:[`--always-approve`,`--yolo`,`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],devin:[`--permission-mode dangerous`,`--permission-mode=dangerous`],pi:[],omp:[`--auto-approve`,`--approval-mode yolo`,`--approval-mode=yolo`]};function EW(e){let t=yW(e);return t?wW[t]:null}function DW(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function OW(e){return RegExp(`(^|\\s)${DW(e)}(?=\\s|$)`,`g`)}function kW(e,t){return(t?[yW(t)].filter(e=>e!==null):Object.keys(TW)).some(t=>TW[t].some(t=>OW(t).test(e)))}function AW(e,t){let n=SW(e);return n?`${e.slice(0,n.end)} ${t}${e.slice(n.end)}`:null}function jW(e,t){let n=EW(t);if(!n)return e;let r=e.trim();if(!r||kW(r,t))return r;let i=AW(r,n);if(i)return i;let a=bW(r);if(a&&a!==r){let e=AW(a,n);if(e)return`bash -lc '${e.replace(/'/g,`'\\''`)}'`}return`${r} ${n}`}function MW(e,t){let n=yW(t);if(!n||kW(e,t))return null;if(n===`codex`){let t=/(^|\s)(--full-auto|--ask-for-approval|-a)(?=\s|=|$)/.exec(e);if(t)return`conflicts with ${t[2]}`}if(n===`omp`){let t=/(^|\s)--approval-mode(?:\s+|=)(always-ask|write)/.exec(e);if(t)return`conflicts with --approval-mode ${t[2]}`}let r=/(^|\s)--permission-mode(?:\s+|=)(\S+)/.exec(e);return r&&n!==`codex`?`conflicts with --permission-mode ${r[2]}`:null}function NW(e,t){let n=yW(t);if(!n)return e;let r=e;for(let e of TW[n])r=r.replace(OW(e),` `);return r.replace(/\s+/g,` `).trim()}function PW({isOpen:e,onClose:t,onCreate:n,defaultProjectDir:r,commandPresets:i,defaultPresetId:a,lastProjectPath:o,activeProjectPath:s,remoteHosts:c=[],remoteAllowControl:l=!1,initialHost:u,initialPath:d,initialCommand:f}){let[p,m]=(0,x.useState)(``),[h,g]=(0,x.useState)(``),[_,v]=(0,x.useState)(null),[y,b]=(0,x.useState)(``),[S,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(``),E=H(e=>e.yoloMode),D=H(e=>e.setYoloMode),O=(0,x.useRef)(null),k=(0,x.useRef)(null),A=(0,x.useRef)(null),j=(0,x.useRef)(!1),M=l&&c.length>0,N=e=>{if(!E)return e;let t=CW(e);return t&&!MW(e,t)?jW(e,t):e},P=e=>{let t=i.find(t=>t.id===e);t&&(v(e),b(N(te(t))))},F=()=>{v(null),b(``)};if((0,x.useEffect)(()=>{let t=j.current;if(j.current=e,!e){m(``),g(``),v(null),b(``),C(!1),T(u??``),t&&setTimeout(()=>{if(typeof document>`u`||typeof document.querySelector!=`function`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300);return}if(typeof document<`u`&&typeof document.querySelector==`function`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}m(d?.trim()||s?.trim()||o||r||``),g(``),T(u??``);let n=f?.trim();if(n){let e=i.find(e=>te(e)===n);e?(v(e.id),b(te(e))):(v(null),b(n))}else{let e=i.find(e=>e.id===a);e?(v(a),b(N(te(e)))):i.length>0?(v(i[0].id),b(N(te(i[0])))):(v(null),b(``))}setTimeout(()=>{if(A.current?.focus(),k.current){let e=k.current;e.scrollLeft=e.scrollWidth}},50)},[s,i,a,r,e,o,u,d,f]),(0,x.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=()=>O.current?Array.from(O.current.querySelectorAll(`input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]`)):[],r=e=>{if(!S){if(e.key===`Escape`){typeof e.stopPropagation==`function`&&e.stopPropagation(),t();return}if(e.key===`Enter`){let t=document.activeElement;if(!t||t.tagName===`INPUT`||t.closest(`[data-testid="host-select"]`)||!t.closest(`[data-testid="command-select"]`))return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),O.current?.requestSubmit();return}if(/^[0-9]$/.test(e.key)&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=document.activeElement;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable))return;let n;if(e.key===`0`)n=i.length;else if(n=Number(e.key)-1,n>=i.length)return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),n===i.length?F():P(i[n].id),(O.current?.querySelectorAll?.(`[data-testid="command-select"] [role="radio"]`))?.[n]?.focus();return}if(e.key===`Tab`){e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation();let t=n();if(t.length===0)return;let r=document.activeElement,i=t.indexOf(r),a;a=i===-1?e.shiftKey?t.length-1:0:e.shiftKey?i<=0?t.length-1:i-1:i>=t.length-1?0:i+1,t[a]?.focus()}}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,t,S,i,E]),!e)return null;let I=_===null,L=w!==``,ee=CW(y),R=EW(ee)!==null,z=ee?kW(y,ee):!1,B=ee&&!z?MW(y,ee):null,V=!R||B!==null,ne=ee?ee===`pi`?`Pi has no permission prompts — nothing to enable`:B??`Append ${EW(ee)}`:`Enter a supported agent command (claude, codex, grok, devin)`,re=e=>{D(e),ee&&b(e?jW(y,ee):NW(y,ee))},U=e=>{e.preventDefault();let r=p.trim();if(!r)return;let i=y.trim();n(r,h.trim()||void 0,i||void 0,L?w:void 0),t()},ie=[...i.map(e=>({id:e.id,label:e.label,isCustom:!1,agentType:e.agentType,command:e.command})),{id:`custom`,label:`Custom`,isCustom:!0,agentType:void 0,command:void 0}],ae=[{id:``,label:`Local`,ok:!0,error:void 0},...c.map(e=>({id:e.host,label:e.host,ok:e.ok,error:e.error}))],oe=p.trim()||`~`;return(0,W.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:[(0,W.jsxs)(`form`,{ref:O,onSubmit:U,className:`w-full max-w-md border border-border bg-elevated p-6`,children:[(0,W.jsx)(`h2`,{id:`new-session-title`,className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`New Session`}),(0,W.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[M&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Host`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Host`,"data-testid":`host-select`,children:ae.map((e,t)=>{let n=w===e.id,r=!e.ok&&!n;return(0,W.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-label":e.label,title:e.ok?void 0:e.error||`Unreachable`,tabIndex:n?0:-1,onClick:()=>T(e.id),onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ae.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ae.length)%ae.length;else return;let r=ae[n];T(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``} ${r?`opacity-60`:``}`,children:e.label},e.id||`local`)})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Command`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Command preset`,"data-testid":`command-select`,children:ie.map((e,t)=>{let n=e.isCustom?I:_===e.id,r=e.isCustom?`0`:t<9?String(t+1):null;return(0,W.jsxs)(`button`,{ref:n?A:void 0,type:`button`,role:`radio`,"aria-checked":n,"aria-keyshortcuts":r??void 0,tabIndex:n?0:-1,onClick:()=>{e.isCustom?F():P(e.id)},onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ie.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ie.length)%ie.length;else return;let r=ie[n];r.isCustom?F():P(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``}`,children:[r&&(0,W.jsx)(`kbd`,{"aria-hidden":`true`,className:`shortcut-badge`,children:r}),(0,W.jsx)(rh,{agentType:e.agentType,command:e.command,className:`inline-block h-3.5 w-3.5 shrink-0`}),e.label]},e.id)})}),(0,W.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),placeholder:`Enter command...`,className:`input mt-2 font-mono text-xs`}),(0,W.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs ${V?`text-muted opacity-60`:`text-secondary`}`,title:ne,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:z,disabled:V,onChange:e=>re(e.target.checked)}),`yolo mode — skip permission prompts`]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Project Path`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`input`,{ref:k,value:p,onChange:e=>m(e.target.value),placeholder:L?`/home/user/project`:s||o||r||`/Users/you/code/my-project`,className:`input flex-1 text-sm`}),!L&&(0,W.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>C(!0),children:`Browse`})]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Display Name`}),(0,W.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`auto-generated`,className:`input text-sm placeholder:italic`})]})]}),(0,W.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Create`})]})]}),S&&!L&&(0,W.jsx)(gW,{initialPath:oe,onSelect:e=>{m(e),C(!1)},onCancel:()=>C(!1)})]})}function FW({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=x.useRef(e!==void 0),[a,o]=x.useState(t);return[i?e:a,x.useCallback(e=>{i||o(e)},[])]}var IW={};function LW(e,t){let n=x.useRef(IW);return n.current===IW&&(n.current=e(t)),n}var RW=x[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],zW=RW&&RW!==x.useLayoutEffect?RW:e=>e();function BW(e){let t=LW(VW).current;return t.next=e,zW(t.effect),t.trampoline}function VW(){let e={next:void 0,callback:HW,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function HW(){}function UW(e,t,n,r){let i=LW(GW).current;return KW(i,e,t,n,r)&&JW(i,[e,t,n,r]),i.callback}function WW(e){let t=LW(GW).current;return qW(t,e)&&JW(t,e),t.callback}function GW(){return{callback:null,cleanup:null,refs:[]}}function KW(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function qW(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function JW(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var YW=typeof document<`u`?x.useLayoutEffect:()=>{},XW={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},ZW={...XW,position:`fixed`,top:0,left:0},QW={...XW,position:`absolute`};function $W(){}Object.freeze([]);var eG=Object.freeze({});function tG(e,...t){let n=new URL(`https://base-ui.com/production-error`);return n.searchParams.set(`code`,e.toString()),t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var nG=18;function rG(e){return nG>=e}function iG(e){if(!x.isValidElement(e))return null;let t=e,n=t.props;return(rG(19)?n?.ref:t.ref)??null}function aG(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function oG(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function sG(e,t){return typeof e==`function`?e(t):e}function cG(e,t){return typeof e==`function`?e(t):e}var lG={};function uG(e,t,n,r,i){let a={...gG(e,lG)};return t&&(a=fG(a,t)),n&&(a=fG(a,n)),r&&(a=fG(a,r)),i&&(a=fG(a,i)),a}function dG(e){if(e.length===0)return lG;if(e.length===1)return gG(e[0],lG);let t={...gG(e[0],lG)};for(let n=1;n<e.length;n+=1)t=fG(t,e[n]);return t}function fG(e,t){return hG(t)?t(e):pG(e,t)}function pG(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=aG(e.style,r);break;case`className`:e[n]=yG(e.className,r);break;default:mG(n,r)?e[n]=_G(e[n],r):e[n]=r}}return e}function mG(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function hG(e){return typeof e==`function`}function gG(e,t){return hG(e)?e(t):e??lG}function _G(e,t){return t?e?n=>{if(bG(n)){let r=n;vG(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function vG(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function yG(e,t){return t?e?t+` `+e:t:e}function bG(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function xG(e,t,n={}){let r=t.render,i=SG(t,n);return n.enabled===!1?null:wG(e,r,i,n.state??eG)}function SG(e,t={}){let{className:n,style:r,render:i}=e,{state:a=eG,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?sG(n,a):void 0,d=l?cG(r,a):void 0,f=l?oG(a,c):eG,p=l?aG(f,Array.isArray(s)?dG(s):s)??eG:eG;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=WW([p.ref,iG(i),...o]):p.ref=UW(p.ref,iG(i),o):UW(null,null)),l?(u!==void 0&&(p.className=yG(p.className,u)),d!==void 0&&(p.style=aG(p.style,d)),p):eG}var CG=Symbol.for(`react.lazy`);function wG(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=uG(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===CG&&(i=x.Children.toArray(t)[0]),x.cloneElement(i,e)}if(e&&typeof e==`string`)return TG(e,n);throw Error(tG(8))}function TG(e,t){return e===`button`?(0,x.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,x.createElement)(`img`,{alt:``,...t,key:t.key}):x.createElement(e,t)}var EG={...x},DG=0;function OG(e,t=`mui`){let[n,r]=x.useState(e),i=e||n;return x.useEffect(()=>{n??(DG+=1,r(`${t}-${DG}`))},[n,t]),i}var kG=EG.useId;function AG(e,t){if(kG!==void 0){let n=kG();return e??(t?`${t}-${n}`:n)}return OG(e,t)}function jG(e){return AG(e,`base-ui`)}function MG(){return typeof window<`u`}function NG(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function PG(e){return MG()?e instanceof Element||e instanceof NG(e).Element:!1}function FG(e){return MG()?e instanceof HTMLElement||e instanceof NG(e).HTMLElement:!1}function IG(e){return!MG()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof NG(e).ShadowRoot}var LG=x.createContext(void 0);function RG(e=!1){let t=x.useContext(LG);if(t===void 0&&!e)throw Error(tG(16));return t}function zG(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:x.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function BG(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=e,a=x.useRef(null),o=RG(!0)!==void 0,s=BW(()=>{let e=a.current;return!!(e?.tagName===`A`&&e?.href)}),{props:c}=zG({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:r,isNativeButton:i}),l=x.useCallback(()=>{let e=a.current;VG(e)&&o&&t&&c.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,c.disabled,o]);return YW(l,[l]),{getButtonProps:x.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:l,...u}=e;return uG({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(vG(e),o?.(e)),e.baseUIHandlerPrevented)return;let r=e.target===e.currentTarget&&!i&&!s()&&!t,a=e.key===`Enter`,c=e.key===` `;r&&((c||a)&&e.preventDefault(),a&&n?.(e))},onKeyUp(e){t||(vG(e),a?.(e)),!e.baseUIHandlerPrevented&&e.target===e.currentTarget&&!i&&!t&&e.key===` `&&n?.(e)},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},i?void 0:{role:`button`},c,u)},[t,c,i,s]),buttonRef:BW(e=>{a.current=e,l()})}}function VG(e){return FG(e)&&e.tagName===`BUTTON`}var HG=x.createContext(void 0);function UG(){let e=x.useContext(HG);if(e===void 0)throw Error(tG(63));return e}var WG=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),GG={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},KG={valid(e){return e===null?null:e?{[WG.valid]:``}:{[WG.invalid]:``}}},qG=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),JG={...KG,checked(e){return e?{[qG.checked]:``}:{[qG.unchecked]:``}}};function YG(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}var XG=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:$W,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function ZG(){return x.useContext(XG)}var QG=x.createContext({invalid:void 0,name:void 0,validityData:{state:GG,errors:[],error:``,value:``,initialValue:null},setValidityData:$W,disabled:void 0,touched:!1,setTouched:$W,dirty:!1,setDirty:$W,filled:!1,setFilled:$W,focused:!1,setFocused:$W,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=eG)=>e,getInputValidationProps:(e=eG)=>e,inputRef:{current:null},commit:async()=>{}}});function $G(e=!0){let t=x.useContext(QG);if(t.setValidityData===$W&&!e)throw Error(tG(28));return t}function eK(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=ZG(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=$G(),f=BW(e.getValue);YW(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),YW(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:YG(u,c),validate(e=!0){let t=n;t===void 0&&(t=f()),l.current=!0,e?U.flushSync(()=>o(t)):o(t)}})},[o,a,t,s,f,r,c,l,i,u,n]),YW(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var tK=x.createContext({controlId:void 0,registerControlId:$W,labelId:void 0,setLabelId:$W,messageIds:[],setMessageIds:$W,getDescriptionProps:e=>e});function nK(){return x.useContext(tK)}function rK(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=nK(),o=jG(t),s=n?i:void 0,c=LW(()=>Symbol(`labelable-control`)),l=x.useRef(!1),u=x.useRef(t!=null),d=BW(()=>{!l.current||a===$W||(l.current=!1,a(c.current,void 0))});return YW(()=>{if(a===$W)return;let e;if(n){let n=r?.current;e=PG(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),x.useEffect(()=>d,[d]),i??o}var iK=`none`;function aK(e,t,n,r){let i=!1,a=!1,o=r??eG;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function oK(e,t){let n=x.useRef(e),r=BW(t);YW(()=>{n.current!==e&&r(n.current)},[e,r]),YW(()=>{n.current=e},[e])}var sK=x.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,id:a,inputRef:o,name:s,nativeButton:c=!1,onCheckedChange:l,readOnly:u=!1,required:d=!1,disabled:f=!1,render:p,uncheckedValue:m,value:h,...g}=e,{clearErrors:_}=ZG(),{state:v,setTouched:y,setDirty:b,validityData:S,setFilled:C,setFocused:w,shouldValidateOnChange:T,validationMode:E,disabled:D,name:O,validation:k}=$G(),{labelId:A}=nK(),j=D||f,M=O??s,N=BW(l),P=x.useRef(null),F=UW(P,o,k.inputRef),I=x.useRef(null),L=jG(),ee=rK({id:a,implicit:!1,controlRef:I}),R=c?void 0:ee,[z,B]=FW({controlled:n,default:!!i,name:`Switch`,state:`checked`});eK({id:L,commit:k.commit,value:z,controlRef:I,name:M,getValue:()=>z}),YW(()=>{P.current&&C(P.current.checked)},[P,C]),oK(z,()=>{_(M),b(z!==S.initialValue),C(z),T()?k.commit(z):k.commit(z,!0)});let{getButtonProps:te,buttonRef:V}=BG({disabled:j,native:c}),ne={id:c?ee:L,role:`switch`,"aria-checked":z,"aria-readonly":u||void 0,"aria-required":d||void 0,"aria-labelledby":A,onFocus(){j||w(!0)},onBlur(){let e=P.current;!e||j||(y(!0),w(!1),E===`onBlur`&&k.commit(e.checked))},onClick(e){u||j||(e.preventDefault(),P.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},H=x.useMemo(()=>uG({checked:z,disabled:j,id:R,name:M,required:d,style:M?QW:ZW,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:F,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=aK(iK,e.nativeEvent);N?.(t,n),!n.isCanceled&&B(t)},onFocus(){I.current?.focus()}},k.getInputValidationProps,h===void 0?eG:{value:h}),[z,j,F,R,M,N,d,B,k,h]),re=x.useMemo(()=>({...v,checked:z,disabled:j,readOnly:u,required:d}),[v,z,j,u,d]),U=xG(`span`,e,{state:re,ref:[t,I,V],props:[ne,k.getValidationProps,g,te],stateAttributesMapping:JG});return(0,W.jsxs)(HG.Provider,{value:re,children:[U,!z&&M&&m!==void 0&&(0,W.jsx)(`input`,{type:`hidden`,name:M,value:m}),(0,W.jsx)(`input`,{...H})]})}),cK=x.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=$G(),o=UG();return xG(`span`,e,{state:{...a,...o},ref:t,stateAttributesMapping:JG,props:i})});function lK(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=lK(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function uK(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=lK(e))&&(r&&(r+=` `),r+=t);return r}var dK=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},fK=(e,t)=>({classGroupId:e,validator:t}),pK=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),mK=`-`,hK=[],gK=`arbitrary..`,_K=e=>{let t=bK(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return yK(e);let n=e.split(mK);return vK(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?dK(i,t):t:i||hK}return n[e]||hK}}},vK=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=vK(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(mK):e.slice(t).join(mK),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},yK=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?gK+r:void 0})(),bK=e=>{let{theme:t,classGroups:n}=e;return xK(n,t)},xK=(e,t)=>{let n=pK();for(let r in e){let i=e[r];SK(i,n,r,t)}return n},SK=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];CK(i,t,n,r)}},CK=(e,t,n,r)=>{if(typeof e==`string`){wK(e,t,n);return}if(typeof e==`function`){TK(e,t,n,r);return}EK(e,t,n,r)},wK=(e,t,n)=>{let r=e===``?t:DK(t,e);r.classGroupId=n},TK=(e,t,n,r)=>{if(OK(e)){SK(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(fK(n,e))},EK=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];SK(o,DK(t,a),n,r)}},DK=(e,t)=>{let n=e,r=t.split(mK),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=pK(),n.nextPart.set(t,i)),n=i}return n},OK=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,kK=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},AK=`!`,jK=`:`,MK=[],NK=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),PK=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===jK){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(AK)?(c=s.slice(0,-1),l=!0):s.startsWith(AK)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return NK(t,l,c,u)};if(t){let e=t+jK,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):NK(MK,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},FK=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},IK=e=>({cache:kK(e.cacheSize),parseClassName:PK(e),sortModifiers:FK(e),..._K(e)}),LK=/\s+/,RK=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(LK),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+AK:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},zK=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=BK(n))&&(i&&(i+=` `),i+=r);return i},BK=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=BK(e[r]))&&(n&&(n+=` `),n+=t);return n},VK=(e,...t)=>{let n,r,i,a,o=o=>(n=IK(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=RK(e,n);return i(e,a),a};return a=o,(...e)=>a(zK(...e))},HK=[],UK=e=>{let t=t=>t[e]||HK;return t.isThemeGetter=!0,t},WK=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,GK=/^\((?:(\w[\w-]*):)?(.+)\)$/i,KK=/^\d+\/\d+$/,qK=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,JK=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,YK=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,XK=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ZK=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,QK=e=>KK.test(e),$K=e=>!!e&&!Number.isNaN(Number(e)),eq=e=>!!e&&Number.isInteger(Number(e)),tq=e=>e.endsWith(`%`)&&$K(e.slice(0,-1)),nq=e=>qK.test(e),rq=()=>!0,iq=e=>JK.test(e)&&!YK.test(e),aq=()=>!1,oq=e=>XK.test(e),sq=e=>ZK.test(e),cq=e=>!Q(e)&&!$(e),lq=e=>xq(e,Tq,aq),Q=e=>WK.test(e),uq=e=>xq(e,Eq,iq),dq=e=>xq(e,Dq,$K),fq=e=>xq(e,Cq,aq),pq=e=>xq(e,wq,sq),mq=e=>xq(e,kq,oq),$=e=>GK.test(e),hq=e=>Sq(e,Eq),gq=e=>Sq(e,Oq),_q=e=>Sq(e,Cq),vq=e=>Sq(e,Tq),yq=e=>Sq(e,wq),bq=e=>Sq(e,kq,!0),xq=(e,t,n)=>{let r=WK.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Sq=(e,t,n=!1)=>{let r=GK.exec(e);return r?r[1]?t(r[1]):n:!1},Cq=e=>e===`position`||e===`percentage`,wq=e=>e===`image`||e===`url`,Tq=e=>e===`length`||e===`size`||e===`bg-size`,Eq=e=>e===`length`,Dq=e=>e===`number`,Oq=e=>e===`family-name`,kq=e=>e===`shadow`,Aq=VK(()=>{let e=UK(`color`),t=UK(`font`),n=UK(`text`),r=UK(`font-weight`),i=UK(`tracking`),a=UK(`leading`),o=UK(`breakpoint`),s=UK(`container`),c=UK(`spacing`),l=UK(`radius`),u=UK(`shadow`),d=UK(`inset-shadow`),f=UK(`text-shadow`),p=UK(`drop-shadow`),m=UK(`blur`),h=UK(`perspective`),g=UK(`aspect`),_=UK(`ease`),v=UK(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),$,Q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$,Q,c],T=()=>[QK,`full`,`auto`,...w()],E=()=>[eq,`none`,`subgrid`,$,Q],D=()=>[`auto`,{span:[`full`,eq,$,Q]},eq,$,Q],O=()=>[eq,`auto`,$,Q],k=()=>[`auto`,`min`,`max`,`fr`,$,Q],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[QK,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,$,Q],F=()=>[...b(),_q,fq,{position:[$,Q]}],I=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],L=()=>[`auto`,`cover`,`contain`,vq,lq,{size:[$,Q]}],ee=()=>[tq,hq,uq],R=()=>[``,`none`,`full`,l,$,Q],z=()=>[``,$K,hq,uq],B=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],V=()=>[$K,tq,_q,fq],ne=()=>[``,`none`,m,$,Q],H=()=>[`none`,$K,$,Q],re=()=>[`none`,$K,$,Q],U=()=>[$K,$,Q],ie=()=>[QK,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[nq],breakpoint:[nq],color:[rq],container:[nq],"drop-shadow":[nq],ease:[`in`,`out`,`in-out`],font:[cq],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[nq],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[nq],shadow:[nq],spacing:[`px`,$K],text:[nq],"text-shadow":[nq],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,QK,Q,$,g]}],container:[`container`],columns:[{columns:[$K,Q,$,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[eq,`auto`,$,Q]}],basis:[{basis:[QK,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[$K,QK,`auto`,`initial`,`none`,Q]}],grow:[{grow:[``,$K,$,Q]}],shrink:[{shrink:[``,$K,$,Q]}],order:[{order:[eq,`first`,`last`,`none`,$,Q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,hq,uq]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,$,dq]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,tq,Q]}],"font-family":[{font:[gq,Q,t]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,$,Q]}],"line-clamp":[{"line-clamp":[$K,`none`,$,dq]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$,Q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$,Q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...B(),`wavy`]}],"text-decoration-thickness":[{decoration:[$K,`from-font`,`auto`,$,uq]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[$K,`auto`,$,Q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$,Q]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,$,Q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:L()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},eq,$,Q],radial:[``,$,Q],conic:[eq,$,Q]},yq,pq]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":z()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...B(),`hidden`,`none`]}],"divide-style":[{divide:[...B(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...B(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[$K,$,Q]}],"outline-w":[{outline:[``,$K,hq,uq]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,bq,mq]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,bq,mq]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[$K,uq]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,bq,mq]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[$K,$,Q]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[$K]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[$,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[$K]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,$,Q]}],filter:[{filter:[``,`none`,$,Q]}],blur:[{blur:ne()}],brightness:[{brightness:[$K,$,Q]}],contrast:[{contrast:[$K,$,Q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,bq,mq]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,$K,$,Q]}],"hue-rotate":[{"hue-rotate":[$K,$,Q]}],invert:[{invert:[``,$K,$,Q]}],saturate:[{saturate:[$K,$,Q]}],sepia:[{sepia:[``,$K,$,Q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$,Q]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[$K,$,Q]}],"backdrop-contrast":[{"backdrop-contrast":[$K,$,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,$K,$,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$K,$,Q]}],"backdrop-invert":[{"backdrop-invert":[``,$K,$,Q]}],"backdrop-opacity":[{"backdrop-opacity":[$K,$,Q]}],"backdrop-saturate":[{"backdrop-saturate":[$K,$,Q]}],"backdrop-sepia":[{"backdrop-sepia":[``,$K,$,Q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,$,Q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[$K,`initial`,$,Q]}],ease:[{ease:[`linear`,`initial`,_,$,Q]}],delay:[{delay:[$K,$,Q]}],animate:[{animate:[`none`,v,$,Q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$,Q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":[`scale-3d`],skew:[{skew:U()}],"skew-x":[{"skew-x":U()}],"skew-y":[{"skew-y":U()}],transform:[{transform:[$,Q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,$,Q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,$,Q]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[$K,hq,uq,dq]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function jq(...e){return Aq(uK(e))}function Mq({checked:e,onCheckedChange:t,disabled:n,className:r,ariaLabel:i}){return(0,W.jsx)(sK,{checked:e,onCheckedChange:t,disabled:n,"aria-label":i,className:jq(`group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors`,`bg-border data-[checked]:bg-accent`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base`,`disabled:cursor-not-allowed disabled:opacity-50`,r),children:(0,W.jsx)(cK,{className:jq(`pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform`,`translate-x-1 group-data-[checked]:translate-x-5`)})})}var Nq=null,Pq=!1,Fq={},Iq=500;function Lq(){if(typeof window>`u`)return null;if(Nq?.state===`closed`&&(Nq=null),!Nq){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;Nq=new e}return Nq}function Rq(){Nq&&=(Nq.close().catch(()=>{}),null),Lq()}function zq(){return Pq}function Bq(){Nq&&(Rq(),Pq=!0)}if(typeof window<`u`){window.addEventListener(`pageshow`,e=>{e.persisted&&Bq()}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&Bq()});let e=Date.now();setInterval(()=>{let t=Date.now();t-e>15e3&&Bq(),e=t},5e3)}async function Vq(){let e=Lq();e&&e.state===`suspended`&&await e.resume().catch(()=>{}),Pq=!1}async function Hq(e){e.state===`suspended`&&await e.resume().catch(()=>{})}async function Uq(e){let t=Lq();if(!t||(await Hq(t),t.state!==`running`))return;let{frequencies:n,durationMs:r,attackMs:i,peakGain:a,type:o=`sine`}=e,s=t.currentTime,c=r/1e3,l=i/1e3,u=t.createGain();u.connect(t.destination);let d=s+c*.7;u.gain.setValueAtTime(0,s),u.gain.linearRampToValueAtTime(a,s+l),u.gain.setValueAtTime(a,d),u.gain.linearRampToValueAtTime(0,s+c);let f=n.map(e=>{let n=t.createOscillator();return n.type=o,n.frequency.setValueAtTime(e,s),n.connect(u),n});for(let e of f)e.start(s),e.stop(s+c);let p=f[f.length-1];p.onended=()=>{for(let e of f)e.disconnect();u.disconnect()}}async function Wq(){let e=Date.now();if(!(e-(Fq.permission||0)<Iq)){Fq.permission=e;try{await Uq({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:`sine`})}catch{}}}async function Gq(){let e=Date.now();if(!(e-(Fq.idle||0)<Iq)){Fq.idle=e;try{await Uq({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:`sine`})}catch{}}}function Kq({isOpen:e,onClose:t}){let n=H(e=>e.defaultProjectDir),r=H(e=>e.setDefaultProjectDir),i=H(e=>e.commandPresets),a=H(e=>e.setCommandPresets),o=H(e=>e.defaultPresetId),s=H(e=>e.setDefaultPresetId),c=H(e=>e.sessionSortMode),l=H(e=>e.setSessionSortMode),u=H(e=>e.sessionSortDirection),d=H(e=>e.setSessionSortDirection),f=H(e=>e.useWebGL),p=H(e=>e.setUseWebGL),m=H(e=>e.fontSize),h=H(e=>e.setFontSize),g=H(e=>e.lineHeight),_=H(e=>e.setLineHeight),v=H(e=>e.letterSpacing),y=H(e=>e.setLetterSpacing),b=H(e=>e.fontOption),S=H(e=>e.setFontOption),C=H(e=>e.customFontFamily),w=H(e=>e.setCustomFontFamily),T=H(e=>e.shortcutModifier),E=H(e=>e.setShortcutModifier),D=H(e=>e.showProjectName),O=H(e=>e.setShowProjectName),k=H(e=>e.showLastUserMessage),A=H(e=>e.setShowLastUserMessage),j=H(e=>e.showSessionIdPrefix),M=H(e=>e.setShowSessionIdPrefix),N=uU(e=>e.theme),F=uU(e=>e.setTheme),I=H(e=>e.soundOnPermission),ee=H(e=>e.setSoundOnPermission),R=H(e=>e.soundOnIdle),z=H(e=>e.setSoundOnIdle),[B,te]=(0,x.useState)(n),[V,ne]=(0,x.useState)(i),[re,U]=(0,x.useState)(o),[ie,ae]=(0,x.useState)(c),[oe,se]=(0,x.useState)(u),[ce,le]=(0,x.useState)(f),[ue,de]=(0,x.useState)(m),[fe,pe]=(0,x.useState)(g),[me,he]=(0,x.useState)(v),[ge,_e]=(0,x.useState)(b),[ve,ye]=(0,x.useState)(C),[be,xe]=(0,x.useState)(T),[Se,Ce]=(0,x.useState)(D),[we,Te]=(0,x.useState)(k),[Ee,De]=(0,x.useState)(j),[Oe,ke]=(0,x.useState)(N),[Ae,je]=(0,x.useState)(I),[Me,Ne]=(0,x.useState)(R),[Pe,Fe]=(0,x.useState)(!0),[Ie,Le]=(0,x.useState)(!1),[Re,ze]=(0,x.useState)(!0),[Be,Ve]=(0,x.useState)(!0),[He,Ue]=(0,x.useState)(!1),[We,Ge]=(0,x.useState)(!1),[Ke,Je]=(0,x.useState)(24),[Xe,Ze]=(0,x.useState)(!1),[Qe,$e]=(0,x.useState)(!1),[et,tt]=(0,x.useState)(``),[nt,rt]=(0,x.useState)(``),[it,at]=(0,x.useState)(``),ot=(0,x.useRef)(null),st=(0,x.useRef)(0),ct=(0,x.useRef)(!1);if((0,x.useEffect)(()=>{let t=++st.current,r=ct.current;if(ct.current=e,ot.current&&=(clearTimeout(ot.current),null),e){if(te(n),ne(i),U(o),ae(c),se(u),le(f),de(m),pe(g),he(v),_e(b),ye(C),xe(T),Ce(D),Te(k),De(j),ke(N),je(I),Ne(R),$e(!1),tt(``),rt(``),at(``),fetch(`/api/settings/tmux-mouse-mode`).then(e=>e.json()).then(e=>Fe(e.enabled)).catch(()=>{}),Ve(!0),fetch(`/api/settings/terminal-colors`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{st.current===t&&ze(e.enabled)}).catch(()=>{}).finally(()=>{st.current===t&&Ve(!1)}),fetch(`/api/settings/history-max-age-hours`).then(e=>e.json()).then(e=>Je(e.hours)).catch(()=>{}),fetch(`/api/settings/prefer-window-name`).then(e=>e.json()).then(e=>Ue(e.enabled)).catch(()=>{}),typeof document<`u`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}}else r&&typeof document<`u`&&(ot.current=setTimeout(()=>{if(typeof document>`u`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300));return()=>{ot.current&&=(clearTimeout(ot.current),null)}},[i,o,n,c,u,f,m,g,v,b,C,T,D,k,j,N,I,R,e]),(0,x.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=e=>{e.key===`Escape`&&(typeof e.stopPropagation==`function`&&e.stopPropagation(),t())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),!e)return null;let lt=e=>{e.preventDefault();let n=B.trim(),i=ce!==f;r(n||`~/Documents/GitHub`),a(V),s(re),l(ie),d(oe),p(ce),h(ue),_(fe),y(me),S(ge),w(ve),E(be),O(Se),A(we),M(Ee),F(Oe),ee(Ae),z(Me),t({webglChanged:i})},ut=(e,t)=>{ne(n=>n.map(n=>n.id===e?{...n,...t}:n))},dt=e=>{let t=V.find(t=>t.id===e);if(!t||t.isBuiltIn)return;let n=V.filter(t=>t.id!==e);ne(n),e===re&&U(n[0]?.id||`claude`)},ft=()=>{if(!et.trim()||!nt.trim()||V.length>=50)return;let e={id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,label:et.trim(),command:nt.trim(),isBuiltIn:!1,agentType:it||void 0};ne([...V,e]),$e(!1),tt(``),rt(``),at(``)},pt=V.length<50,mt=e=>{Le(!0),Fe(e),fetch(`/api/settings/tmux-mouse-mode`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Fe(!e)).finally(()=>Le(!1))},ht=e=>{Ge(!0),Ue(e),fetch(`/api/settings/prefer-window-name`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Ue(!e)).finally(()=>Ge(!1))},gt=e=>{Ve(!0),ze(e),fetch(`/api/settings/terminal-colors`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>ze(!e)).finally(()=>Ve(!1))},_t=e=>{let t=Ke;Ze(!0),Je(e),fetch(`/api/settings/history-max-age-hours`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hours:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Je(t)).finally(()=>Ze(!1))};return(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,W.jsxs)(`form`,{onSubmit:lt,className:`w-full max-w-lg max-h-[90vh] flex flex-col border border-border bg-elevated`,children:[(0,W.jsxs)(`div`,{className:`p-6 pb-0`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`Settings`}),(0,W.jsx)(`p`,{className:`mt-2 text-xs text-muted text-pretty`,children:`Configure default directory, command presets, and display options.`})]}),(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 pb-4`,children:(0,W.jsxs)(`div`,{className:`mt-5 space-y-4`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Default Project Directory`}),(0,W.jsx)(`input`,{value:B,onChange:e=>te(e.target.value),placeholder:P,className:`input`,autoFocus:!0})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,W.jsx)(`label`,{className:`text-xs text-secondary`,children:`Command Presets`}),(0,W.jsx)(`select`,{value:re,onChange:e=>U(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:V.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,W.jsx)(`p`,{className:`text-[10px] text-muted mb-3`,children:`Default preset is pre-selected when creating new sessions.`}),(0,W.jsx)(`div`,{className:`space-y-3`,children:V.map(e=>(0,W.jsxs)(`div`,{className:`border border-border p-3 space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,W.jsx)(`input`,{value:e.label,onChange:t=>ut(e.id,{label:t.target.value}),className:`input text-sm py-1 px-2 w-32`,placeholder:`Label`})}),!e.isBuiltIn&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>dt(e.id),className:`btn text-xs px-2 py-1 text-error hover:bg-error/10`,children:`Delete`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Command`}),(0,W.jsx)(`input`,{value:e.command,onChange:t=>ut(e.id,{command:t.target.value}),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`})]}),!e.isBuiltIn&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Icon`}),(0,W.jsxs)(`select`,{value:e.agentType||``,onChange:t=>ut(e.id,{agentType:t.target.value||void 0}),className:`input text-xs py-1 px-2 w-auto`,children:[(0,W.jsx)(`option`,{value:``,children:`Terminal`}),(0,W.jsx)(`option`,{value:`claude`,children:`Claude`}),(0,W.jsx)(`option`,{value:`codex`,children:`Codex`}),(0,W.jsx)(`option`,{value:`pi`,children:`Pi`}),(0,W.jsx)(`option`,{value:`devin`,children:`Devin`}),(0,W.jsx)(`option`,{value:`grok`,children:`Grok`}),(0,W.jsx)(`option`,{value:`omp`,children:`OMP`})]})]})]},e.id))}),Qe?(0,W.jsxs)(`div`,{className:`mt-3 border border-border p-3 space-y-2`,children:[(0,W.jsx)(`div`,{className:`text-xs text-secondary mb-2`,children:`New Preset`}),(0,W.jsx)(`input`,{value:et,onChange:e=>tt(e.target.value),className:`input text-xs py-1 px-2 w-full`,placeholder:`Label`}),(0,W.jsx)(`input`,{value:nt,onChange:e=>rt(e.target.value),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(`select`,{value:it,onChange:e=>at(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:[(0,W.jsx)(`option`,{value:``,children:`Terminal Icon`}),(0,W.jsx)(`option`,{value:`claude`,children:`Claude Icon`}),(0,W.jsx)(`option`,{value:`codex`,children:`Codex Icon`}),(0,W.jsx)(`option`,{value:`pi`,children:`Pi Icon`}),(0,W.jsx)(`option`,{value:`devin`,children:`Devin Icon`}),(0,W.jsx)(`option`,{value:`grok`,children:`Grok Icon`}),(0,W.jsx)(`option`,{value:`omp`,children:`OMP Icon`})]}),(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>$e(!1),className:`btn text-xs px-2 py-1`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`button`,onClick:ft,disabled:!et.trim()||!nt.trim(),className:`btn btn-primary text-xs px-2 py-1`,children:`Add`})]})]}):(0,W.jsx)(`button`,{type:`button`,onClick:()=>$e(!0),disabled:!pt,className:`btn text-xs mt-3 w-full`,children:pt?`+ Add Preset`:`Max 50 presets`})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Session List Order`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`created`?`btn-primary`:``}`,onClick:()=>ae(`created`),children:`Created`}),(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`status`?`btn-primary`:``}`,onClick:()=>ae(`status`),children:`Status`}),(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`manual`?`btn-primary`:``}`,onClick:()=>ae(`manual`),children:`Manual`})]}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:ie===`status`?`Sessions auto-resort by status (waiting, working, unknown)`:ie===`manual`?`Drag sessions to reorder manually`:`Sessions stay in creation order`})]}),ie===`created`&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Sort Direction`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${oe===`desc`?`btn-primary`:``}`,onClick:()=>se(`desc`),children:`Newest First`}),(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${oe===`asc`?`btn-primary`:``}`,onClick:()=>se(`asc`),children:`Oldest First`})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,W.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Session List Details`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Project Name`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the project folder name under each session.`})]}),(0,W.jsx)(Mq,{checked:Se,onCheckedChange:Ce})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Last User Message`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the most recent user input next to the project name.`})]}),(0,W.jsx)(Mq,{checked:we,onCheckedChange:Te})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Session ID Prefix`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show first 5 characters of agent session IDs in the list.`})]}),(0,W.jsx)(Mq,{checked:Ee,onCheckedChange:De})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`History Sessions Lookback`}),(0,W.jsxs)(`div`,{className:`text-[10px] text-muted`,children:[`Show history sessions from the last N hours (`,1,`-`,168,`).`]})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`number`,min:1,max:168,value:Ke,onChange:e=>{let t=parseInt(e.target.value,10);t>=1&&t<=168&&_t(t)},disabled:Xe,className:`input text-xs py-1 px-2 w-16 text-center`}),(0,W.jsx)(`span`,{className:`text-xs text-muted`,children:`hrs`})]})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,W.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Notifications`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Permission Sound`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a ping when any session needs permission.`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>void Wq(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,W.jsx)(Mq,{checked:Ae,onCheckedChange:e=>{je(e),e&&Vq()}})]})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Idle Sound`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a chime when a session finishes working.`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>void Gq(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,W.jsx)(Mq,{checked:Me,onCheckedChange:e=>{Ne(e),e&&Vq()}})]})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Terminal Rendering`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`WebGL Acceleration`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`GPU rendering for better performance. Turn off if text looks fuzzy or flickering.`})]}),(0,W.jsx)(Mq,{checked:ce,onCheckedChange:le})]}),ce!==f&&(0,W.jsx)(`p`,{className:`mt-2 text-[10px] text-approval`,children:`Terminal will reload when saved`}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Mouse Mode`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Enable tmux mouse mode for trackpad/scroll wheel support.`})]}),(0,W.jsx)(Mq,{checked:Pe,onCheckedChange:mt,disabled:Ie})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-4`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Terminal Colors`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Preserve ANSI colors for terminal output. Hibernate then Wake running agents after changing this setting.`})]}),(0,W.jsx)(Mq,{checked:Re,onCheckedChange:gt,disabled:Be,ariaLabel:`Enable terminal colors`})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Prefer Window Names`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Label discovered sessions with their tmux window name instead of the session name. Applies immediately.`})]}),(0,W.jsx)(Mq,{checked:He,onCheckedChange:ht,disabled:We})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Size`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal text size in pixels (6-24)`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>de(Math.max(6,ue-1)),className:`flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover`,children:(0,W.jsx)(`span`,{className:`text-sm font-bold`,children:`−`})}),(0,W.jsx)(`span`,{className:`text-sm text-secondary w-6 text-center`,children:ue}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>de(Math.min(24,ue+1)),className:`flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover`,children:(0,W.jsx)(`span`,{className:`text-sm font-bold`,children:`+`})})]})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Line Height`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Vertical spacing (1.0 = compact, 2.0 = spacious)`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`range`,min:`1.0`,max:`2.0`,step:`0.1`,value:fe,onChange:e=>pe(parseFloat(e.target.value)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,W.jsx)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:fe.toFixed(1)})]})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Letter Spacing`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Horizontal spacing between characters in pixels`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`range`,min:`-3`,max:`3`,step:`1`,value:me,onChange:e=>he(parseInt(e.target.value,10)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,W.jsxs)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:[me,`px`]})]})]}),(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Family`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal typeface`})]}),(0,W.jsx)(`select`,{value:ge,onChange:e=>_e(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:L.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),ge===`custom`&&(0,W.jsx)(`input`,{value:ve,onChange:e=>ye(e.target.value),placeholder:`"Fira Code", monospace`,className:`input text-xs mt-2 font-mono`})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Dark Mode`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Switch between dark and light themes.`})]}),(0,W.jsx)(Mq,{checked:Oe===`dark`,onCheckedChange:e=>ke(e?`dark`:`light`)})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Keyboard Shortcut Modifier`}),(0,W.jsx)(`div`,{className:`grid grid-cols-5 gap-1`,children:[`auto`,`ctrl-option`,`ctrl-shift`,`cmd-option`,`cmd-shift`].map(e=>(0,W.jsx)(`button`,{type:`button`,className:`btn text-xs px-2 ${be===e?`btn-primary`:``}`,onClick:()=>xe(e),children:e===`auto`?`Auto`:Ye(e)},e))}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:be===`auto`?`Shortcuts: ${Ye(qe(`auto`))}+[1-9/N/X/[/]]`:`Shortcuts: ${Ye(be)}+[1-9/N/X/[/]]`})]})]})}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2 p-6 pt-4 border-t border-border bg-elevated`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>t(),className:`btn`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Save`})]})]})})}var qq=[];function Jq(e){x.useEffect(e,qq)}var Yq=x.createContext(void 0);function Xq(){let e=x.useContext(Yq);if(!e)throw Error(tG(73));return e}var Zq=Symbol(`NOT_FOUND`);function Qq(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function $q(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function eJ(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var tJ=e=>Array.isArray(e)?e:[e];function nJ(e){let t=Array.isArray(e[0])?e[0]:e;return eJ(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function rJ(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function iJ(e){let t;return{get(n){return t&&e(t.key,n)?t.value:Zq},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function aJ(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return Zq}function i(t,i){r(t)===Zq&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var oJ=(e,t)=>e===t;function sJ(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function cJ(e,t){let{equalityCheck:n=oJ,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=sJ(n),o=0,s=r<=1?iJ(a):aJ(r,a);function c(){let t=s.get(arguments);if(t===Zq){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var lJ=class{constructor(e){this.value=e}deref(){return this.value}},uJ=typeof WeakRef<`u`?WeakRef:lJ,dJ=0,fJ=1;function pJ(){return{s:dJ,v:void 0,o:null,p:null}}function mJ(e,t={}){let n=pJ(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=pJ(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=pJ(),e.set(n,t)):t=r}}let s=t,c;if(t.s===fJ)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new uJ(c):c}return s.s=fJ,s.v=c,c}return o.clearCache=()=>{n=pJ(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function hJ(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Qq(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=mJ,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=tJ(c),p=tJ(u),m=nJ(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=rJ(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var gJ=hJ(mJ),_J=Object.assign((e,t=gJ)=>{$q(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>_J}),vJ=hJ({memoize:cJ,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),yJ=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(tG(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},bJ=(...e)=>{let t=new WeakMap,n=1,r=e[e.length-1],i=e.length-1||1,a=r.length-i;if(a>3)throw Error(tG(2));return(i,o,s,c)=>{let l=i.__cacheKey__;l||(l={id:n},i.__cacheKey__=l,n+=1);let u=t.get(l);if(!u){let n=e,i=[void 0,void 0,void 0];switch(a){case 0:break;case 1:n=[...e.slice(0,-1),()=>i[0],r];break;case 2:n=[...e.slice(0,-1),()=>i[0],()=>i[1],r];break;case 3:n=[...e.slice(0,-1),()=>i[0],()=>i[1],()=>i[2],r];break;default:throw Error(tG(2))}u=vJ(...n),u.selectorArgs=i,t.set(l,u)}switch(u.selectorArgs[0]=o,u.selectorArgs[1]=s,u.selectorArgs[2]=c,a){case 0:return u(i);case 1:return u(i,o);case 2:return u(i,o,s);case 3:return u(i,o,s,c);default:throw Error(`unreachable`)}}},xJ=s((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),SJ=s(((e,t)=>{t.exports=xJ()})),CJ=s((e=>{var t=p(),n=SJ();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),wJ=s(((e,t)=>{t.exports=CJ()})),TJ=[],EJ=void 0;function DJ(){return EJ}function OJ(e){TJ.push(e)}var kJ=SJ(),AJ=wJ(),jJ=rG(19)?PJ:FJ;function MJ(e,t,n,r,i){return jJ(e,t,n,r,i)}function NJ(e,t,n,r,i){let a=x.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,kJ.useSyncExternalStore)(e.subscribe,a,a)}OJ({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,kJ.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function PJ(e,t,n,r,i){let a=DJ();if(!a)return NJ(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function FJ(e,t,n,r,i){return(0,AJ.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var IJ=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return MJ(this,e,t,n,r)}},LJ=class extends IJ{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){x.useDebugValue(e),YW(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;YW(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;YW(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){x.useDebugValue(e);let n=t!==void 0;YW(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return x.useDebugValue(e),MJ(this,this.selectors[e],t,n,r)}useContextCallback(e,t){x.useDebugValue(e);let n=BW(t??$W);this.context[e]=n}useStateSetter(e){let t=x.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},RJ=null;globalThis.requestAnimationFrame;var zJ=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},BJ=class e{static create(){return new e}static request(e){return zJ.request(e)}static cancel(e){return zJ.cancel(e)}currentId=RJ;request(e){this.cancel(),this.currentId=zJ.request(()=>{this.currentId=RJ,e()})}cancel=()=>{this.currentId!==RJ&&(zJ.cancel(this.currentId),this.currentId=RJ)};disposeEffect=()=>this.cancel};function VJ(){let e=LW(BJ.create).current;return Jq(e.disposeEffect),e}var HJ=0,UJ=class e{static create(){return new e}currentId=HJ;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=HJ,t()},e)}isStarted(){return this.currentId!==HJ}clear=()=>{this.currentId!==HJ&&(clearTimeout(this.currentId),this.currentId=HJ)};disposeEffect=()=>this.clear};function WJ(){let e=LW(UJ.create).current;return Jq(e.disposeEffect),e}var GJ=0;function KJ(e){return GJ+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${GJ}`}function qJ(e){return e?.ownerDocument||document}function JJ(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}var YJ=typeof navigator<`u`,XJ=tY(),ZJ=rY(),QJ=nY();typeof CSS>`u`||!CSS.supports||CSS.supports(`-webkit-backdrop-filter:none`),XJ.platform===`MacIntel`&&XJ.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(XJ.platform),YJ&&/firefox/i.test(QJ);var $J=YJ&&/apple/i.test(navigator.vendor);YJ&&/Edg/i.test(QJ),YJ&&/android/i.test(ZJ)||/android/i.test(QJ),YJ&&ZJ.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var eY=QJ.includes(`jsdom/`);function tY(){if(!YJ)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function nY(){if(!YJ)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function rY(){if(!YJ)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function iY(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function aY(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&IG(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function oY(e){return`composedPath`in e?e.composedPath()[0]:e.target}function sY(e){if(!e||eY)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}var cY=bJ(e=>e.toasts,e=>{let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}),lY={toasts:yJ(e=>e.toasts),isEmpty:yJ(e=>e.toasts.length===0),toast:yJ(cY,(e,t)=>e.get(t)?.value),toastIndex:yJ(cY,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:yJ(cY,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:yJ(cY,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:yJ(e=>e.hovering),focused:yJ(e=>e.focused),expanded:yJ(e=>e.hovering||e.focused),expandedOrOutOfFocus:yJ(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:yJ(e=>e.prevFocusElement)},uY=class extends LJ{timers=new Map;areTimersPaused=!1;constructor(e){super(e,{},lY)}setFocused(e){this.set(`focused`,e)}setHovering(e){this.set(`hovering`,e)}setIsWindowFocused(e){this.set(`isWindowFocused`,e)}setPrevFocusElement(e){this.set(`prevFocusElement`,e)}setViewport=e=>{this.set(`viewport`,e)};disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e){let t=lY.toastIndex(this.state,e);if(t===-1)return;this.state.toasts[t]?.onRemove?.();let n=[...this.state.toasts];n.splice(t,1),this.setToasts(n)}addToast=e=>{let{toasts:t,timeout:n,limit:r}=this.state,i=e.id||KJ(`toast`),a={...e,id:i,transitionStatus:`starting`},o=[a,...t],s=o.filter(e=>e.transitionStatus!==`ending`);if(s.length>r){let e=s.length-r,t=s.slice(-e),n=new Set(t.map(e=>e.id));this.setToasts(o.map(e=>{let t=n.has(e.id);return e.limited===t?e:{...e,limited:t}}))}else this.setToasts(o.map(e=>e.limited?{...e,limited:!1}:e));let c=a.timeout??n;return a.type!==`loading`&&c>0&&this.scheduleTimer(i,c,()=>this.closeToast(i)),lY.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),i};updateToast=(e,t)=>{this.updateToastInternal(e,t)};updateToastInternal=(e,t)=>{let{timeout:n,toasts:r}=this.state,i=lY.toast(this.state,e)??null;if(!i||i.transitionStatus===`ending`)return;let a={...i,...t};this.setToasts(r.map(n=>n.id===e?{...n,...t}:n));let o=a.timeout??n,s=i?.timeout??n,c=Object.hasOwn(t,`timeout`),l=a.transitionStatus!==`ending`&&a.type!==`loading`&&o>0,u=this.timers.has(e),d=s!==o,f=i?.type===`loading`;if(!l&&u){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e);return}if(l&&(!u||d||c||f)){let t=this.timers.get(e);t&&(t.timeout?.clear(),this.timers.delete(e)),this.scheduleTimer(e,o,()=>this.closeToast(e)),lY.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=e=>{lY.toast(this.state,e)?.onClose?.();let{limit:t,toasts:n}=this.state,r=0,i=n.map(n=>{if(n.id===e)return{...n,transitionStatus:`ending`,height:0};if(n.transitionStatus===`ending`)return n;let i=r>=t;return r+=1,n.limited===i?n:{...n,limited:i}}),a=this.timers.get(e);a&&a.timeout&&(a.timeout.clear(),this.timers.delete(e)),this.handleFocusManagement(e),this.setToasts(i)};promiseToast=(e,t)=>{let n=JJ(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=JJ(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=JJ(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();let t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=UJ.create(),e.timeout.start(e.remaining,()=>{this.timers.delete(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=oY(e);aY(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=!lY.expandedOrOutOfFocus(this.state),a=i?UJ.create():void 0;a?.start(t,()=>{this.timers.delete(e),n()}),this.timers.set(e,{timeout:a,start:i?r:0,delay:t,remaining:t,callback:n})}setToasts(e){let t={toasts:e};e.length===0&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){let t=iY(qJ(this.state.viewport));if(!this.state.viewport||!aY(this.state.viewport,t)||!sY(t))return;let n=lY.toasts(this.state),r=lY.toastIndex(this.state,e),i=null,a=r+1;for(;a<n.length;){if(n[a].transitionStatus!==`ending`){i=n[a];break}a+=1}if(!i)for(a=r-1;a>=0;){if(n[a].transitionStatus!==`ending`){i=n[a];break}--a}i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}},dY=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=LW(()=>new uY({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return Jq(a.disposeEffect),x.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`&&n?a.closeToast(n):a.addToast(t)})},[a,n,i]),a.useSyncedValues({timeout:n,limit:r}),(0,W.jsx)(Yq.Provider,{value:a,children:t})},fY=x.forwardRef(function(e,t){let[n,r]=x.useState();YW(()=>{$J&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,W.jsx)(`span`,{...e,ref:t,style:ZW,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),pY=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({}),mY=x.forwardRef(function(e,t){let{render:n,className:r,children:i,...a}=e,o=Xq(),s=WJ(),c=x.useRef(!1),l=x.useRef(!1),u=o.useState(`isEmpty`),d=o.useState(`toasts`),f=o.useState(`focused`),p=o.useState(`expanded`),m=o.useState(`prevFocusElement`),h=d[0]?.height??0,g=x.useMemo(()=>d.some(e=>e.transitionStatus===`ending`),[d]);x.useEffect(()=>{let e=o.state.viewport;if(!e)return;function t(t){u||t.key===`F6`&&t.target!==e&&(t.preventDefault(),o.setPrevFocusElement(iY(qJ(e))),e?.focus({preventScroll:!0}),o.pauseTimers(),o.setFocused(!0))}let n=NG(e);return n.addEventListener(`keydown`,t),()=>{n.removeEventListener(`keydown`,t)}},[o,u]),x.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=NG(e);function n(e){e.target===t&&(o.setIsWindowFocused(!1),o.pauseTimers())}function r(n){if(n.relatedTarget||n.target===t)return;let r=oY(n),i=iY(qJ(e));(!aY(e,r)||!sY(i))&&o.resumeTimers(),s.start(0,()=>o.setIsWindowFocused(!0))}return t.addEventListener(`blur`,n,!0),t.addEventListener(`focus`,r,!0),()=>{t.removeEventListener(`blur`,n,!0),t.removeEventListener(`focus`,r,!0)}},[o,s,u]),x.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=qJ(e);return t.addEventListener(`pointerdown`,o.handleDocumentPointerDown,!0),()=>{t.removeEventListener(`pointerdown`,o.handleDocumentPointerDown,!0)}},[u,o]);function _(e){let t=o.state.viewport;t&&(c.current=!0,e.relatedTarget===t?d[0]?.ref?.current?.focus():o.restoreFocusToPrevElement())}function v(e){e.key===`Tab`&&e.shiftKey&&e.target===o.state.viewport&&(e.preventDefault(),o.restoreFocusToPrevElement(),o.resumeTimers())}x.useEffect(()=>{!o.state.isWindowFocused||g||!l.current||(o.resumeTimers(),o.setHovering(!1),l.current=!1)},[g,o]);function y(){o.pauseTimers(),o.setHovering(!0),l.current=!1}function b(){g?l.current=!0:(o.resumeTimers(),o.setHovering(!1))}function S(){if(c.current){c.current=!1;return}f||sY(qJ(o.state.viewport).activeElement)&&(o.setFocused(!0),o.pauseTimers())}function C(e){!f||aY(o.state.viewport,e.relatedTarget)||(o.setFocused(!1),o.resumeTimers())}let w={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:y,onMouseMove:y,onMouseLeave:b,onFocus:S,onBlur:C,onKeyDown:v,onClick:S},T={expanded:p},E=xG(`div`,e,{ref:[t,o.setViewport],state:T,props:[w,{style:{[pY.frontmostHeight]:h?`${h}px`:void 0}},a,{children:(0,W.jsxs)(x.Fragment,{children:[!u&&m&&(0,W.jsx)(fY,{onFocus:_}),i,!u&&m&&(0,W.jsx)(fY,{onFocus:_})]})}]}),D=x.useMemo(()=>d.filter(e=>e.priority===`high`),[d]);return(0,W.jsxs)(x.Fragment,{children:[!u&&m&&(0,W.jsx)(fY,{onFocus:_}),E,!f&&D.length>0&&(0,W.jsx)(`div`,{style:ZW,children:D.map(e=>(0,W.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,W.jsx)(`div`,{children:e.title}),(0,W.jsx)(`div`,{children:e.description})]},e.id))})]})});function hY(e){return rG(19)?e:e?`true`:void 0}var gY=x.createContext(void 0);function _Y(){let e=x.useContext(gY);if(!e)throw Error(tG(66));return e}var vY=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),yY={[vY.startingStyle]:``},bY={[vY.endingStyle]:``},xY={transitionStatus(e){return e===`starting`?yY:e===`ending`?bY:null}};function SY(e){return e==null?e:`current`in e?e.current:e}function CY(e,t=!1,n=!0){let r=VJ();return BW((i,a=null)=>{r.cancel();function o(){U.flushSync(i)}let s=SY(e);if(s==null)return;let c=s;if(typeof c.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{function e(){let e=vY.startingStyle;if(!c.hasAttribute(e)){r.request(i);return}let t=new MutationObserver(()=>{c.hasAttribute(e)||(t.disconnect(),i())});t.observe(c,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}function i(){Promise.all(c.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||o()}).catch(()=>{let e=c.getAnimations();if(n){if(a?.aborted)return;o()}else e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&i()})}if(t){e();return}r.request(i)}})}function wY(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=BW(i),o=CY(r,n,!1);x.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var TY=function(e){return e.index=`--toast-index`,e.offsetY=`--toast-offset-y`,e.height=`--toast-height`,e.swipeMovementX=`--toast-swipe-movement-x`,e.swipeMovementY=`--toast-swipe-movement-y`,e}({}),EY={...xY,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},DY=40,OY=10,kY=.5,AY=1;function jY(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function MY(e){let t=window.getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var NY=x.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],...o}=e,s=n.positionerProps?.anchor!==void 0,c=[];s||(c=Array.isArray(a)?a:[a]);let l=c.length>0,u=Xq(),[d,f]=x.useState(void 0),[p,m]=x.useState(!1),[h,g]=x.useState(!1),[_,v]=x.useState(!1),[y,b]=x.useState({x:0,y:0}),[S,C]=x.useState({x:0,y:0,scale:1}),[w,T]=x.useState(),[E,D]=x.useState(),[O,k]=x.useState(null),A=x.useRef(null),j=x.useRef({x:0,y:0}),M=x.useRef({x:0,y:0,scale:1}),N=x.useRef(void 0),P=x.useRef(0),F=x.useRef(!1),I=x.useRef({x:0,y:0}),L=x.useRef(!1),ee=u.useState(`toastIndex`,n.id),R=u.useState(`toastVisibleIndex`,n.id),z=u.useState(`toastOffsetY`,n.id),B=u.useState(`focused`),te=u.useState(`expanded`);wY({open:n.transitionStatus!==`ending`,ref:A,onComplete(){n.transitionStatus===`ending`&&u.removeToast(n.id)}});let V=BW((e=!1)=>{let t=A.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){u.updateToastInternal(n.id,{ref:A,height:i,...n.transitionStatus===`starting`?{transitionStatus:void 0}:{}})}e?U.flushSync(a):a()});YW(V,[V]);function ne(e,t){let n=e,r=t;return!c.includes(`left`)&&!c.includes(`right`)?n=e>0?e**kY:-(Math.abs(e)**kY):(!c.includes(`right`)&&e>0&&(n=e**kY),!c.includes(`left`)&&e<0&&(n=-(Math.abs(e)**kY))),!c.includes(`up`)&&!c.includes(`down`)?r=t>0?t**kY:-(Math.abs(t)**kY):(!c.includes(`down`)&&t>0&&(r=t**kY),!c.includes(`up`)&&t<0&&(r=-(Math.abs(t)**kY))),{x:n,y:r}}function H(e){if(e.button!==0)return;e.pointerType===`touch`&&u.pauseTimers();let t=oY(e.nativeEvent);if(!(t&&t.closest(`button,a,input,textarea,[role="button"],[data-swipe-ignore]`))){if(F.current=!1,N.current=void 0,P.current=0,j.current={x:e.clientX,y:e.clientY},I.current=j.current,A.current){let e=MY(A.current);M.current=e,C(e),b({x:e.x,y:e.y})}u.setHovering(!0),m(!0),g(!1),k(null),L.current=!0,A.current?.setPointerCapture(e.pointerId)}}function re(e){if(!p)return;e.preventDefault(),L.current&&=(j.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>I.current.y||i>0&&t<I.current.y)&&(I.current={x:I.current.x,y:t}),(r<0&&n>I.current.x||r>0&&n<I.current.x)&&(I.current={x:n,y:I.current.y});let a=n-j.current.x,o=t-j.current.y,s=t-I.current.y,l=n-I.current.x;if(!h&&Math.sqrt(a*a+o*o)>=AY&&(g(!0),O===null)){let e=c.includes(`left`)||c.includes(`right`),t=c.includes(`up`)||c.includes(`down`);e&&t&&k(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let u;if(!N.current)O===`vertical`?o>0?u=`down`:o<0&&(u=`up`):O===`horizontal`?a>0?u=`right`:a<0&&(u=`left`):u=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,u&&c.includes(u)&&(N.current=u,P.current=jY(u,a,o),f(u));else{let e=N.current,t=jY(e,l,s);t>DY?(F.current=!1,f(e)):!(c.includes(`left`)&&c.includes(`right`))&&!(c.includes(`up`)&&c.includes(`down`))&&P.current-t>=OY&&(F.current=!0)}let d=ne(a,o),m=M.current.x,_=M.current.y;O===`horizontal`?(c.includes(`left`)||c.includes(`right`))&&(m+=d.x):(O===`vertical`||(c.includes(`left`)||c.includes(`right`))&&(m+=d.x),(c.includes(`up`)||c.includes(`down`))&&(_+=d.y)),b({x:m,y:_})}function ie(e){if(!p)return;if(m(!1),g(!1),k(null),A.current?.releasePointerCapture(e.pointerId),F.current){b({x:S.x,y:S.y}),f(void 0);return}let t=!1,r=y.x-S.x,i=y.y-S.y,a;for(let e of c){switch(e){case`right`:r>DY&&(t=!0,a=`right`);break;case`left`:r<-DY&&(t=!0,a=`left`);break;case`down`:i>DY&&(t=!0,a=`down`);break;case`up`:i<-DY&&(t=!0,a=`up`);break;default:break}if(t)break}t?(f(a),v(!0),u.closeToast(n.id)):(b({x:S.x,y:S.y}),f(void 0))}function ae(e){if(e.key===`Escape`){if(!A.current||!aY(A.current,iY(qJ(A.current))))return;u.closeToast(n.id)}}x.useEffect(()=>{if(!l)return;let e=A.current;if(!e)return;function t(t){aY(e,t.target)&&t.preventDefault()}return e.addEventListener(`touchmove`,t,{passive:!1}),()=>{e.removeEventListener(`touchmove`,t)}},[l]);function oe(){if(!p&&y.x===S.x&&y.y===S.y&&!_)return{[TY.swipeMovementX]:`0px`,[TY.swipeMovementY]:`0px`};let e=y.x-S.x,t=y.y-S.y;return{transition:p?`none`:void 0,transform:p?`translateX(${y.x}px) translateY(${y.y}px) scale(${S.scale})`:void 0,[TY.swipeMovementX]:`${e}px`,[TY.swipeMovementY]:`${t}px`}}let se=n.priority===`high`,ce={role:se?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":w,"aria-describedby":E,"aria-hidden":se&&!B?!0:void 0,onPointerDown:l?H:void 0,onPointerMove:l?re:void 0,onPointerUp:l?ie:void 0,onKeyDown:ae,inert:hY(n.limited),style:{...oe(),[TY.index]:n.transitionStatus===`ending`?ee:R,[TY.offsetY]:`${z}px`,[TY.height]:n.height?`${n.height}px`:void 0}},le=x.useMemo(()=>({rootRef:A,toast:n,titleId:w,setTitleId:T,descriptionId:E,setDescriptionId:D,swiping:p,swipeDirection:d,recalculateHeight:V,index:ee,visibleIndex:R,expanded:te}),[n,w,E,p,d,V,ee,R,te]),ue={transitionStatus:n.transitionStatus,expanded:te,limited:n.limited||!1,type:n.type,swiping:le.swiping,swipeDirection:le.swipeDirection},de=xG(`div`,e,{ref:[t,le.rootRef],state:ue,stateAttributesMapping:EY,props:[ce,o]});return(0,W.jsx)(gY.Provider,{value:le,children:de})}),PY=x.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setDescriptionId:c}=_Y(),l=a??s.description,u=!!l,d=AG(i);YW(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=xG(`p`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),FY=x.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setTitleId:c}=_Y(),l=a??s.title,u=!!l,d=AG(i);YW(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=xG(`h2`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),IY=x.forwardRef(function(e,t){let{render:n,className:r,disabled:i,nativeButton:a=!0,...o}=e,s=Xq(),{toast:c}=_Y(),l=s.useState(`expanded`),[u,d]=x.useState(!1),{getButtonProps:f,buttonRef:p}=BG({disabled:i,native:a}),m={type:c.type};return xG(`button`,e,{ref:[t,p],state:m,props:[{"aria-hidden":!l&&!u,onClick(){s.closeToast(c.id)},onFocus(){d(!0)},onBlur(){d(!1)}},o,f]})});function LY(){let e=x.useContext(Yq);if(!e)throw Error(tG(73));let t=e.useState(`toasts`);return x.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function RY(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||KJ(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var zY=5e3,BY=RY();function VY({toast:e}){return(0,W.jsxs)(NY,{toast:e,className:jq(`relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg`,`data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]`,`data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]`,`data-[ending-style]:opacity-0`,`data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0`,`transition-all duration-200`,e.type===`error`&&`border-error/50`,e.type===`success`&&`border-approval/50`,(!e.type||e.type===`info`)&&`border-border`),children:[(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsx)(FY,{className:jq(`text-sm font-medium`,e.type===`error`&&`text-error`,e.type===`success`&&`text-approval`,(!e.type||e.type===`info`)&&`text-primary`),children:e.title}),e.description&&(0,W.jsx)(PY,{className:`mt-1 text-xs text-muted line-clamp-2`,children:e.description})]}),(0,W.jsx)(IY,{className:`shrink-0 text-muted hover:text-primary transition-colors`,"aria-label":`Close`,children:(0,W.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,W.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}function HY(){let{toasts:e}=LY();return(0,W.jsx)(W.Fragment,{children:e.map(e=>(0,W.jsx)(VY,{toast:e},e.id))})}function UY(){return(0,W.jsxs)(dY,{timeout:zY,toastManager:BY,children:[(0,W.jsx)(HY,{}),(0,W.jsx)(mY,{className:`fixed bottom-4 right-4 z-[100] flex flex-col gap-2`})]})}var WY=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],GY=3e3,KY=8e3,qY=15e3,JY=5e3,YY=2e4,XY=1e4,ZY=1500,QY=5e3,$Y=750,eX=4,tX=5e3,nX=new class{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status=`connecting`,this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.connectTimer=null,this.manualClose=!1,this.lastTick=Date.now(),this.wakeCheckInterval=null,this.lifecycleStarted=!1,this.heartbeatTimer=null,this.pongTimer=null,this.lastForceReconnectTs=0,this.lastConnectTs=0,this.pingSeq=0,this.connectionEpoch=0,this.consecutiveFailures=0,this.isResumeAttempt=!1,this.leakedSockets=new Set,this.verifyTimer=null,this.onVisibilityChange=()=>{if(J(`ws_visibility`,{state:document.visibilityState,...this.wsSnap()},`info`),document.visibilityState===`visible`){let e=Date.now(),t=e-this.lastTick;this.lastTick=e,J(`ws_resume`,{gapMs:t,...this.wsSnap()},`info`),this.ws?.readyState===WebSocket.OPEN?this.verifyConnection():this.forceReconnect(`visibilitychange`,!0)}else this.stopHeartbeat(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null)},this.onPageShow=e=>{J(`ws_pageshow`,{persisted:e.persisted,...this.wsSnap()},`info`),e.persisted&&(this.lastTick=Date.now(),this.forceReconnect(`pageshow`,!0))}}wsSnap(){return{status:this.status,ws:this.ws?WY[this.ws.readyState]:null,attempt:this.reconnectAttempts,failures:this.consecutiveFailures,leaked:this.leakedSockets.size,online:typeof navigator<`u`?navigator.onLine:void 0,verifying:this.verifyTimer!==null,buffered:this.ws?this.ws.bufferedAmount:void 0}}connect(){if(this.ws){let e=this.ws.readyState===WebSocket.OPEN;if(e&&this.status===`connected`){J(`ws_connect_skip`,{reason:`already_open`,...this.wsSnap()});return}let t=Date.now();if(this.ws.readyState===WebSocket.CONNECTING&&t-this.lastConnectTs<200){J(`ws_connect_skip`,{reason:`already_connecting`,...this.wsSnap()});return}J(`ws_connect_destroy_zombie`,{reason:e?`open_desynced`:`not_open`,...this.wsSnap()}),this.destroySocket()}this.manualClose=!1,this.clearConnectTimer(),this.setStatus(`connecting`);let e=`${window.location.protocol===`https:`?`wss`:`ws`}://${window.location.host}/ws`;J(`ws_connect`,{url:e,resume:this.isResumeAttempt,...this.wsSnap()},`info`);let t=new WebSocket(e);this.ws=t,this.lastConnectTs=Date.now(),this.leakedSockets.add(t);let n=this.isResumeAttempt?KY:GY;this.isResumeAttempt=!1,this.connectTimer=window.setTimeout(()=>{this.ws===t&&(this.connectTimer=null,t.readyState===WebSocket.OPEN&&this.status===`connected`||(J(`ws_connect_timeout`,{wsState:WY[t.readyState],managerStatus:this.status,timeoutMs:n,...this.wsSnap()},`info`),this.consecutiveFailures+=1,this.destroySocket(),this.scheduleReconnect()))},n),t.onopen=()=>{if(this.ws!==t){J(`ws_onopen_stale`,this.wsSnap(),`info`);return}J(`ws_onopen`,this.wsSnap(),`info`),this.clearConnectTimer(),this.reconnectAttempts=0,this.consecutiveFailures=0,this.connectionEpoch+=1,this.leakedSockets.delete(t),this.setStatus(`connected`),this.startHeartbeat()},t.onmessage=e=>{try{let t=e.data,n=performance.now(),r=JSON.parse(t),i=performance.now()-n,a=r;if(a._parseMs=Math.round(i),a._rawLength=t.length,r.type===`pong`){r.seq===this.pingSeq&&(this.clearPongTimer(),this.verifyTimer!==null&&(this.cancelVerify(),J(`ws_verify_ok`,this.wsSnap(),`info`),this.startHeartbeat(QY)));return}this.listeners.forEach(e=>e(r))}catch{}},t.onerror=()=>{this.ws===t&&(J(`ws_onerror`,this.wsSnap(),`info`),this.clearConnectTimer())},t.onclose=e=>{if(this.ws!==t){J(`ws_onclose_stale`,{code:e.code,...this.wsSnap()},`info`);return}J(`ws_onclose`,{code:e.code,reason:e.reason,clean:e.wasClean,...this.wsSnap()},`info`),this.clearConnectTimer(),this.cancelVerify(),this.consecutiveFailures+=1,this.ws=null,this.manualClose?this.setStatus(`disconnected`):this.scheduleReconnect()}}disconnect(){this.manualClose=!0,this.clearConnectTimer(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),this.setStatus(`disconnected`)}startLifecycleListeners(){this.lifecycleStarted||typeof document>`u`||typeof window>`u`||(this.lifecycleStarted=!0,document.addEventListener(`visibilitychange`,this.onVisibilityChange),window.addEventListener(`pageshow`,this.onPageShow),this.lastTick=Date.now(),this.wakeCheckInterval=window.setInterval(()=>{let e=Date.now(),t=e-this.lastTick;this.isHidden()||(t>qY&&(J(`ws_time_jump`,{gapMs:t,...this.wsSnap()},`info`),this.forceReconnect(`time_jump`,!0)),this.lastTick=e)},JY))}stopLifecycleListeners(){this.lifecycleStarted&&(this.lifecycleStarted=!1,document.removeEventListener(`visibilitychange`,this.onVisibilityChange),window.removeEventListener(`pageshow`,this.onPageShow),this.wakeCheckInterval!==null&&(window.clearInterval(this.wakeCheckInterval),this.wakeCheckInterval=null))}send(e){if(this.ws?.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(e)),!0}catch(t){return J(`ws_send_error`,{messageType:e.type,error:t instanceof Error?t.message:String(t),...this.wsSnap()},`info`),this.destroySocket(),this.scheduleReconnect(),!1}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeStatus(e){return this.statusListeners.add(e),e(this.status,this.error,this.connectionEpoch),()=>this.statusListeners.delete(e)}getStatus(){return this.status}getConnectionEpoch(){return this.connectionEpoch}verifyConnection(){this.cancelVerify(),this.stopHeartbeat(),this.pingSeq+=1;let e=this.pingSeq,t=this.ws;if(J(`ws_verify`,{seq:e,...this.wsSnap()},`info`),!this.send({type:`ping`,seq:e})){J(`ws_verify_send_fail`,this.wsSnap(),`info`),this.forceReconnect(`verify_send_fail`,!0);return}this.verifyTimer=window.setTimeout(()=>{this.verifyTimer=null,this.ws===t&&(J(`ws_verify_timeout`,this.wsSnap(),`info`),this.forceReconnect(`verify_timeout`,!0))},ZY)}cancelVerify(){this.verifyTimer!==null&&(window.clearTimeout(this.verifyTimer),this.verifyTimer=null)}forceReconnect(e=`unknown`,t=!1){if(this.manualClose){J(`ws_force_skip`,{trigger:e,reason:`manual_close`});return}let n=Date.now(),r=t?200:500;if(n-this.lastForceReconnectTs<r){J(`ws_force_skip`,{trigger:e,reason:`debounce`,force:t});return}if(!t&&this.ws?.readyState===WebSocket.OPEN&&this.status===`connected`){J(`ws_force_skip`,{trigger:e,reason:`already_connected`});return}this.lastForceReconnectTs=n,J(`ws_force_reconnect`,{trigger:e,force:t,...this.wsSnap()},`info`),this.reconnectAttempts=0,this.consecutiveFailures=0,this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),t?(this.purgeLeakedSockets(),this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},$Y)):this.connect()}startHeartbeat(e){this.stopHeartbeat();let t=()=>{this.ws?.readyState===WebSocket.OPEN&&(this.pingSeq+=1,this.send({type:`ping`,seq:this.pingSeq})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,J(`ws_pong_timeout`,this.wsSnap(),`info`),this.destroySocket(),this.scheduleReconnect()},XY)))};e!==void 0&&e<YY?this.heartbeatTimer=window.setTimeout(()=>{t(),this.heartbeatTimer=window.setInterval(t,YY)},e):this.heartbeatTimer=window.setInterval(t,YY)}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null),this.clearPongTimer()}clearPongTimer(){this.pongTimer!==null&&(window.clearTimeout(this.pongTimer),this.pongTimer=null)}setStatus(e,t=null){this.status=e,this.error=t,this.statusListeners.forEach(n=>n(e,t,this.connectionEpoch))}scheduleReconnect(){if(this.stopHeartbeat(),this.isHidden()){J(`ws_schedule_skip`,{reason:`hidden`,...this.wsSnap()}),this.setStatus(`reconnecting`);return}if(this.consecutiveFailures>=eX){J(`ws_stall_detected`,this.wsSnap(),`info`),this.purgeLeakedSockets(),this.consecutiveFailures=0,this.reconnectAttempts=0,this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},tX);return}this.reconnectAttempts+=1;let e=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);J(`ws_schedule_reconnect`,{delay:e,...this.wsSnap()}),this.setStatus(`reconnecting`),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}isHidden(){return typeof document<`u`&&document.visibilityState===`hidden`}clearConnectTimer(){this.connectTimer&&=(window.clearTimeout(this.connectTimer),null)}destroySocket(){if(this.clearConnectTimer(),this.stopHeartbeat(),this.cancelVerify(),!this.ws)return;let e=this.ws;this.ws=null,this.leakedSockets.add(e),e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}purgeLeakedSockets(){if(this.leakedSockets.size!==0){J(`ws_purge_leaked`,{count:this.leakedSockets.size},`info`);for(let e of this.leakedSockets)try{e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,e.close()}catch{}this.leakedSockets.clear()}}};function rX(){let e=qm(e=>e.setConnectionState);return(0,x.useEffect)(()=>{nX.connect(),nX.startLifecycleListeners();let t=nX.subscribeStatus((t,n,r)=>{e(t,n,r)});return()=>{t(),nX.stopLifecycleListeners()}},[e]),{sendMessage:(0,x.useMemo)(()=>e=>{nX.send(e)},[]),subscribe:(0,x.useMemo)(()=>nX.subscribe.bind(nX),[]),getConnectionEpoch:(0,x.useMemo)(()=>()=>nX.getConnectionEpoch(),[])}}var iX=100;function aX({viewport:e,win:t,doc:n}){if(!e)return!1;let r=Math.max(0,e.offsetTop||0),i=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+r),o=Math.max(0,a),s=Math.max(0,e.height||0),c=Math.max(0,e.width||0);return n.documentElement.style.setProperty(`--keyboard-inset`,`${o}px`),n.documentElement.style.setProperty(`--viewport-offset-top`,`${r}px`),n.documentElement.style.setProperty(`--viewport-offset-left`,`${i}px`),n.documentElement.style.setProperty(`--visual-viewport-height`,`${s}px`),n.documentElement.style.setProperty(`--visual-viewport-width`,`${c}px`),o>iX?n.documentElement.classList.add(`keyboard-visible`):n.documentElement.classList.remove(`keyboard-visible`),!0}function oX(e){e.documentElement.style.removeProperty(`--keyboard-inset`),e.documentElement.style.removeProperty(`--viewport-offset-top`),e.documentElement.style.removeProperty(`--viewport-offset-left`),e.documentElement.style.removeProperty(`--visual-viewport-height`),e.documentElement.style.removeProperty(`--visual-viewport-width`),e.documentElement.classList.remove(`keyboard-visible`)}function sX(){(0,x.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=null,n=null,r=()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName?.toLowerCase();return t===`input`||t===`textarea`?!0:!!e.isContentEditable},i=()=>{aX({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!=`function`){i();return}t!==null&&window.cancelAnimationFrame(t);let e=performance.now(),n=()=>{i(),t=performance.now()-e<1500?window.requestAnimationFrame(n):null};t=window.requestAnimationFrame(n)},o=()=>{if(!r()){c();return}i()},s=()=>{n!==null||typeof window.setInterval!=`function`||(n=window.setInterval(o,250),o())},c=()=>{n===null||typeof window.clearInterval!=`function`||(window.clearInterval(n),n=null)},l=()=>{r()?(a(),s(),i()):c()},u=()=>{l()},d=()=>{l()},f=()=>{a()};return i(),l(),e.addEventListener(`resize`,i),e.addEventListener(`scroll`,i),typeof window.addEventListener==`function`&&(window.addEventListener(`resize`,i),window.addEventListener(`orientationchange`,f)),typeof document.addEventListener==`function`&&(document.addEventListener(`focusin`,u),document.addEventListener(`focusout`,d),document.addEventListener(`focus`,u,!0),document.addEventListener(`blur`,d,!0)),()=>{e.removeEventListener(`resize`,i),e.removeEventListener(`scroll`,i),typeof window.removeEventListener==`function`&&(window.removeEventListener(`resize`,i),window.removeEventListener(`orientationchange`,f)),typeof document.removeEventListener==`function`&&(document.removeEventListener(`focusin`,u),document.removeEventListener(`focusout`,d),document.removeEventListener(`focus`,u,!0),document.removeEventListener(`blur`,d,!0)),t!==null&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(t),c(),oX(document)}},[])}var cX=[`theme`,`commandPresets`,`defaultPresetId`,`defaultProjectDir`,`lastProjectPath`,`recentPaths`,`sessionSortMode`,`sessionSortDirection`,`manualSessionOrder`,`projectFilters`,`hostFilters`],lX=[`claude`,`claude-rp`,`codex`,`pi`,`devin`,`grok`,`omp`];function uX(e,t){return Array.isArray(e)&&e.length<=t&&e.every(e=>typeof e==`string`)}function dX(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>=1&&t.id.length<=128&&typeof t.label==`string`&&t.label.trim().length>=1&&t.label.length<=64&&typeof t.command==`string`&&t.command.trim().length>=1&&t.command.length<=1024&&typeof t.isBuiltIn==`boolean`&&(t.agentType===void 0||lX.includes(t.agentType))}var fX={theme:e=>e===`dark`||e===`light`,commandPresets:e=>Array.isArray(e)&&e.length<=50&&e.every(dX),defaultPresetId:e=>typeof e==`string`&&e.length<=128,defaultProjectDir:e=>typeof e==`string`&&e.length<=4096,lastProjectPath:e=>e===null||typeof e==`string`&&e.length<=4096,recentPaths:e=>uX(e,50),sessionSortMode:e=>e===`status`||e===`created`||e===`manual`,sessionSortDirection:e=>e===`asc`||e===`desc`,manualSessionOrder:e=>uX(e,1e3),projectFilters:e=>uX(e,500),hostFilters:e=>uX(e,500)};function pX(e){return cX.includes(e)}function mX(e,t){return fX[e](t)}var hX=`agentboard-theme`,gX=`agentboard-settings`,_X=200,vX=new Map,yX=new Set,bX=null,xX=!1;function SX(e){return e===`theme`?uU.getState().theme:H.getState()[e]}function CX(e){let t=e===`theme`?hX:gX;return M.getItem(t)!==null}function wX(){if(bX=null,yX.size===0)return;let e={};for(let t of yX){let n=SX(t);e[t]=n,vX.set(t,JSON.stringify(n))}yX.clear();try{fetch(`/api/settings/synced`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({settings:e})}).then(e=>{e.ok||J(`synced_settings_push_rejected`,{status:e.status},`warn`)}).catch(e=>{J(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)})}catch(e){J(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)}}function TX(e){yX.add(e),!bX&&(bX=setTimeout(wX,_X))}function EX(e){let t=new Map;for(let e of cX)t.set(e,CX(e));let n={},r;for(let[t,i]of Object.entries(e))!pX(t)||!mX(t,i)||(vX.set(t,JSON.stringify(i)),t===`theme`?r=i:n[t]=i);r!==void 0&&uU.setState({theme:r}),Object.keys(n).length>0&&H.setState(n);for(let n of cX){if(n in e||!t.get(n))continue;let r=SX(n);mX(n,r)&&vX.get(n)!==JSON.stringify(r)&&TX(n)}}function DX(){if(xX)return()=>{};xX=!0;let e=H.subscribe((e,t)=>{let n=e,r=t;for(let e of cX)e!==`theme`&&n[e]!==r[e]&&vX.get(e)!==JSON.stringify(n[e])&&TX(e)}),t=uU.subscribe((e,t)=>{e.theme!==t.theme&&vX.get(`theme`)!==JSON.stringify(e.theme)&&TX(`theme`)});return()=>{e(),t(),xX=!1,bX&&=(clearTimeout(bX),null),yX.clear(),vX.clear()}}function OX(e,t,n){let r=e;return t.length>0&&(r=r.filter(e=>t.includes(e.projectPath))),n.length>0&&(r=r.filter(e=>n.includes(e.host??``))),r}function kX(){let[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(void 0),[i,a]=(0,x.useState)(void 0),[o,s]=(0,x.useState)(void 0),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null),g=qm(e=>e.sessions),_=qm(e=>e.agentSessions),v=qm(e=>e.agentSessionsEpoch),y=qm(e=>e.selectedSessionId),b=qm(e=>e.selectedHibernatingSessionId),S=qm(e=>e.setSessions),C=qm(e=>e.setAgentSessions),w=qm(e=>e.setActiveAgentSessions),T=qm(e=>e.setHostStatuses),E=qm(e=>e.updateSession),D=qm(e=>e.setSelectedSessionId),O=qm(e=>e.setSelectedHibernatingSessionId),k=qm(e=>e.hasLoaded),A=qm(e=>e.connectionStatus),j=qm(e=>e.connectionError),M=qm(e=>e.clearExitingSession),N=qm(e=>e.markSessionExiting),P=qm(e=>e.setRemoteAllowControl),F=qm(e=>e.setRemoteAllowAttach),I=qm(e=>e.setHostLabel),L=qm(e=>e.setPreferWindowName),ee=qm(e=>e.hostStatuses),R=qm(e=>e.remoteAllowControl),z=qm(e=>e.hostLabel),B=uU(e=>e.theme),te=re(),V=H(e=>e.defaultProjectDir),ne=H(e=>e.commandPresets),ie=H(e=>e.defaultPresetId),ae=H(e=>e.lastProjectPath),oe=H(e=>e.setLastProjectPath),se=H(e=>e.addRecentPath),ce=H(e=>e.shortcutModifier),le=H(e=>e.sidebarWidth),ue=H(e=>e.setSidebarWidth),de=H(e=>e.projectFilters),fe=H(e=>e.hostFilters),pe=H(e=>e.soundOnPermission),me=H(e=>e.soundOnIdle),he=qm(e=>e.connectionEpoch),{sendMessage:ge,subscribe:_e,getConnectionEpoch:ve}=rX();(0,x.useEffect)(()=>DX(),[]),sX(),(0,x.useEffect)(()=>{if(typeof document>`u`||!pe&&!me)return;let e=!1,t=()=>{e&&!zq()||(e=!0,Vq())};return document.addEventListener(`click`,t,{passive:!0}),document.addEventListener(`keydown`,t,{passive:!0}),document.addEventListener(`touchstart`,t,{passive:!0}),()=>{document.removeEventListener(`click`,t),document.removeEventListener(`keydown`,t),document.removeEventListener(`touchstart`,t)}},[pe,me]);let ye=(0,x.useRef)(!1),be=(0,x.useCallback)(e=>{e.preventDefault(),ye.current=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]);(0,x.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=e=>{if(!ye.current)return;let t=e.clientX;ue(Math.max(180,Math.min(400,t)))},t=()=>{ye.current&&(ye.current=!1,document.body.style.cursor=``,document.body.style.userSelect=``)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[ue]),(0,x.useEffect)(()=>{let e=_e(e=>{if(e.type!==`terminal-output`){if(e.type===`sessions`){let t=qm.getState().sessions,{soundOnPermission:n,soundOnIdle:r}=H.getState();if(n||r)for(let i of e.sessions){let e=t.find(e=>e.id===i.id);e&&e.status!==i.status&&(e.status!==`permission`&&i.status===`permission`&&n&&Wq(),e.status===`working`&&i.status===`waiting`&&r&&Gq())}if(Ie.current.size>0){let e=ve();for(let[t,n]of Ie.current)n.epoch!==e&&Ie.current.delete(t)}let i=Ie.current.size>0?e.sessions.filter(e=>!Ie.current.has(e.id)):e.sessions,{selectedSessionId:a,selectedHibernatingSessionId:o}=qm.getState(),s=a!==null&&o===null&&!i.some(e=>e.id===a)?t.find(e=>e.id===a)?.agentSessionId?.trim()??null:null;s&&(Me.current=s),S(i);let c=Ne.current,{selectedSessionId:l,selectedHibernatingSessionId:u}=qm.getState(),{projectFilters:d,hostFilters:f}=H.getState();if(c&&l===null&&u===null){let e=i.find(e=>!(e.agentSessionId?.trim()!==c||d.length>0&&!d.includes(e.projectPath)||f.length>0&&!f.includes(e.host??``)));e&&(Ne.current=null,D(e.id))}}if(e.type===`host-status`&&T(e.hosts),e.type===`server-config`&&(P(e.remoteAllowControl),F(e.remoteAllowAttach),I(e.hostLabel),L(e.preferWindowName),e.clientLogLevel&&SE(e.clientLogLevel)),e.type===`synced-settings`&&EX(e.settings),e.type===`session-update`){let t=qm.getState().sessions.find(t=>t.id===e.session.id)?.status,n=e.session.status;if(E(e.session),t){let{soundOnPermission:e,soundOnIdle:r}=H.getState();t!==`permission`&&n===`permission`&&e&&Wq(),t===`working`&&n===`waiting`&&r&&Gq()}}if(e.type===`session-created`){let t=qm.getState().sessions;t.some(t=>t.id===e.session.id)||S([e.session,...t]),D(e.session.id),se(e.session.projectPath);let{projectFilters:n,setProjectFilters:r}=H.getState();n.length>0&&!n.includes(e.session.projectPath)&&r([...n,e.session.projectPath])}if(e.type===`session-removed`){FH(e.sessionId);let t=qm.getState().sessions,n=t.filter(t=>t.id!==e.sessionId);n.length!==t.length&&S(n)}if(e.type===`agent-sessions`){let t=Array.isArray(e.active)?e.active:[],n=Array.isArray(e.hibernating)?e.hibernating:[],r=Array.isArray(e.history)?e.history:[],{selectedHibernatingSessionId:i}=qm.getState(),a=Me.current;i&&!n.some(e=>e.sessionId===i)&&(Ne.current=i),C(t,n,r),h(e=>e&&n.some(t=>t.sessionId===e.sessionId)?null:e),a&&n.some(e=>e.sessionId===a)?(Me.current=null,O(a)):a&&(Me.current=null)}if(e.type===`agent-sessions-active`&&w(Array.isArray(e.active)?e.active:[]),e.type===`session-orphaned`&&!e.supersededBy){let t=qm.getState().sessions,n=t.filter(t=>t.agentSessionId?.trim()!==e.session.sessionId);n.length!==t.length&&S(n)}if(e.type===`session-activated`){let t=qm.getState().sessions.find(t=>t.tmuxWindow===e.window);t&&E({...t,agentSessionId:e.session.sessionId,agentSessionName:e.session.displayName,logFilePath:e.session.logFilePath,isHibernating:e.session.isHibernating,lastUserMessage:e.session.lastUserMessage??t.lastUserMessage})}if(e.type===`session-wake-result`)if(e.ok&&e.session){h(t=>t?.sessionId===e.sessionId?null:t);let t=qm.getState().sessions;t.some(t=>t.id===e.session.id)||S([e.session,...t]),D(e.session.id)}else e.ok||(d(`${e.error?.code}: ${e.error?.message}`),window.setTimeout(()=>d(null),6e3));if(e.type===`session-hibernate-result`&&(e.ok?(e.session&&h(e.session),O(e.sessionId)):(d(e.error??`Failed to hibernate session`),window.setTimeout(()=>d(null),6e3))),e.type===`terminal-error`&&(!e.sessionId||e.sessionId===y)&&(d(`${e.code}: ${e.message}`),window.setTimeout(()=>d(null),6e3)),e.type===`terminal-ready`&&e.sessionId===y&&d(null),e.type===`error`&&(d(e.message),window.setTimeout(()=>d(null),6e3)),e.type===`kill-failed`){let t=Ie.current.get(e.sessionId);if(t){let n=qm.getState().sessions;n.some(t=>t.id===e.sessionId)||S([t.session,...n]),t.wasSelected&&D(e.sessionId),Ie.current.delete(e.sessionId)}M(e.sessionId),d(e.message),window.setTimeout(()=>d(null),6e3)}e.type===`session-move-to-history-result`&&!e.ok&&e.error&&(d(e.error),window.setTimeout(()=>d(null),6e3))}});return()=>{e()}},[y,b,se,M,ge,D,O,h,S,C,w,T,P,F,I,L,_e,E]);let xe=(0,x.useMemo)(()=>g.find(e=>e.id===y)||null,[y,g]),Se=_.hibernating??[],Ce=_.history??[],we=(0,x.useMemo)(()=>OX(Se,de,fe),[Se,de,fe]),Te=(0,x.useMemo)(()=>we.find(e=>e.sessionId===b)||(m?.sessionId===b?m:null),[we,m,b]);(0,x.useEffect)(()=>{xe?.projectPath&&!xe.remote&&oe(xe.projectPath)},[xe?.projectPath,xe?.remote,oe]);let Ee=H(e=>e.sessionSortMode),De=H(e=>e.sessionSortDirection),Oe=H(e=>e.manualSessionOrder),ke=(0,x.useMemo)(()=>Mm(g,{mode:Ee,direction:De,manualOrder:Oe}),[g,Ee,De,Oe]),Ae=(0,x.useMemo)(()=>{let e=ke;return de.length>0&&(e=e.filter(e=>de.includes(e.projectPath))),fe.length>0&&(e=e.filter(e=>fe.includes(e.host??``))),e},[ke,de,fe]),je=(0,x.useRef)(b),Me=(0,x.useRef)(null),Ne=(0,x.useRef)(null),Pe=(0,x.useRef)(he),Fe=(0,x.useCallback)(()=>Ae.length>0?(D(Ae[0].id),!0):we.length>0?(O(we[0].sessionId),!0):!1,[Ae,we,D,O]);(0,x.useEffect)(()=>{let e=je.current;e&&b===null&&!Se.some(t=>t.sessionId===e)?Ne.current=e:b!==null&&(Ne.current=null),je.current=b},[Se,b]),(0,x.useEffect)(()=>{m&&b!==m.sessionId&&h(null)},[m,b]),(0,x.useEffect)(()=>{Pe.current!==he&&(Pe.current=he,Me.current=null,Ne.current=null,h(null))},[he]),(0,x.useEffect)(()=>{k&&(b||y&&(Ae.some(e=>e.id===y)||Fe()||D(null)))},[k,y,b,Fe,D]),(0,x.useEffect)(()=>{if(!b||m?.sessionId===b||v!==he||we.some(e=>e.sessionId===b))return;let e=Ae.find(e=>e.agentSessionId?.trim()===b);if(e){D(e.id);return}Fe()||O(null)},[we,Ae,v,m,b,Fe,D,O,he]),(0,x.useEffect)(()=>{let e=Ne.current;if(!e)return;if(b!==null){Ne.current=null;return}let t=Ae.find(t=>t.agentSessionId?.trim()===e);if(t){Ne.current=null,D(t.id);return}if(y!==null){Ne.current=null;return}Fe()&&(Ne.current=null)},[Ae,y,b,Fe,D]),(0,x.useEffect)(()=>{window.matchMedia(`(max-width: 767px)`).matches&&k&&y===null&&b===null&&(Ae.length>0||we.length>0)&&Fe()},[we.length,Ae.length,k,Fe,y,b]);let Ie=(0,x.useRef)(new Map),Le=(0,x.useCallback)((e,t=`unknown`)=>{FH(e);let{sessions:n,selectedSessionId:r}=qm.getState(),i=n.find(t=>t.id===e);i&&Ie.current.set(e,{session:i,wasSelected:r===e,epoch:ve()}),(0,U.flushSync)(()=>{N(e),S(n.filter(t=>t.id!==e))}),ge({type:`session-kill`,sessionId:e,source:t})},[N,S,ge]);(0,x.useEffect)(()=>{let n=qe(ce),r=r=>{if(r.defaultPrevented)return;let i=r.code,a=Xe(r,n);if(a&&(i===`BracketLeft`||i===`BracketRight`)){r.preventDefault();let e=i===`BracketLeft`?-1:1,t=Ae;if(t.length===0){let t=we;if(t.length===0)return;let n=t.findIndex(e=>e.sessionId===b);if(n===-1){O(t[0].sessionId);return}O(t[(n+e+t.length)%t.length].sessionId);return}let n=t.findIndex(e=>e.id===y);if(n===-1){D(t[0].id);return}D(t[(n+e+t.length)%t.length].id);return}if(a&&/^Digit[1-9]$/.test(i)){let e=Number(i.slice(5))-1;if(Ae.length>0){let t=Ae[e];if(!t)return;r.preventDefault(),D(t.id);return}let t=we[e];if(!t)return;r.preventDefault(),O(t.sessionId);return}if(a&&i===`KeyN`){r.preventDefault(),!e&&te&&t(!0);return}if(a&&i===`KeyX`){r.preventDefault(),y&&!e&&Le(y,`keyboard_shortcut`);return}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,y,b,D,O,Ae,we,Le,ce,te]);let Re=()=>te?(r(void 0),a(void 0),s(void 0),t(!0),!0):!1,ze=()=>l(!0),Be=(e,t,n,r)=>{ge({type:`session-create`,projectPath:e,name:t,command:n,host:r}),r||oe(e)},Ve=e=>{ge({type:`session-wake`,sessionId:e})},He=(0,x.useCallback)(e=>{ge({type:`session-hibernate`,sessionId:e})},[ge]),Ue=(e,t)=>{ge({type:`session-rename`,sessionId:e,newName:t})},We=(0,x.useCallback)(e=>{let t=g.find(t=>t.id===e);t&&ge({type:`session-create`,projectPath:t.projectPath,command:t.command||void 0,host:t.remote&&t.host?t.host:void 0})},[g,ge]),Ge=(0,x.useCallback)(e=>{ge({type:`session-move-to-history`,sessionId:e})},[ge]);(0,x.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,B)},[B]),(0,x.useEffect)(()=>{fetch(`/api/server-info`).then(e=>e.json()).then(e=>p(e)).catch(()=>{})},[]);let Ke=(0,x.useMemo)(()=>z?ee.filter(e=>e.host!==z):ee,[ee,z]);return(0,W.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[(0,W.jsxs)(`div`,{className:`hidden h-full flex-col md:flex md:shrink-0`,style:{width:le},children:[(0,W.jsx)($e,{connectionStatus:A,onNewSession:Re,onOpenSettings:ze,tailscaleIp:f?.tailscaleIp??null}),(0,W.jsx)(_E,{sessions:g,hibernatingSessions:Se,historySessions:Ce,selectedSessionId:y,selectedHibernatingSessionId:b,onSelect:D,onSelectHibernating:O,onRename:Ue,onResume:Ve,onHibernate:He,onKill:Le,onDuplicate:We,onMoveToHistory:Ge,onNewSession:Re,loading:!k,error:j||u})]}),(0,W.jsx)(`div`,{className:`hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20`,onMouseDown:be}),(0,W.jsx)(hW,{session:xe,sessions:Ae,hibernatingSession:Te,hibernatingSessions:Se,connectionStatus:A,connectionEpoch:he,sendMessage:ge,subscribe:_e,onClose:()=>D(null),onSelectSession:D,onSelectHibernatingSession:O,onNewSession:Re,onKillSession:Le,onRenameSession:Ue,onOpenSettings:ze,onResumeSession:Ve,onHibernateSession:He,onMoveToHistory:Ge,historySessions:Ce,loading:!k,error:j||u}),(0,W.jsx)(PW,{isOpen:e,onClose:()=>t(!1),onCreate:Be,defaultProjectDir:V,commandPresets:ne,defaultPresetId:ie,lastProjectPath:ae,activeProjectPath:xe&&!xe.remote?xe.projectPath:void 0,remoteHosts:Ke,remoteAllowControl:R,initialHost:n,initialPath:i,initialCommand:o}),(0,W.jsx)(Kq,{isOpen:c,onClose:()=>l(!1)}),(0,W.jsx)(UY,{})]})}var AX=`modulepreload`,jX=function(e){return`/`+e},MX={},NX=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=jX(t,n),t in MX)return;MX[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`:AX,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)})},PX=`true`,FX=`false`,IX=PX===`true`,LX=FX===`true`;function RX(e={}){let{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:o}=e,s,c,l,u=async(e=!0)=>{await c,IX||l?.()};async function d(){if(`serviceWorker`in navigator){if(s=await NX(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bq4GJJid.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{o?.(e)}),!s)return;if(l=()=>{s?.messageSkipWaiting()},!LX)if(IX)s.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&window.location.reload()}),s.addEventListener(`installed`,e=>{e.isUpdate||r?.()});else{let e=!1,t=()=>{e=!0,s?.addEventListener(`controlling`,e=>{e.isUpdate&&window.location.reload()}),n?.()};s.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&r?.():n.isExternal?t():!e&&r?.():n.isUpdate||r?.()}),s.addEventListener(`waiting`,t)}s.register({immediate:t}).then(e=>{a?a(`/sw.js`,e):i?.(e)}).catch(e=>{o?.(e)})}}return c=d(),u}We()&&document.documentElement.classList.add(`ios`),Ge()&&document.documentElement.classList.add(`ios-pwa`),RX({immediate:!0,onRegisteredSW(e,t){t&&(setInterval(()=>{t.update()},300*1e3),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&t.update()}))}});var zX=document.getElementById(`root`);if(!zX)throw Error(`Root element not found`);(0,E.createRoot)(zX).render((0,W.jsx)(x.StrictMode,{children:(0,W.jsx)(kX,{})}));
306
+ `,onClick:()=>{mW(),u(t.id)},title:lt?t.name:void 0,children:i},t.id)})})]}),(0,W.jsxs)(`div`,{className:`relative flex-1`,children:[(0,W.jsx)(`div`,{ref:we,className:`absolute inset-0`,style:{backgroundColor:S.background}}),Me&&e&&(0,W.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-2 z-50 flex items-center gap-1.5 rounded-lg bg-black/60 px-2.5 py-1.5 text-xs text-white/90 shadow-lg backdrop-blur-md`,children:[(0,W.jsxs)(`svg`,{className:`h-3 w-3 animate-spin`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,W.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,W.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]}),`Loading`]}),Fe&&e&&(0,W.jsxs)(`div`,{className:`absolute ${j&&!N?`bottom-20`:`bottom-8`} left-1/2 z-30 flex max-w-[calc(100%-2rem)] -translate-x-1/2 items-center gap-2 rounded-lg border border-border bg-elevated/95 px-2 py-2 shadow-lg backdrop-blur-sm md:left-auto md:right-4 md:translate-x-0`,children:[(0,W.jsx)(`span`,{className:`max-w-[12rem] truncate text-xs text-secondary md:max-w-[18rem]`,children:`Selection ready`}),(0,W.jsxs)(`button`,{type:`button`,onClick:Ie,className:`flex h-8 shrink-0 items-center justify-center gap-1.5 rounded bg-accent px-2.5 text-xs font-medium text-white hover:bg-accent/90 active:scale-95 transition-all`,title:`Copy selection`,"aria-label":`Copy selection`,children:[(0,W.jsx)(de,{width:14,height:14}),`Copy`]}),(0,W.jsx)(`button`,{type:`button`,onClick:Re,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,W.jsx)(Ue,{width:14,height:14})})]}),!e&&(0,W.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-muted`,children:n?null:`Select a session to view terminal`}),e&&ve&&(0,W.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-center text-sm text-muted`,children:`Remote session (read-only). Use SSH to attach on the host.`}),n&&(0,W.jsx)(`div`,{className:`absolute inset-0 z-10 overflow-y-auto bg-base`,children:(0,W.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col gap-4 p-4 md:p-6`,children:[(0,W.jsx)(`div`,{className:`border-b border-border pb-4`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,W.jsx)(`h2`,{className:`min-w-0 truncate text-lg font-semibold text-primary`,children:be}),(0,W.jsx)(`span`,{className:`rounded-full bg-blue-500/15 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),xe&&(0,W.jsx)(`span`,{className:`text-muted`,children:xe}),(0,W.jsxs)(`span`,{className:`text-muted`,children:[`Last active `,Se]})]}),n.lastResumeError&&(0,W.jsxs)(`div`,{className:`inline-flex items-center gap-1 rounded bg-amber-500/15 px-2 py-1 text-xs text-amber-400`,title:`Last wake failed: ${n.lastResumeError}`,children:[(0,W.jsx)(ae,{width:12,height:12}),`Last wake failed`]}),n.lastUserMessage&&(0,W.jsx)(`p`,{className:`max-h-28 max-w-3xl overflow-y-auto whitespace-pre-wrap break-words pr-2 text-sm leading-6 text-secondary`,children:n.lastUserMessage})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>h(n.sessionId),className:`btn btn-primary hidden md:inline-flex`,children:`Wake`}),_&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>_(n.sessionId),className:`btn btn-secondary`,children:`Move to History`})]})]})}),(0,W.jsx)(fE,{session:n})]})}),ke&&e&&!N?(0,W.jsxs)(`button`,{type:`button`,onClick:ze,className:`absolute bottom-14 left-1/2 z-20 flex h-10 items-center justify-center overflow-hidden rounded-full border border-amber-400/35 bg-amber-500/20 text-amber-100 shadow-lg backdrop-blur-sm transition-all hover:bg-amber-500/30 active:scale-95 md:bottom-8`,style:{transform:`translateX(-50%)`},title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,W.jsx)(`span`,{className:`px-3 text-[11px] font-semibold uppercase tracking-wide`,children:`Copy mode`}),(0,W.jsx)(`span`,{className:`self-stretch border-l border-amber-400/25`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`px-3 text-sm font-medium`,children:`Exit`})]}):j&&e&&!N?(0,W.jsxs)(`button`,{type:`button`,onClick:ze,className:`absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all`,style:{transform:`translateX(-50%)`},title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M12 5v14M5 12l7 7 7-7`})}),(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`Jump to bottom`})]}):null]}),(0,W.jsx)(JU,{...ot}),e&&(0,W.jsx)(cW,{onSendKey:nt,onPasteText:rt,onPasteImage:it,disabled:a!==`connected`||ve||!Pe,sessions:t.map(e=>({id:e.id,name:e.name,status:e.status})),currentSessionId:e.id,agentType:e.agentType,fileUploadsAllowed:!fe,onSelectSession:u,hideSessionSwitcher:!0,onRefocus:at,isKeyboardVisible:ct,onEnterTextMode:st}),(A||k)&&(0,W.jsx)(lW,{isOpen:z,onClose:()=>B(!1),sessions:t,hibernatingSessions:r,historySessions:i,selectedSessionId:e?.id??null,selectedHibernatingSessionId:n?.sessionId??null,onSelect:u,onSelectHibernating:d,onRename:m,onResume:h,onHibernate:g,onMoveToHistory:_,onNewSession:f,loading:y,error:b}),F&&e&&(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,children:(0,W.jsxs)(`div`,{className:`mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl`,children:[(0,W.jsx)(`h3`,{className:`text-base font-medium text-primary mb-2 text-balance`,children:`Kill Session`}),(0,W.jsxs)(`p`,{className:`text-sm text-secondary mb-4 text-pretty`,children:[`Kill "`,e.agentSessionName||e.name,`"? The process will be terminated. Conversation history is preserved in logs.`]}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,W.jsx)(`button`,{onClick:()=>I(!1),className:`btn py-1.5 px-3 text-sm`,children:`Cancel`}),(0,W.jsx)(`button`,{ref:ce,onClick:He,className:`btn btn-danger py-1.5 px-3 text-sm`,children:`Kill Session`})]})]})})]})}function gW({onSelect:e,onCancel:t,initialPath:n}){let[r,i]=(0,x.useState)(n||`~`),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(!0),[d,f]=(0,x.useState)(-1),p=(0,x.useRef)(null),m=H(e=>e.recentPaths),h=(0,x.useCallback)(async e=>{p.current?.abort();let t=new AbortController;p.current=t;let{signal:n}=t;u(!0),c(null),o(null),f(-1),i(e);try{let r=await fetch(`/api/directories?path=${encodeURIComponent(e)}`,{signal:n});if(!r.ok){let e=await r.json();throw Error(e.message||`Failed to load directory`)}let a=await r.json();if(p.current!==t)return;o(a),i(a.path)}catch(e){if(p.current!==t)return;let n=e;n?.name!==`AbortError`&&c(n?.message||`Failed to load directory`)}finally{p.current===t&&u(!1)}},[]);(0,x.useEffect)(()=>(h(n||`~`),()=>{p.current?.abort()}),[h,n]);let g=a?.directories??[],_=a?.path||r,v=a?.parent;return(0,x.useEffect)(()=>{let n=n=>{if(n.key===`Escape`){n.preventDefault(),t();return}if(!l){if(n.key===`ArrowDown`){n.preventDefault(),f(e=>g.length===0?-1:e<0?0:Math.min(e+1,g.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),f(e=>g.length===0?-1:e<0?g.length-1:Math.max(e-1,0));return}if(n.key===`Enter`){n.preventDefault();let t=g[d];t?h(t.path):_&&e(_);return}n.key===`Backspace`&&v&&(n.preventDefault(),h(v))}};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[g,_,h,d,l,t,e,v]),(0,W.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Directory browser`,className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},"data-testid":`directory-browser`,children:(0,W.jsxs)(`div`,{className:`w-full max-w-lg border border-border bg-elevated p-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border pb-2`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{v&&h(v)},disabled:!v||l,children:`Up`}),(0,W.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-xs font-mono text-secondary`,title:_,"data-testid":`directory-current-path`,children:_})]}),(0,W.jsx)(`div`,{className:`mt-3 max-h-60 overflow-y-auto border border-border bg-surface`,children:l?(0,W.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-loading`,children:`Loading directories...`}):s?(0,W.jsxs)(`div`,{className:`px-3 py-4 text-xs`,"data-testid":`directory-error`,children:[(0,W.jsx)(`p`,{className:`text-danger`,children:s}),(0,W.jsx)(`button`,{type:`button`,className:`btn mt-3`,onClick:()=>h(r),children:`Retry`})]}):g.length===0?(0,W.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-empty`,children:`No subdirectories`}):(0,W.jsx)(`div`,{className:`py-1`,children:g.map((e,t)=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>h(e.path),onMouseEnter:()=>f(t),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${t===d?`bg-hover text-primary`:`text-secondary`}`,"data-testid":`directory-entry`,"data-entry-name":e.name,"data-entry-path":e.path,children:[(0,W.jsx)(xe,{width:14,height:14,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))})}),a?.truncated?(0,W.jsx)(`p`,{className:`mt-2 text-[10px] text-muted`,children:`Showing first 200 directories.`}):null,(0,W.jsxs)(`div`,{className:`mt-4 border-t border-border pt-3`,children:[(0,W.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-secondary`,children:`Recent`}),m.length===0?(0,W.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:`No recent paths yet.`}):(0,W.jsx)(`div`,{className:`mt-2 space-y-1`,children:m.map(e=>(0,W.jsx)(`button`,{type:`button`,className:`block w-full truncate text-left text-xs text-secondary hover:text-primary`,onClick:()=>h(e),title:e,"data-testid":`directory-recent`,"data-recent-path":e,children:e},e))})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{_&&e(_)},className:`btn btn-primary`,disabled:l||!_,children:`Select`})]})]})})}function _W(e){let t=e.trim();if(t.length>=2){let e=t[0],n=t[t.length-1];if(e===`'`&&n===`'`)return t.slice(1,-1).replace(/'\\''/g,`'`);if(e===`"`&&n===`"`)return t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`)}return t}function vW(e){let t=e.trim(),n=t.search(/\s/);if(n===-1||t.slice(0,n).split(`/`).pop()!==`bash`)return null;let r=n;for(;r<t.length&&/\s/.test(t[r]);)r++;let i=!1,a=!1;for(;r<t.length;){let e=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let n=t.slice(e,r);for(;r<t.length&&/\s/.test(t[r]);)r++;if(!n.startsWith(`-`)||n===`-`)return null;if(n===`--`)break;if(n.startsWith(`--`)||!/^-[a-zA-Z]+$/.test(n))continue;let o=n.slice(1);if(o.includes(`l`)&&(i=!0),o.includes(`c`)){a=!0;break}}if(!i||!a)return null;let o=t.slice(r).trim();return o?_W(o):null}function yW(e){return e?e===`claude-rp`?`claude`:e:null}function bW(e){let t=e.trim();if(!t)return``;let n=_W(t);return vW(n)??n}function xW(e){if(e===`claude`)return`claude`;if(e===`codex`)return`codex`;if(e===`pi`)return`pi`;if(e===`devin`||e===`devin-cli`)return`devin`;if(e===`grok`||e.startsWith(`grok-`))return`grok`;if(e===`omp`)return`omp`}function SW(e){let t=/\S+/g,n;for(;n=t.exec(e);){let e=n[0].toLowerCase().replace(/^["']+|["']+$/g,``);if([`npx`,`bunx`,`pnpm`,`yarn`,`env`].includes(e)||e.includes(`=`)||e.startsWith(`-`))continue;let t=e.includes(`@oh-my-pi/`)?`omp`:xW(e.split(`/`).pop()||e);return t?{agentType:t,end:n.index+n[0].length}:void 0}}function CW(e){let t=bW(e);if(t)return SW(t.toLowerCase().trim().replace(/^["']|["']$/g,``))?.agentType}var wW={claude:`--dangerously-skip-permissions`,codex:`--yolo`,grok:`--always-approve`,devin:`--permission-mode dangerous`,pi:null,omp:`--auto-approve`},TW={claude:[`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],codex:[`--yolo`,`--dangerously-bypass-approvals-and-sandbox`],grok:[`--always-approve`,`--yolo`,`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],devin:[`--permission-mode dangerous`,`--permission-mode=dangerous`],pi:[],omp:[`--auto-approve`,`--approval-mode yolo`,`--approval-mode=yolo`]};function EW(e){let t=yW(e);return t?wW[t]:null}function DW(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function OW(e){return RegExp(`(^|\\s)${DW(e)}(?=\\s|$)`,`g`)}function kW(e,t){return(t?[yW(t)].filter(e=>e!==null):Object.keys(TW)).some(t=>TW[t].some(t=>OW(t).test(e)))}function AW(e,t){let n=SW(e);return n?`${e.slice(0,n.end)} ${t}${e.slice(n.end)}`:null}function jW(e,t){let n=EW(t);if(!n)return e;let r=e.trim();if(!r||kW(r,t))return r;let i=AW(r,n);if(i)return i;let a=bW(r);if(a&&a!==r){let e=AW(a,n);if(e)return`bash -lc '${e.replace(/'/g,`'\\''`)}'`}return`${r} ${n}`}function MW(e,t){let n=yW(t);if(!n||kW(e,t))return null;if(n===`codex`){let t=/(^|\s)(--full-auto|--ask-for-approval|-a)(?=\s|=|$)/.exec(e);if(t)return`conflicts with ${t[2]}`}if(n===`omp`){let t=/(^|\s)--approval-mode(?:\s+|=)(always-ask|write)/.exec(e);if(t)return`conflicts with --approval-mode ${t[2]}`}let r=/(^|\s)--permission-mode(?:\s+|=)(\S+)/.exec(e);return r&&n!==`codex`?`conflicts with --permission-mode ${r[2]}`:null}function NW(e,t){let n=yW(t);if(!n)return e;let r=e;for(let e of TW[n])r=r.replace(OW(e),` `);return r.replace(/\s+/g,` `).trim()}function PW({isOpen:e,onClose:t,onCreate:n,defaultProjectDir:r,commandPresets:i,defaultPresetId:a,lastProjectPath:o,activeProjectPath:s,remoteHosts:c=[],remoteAllowControl:l=!1,initialHost:u,initialPath:d,initialCommand:f}){let[p,m]=(0,x.useState)(``),[h,g]=(0,x.useState)(``),[_,v]=(0,x.useState)(null),[y,b]=(0,x.useState)(``),[S,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(``),E=H(e=>e.yoloMode),D=H(e=>e.setYoloMode),O=(0,x.useRef)(null),k=(0,x.useRef)(null),A=(0,x.useRef)(null),j=(0,x.useRef)(!1),M=l&&c.length>0,N=e=>{if(!E)return e;let t=CW(e);return t&&!MW(e,t)?jW(e,t):e},P=e=>{let t=i.find(t=>t.id===e);t&&(v(e),b(N(te(t))))},F=()=>{v(null),b(``)};if((0,x.useEffect)(()=>{let t=j.current;if(j.current=e,!e){m(``),g(``),v(null),b(``),C(!1),T(u??``),t&&setTimeout(()=>{if(typeof document>`u`||typeof document.querySelector!=`function`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300);return}if(typeof document<`u`&&typeof document.querySelector==`function`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}m(d?.trim()||s?.trim()||o||r||``),g(``),T(u??``);let n=f?.trim();if(n){let e=i.find(e=>te(e)===n);e?(v(e.id),b(te(e))):(v(null),b(n))}else{let e=i.find(e=>e.id===a);e?(v(a),b(N(te(e)))):i.length>0?(v(i[0].id),b(N(te(i[0])))):(v(null),b(``))}setTimeout(()=>{if(A.current?.focus(),k.current){let e=k.current;e.scrollLeft=e.scrollWidth}},50)},[s,i,a,r,e,o,u,d,f]),(0,x.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=()=>O.current?Array.from(O.current.querySelectorAll(`input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]`)):[],r=e=>{if(!S){if(e.key===`Escape`){typeof e.stopPropagation==`function`&&e.stopPropagation(),t();return}if(e.key===`Enter`){let t=document.activeElement;if(!t||t.tagName===`INPUT`||t.closest(`[data-testid="host-select"]`)||!t.closest(`[data-testid="command-select"]`))return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),O.current?.requestSubmit();return}if(/^[0-9]$/.test(e.key)&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=document.activeElement;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable))return;let n;if(e.key===`0`)n=i.length;else if(n=Number(e.key)-1,n>=i.length)return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),n===i.length?F():P(i[n].id),(O.current?.querySelectorAll?.(`[data-testid="command-select"] [role="radio"]`))?.[n]?.focus();return}if(e.key===`Tab`){e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation();let t=n();if(t.length===0)return;let r=document.activeElement,i=t.indexOf(r),a;a=i===-1?e.shiftKey?t.length-1:0:e.shiftKey?i<=0?t.length-1:i-1:i>=t.length-1?0:i+1,t[a]?.focus()}}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,t,S,i,E]),!e)return null;let I=_===null,L=w!==``,ee=CW(y),R=EW(ee)!==null,z=ee?kW(y,ee):!1,B=ee&&!z?MW(y,ee):null,V=!R||B!==null,ne=ee?ee===`pi`?`Pi has no permission prompts — nothing to enable`:B??`Append ${EW(ee)}`:`Enter a supported agent command (claude, codex, grok, devin)`,re=e=>{D(e),ee&&b(e?jW(y,ee):NW(y,ee))},U=e=>{e.preventDefault();let r=p.trim();if(!r)return;let i=y.trim();n(r,h.trim()||void 0,i||void 0,L?w:void 0),t()},ie=[...i.map(e=>({id:e.id,label:e.label,isCustom:!1,agentType:e.agentType,command:e.command})),{id:`custom`,label:`Custom`,isCustom:!0,agentType:void 0,command:void 0}],ae=[{id:``,label:`Local`,ok:!0,error:void 0},...c.map(e=>({id:e.host,label:e.host,ok:e.ok,error:e.error}))],oe=p.trim()||`~`;return(0,W.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:[(0,W.jsxs)(`form`,{ref:O,onSubmit:U,className:`w-full max-w-md border border-border bg-elevated p-6`,children:[(0,W.jsx)(`h2`,{id:`new-session-title`,className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`New Session`}),(0,W.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[M&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Host`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Host`,"data-testid":`host-select`,children:ae.map((e,t)=>{let n=w===e.id,r=!e.ok&&!n;return(0,W.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-label":e.label,title:e.ok?void 0:e.error||`Unreachable`,tabIndex:n?0:-1,onClick:()=>T(e.id),onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ae.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ae.length)%ae.length;else return;let r=ae[n];T(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``} ${r?`opacity-60`:``}`,children:e.label},e.id||`local`)})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Command`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Command preset`,"data-testid":`command-select`,children:ie.map((e,t)=>{let n=e.isCustom?I:_===e.id,r=e.isCustom?`0`:t<9?String(t+1):null;return(0,W.jsxs)(`button`,{ref:n?A:void 0,type:`button`,role:`radio`,"aria-checked":n,"aria-keyshortcuts":r??void 0,tabIndex:n?0:-1,onClick:()=>{e.isCustom?F():P(e.id)},onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ie.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ie.length)%ie.length;else return;let r=ie[n];r.isCustom?F():P(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``}`,children:[r&&(0,W.jsx)(`kbd`,{"aria-hidden":`true`,className:`shortcut-badge`,children:r}),(0,W.jsx)(rh,{agentType:e.agentType,command:e.command,className:`inline-block h-3.5 w-3.5 shrink-0`}),e.label]},e.id)})}),(0,W.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),placeholder:`Enter command...`,className:`input mt-2 font-mono text-xs`}),(0,W.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs ${V?`text-muted opacity-60`:`text-secondary`}`,title:ne,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:z,disabled:V,onChange:e=>re(e.target.checked)}),`yolo mode — skip permission prompts`]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Project Path`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`input`,{ref:k,value:p,onChange:e=>m(e.target.value),placeholder:L?`/home/user/project`:s||o||r||`/Users/you/code/my-project`,className:`input flex-1 text-sm`}),!L&&(0,W.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>C(!0),children:`Browse`})]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Display Name`}),(0,W.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`auto-generated`,className:`input text-sm placeholder:italic`})]})]}),(0,W.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Create`})]})]}),S&&!L&&(0,W.jsx)(gW,{initialPath:oe,onSelect:e=>{m(e),C(!1)},onCancel:()=>C(!1)})]})}function FW({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=x.useRef(e!==void 0),[a,o]=x.useState(t);return[i?e:a,x.useCallback(e=>{i||o(e)},[])]}var IW={};function LW(e,t){let n=x.useRef(IW);return n.current===IW&&(n.current=e(t)),n}var RW=x[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],zW=RW&&RW!==x.useLayoutEffect?RW:e=>e();function BW(e){let t=LW(VW).current;return t.next=e,zW(t.effect),t.trampoline}function VW(){let e={next:void 0,callback:HW,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function HW(){}function UW(e,t,n,r){let i=LW(GW).current;return KW(i,e,t,n,r)&&JW(i,[e,t,n,r]),i.callback}function WW(e){let t=LW(GW).current;return qW(t,e)&&JW(t,e),t.callback}function GW(){return{callback:null,cleanup:null,refs:[]}}function KW(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function qW(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function JW(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var YW=typeof document<`u`?x.useLayoutEffect:()=>{},XW={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},ZW={...XW,position:`fixed`,top:0,left:0},QW={...XW,position:`absolute`};function $W(){}Object.freeze([]);var eG=Object.freeze({});function tG(e,...t){let n=new URL(`https://base-ui.com/production-error`);return n.searchParams.set(`code`,e.toString()),t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var nG=18;function rG(e){return nG>=e}function iG(e){if(!x.isValidElement(e))return null;let t=e,n=t.props;return(rG(19)?n?.ref:t.ref)??null}function aG(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function oG(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function sG(e,t){return typeof e==`function`?e(t):e}function cG(e,t){return typeof e==`function`?e(t):e}var lG={};function uG(e,t,n,r,i){let a={...gG(e,lG)};return t&&(a=fG(a,t)),n&&(a=fG(a,n)),r&&(a=fG(a,r)),i&&(a=fG(a,i)),a}function dG(e){if(e.length===0)return lG;if(e.length===1)return gG(e[0],lG);let t={...gG(e[0],lG)};for(let n=1;n<e.length;n+=1)t=fG(t,e[n]);return t}function fG(e,t){return hG(t)?t(e):pG(e,t)}function pG(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=aG(e.style,r);break;case`className`:e[n]=yG(e.className,r);break;default:mG(n,r)?e[n]=_G(e[n],r):e[n]=r}}return e}function mG(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function hG(e){return typeof e==`function`}function gG(e,t){return hG(e)?e(t):e??lG}function _G(e,t){return t?e?n=>{if(bG(n)){let r=n;vG(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function vG(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function yG(e,t){return t?e?t+` `+e:t:e}function bG(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function xG(e,t,n={}){let r=t.render,i=SG(t,n);return n.enabled===!1?null:wG(e,r,i,n.state??eG)}function SG(e,t={}){let{className:n,style:r,render:i}=e,{state:a=eG,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?sG(n,a):void 0,d=l?cG(r,a):void 0,f=l?oG(a,c):eG,p=l?aG(f,Array.isArray(s)?dG(s):s)??eG:eG;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=WW([p.ref,iG(i),...o]):p.ref=UW(p.ref,iG(i),o):UW(null,null)),l?(u!==void 0&&(p.className=yG(p.className,u)),d!==void 0&&(p.style=aG(p.style,d)),p):eG}var CG=Symbol.for(`react.lazy`);function wG(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=uG(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===CG&&(i=x.Children.toArray(t)[0]),x.cloneElement(i,e)}if(e&&typeof e==`string`)return TG(e,n);throw Error(tG(8))}function TG(e,t){return e===`button`?(0,x.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,x.createElement)(`img`,{alt:``,...t,key:t.key}):x.createElement(e,t)}var EG={...x},DG=0;function OG(e,t=`mui`){let[n,r]=x.useState(e),i=e||n;return x.useEffect(()=>{n??(DG+=1,r(`${t}-${DG}`))},[n,t]),i}var kG=EG.useId;function AG(e,t){if(kG!==void 0){let n=kG();return e??(t?`${t}-${n}`:n)}return OG(e,t)}function jG(e){return AG(e,`base-ui`)}function MG(){return typeof window<`u`}function NG(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function PG(e){return MG()?e instanceof Element||e instanceof NG(e).Element:!1}function FG(e){return MG()?e instanceof HTMLElement||e instanceof NG(e).HTMLElement:!1}function IG(e){return!MG()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof NG(e).ShadowRoot}var LG=x.createContext(void 0);function RG(e=!1){let t=x.useContext(LG);if(t===void 0&&!e)throw Error(tG(16));return t}function zG(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:x.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function BG(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=e,a=x.useRef(null),o=RG(!0)!==void 0,s=BW(()=>{let e=a.current;return!!(e?.tagName===`A`&&e?.href)}),{props:c}=zG({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:r,isNativeButton:i}),l=x.useCallback(()=>{let e=a.current;VG(e)&&o&&t&&c.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,c.disabled,o]);return YW(l,[l]),{getButtonProps:x.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:l,...u}=e;return uG({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(vG(e),o?.(e)),e.baseUIHandlerPrevented)return;let r=e.target===e.currentTarget&&!i&&!s()&&!t,a=e.key===`Enter`,c=e.key===` `;r&&((c||a)&&e.preventDefault(),a&&n?.(e))},onKeyUp(e){t||(vG(e),a?.(e)),!e.baseUIHandlerPrevented&&e.target===e.currentTarget&&!i&&!t&&e.key===` `&&n?.(e)},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},i?void 0:{role:`button`},c,u)},[t,c,i,s]),buttonRef:BW(e=>{a.current=e,l()})}}function VG(e){return FG(e)&&e.tagName===`BUTTON`}var HG=x.createContext(void 0);function UG(){let e=x.useContext(HG);if(e===void 0)throw Error(tG(63));return e}var WG=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),GG={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},KG={valid(e){return e===null?null:e?{[WG.valid]:``}:{[WG.invalid]:``}}},qG=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),JG={...KG,checked(e){return e?{[qG.checked]:``}:{[qG.unchecked]:``}}};function YG(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}var XG=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:$W,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function ZG(){return x.useContext(XG)}var QG=x.createContext({invalid:void 0,name:void 0,validityData:{state:GG,errors:[],error:``,value:``,initialValue:null},setValidityData:$W,disabled:void 0,touched:!1,setTouched:$W,dirty:!1,setDirty:$W,filled:!1,setFilled:$W,focused:!1,setFocused:$W,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=eG)=>e,getInputValidationProps:(e=eG)=>e,inputRef:{current:null},commit:async()=>{}}});function $G(e=!0){let t=x.useContext(QG);if(t.setValidityData===$W&&!e)throw Error(tG(28));return t}function eK(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=ZG(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=$G(),f=BW(e.getValue);YW(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),YW(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:YG(u,c),validate(e=!0){let t=n;t===void 0&&(t=f()),l.current=!0,e?U.flushSync(()=>o(t)):o(t)}})},[o,a,t,s,f,r,c,l,i,u,n]),YW(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var tK=x.createContext({controlId:void 0,registerControlId:$W,labelId:void 0,setLabelId:$W,messageIds:[],setMessageIds:$W,getDescriptionProps:e=>e});function nK(){return x.useContext(tK)}function rK(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=nK(),o=jG(t),s=n?i:void 0,c=LW(()=>Symbol(`labelable-control`)),l=x.useRef(!1),u=x.useRef(t!=null),d=BW(()=>{!l.current||a===$W||(l.current=!1,a(c.current,void 0))});return YW(()=>{if(a===$W)return;let e;if(n){let n=r?.current;e=PG(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),x.useEffect(()=>d,[d]),i??o}var iK=`none`;function aK(e,t,n,r){let i=!1,a=!1,o=r??eG;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function oK(e,t){let n=x.useRef(e),r=BW(t);YW(()=>{n.current!==e&&r(n.current)},[e,r]),YW(()=>{n.current=e},[e])}var sK=x.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,id:a,inputRef:o,name:s,nativeButton:c=!1,onCheckedChange:l,readOnly:u=!1,required:d=!1,disabled:f=!1,render:p,uncheckedValue:m,value:h,...g}=e,{clearErrors:_}=ZG(),{state:v,setTouched:y,setDirty:b,validityData:S,setFilled:C,setFocused:w,shouldValidateOnChange:T,validationMode:E,disabled:D,name:O,validation:k}=$G(),{labelId:A}=nK(),j=D||f,M=O??s,N=BW(l),P=x.useRef(null),F=UW(P,o,k.inputRef),I=x.useRef(null),L=jG(),ee=rK({id:a,implicit:!1,controlRef:I}),R=c?void 0:ee,[z,B]=FW({controlled:n,default:!!i,name:`Switch`,state:`checked`});eK({id:L,commit:k.commit,value:z,controlRef:I,name:M,getValue:()=>z}),YW(()=>{P.current&&C(P.current.checked)},[P,C]),oK(z,()=>{_(M),b(z!==S.initialValue),C(z),T()?k.commit(z):k.commit(z,!0)});let{getButtonProps:te,buttonRef:V}=BG({disabled:j,native:c}),ne={id:c?ee:L,role:`switch`,"aria-checked":z,"aria-readonly":u||void 0,"aria-required":d||void 0,"aria-labelledby":A,onFocus(){j||w(!0)},onBlur(){let e=P.current;!e||j||(y(!0),w(!1),E===`onBlur`&&k.commit(e.checked))},onClick(e){u||j||(e.preventDefault(),P.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},H=x.useMemo(()=>uG({checked:z,disabled:j,id:R,name:M,required:d,style:M?QW:ZW,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:F,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=aK(iK,e.nativeEvent);N?.(t,n),!n.isCanceled&&B(t)},onFocus(){I.current?.focus()}},k.getInputValidationProps,h===void 0?eG:{value:h}),[z,j,F,R,M,N,d,B,k,h]),re=x.useMemo(()=>({...v,checked:z,disabled:j,readOnly:u,required:d}),[v,z,j,u,d]),U=xG(`span`,e,{state:re,ref:[t,I,V],props:[ne,k.getValidationProps,g,te],stateAttributesMapping:JG});return(0,W.jsxs)(HG.Provider,{value:re,children:[U,!z&&M&&m!==void 0&&(0,W.jsx)(`input`,{type:`hidden`,name:M,value:m}),(0,W.jsx)(`input`,{...H})]})}),cK=x.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=$G(),o=UG();return xG(`span`,e,{state:{...a,...o},ref:t,stateAttributesMapping:JG,props:i})});function lK(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=lK(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function uK(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=lK(e))&&(r&&(r+=` `),r+=t);return r}var dK=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},fK=(e,t)=>({classGroupId:e,validator:t}),pK=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),mK=`-`,hK=[],gK=`arbitrary..`,_K=e=>{let t=bK(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return yK(e);let n=e.split(mK);return vK(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?dK(i,t):t:i||hK}return n[e]||hK}}},vK=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=vK(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(mK):e.slice(t).join(mK),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},yK=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?gK+r:void 0})(),bK=e=>{let{theme:t,classGroups:n}=e;return xK(n,t)},xK=(e,t)=>{let n=pK();for(let r in e){let i=e[r];SK(i,n,r,t)}return n},SK=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];CK(i,t,n,r)}},CK=(e,t,n,r)=>{if(typeof e==`string`){wK(e,t,n);return}if(typeof e==`function`){TK(e,t,n,r);return}EK(e,t,n,r)},wK=(e,t,n)=>{let r=e===``?t:DK(t,e);r.classGroupId=n},TK=(e,t,n,r)=>{if(OK(e)){SK(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(fK(n,e))},EK=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];SK(o,DK(t,a),n,r)}},DK=(e,t)=>{let n=e,r=t.split(mK),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=pK(),n.nextPart.set(t,i)),n=i}return n},OK=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,kK=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},AK=`!`,jK=`:`,MK=[],NK=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),PK=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===jK){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(AK)?(c=s.slice(0,-1),l=!0):s.startsWith(AK)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return NK(t,l,c,u)};if(t){let e=t+jK,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):NK(MK,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},FK=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},IK=e=>({cache:kK(e.cacheSize),parseClassName:PK(e),sortModifiers:FK(e),..._K(e)}),LK=/\s+/,RK=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(LK),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+AK:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},zK=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=BK(n))&&(i&&(i+=` `),i+=r);return i},BK=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=BK(e[r]))&&(n&&(n+=` `),n+=t);return n},VK=(e,...t)=>{let n,r,i,a,o=o=>(n=IK(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=RK(e,n);return i(e,a),a};return a=o,(...e)=>a(zK(...e))},HK=[],UK=e=>{let t=t=>t[e]||HK;return t.isThemeGetter=!0,t},WK=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,GK=/^\((?:(\w[\w-]*):)?(.+)\)$/i,KK=/^\d+\/\d+$/,qK=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,JK=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,YK=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,XK=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ZK=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,QK=e=>KK.test(e),$K=e=>!!e&&!Number.isNaN(Number(e)),eq=e=>!!e&&Number.isInteger(Number(e)),tq=e=>e.endsWith(`%`)&&$K(e.slice(0,-1)),nq=e=>qK.test(e),rq=()=>!0,iq=e=>JK.test(e)&&!YK.test(e),aq=()=>!1,oq=e=>XK.test(e),sq=e=>ZK.test(e),cq=e=>!Q(e)&&!$(e),lq=e=>xq(e,Tq,aq),Q=e=>WK.test(e),uq=e=>xq(e,Eq,iq),dq=e=>xq(e,Dq,$K),fq=e=>xq(e,Cq,aq),pq=e=>xq(e,wq,sq),mq=e=>xq(e,kq,oq),$=e=>GK.test(e),hq=e=>Sq(e,Eq),gq=e=>Sq(e,Oq),_q=e=>Sq(e,Cq),vq=e=>Sq(e,Tq),yq=e=>Sq(e,wq),bq=e=>Sq(e,kq,!0),xq=(e,t,n)=>{let r=WK.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Sq=(e,t,n=!1)=>{let r=GK.exec(e);return r?r[1]?t(r[1]):n:!1},Cq=e=>e===`position`||e===`percentage`,wq=e=>e===`image`||e===`url`,Tq=e=>e===`length`||e===`size`||e===`bg-size`,Eq=e=>e===`length`,Dq=e=>e===`number`,Oq=e=>e===`family-name`,kq=e=>e===`shadow`,Aq=VK(()=>{let e=UK(`color`),t=UK(`font`),n=UK(`text`),r=UK(`font-weight`),i=UK(`tracking`),a=UK(`leading`),o=UK(`breakpoint`),s=UK(`container`),c=UK(`spacing`),l=UK(`radius`),u=UK(`shadow`),d=UK(`inset-shadow`),f=UK(`text-shadow`),p=UK(`drop-shadow`),m=UK(`blur`),h=UK(`perspective`),g=UK(`aspect`),_=UK(`ease`),v=UK(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),$,Q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$,Q,c],T=()=>[QK,`full`,`auto`,...w()],E=()=>[eq,`none`,`subgrid`,$,Q],D=()=>[`auto`,{span:[`full`,eq,$,Q]},eq,$,Q],O=()=>[eq,`auto`,$,Q],k=()=>[`auto`,`min`,`max`,`fr`,$,Q],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[QK,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,$,Q],F=()=>[...b(),_q,fq,{position:[$,Q]}],I=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],L=()=>[`auto`,`cover`,`contain`,vq,lq,{size:[$,Q]}],ee=()=>[tq,hq,uq],R=()=>[``,`none`,`full`,l,$,Q],z=()=>[``,$K,hq,uq],B=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],V=()=>[$K,tq,_q,fq],ne=()=>[``,`none`,m,$,Q],H=()=>[`none`,$K,$,Q],re=()=>[`none`,$K,$,Q],U=()=>[$K,$,Q],ie=()=>[QK,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[nq],breakpoint:[nq],color:[rq],container:[nq],"drop-shadow":[nq],ease:[`in`,`out`,`in-out`],font:[cq],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[nq],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[nq],shadow:[nq],spacing:[`px`,$K],text:[nq],"text-shadow":[nq],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,QK,Q,$,g]}],container:[`container`],columns:[{columns:[$K,Q,$,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[eq,`auto`,$,Q]}],basis:[{basis:[QK,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[$K,QK,`auto`,`initial`,`none`,Q]}],grow:[{grow:[``,$K,$,Q]}],shrink:[{shrink:[``,$K,$,Q]}],order:[{order:[eq,`first`,`last`,`none`,$,Q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,hq,uq]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,$,dq]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,tq,Q]}],"font-family":[{font:[gq,Q,t]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,$,Q]}],"line-clamp":[{"line-clamp":[$K,`none`,$,dq]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$,Q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$,Q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...B(),`wavy`]}],"text-decoration-thickness":[{decoration:[$K,`from-font`,`auto`,$,uq]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[$K,`auto`,$,Q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$,Q]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,$,Q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:L()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},eq,$,Q],radial:[``,$,Q],conic:[eq,$,Q]},yq,pq]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":z()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...B(),`hidden`,`none`]}],"divide-style":[{divide:[...B(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...B(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[$K,$,Q]}],"outline-w":[{outline:[``,$K,hq,uq]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,bq,mq]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,bq,mq]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[$K,uq]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,bq,mq]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[$K,$,Q]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[$K]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[$,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[$K]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,$,Q]}],filter:[{filter:[``,`none`,$,Q]}],blur:[{blur:ne()}],brightness:[{brightness:[$K,$,Q]}],contrast:[{contrast:[$K,$,Q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,bq,mq]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,$K,$,Q]}],"hue-rotate":[{"hue-rotate":[$K,$,Q]}],invert:[{invert:[``,$K,$,Q]}],saturate:[{saturate:[$K,$,Q]}],sepia:[{sepia:[``,$K,$,Q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$,Q]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[$K,$,Q]}],"backdrop-contrast":[{"backdrop-contrast":[$K,$,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,$K,$,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$K,$,Q]}],"backdrop-invert":[{"backdrop-invert":[``,$K,$,Q]}],"backdrop-opacity":[{"backdrop-opacity":[$K,$,Q]}],"backdrop-saturate":[{"backdrop-saturate":[$K,$,Q]}],"backdrop-sepia":[{"backdrop-sepia":[``,$K,$,Q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,$,Q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[$K,`initial`,$,Q]}],ease:[{ease:[`linear`,`initial`,_,$,Q]}],delay:[{delay:[$K,$,Q]}],animate:[{animate:[`none`,v,$,Q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$,Q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":[`scale-3d`],skew:[{skew:U()}],"skew-x":[{"skew-x":U()}],"skew-y":[{"skew-y":U()}],transform:[{transform:[$,Q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,$,Q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,$,Q]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[$K,hq,uq,dq]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function jq(...e){return Aq(uK(e))}function Mq({checked:e,onCheckedChange:t,disabled:n,className:r,ariaLabel:i}){return(0,W.jsx)(sK,{checked:e,onCheckedChange:t,disabled:n,"aria-label":i,className:jq(`group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors`,`bg-border data-[checked]:bg-accent`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base`,`disabled:cursor-not-allowed disabled:opacity-50`,r),children:(0,W.jsx)(cK,{className:jq(`pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform`,`translate-x-1 group-data-[checked]:translate-x-5`)})})}var Nq=null,Pq=!1,Fq={},Iq=500;function Lq(){if(typeof window>`u`)return null;if(Nq?.state===`closed`&&(Nq=null),!Nq){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;Nq=new e}return Nq}function Rq(){Nq&&=(Nq.close().catch(()=>{}),null),Lq()}function zq(){return Pq}function Bq(){Nq&&(Rq(),Pq=!0)}if(typeof window<`u`){window.addEventListener(`pageshow`,e=>{e.persisted&&Bq()}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&Bq()});let e=Date.now();setInterval(()=>{let t=Date.now();t-e>15e3&&Bq(),e=t},5e3)}async function Vq(){let e=Lq();e&&e.state===`suspended`&&await e.resume().catch(()=>{}),Pq=!1}async function Hq(e){e.state===`suspended`&&await e.resume().catch(()=>{})}async function Uq(e){let t=Lq();if(!t||(await Hq(t),t.state!==`running`))return;let{frequencies:n,durationMs:r,attackMs:i,peakGain:a,type:o=`sine`}=e,s=t.currentTime,c=r/1e3,l=i/1e3,u=t.createGain();u.connect(t.destination);let d=s+c*.7;u.gain.setValueAtTime(0,s),u.gain.linearRampToValueAtTime(a,s+l),u.gain.setValueAtTime(a,d),u.gain.linearRampToValueAtTime(0,s+c);let f=n.map(e=>{let n=t.createOscillator();return n.type=o,n.frequency.setValueAtTime(e,s),n.connect(u),n});for(let e of f)e.start(s),e.stop(s+c);let p=f[f.length-1];p.onended=()=>{for(let e of f)e.disconnect();u.disconnect()}}async function Wq(){let e=Date.now();if(!(e-(Fq.permission||0)<Iq)){Fq.permission=e;try{await Uq({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:`sine`})}catch{}}}async function Gq(){let e=Date.now();if(!(e-(Fq.idle||0)<Iq)){Fq.idle=e;try{await Uq({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:`sine`})}catch{}}}function Kq({isOpen:e,onClose:t}){let n=H(e=>e.defaultProjectDir),r=H(e=>e.setDefaultProjectDir),i=H(e=>e.commandPresets),a=H(e=>e.setCommandPresets),o=H(e=>e.defaultPresetId),s=H(e=>e.setDefaultPresetId),c=H(e=>e.sessionSortMode),l=H(e=>e.setSessionSortMode),u=H(e=>e.sessionSortDirection),d=H(e=>e.setSessionSortDirection),f=H(e=>e.useWebGL),p=H(e=>e.setUseWebGL),m=H(e=>e.fontSize),h=H(e=>e.setFontSize),g=H(e=>e.lineHeight),_=H(e=>e.setLineHeight),v=H(e=>e.letterSpacing),y=H(e=>e.setLetterSpacing),b=H(e=>e.fontOption),S=H(e=>e.setFontOption),C=H(e=>e.customFontFamily),w=H(e=>e.setCustomFontFamily),T=H(e=>e.shortcutModifier),E=H(e=>e.setShortcutModifier),D=H(e=>e.showProjectName),O=H(e=>e.setShowProjectName),k=H(e=>e.showLastUserMessage),A=H(e=>e.setShowLastUserMessage),j=H(e=>e.showSessionIdPrefix),M=H(e=>e.setShowSessionIdPrefix),N=uU(e=>e.theme),F=uU(e=>e.setTheme),I=H(e=>e.soundOnPermission),ee=H(e=>e.setSoundOnPermission),R=H(e=>e.soundOnIdle),z=H(e=>e.setSoundOnIdle),[B,te]=(0,x.useState)(n),[V,ne]=(0,x.useState)(i),[re,U]=(0,x.useState)(o),[ie,ae]=(0,x.useState)(c),[oe,se]=(0,x.useState)(u),[ce,le]=(0,x.useState)(f),[ue,de]=(0,x.useState)(m),[fe,pe]=(0,x.useState)(g),[me,he]=(0,x.useState)(v),[ge,_e]=(0,x.useState)(b),[ve,ye]=(0,x.useState)(C),[be,xe]=(0,x.useState)(T),[Se,Ce]=(0,x.useState)(D),[we,Te]=(0,x.useState)(k),[Ee,De]=(0,x.useState)(j),[Oe,ke]=(0,x.useState)(N),[Ae,je]=(0,x.useState)(I),[Me,Ne]=(0,x.useState)(R),[Pe,Fe]=(0,x.useState)(!0),[Ie,Le]=(0,x.useState)(!1),[Re,ze]=(0,x.useState)(!0),[Be,Ve]=(0,x.useState)(!0),[He,Ue]=(0,x.useState)(!1),[We,Ge]=(0,x.useState)(!1),[Ke,Je]=(0,x.useState)(24),[Xe,Ze]=(0,x.useState)(!1),[Qe,$e]=(0,x.useState)(!1),[et,tt]=(0,x.useState)(``),[nt,rt]=(0,x.useState)(``),[it,at]=(0,x.useState)(``),ot=(0,x.useRef)(null),st=(0,x.useRef)(0),ct=(0,x.useRef)(!1);if((0,x.useEffect)(()=>{let t=++st.current,r=ct.current;if(ct.current=e,ot.current&&=(clearTimeout(ot.current),null),e){if(te(n),ne(i),U(o),ae(c),se(u),le(f),de(m),pe(g),he(v),_e(b),ye(C),xe(T),Ce(D),Te(k),De(j),ke(N),je(I),Ne(R),$e(!1),tt(``),rt(``),at(``),fetch(`/api/settings/tmux-mouse-mode`).then(e=>e.json()).then(e=>Fe(e.enabled)).catch(()=>{}),Ve(!0),fetch(`/api/settings/terminal-colors`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{st.current===t&&ze(e.enabled)}).catch(()=>{}).finally(()=>{st.current===t&&Ve(!1)}),fetch(`/api/settings/history-max-age-hours`).then(e=>e.json()).then(e=>Je(e.hours)).catch(()=>{}),fetch(`/api/settings/prefer-window-name`).then(e=>e.json()).then(e=>Ue(e.enabled)).catch(()=>{}),typeof document<`u`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}}else r&&typeof document<`u`&&(ot.current=setTimeout(()=>{if(typeof document>`u`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300));return()=>{ot.current&&=(clearTimeout(ot.current),null)}},[i,o,n,c,u,f,m,g,v,b,C,T,D,k,j,N,I,R,e]),(0,x.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=e=>{e.key===`Escape`&&(typeof e.stopPropagation==`function`&&e.stopPropagation(),t())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),!e)return null;let lt=e=>{e.preventDefault();let n=B.trim(),i=ce!==f;r(n||`~/Documents/GitHub`),a(V),s(re),l(ie),d(oe),p(ce),h(ue),_(fe),y(me),S(ge),w(ve),E(be),O(Se),A(we),M(Ee),F(Oe),ee(Ae),z(Me),t({webglChanged:i})},ut=(e,t)=>{ne(n=>n.map(n=>n.id===e?{...n,...t}:n))},dt=e=>{let t=V.find(t=>t.id===e);if(!t||t.isBuiltIn)return;let n=V.filter(t=>t.id!==e);ne(n),e===re&&U(n[0]?.id||`claude`)},ft=()=>{if(!et.trim()||!nt.trim()||V.length>=50)return;let e={id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,label:et.trim(),command:nt.trim(),isBuiltIn:!1,agentType:it||void 0};ne([...V,e]),$e(!1),tt(``),rt(``),at(``)},pt=V.length<50,mt=e=>{Le(!0),Fe(e),fetch(`/api/settings/tmux-mouse-mode`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Fe(!e)).finally(()=>Le(!1))},ht=e=>{Ge(!0),Ue(e),fetch(`/api/settings/prefer-window-name`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Ue(!e)).finally(()=>Ge(!1))},gt=e=>{Ve(!0),ze(e),fetch(`/api/settings/terminal-colors`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>ze(!e)).finally(()=>Ve(!1))},_t=e=>{let t=Ke;Ze(!0),Je(e),fetch(`/api/settings/history-max-age-hours`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hours:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Je(t)).finally(()=>Ze(!1))};return(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,W.jsxs)(`form`,{onSubmit:lt,className:`w-full max-w-lg max-h-[90vh] flex flex-col border border-border bg-elevated`,children:[(0,W.jsxs)(`div`,{className:`p-6 pb-0`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`Settings`}),(0,W.jsx)(`p`,{className:`mt-2 text-xs text-muted text-pretty`,children:`Configure default directory, command presets, and display options.`})]}),(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 pb-4`,children:(0,W.jsxs)(`div`,{className:`mt-5 space-y-4`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Default Project Directory`}),(0,W.jsx)(`input`,{value:B,onChange:e=>te(e.target.value),placeholder:P,className:`input`,autoFocus:!0})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,W.jsx)(`label`,{className:`text-xs text-secondary`,children:`Command Presets`}),(0,W.jsx)(`select`,{value:re,onChange:e=>U(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:V.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,W.jsx)(`p`,{className:`text-[10px] text-muted mb-3`,children:`Default preset is pre-selected when creating new sessions.`}),(0,W.jsx)(`div`,{className:`space-y-3`,children:V.map(e=>(0,W.jsxs)(`div`,{className:`border border-border p-3 space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,W.jsx)(`input`,{value:e.label,onChange:t=>ut(e.id,{label:t.target.value}),className:`input text-sm py-1 px-2 w-32`,placeholder:`Label`})}),!e.isBuiltIn&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>dt(e.id),className:`btn text-xs px-2 py-1 text-error hover:bg-error/10`,children:`Delete`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Command`}),(0,W.jsx)(`input`,{value:e.command,onChange:t=>ut(e.id,{command:t.target.value}),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`})]}),!e.isBuiltIn&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Icon`}),(0,W.jsxs)(`select`,{value:e.agentType||``,onChange:t=>ut(e.id,{agentType:t.target.value||void 0}),className:`input text-xs py-1 px-2 w-auto`,children:[(0,W.jsx)(`option`,{value:``,children:`Terminal`}),(0,W.jsx)(`option`,{value:`claude`,children:`Claude`}),(0,W.jsx)(`option`,{value:`codex`,children:`Codex`}),(0,W.jsx)(`option`,{value:`pi`,children:`Pi`}),(0,W.jsx)(`option`,{value:`devin`,children:`Devin`}),(0,W.jsx)(`option`,{value:`grok`,children:`Grok`}),(0,W.jsx)(`option`,{value:`omp`,children:`OMP`})]})]})]},e.id))}),Qe?(0,W.jsxs)(`div`,{className:`mt-3 border border-border p-3 space-y-2`,children:[(0,W.jsx)(`div`,{className:`text-xs text-secondary mb-2`,children:`New Preset`}),(0,W.jsx)(`input`,{value:et,onChange:e=>tt(e.target.value),className:`input text-xs py-1 px-2 w-full`,placeholder:`Label`}),(0,W.jsx)(`input`,{value:nt,onChange:e=>rt(e.target.value),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(`select`,{value:it,onChange:e=>at(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:[(0,W.jsx)(`option`,{value:``,children:`Terminal Icon`}),(0,W.jsx)(`option`,{value:`claude`,children:`Claude Icon`}),(0,W.jsx)(`option`,{value:`codex`,children:`Codex Icon`}),(0,W.jsx)(`option`,{value:`pi`,children:`Pi Icon`}),(0,W.jsx)(`option`,{value:`devin`,children:`Devin Icon`}),(0,W.jsx)(`option`,{value:`grok`,children:`Grok Icon`}),(0,W.jsx)(`option`,{value:`omp`,children:`OMP Icon`})]}),(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>$e(!1),className:`btn text-xs px-2 py-1`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`button`,onClick:ft,disabled:!et.trim()||!nt.trim(),className:`btn btn-primary text-xs px-2 py-1`,children:`Add`})]})]}):(0,W.jsx)(`button`,{type:`button`,onClick:()=>$e(!0),disabled:!pt,className:`btn text-xs mt-3 w-full`,children:pt?`+ Add Preset`:`Max 50 presets`})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Session List Order`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`created`?`btn-primary`:``}`,onClick:()=>ae(`created`),children:`Created`}),(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`status`?`btn-primary`:``}`,onClick:()=>ae(`status`),children:`Status`}),(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`manual`?`btn-primary`:``}`,onClick:()=>ae(`manual`),children:`Manual`})]}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:ie===`status`?`Sessions auto-resort by status (waiting, working, unknown)`:ie===`manual`?`Drag sessions to reorder manually`:`Sessions stay in creation order`})]}),ie===`created`&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Sort Direction`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${oe===`desc`?`btn-primary`:``}`,onClick:()=>se(`desc`),children:`Newest First`}),(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${oe===`asc`?`btn-primary`:``}`,onClick:()=>se(`asc`),children:`Oldest First`})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,W.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Session List Details`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Project Name`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the project folder name under each session.`})]}),(0,W.jsx)(Mq,{checked:Se,onCheckedChange:Ce})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Last User Message`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the most recent user input next to the project name.`})]}),(0,W.jsx)(Mq,{checked:we,onCheckedChange:Te})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Session ID Prefix`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show first 5 characters of agent session IDs in the list.`})]}),(0,W.jsx)(Mq,{checked:Ee,onCheckedChange:De})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`History Sessions Lookback`}),(0,W.jsxs)(`div`,{className:`text-[10px] text-muted`,children:[`Show history sessions from the last N hours (`,1,`-`,168,`).`]})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`number`,min:1,max:168,value:Ke,onChange:e=>{let t=parseInt(e.target.value,10);t>=1&&t<=168&&_t(t)},disabled:Xe,className:`input text-xs py-1 px-2 w-16 text-center`}),(0,W.jsx)(`span`,{className:`text-xs text-muted`,children:`hrs`})]})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,W.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Notifications`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Permission Sound`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a ping when any session needs permission.`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>void Wq(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,W.jsx)(Mq,{checked:Ae,onCheckedChange:e=>{je(e),e&&Vq()}})]})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Idle Sound`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a chime when a session finishes working.`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>void Gq(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,W.jsx)(Mq,{checked:Me,onCheckedChange:e=>{Ne(e),e&&Vq()}})]})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Terminal Rendering`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`WebGL Acceleration`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`GPU rendering for better performance. Turn off if text looks fuzzy or flickering.`})]}),(0,W.jsx)(Mq,{checked:ce,onCheckedChange:le})]}),ce!==f&&(0,W.jsx)(`p`,{className:`mt-2 text-[10px] text-approval`,children:`Terminal will reload when saved`}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Mouse Mode`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Enable tmux mouse mode for trackpad/scroll wheel support.`})]}),(0,W.jsx)(Mq,{checked:Pe,onCheckedChange:mt,disabled:Ie})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-4`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Terminal Colors`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Preserve ANSI colors for terminal output. Hibernate then Wake running agents after changing this setting.`})]}),(0,W.jsx)(Mq,{checked:Re,onCheckedChange:gt,disabled:Be,ariaLabel:`Enable terminal colors`})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Prefer Window Names`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Label discovered sessions with their tmux window name instead of the session name. Applies immediately.`})]}),(0,W.jsx)(Mq,{checked:He,onCheckedChange:ht,disabled:We})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Size`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal text size in pixels (6-24)`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>de(Math.max(6,ue-1)),className:`flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover`,children:(0,W.jsx)(`span`,{className:`text-sm font-bold`,children:`−`})}),(0,W.jsx)(`span`,{className:`text-sm text-secondary w-6 text-center`,children:ue}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>de(Math.min(24,ue+1)),className:`flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover`,children:(0,W.jsx)(`span`,{className:`text-sm font-bold`,children:`+`})})]})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Line Height`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Vertical spacing (1.0 = compact, 2.0 = spacious)`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`range`,min:`1.0`,max:`2.0`,step:`0.1`,value:fe,onChange:e=>pe(parseFloat(e.target.value)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,W.jsx)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:fe.toFixed(1)})]})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Letter Spacing`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Horizontal spacing between characters in pixels`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`range`,min:`-3`,max:`3`,step:`1`,value:me,onChange:e=>he(parseInt(e.target.value,10)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,W.jsxs)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:[me,`px`]})]})]}),(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Family`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal typeface`})]}),(0,W.jsx)(`select`,{value:ge,onChange:e=>_e(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:L.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),ge===`custom`&&(0,W.jsx)(`input`,{value:ve,onChange:e=>ye(e.target.value),placeholder:`"Fira Code", monospace`,className:`input text-xs mt-2 font-mono`})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Dark Mode`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Switch between dark and light themes.`})]}),(0,W.jsx)(Mq,{checked:Oe===`dark`,onCheckedChange:e=>ke(e?`dark`:`light`)})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Keyboard Shortcut Modifier`}),(0,W.jsx)(`div`,{className:`grid grid-cols-5 gap-1`,children:[`auto`,`ctrl-option`,`ctrl-shift`,`cmd-option`,`cmd-shift`].map(e=>(0,W.jsx)(`button`,{type:`button`,className:`btn text-xs px-2 ${be===e?`btn-primary`:``}`,onClick:()=>xe(e),children:e===`auto`?`Auto`:Ye(e)},e))}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:be===`auto`?`Shortcuts: ${Ye(qe(`auto`))}+[1-9/N/X/[/]]`:`Shortcuts: ${Ye(be)}+[1-9/N/X/[/]]`})]})]})}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2 p-6 pt-4 border-t border-border bg-elevated`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>t(),className:`btn`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Save`})]})]})})}var qq=[];function Jq(e){x.useEffect(e,qq)}var Yq=x.createContext(void 0);function Xq(){let e=x.useContext(Yq);if(!e)throw Error(tG(73));return e}var Zq=Symbol(`NOT_FOUND`);function Qq(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function $q(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function eJ(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var tJ=e=>Array.isArray(e)?e:[e];function nJ(e){let t=Array.isArray(e[0])?e[0]:e;return eJ(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function rJ(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function iJ(e){let t;return{get(n){return t&&e(t.key,n)?t.value:Zq},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function aJ(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return Zq}function i(t,i){r(t)===Zq&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var oJ=(e,t)=>e===t;function sJ(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function cJ(e,t){let{equalityCheck:n=oJ,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=sJ(n),o=0,s=r<=1?iJ(a):aJ(r,a);function c(){let t=s.get(arguments);if(t===Zq){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var lJ=class{constructor(e){this.value=e}deref(){return this.value}},uJ=typeof WeakRef<`u`?WeakRef:lJ,dJ=0,fJ=1;function pJ(){return{s:dJ,v:void 0,o:null,p:null}}function mJ(e,t={}){let n=pJ(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=pJ(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=pJ(),e.set(n,t)):t=r}}let s=t,c;if(t.s===fJ)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new uJ(c):c}return s.s=fJ,s.v=c,c}return o.clearCache=()=>{n=pJ(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function hJ(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Qq(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=mJ,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=tJ(c),p=tJ(u),m=nJ(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=rJ(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var gJ=hJ(mJ),_J=Object.assign((e,t=gJ)=>{$q(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>_J}),vJ=hJ({memoize:cJ,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),yJ=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(tG(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},bJ=(...e)=>{let t=new WeakMap,n=1,r=e[e.length-1],i=e.length-1||1,a=r.length-i;if(a>3)throw Error(tG(2));return(i,o,s,c)=>{let l=i.__cacheKey__;l||(l={id:n},i.__cacheKey__=l,n+=1);let u=t.get(l);if(!u){let n=e,i=[void 0,void 0,void 0];switch(a){case 0:break;case 1:n=[...e.slice(0,-1),()=>i[0],r];break;case 2:n=[...e.slice(0,-1),()=>i[0],()=>i[1],r];break;case 3:n=[...e.slice(0,-1),()=>i[0],()=>i[1],()=>i[2],r];break;default:throw Error(tG(2))}u=vJ(...n),u.selectorArgs=i,t.set(l,u)}switch(u.selectorArgs[0]=o,u.selectorArgs[1]=s,u.selectorArgs[2]=c,a){case 0:return u(i);case 1:return u(i,o);case 2:return u(i,o,s);case 3:return u(i,o,s,c);default:throw Error(`unreachable`)}}},xJ=s((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),SJ=s(((e,t)=>{t.exports=xJ()})),CJ=s((e=>{var t=p(),n=SJ();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),wJ=s(((e,t)=>{t.exports=CJ()})),TJ=[],EJ=void 0;function DJ(){return EJ}function OJ(e){TJ.push(e)}var kJ=SJ(),AJ=wJ(),jJ=rG(19)?PJ:FJ;function MJ(e,t,n,r,i){return jJ(e,t,n,r,i)}function NJ(e,t,n,r,i){let a=x.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,kJ.useSyncExternalStore)(e.subscribe,a,a)}OJ({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,kJ.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function PJ(e,t,n,r,i){let a=DJ();if(!a)return NJ(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function FJ(e,t,n,r,i){return(0,AJ.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var IJ=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return MJ(this,e,t,n,r)}},LJ=class extends IJ{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){x.useDebugValue(e),YW(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;YW(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;YW(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){x.useDebugValue(e);let n=t!==void 0;YW(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return x.useDebugValue(e),MJ(this,this.selectors[e],t,n,r)}useContextCallback(e,t){x.useDebugValue(e);let n=BW(t??$W);this.context[e]=n}useStateSetter(e){let t=x.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},RJ=null;globalThis.requestAnimationFrame;var zJ=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},BJ=class e{static create(){return new e}static request(e){return zJ.request(e)}static cancel(e){return zJ.cancel(e)}currentId=RJ;request(e){this.cancel(),this.currentId=zJ.request(()=>{this.currentId=RJ,e()})}cancel=()=>{this.currentId!==RJ&&(zJ.cancel(this.currentId),this.currentId=RJ)};disposeEffect=()=>this.cancel};function VJ(){let e=LW(BJ.create).current;return Jq(e.disposeEffect),e}var HJ=0,UJ=class e{static create(){return new e}currentId=HJ;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=HJ,t()},e)}isStarted(){return this.currentId!==HJ}clear=()=>{this.currentId!==HJ&&(clearTimeout(this.currentId),this.currentId=HJ)};disposeEffect=()=>this.clear};function WJ(){let e=LW(UJ.create).current;return Jq(e.disposeEffect),e}var GJ=0;function KJ(e){return GJ+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${GJ}`}function qJ(e){return e?.ownerDocument||document}function JJ(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}var YJ=typeof navigator<`u`,XJ=tY(),ZJ=rY(),QJ=nY();typeof CSS>`u`||!CSS.supports||CSS.supports(`-webkit-backdrop-filter:none`),XJ.platform===`MacIntel`&&XJ.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(XJ.platform),YJ&&/firefox/i.test(QJ);var $J=YJ&&/apple/i.test(navigator.vendor);YJ&&/Edg/i.test(QJ),YJ&&/android/i.test(ZJ)||/android/i.test(QJ),YJ&&ZJ.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var eY=QJ.includes(`jsdom/`);function tY(){if(!YJ)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function nY(){if(!YJ)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function rY(){if(!YJ)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function iY(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function aY(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&IG(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function oY(e){return`composedPath`in e?e.composedPath()[0]:e.target}function sY(e){if(!e||eY)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}var cY=bJ(e=>e.toasts,e=>{let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}),lY={toasts:yJ(e=>e.toasts),isEmpty:yJ(e=>e.toasts.length===0),toast:yJ(cY,(e,t)=>e.get(t)?.value),toastIndex:yJ(cY,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:yJ(cY,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:yJ(cY,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:yJ(e=>e.hovering),focused:yJ(e=>e.focused),expanded:yJ(e=>e.hovering||e.focused),expandedOrOutOfFocus:yJ(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:yJ(e=>e.prevFocusElement)},uY=class extends LJ{timers=new Map;areTimersPaused=!1;constructor(e){super(e,{},lY)}setFocused(e){this.set(`focused`,e)}setHovering(e){this.set(`hovering`,e)}setIsWindowFocused(e){this.set(`isWindowFocused`,e)}setPrevFocusElement(e){this.set(`prevFocusElement`,e)}setViewport=e=>{this.set(`viewport`,e)};disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e){let t=lY.toastIndex(this.state,e);if(t===-1)return;this.state.toasts[t]?.onRemove?.();let n=[...this.state.toasts];n.splice(t,1),this.setToasts(n)}addToast=e=>{let{toasts:t,timeout:n,limit:r}=this.state,i=e.id||KJ(`toast`),a={...e,id:i,transitionStatus:`starting`},o=[a,...t],s=o.filter(e=>e.transitionStatus!==`ending`);if(s.length>r){let e=s.length-r,t=s.slice(-e),n=new Set(t.map(e=>e.id));this.setToasts(o.map(e=>{let t=n.has(e.id);return e.limited===t?e:{...e,limited:t}}))}else this.setToasts(o.map(e=>e.limited?{...e,limited:!1}:e));let c=a.timeout??n;return a.type!==`loading`&&c>0&&this.scheduleTimer(i,c,()=>this.closeToast(i)),lY.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),i};updateToast=(e,t)=>{this.updateToastInternal(e,t)};updateToastInternal=(e,t)=>{let{timeout:n,toasts:r}=this.state,i=lY.toast(this.state,e)??null;if(!i||i.transitionStatus===`ending`)return;let a={...i,...t};this.setToasts(r.map(n=>n.id===e?{...n,...t}:n));let o=a.timeout??n,s=i?.timeout??n,c=Object.hasOwn(t,`timeout`),l=a.transitionStatus!==`ending`&&a.type!==`loading`&&o>0,u=this.timers.has(e),d=s!==o,f=i?.type===`loading`;if(!l&&u){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e);return}if(l&&(!u||d||c||f)){let t=this.timers.get(e);t&&(t.timeout?.clear(),this.timers.delete(e)),this.scheduleTimer(e,o,()=>this.closeToast(e)),lY.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=e=>{lY.toast(this.state,e)?.onClose?.();let{limit:t,toasts:n}=this.state,r=0,i=n.map(n=>{if(n.id===e)return{...n,transitionStatus:`ending`,height:0};if(n.transitionStatus===`ending`)return n;let i=r>=t;return r+=1,n.limited===i?n:{...n,limited:i}}),a=this.timers.get(e);a&&a.timeout&&(a.timeout.clear(),this.timers.delete(e)),this.handleFocusManagement(e),this.setToasts(i)};promiseToast=(e,t)=>{let n=JJ(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=JJ(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=JJ(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();let t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=UJ.create(),e.timeout.start(e.remaining,()=>{this.timers.delete(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=oY(e);aY(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=!lY.expandedOrOutOfFocus(this.state),a=i?UJ.create():void 0;a?.start(t,()=>{this.timers.delete(e),n()}),this.timers.set(e,{timeout:a,start:i?r:0,delay:t,remaining:t,callback:n})}setToasts(e){let t={toasts:e};e.length===0&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){let t=iY(qJ(this.state.viewport));if(!this.state.viewport||!aY(this.state.viewport,t)||!sY(t))return;let n=lY.toasts(this.state),r=lY.toastIndex(this.state,e),i=null,a=r+1;for(;a<n.length;){if(n[a].transitionStatus!==`ending`){i=n[a];break}a+=1}if(!i)for(a=r-1;a>=0;){if(n[a].transitionStatus!==`ending`){i=n[a];break}--a}i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}},dY=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=LW(()=>new uY({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return Jq(a.disposeEffect),x.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`&&n?a.closeToast(n):a.addToast(t)})},[a,n,i]),a.useSyncedValues({timeout:n,limit:r}),(0,W.jsx)(Yq.Provider,{value:a,children:t})},fY=x.forwardRef(function(e,t){let[n,r]=x.useState();YW(()=>{$J&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,W.jsx)(`span`,{...e,ref:t,style:ZW,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),pY=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({}),mY=x.forwardRef(function(e,t){let{render:n,className:r,children:i,...a}=e,o=Xq(),s=WJ(),c=x.useRef(!1),l=x.useRef(!1),u=o.useState(`isEmpty`),d=o.useState(`toasts`),f=o.useState(`focused`),p=o.useState(`expanded`),m=o.useState(`prevFocusElement`),h=d[0]?.height??0,g=x.useMemo(()=>d.some(e=>e.transitionStatus===`ending`),[d]);x.useEffect(()=>{let e=o.state.viewport;if(!e)return;function t(t){u||t.key===`F6`&&t.target!==e&&(t.preventDefault(),o.setPrevFocusElement(iY(qJ(e))),e?.focus({preventScroll:!0}),o.pauseTimers(),o.setFocused(!0))}let n=NG(e);return n.addEventListener(`keydown`,t),()=>{n.removeEventListener(`keydown`,t)}},[o,u]),x.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=NG(e);function n(e){e.target===t&&(o.setIsWindowFocused(!1),o.pauseTimers())}function r(n){if(n.relatedTarget||n.target===t)return;let r=oY(n),i=iY(qJ(e));(!aY(e,r)||!sY(i))&&o.resumeTimers(),s.start(0,()=>o.setIsWindowFocused(!0))}return t.addEventListener(`blur`,n,!0),t.addEventListener(`focus`,r,!0),()=>{t.removeEventListener(`blur`,n,!0),t.removeEventListener(`focus`,r,!0)}},[o,s,u]),x.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=qJ(e);return t.addEventListener(`pointerdown`,o.handleDocumentPointerDown,!0),()=>{t.removeEventListener(`pointerdown`,o.handleDocumentPointerDown,!0)}},[u,o]);function _(e){let t=o.state.viewport;t&&(c.current=!0,e.relatedTarget===t?d[0]?.ref?.current?.focus():o.restoreFocusToPrevElement())}function v(e){e.key===`Tab`&&e.shiftKey&&e.target===o.state.viewport&&(e.preventDefault(),o.restoreFocusToPrevElement(),o.resumeTimers())}x.useEffect(()=>{!o.state.isWindowFocused||g||!l.current||(o.resumeTimers(),o.setHovering(!1),l.current=!1)},[g,o]);function y(){o.pauseTimers(),o.setHovering(!0),l.current=!1}function b(){g?l.current=!0:(o.resumeTimers(),o.setHovering(!1))}function S(){if(c.current){c.current=!1;return}f||sY(qJ(o.state.viewport).activeElement)&&(o.setFocused(!0),o.pauseTimers())}function C(e){!f||aY(o.state.viewport,e.relatedTarget)||(o.setFocused(!1),o.resumeTimers())}let w={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:y,onMouseMove:y,onMouseLeave:b,onFocus:S,onBlur:C,onKeyDown:v,onClick:S},T={expanded:p},E=xG(`div`,e,{ref:[t,o.setViewport],state:T,props:[w,{style:{[pY.frontmostHeight]:h?`${h}px`:void 0}},a,{children:(0,W.jsxs)(x.Fragment,{children:[!u&&m&&(0,W.jsx)(fY,{onFocus:_}),i,!u&&m&&(0,W.jsx)(fY,{onFocus:_})]})}]}),D=x.useMemo(()=>d.filter(e=>e.priority===`high`),[d]);return(0,W.jsxs)(x.Fragment,{children:[!u&&m&&(0,W.jsx)(fY,{onFocus:_}),E,!f&&D.length>0&&(0,W.jsx)(`div`,{style:ZW,children:D.map(e=>(0,W.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,W.jsx)(`div`,{children:e.title}),(0,W.jsx)(`div`,{children:e.description})]},e.id))})]})});function hY(e){return rG(19)?e:e?`true`:void 0}var gY=x.createContext(void 0);function _Y(){let e=x.useContext(gY);if(!e)throw Error(tG(66));return e}var vY=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),yY={[vY.startingStyle]:``},bY={[vY.endingStyle]:``},xY={transitionStatus(e){return e===`starting`?yY:e===`ending`?bY:null}};function SY(e){return e==null?e:`current`in e?e.current:e}function CY(e,t=!1,n=!0){let r=VJ();return BW((i,a=null)=>{r.cancel();function o(){U.flushSync(i)}let s=SY(e);if(s==null)return;let c=s;if(typeof c.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{function e(){let e=vY.startingStyle;if(!c.hasAttribute(e)){r.request(i);return}let t=new MutationObserver(()=>{c.hasAttribute(e)||(t.disconnect(),i())});t.observe(c,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}function i(){Promise.all(c.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||o()}).catch(()=>{let e=c.getAnimations();if(n){if(a?.aborted)return;o()}else e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&i()})}if(t){e();return}r.request(i)}})}function wY(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=BW(i),o=CY(r,n,!1);x.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var TY=function(e){return e.index=`--toast-index`,e.offsetY=`--toast-offset-y`,e.height=`--toast-height`,e.swipeMovementX=`--toast-swipe-movement-x`,e.swipeMovementY=`--toast-swipe-movement-y`,e}({}),EY={...xY,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},DY=40,OY=10,kY=.5,AY=1;function jY(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function MY(e){let t=window.getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var NY=x.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],...o}=e,s=n.positionerProps?.anchor!==void 0,c=[];s||(c=Array.isArray(a)?a:[a]);let l=c.length>0,u=Xq(),[d,f]=x.useState(void 0),[p,m]=x.useState(!1),[h,g]=x.useState(!1),[_,v]=x.useState(!1),[y,b]=x.useState({x:0,y:0}),[S,C]=x.useState({x:0,y:0,scale:1}),[w,T]=x.useState(),[E,D]=x.useState(),[O,k]=x.useState(null),A=x.useRef(null),j=x.useRef({x:0,y:0}),M=x.useRef({x:0,y:0,scale:1}),N=x.useRef(void 0),P=x.useRef(0),F=x.useRef(!1),I=x.useRef({x:0,y:0}),L=x.useRef(!1),ee=u.useState(`toastIndex`,n.id),R=u.useState(`toastVisibleIndex`,n.id),z=u.useState(`toastOffsetY`,n.id),B=u.useState(`focused`),te=u.useState(`expanded`);wY({open:n.transitionStatus!==`ending`,ref:A,onComplete(){n.transitionStatus===`ending`&&u.removeToast(n.id)}});let V=BW((e=!1)=>{let t=A.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){u.updateToastInternal(n.id,{ref:A,height:i,...n.transitionStatus===`starting`?{transitionStatus:void 0}:{}})}e?U.flushSync(a):a()});YW(V,[V]);function ne(e,t){let n=e,r=t;return!c.includes(`left`)&&!c.includes(`right`)?n=e>0?e**kY:-(Math.abs(e)**kY):(!c.includes(`right`)&&e>0&&(n=e**kY),!c.includes(`left`)&&e<0&&(n=-(Math.abs(e)**kY))),!c.includes(`up`)&&!c.includes(`down`)?r=t>0?t**kY:-(Math.abs(t)**kY):(!c.includes(`down`)&&t>0&&(r=t**kY),!c.includes(`up`)&&t<0&&(r=-(Math.abs(t)**kY))),{x:n,y:r}}function H(e){if(e.button!==0)return;e.pointerType===`touch`&&u.pauseTimers();let t=oY(e.nativeEvent);if(!(t&&t.closest(`button,a,input,textarea,[role="button"],[data-swipe-ignore]`))){if(F.current=!1,N.current=void 0,P.current=0,j.current={x:e.clientX,y:e.clientY},I.current=j.current,A.current){let e=MY(A.current);M.current=e,C(e),b({x:e.x,y:e.y})}u.setHovering(!0),m(!0),g(!1),k(null),L.current=!0,A.current?.setPointerCapture(e.pointerId)}}function re(e){if(!p)return;e.preventDefault(),L.current&&=(j.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>I.current.y||i>0&&t<I.current.y)&&(I.current={x:I.current.x,y:t}),(r<0&&n>I.current.x||r>0&&n<I.current.x)&&(I.current={x:n,y:I.current.y});let a=n-j.current.x,o=t-j.current.y,s=t-I.current.y,l=n-I.current.x;if(!h&&Math.sqrt(a*a+o*o)>=AY&&(g(!0),O===null)){let e=c.includes(`left`)||c.includes(`right`),t=c.includes(`up`)||c.includes(`down`);e&&t&&k(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let u;if(!N.current)O===`vertical`?o>0?u=`down`:o<0&&(u=`up`):O===`horizontal`?a>0?u=`right`:a<0&&(u=`left`):u=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,u&&c.includes(u)&&(N.current=u,P.current=jY(u,a,o),f(u));else{let e=N.current,t=jY(e,l,s);t>DY?(F.current=!1,f(e)):!(c.includes(`left`)&&c.includes(`right`))&&!(c.includes(`up`)&&c.includes(`down`))&&P.current-t>=OY&&(F.current=!0)}let d=ne(a,o),m=M.current.x,_=M.current.y;O===`horizontal`?(c.includes(`left`)||c.includes(`right`))&&(m+=d.x):(O===`vertical`||(c.includes(`left`)||c.includes(`right`))&&(m+=d.x),(c.includes(`up`)||c.includes(`down`))&&(_+=d.y)),b({x:m,y:_})}function ie(e){if(!p)return;if(m(!1),g(!1),k(null),A.current?.releasePointerCapture(e.pointerId),F.current){b({x:S.x,y:S.y}),f(void 0);return}let t=!1,r=y.x-S.x,i=y.y-S.y,a;for(let e of c){switch(e){case`right`:r>DY&&(t=!0,a=`right`);break;case`left`:r<-DY&&(t=!0,a=`left`);break;case`down`:i>DY&&(t=!0,a=`down`);break;case`up`:i<-DY&&(t=!0,a=`up`);break;default:break}if(t)break}t?(f(a),v(!0),u.closeToast(n.id)):(b({x:S.x,y:S.y}),f(void 0))}function ae(e){if(e.key===`Escape`){if(!A.current||!aY(A.current,iY(qJ(A.current))))return;u.closeToast(n.id)}}x.useEffect(()=>{if(!l)return;let e=A.current;if(!e)return;function t(t){aY(e,t.target)&&t.preventDefault()}return e.addEventListener(`touchmove`,t,{passive:!1}),()=>{e.removeEventListener(`touchmove`,t)}},[l]);function oe(){if(!p&&y.x===S.x&&y.y===S.y&&!_)return{[TY.swipeMovementX]:`0px`,[TY.swipeMovementY]:`0px`};let e=y.x-S.x,t=y.y-S.y;return{transition:p?`none`:void 0,transform:p?`translateX(${y.x}px) translateY(${y.y}px) scale(${S.scale})`:void 0,[TY.swipeMovementX]:`${e}px`,[TY.swipeMovementY]:`${t}px`}}let se=n.priority===`high`,ce={role:se?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":w,"aria-describedby":E,"aria-hidden":se&&!B?!0:void 0,onPointerDown:l?H:void 0,onPointerMove:l?re:void 0,onPointerUp:l?ie:void 0,onKeyDown:ae,inert:hY(n.limited),style:{...oe(),[TY.index]:n.transitionStatus===`ending`?ee:R,[TY.offsetY]:`${z}px`,[TY.height]:n.height?`${n.height}px`:void 0}},le=x.useMemo(()=>({rootRef:A,toast:n,titleId:w,setTitleId:T,descriptionId:E,setDescriptionId:D,swiping:p,swipeDirection:d,recalculateHeight:V,index:ee,visibleIndex:R,expanded:te}),[n,w,E,p,d,V,ee,R,te]),ue={transitionStatus:n.transitionStatus,expanded:te,limited:n.limited||!1,type:n.type,swiping:le.swiping,swipeDirection:le.swipeDirection},de=xG(`div`,e,{ref:[t,le.rootRef],state:ue,stateAttributesMapping:EY,props:[ce,o]});return(0,W.jsx)(gY.Provider,{value:le,children:de})}),PY=x.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setDescriptionId:c}=_Y(),l=a??s.description,u=!!l,d=AG(i);YW(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=xG(`p`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),FY=x.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setTitleId:c}=_Y(),l=a??s.title,u=!!l,d=AG(i);YW(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=xG(`h2`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),IY=x.forwardRef(function(e,t){let{render:n,className:r,disabled:i,nativeButton:a=!0,...o}=e,s=Xq(),{toast:c}=_Y(),l=s.useState(`expanded`),[u,d]=x.useState(!1),{getButtonProps:f,buttonRef:p}=BG({disabled:i,native:a}),m={type:c.type};return xG(`button`,e,{ref:[t,p],state:m,props:[{"aria-hidden":!l&&!u,onClick(){s.closeToast(c.id)},onFocus(){d(!0)},onBlur(){d(!1)}},o,f]})});function LY(){let e=x.useContext(Yq);if(!e)throw Error(tG(73));let t=e.useState(`toasts`);return x.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function RY(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||KJ(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var zY=5e3,BY=RY();function VY({toast:e}){return(0,W.jsxs)(NY,{toast:e,className:jq(`relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg`,`data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]`,`data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]`,`data-[ending-style]:opacity-0`,`data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0`,`transition-all duration-200`,e.type===`error`&&`border-error/50`,e.type===`success`&&`border-approval/50`,(!e.type||e.type===`info`)&&`border-border`),children:[(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsx)(FY,{className:jq(`text-sm font-medium`,e.type===`error`&&`text-error`,e.type===`success`&&`text-approval`,(!e.type||e.type===`info`)&&`text-primary`),children:e.title}),e.description&&(0,W.jsx)(PY,{className:`mt-1 text-xs text-muted line-clamp-2`,children:e.description})]}),(0,W.jsx)(IY,{className:`shrink-0 text-muted hover:text-primary transition-colors`,"aria-label":`Close`,children:(0,W.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,W.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}function HY(){let{toasts:e}=LY();return(0,W.jsx)(W.Fragment,{children:e.map(e=>(0,W.jsx)(VY,{toast:e},e.id))})}function UY(){return(0,W.jsxs)(dY,{timeout:zY,toastManager:BY,children:[(0,W.jsx)(HY,{}),(0,W.jsx)(mY,{className:`fixed bottom-4 right-4 z-[100] flex flex-col gap-2`})]})}var WY=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],GY=3e3,KY=8e3,qY=15e3,JY=5e3,YY=2e4,XY=1e4,ZY=1500,QY=5e3,$Y=750,eX=4,tX=5e3,nX=new class{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status=`connecting`,this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.connectTimer=null,this.manualClose=!1,this.lastTick=Date.now(),this.wakeCheckInterval=null,this.lifecycleStarted=!1,this.heartbeatTimer=null,this.pongTimer=null,this.lastForceReconnectTs=0,this.lastConnectTs=0,this.pingSeq=0,this.connectionEpoch=0,this.consecutiveFailures=0,this.stallCount=0,this.isResumeAttempt=!1,this.leakedSockets=new Set,this.verifyTimer=null,this.onVisibilityChange=()=>{if(J(`ws_visibility`,{state:document.visibilityState,...this.wsSnap()},`info`),document.visibilityState===`visible`){let e=Date.now(),t=e-this.lastTick;this.lastTick=e,J(`ws_resume`,{gapMs:t,...this.wsSnap()},`info`),this.ws?.readyState===WebSocket.OPEN?this.verifyConnection():this.forceReconnect(`visibilitychange`,!0)}else this.stopHeartbeat(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null)},this.onPageShow=e=>{J(`ws_pageshow`,{persisted:e.persisted,...this.wsSnap()},`info`),e.persisted&&(this.lastTick=Date.now(),this.forceReconnect(`pageshow`,!0))}}wsSnap(){return{status:this.status,ws:this.ws?WY[this.ws.readyState]:null,attempt:this.reconnectAttempts,failures:this.consecutiveFailures,stalls:this.stallCount,leaked:this.leakedSockets.size,online:typeof navigator<`u`?navigator.onLine:void 0,verifying:this.verifyTimer!==null,buffered:this.ws?this.ws.bufferedAmount:void 0}}connect(){if(this.ws){let e=this.ws.readyState===WebSocket.OPEN;if(e&&this.status===`connected`){J(`ws_connect_skip`,{reason:`already_open`,...this.wsSnap()});return}let t=Date.now();if(this.ws.readyState===WebSocket.CONNECTING&&t-this.lastConnectTs<200){J(`ws_connect_skip`,{reason:`already_connecting`,...this.wsSnap()});return}J(`ws_connect_destroy_zombie`,{reason:e?`open_desynced`:`not_open`,...this.wsSnap()}),this.destroySocket()}this.manualClose=!1,this.clearConnectTimer(),this.setStatus(`connecting`);let e=`${window.location.protocol===`https:`?`wss`:`ws`}://${window.location.host}/ws`;J(`ws_connect`,{url:e,resume:this.isResumeAttempt,...this.wsSnap()},`info`);let t=new WebSocket(e);this.ws=t,this.lastConnectTs=Date.now(),this.leakedSockets.add(t);let n=this.isResumeAttempt?KY:GY;this.isResumeAttempt=!1,this.connectTimer=window.setTimeout(()=>{this.ws===t&&(this.connectTimer=null,t.readyState===WebSocket.OPEN&&this.status===`connected`||(J(`ws_connect_timeout`,{wsState:WY[t.readyState],managerStatus:this.status,timeoutMs:n,...this.wsSnap()},`info`),this.consecutiveFailures+=1,this.destroySocket(),this.scheduleReconnect()))},n),t.onopen=()=>{if(this.ws!==t){J(`ws_onopen_stale`,this.wsSnap(),`info`);return}J(`ws_onopen`,this.wsSnap(),`info`),this.clearConnectTimer(),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.connectionEpoch+=1,this.leakedSockets.delete(t),this.setStatus(`connected`),this.startHeartbeat()},t.onmessage=e=>{try{let t=e.data,n=performance.now(),r=JSON.parse(t),i=performance.now()-n,a=r;if(a._parseMs=Math.round(i),a._rawLength=t.length,r.type===`pong`){r.seq===this.pingSeq&&(this.clearPongTimer(),this.verifyTimer!==null&&(this.cancelVerify(),J(`ws_verify_ok`,this.wsSnap(),`info`),this.startHeartbeat(QY)));return}this.listeners.forEach(e=>e(r))}catch{}},t.onerror=()=>{this.ws===t&&(J(`ws_onerror`,this.wsSnap(),`info`),this.clearConnectTimer())},t.onclose=e=>{if(this.ws!==t){J(`ws_onclose_stale`,{code:e.code,...this.wsSnap()},`info`);return}J(`ws_onclose`,{code:e.code,reason:e.reason,clean:e.wasClean,...this.wsSnap()},`info`),this.clearConnectTimer(),this.cancelVerify(),this.consecutiveFailures+=1,this.ws=null,this.manualClose?this.setStatus(`disconnected`):this.scheduleReconnect()}}disconnect(){this.manualClose=!0,this.clearConnectTimer(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),this.setStatus(`disconnected`)}startLifecycleListeners(){this.lifecycleStarted||typeof document>`u`||typeof window>`u`||(this.lifecycleStarted=!0,document.addEventListener(`visibilitychange`,this.onVisibilityChange),window.addEventListener(`pageshow`,this.onPageShow),this.lastTick=Date.now(),this.wakeCheckInterval=window.setInterval(()=>{let e=Date.now(),t=e-this.lastTick;this.isHidden()||(t>qY&&(J(`ws_time_jump`,{gapMs:t,...this.wsSnap()},`info`),this.forceReconnect(`time_jump`,!0)),this.lastTick=e)},JY))}stopLifecycleListeners(){this.lifecycleStarted&&(this.lifecycleStarted=!1,document.removeEventListener(`visibilitychange`,this.onVisibilityChange),window.removeEventListener(`pageshow`,this.onPageShow),this.wakeCheckInterval!==null&&(window.clearInterval(this.wakeCheckInterval),this.wakeCheckInterval=null))}send(e){if(this.ws?.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(e)),!0}catch(t){return J(`ws_send_error`,{messageType:e.type,error:t instanceof Error?t.message:String(t),...this.wsSnap()},`info`),this.destroySocket(),this.scheduleReconnect(),!1}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeStatus(e){return this.statusListeners.add(e),e(this.status,this.error,this.connectionEpoch),()=>this.statusListeners.delete(e)}getStatus(){return this.status}getConnectionEpoch(){return this.connectionEpoch}verifyConnection(){this.cancelVerify(),this.stopHeartbeat(),this.pingSeq+=1;let e=this.pingSeq,t=this.ws;if(J(`ws_verify`,{seq:e,...this.wsSnap()},`info`),!this.send({type:`ping`,seq:e})){J(`ws_verify_send_fail`,this.wsSnap(),`info`),this.forceReconnect(`verify_send_fail`,!0);return}this.verifyTimer=window.setTimeout(()=>{this.verifyTimer=null,this.ws===t&&(J(`ws_verify_timeout`,this.wsSnap(),`info`),this.forceReconnect(`verify_timeout`,!0))},ZY)}cancelVerify(){this.verifyTimer!==null&&(window.clearTimeout(this.verifyTimer),this.verifyTimer=null)}forceReconnect(e=`unknown`,t=!1){if(this.manualClose){J(`ws_force_skip`,{trigger:e,reason:`manual_close`});return}let n=Date.now(),r=t?200:500;if(n-this.lastForceReconnectTs<r){J(`ws_force_skip`,{trigger:e,reason:`debounce`,force:t});return}if(!t&&this.ws?.readyState===WebSocket.OPEN&&this.status===`connected`){J(`ws_force_skip`,{trigger:e,reason:`already_connected`});return}this.lastForceReconnectTs=n,J(`ws_force_reconnect`,{trigger:e,force:t,...this.wsSnap()},`info`),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),t?(this.purgeLeakedSockets(),this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},$Y)):this.connect()}startHeartbeat(e){this.stopHeartbeat();let t=()=>{this.ws?.readyState===WebSocket.OPEN&&(this.pingSeq+=1,this.send({type:`ping`,seq:this.pingSeq})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,J(`ws_pong_timeout`,this.wsSnap(),`info`),this.destroySocket(),this.scheduleReconnect()},XY)))};e!==void 0&&e<YY?this.heartbeatTimer=window.setTimeout(()=>{t(),this.heartbeatTimer=window.setInterval(t,YY)},e):this.heartbeatTimer=window.setInterval(t,YY)}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null),this.clearPongTimer()}clearPongTimer(){this.pongTimer!==null&&(window.clearTimeout(this.pongTimer),this.pongTimer=null)}setStatus(e,t=null){this.status=e,this.error=t,this.statusListeners.forEach(n=>n(e,t,this.connectionEpoch))}scheduleReconnect(){if(this.stopHeartbeat(),this.isHidden()){J(`ws_schedule_skip`,{reason:`hidden`,...this.wsSnap()}),this.setStatus(`reconnecting`);return}if(this.consecutiveFailures>=eX){J(`ws_stall_detected`,this.wsSnap(),`info`),this.purgeLeakedSockets();let e=Math.min(tX*2**this.stallCount,3e4);this.stallCount+=1,this.consecutiveFailures=0,this.reconnectAttempts=0,this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e);return}this.reconnectAttempts+=1;let e=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);J(`ws_schedule_reconnect`,{delay:e,...this.wsSnap()}),this.setStatus(`reconnecting`),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}isHidden(){return typeof document<`u`&&document.visibilityState===`hidden`}clearConnectTimer(){this.connectTimer&&=(window.clearTimeout(this.connectTimer),null)}destroySocket(){if(this.clearConnectTimer(),this.stopHeartbeat(),this.cancelVerify(),!this.ws)return;let e=this.ws;this.ws=null,this.leakedSockets.add(e),e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}purgeLeakedSockets(){if(this.leakedSockets.size!==0){J(`ws_purge_leaked`,{count:this.leakedSockets.size},`info`);for(let e of this.leakedSockets)try{e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,e.close()}catch{}this.leakedSockets.clear()}}};function rX(){let e=qm(e=>e.setConnectionState);return(0,x.useEffect)(()=>{nX.connect(),nX.startLifecycleListeners();let t=nX.subscribeStatus((t,n,r)=>{e(t,n,r)});return()=>{t(),nX.stopLifecycleListeners()}},[e]),{sendMessage:(0,x.useMemo)(()=>e=>{nX.send(e)},[]),subscribe:(0,x.useMemo)(()=>nX.subscribe.bind(nX),[]),getConnectionEpoch:(0,x.useMemo)(()=>()=>nX.getConnectionEpoch(),[])}}var iX=100;function aX({viewport:e,win:t,doc:n}){if(!e)return!1;let r=Math.max(0,e.offsetTop||0),i=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+r),o=Math.max(0,a),s=Math.max(0,e.height||0),c=Math.max(0,e.width||0);return n.documentElement.style.setProperty(`--keyboard-inset`,`${o}px`),n.documentElement.style.setProperty(`--viewport-offset-top`,`${r}px`),n.documentElement.style.setProperty(`--viewport-offset-left`,`${i}px`),n.documentElement.style.setProperty(`--visual-viewport-height`,`${s}px`),n.documentElement.style.setProperty(`--visual-viewport-width`,`${c}px`),o>iX?n.documentElement.classList.add(`keyboard-visible`):n.documentElement.classList.remove(`keyboard-visible`),!0}function oX(e){e.documentElement.style.removeProperty(`--keyboard-inset`),e.documentElement.style.removeProperty(`--viewport-offset-top`),e.documentElement.style.removeProperty(`--viewport-offset-left`),e.documentElement.style.removeProperty(`--visual-viewport-height`),e.documentElement.style.removeProperty(`--visual-viewport-width`),e.documentElement.classList.remove(`keyboard-visible`)}function sX(){(0,x.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=null,n=null,r=()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName?.toLowerCase();return t===`input`||t===`textarea`?!0:!!e.isContentEditable},i=()=>{aX({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!=`function`){i();return}t!==null&&window.cancelAnimationFrame(t);let e=performance.now(),n=()=>{i(),t=performance.now()-e<1500?window.requestAnimationFrame(n):null};t=window.requestAnimationFrame(n)},o=()=>{if(!r()){c();return}i()},s=()=>{n!==null||typeof window.setInterval!=`function`||(n=window.setInterval(o,250),o())},c=()=>{n===null||typeof window.clearInterval!=`function`||(window.clearInterval(n),n=null)},l=()=>{r()?(a(),s(),i()):c()},u=()=>{l()},d=()=>{l()},f=()=>{a()};return i(),l(),e.addEventListener(`resize`,i),e.addEventListener(`scroll`,i),typeof window.addEventListener==`function`&&(window.addEventListener(`resize`,i),window.addEventListener(`orientationchange`,f)),typeof document.addEventListener==`function`&&(document.addEventListener(`focusin`,u),document.addEventListener(`focusout`,d),document.addEventListener(`focus`,u,!0),document.addEventListener(`blur`,d,!0)),()=>{e.removeEventListener(`resize`,i),e.removeEventListener(`scroll`,i),typeof window.removeEventListener==`function`&&(window.removeEventListener(`resize`,i),window.removeEventListener(`orientationchange`,f)),typeof document.removeEventListener==`function`&&(document.removeEventListener(`focusin`,u),document.removeEventListener(`focusout`,d),document.removeEventListener(`focus`,u,!0),document.removeEventListener(`blur`,d,!0)),t!==null&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(t),c(),oX(document)}},[])}var cX=[`theme`,`commandPresets`,`defaultPresetId`,`defaultProjectDir`,`lastProjectPath`,`recentPaths`,`sessionSortMode`,`sessionSortDirection`,`manualSessionOrder`,`projectFilters`,`hostFilters`],lX=[`claude`,`claude-rp`,`codex`,`pi`,`devin`,`grok`,`omp`];function uX(e,t){return Array.isArray(e)&&e.length<=t&&e.every(e=>typeof e==`string`)}function dX(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>=1&&t.id.length<=128&&typeof t.label==`string`&&t.label.trim().length>=1&&t.label.length<=64&&typeof t.command==`string`&&t.command.trim().length>=1&&t.command.length<=1024&&typeof t.isBuiltIn==`boolean`&&(t.agentType===void 0||lX.includes(t.agentType))}var fX={theme:e=>e===`dark`||e===`light`,commandPresets:e=>Array.isArray(e)&&e.length<=50&&e.every(dX),defaultPresetId:e=>typeof e==`string`&&e.length<=128,defaultProjectDir:e=>typeof e==`string`&&e.length<=4096,lastProjectPath:e=>e===null||typeof e==`string`&&e.length<=4096,recentPaths:e=>uX(e,50),sessionSortMode:e=>e===`status`||e===`created`||e===`manual`,sessionSortDirection:e=>e===`asc`||e===`desc`,manualSessionOrder:e=>uX(e,1e3),projectFilters:e=>uX(e,500),hostFilters:e=>uX(e,500)};function pX(e){return cX.includes(e)}function mX(e,t){return fX[e](t)}var hX=`agentboard-theme`,gX=`agentboard-settings`,_X=200,vX=new Map,yX=new Set,bX=null,xX=!1;function SX(e){return e===`theme`?uU.getState().theme:H.getState()[e]}function CX(e){let t=e===`theme`?hX:gX;return M.getItem(t)!==null}function wX(){if(bX=null,yX.size===0)return;let e={};for(let t of yX){let n=SX(t);e[t]=n,vX.set(t,JSON.stringify(n))}yX.clear();try{fetch(`/api/settings/synced`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({settings:e})}).then(e=>{e.ok||J(`synced_settings_push_rejected`,{status:e.status},`warn`)}).catch(e=>{J(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)})}catch(e){J(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)}}function TX(e){yX.add(e),!bX&&(bX=setTimeout(wX,_X))}function EX(e){let t=new Map;for(let e of cX)t.set(e,CX(e));let n={},r;for(let[t,i]of Object.entries(e))!pX(t)||!mX(t,i)||(vX.set(t,JSON.stringify(i)),t===`theme`?r=i:n[t]=i);r!==void 0&&uU.setState({theme:r}),Object.keys(n).length>0&&H.setState(n);for(let n of cX){if(n in e||!t.get(n))continue;let r=SX(n);mX(n,r)&&vX.get(n)!==JSON.stringify(r)&&TX(n)}}function DX(){if(xX)return()=>{};xX=!0;let e=H.subscribe((e,t)=>{let n=e,r=t;for(let e of cX)e!==`theme`&&n[e]!==r[e]&&vX.get(e)!==JSON.stringify(n[e])&&TX(e)}),t=uU.subscribe((e,t)=>{e.theme!==t.theme&&vX.get(`theme`)!==JSON.stringify(e.theme)&&TX(`theme`)});return()=>{e(),t(),xX=!1,bX&&=(clearTimeout(bX),null),yX.clear(),vX.clear()}}function OX(e,t,n){let r=e;return t.length>0&&(r=r.filter(e=>t.includes(e.projectPath))),n.length>0&&(r=r.filter(e=>n.includes(e.host??``))),r}function kX(){let[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(void 0),[i,a]=(0,x.useState)(void 0),[o,s]=(0,x.useState)(void 0),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null),g=qm(e=>e.sessions),_=qm(e=>e.agentSessions),v=qm(e=>e.agentSessionsEpoch),y=qm(e=>e.selectedSessionId),b=qm(e=>e.selectedHibernatingSessionId),S=qm(e=>e.setSessions),C=qm(e=>e.setAgentSessions),w=qm(e=>e.setActiveAgentSessions),T=qm(e=>e.setHostStatuses),E=qm(e=>e.updateSession),D=qm(e=>e.setSelectedSessionId),O=qm(e=>e.setSelectedHibernatingSessionId),k=qm(e=>e.hasLoaded),A=qm(e=>e.connectionStatus),j=qm(e=>e.connectionError),M=qm(e=>e.clearExitingSession),N=qm(e=>e.markSessionExiting),P=qm(e=>e.setRemoteAllowControl),F=qm(e=>e.setRemoteAllowAttach),I=qm(e=>e.setHostLabel),L=qm(e=>e.setPreferWindowName),ee=qm(e=>e.hostStatuses),R=qm(e=>e.remoteAllowControl),z=qm(e=>e.hostLabel),B=uU(e=>e.theme),te=re(),V=H(e=>e.defaultProjectDir),ne=H(e=>e.commandPresets),ie=H(e=>e.defaultPresetId),ae=H(e=>e.lastProjectPath),oe=H(e=>e.setLastProjectPath),se=H(e=>e.addRecentPath),ce=H(e=>e.shortcutModifier),le=H(e=>e.sidebarWidth),ue=H(e=>e.setSidebarWidth),de=H(e=>e.projectFilters),fe=H(e=>e.hostFilters),pe=H(e=>e.soundOnPermission),me=H(e=>e.soundOnIdle),he=qm(e=>e.connectionEpoch),{sendMessage:ge,subscribe:_e,getConnectionEpoch:ve}=rX();(0,x.useEffect)(()=>DX(),[]),sX(),(0,x.useEffect)(()=>{if(typeof document>`u`||!pe&&!me)return;let e=!1,t=()=>{e&&!zq()||(e=!0,Vq())};return document.addEventListener(`click`,t,{passive:!0}),document.addEventListener(`keydown`,t,{passive:!0}),document.addEventListener(`touchstart`,t,{passive:!0}),()=>{document.removeEventListener(`click`,t),document.removeEventListener(`keydown`,t),document.removeEventListener(`touchstart`,t)}},[pe,me]);let ye=(0,x.useRef)(!1),be=(0,x.useCallback)(e=>{e.preventDefault(),ye.current=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]);(0,x.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=e=>{if(!ye.current)return;let t=e.clientX;ue(Math.max(180,Math.min(400,t)))},t=()=>{ye.current&&(ye.current=!1,document.body.style.cursor=``,document.body.style.userSelect=``)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[ue]),(0,x.useEffect)(()=>{let e=_e(e=>{if(e.type!==`terminal-output`){if(e.type===`sessions`){let t=qm.getState().sessions,{soundOnPermission:n,soundOnIdle:r}=H.getState();if(n||r)for(let i of e.sessions){let e=t.find(e=>e.id===i.id);e&&e.status!==i.status&&(e.status!==`permission`&&i.status===`permission`&&n&&Wq(),e.status===`working`&&i.status===`waiting`&&r&&Gq())}if(Ie.current.size>0){let e=ve();for(let[t,n]of Ie.current)n.epoch!==e&&Ie.current.delete(t)}let i=Ie.current.size>0?e.sessions.filter(e=>!Ie.current.has(e.id)):e.sessions,{selectedSessionId:a,selectedHibernatingSessionId:o}=qm.getState(),s=a!==null&&o===null&&!i.some(e=>e.id===a)?t.find(e=>e.id===a)?.agentSessionId?.trim()??null:null;s&&(Me.current=s),S(i);let c=Ne.current,{selectedSessionId:l,selectedHibernatingSessionId:u}=qm.getState(),{projectFilters:d,hostFilters:f}=H.getState();if(c&&l===null&&u===null){let e=i.find(e=>!(e.agentSessionId?.trim()!==c||d.length>0&&!d.includes(e.projectPath)||f.length>0&&!f.includes(e.host??``)));e&&(Ne.current=null,D(e.id))}}if(e.type===`host-status`&&T(e.hosts),e.type===`server-config`&&(P(e.remoteAllowControl),F(e.remoteAllowAttach),I(e.hostLabel),L(e.preferWindowName),e.clientLogLevel&&SE(e.clientLogLevel)),e.type===`synced-settings`&&EX(e.settings),e.type===`session-update`){let t=qm.getState().sessions.find(t=>t.id===e.session.id)?.status,n=e.session.status;if(E(e.session),t){let{soundOnPermission:e,soundOnIdle:r}=H.getState();t!==`permission`&&n===`permission`&&e&&Wq(),t===`working`&&n===`waiting`&&r&&Gq()}}if(e.type===`session-created`){let t=qm.getState().sessions;t.some(t=>t.id===e.session.id)||S([e.session,...t]),D(e.session.id),se(e.session.projectPath);let{projectFilters:n,setProjectFilters:r}=H.getState();n.length>0&&!n.includes(e.session.projectPath)&&r([...n,e.session.projectPath])}if(e.type===`session-removed`){FH(e.sessionId);let t=qm.getState().sessions,n=t.filter(t=>t.id!==e.sessionId);n.length!==t.length&&S(n)}if(e.type===`agent-sessions`){let t=Array.isArray(e.active)?e.active:[],n=Array.isArray(e.hibernating)?e.hibernating:[],r=Array.isArray(e.history)?e.history:[],{selectedHibernatingSessionId:i}=qm.getState(),a=Me.current;i&&!n.some(e=>e.sessionId===i)&&(Ne.current=i),C(t,n,r),h(e=>e&&n.some(t=>t.sessionId===e.sessionId)?null:e),a&&n.some(e=>e.sessionId===a)?(Me.current=null,O(a)):a&&(Me.current=null)}if(e.type===`agent-sessions-active`&&w(Array.isArray(e.active)?e.active:[]),e.type===`session-orphaned`&&!e.supersededBy){let t=qm.getState().sessions,n=t.filter(t=>t.agentSessionId?.trim()!==e.session.sessionId);n.length!==t.length&&S(n)}if(e.type===`session-activated`){let t=qm.getState().sessions.find(t=>t.tmuxWindow===e.window);t&&E({...t,agentSessionId:e.session.sessionId,agentSessionName:e.session.displayName,logFilePath:e.session.logFilePath,isHibernating:e.session.isHibernating,lastUserMessage:e.session.lastUserMessage??t.lastUserMessage})}if(e.type===`session-wake-result`)if(e.ok&&e.session){h(t=>t?.sessionId===e.sessionId?null:t);let t=qm.getState().sessions;t.some(t=>t.id===e.session.id)||S([e.session,...t]),D(e.session.id)}else e.ok||(d(`${e.error?.code}: ${e.error?.message}`),window.setTimeout(()=>d(null),6e3));if(e.type===`session-hibernate-result`&&(e.ok?(e.session&&h(e.session),O(e.sessionId)):(d(e.error??`Failed to hibernate session`),window.setTimeout(()=>d(null),6e3))),e.type===`terminal-error`&&(!e.sessionId||e.sessionId===y)&&(d(`${e.code}: ${e.message}`),window.setTimeout(()=>d(null),6e3)),e.type===`terminal-ready`&&e.sessionId===y&&d(null),e.type===`error`&&(d(e.message),window.setTimeout(()=>d(null),6e3)),e.type===`kill-failed`){let t=Ie.current.get(e.sessionId);if(t){let n=qm.getState().sessions;n.some(t=>t.id===e.sessionId)||S([t.session,...n]),t.wasSelected&&D(e.sessionId),Ie.current.delete(e.sessionId)}M(e.sessionId),d(e.message),window.setTimeout(()=>d(null),6e3)}e.type===`session-move-to-history-result`&&!e.ok&&e.error&&(d(e.error),window.setTimeout(()=>d(null),6e3))}});return()=>{e()}},[y,b,se,M,ge,D,O,h,S,C,w,T,P,F,I,L,_e,E]);let xe=(0,x.useMemo)(()=>g.find(e=>e.id===y)||null,[y,g]),Se=_.hibernating??[],Ce=_.history??[],we=(0,x.useMemo)(()=>OX(Se,de,fe),[Se,de,fe]),Te=(0,x.useMemo)(()=>we.find(e=>e.sessionId===b)||(m?.sessionId===b?m:null),[we,m,b]);(0,x.useEffect)(()=>{xe?.projectPath&&!xe.remote&&oe(xe.projectPath)},[xe?.projectPath,xe?.remote,oe]);let Ee=H(e=>e.sessionSortMode),De=H(e=>e.sessionSortDirection),Oe=H(e=>e.manualSessionOrder),ke=(0,x.useMemo)(()=>Mm(g,{mode:Ee,direction:De,manualOrder:Oe}),[g,Ee,De,Oe]),Ae=(0,x.useMemo)(()=>{let e=ke;return de.length>0&&(e=e.filter(e=>de.includes(e.projectPath))),fe.length>0&&(e=e.filter(e=>fe.includes(e.host??``))),e},[ke,de,fe]),je=(0,x.useRef)(b),Me=(0,x.useRef)(null),Ne=(0,x.useRef)(null),Pe=(0,x.useRef)(he),Fe=(0,x.useCallback)(()=>Ae.length>0?(D(Ae[0].id),!0):we.length>0?(O(we[0].sessionId),!0):!1,[Ae,we,D,O]);(0,x.useEffect)(()=>{let e=je.current;e&&b===null&&!Se.some(t=>t.sessionId===e)?Ne.current=e:b!==null&&(Ne.current=null),je.current=b},[Se,b]),(0,x.useEffect)(()=>{m&&b!==m.sessionId&&h(null)},[m,b]),(0,x.useEffect)(()=>{Pe.current!==he&&(Pe.current=he,Me.current=null,Ne.current=null,h(null))},[he]),(0,x.useEffect)(()=>{k&&(b||y&&(Ae.some(e=>e.id===y)||Fe()||D(null)))},[k,y,b,Fe,D]),(0,x.useEffect)(()=>{if(!b||m?.sessionId===b||v!==he||we.some(e=>e.sessionId===b))return;let e=Ae.find(e=>e.agentSessionId?.trim()===b);if(e){D(e.id);return}Fe()||O(null)},[we,Ae,v,m,b,Fe,D,O,he]),(0,x.useEffect)(()=>{let e=Ne.current;if(!e)return;if(b!==null){Ne.current=null;return}let t=Ae.find(t=>t.agentSessionId?.trim()===e);if(t){Ne.current=null,D(t.id);return}if(y!==null){Ne.current=null;return}Fe()&&(Ne.current=null)},[Ae,y,b,Fe,D]),(0,x.useEffect)(()=>{window.matchMedia(`(max-width: 767px)`).matches&&k&&y===null&&b===null&&(Ae.length>0||we.length>0)&&Fe()},[we.length,Ae.length,k,Fe,y,b]);let Ie=(0,x.useRef)(new Map),Le=(0,x.useCallback)((e,t=`unknown`)=>{FH(e);let{sessions:n,selectedSessionId:r}=qm.getState(),i=n.find(t=>t.id===e);i&&Ie.current.set(e,{session:i,wasSelected:r===e,epoch:ve()}),(0,U.flushSync)(()=>{N(e),S(n.filter(t=>t.id!==e))}),ge({type:`session-kill`,sessionId:e,source:t})},[N,S,ge]);(0,x.useEffect)(()=>{let n=qe(ce),r=r=>{if(r.defaultPrevented)return;let i=r.code,a=Xe(r,n);if(a&&(i===`BracketLeft`||i===`BracketRight`)){r.preventDefault();let e=i===`BracketLeft`?-1:1,t=Ae;if(t.length===0){let t=we;if(t.length===0)return;let n=t.findIndex(e=>e.sessionId===b);if(n===-1){O(t[0].sessionId);return}O(t[(n+e+t.length)%t.length].sessionId);return}let n=t.findIndex(e=>e.id===y);if(n===-1){D(t[0].id);return}D(t[(n+e+t.length)%t.length].id);return}if(a&&/^Digit[1-9]$/.test(i)){let e=Number(i.slice(5))-1;if(Ae.length>0){let t=Ae[e];if(!t)return;r.preventDefault(),D(t.id);return}let t=we[e];if(!t)return;r.preventDefault(),O(t.sessionId);return}if(a&&i===`KeyN`){r.preventDefault(),!e&&te&&t(!0);return}if(a&&i===`KeyX`){r.preventDefault(),y&&!e&&Le(y,`keyboard_shortcut`);return}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,y,b,D,O,Ae,we,Le,ce,te]);let Re=()=>te?(r(void 0),a(void 0),s(void 0),t(!0),!0):!1,ze=()=>l(!0),Be=(e,t,n,r)=>{ge({type:`session-create`,projectPath:e,name:t,command:n,host:r}),r||oe(e)},Ve=e=>{ge({type:`session-wake`,sessionId:e})},He=(0,x.useCallback)(e=>{ge({type:`session-hibernate`,sessionId:e})},[ge]),Ue=(e,t)=>{ge({type:`session-rename`,sessionId:e,newName:t})},We=(0,x.useCallback)(e=>{let t=g.find(t=>t.id===e);t&&ge({type:`session-create`,projectPath:t.projectPath,command:t.command||void 0,host:t.remote&&t.host?t.host:void 0})},[g,ge]),Ge=(0,x.useCallback)(e=>{ge({type:`session-move-to-history`,sessionId:e})},[ge]);(0,x.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,B)},[B]),(0,x.useEffect)(()=>{fetch(`/api/server-info`).then(e=>e.json()).then(e=>p(e)).catch(()=>{})},[]);let Ke=(0,x.useMemo)(()=>z?ee.filter(e=>e.host!==z):ee,[ee,z]);return(0,W.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[(0,W.jsxs)(`div`,{className:`hidden h-full flex-col md:flex md:shrink-0`,style:{width:le},children:[(0,W.jsx)($e,{connectionStatus:A,onNewSession:Re,onOpenSettings:ze,tailscaleIp:f?.tailscaleIp??null}),(0,W.jsx)(_E,{sessions:g,hibernatingSessions:Se,historySessions:Ce,selectedSessionId:y,selectedHibernatingSessionId:b,onSelect:D,onSelectHibernating:O,onRename:Ue,onResume:Ve,onHibernate:He,onKill:Le,onDuplicate:We,onMoveToHistory:Ge,onNewSession:Re,loading:!k,error:j||u})]}),(0,W.jsx)(`div`,{className:`hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20`,onMouseDown:be}),(0,W.jsx)(hW,{session:xe,sessions:Ae,hibernatingSession:Te,hibernatingSessions:Se,connectionStatus:A,connectionEpoch:he,sendMessage:ge,subscribe:_e,onClose:()=>D(null),onSelectSession:D,onSelectHibernatingSession:O,onNewSession:Re,onKillSession:Le,onRenameSession:Ue,onOpenSettings:ze,onResumeSession:Ve,onHibernateSession:He,onMoveToHistory:Ge,historySessions:Ce,loading:!k,error:j||u}),(0,W.jsx)(PW,{isOpen:e,onClose:()=>t(!1),onCreate:Be,defaultProjectDir:V,commandPresets:ne,defaultPresetId:ie,lastProjectPath:ae,activeProjectPath:xe&&!xe.remote?xe.projectPath:void 0,remoteHosts:Ke,remoteAllowControl:R,initialHost:n,initialPath:i,initialCommand:o}),(0,W.jsx)(Kq,{isOpen:c,onClose:()=>l(!1)}),(0,W.jsx)(UY,{})]})}var AX=`modulepreload`,jX=function(e){return`/`+e},MX={},NX=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=jX(t,n),t in MX)return;MX[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`:AX,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)})},PX=`true`,FX=`false`,IX=PX===`true`,LX=FX===`true`;function RX(e={}){let{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:o}=e,s,c,l,u=async(e=!0)=>{await c,IX||l?.()};async function d(){if(`serviceWorker`in navigator){if(s=await NX(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bq4GJJid.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{o?.(e)}),!s)return;if(l=()=>{s?.messageSkipWaiting()},!LX)if(IX)s.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&window.location.reload()}),s.addEventListener(`installed`,e=>{e.isUpdate||r?.()});else{let e=!1,t=()=>{e=!0,s?.addEventListener(`controlling`,e=>{e.isUpdate&&window.location.reload()}),n?.()};s.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&r?.():n.isExternal?t():!e&&r?.():n.isUpdate||r?.()}),s.addEventListener(`waiting`,t)}s.register({immediate:t}).then(e=>{a?a(`/sw.js`,e):i?.(e)}).catch(e=>{o?.(e)})}}return c=d(),u}We()&&document.documentElement.classList.add(`ios`),Ge()&&document.documentElement.classList.add(`ios-pwa`),RX({immediate:!0,onRegisteredSW(e,t){t&&(setInterval(()=>{t.update()},300*1e3),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&t.update()}))}});var zX=document.getElementById(`root`);if(!zX)throw Error(`Root element not found`);(0,E.createRoot)(zX).render((0,W.jsx)(x.StrictMode,{children:(0,W.jsx)(kX,{})}));
@@ -8,7 +8,7 @@
8
8
  <title>Agentboard</title>
9
9
  <link rel="apple-touch-icon" href="/icons/pwa-192x192.png" />
10
10
  <meta name="theme-color" content="#0f172a" />
11
- <script type="module" crossorigin src="/assets/index-DxmnQErq.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-05hHPgj6.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-DEtsr6VP.css">
13
13
  <link rel="manifest" href="/manifest.webmanifest"></head>
14
14
  <body>
package/dist/client/sw.js CHANGED
@@ -1 +1 @@
1
- if(!self.define){let e,n={};const i=(i,o)=>(i=new URL(i+".js",o).href,n[i]||new Promise(n=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=n,document.head.appendChild(e)}else e=i,importScripts(i),n()}).then(()=>{let e=n[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(o,s)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(n[r])return;let f={};const t=e=>i(e,r),d={module:{uri:r},exports:f,require:t};n[r]=Promise.all(o.map(e=>d[e]||t(e))).then(e=>(s(...e),f))}}define(["./workbox-8c29f6e4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"0ea8f2254b8fec0cd7baccab639b985f"},{url:"favicon.svg",revision:"12048a608dedfc53518ddc59c07e41b6"},{url:"icons/pwa-512x512.png",revision:"eb82042b3e4ed505f3efe1b79622d998"},{url:"icons/pwa-192x192.png",revision:"affb57c15619ee7223d1adea372ad514"},{url:"fonts/jetbrains-mono-vietnamese-wght-normal.woff2",revision:"ddf99e6e35c6ee9f00a41d2567b0e77f"},{url:"fonts/jetbrains-mono-latin-wght-normal.woff2",revision:"b058178d7f309414f8f856b99fd80d9b"},{url:"fonts/jetbrains-mono-latin-ext-wght-normal.woff2",revision:"e36841ed93d5bfe6b1d487d18ad7e90b"},{url:"fonts/jetbrains-mono-greek-wght-normal.woff2",revision:"51671ed9eb64e29390d4791ab0023c8e"},{url:"fonts/jetbrains-mono-cyrillic-wght-normal.woff2",revision:"615bf869ebeb5998734d81fc8958116c"},{url:"fonts/jetbrains-mono-cyrillic-ext-wght-normal.woff2",revision:"742dd0628e0118d32dccf0437900670b"},{url:"assets/workbox-window.prod.es5-Bq4GJJid.js",revision:null},{url:"assets/index-DxmnQErq.js",revision:null},{url:"assets/index-DEtsr6VP.css",revision:null},{url:"icons/pwa-192x192.png",revision:"affb57c15619ee7223d1adea372ad514"},{url:"icons/pwa-512x512.png",revision:"eb82042b3e4ed505f3efe1b79622d998"},{url:"manifest.webmanifest",revision:"b6d4b3666a548fa0f0c6919d31ec2eee"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"),{denylist:[/^\/api(?:\/|$)/,/^\/ws(?:\/|$)/]}))});
1
+ if(!self.define){let e,n={};const i=(i,o)=>(i=new URL(i+".js",o).href,n[i]||new Promise(n=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=n,document.head.appendChild(e)}else e=i,importScripts(i),n()}).then(()=>{let e=n[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(o,s)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(n[r])return;let t={};const f=e=>i(e,r),d={module:{uri:r},exports:t,require:f};n[r]=Promise.all(o.map(e=>d[e]||f(e))).then(e=>(s(...e),t))}}define(["./workbox-8c29f6e4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"afc718e3fa74ec80a0a218d4aad14315"},{url:"favicon.svg",revision:"12048a608dedfc53518ddc59c07e41b6"},{url:"icons/pwa-512x512.png",revision:"eb82042b3e4ed505f3efe1b79622d998"},{url:"icons/pwa-192x192.png",revision:"affb57c15619ee7223d1adea372ad514"},{url:"fonts/jetbrains-mono-vietnamese-wght-normal.woff2",revision:"ddf99e6e35c6ee9f00a41d2567b0e77f"},{url:"fonts/jetbrains-mono-latin-wght-normal.woff2",revision:"b058178d7f309414f8f856b99fd80d9b"},{url:"fonts/jetbrains-mono-latin-ext-wght-normal.woff2",revision:"e36841ed93d5bfe6b1d487d18ad7e90b"},{url:"fonts/jetbrains-mono-greek-wght-normal.woff2",revision:"51671ed9eb64e29390d4791ab0023c8e"},{url:"fonts/jetbrains-mono-cyrillic-wght-normal.woff2",revision:"615bf869ebeb5998734d81fc8958116c"},{url:"fonts/jetbrains-mono-cyrillic-ext-wght-normal.woff2",revision:"742dd0628e0118d32dccf0437900670b"},{url:"assets/workbox-window.prod.es5-Bq4GJJid.js",revision:null},{url:"assets/index-DEtsr6VP.css",revision:null},{url:"assets/index-05hHPgj6.js",revision:null},{url:"icons/pwa-192x192.png",revision:"affb57c15619ee7223d1adea372ad514"},{url:"icons/pwa-512x512.png",revision:"eb82042b3e4ed505f3efe1b79622d998"},{url:"manifest.webmanifest",revision:"b6d4b3666a548fa0f0c6919d31ec2eee"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"),{denylist:[/^\/api(?:\/|$)/,/^\/ws(?:\/|$)/]}))});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gbasin/agentboard-darwin-x64",
3
- "version": "0.13.0",
3
+ "version": "0.14.1",
4
4
  "description": "agentboard binary for darwin-x64",
5
5
  "repository": {
6
6
  "type": "git",