@monotykamary/localterm 1.11.1 → 1.11.3
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/README.md +4 -4
- package/dist/commands/restart.d.ts.map +1 -1
- package/dist/commands/restart.js +2 -1
- package/dist/commands/restart.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +54 -13
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +19 -6
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/stop.d.ts.map +1 -1
- package/dist/commands/stop.js +21 -5
- package/dist/commands/stop.js.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +1 -0
- package/dist/paths.js.map +1 -1
- package/dist/state.d.ts +2 -1
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +27 -7
- package/dist/state.js.map +1 -1
- package/dist/utils/poll-for-daemon-ready.d.ts +2 -1
- package/dist/utils/poll-for-daemon-ready.d.ts.map +1 -1
- package/dist/utils/poll-for-daemon-ready.js +4 -3
- package/dist/utils/poll-for-daemon-ready.js.map +1 -1
- package/dist/utils/run-start-preflight.d.ts +1 -1
- package/dist/utils/run-start-preflight.d.ts.map +1 -1
- package/dist/utils/run-start-preflight.js +7 -1
- package/dist/utils/run-start-preflight.js.map +1 -1
- package/dist/utils/verify-pid-is-localterm.d.ts +2 -1
- package/dist/utils/verify-pid-is-localterm.d.ts.map +1 -1
- package/dist/utils/verify-pid-is-localterm.js +3 -3
- package/dist/utils/verify-pid-is-localterm.js.map +1 -1
- package/package.json +15 -14
- package/terminal/assets/{index-DsfFB-Jd.js → index-TQyjKb-9.js} +6 -6
- package/terminal/assets/index-TQyjKb-9.js.map +1 -0
- package/terminal/index.html +1 -1
- package/terminal/assets/index-DsfFB-Jd.js.map +0 -1
|
@@ -72,9 +72,9 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
|
|
|
72
72
|
`,()=>this.lineFeed()),this._parser.setExecuteHandler(`\v`,()=>this.lineFeed()),this._parser.setExecuteHandler(`\f`,()=>this.lineFeed()),this._parser.setExecuteHandler(`\r`,()=>this.carriageReturn()),this._parser.setExecuteHandler(`\b`,()=>this.backspace()),this._parser.setExecuteHandler(` `,()=>this.tab()),this._parser.setExecuteHandler(``,()=>this.shiftOut()),this._parser.setExecuteHandler(``,()=>this.shiftIn()),this._parser.setExecuteHandler(``,()=>this.index()),this._parser.setExecuteHandler(`
`,()=>this.nextLine()),this._parser.setExecuteHandler(``,()=>this.tabSet()),this._parser.registerOscHandler(0,new eu(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new eu(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new eu(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new eu(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new eu(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new eu(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new eu(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new eu(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new eu(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new eu(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new eu(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new eu(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in Cl)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new au((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){if(this._logService.logLevel<=3){let t,n=new Promise((e,n)=>{t=setTimeout(()=>n(`#SLOW_TIMEOUT`),5e3)});Promise.race([e,n]).then(()=>{t!==void 0&&clearTimeout(t)},e=>{if(t!==void 0&&clearTimeout(t),e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than 5000 ms`)})}}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>131072&&(a=this._parseStack.position+131072)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(e.length,131072))),o||this._dirtyRowTracker.clearRange(),e.length>131072)for(let t=a;t<e.length;t+=131072){let a=t+131072<e.length?t+131072:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);if(!d)return;this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r===173)continue;if(r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=Hl.extractWidth(t);let n=Hl.extractShouldJoin(t),m=n?Hl.extractWidth(f):0;f=t,o&&this._onA11yChar.fire(ba(r));let h=this._getCurrentLinkId();if(h&&this._oscLinkService.addLineToLink(h,this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;if(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),!d)return;for(m>0&&d instanceof ml&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>xu(e.params[0],this._optionsService.rawOptions.windowOptions)?t(e):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new au(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new eu(t))}registerApcHandler(e,t){return this._parser.registerApcHandler(e,new lu(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a&&(a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1))}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:if(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols){let e=this._activeBuffer.lines.get(n+1);e&&(e.isWrapped=!1)}for(;n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(ul));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=Hl.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(`\x1B[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(`\x1B[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(`\x1B[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(`\x1B[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(`\x1B[>83;40003;0c`)),!0}sendXtVersion(e){return e.params[0]>0||this._coreService.triggerDataEvent(`\x1BP>|xterm.js(${yu})\x1B\\`),!0}_is(e){return(this._optionsService.rawOptions.termName+``).startsWith(e)}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,wl),this._charsetService.setgCharset(1,wl),this._charsetService.setgCharset(2,wl),this._charsetService.setgCharset(3,wl);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.rawOptions.quirks?.allowSetCursorBlink&&(this._optionsService.options.cursorBlink=!0);break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._mouseStateService.activeProtocol=`X10`;break;case 1e3:this._mouseStateService.activeProtocol=`VT200`;break;case 1002:this._mouseStateService.activeProtocol=`DRAG`;break;case 1003:this._mouseStateService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._mouseStateService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._mouseStateService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:if(this._optionsService.rawOptions.vtExtensions?.kittyKeyboard){let e=this._coreService.kittyKeyboard;e.mainFlags=e.flags,e.flags=e.altFlags}this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break;case 2031:(this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery??!0)&&(this._coreService.decPrivateModes.colorSchemeUpdates=!0);break;case 9001:this._optionsService.rawOptions.vtExtensions?.win32InputMode&&(this._coreService.decPrivateModes.win32InputMode=!0);break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.rawOptions.quirks?.allowSetCursorBlink&&(this._optionsService.options.cursorBlink=!1);break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._mouseStateService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._mouseStateService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._mouseStateService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:if(this._optionsService.rawOptions.vtExtensions?.kittyKeyboard){let e=this._coreService.kittyKeyboard;e.altFlags=e.flags,e.flags=e.mainFlags}this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break;case 2031:(this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery??!0)&&(this._coreService.decPrivateModes.colorSchemeUpdates=!1);break;case 9001:this._optionsService.rawOptions.vtExtensions?.win32InputMode&&(this._coreService.decPrivateModes.win32InputMode=!1);break}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._mouseStateService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`\x1B[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):m===9001&&this._optionsService.rawOptions.vtExtensions?.win32InputMode?f(m,p(r.win32InputMode)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=wa.fromColorRGB([n,r,i])):t===5&&(e&=-67108864,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=ul.fg,e.bg=ul.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-67108864,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-67108864,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-67108864,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-67108864,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=ul.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=ul.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===221&&(this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl??!0)?r.fg&=-134217729:n===222&&(this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl??!0)?r.bg&=-134217729:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`\x1B[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`\x1B[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`\x1B[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53:break;case 996:(this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery??!0)&&this._onRequestColorSchemeQuery.fire();break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ul.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`;break}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!xu(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`\x1B[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._activeBuffer.savedCharsets=this._charsetService.charsets.slice(),this._activeBuffer.savedGlevel=this._charsetService.glevel,this._activeBuffer.savedOriginMode=this._coreService.decPrivateModes.origin,this._activeBuffer.savedWraparoundMode=this._coreService.decPrivateModes.wraparound,!0}restoreCursor(e){this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg;for(let e=0;e<this._activeBuffer.savedCharsets.length;e++)this._charsetService.setgCharset(e,this._activeBuffer.savedCharsets[e]);return this._charsetService.setgLevel(this._activeBuffer.savedGlevel),this._coreService.decPrivateModes.origin=this._activeBuffer.savedOriginMode,this._coreService.decPrivateModes.wraparound=this._activeBuffer.savedWraparoundMode,this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e,10);if(Tu(n))if(r===`?`)t.push({type:0,index:n});else{let e=gu(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=gu(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e],10);Tu(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,wl),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(bu[e[0]],Cl[e[1]]??wl),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=ul.clone(),this._eraseAttrDataInternal=ul.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Ea;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`\x1B${e}\x1B\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}kittyKeyboardSet(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;let t=e.params[0]||0,n=e.length>1&&e.params[1]||1,r=this._coreService.kittyKeyboard;switch(n){case 1:r.flags=t;break;case 2:r.flags|=t;break;case 3:r.flags&=~t;break}return!0}kittyKeyboardQuery(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;let t=this._coreService.kittyKeyboard.flags;return this._coreService.triggerDataEvent(`\x1B[?${t}u`),!0}kittyKeyboardPush(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;let t=e.params[0]||0,n=this._coreService.kittyKeyboard,r=this._bufferService.buffer===this._bufferService.buffers.alt?n.altStack:n.mainStack;return r.length>=16&&r.shift(),r.push(n.flags),n.flags=t,!0}kittyKeyboardPop(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;let t=Math.max(1,e.params[0]||1),n=this._coreService.kittyKeyboard,r=this._bufferService.buffer===this._bufferService.buffers.alt?n.altStack:n.mainStack;for(let e=0;e<t&&r.length>0;e++)n.flags=r.pop();return r.length===0&&t>0&&(n.flags=0),!0}},wu=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Su=e,e=t,t=Su),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};wu=ca([K(0,ja)],wu);function Tu(e){return 0<=e&&e<256}var Eu=class extends no{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._innerWriteTimer=this._register(new ao),this._onWriteParsed=this._register(new q),this.onWriteParsed=this._onWriteParsed.event,this._register($a(()=>{this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0}))}handleUserInput(){this._didUserInput=!0}flushSync(){if(this._store.isDisposed||this._isSyncWriting)return;this._isSyncWriting=!0;let e,t=!1;for(;e=this._writeBuffer.shift();){t=!0,this._action(e);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._writeBuffer.length=0,this._callbacks.length=0,this._isSyncWriting=!1,t&&this._onWriteParsed.fire()}writeSync(e,t){if(this._store.isDisposed)return;if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(!this._store.isDisposed){if(this._pendingData>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}this._scheduleInnerWrite()}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}}_scheduleInnerWrite(e=0,t=!0){this._store.isDisposed||this._innerWriteTimer.cancelAndSet(()=>this._innerWrite(e,t),0)}_innerWrite(e=0,t=!0){if(this._store.isDisposed)return;let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>{this._store.isDisposed||(performance.now()-n>=12?this._scheduleInnerWrite(0,e):this._innerWrite(n,e))});return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),this._scheduleInnerWrite()):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},Du=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Du=ca([K(0,ja)],Du);var Ou=!1,ku=class extends no{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ro),this._onBinary=this._register(new q),this.onBinary=this._onBinary.event,this._onData=this._register(new q),this.onData=this._onData.event,this._onLineFeed=this._register(new q),this.onLineFeed=this._onLineFeed.event,this._onRender=this._register(new q),this.onRender=this._onRender.event,this._onResize=this._register(new q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new q),this._instantiationService=new rl,this.optionsService=this._register(new jl(e)),this._instantiationService.setService(La,this.optionsService),this._logService=this._register(this._instantiationService.createInstance(ol)),this._instantiationService.setService(Ia,this._logService),this._bufferService=this._register(this._instantiationService.createInstance(Ol)),this._instantiationService.setService(ja,this._bufferService),this.coreService=this._register(this._instantiationService.createInstance(Il)),this._instantiationService.setService(Na,this.coreService),this.mouseStateService=this._register(this._instantiationService.createInstance(Vl)),this._instantiationService.setService(Ma,this.mouseStateService),this.unicodeService=this._register(this._instantiationService.createInstance(Hl)),this.unicodeService.register(new ql),this._instantiationService.setService(za,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Jl),this._instantiationService.setService(Pa,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Du),this._instantiationService.setService(Ra,this._oscLinkService),this._inputHandler=this._register(new Cu(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.mouseStateService,this.unicodeService)),this._register(Go.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(Go.forward(this._bufferService.onResize,this._onResize)),this._register(Go.forward(this.coreService.onData,this._onData)),this._register(Go.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new Eu((e,t)=>this._inputHandler.parse(e,t))),this._register(Go.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new q),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Ou&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),Ou=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,2),t=Math.max(t,1),this._writeBuffer.flushSync(),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}registerApcHandler(e,t){return this._inputHandler.registerApcHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.mouseStateService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.backend!==void 0&&t.buildNumber!==void 0&&(e=t.backend===`conpty`&&t.buildNumber<21376),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Yl.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(Yl(this._bufferService),!1))),this._windowsWrappingHeuristics.value=$a(()=>{for(let t of e)t.dispose()})}}},Au=0,ju=class{constructor(e,t){this._getKey=e,this._array=[],this._insertedValues=[],this._isFlushingInserted=!1,this._deletedIndices=[],this._isFlushingDeleted=!1,this._flushInsertedTask=new yc(t),this._flushDeletedTask=new yc(t)}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Au=this._search(t),Au===-1)||this._getKey(this._array[Au])!==t)return!1;do if(this._array[Au]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Au),!0;while(++Au<this._array.length&&this._getKey(this._array[Au])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Au=this._search(e),!(Au<0||Au>=this._array.length)&&this._getKey(this._array[Au])===e))do yield this._array[Au];while(++Au<this._array.length&&this._getKey(this._array[Au])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Au=this._search(e),!(Au<0||Au>=this._array.length)&&this._getKey(this._array[Au])===e))do t(this._array[Au]);while(++Au<this._array.length&&this._getKey(this._array[Au])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Mu=0,Nu=0,Pu=class extends no{constructor(e,t){super(),this._logService=e,this._bufferService=t,this._lineCache=this._register(new Fu),this._onDecorationRegistered=this._register(new q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._decorations=new ju(e=>e?.marker.line,this._logService),this._register($a(()=>this.reset())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._lineCache.attachToBufferLines(this._bufferService.buffer.lines)})),this._lineCache.attachToBufferLines(this._bufferService.buffer.lines)}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Iu(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&(this._lineCache.remove(t),this._onDecorationRemoved.fire(t)),e.dispose())});this._decorations.insert(t),this._lineCache.add(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear(),this._lineCache.clear()}*getDecorationsAtCell(e,t,n){let r=this._lineCache.getDecorationsOnLine(t);if(r)for(let t of r)Mu=t.options.x??0,Nu=Mu+(t.options.width??1),e>=Mu&&e<Nu&&(!n||(t.options.layer??`bottom`)===n)&&(yield t)}forEachDecorationAtCell(e,t,n,r){let i=this._lineCache.getDecorationsOnLine(t);if(i)for(let t of i)Mu=t.options.x??0,Nu=Mu+(t.options.width??1),e>=Mu&&e<Nu&&(!n||(t.options.layer??`bottom`)===n)&&r(t)}};Pu=ca([K(0,Ia),K(1,ja)],Pu);var Fu=class extends no{constructor(){super(...arguments),this._decorationsByLine=new Map,this._decorations=new Set,this._bufferLineListeners=this._register(new ro),this._lineIndexSyncTimer=this._register(new oo),this._lineIndexSyncCallbacks=[]}clear(){this._lineIndexSyncCallbacks.length=0,this._lineIndexSyncTimer.cancel(),this._decorationsByLine.clear(),this._decorations.clear()}add(e){this._decorations.add(e),this._addToLineBuckets(e)}remove(e){this._decorations.delete(e),this._removeFromLineBuckets(e)}getDecorationsOnLine(e){return this._decorationsByLine.get(e)}attachToBufferLines(e){let t=new to;this._bufferLineListeners.value=t,t.add(e.onTrim(e=>this._handleBufferLinesTrim(e))),t.add(e.onInsert(e=>this._handleBufferLinesInsert(e))),t.add(e.onDelete(e=>this._handleBufferLinesDelete(e)))}_getDecorationHeight(e){return e.options.height??1}_addToLineBuckets(e){let t=e.marker.line;if(t<0)return;e._indexedStartLine=t;let n=this._getDecorationHeight(e);for(let r=t;r<t+n;r++){let t=this._decorationsByLine.get(r);t||(t=[],this._decorationsByLine.set(r,t)),t.push(e)}}_removeFromLineBuckets(e){let t=e._indexedStartLine,n=this._getDecorationHeight(e);for(let r=t;r<t+n;r++){let t=this._decorationsByLine.get(r);if(!t)continue;let n=t.indexOf(e);n!==-1&&t.splice(n,1),t.length===0&&this._decorationsByLine.delete(r)}}_reindexDecoration(e){this._removeFromLineBuckets(e),!e.marker.isDisposed&&e.marker.line>=0&&this._addToLineBuckets(e)}_scheduleLineIndexSync(e){this._lineIndexSyncCallbacks.push(e),this._lineIndexSyncTimer.set(()=>{let e=this._lineIndexSyncCallbacks;this._lineIndexSyncCallbacks=[];for(let t of e)t()})}_handleBufferLinesTrim(e){if(e<=0)return;let t=new Map;for(let[n,r]of this._decorationsByLine){let i=n-e;i<0||this._mergeLineBucket(t,i,r)}this._decorationsByLine.clear();for(let[e,n]of t)this._decorationsByLine.set(e,n);for(let t of this._decorations)t.marker.isDisposed||(t._indexedStartLine-=e)}_handleBufferLinesInsert(e){this._scheduleLineIndexSync(()=>this._applyBufferLinesInsert(e))}_handleBufferLinesDelete(e){this._scheduleLineIndexSync(()=>this._applyBufferLinesDelete(e))}_mergeLineBucket(e,t,n){let r=e.get(t);if(r)for(let e=0,t=n.length;e<t;e++)r.push(n[e]);else e.set(t,n.slice())}_applyBufferLinesInsert(e){let{index:t,amount:n}=e,r=[];for(let e of this._decorations){if(e.marker.isDisposed)continue;let n=e._indexedStartLine;n<t&&n+this._getDecorationHeight(e)>t&&(r.push(e),this._removeFromLineBuckets(e))}let i=new Map;for(let[e,r]of this._decorationsByLine){let a=e>=t?e+n:e;this._mergeLineBucket(i,a,r)}this._decorationsByLine.clear();for(let[e,t]of i)this._decorationsByLine.set(e,t);for(let e of this._decorations)e.marker.isDisposed||e._indexedStartLine>=t&&(e._indexedStartLine=e.marker.line);for(let e of r)this._addToLineBuckets(e)}_applyBufferLinesDelete(e){let t=e.index+e.amount,n=new Map;for(let[r,i]of this._decorationsByLine){if(r>=e.index&&r<t)continue;let a=r>=t?r-e.amount:r;this._mergeLineBucket(n,a,i)}this._decorationsByLine.clear();for(let[e,t]of n)this._decorationsByLine.set(e,t);let r=[];for(let n of this._decorations){if(n.marker.isDisposed)continue;let i=n._indexedStartLine,a=this._getDecorationHeight(n);i>=t?n._indexedStartLine=n.marker.line:i<e.index&&i+a>t&&r.push(n)}for(let e of r)this._reindexDecoration(e)}},Iu=class extends to{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new q),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this._indexedStartLine=e.marker.line,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Es.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Es.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Lu=1e3,Ru=class{constructor(e,t=Lu){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&=(clearTimeout(this._refreshTimeoutID),void 0),this._additionalRefreshRequested=!1}refresh(e,t,n){this._rowCount=n,e??=0,t??=this._rowCount-1,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._refreshTimeoutID!==void 0&&(clearTimeout(this._refreshTimeoutID),this._refreshTimeoutID=void 0,this._additionalRefreshRequested=!1),this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},zu=!1,Bu=class extends no{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Ru(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);zu?(this._accessibilityContainer.classList.add(`debug`),this._rowContainer.classList.add(`debug`),this._debugRootContainer=i.createElement(`div`),this._debugRootContainer.classList.add(`xterm`),this._debugRootContainer.appendChild(i.createTextNode(`------start a11y------`)),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(i.createTextNode(`------end a11y------`)),this._terminal.element.insertAdjacentElement(`afterend`,this._debugRootContainer)):this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
73
73
|
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(uo(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register($a(()=>{zu?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
74
74
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent=fa.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent===fa.get()&&this._clearLiveRegion(),this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Bu=ca([K(1,Fa),K(2,Wa),K(3,qa)],Bu);var Vu=class extends no{constructor(e,t,n,r,i){super(),this._element=e,this._mouseCoordsService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new q),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new q),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register($a(()=>{eo(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(uo(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(uo(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(uo(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(uo(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element);t&&this._mouseDownLink&&Hu(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,eo(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t){let n=this._mouseCoordsService.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};Vu=ca([K(1,Ga),K(2,qa),K(3,ja),K(4,Za)],Vu);function Hu(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Uu=class extends ku{constructor(e={}){super(e),this._linkifier=this._register(new ro),this.browser=Co,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ro),this._onCursorMove=this._register(new q),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new q),this.onKey=this._onKey.event,this._onSelectionChange=this._register(new q),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new q),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new q),this.onBell=this._onBell.event,this._onFocus=this._register(new q),this._onBlur=this._register(new q),this._onA11yCharEmitter=this._register(new q),this._onA11yTabEmitter=this._register(new q),this._onWillOpen=this._register(new q),this._onDimensionsChange=this._register(new q),this.onDimensionsChange=this._onDimensionsChange.event,this._setup(),this._decorationService=this._instantiationService.createInstance(Pu),this._instantiationService.setService(Ba,this._decorationService),this._keyboardService=this._instantiationService.createInstance(tl),this._instantiationService.setService(Qa,this._keyboardService),this._linkProviderService=this._instantiationService.createInstance(ec),this._instantiationService.setService(Za,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Va)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(Go.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Go.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Go.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Go.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register($a(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}get dimensions(){if(!this._renderService)return;let e=this._renderService.dimensions;return{css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=Ts.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`\x1B]${n};${vu(r)}\x1B\\`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=ws.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=ws.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_reportColorScheme(){if(!this._themeService)return;let e=Ds.relativeLuminance(this._themeService.colors.background.rgba>>8)<Ds.relativeLuminance(this._themeService.colors.foreground.rgba>>8)?1:2;this.coreService.triggerDataEvent(`\x1B[?997;${e}n`)}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Bu,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(`\x1B[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(`\x1B[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(uo(this.element,`copy`,e=>{this.hasSelection()&&ha(e,this._selectionService)}));let e=e=>ga(e,this.textarea,this.coreService,this.optionsService);this._register(uo(this.textarea,`paste`,e)),this._register(uo(this.element,`paste`,e)),Do?this._register(uo(this.element,`mousedown`,e=>{e.button===2&&ya(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(uo(this.element,`contextmenu`,e=>{ya(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Fo&&this._register(uo(this.element,`auxclick`,e=>{e.button===1&&va(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(uo(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(uo(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(uo(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(uo(this.textarea,`compositionstart`,()=>{this._syncTextArea(),this._compositionHelper.compositionstart(),this._compositionHelper.updateCompositionElements()})),this._register(uo(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(uo(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(uo(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),this.element.classList.toggle(`allow-transparency`,this.options.allowTransparency),this._register(this.optionsService.onSpecificOptionChange(`allowTransparency`,e=>this.element.classList.toggle(`allow-transparency`,e))),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(uo(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,ua.get()),Io||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Qs,this.textarea,e.ownerDocument.defaultView??window,this._document??(typeof window<`u`?window.document:null))),this._instantiationService.setService(Wa,this._coreBrowserService),this._register(uo(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(uo(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Js,this._document,this._helperContainer),this._instantiationService.setService(Ua,this._charSizeService),this._themeService=this._instantiationService.createInstance(Yc),this._instantiationService.setService(Xa,this._themeService),this._register(this._inputHandler.onRequestColorSchemeQuery(()=>this._reportColorScheme())),this._register(this._themeService.onChangeColors(()=>{this.coreService.decPrivateModes.colorSchemeUpdates&&this._reportColorScheme()})),this._characterJoinerService=this._instantiationService.createInstance(Ms),this._instantiationService.setService(Ya,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(xc,this.rows,this.screenElement)),this._instantiationService.setService(qa,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this._register(this._renderService.onDimensionsChange(e=>this._onDimensionsChange.fire({css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(vs,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseCoordsService=this._instantiationService.createInstance(rc),this._instantiationService.setService(Ga,this._mouseCoordsService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Vu,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch(e){this._logService.error(`onWillOpen handler threw an exception`,e)}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>{this._renderService.handleResize(this.cols,this.rows),this._syncTextArea()})),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(ds,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(zc,this.element,this.screenElement,r)),this._instantiationService.setService(Ja,this._selectionService),this._mouseService=this._instantiationService.createInstance(pc),this._instantiationService.setService(Ka,this._mouseService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(Go.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(fs,this.screenElement)),this._register(uo(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.mouseStateService.areMouseEventsActive&&!this.options.mouseEventsRequireAlt?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):(this._selectionService.enable(),this.element.classList.remove(`enable-mouse-events`)),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Bu,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e)));let i=this.options.scrollbar?.showScrollbar??!0,a=this.options.scrollbar?.width;i&&a&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(_s,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`scrollbar`,e=>{let t=(e?.showScrollbar??!0)&&!!e?.width;!this._overviewRulerRenderer&&t&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(_s,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this._mouseService.bindMouse({element:this.element,screenElement:this.screenElement,document:this._document,handleTouchScroll:e=>this._viewport?.handleTouchScroll(e)},e=>this._register(e),()=>this.focus())}_createRenderer(){return this._instantiationService.createInstance(Ks,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}refresh(e,t,n=!1){this._renderService?.refreshRows(e,t,n)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){_a(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this.mouseStateService.setCustomWheelEventHandler(e)}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=this._keyboardService.evaluateKeyDown(e);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),e.preventDefault(),e.stopPropagation(),!1}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&(e.preventDefault(),e.stopPropagation()),!n.key)||!this._keyboardService.useKitty&&!this._keyboardService.useWin32InputMode&&e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;(n.key===``||n.key===`\r`)&&(this.textarea.value=``);let r=this._keyboardService.useWin32InputMode&&Wu(e);if(this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!r),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return e.preventDefault(),e.stopPropagation(),!1;this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){if(this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return;Wu(e)||this.focus();let t=this._keyboardService.evaluateKeyUp(e);if(t?.key){let n=this._keyboardService.useWin32InputMode&&Wu(e);this.coreService.triggerDataEvent(t.key,!n)}this.updateCursorStyle(e),this._keyPressHandled=!1}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(ul));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._mouseService?.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1,!0)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(`\x1B[I`):this.coreService.triggerDataEvent(`\x1B[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`\x1B[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`\x1B[6;${r};${n}t`);break}}};function Wu(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18||e.keyCode===91||e.keyCode===92||e.keyCode===93||e.keyCode===224||e.key===`Meta`}var Gu=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Ku=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Ea)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},qu=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new Ku(t)}getNullCell(){return new Ea}},Ju=class extends no{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new q),this.onBufferChange=this._onBufferChange.event,this._normal=new qu(this._core.buffers.normal,`normal`),this._alternate=new qu(this._core.buffers.alt,`alternate`),this._register(this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},Yu=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}registerApcHandler(e,t){return this._core.registerApcHandler(e,t)}},Xu=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Zu=[`cols`,`rows`],Qu=0,$u=class extends no{constructor(e){super(),this._core=this._register(new Uu(e)),this._addonManager=this._register(new Gu),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(Zu.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get onDimensionsChange(){return this._core.onDimensionsChange}get element(){return this._core.element}get screenElement(){return this._core.screenElement}get parser(){return this._parser??=new Yu(this._core)}get unicode(){return this._checkProposedApi(),new Xu(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer??=this._register(new Ju(this._core))}get markers(){return this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.mouseStateService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`;break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,showCursor:!this._core.coreService.isCursorHidden,synchronizedOutputMode:e.synchronizedOutput,win32InputMode:e.win32InputMode,wraparoundMode:e.wraparound}}get dimensions(){return this._core.dimensions}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
75
|
-
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return ua.get()},set promptLabel(e){ua.set(e)},get tooMuchOutput(){return fa.get()},set tooMuchOutput(e){fa.set(e)}}}_verifyIntegers(...e){for(Qu of e)if(Qu===1/0||isNaN(Qu)||Qu%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Qu of e)if(Qu&&(Qu===1/0||isNaN(Qu)||Qu%1!=0||Qu<0))throw Error(`This API only accepts positive integers`)}},ed=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),td=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),nd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),rd=e=>{let t=nd(e);return t.charAt(0).toUpperCase()+t.slice(1)},id={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ad=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},od=(0,b.createContext)({}),sd=()=>(0,b.useContext)(od),cd=(0,b.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=sd()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,b.createElement)(`svg`,{ref:c,...id,width:t??l??id.width,height:t??l??id.height,stroke:e??f,strokeWidth:m,className:ed(`lucide`,p,i),...!a&&!ad(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,b.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),ld=(e,t)=>{let n=(0,b.forwardRef)(({className:n,...r},i)=>(0,b.createElement)(cd,{ref:i,iconNode:t,className:ed(`lucide-${td(rd(e))}`,`lucide-${e}`,n),...r}));return n.displayName=rd(e),n},ud=ld(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),dd=ld(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),fd=ld(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),pd=ld(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),md=ld(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),hd=ld(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),gd=ld(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),_d=ld(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),vd=ld(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),yd=ld(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);function bd(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=bd(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function xd(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=bd(e))&&(r&&(r+=` `),r+=t);return r}var Sd=(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},Cd=(e,t)=>({classGroupId:e,validator:t}),wd=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Td=`-`,Ed=[],Dd=`arbitrary..`,Od=e=>{let t=jd(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Ad(e);let n=e.split(Td);return kd(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Sd(i,t):t:i||Ed}return n[e]||Ed}}},kd=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=kd(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Td):e.slice(t).join(Td),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Ad=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?Dd+r:void 0})(),jd=e=>{let{theme:t,classGroups:n}=e;return Md(n,t)},Md=(e,t)=>{let n=wd();for(let r in e){let i=e[r];Nd(i,n,r,t)}return n},Nd=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Pd(i,t,n,r)}},Pd=(e,t,n,r)=>{if(typeof e==`string`){Fd(e,t,n);return}if(typeof e==`function`){Id(e,t,n,r);return}Ld(e,t,n,r)},Fd=(e,t,n)=>{let r=e===``?t:Rd(t,e);r.classGroupId=n},Id=(e,t,n,r)=>{if(zd(e)){Nd(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Cd(n,e))},Ld=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Nd(o,Rd(t,a),n,r)}},Rd=(e,t)=>{let n=e,r=t.split(Td),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=wd(),n.nextPart.set(t,i)),n=i}return n},zd=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Bd=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)}}},Vd=`!`,Hd=`:`,Ud=[],Wd=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Gd=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===Hd){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(Vd)?(c=s.slice(0,-1),l=!0):s.startsWith(Vd)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Wd(t,l,c,u)};if(t){let e=t+Hd,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Wd(Ud,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Kd=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}},qd=e=>({cache:Bd(e.cacheSize),parseClassName:Gd(e),sortModifiers:Kd(e),...Od(e)}),Jd=/\s+/,Yd=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Jd),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+Vd: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},Xd=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Zd(n))&&(i&&(i+=` `),i+=r);return i},Zd=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Zd(e[r]))&&(n&&(n+=` `),n+=t);return n},Qd=(e,...t)=>{let n,r,i,a,o=o=>(n=qd(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=Yd(e,n);return i(e,a),a};return a=o,(...e)=>a(Xd(...e))},$d=[],ef=e=>{let t=t=>t[e]||$d;return t.isThemeGetter=!0,t},tf=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,nf=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rf=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,af=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,of=/\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$/,sf=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,cf=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lf=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,uf=e=>rf.test(e),df=e=>!!e&&!Number.isNaN(Number(e)),ff=e=>!!e&&Number.isInteger(Number(e)),pf=e=>e.endsWith(`%`)&&df(e.slice(0,-1)),mf=e=>af.test(e),hf=()=>!0,gf=e=>of.test(e)&&!sf.test(e),_f=()=>!1,vf=e=>cf.test(e),yf=e=>lf.test(e),bf=e=>!J(e)&&!Y(e),xf=e=>If(e,Bf,_f),J=e=>tf.test(e),Sf=e=>If(e,Vf,gf),Cf=e=>If(e,Hf,df),wf=e=>If(e,Wf,hf),Tf=e=>If(e,Uf,_f),Ef=e=>If(e,Rf,_f),Df=e=>If(e,zf,yf),Of=e=>If(e,Gf,vf),Y=e=>nf.test(e),kf=e=>Lf(e,Vf),Af=e=>Lf(e,Uf),jf=e=>Lf(e,Rf),Mf=e=>Lf(e,Bf),Nf=e=>Lf(e,zf),Pf=e=>Lf(e,Gf,!0),Ff=e=>Lf(e,Wf,!0),If=(e,t,n)=>{let r=tf.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Lf=(e,t,n=!1)=>{let r=nf.exec(e);return r?r[1]?t(r[1]):n:!1},Rf=e=>e===`position`||e===`percentage`,zf=e=>e===`image`||e===`url`,Bf=e=>e===`length`||e===`size`||e===`bg-size`,Vf=e=>e===`length`,Hf=e=>e===`number`,Uf=e=>e===`family-name`,Wf=e=>e===`number`||e===`weight`,Gf=e=>e===`shadow`,Kf=Qd(()=>{let e=ef(`color`),t=ef(`font`),n=ef(`text`),r=ef(`font-weight`),i=ef(`tracking`),a=ef(`leading`),o=ef(`breakpoint`),s=ef(`container`),c=ef(`spacing`),l=ef(`radius`),u=ef(`shadow`),d=ef(`inset-shadow`),f=ef(`text-shadow`),p=ef(`drop-shadow`),m=ef(`blur`),h=ef(`perspective`),g=ef(`aspect`),_=ef(`ease`),v=ef(`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(),Y,J],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Y,J,c],T=()=>[uf,`full`,`auto`,...w()],E=()=>[ff,`none`,`subgrid`,Y,J],D=()=>[`auto`,{span:[`full`,ff,Y,J]},ff,Y,J],O=()=>[ff,`auto`,Y,J],k=()=>[`auto`,`min`,`max`,`fr`,Y,J],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=()=>[uf,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[uf,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[uf,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,Y,J],L=()=>[...b(),jf,Ef,{position:[Y,J]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],R=()=>[`auto`,`cover`,`contain`,Mf,xf,{size:[Y,J]}],te=()=>[pf,kf,Sf],z=()=>[``,`none`,`full`,l,Y,J],B=()=>[``,df,kf,Sf],V=()=>[`solid`,`dashed`,`dotted`,`double`],H=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ne=()=>[df,pf,jf,Ef],U=()=>[``,`none`,m,Y,J],re=()=>[`none`,df,Y,J],ie=()=>[`none`,df,Y,J],ae=()=>[df,Y,J],oe=()=>[uf,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[mf],breakpoint:[mf],color:[hf],container:[mf],"drop-shadow":[mf],ease:[`in`,`out`,`in-out`],font:[bf],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[mf],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[mf],shadow:[mf],spacing:[`px`,df],text:[mf],"text-shadow":[mf],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,uf,J,Y,g]}],container:[`container`],columns:[{columns:[df,J,Y,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:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[ff,`auto`,Y,J]}],basis:[{basis:[uf,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[df,uf,`auto`,`initial`,`none`,J]}],grow:[{grow:[``,df,Y,J]}],shrink:[{shrink:[``,df,Y,J]}],order:[{order:[ff,`first`,`last`,`none`,Y,J]}],"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()}],pbs:[{pbs:w()}],pbe:[{pbe: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()}],mbs:[{mbs:M()}],mbe:[{mbe: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()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],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,kf,Sf]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Ff,wf]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,pf,J]}],"font-family":[{font:[Af,Tf,t]}],"font-features":[{"font-features":[J]}],"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,Y,J]}],"line-clamp":[{"line-clamp":[df,`none`,Y,Cf]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Y,J]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Y,J]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...V(),`wavy`]}],"text-decoration-thickness":[{decoration:[df,`from-font`,`auto`,Y,Sf]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[df,`auto`,Y,J]}],"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`,Y,J]}],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`,Y,J]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:R()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},ff,Y,J],radial:[``,Y,J],conic:[ff,Y,J]},Nf,Df]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":B()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...V(),`hidden`,`none`]}],"divide-style":[{divide:[...V(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...V(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[df,Y,J]}],"outline-w":[{outline:[``,df,kf,Sf]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Pf,Of]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Pf,Of]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:B()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[df,Sf]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Pf,Of]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[df,Y,J]}],"mix-blend":[{"mix-blend":[...H(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":H()}],"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":[df]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Y,J]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":[df]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Y,J]}],filter:[{filter:[``,`none`,Y,J]}],blur:[{blur:U()}],brightness:[{brightness:[df,Y,J]}],contrast:[{contrast:[df,Y,J]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Pf,Of]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,df,Y,J]}],"hue-rotate":[{"hue-rotate":[df,Y,J]}],invert:[{invert:[``,df,Y,J]}],saturate:[{saturate:[df,Y,J]}],sepia:[{sepia:[``,df,Y,J]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Y,J]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[df,Y,J]}],"backdrop-contrast":[{"backdrop-contrast":[df,Y,J]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,df,Y,J]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[df,Y,J]}],"backdrop-invert":[{"backdrop-invert":[``,df,Y,J]}],"backdrop-opacity":[{"backdrop-opacity":[df,Y,J]}],"backdrop-saturate":[{"backdrop-saturate":[df,Y,J]}],"backdrop-sepia":[{"backdrop-sepia":[``,df,Y,J]}],"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`,Y,J]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[df,`initial`,Y,J]}],ease:[{ease:[`linear`,`initial`,_,Y,J]}],delay:[{delay:[df,Y,J]}],animate:[{animate:[`none`,v,Y,J]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Y,J]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":[`scale-3d`],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[Y,J,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"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`,Y,J]}],"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-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":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-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":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`,Y,J]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[df,kf,Sf,Cf]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`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`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`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-bs`,`border-w-be`,`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-bs`,`border-color-be`,`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-mbs`,`scroll-mbe`,`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-pbs`,`scroll-pbe`,`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 qf(...e){return Kf(xd(e))}function Jf(e){let t=b.useRef(!0);t.current&&(t.current=!1,e())}function Yf(){return typeof window<`u`}function Xf(e){return $f(e)?(e.nodeName||``).toLowerCase():`#document`}function Zf(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qf(e){return(($f(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function $f(e){return Yf()?e instanceof Node||e instanceof Zf(e).Node:!1}function ep(e){return Yf()?e instanceof Element||e instanceof Zf(e).Element:!1}function tp(e){return Yf()?e instanceof HTMLElement||e instanceof Zf(e).HTMLElement:!1}function np(e){return!Yf()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Zf(e).ShadowRoot}function rp(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=mp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ip(e){return/^(table|td|th)$/.test(Xf(e))}function ap(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var op=/transform|translate|scale|rotate|perspective|filter/,sp=/paint|layout|strict|content/,cp=e=>!!e&&e!==`none`,lp;function up(e){let t=ep(e)?mp(e):e;return cp(t.transform)||cp(t.translate)||cp(t.scale)||cp(t.rotate)||cp(t.perspective)||!fp()&&(cp(t.backdropFilter)||cp(t.filter))||op.test(t.willChange||``)||sp.test(t.contain||``)}function dp(e){let t=gp(e);for(;tp(t)&&!pp(t);){if(up(t))return t;if(ap(t))return null;t=gp(t)}return null}function fp(){return lp??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),lp}function pp(e){return/^(html|body|#document)$/.test(Xf(e))}function mp(e){return Zf(e).getComputedStyle(e)}function hp(e){return ep(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gp(e){if(Xf(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||np(e)&&e.host||Qf(e);return np(t)?t.host:t}function _p(e){let t=gp(e);return pp(t)?e.ownerDocument?e.ownerDocument.body:e.body:tp(t)&&rp(t)?t:_p(t)}function vp(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=_p(e),i=r===e.ownerDocument?.body,a=Zf(r);if(i){let e=yp(a);return t.concat(a,a.visualViewport||[],rp(r)?r:[],e&&n?vp(e):[])}else return t.concat(r,vp(r,[],n))}function yp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function bp(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var xp=typeof navigator<`u`,Sp=jp(),Cp=Np(),wp=Mp(),Tp=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),Ep=Sp.platform===`MacIntel`&&Sp.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Sp.platform);xp&&/firefox/i.test(wp);var Dp=xp&&/apple/i.test(navigator.vendor);xp&&/Edg/i.test(wp);var Op=xp&&/android/i.test(Cp)||/android/i.test(wp),kp=xp&&Cp.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,Ap=wp.includes(`jsdom/`);function jp(){if(!xp)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 Mp(){if(!xp)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function Np(){if(!xp)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function Pp(e){return e?.ownerDocument||document}var X=typeof document<`u`?b.useLayoutEffect:()=>{},Fp={};function Ip(e,t){let n=b.useRef(Fp);return n.current===Fp&&(n.current=e(t)),n}var Lp=[];function Rp(e){b.useEffect(e,Lp)}var zp=0,Bp=class e{static create(){return new e}currentId=zp;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=zp,t()},e)}isStarted(){return this.currentId!==zp}clear=()=>{this.currentId!==zp&&(clearTimeout(this.currentId),this.currentId=zp)};disposeEffect=()=>this.clear};function Vp(){let e=Ip(Bp.create).current;return Rp(e.disposeEffect),e}var Hp=null;globalThis.requestAnimationFrame;var Up=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)}},Wp=class e{static create(){return new e}static request(e){return Up.request(e)}static cancel(e){return Up.cancel(e)}currentId=Hp;request(e){this.cancel(),this.currentId=Up.request(()=>{this.currentId=Hp,e()})}cancel=()=>{this.currentId!==Hp&&(Up.cancel(this.currentId),this.currentId=Hp)};disposeEffect=()=>this.cancel};function Gp(){let e=Ip(Wp.create).current;return Rp(e.disposeEffect),e}function Kp(){}var qp=Object.freeze([]),Jp=Object.freeze({}),Yp={},Xp={},Zp=``;function Qp(e){if(typeof document>`u`)return!1;let t=Pp(e);return Zf(t).innerWidth-t.documentElement.clientWidth>0}function $p(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Pp(e),n=t.documentElement,r=t.body,i=rp(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function em(e){let t=Pp(e),n=t.documentElement,r=t.body,i=rp(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function tm(e){let t=Pp(e),n=t.documentElement,r=t.body,i=Zf(n),a=0,o=0,s=!1,c=Wp.create();if(Tp&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,Yp={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Zp=n.style.scrollBehavior,Xp={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=rp(n)?n:r;if(s=$p(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,Yp),Object.assign(r.style,Xp),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Zp)}function d(){u(),c.request(l)}l();let f=bp(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var nm=new class{lockCount=0;restore=null;timeoutLock=Bp.create();timeoutUnlock=Bp.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Pp(e).documentElement,n=Zf(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=Kp;return}let r=Ep||!Qp(e);this.restore=r?em(e):tm(e)}};function rm(e=!0,t=null){X(()=>{if(e)return nm.acquire(t)},[e,t])}function im(e){e.preventDefault(),e.stopPropagation()}function am(e){return`nativeEvent`in e}function om(e){return e.pointerType===``&&e.isTrusted?!0:Op&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function sm(e){return Ap?!1:!Op&&e.width===0&&e.height===0||Op&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function cm(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function lm(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function um(e,t){return t!=null&&!cm(t)?0:typeof e==`function`?e():e}function dm(e,t,n){let r=um(e,n);return typeof r==`number`?r:r?.[t]}function fm(e){return typeof e==`function`?e():e}function pm(e,t){return t||e===`click`||e===`mousedown`}var mm=`none`,hm=`trigger-press`,gm=`trigger-hover`,_m=`trigger-focus`,vm=`outside-press`,ym=`item-press`,bm=`focus-out`,xm=`escape-key`,Sm=`list-navigation`,Cm=`cancel-open`,wm=`disabled`,Tm=`imperative-action`,Em=`window-resize`;function Dm(e,t,n,r){let i=!1,a=!1,o=r??Jp;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}}var Om=b.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Bp,currentIdRef:{current:null},currentContextRef:{current:null}});function km(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=b.useRef(n),a=b.useRef(n),o=b.useRef(null),s=b.useRef(null),c=Vp();return(0,y.jsx)(Om.Provider,{value:b.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Am(e,t={open:!1}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`floatingId`),{open:i}=t,{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=b.useContext(Om),[f,p]=b.useState(!1);return X(()=>{function e(){p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current}if(a.current&&!i&&a.current===r){if(p(!1),s){let t=r;return d.start(s,()=>{n.select(`open`)||a.current&&a.current!==t||e()}),()=>{d.clear()}}e()}},[i,r,a,o,s,c,l,d,n]),X(()=>{if(!i)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:n.setOpen,setIsInstantPhase:p},a.current=r,o.current={open:0,close:dm(c.current,`close`)},t!==null&&t!==r?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,Dm(mm))):(p(!1),e?.setIsInstantPhase(!1))},[i,r,n,a,o,s,c,l,d]),X(()=>()=>{l.current=null},[l]),b.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function jm(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Mm(e,t,n,r){let i=Ip(Pm).current;return Fm(i,e,t,n,r)&&Lm(i,[e,t,n,r]),i.callback}function Nm(e){let t=Ip(Pm).current;return Im(t,e)&&Lm(t,e),t.callback}function Pm(){return{callback:null,cleanup:null,refs:[]}}function Fm(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Im(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function Lm(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:}}}}}}function Rm(e){let t=Ip(zm,e).current;return t.next=e,X(t.effect),t}function zm(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Bm=b[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Vm=Bm&&Bm!==b.useLayoutEffect?Bm:e=>e();function Z(e){let t=Ip(Hm).current;return t.next=e,Vm(t.effect),t.trampoline}function Hm(){let e={next:void 0,callback:Um,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Um(){}var Wm={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Gm={...Wm,position:`fixed`,top:0,left:0},Km={...Wm,position:`absolute`},qm=b.forwardRef(function(e,t){let[n,r]=b.useState();X(()=>{Dp&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,y.jsx)(`span`,{...e,ref:t,style:Gm,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),Jm=`data-base-ui-focusable`,Ym=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Xm=`ArrowLeft`,Zm=`ArrowRight`,Qm=`ArrowUp`,$m=`ArrowDown`;function eh(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function th(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&np(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function nh(e){return`composedPath`in e?e.composedPath()[0]:e.target}function rh(e,t){if(!ep(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(th(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function ih(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function ah(e){return e.matches(`html,body`)}function oh(e){return tp(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function sh(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Ym}`)!=null}function ch(e){return e?e.getAttribute(`role`)===`combobox`&&oh(e):!1}function lh(e){if(!e||Ap)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function uh(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}var dh=[`top`,`right`,`bottom`,`left`],fh=Math.min,ph=Math.max,mh=Math.round,hh=Math.floor,gh=e=>({x:e,y:e}),_h={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function vh(e,t,n){return ph(e,fh(t,n))}function yh(e,t){return typeof e==`function`?e(t):e}function bh(e){return e.split(`-`)[0]}function xh(e){return e.split(`-`)[1]}function Sh(e){return e===`x`?`y`:`x`}function Ch(e){return e===`y`?`height`:`width`}function wh(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Th(e){return Sh(wh(e))}function Eh(e,t,n){n===void 0&&(n=!1);let r=xh(e),i=Th(e),a=Ch(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Fh(o)),[o,Fh(o)]}function Dh(e){let t=Fh(e);return[Oh(e),t,Oh(t)]}function Oh(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var kh=[`left`,`right`],Ah=[`right`,`left`],jh=[`top`,`bottom`],Mh=[`bottom`,`top`];function Nh(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ah:kh:t?kh:Ah;case`left`:case`right`:return t?jh:Mh;default:return[]}}function Ph(e,t,n,r){let i=xh(e),a=Nh(bh(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Oh)))),a}function Fh(e){let t=bh(e);return _h[t]+e.slice(t.length)}function Ih(e){return{top:0,right:0,bottom:0,left:0,...e}}function Lh(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ih(e)}function Rh(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function zh(e,t,n){return Math.floor(e/t)!==n}function Bh(e,t){return t<0||t>=e.length}function Vh(e,t){return Uh(e.current,{disabledIndices:t})}function Hh(e,t){return Uh(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Uh(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&Jh(e,a,r));return a}function Wh(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!Jh(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=hh(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!Jh(e,r,s))return r}};d&&im(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=Uh(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=Uh(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}Bh(e,f)&&(f=u)}if(n===`both`){let n=hh(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&im(t),u%o===o-1?r&&(f=Uh(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=Uh(e,{startingIndex:u,disabledIndices:s}),r&&zh(f,o,n)&&(f=Uh(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),zh(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&im(t),u%o===0?r&&(f=Uh(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=Uh(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&zh(f,o,n)&&(f=Uh(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),zh(f,o,n)&&(f=u));let c=hh(l/o)===n;Bh(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:Uh(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function Gh(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function Kh(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function qh(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function Jh(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?Xh(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function Yh(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Xh(e,t=e?mp(e):null){return!e||!e.isConnected||!t||Yh(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Zh=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Qh(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return np(n)?n.host:null}function $h(e){for(let t of Array.from(e.children))if(Xf(t)===`summary`)return t;return null}function eg(e,t){let n=$h(t);return!!n&&(e===n||th(n,e))}function tg(e){let t=e?Xf(e):``;return e!=null&&e.matches(Zh)&&(t!==`summary`||e.parentElement!=null&&Xf(e.parentElement)===`details`&&$h(e.parentElement)===e)&&(t!==`details`||$h(e)==null)&&(t!==`input`||e.type!==`hidden`)}function ng(e){if(!tg(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Qh(t)){let n=t!==e,r=Xf(t)===`slot`;if(t.hasAttribute(`inert`)||n&&Xf(t)===`details`&&!t.open&&!eg(e,t)||t.hasAttribute(`hidden`)||!r&&!rg(t,n))return!1}return!0}function rg(e,t){let n=mp(e);return t?n.display!==`none`:Xh(e,n)}function ig(e){let t=e.tabIndex;if(t<0){let t=Xf(e);if(t===`details`||t===`audio`||t===`video`||tp(e)&&e.isContentEditable)return 0}return t}function ag(e){if(Xf(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function og(e,t){let n=ag(e);if(!n)return!0;let r=t.find(e=>{let t=ag(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=ag(e);return t?.name===n.name&&t.form===n.form})===n}function sg(e){if(tp(e)&&Xf(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return tp(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function cg(e,t){sg(e).forEach(e=>{tg(e)&&t.push(e),cg(e,t)})}function lg(e,t,n){sg(e).forEach(e=>{tp(e)&&e.matches(t)&&n.push(e),lg(e,t,n)})}function ug(e){return ng(e)&&ig(e)>=0}function dg(e){let t=[];return cg(e,t),t.filter(ng)}function fg(e){let t=dg(e);return t.filter(e=>ig(e)>=0&&og(e,t))}function pg(e,t){let n=fg(e),r=n.length;if(r===0)return;let i=eh(Pp(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function mg(e){return pg(Pp(e).body,1)||e}function hg(e){return pg(Pp(e).body,-1)||e}function gg(e,t){if(!e)return null;let n=fg(Pp(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function _g(e){return gg(e,1)}function vg(e){return gg(e,-1)}function yg(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!th(n,r)}function bg(e){fg(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function xg(e){let t=[];lg(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Sg(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Sg(e,t.id,n)])}function Cg(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function wg(e){return`data-base-ui-${e}`}var Tg=0;function Eg(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(Tg);let a=()=>e?.focus({preventScroll:n});if(i)return a(),Kp;let o=requestAnimationFrame(a);return Tg=o,()=>{Tg===o&&(cancelAnimationFrame(o),Tg=0)}}var Dg={inert:new WeakMap,"aria-hidden":new WeakMap},Og=`data-base-ui-inert`,kg={inert:new WeakSet,"aria-hidden":new WeakSet},Ag=new WeakMap,jg=0;function Mg(e){return kg[e]}function Ng(e){return e?np(e)?e.host:Ng(e.parentNode):null}var Pg=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Ng(t);return e.contains(n)?n:null}).filter(e=>e!=null),Fg=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Ig=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{Xf(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function Lg(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=Pg(t,e),u=i?Pg(t,a):[],d=new Set(u),f=i?Ig(t,Fg(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=Dg[o],n=Mg(o);c=n,s=e;let r=Pg(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);Ig(t,Fg(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(Ag.get(e)||0)+1;Ag.set(e,t),m.push(e),t===1&&e.setAttribute(Og,``)}),jg+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(Ag.get(e)||0)-1;Ag.set(e,t),t||e.removeAttribute(Og)}),--jg,jg||(Dg.inert=new WeakMap,Dg[`aria-hidden`]=new WeakMap,kg.inert=new WeakSet,kg[`aria-hidden`]=new WeakSet,Ag=new WeakMap)}}function Rg(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=Pp(e[0]).body;return Lg(e,o,n,r,{mark:i,markerIgnoreElements:a})}var zg={...b},Bg=0;function Vg(e,t=`mui`){let[n,r]=b.useState(e),i=e||n;return b.useEffect(()=>{n??(Bg+=1,r(`${t}-${Bg}`))},[n,t]),i}var Hg=zg.useId;function Ug(e,t){if(Hg!==void 0){let n=Hg();return e??(t?`${t}-${n}`:n)}return Vg(e,t)}function Wg(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var Gg=Wg(`https://base-ui.com/production-error`,`Base UI`),Kg=19;function qg(e){return Kg>=e}function Jg(e){if(!b.isValidElement(e))return null;let t=e,n=t.props;return(qg(19)?n?.ref:t.ref)??null}function Yg(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Xg(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 Zg(e,t){return typeof e==`function`?e(t):e}function Qg(e,t){return typeof e==`function`?e(t):e}var $g={};function e_(e,t,n,r,i){if(!n&&!r&&!i&&!e)return n_(t);let a=n_(e);return t&&(a=r_(a,t)),n&&(a=r_(a,n)),r&&(a=r_(a,r)),i&&(a=r_(a,i)),a}function t_(e){if(e.length===0)return $g;if(e.length===1)return n_(e[0]);let t=n_(e[0]);for(let n=1;n<e.length;n+=1)t=r_(t,e[n]);return t}function n_(e){return s_(e)?{...c_(e,$g)}:i_(e)}function r_(e,t){return s_(t)?c_(t,e):a_(e,t)}function i_(e){let t={...e};for(let e in t){let n=t[e];o_(e,n)&&(t[e]=u_(n))}return t}function a_(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Yg(e.style,r);break;case`className`:e[n]=f_(e.className,r);break;default:o_(n,r)?e[n]=l_(e[n],r):e[n]=r}}return e}function o_(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 s_(e){return typeof e==`function`}function c_(e,t){return s_(e)?e(t):e??$g}function l_(e,t){return t?e?(...n)=>{let r=n[0];if(p_(r)){let i=r;d_(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:u_(t):e}function u_(e){return e&&((...t)=>{let n=t[0];return p_(n)&&d_(n),e(...t)})}function d_(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function f_(e,t){return t?e?t+` `+e:t:e}function p_(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function m_(e,t,n={}){let r=t.render,i=h_(t,n);return n.enabled===!1?null:v_(e,r,i,n.state??Jp)}function h_(e,t={}){let{className:n,style:r,render:i}=e,{state:a=Jp,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Zg(n,a):void 0,d=l?Qg(r,a):void 0,f=l?Xg(a,c):Jp,p=l&&s?g_(s):void 0,m=l?Yg(f,p)??{}:Jp;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=Nm([m.ref,Jg(i),...o]):m.ref=Mm(m.ref,Jg(i),o):Mm(null,null)),l?(u!==void 0&&(m.className=f_(m.className,u)),d!==void 0&&(m.style=Yg(m.style,d)),m):Jp}function g_(e){return Array.isArray(e)?t_(e):e_(void 0,e)}var __=Symbol.for(`react.lazy`);function v_(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=e_(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===__&&(i=b.Children.toArray(t)[0]),b.cloneElement(i,e)}if(e&&typeof e==`string`)return y_(e,n);throw Error(Gg(8))}function y_(e,t){return e===`button`?(0,b.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,b.createElement)(`img`,{alt:``,...t,key:t.key}):b.createElement(e,t)}var b_={style:{transition:`none`}},x_=`data-base-ui-click-trigger`,S_={fallbackAxisSide:`none`},C_={fallbackAxisSide:`end`},w_={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},T_=c(g()),E_=b.createContext(null),D_=()=>b.useContext(E_),O_=wg(`portal`);function k_(e={}){let{ref:t,container:n,componentProps:r=Jp,elementProps:i}=e,a=Ug(),o=D_()?.portalNode,[s,c]=b.useState(null),[l,u]=b.useState(null),d=Z(e=>{e!==null&&u(e)}),f=b.useRef(null);X(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&($f(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=m_(`div`,r,{ref:[t,d],props:[{id:a,[O_]:``},i]});return{portalNode:l,portalSubtree:s&&p?T_.createPortal(p,s):null}}var A_=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,style:s,...c}=e,{portalNode:l,portalSubtree:u}=k_({container:r,ref:t,componentProps:e,elementProps:c}),d=b.useRef(null),f=b.useRef(null),p=b.useRef(null),m=b.useRef(null),[h,g]=b.useState(null),_=b.useRef(!1),v=h?.modal,x=h?.open,S=typeof o==`boolean`?o:!!h&&!h.modal&&h.open&&!!l;b.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&yg(e)&&(e.type===`focusin`?_.current&&=(xg(l),!1):(bg(l),_.current=!0))}return jm(bp(l,`focusin`,e,!0),bp(l,`focusout`,e,!0))},[l,v]),b.useEffect(()=>{!l||x!==!1||(xg(l),_.current=!1)},[x,l]);let C=b.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,y.jsxs)(b.Fragment,{children:[u,(0,y.jsxs)(E_.Provider,{value:C,children:[S&&l&&(0,y.jsx)(qm,{"data-type":`outside`,ref:d,onFocus:e=>{yg(e,l)?p.current?.focus():hg(h?h.domReference:null)?.focus()}}),S&&l&&(0,y.jsx)(`span`,{"aria-owns":l.id,style:w_}),l&&T_.createPortal(n,l),S&&l&&(0,y.jsx)(qm,{"data-type":`outside`,ref:f,onFocus:e=>{yg(e,l)?m.current?.focus():(mg(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,Dm(`focus-out`,e.nativeEvent)))}})]})]})});function j_(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var M_=class{nodesRef={current:[]};events=j_();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},N_=b.createContext(null),P_=b.createContext(null),F_=()=>b.useContext(N_)?.id||null,I_=e=>{let t=b.useContext(P_);return e??t};function L_(e){let t=Ug(),n=I_(e),r=F_();return X(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function R_(e){let{children:t,id:n}=e,r=F_();return(0,y.jsx)(N_.Provider,{value:b.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function z_(e){let{children:t,externalTree:n}=e,r=Ip(()=>n??new M_).current;return(0,y.jsx)(P_.Provider,{value:r,children:t})}function B_(e){return e==null?e:`current`in e?e.current:e}function V_(e,t){let n=Zf(nh(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var H_=20,U_=[];function W_(){U_=U_.filter(e=>e.deref()?.isConnected)}function G_(e){W_(),e&&Xf(e)!==`body`&&(U_.push(new WeakRef(e)),U_.length>H_&&(U_=U_.slice(-H_)))}function K_(){return W_(),U_[U_.length-1]?.deref()}function q_(e){return e?ug(e)?e:fg(e)[0]||e:null}function J_(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=dg(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return ug(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Y_(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:x,dataRef:S}=h.context,C=Z(()=>S.current.floatingContext?.nodeId),w=i===!1,T=ch(_)&&w,E=b.useRef([`content`]),D=Rm(i),O=Rm(a),k=Rm(l),A=I_(p),j=D_(),M=b.useRef(!1),N=b.useRef(!1),P=b.useRef(!1),F=b.useRef(null),I=b.useRef(``),L=b.useRef(``),ee=b.useRef(null),R=b.useRef(null),te=Mm(ee,f,j?.beforeInsideRef),z=Mm(R,j?.afterInsideRef),B=Vp(),V=Vp(),H=Gp(),ne=j!=null,U=uh(v),re=Z((e=U)=>e?fg(e):[]),ie=Z(()=>m?.().filter(e=>e!=null)??[]);b.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&th(U,eh(Pp(U)))&&re().length===0&&!T&&im(e)}return bp(Pp(U),`keydown`,e)},[r,_,U,s,E,T,re]),b.useEffect(()=>{if(r||!g)return;let e=Pp(U);function t(){P.current=!1}function n(e){let t=nh(e),n=ie();P.current=!(th(v,t)||th(_,t)||th(j?.portalNode,t)||n.some(e=>e===t||th(e,t))),L.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(N.current=!0)}function i(){L.current=`keyboard`}return jm(bp(e,`pointerdown`,n,!0),bp(e,`pointerup`,t,!0),bp(e,`pointercancel`,t,!0),bp(e,`keydown`,i,!0))},[r,v,_,U,g,j,ie]),b.useEffect(()=>{if(r||!c)return;let e=Pp(U);function t(){N.current=!0,V.start(0,()=>{N.current=!1})}function n(e){let t=nh(e);ug(t)&&(F.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=nh(t);queueMicrotask(()=>{let a=C(),c=h.context.triggerElements,l=ie(),f=n?.hasAttribute(wg(`focus-guard`))&&[ee.current,R.current,j?.beforeInsideRef.current,j?.afterInsideRef.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,B_(d),B_(u)].includes(n),p=!(th(_,n)||th(v,n)||th(n,v)||th(j?.portalNode,n)||l.some(e=>e===n||th(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>th(e,n))||f||A&&(Sg(A.nodesRef.current,a).find(e=>th(e.context?.elements.floating,n)||th(e.context?.elements.domReference,n))||Cg(A.nodesRef.current,a).find(e=>[e.context?.elements.floating,uh(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&U&&J_(U,E),o&&r!==_&&!Xh(i)&&eh(e)===e.body){if(tp(U)&&(U.focus(),o===`popup`)){H.request(()=>{U.focus()});return}let e=re(),t=F.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||U;tp(n)&&n.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(T||!s)&&n&&p&&!N.current&&(T||n!==K_())&&(M.current=!0,h.setOpen(!1,Dm(bm,t)))})}function a(){P.current||(S.current.insideReactTree=!0,B.start(0,()=>{S.current.insideReactTree=!1}))}let l=tp(_)?_:null;if(!(!v&&!l))return jm(l&&bp(l,`focusout`,i),l&&bp(l,`pointerdown`,t),v&&bp(v,`focusin`,n),v&&bp(v,`focusout`,i),v&&j&&bp(v,`focusout`,a,!0))},[r,_,v,U,s,A,j,h,c,o,re,T,C,E,S,B,V,H,u,d,ie]),b.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(j?.portalNode?.querySelectorAll(`[${wg(`portal`)}]`)||[]),t=(A?Cg(A.nodesRef.current,C()):[]).find(e=>ch(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Rg([...[v,...e,ee.current,R.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,...ie()],t,B_(d),B_(u),T?_:null].filter(e=>e!=null),{ariaHidden:s||T,mark:!1}),i=Rg([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,E,j,T,A,C,u,d,ie]),X(()=>{if(!g||r||!tp(U))return;let e=eh(Pp(U));queueMicrotask(()=>{let t=D.current,n=typeof t==`function`?t(k.current||``):t;if(n===void 0||n===!1||th(U,e))return;let r=null,i=()=>(r??=re(U),r[0]||U),a;a=n===!0||n===null?i():B_(n),a||=i(),Eg(a,{preventScroll:a===U})})},[r,g,U,w,re,D,k]),X(()=>{if(r||!U)return;let e=Pp(U);G_(eh(e));function t(e){if(e.open||(I.current=V_(e.nativeEvent,L.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(M.current=!0),e.reason===`outside-press`)if(e.nested)M.current=!1;else if(om(e.nativeEvent)||sm(e.nativeEvent))M.current=!1;else{let e=!1;Pp(U).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?M.current=!1:M.current=!0}}x.on(`openchange`,t);function n(){let e=O.current,t=typeof e==`function`?e(I.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=_||K_();return e&&e.isConnected?e:null}let n=_||K_();return B_(t)||n||null}return()=>{x.off(`openchange`,t);let r=eh(e),i=ie(),a=th(v,r)||i.some(e=>e===r||th(e,r))||A&&Sg(A.nodesRef.current,C(),!1).some(e=>th(e.context?.elements.floating,r)),o=O.current,s=n();queueMicrotask(()=>{let t=q_(s),n=typeof o!=`boolean`;o&&!M.current&&tp(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),M.current=!1})}},[r,v,U,O,S,x,A,_,C,ie]),X(()=>{if(!Tp||g||!v)return;let e=eh(Pp(v));!tp(e)||!oh(e)||th(v,e)&&e.blur()},[g,v]),X(()=>{if(!(r||!j))return j.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{j.setFocusManagerState(null)}},[r,j,s,g,h,c,_]),X(()=>{if(!(r||!U))return J_(U,E),()=>{queueMicrotask(W_)}},[r,U,E]);let ae=!r&&(s?!T:!0)&&(ne||s);return(0,y.jsxs)(b.Fragment,{children:[ae&&(0,y.jsx)(qm,{"data-type":`inside`,ref:te,onFocus:e=>{if(s){let e=re();Eg(e[e.length-1])}else j?.portalNode&&(M.current=!1,yg(e,j.portalNode)?mg(_)?.focus():B_(d??j.beforeOutsideRef)?.focus())}}),n,ae&&(0,y.jsx)(qm,{"data-type":`inside`,ref:z,onFocus:e=>{s?Eg(re()[0]):j?.portalNode&&(c&&(M.current=!0),yg(e,j.portalNode)?hg(_)?.focus():B_(u??j.afterOutsideRef)?.focus())}})]})}function X_(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0,reason:u=hm}=t,d=b.useRef(void 0),f=Gp(),p=Vp(),m=b.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){let t=d.current,i=e.nativeEvent,m=n.select(`open`);if(e.button!==0||a===`click`||cm(t,!0)&&s)return;let h=r.current.openEvent,g=h?.type,_=n.select(`domReferenceElement`)!==e.currentTarget,v=m&&_||!(m&&o&&(!(h&&c)||g===`click`||g===`mousedown`)),y=nh(i);if(oh(y)){let e=Dm(u,i,y);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e);return}let b=e.currentTarget;f.request(()=>{let e=Dm(u,i,b);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e)})},onClick(e){if(a===`mousedown-only`)return;let t=d.current;if(a===`mousedown`&&t){d.current=void 0;return}if(cm(t,!0)&&s)return;let i=n.select(`open`),f=r.current.openEvent,m=n.select(`domReferenceElement`)!==e.currentTarget,h=i&&m||!(i&&o&&(!(f&&c)||lm(f))),g=Dm(u,e.nativeEvent,e.currentTarget);h&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,g)}):n.setOpen(h,g)},onKeyDown(){d.current=void 0}}),[r,a,s,n,c,o,f,p,l,u]);return b.useMemo(()=>i?{reference:m}:Jp,[i,m])}function Z_(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function Q_(e){return e!=null&&e.clientX!=null}function $_(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{enabled:s=!0,axis:c=`both`}=t,l=b.useRef(!1),u=b.useRef(null),[d,f]=b.useState(),[p,m]=b.useState([]),h=Z((e,t,r)=>{l.current||o.current.openEvent&&!Q_(o.current.openEvent)||n.set(`positionReference`,Z_(r??a,{x:e,y:t,axis:c,dataRef:o,pointerType:d}))}),g=Z(e=>{r?u.current||m([]):h(e.clientX,e.clientY,e.currentTarget)}),_=cm(d)?i:r,v=b.useCallback(()=>{if(!_||!s)return;let e=Zf(i);function t(e){th(i,nh(e))?(u.current?.(),u.current=null):h(e.clientX,e.clientY)}if(!o.current.openEvent||Q_(o.current.openEvent))return u.current=bp(e,`mousemove`,t),()=>{u.current?.(),u.current=null};n.set(`positionReference`,a)},[_,s,i,o,a,n,h]);b.useEffect(()=>v(),[v,p]),b.useEffect(()=>{s&&!i&&(l.current=!1)},[s,i]),b.useEffect(()=>{!s&&r&&(l.current=!0)},[s,r]);let y=b.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:g,onMouseEnter:g}},[g]);return b.useMemo(()=>s?{reference:y,trigger:y}:{},[s,y])}var ev={intentional:`onClick`,sloppy:`onPointerDown`};function tv(){return!1}function nv(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function rv(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),{dataRef:a}=n.context,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`sloppy`,referencePress:u=tv,referencePressEvent:d=`sloppy`,bubbles:f,externalTree:p}=t,m=I_(p),h=Z(typeof c==`function`?c:()=>!1),g=typeof c==`function`?h:c,_=g!==!1,v=Z(()=>l),y=b.useRef(!1),x=b.useRef(!1),S=b.useRef(!1),{escapeKey:C,outsidePress:w}=nv(f),T=b.useRef(null),E=Vp(),D=Vp(),O=Z(()=>{D.clear(),a.current.insideReactTree=!1}),k=b.useRef(!1),A=b.useRef(``),j=Z(u),M=Z(e=>{if(!r||!o||!s||e.key!==`Escape`||k.current)return;let t=a.current.floatingContext?.nodeId,i=m?Sg(m.nodesRef.current,t):[];if(!C&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let c=Dm(xm,am(e)?e.nativeEvent:e);n.setOpen(!1,c),!C&&!c.isPropagationAllowed&&e.stopPropagation()}),N=Z(()=>{a.current.insideReactTree=!0,D.start(0,O)});b.useEffect(()=>{if(!r||!o)return;a.current.__escapeKeyBubbles=C,a.current.__outsidePressBubbles=w;let e=new Bp,t=new Bp;function c(){e.clear(),k.current=!0}function l(){e.start(fp()?5:0,()=>{k.current=!1})}function u(){S.current=!0,t.start(0,()=>{S.current=!1})}function d(){y.current=!1,x.current=!1}function f(){let e=A.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function p(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=a.current.floatingContext?.nodeId,r=m&&Sg(m.nodesRef.current,t).some(t=>ih(e,t.context?.elements.floating));return ih(e,n.select(`floatingElement`))||ih(e,n.select(`domReferenceElement`))||r}function b(e){if(p(e)){O();return}if(a.current.insideReactTree){O();return}let r=nh(e),i=`[${wg(`inert`)}]`,o=ep(r)?r.getRootNode():null,s=Array.from((np(o)?o:Pp(n.select(`floatingElement`))).querySelectorAll(i)),c=n.context.triggerElements;if(r&&(c.hasElement(r)||c.hasMatchingElement(e=>th(e,r))))return;let l=ep(r)?r:null;for(;l&&!pp(l);){let e=gp(l);if(pp(e)||!ep(e))break;l=e}if(s.length&&ep(r)&&!ah(r)&&!th(r,n.select(`floatingElement`))&&s.every(e=>!th(l,e)))return;if(tp(r)&&!(`touches`in e)){let t=pp(r),n=mp(r),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=r.offsetWidth-r.clientWidth:e.offsetX>r.clientWidth),d=s&&e.offsetY>r.clientHeight;if(u||d)return}if(h(e))return;if(f()===`intentional`&&S.current){t.clear(),S.current=!1;return}if(typeof g==`function`&&!g(e))return;let u=a.current.floatingContext?.nodeId,d=m?Sg(m.nodesRef.current,u):[];if(d.length>0){let e=!0;if(d.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,Dm(vm,e)),O()}function D(e){f()!==`sloppy`||e.pointerType===`touch`||!n.select(`open`)||!o||ih(e,n.select(`floatingElement`))||ih(e,n.select(`domReferenceElement`))||b(e)}function j(e){if(f()!==`sloppy`||!n.select(`open`)||!o||ih(e,n.select(`floatingElement`))||ih(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function N(e,t){let n=nh(e);if(!n)return;let r=bp(n,e.type,()=>{t(e),r()})}function P(e){A.current=`touch`,N(e,j)}function F(e){E.clear(),e.type===`pointerdown`&&(A.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&N(e,e=>{e.type===`pointerdown`?D(e):b(e)})}function I(e){if(!y.current)return;let n=x.current;if(d(),f()===`intentional`){if(e.type===`pointercancel`){n&&u();return}if(!h(e)){if(n){u();return}typeof g==`function`&&!g(e)||(t.clear(),S.current=!0,O())}}}function L(e){if(f()!==`sloppy`||!T.current||ih(e,n.select(`floatingElement`))||ih(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-T.current.startX),i=Math.abs(t.clientY-T.current.startY),a=Math.sqrt(r*r+i*i);a>5&&(T.current.dismissOnTouchEnd=!0),a>10&&(b(e),E.clear(),T.current=null)}function ee(e){N(e,L)}function R(e){f()!==`sloppy`||!T.current||ih(e,n.select(`floatingElement`))||ih(e,n.select(`domReferenceElement`))||(T.current.dismissOnTouchEnd&&b(e),E.clear(),T.current=null)}function te(e){N(e,R)}let z=Pp(i),B=jm(s&&jm(bp(z,`keydown`,M),bp(z,`compositionstart`,c),bp(z,`compositionend`,l)),_&&jm(bp(z,`click`,F,!0),bp(z,`pointerdown`,F,!0),bp(z,`pointerup`,I,!0),bp(z,`pointercancel`,I,!0),bp(z,`mousedown`,F,!0),bp(z,`mouseup`,I,!0),bp(z,`touchstart`,P,!0),bp(z,`touchmove`,ee,!0),bp(z,`touchend`,te,!0)));return()=>{B(),e.clear(),t.clear(),d(),S.current=!1}},[a,i,s,_,g,r,o,C,w,M,O,v,m,n,E]),b.useEffect(O,[g,O]);let P=b.useMemo(()=>({onKeyDown:M,[ev[d]]:e=>{j()&&n.setOpen(!1,Dm(hm,e.nativeEvent))},...d!==`intentional`&&{onClick(e){j()&&n.setOpen(!1,Dm(`trigger-press`,e.nativeEvent))}}}),[M,n,d,j]),F=Z(e=>{if(!r||!o||e.button!==0)return;let t=nh(e.nativeEvent);th(n.select(`floatingElement`),t)&&(y.current||(y.current=!0,x.current=!1))}),I=Z(e=>{!r||!o||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&y.current&&(x.current=!0)}),L=b.useMemo(()=>({onKeyDown:M,onPointerDown:I,onMouseDown:I,onClickCapture:N,onMouseDownCapture(e){N(),F(e)},onPointerDownCapture(e){N(),F(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[M,N,F,I]);return b.useMemo(()=>o?{reference:P,floating:L,trigger:P}:{},[o,P,L])}function iv(e,t,n){let{reference:r,floating:i}=e,a=wh(t),o=Th(t),s=Ch(o),c=bh(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(xh(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function av(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=yh(t,e),p=Lh(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Rh(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Rh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ov=50,sv=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:av},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=iv(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ov&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=iv(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},cv=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=yh(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=bh(r),_=wh(o),v=bh(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Fh(o)]:Dh(o)),x=p!==`none`;!d&&x&&b.push(...Ph(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Eh(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==wh(t))||T.every(e=>wh(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=wh(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function lv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uv(e){return dh.some(t=>e[t]>=0)}var dv=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=yh(e,t);switch(i){case`referenceHidden`:{let e=lv(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:uv(e)}}}case`escaped`:{let e=lv(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:uv(e)}}}default:return{}}}}},fv=new Set([`left`,`top`]);async function pv(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=bh(n),s=xh(n),c=wh(n)===`y`,l=fv.has(o)?-1:1,u=a&&c?-1:1,d=yh(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var mv=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await pv(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},hv=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=yh(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=wh(bh(i)),p=Sh(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=vh(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=vh(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},gv=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=yh(e,t),u={x:n,y:r},d=wh(i),f=Sh(d),p=u[f],m=u[d],h=yh(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=fv.has(bh(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},_v=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=yh(e,t),u=await o.detectOverflow(t,l),d=bh(i),f=xh(i),p=wh(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=fh(h-u[g],v),x=fh(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=ph(u.left,0),t=ph(u.right,0),n=ph(u.top,0),r=ph(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:ph(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:ph(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function vv(e){let t=mp(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=tp(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=mh(n)!==a||mh(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function yv(e){return ep(e)?e:e.contextElement}function bv(e){let t=yv(e);if(!tp(t))return gh(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=vv(t),o=(a?mh(n.width):n.width)/r,s=(a?mh(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var xv=gh(0);function Sv(e){let t=Zf(e);return!fp()||!t.visualViewport?xv:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Cv(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Zf(e)?!1:t}function wv(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=yv(e),o=gh(1);t&&(r?ep(r)&&(o=bv(r)):o=bv(e));let s=Cv(a,n,r)?Sv(a):gh(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Zf(a),t=r&&ep(r)?Zf(r):r,n=e,i=yp(n);for(;i&&r&&t!==n;){let e=bv(i),t=i.getBoundingClientRect(),r=mp(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Zf(i),i=yp(n)}}return Rh({width:u,height:d,x:c,y:l})}function Tv(e,t){let n=hp(e).scrollLeft;return t?t.left+n:wv(Qf(e)).left+n}function Ev(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Tv(e,n),y:n.top+t.scrollTop}}function Dv(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Qf(r),s=t?ap(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=gh(1),u=gh(0),d=tp(r);if((d||!d&&!a)&&((Xf(r)!==`body`||rp(o))&&(c=hp(r)),d)){let e=wv(r);l=bv(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ev(o,c):gh(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ov(e){return Array.from(e.getClientRects())}function kv(e){let t=Qf(e),n=hp(e),r=e.ownerDocument.body,i=ph(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ph(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Tv(e),s=-n.scrollTop;return mp(r).direction===`rtl`&&(o+=ph(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Av=25;function jv(e,t){let n=Zf(e),r=Qf(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=fp();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Tv(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Av&&(a-=o)}else l<=Av&&(a+=l);return{width:a,height:o,x:s,y:c}}function Mv(e,t){let n=wv(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=tp(e)?bv(e):gh(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Nv(e,t,n){let r;if(t===`viewport`)r=jv(e,n);else if(t===`document`)r=kv(Qf(e));else if(ep(t))r=Mv(t,n);else{let n=Sv(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Rh(r)}function Pv(e,t){let n=gp(e);return n===t||!ep(n)||pp(n)?!1:mp(n).position===`fixed`||Pv(n,t)}function Fv(e,t){let n=t.get(e);if(n)return n;let r=vp(e,[],!1).filter(e=>ep(e)&&Xf(e)!==`body`),i=null,a=mp(e).position===`fixed`,o=a?gp(e):e;for(;ep(o)&&!pp(o);){let t=mp(o),n=up(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||rp(o)&&!n&&Pv(e,o))?r=r.filter(e=>e!==o):i=t,o=gp(o)}return t.set(e,r),r}function Iv(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ap(t)?[]:Fv(t,this._c):[].concat(n),r],o=Nv(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Nv(t,a[e],i);s=ph(n.top,s),c=fh(n.right,c),l=fh(n.bottom,l),u=ph(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Lv(e){let{width:t,height:n}=vv(e);return{width:t,height:n}}function Rv(e,t,n){let r=tp(t),i=Qf(t),a=n===`fixed`,o=wv(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=gh(0);function l(){c.x=Tv(i)}if(r||!r&&!a)if((Xf(t)!==`body`||rp(i))&&(s=hp(t)),r){let e=wv(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Ev(i,s):gh(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function zv(e){return mp(e).position===`static`}function Bv(e,t){if(!tp(e)||mp(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Qf(e)===n&&(n=n.ownerDocument.body),n}function Vv(e,t){let n=Zf(e);if(ap(e))return n;if(!tp(e)){let t=gp(e);for(;t&&!pp(t);){if(ep(t)&&!zv(t))return t;t=gp(t)}return n}let r=Bv(e,t);for(;r&&ip(r)&&zv(r);)r=Bv(r,t);return r&&pp(r)&&zv(r)&&!up(r)?n:r||dp(e)||n}var Hv=async function(e){let t=this.getOffsetParent||Vv,n=this.getDimensions,r=await n(e.floating);return{reference:Rv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Uv(e){return mp(e).direction===`rtl`}var Wv={convertOffsetParentRelativeRectToViewportRelativeRect:Dv,getDocumentElement:Qf,getClippingRect:Iv,getOffsetParent:Vv,getElementRects:Hv,getClientRects:Ov,getDimensions:Lv,getScale:bv,isElement:ep,isRTL:Uv};function Gv(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Kv(e,t){let n=null,r,i=Qf(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=hh(d),h=hh(i.clientWidth-(u+f)),g=hh(i.clientHeight-(d+p)),_=hh(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ph(0,fh(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Gv(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function qv(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=yv(e),u=i||a?[...l?vp(l):[],...t?vp(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Kv(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?wv(e):null;c&&g();function g(){let t=wv(e);h&&!Gv(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Jv=mv,Yv=hv,Xv=cv,Zv=_v,Qv=dv,$v=gv,ey=(e,t,n)=>{let r=new Map,i={platform:Wv,...n},a={...i.platform,_c:r};return sv(e,t,{...i,platform:a})},ty=typeof document<`u`?b.useLayoutEffect:function(){};function ny(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ny(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!ny(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ry(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function iy(e,t){let n=ry(e);return Math.round(t*n)/n}function ay(e){let t=b.useRef(e);return ty(()=>{t.current=e}),t}function oy(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=b.useState(r);ny(f,r)||p(r);let[m,h]=b.useState(null),[g,_]=b.useState(null),v=b.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=b.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=b.useRef(null),w=b.useRef(null),T=b.useRef(u),E=c!=null,D=ay(c),O=ay(i),k=ay(l),A=b.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),ey(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!ny(T.current,t)&&(T.current=t,T_.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);ty(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=b.useRef(!1);ty(()=>(j.current=!0,()=>{j.current=!1}),[]),ty(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=b.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=b.useMemo(()=>({reference:x,floating:S}),[x,S]),P=b.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=iy(N.floating,u.x),r=iy(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ry(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return b.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var sy=(e,t)=>{let n=Jv(e);return{name:n.name,fn:n.fn,options:[e,t]}},cy=(e,t)=>{let n=Yv(e);return{name:n.name,fn:n.fn,options:[e,t]}},ly=(e,t)=>({fn:$v(e).fn,options:[e,t]}),uy=(e,t)=>{let n=Xv(e);return{name:n.name,fn:n.fn,options:[e,t]}},dy=(e,t)=>{let n=Zv(e);return{name:n.name,fn:n.fn,options:[e,t]}},fy=(e,t)=>{let n=Qv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(Gg(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},py=o((e=>{var t=f();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})),my=o(((e,t)=>{t.exports=py()})),hy=o((e=>{var t=f(),n=my();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}})),gy=o(((e,t)=>{t.exports=hy()})),_y=[],vy=void 0;function yy(){return vy}function by(e){_y.push(e)}function xy(e){let t=(t,n)=>{let r=Ip(Cy).current,i;try{vy=r;for(let e of _y)e.before(r);i=e(t,n);for(let e of _y)e.after(r);r.didInitialize=!0}finally{vy=void 0}return i};return t.displayName=e.displayName||e.name,t}function Sy(e){return b.forwardRef(xy(e))}function Cy(){return{didInitialize:!1}}var wy=my(),Ty=gy(),Ey=qg(19)?ky:Ay;function Dy(e,t,n,r,i){return Ey(e,t,n,r,i)}function Oy(e,t,n,r,i){let a=b.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,wy.useSyncExternalStore)(e.subscribe,a,a)}by({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,wy.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function ky(e,t,n,r,i){let a=yy();if(!a)return Oy(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 Ay(e,t,n,r,i){return(0,Ty.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var jy=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 Dy(this,e,t,n,r)}},My=class extends jy{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){b.useDebugValue(e),X(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;X(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;X(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){b.useDebugValue(e);let n=t!==void 0;X(()=>{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 b.useDebugValue(e),Dy(this,this.selectors[e],t,n,r)}useContextCallback(e,t){b.useDebugValue(e);let n=Z(t??Kp);this.context[e]=n}useStateSetter(e){let t=b.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)}})}},Ny={open:Q(e=>e.open),transitionStatus:Q(e=>e.transitionStatus),domReferenceElement:Q(e=>e.domReferenceElement),referenceElement:Q(e=>e.positionReference??e.referenceElement),floatingElement:Q(e=>e.floatingElement),floatingId:Q(e=>e.floatingId)},Py=class extends My{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:j_(),nested:n,triggerElements:i},Ny),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&lm(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function Fy(e,t=!1,n=!1){let[r,i]=b.useState(e&&t?`idle`:void 0),[a,o]=b.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),X(()=>{if(!e&&a&&r!==`ending`&&n){let e=Wp.request(()=>{i(`ending`)});return()=>{Wp.cancel(e)}}},[e,a,r,n]),X(()=>{if(!e||t)return;let n=Wp.request(()=>{i(void 0)});return()=>{Wp.cancel(n)}},[t,e]),X(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=Wp.request(()=>{i(`idle`)});return()=>{Wp.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}var Iy=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),Ly={[Iy.startingStyle]:``},Ry={[Iy.endingStyle]:``},zy={transitionStatus(e){return e===`starting`?Ly:e===`ending`?Ry:null}};function By(e,t=!1,n=!0){let r=Gp();return Z((i,a=null)=>{r.cancel();let o=B_(e);if(o==null)return;let s=o,c=()=>{T_.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=Iy.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function Vy(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=Z(i),o=By(r,n,!1);b.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}function Hy(e,t){let n=b.useRef(null),r=b.useRef(null);return b.useCallback(i=>{if(e!==void 0){if(n.current!==null){let e=n.current,i=r.current,a=t.context.triggerElements.getById(e);i&&a===i&&t.context.triggerElements.delete(e),n.current=null,r.current=null}i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i))}},[t,e])}function Uy(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Hy(e,n),o=Z(t=>{if(a(t),!t||!n.select(`open`))return;let i=n.select(`activeTriggerId`);if(i===e){n.update({activeTriggerElement:t,...r});return}i??n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return X(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function Wy(e){let t=e.useState(`open`);X(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function Gy(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=Fy(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=Z(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Vy({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var Ky=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function qy(){return new Py({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Ky,floatingId:``,syncOnly:!1,nested:!1,onOpenChange:void 0})}function Jy(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:qy(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Jp,inactiveTriggerProps:Jp,popupProps:Jp}}var Yy=Q(e=>e.triggerIdProp??e.activeTriggerId),Xy={open:Q(e=>e.openProp??e.open),mounted:Q(e=>e.mounted),transitionStatus:Q(e=>e.transitionStatus),floatingRootContext:Q(e=>e.floatingRootContext),preventUnmountingOnClose:Q(e=>e.preventUnmountingOnClose),payload:Q(e=>e.payload),activeTriggerId:Yy,activeTriggerElement:Q(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Q((e,t)=>t!==void 0&&Yy(e)===t),isOpenedByTrigger:Q((e,t)=>t!==void 0&&Yy(e)===t&&e.open),isMountedByTrigger:Q((e,t)=>t!==void 0&&Yy(e)===t&&e.mounted),triggerProps:Q((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Q(e=>e.popupProps),popupElement:Q(e=>e.popupElement),positionerElement:Q(e=>e.positionerElement)};function Zy(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Ug(),a=F_()!=null,o=Ip(()=>new Py({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ky,floatingId:i,syncOnly:!1,nested:a})).current;return X(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=ep(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Qy(e={}){let{nodeId:t,externalTree:n}=e,r=Zy(e),i=e.rootContext||r,a={reference:i.useState(`referenceElement`),floating:i.useState(`floatingElement`),domReference:i.useState(`domReferenceElement`)},[o,s]=b.useState(null),c=b.useRef(null),l=I_(n);X(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);let u=oy({...e,elements:{...a,...o&&{reference:o}}}),d=b.useCallback(e=>{let t=ep(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;s(t),u.refs.setReference(t)},[u.refs]),[f,p]=b.useState(void 0),[m,h]=b.useState(null);i.useSyncedValue(`referenceElement`,f??null);let g=ep(f)?f:null;i.useSyncedValue(`domReferenceElement`,f===void 0?a.domReference:g),i.useSyncedValue(`floatingElement`,m);let _=b.useCallback(e=>{(ep(e)||e===null)&&(c.current=e,p(e)),(ep(u.refs.reference.current)||u.refs.reference.current===null||e!==null&&!ep(e))&&u.refs.setReference(e)},[u.refs,p]),v=b.useCallback(e=>{h(e),u.refs.setFloating(e)},[u.refs]),y=b.useMemo(()=>({...u.refs,setReference:_,setFloating:v,setPositionReference:d,domReference:c}),[u.refs,_,v,d]),x=b.useMemo(()=>({...u.elements,domReference:a.domReference}),[u.elements,a.domReference]),S=i.useState(`open`),C=i.useState(`floatingId`),w=b.useMemo(()=>({...u,dataRef:i.context.dataRef,open:S,onOpenChange:i.setOpen,events:i.context.events,floatingId:C,refs:y,elements:x,nodeId:t,rootStore:i}),[u,y,x,t,i,S,C]);return X(()=>{i.context.dataRef.current.floatingContext=w;let e=l?.nodesRef.current.find(e=>e.id===t);e&&(e.context=w)}),b.useMemo(()=>({...u,context:w,refs:y,elements:x,rootStore:i}),[u,y,x,w,i])}function $y(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,i=Ug(),a=F_()!=null,o=t.useState(`open`),s=t.useState(`activeTriggerElement`),c=t.useState(n?`popupElement`:`positionerElement`),l=t.context.triggerElements,u=Ip(()=>new Py({open:o,transitionStatus:void 0,referenceElement:s,floatingElement:c,triggerElements:l,onOpenChange:r,floatingId:i,syncOnly:!0,nested:a})).current;return X(()=>{let e={open:o,floatingId:i,referenceElement:s,floatingElement:c};ep(s)&&(e.domReferenceElement=s),u.state.positionReference===u.state.referenceElement&&(e.positionReference=s),u.update(e)},[o,i,s,c,u]),u.context.onOpenChange=r,u.context.nested=a,u}var eb=kp&&Dp;function tb(e,t={}){let n=`rootStore`in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,delay:o}=t,s=b.useRef(!1),c=b.useRef(null),l=Vp(),u=b.useRef(!0);b.useEffect(()=>{let e=n.select(`domReferenceElement`);if(!a)return;let t=Zf(e);function r(){let e=n.select(`domReferenceElement`);!n.select(`open`)&&tp(e)&&e===eh(Pp(e))&&(s.current=!0)}function i(){u.current=!0}function o(){u.current=!1}return jm(bp(t,`blur`,r),eb&&bp(t,`keydown`,i,!0),eb&&bp(t,`pointerdown`,o,!0))},[n,a]),b.useEffect(()=>{if(!a)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=n.select(`domReferenceElement`);ep(e)&&(c.current=e,s.current=!0)}}return r.on(`openchange`,e),()=>{r.off(`openchange`,e)}},[r,a,n]);let d=b.useMemo(()=>({onMouseLeave(){s.current=!1,c.current=null},onFocus(e){let t=e.currentTarget;if(s.current){if(c.current===t)return;s.current=!1,c.current=null}let r=nh(e.nativeEvent);if(ep(r)){if(eb&&!e.relatedTarget){if(!u.current&&!oh(r))return}else if(!lh(r))return}let i=rh(e.relatedTarget,n.context.triggerElements),{nativeEvent:a,currentTarget:d}=e,f=typeof o==`function`?o():o;if(n.select(`open`)&&i||f===0||f===void 0){n.setOpen(!0,Dm(_m,a,d));return}l.start(f,()=>{s.current||n.setOpen(!0,Dm(_m,a,d))})},onBlur(e){s.current=!1,c.current=null;let t=e.relatedTarget,r=e.nativeEvent,a=ep(t)&&t.hasAttribute(wg(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let e=n.select(`domReferenceElement`),o=eh(Pp(e));!t&&o===e||th(i.current.floatingContext?.refs.floating.current,o)||th(e,o)||a||rh(t??o,n.context.triggerElements)||n.setOpen(!1,Dm(_m,r))})}}),[i,n,l,o]);return b.useMemo(()=>a?{reference:d,trigger:d}:{},[a,d])}var nb=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Bp,this.restTimeout=new Bp,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},rb=new WeakMap;function ib(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&rb.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),rb.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function ab(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=rb.get(n);a&&a!==e&&ib(a),ib(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,rb.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function ob(e){let t=Ip(nb.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||=t,Rp(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function sb(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:c=0,nodeId:l}=t,u=ob(n),d=I_(),f=F_(),p=Z(()=>pm(o.current.openEvent?.type,u.interactedInside)),m=Z(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),h=Z(e=>rh(e,n.context.triggerElements)),g=b.useCallback(e=>{let t=dm(c,`close`,u.pointerType),r=()=>{n.setOpen(!1,Dm(gm,e)),d?.events.emit(`floating.closed`,e)};t?u.openChangeTimeout.start(t,r):(u.openChangeTimeout.clear(),r())},[c,n,u,d]),_=Z(()=>{ib(u)}),v=Z(e=>{let t=nh(e);if(!sh(t)){u.interactedInside=!1;return}u.interactedInside=t?.closest(`[aria-haspopup]`)!=null});X(()=>{r||(u.pointerType=void 0,u.restTimeoutPending=!1,u.interactedInside=!1,_())},[r,u,_]),b.useEffect(()=>_,[_]),X(()=>{if(s&&r&&u.handleCloseOptions?.blockPointerEvents&&m()&&ep(a)&&i){let e=a,t=i,n=Pp(i),r=d?.nodesRef.current.find(e=>e.id===f)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),ab(u,{scopeElement:u.handleCloseOptions?.getScope?.()??u.pointerEventsScopeElement??r??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{_()}}},[s,r,a,i,u,m,d,f,_]);let y=Vp();b.useEffect(()=>{if(!s)return;function e(){u.openChangeTimeout.clear(),y.clear(),d?.events.off(`floating.closed`,r),_()}function t(e){if(d&&f&&Sg(d.nodesRef.current,f).length>0){d.events.on(`floating.closed`,r);return}if(h(e.relatedTarget))return;let t=o.current.floatingContext?.nodeId??l,n=e.relatedTarget;if(!(d&&t&&ep(n)&&Sg(d.nodesRef.current,t,!1).some(e=>th(e.context?.elements.floating,n)))){if(u.handler){u.handler(e);return}_(),p()||g(e)}}function r(e){!d||!f||Sg(d.nodesRef.current,f).length>0||y.start(0,()=>{d.events.off(`floating.closed`,r),n.setOpen(!1,Dm(gm,e)),d.events.emit(`floating.closed`,e)})}let a=i;return jm(a&&bp(a,`mouseenter`,e),a&&bp(a,`mouseleave`,t),a&&bp(a,`pointerdown`,v,!0),()=>{d?.events.off(`floating.closed`,r)})},[s,i,n,o,l,p,h,g,_,v,u,d,f,y])}var cb={current:null};function lb(e,t={}){let n=`rootStore`in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:d=cb,externalTree:f,isActiveTrigger:p=!0,getHandleCloseContext:m,isClosing:h}=t,g=I_(f),_=ob(n),v=b.useRef(!1),y=Rm(s),x=Rm(o),S=Rm(l),C=Rm(a),w=Rm(h);p&&(_.handleCloseOptions=y.current?.__options);let T=Z(()=>pm(r.current.openEvent?.type,_.interactedInside)),E=Z(e=>rh(e,n.context.triggerElements)),D=Z((e,t,r)=>{let i=n.context.triggerElements;if(i.hasElement(t))return!e||!th(e,t);if(!ep(r))return!1;let a=r;return i.hasMatchingElement(e=>th(e,a))&&(!e||!th(e,a))}),O=Z((e,t=!0)=>{let r=dm(x.current,`close`,_.pointerType);r?_.openChangeTimeout.start(r,()=>{n.setOpen(!1,Dm(gm,e)),g?.events.emit(`floating.closed`,e)}):t&&(_.openChangeTimeout.clear(),n.setOpen(!1,Dm(gm,e)),g?.events.emit(`floating.closed`,e))}),k=Z(()=>{_.handler&&=(Pp(n.select(`domReferenceElement`)).removeEventListener(`mousemove`,_.handler),void 0)}),A=Z(()=>{ib(_)});return b.useEffect(()=>k,[k]),b.useEffect(()=>{if(!a)return;function e(e){e.open?v.current=!1:(v.current=e.reason===gm,k(),_.openChangeTimeout.clear(),_.restTimeout.clear(),_.blockMouseMove=!0,_.restTimeoutPending=!1)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[a,i,_,k]),b.useEffect(()=>{if(!a)return;let e=d.current??(p?n.select(`domReferenceElement`):null);if(!ep(e))return;function t(e){if(_.openChangeTimeout.clear(),_.blockMouseMove=!1,c&&!cm(_.pointerType))return;let t=fm(S.current),r=dm(x.current,`open`,_.pointerType),i=nh(e),a=e.currentTarget??null,o=n.select(`domReferenceElement`),s=a;if(ep(i)&&!n.context.triggerElements.hasElement(i)){for(let e of n.context.triggerElements.elements())if(th(e,i)){s=e;break}}ep(a)&&ep(o)&&!n.context.triggerElements.hasElement(a)&&th(a,o)&&(s=o);let l=s==null?!1:D(o,s,i),u=n.select(`open`),d=w.current?.()??n.select(`transitionStatus`)===`ending`,f=!u&&d&&v.current,p=!l&&ep(s)&&ep(o)&&th(o,s)&&f,m=t>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){n.setOpen(!0,Dm(gm,e,s));return}m||(r?_.openChangeTimeout.start(r,()=>{g&&n.setOpen(!0,Dm(gm,e,s))}):g&&n.setOpen(!0,Dm(gm,e,s)))}function i(e){if(T()){A();return}k();let t=Pp(n.select(`domReferenceElement`));_.restTimeout.clear(),_.restTimeoutPending=!1;let i=r.current.floatingContext??m?.();if(!E(e.relatedTarget)){if(y.current&&i){n.select(`open`)||_.openChangeTimeout.clear();let r=d.current;_.handler=y.current({...i,tree:g,x:e.clientX,y:e.clientY,onClose(){A(),k(),C.current&&!T()&&r===n.select(`domReferenceElement`)&&O(e,!0)}}),t.addEventListener(`mousemove`,_.handler),_.handler(e);return}(_.pointerType!==`touch`||!th(n.select(`floatingElement`),e.relatedTarget))&&O(e)}}return u?jm(bp(e,`mousemove`,t,{once:!0}),bp(e,`mouseenter`,t),bp(e,`mouseleave`,i)):jm(bp(e,`mouseenter`,t),bp(e,`mouseleave`,i))},[k,A,r,x,O,n,a,y,_,p,D,T,E,c,u,S,d,g,C,m,w]),b.useMemo(()=>{if(!a)return;function e(e){_.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`),a=n.select(`open`),o=D(i,r,e.target);if(c&&!cm(_.pointerType))return;if(a&&o&&_.handleCloseOptions?.blockPointerEvents){let e=n.select(`floatingElement`);e&&ab(_,{scopeElement:_.handleCloseOptions?.getScope?.()??r.ownerDocument.body,referenceElement:r,floatingElement:e})}let s=fm(S.current);if(a&&!o||s===0||!o&&_.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;_.restTimeout.clear();function l(){if(_.restTimeoutPending=!1,T())return;let e=n.select(`open`);!_.blockMouseMove&&(!e||o)&&n.setOpen(!0,Dm(gm,t,r))}_.pointerType===`touch`?T_.flushSync(()=>{l()}):o&&a?l():(_.restTimeoutPending=!0,_.restTimeout.start(s,l))}}},[a,_,T,D,c,n,S])}function ub(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=b.useCallback(t=>db(t,e,`reference`),t),o=b.useCallback(t=>db(t,e,`floating`),n),s=b.useCallback(t=>db(t,e,`item`),r),c=b.useCallback(t=>db(t,e,`trigger`),i);return b.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function db(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[Jm]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&fb(a,s,i,r)}return fb(a,e,i,r),a}function fb(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var pb=`Escape`;function mb(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function hb(e,t){return mb(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function gb(e,t,n){return mb(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function _b(e,t,n){return mb(t,n?e===Xm:e===Zm,e===$m)}function vb(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===pb:mb(t,n?e===Zm:e===Xm,e===Qm)}function yb(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:s,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:h=!1,virtual:g=!1,focusItemOnOpen:_=`auto`,focusItemOnHover:v=!0,openOnArrowKeyDown:y=!0,disabledIndices:x=void 0,orientation:S=`vertical`,parentOrientation:C,cols:w=1,id:T,resetOnPointerLeave:E=!0,externalTree:D}=t,O=Rm(uh(i)),k=F_(),A=I_(D);X(()=>{o.current.orientation=S},[o,S]);let j=ch(a),M=b.useRef(_),N=b.useRef(d??-1),P=b.useRef(null),F=b.useRef(!0),I=Z(e=>{l(N.current===-1?null:N.current,e)}),L=b.useRef(I),ee=b.useRef(!!i),R=b.useRef(r),te=b.useRef(!1),z=b.useRef(!1),B=b.useRef(null),V=Rm(x),H=Rm(r),ne=Rm(d),U=Rm(E),re=Z(()=>{function e(e){g?A?.events.emit(`virtualfocus`,e):B.current=Eg(e,{sync:te.current,preventScroll:!0})}let t=s.current[N.current],n=z.current;t&&e(t),(te.current?e=>e():requestAnimationFrame)(()=>{let r=s.current[N.current]||t;r&&(t||e(r),oe&&(n||!F.current)&&r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});X(()=>{u&&(r&&i?(N.current=d??-1,M.current&&d!=null&&(z.current=!0,I())):ee.current&&(N.current=-1,L.current()))},[u,r,i,d,I]),X(()=>{if(u){if(!r){te.current=!1;return}if(i)if(c==null){if(te.current=!1,ne.current!=null)return;if(ee.current&&(N.current=-1,re()),(!R.current||!ee.current)&&M.current&&(P.current!=null||M.current===!0&&P.current==null)){let e=0,t=()=>{s.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(N.current=P.current==null||gb(P.current,S,h)||m?Vh(s):Hh(s),P.current=null,I())};t()}}else Bh(s.current,c)||(N.current=c,re(),z.current=!1)}},[u,r,i,c,ne,m,s,S,h,I,re,V]),X(()=>{if(!u||i||!A||g||!ee.current)return;let e=A.nodesRef.current,t=e.find(e=>e.id===k)?.context?.elements.floating,n=eh(Pp(i)),r=e.some(e=>e.context&&th(e.context.elements.floating,n));t&&!r&&F.current&&t.focus({preventScroll:!0})},[u,i,A,k,g]),X(()=>{L.current=I,R.current=r,ee.current=!!i}),X(()=>{r||(P.current=null,M.current=_)},[r,_]);let ie=c!=null,ae=Z(e=>{if(!H.current)return;let t=s.current.indexOf(e.currentTarget);t!==-1&&(N.current!==t||c!==t)&&(N.current=t,I(e))}),oe=b.useMemo(()=>({onFocus(e){te.current=!0,ae(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){te.current=!0,z.current=!1,v&&ae(e)},onPointerLeave(e){if(!H.current||!F.current||e.pointerType===`touch`)return;te.current=!0;let t=e.relatedTarget;if(!(!v||s.current.includes(t))&&U.current&&(B.current?.(),B.current=null,N.current=-1,I(e),!g)){let e=O.current,t=eh(Pp(e));e&&th(e,t)&&e.focus({preventScroll:!0})}}}),[ae,H,O,v,s,I,U,g]),se=b.useCallback(()=>C??A?.nodesRef.current.find(e=>e.id===k)?.context?.dataRef?.current.orientation,[k,A,C]),ce=Z(e=>{if(F.current=!1,te.current=!0,e.which===229||!H.current&&e.currentTarget===O.current)return;if(m&&vb(e.key,S,h,w)){hb(e.key,se())||im(e),n.setOpen(!1,Dm(Sm,e.nativeEvent)),tp(a)&&(g?A?.events.emit(`virtualfocus`,a):a.focus());return}let t=N.current,i=Vh(s,x),o=Hh(s,x);if(j||(e.key===`Home`&&(im(e),N.current=i,I(e)),e.key===`End`&&(im(e),N.current=o,I(e))),w>1){let t=Array.from({length:s.current.length},()=>({width:1,height:1})),n=Gh(t,w,!1),r=n.findIndex(e=>e!=null&&!Jh(s.current,e,x)),a=n.reduce((e,t,n)=>t!=null&&!Jh(s.current,t,x)?n:e,-1),c=n[Wh(n.map(e=>e==null?null:s.current[e]),{event:e,orientation:S,loopFocus:p,rtl:h,cols:w,disabledIndices:qh([...(typeof x==`function`?null:x)||s.current.map((e,t)=>Jh(s.current,t,x)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:Kh(N.current>o?i:N.current,t,n,w,e.key===`ArrowDown`?`bl`:e.key===(h?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(N.current=c,I(e)),S===`both`)return}if(hb(e.key,S)){if(im(e),r&&!g&&eh(e.currentTarget.ownerDocument)===e.currentTarget){N.current=gb(e.key,S,h)?i:o,I(e);return}gb(e.key,S,h)?p?t>=o?f&&t!==s.current.length?N.current=-1:(te.current=!1,N.current=i):N.current=Uh(s.current,{startingIndex:t,disabledIndices:x}):N.current=Math.min(o,Uh(s.current,{startingIndex:t,disabledIndices:x})):p?t<=i?f&&t!==-1?N.current=s.current.length:(te.current=!1,N.current=o):N.current=Uh(s.current,{startingIndex:t,decrement:!0,disabledIndices:x}):N.current=Math.max(i,Uh(s.current,{startingIndex:t,decrement:!0,disabledIndices:x})),Bh(s.current,N.current)&&(N.current=-1),I(e)}}),le=b.useMemo(()=>g&&r&&ie&&{"aria-activedescendant":`${T}-${c}`},[g,r,ie,T,c]),ue=b.useMemo(()=>({"aria-orientation":S===`both`?void 0:S,...j?{}:le,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!g){let t=nh(e.nativeEvent);if(t&&!th(O.current,t))return;im(e),n.setOpen(!1,Dm(bm,e.nativeEvent)),tp(a)&&a.focus();return}ce(e)},onPointerMove(){F.current=!0}}),[le,ce,O,S,j,n,r,g,a]),de=b.useMemo(()=>{function e(e){_===`auto`&&om(e.nativeEvent)&&(M.current=!g)}function t(e){M.current=_,_===`auto`&&sm(e.nativeEvent)&&(M.current=!0)}return{onKeyDown(e){let t=n.select(`open`);F.current=!1;let r=e.key.startsWith(`Arrow`),i=_b(e.key,se(),h),a=hb(e.key,S),o=(m?i:a)||e.key===`Enter`||e.key.trim()===``;if(g&&t)return ce(e);if(!(!t&&!y&&r)){if(o){let t=hb(e.key,se());P.current=m&&t?null:e.key}if(m){i&&(im(e),t?(N.current=Vh(s,V.current),I(e)):n.setOpen(!0,Dm(Sm,e.nativeEvent,e.currentTarget)));return}a&&(ne.current!=null&&(N.current=ne.current),im(e),!t&&y?n.setOpen(!0,Dm(Sm,e.nativeEvent,e.currentTarget)):ce(e),t&&I(e))}},onFocus(e){n.select(`open`)&&!g&&(N.current=-1,I(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[ce,V,_,s,m,I,n,y,S,se,h,ne,g]),fe=b.useMemo(()=>({...le,...de}),[le,de]);return b.useMemo(()=>u?{reference:fe,floating:ue,item:oe,trigger:de}:{},[u,fe,ue,de,oe])}var bb=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function xb(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{role:s=`dialog`}=t,c=Ug(),l=a?.id||c,u=b.useMemo(()=>uh(o)?.id||i,[o,i]),d=bb.get(s)??s,f=F_()!=null,p=b.useMemo(()=>d===`tooltip`||s===`label`?Jp:{"aria-haspopup":d===`alertdialog`?`dialog`:d,"aria-expanded":`false`,...d===`listbox`&&{role:`combobox`},...d===`menu`&&f&&{role:`menuitem`},...s===`select`&&{"aria-autocomplete":`none`},...s===`combobox`&&{"aria-autocomplete":`list`}},[d,f,s]),m=b.useMemo(()=>d===`tooltip`||s===`label`?{[`aria-${s===`label`?`labelledby`:`describedby`}`]:r?u:void 0}:{...p,"aria-expanded":r?`true`:`false`,"aria-controls":r?u:void 0,...d===`menu`&&{id:l}},[d,u,r,l,s,p]),h=b.useMemo(()=>{let e={id:u,...d&&{role:d}};return d===`tooltip`||s===`label`?e:{...e,...d===`menu`&&{"aria-labelledby":l}}},[d,u,l,s]),g=b.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${u}-fui-option`}};switch(s){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[u,s]);return b.useMemo(()=>({reference:m,floating:h,item:g,trigger:p}),[m,h,p,g])}function Sb(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,i=n.useState(`open`),{listRef:a,elementsRef:o,activeIndex:s,onMatch:c,onTypingChange:l,enabled:u=!0,resetMs:d=750,selectedIndex:f=null}=t,p=Vp(),m=b.useRef(``),h=b.useRef(f??s??-1),g=b.useRef(null);X(()=>{!i&&f!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[i,f,p]),X(()=>{i&&m.current===``&&(h.current=f??s??-1)},[i,f,s]);let _=Z(e=>{e?r.current.typing||(r.current.typing=e,l?.(e)):r.current.typing&&(r.current.typing=e,l?.(e))}),v=Z(e=>{function t(e){let t=o?.current[e];return!t||Xh(t)}function n(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let r=a.current;if(m.current.length>0&&e.key===` `&&(im(e),_(!0)),m.current.length>0&&m.current[0]!==` `&&n(r,m.current)===-1&&e.key!==` `&&_(!1),r==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;i&&e.key!==` `&&(im(e),_(!0));let l=m.current===``;l&&(h.current=f??s??-1),r.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(d,()=>{m.current=``,h.current=g.current,_(!1)});let u=((l?f??s??-1:h.current)??0)+1,v=n(r,m.current,u);v===-1?e.key!==` `&&(m.current=``,_(!1)):(c?.(v),g.current=v)}),y=Z(e=>{let t=e.relatedTarget,r=n.select(`domReferenceElement`),i=n.select(`floatingElement`),a=th(r,t),o=th(i,t);a||o||(p.clear(),m.current=``,h.current=g.current,_(!1))}),x=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]),S=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return b.useMemo(()=>u?{reference:x,floating:S}:{},[u,x,S])}var Cb=.1,wb=Cb*Cb,Tb=.5;function Eb(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Db(e,t,n,r,i,a,o,s,c,l){let u=!1;return Eb(e,t,n,r,i,a)&&(u=!u),Eb(e,t,i,a,o,s)&&(u=!u),Eb(e,t,o,s,c,l)&&(u=!u),Eb(e,t,c,l,n,r)&&(u=!u),u}function Ob(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function kb(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Ab(e={}){let{blockPointerEvents:t=!1}=e,n=new Bp,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*wb;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=nh(r),g=r.type===`mouseleave`,_=th(u,h),v=th(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&ep(r.relatedTarget)&&th(u,r.relatedTarget))return;function y(){return!!(s&&Sg(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=kb(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=kb(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=kb(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=kb(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!Ob(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Tb/2:Tb*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Tb+1,o=C||T?S.bottom-Tb:S.top,s=C?T?S.bottom-Tb:S.top:S.bottom-Tb;M=Db(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Tb/2:Tb*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Tb,o=C||T?S.top+Tb:S.bottom,s=C?T?S.top+Tb:S.bottom:S.top+Tb;M=Db(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Tb/2:Tb*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Tb+1,o=w||E?S.right-Tb:S.left,s=w?E?S.right-Tb:S.left:S.right-Tb;M=Db(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Tb/2:Tb*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Tb,o=w||E?S.left+Tb:S.right,s=w?E?S.left+Tb:S.right:S.left+Tb;M=Db(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function jb(e){let t=b.useRef(``),n=b.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:b.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Mb(e,t){let n=b.useRef(e),r=Z(t);X(()=>{n.current!==e&&r(n.current)},[e,r]),X(()=>{n.current=e},[e])}function Nb(e){let[t,n]=b.useState(null),r=Z((t,r)=>{e||n(r||(Ep?`touch`:``))});Mb(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=jb(r);return b.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function Pb(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),s=t.useState(`modal`),c=t.useState(`popupElement`),{openMethod:l,triggerProps:u}=Nb(a);Wy(t);let{forceUnmount:d}=Gy(a,t),f=b.useCallback(()=>{t.setOpen(!1,Dm(Tm))},[t]);b.useImperativeHandle(r,()=>({unmount:d,close:f}),[d,f]);let p=$y({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[m,h]=b.useState(0),[g,_]=b.useState(0),v=m===0,y=xb(p),x=rv(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:s===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=nh(e);if(v&&!o){let e=n;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||th(e,c)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:v});rm(a&&s===!0,c);let{getReferenceProps:S,getFloatingProps:C,getTriggerProps:w}=ub([y,x]);t.useContextCallback(`onNestedDialogOpen`,(e,t)=>{h(e),_(t)}),t.useContextCallback(`onNestedDialogClose`,()=>{h(0),_(0)}),b.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(m+1,g+ +!!i),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,m,g,n]);let T=b.useMemo(()=>S(u),[S,u]),E=b.useMemo(()=>w(u),[w,u]),D=b.useMemo(()=>C(),[C]);t.useSyncedValues({openMethod:l,activeTriggerProps:T,inactiveTriggerProps:E,popupProps:D,floatingRootContext:p,nestedOpenDialogCount:m,nestedOpenDrawerCount:g})}var Fb=b.createContext(void 0);function Ib(e){let t=b.useContext(Fb);if(e===!1&&t===void 0)throw Error(Gg(27));return t}var Lb={...Xy,modal:Q(e=>e.modal),nested:Q(e=>e.nested),nestedOpenDialogCount:Q(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Q(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Q(e=>e.disablePointerDismissal),openMethod:Q(e=>e.openMethod),descriptionElementId:Q(e=>e.descriptionElementId),titleElementId:Q(e=>e.titleElementId),viewportElement:Q(e=>e.viewportElement),role:Q(e=>e.role)},Rb=class e extends My{constructor(e){super(zb(e),{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new Ky,onOpenChange:void 0,onOpenChangeComplete:void 0},Lb)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};static useStore(t,n){let r=Ip(()=>new e(n)).current;return t??r}};function zb(e={}){return{...Jy(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}var Bb=b.createContext(!1);function Vb(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:o,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Ib(!0),d=!!u,f=Rb.useStore(s?.store,{open:r,openProp:n,activeTriggerId:l,triggerIdProp:c,modal:!0,disablePointerDismissal:!0,nested:d,role:`alertdialog`});f.useControlledProp(`openProp`,n),f.useControlledProp(`triggerIdProp`,c),f.useSyncedValue(`nested`,d),f.useContextCallback(`onOpenChange`,i),f.useContextCallback(`onOpenChangeComplete`,a);let p=f.useState(`payload`);Pb({store:f,actionsRef:o,parentContext:u?.store.context,isDrawer:!1,onOpenChange:i,triggerIdProp:c});let m=b.useMemo(()=>({store:f}),[f]);return(0,y.jsx)(Bb.Provider,{value:!1,children:(0,y.jsx)(Fb.Provider,{value:m,children:typeof t==`function`?t({payload:p}):t})})}var Hb=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Iy.startingStyle]=`startingStyle`,e[e.endingStyle=Iy.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),Ub=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),Wb={[Ub.popupOpen]:``},Gb={[Ub.popupOpen]:``,[Ub.pressed]:``},Kb={[Hb.open]:``},qb={[Hb.closed]:``},Jb={[Hb.anchorHidden]:``},Yb={open(e){return e?Wb:null}},Xb={open(e){return e?Gb:null}},Zb={open(e){return e?Kb:qb},anchorHidden(e){return e?Jb:null}},Qb={...Zb,...zy},$b=b.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=Ib(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return m_(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Qb,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),ex=b.createContext(void 0);function tx(e=!1){let t=b.useContext(ex);if(t===void 0&&!e)throw Error(Gg(16));return t}function nx(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:b.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 rx(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=b.useRef(null),s=tx(!0),c=a??s!==void 0,{props:l}=nx({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=b.useCallback(()=>{let e=o.current;ix(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return X(u,[u]),{getButtonProps:b.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return e_({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(d_(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=ix(a),l=!i&&ax(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(d_(e),a?.(e),e.target===e.currentTarget&&i&&c&&ix(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?void 0:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Z(e=>{o.current=e,u()})}}function ix(e){return tp(e)&&e.tagName===`BUTTON`}function ax(e){return!!(e?.tagName===`A`&&e?.href)}function ox(e){return Ug(e,`base-ui`)}var sx=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Ib(),c=ox(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),m_(`p`,e,{ref:t,props:[{id:c},o]})}),cx=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),lx=function(e){return e[e.open=Hb.open]=`open`,e[e.closed=Hb.closed]=`closed`,e[e.startingStyle=Hb.startingStyle]=`startingStyle`,e[e.endingStyle=Hb.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),ux=b.createContext(void 0);function dx(){let e=b.useContext(ux);if(e===void 0)throw Error(Gg(26));return e}var fx=`ArrowUp`,px=`ArrowDown`,mx=`ArrowLeft`,hx=`ArrowRight`,gx=`Home`,_x=new Set([mx,hx]),vx=new Set([fx,px]),yx=new Set([..._x,...vx]);new Set([...yx,gx,`End`]);var bx=new Set([fx,px,mx,hx,gx,`End`]),xx={...Zb,...zy,nestedDialogOpen(e){return e?{[lx.nestedDialogOpen]:``}:null}},Sx=b.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,style:o,...s}=e,{store:c}=Ib(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),b=c.useState(`titleElementId`),x=c.useState(`transitionStatus`),S=c.useState(`role`);dx(),Vy({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?c.context.popupRef.current:!0}let w=i===void 0?C:i,T=m_(`div`,e,{state:{open:_,nested:h,transitionStatus:x,nestedDialogOpen:g>0},props:[f,{"aria-labelledby":b??void 0,"aria-describedby":l??void 0,role:S,tabIndex:-1,hidden:!m,onKeyDown(e){bx.has(e.key)&&e.stopPropagation()},style:{[cx.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,c.useStateSetter(`popupElement`)],stateAttributesMapping:xx});return(0,y.jsx)(Y_,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:r,modal:p!==!1,restoreFocus:`popup`,children:T})});function Cx(e){return qg(19)?e:e?`true`:void 0}var wx=b.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,y.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),Tx=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Ib(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,y.jsx)(ux.Provider,{value:n,children:(0,y.jsxs)(A_,{ref:t,...r,children:[a&&o===!0&&(0,y.jsx)(wx,{ref:i.context.internalBackdropRef,inert:Cx(!s)}),e.children]})}):null}),Ex=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Ib(),c=ox(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),m_(`h2`,e,{ref:t,props:[{id:c},o]})}),Dx=`border border-border/60 bg-background/70 text-muted-foreground shadow-xs ring-0 backdrop-blur-md`,Ox=`duration-150 ease-snappy data-closed:duration-100 data-closed:fade-out-0 data-closed:zoom-out-95 data-closed:blur-out-[5px] data-closed:slide-out-to-top-2 data-open:fade-in-0 data-open:zoom-in-95 data-open:blur-in-[5px] data-open:slide-in-from-top-2`,kx=`fixed inset-0 isolate z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs`,Ax=`duration-150 ease-snappy data-closed:duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,jx=`border border-border/60 bg-background/90 text-foreground shadow-lg ring-0`,Mx=`duration-150 ease-snappy data-closed:duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,Nx=`absolute inset-0 bg-black/10 supports-backdrop-filter:backdrop-blur-xs transition-[opacity,backdrop-filter] duration-150 ease-snappy data-[closed]:opacity-0 data-[open]:opacity-100`,Px=`transition-[opacity,transform] duration-150 ease-snappy data-[closed]:opacity-0 data-[closed]:scale-95 data-[open]:opacity-100 data-[open]:scale-100`,Fx=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=rx({disabled:i,focusableWhenDisabled:a,native:o});return m_(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),Ix=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Lx=xd,Rx=(e,t)=>n=>{if(t?.variants==null)return Lx(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Ix(t)||Ix(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Lx(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},zx=Rx(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5`,lg:`h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-9`,"icon-xs":`size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function Bx({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,y.jsx)(Fx,{"data-slot":`button`,className:qf(zx({variant:t,size:n,className:e})),...r})}function Vx({...e}){return(0,y.jsx)(Vb,{"data-slot":`alert-dialog`,...e})}function Hx({...e}){return(0,y.jsx)(Tx,{"data-slot":`alert-dialog-portal`,...e})}function Ux({className:e,...t}){return(0,y.jsx)($b,{"data-slot":`alert-dialog-overlay`,className:qf(kx,Ax,e),...t})}function Wx({className:e,size:t=`default`,...n}){return(0,y.jsxs)(Hx,{children:[(0,y.jsx)(Ux,{}),(0,y.jsx)(Sx,{"data-slot":`alert-dialog-content`,"data-size":t,className:qf(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-popover-foreground outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg`,jx,Mx,e),...n})]})}function Gx({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:qf(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Kx({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:qf(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function qx({className:e,...t}){return(0,y.jsx)(Ex,{"data-slot":`alert-dialog-title`,className:qf(`font-heading text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Jx({className:e,...t}){return(0,y.jsx)(sx,{"data-slot":`alert-dialog-description`,className:qf(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Yx({className:e,...t}){return(0,y.jsx)(Bx,{"data-slot":`alert-dialog-action`,className:qf(e),...t})}function Xx(e){return m_(e.defaultTagName??`div`,e,e)}var Zx=Rx(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function Qx({className:e,variant:t=`default`,render:n,...r}){return Xx({defaultTagName:`span`,props:e_({className:qf(Zx({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var $x=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}({}),eS={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},tS={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},nS={disabled:!1,...tS},rS={valid(e){return e===null?null:e?{[$x.valid]:``}:{[$x.invalid]:``}}},iS=b.createContext({invalid:void 0,name:void 0,validityData:{state:eS,errors:[],error:``,value:``,initialValue:null},setValidityData:Kp,disabled:void 0,touched:tS.touched,setTouched:Kp,dirty:tS.dirty,setDirty:Kp,filled:tS.filled,setFilled:Kp,focused:tS.focused,setFocused:Kp,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:nS,markedDirtyRef:{current:!1},registerFieldControl:Kp,validation:{getValidationProps:(e=Jp)=>e,getInputValidationProps:(e=Jp)=>e,inputRef:{current:null},commit:async()=>{}}});function aS(e=!0){let t=b.useContext(iS);if(t.setValidityData===Kp&&!e)throw Error(Gg(28));return t}var oS=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Kp,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function sS(){return b.useContext(oS)}var cS=b.createContext({controlId:void 0,registerControlId:Kp,labelId:void 0,setLabelId:Kp,messageIds:[],setMessageIds:Kp,getDescriptionProps:e=>e});function lS(){return b.useContext(cS)}function uS(e,t,n,r=!0,i){let[a,o]=b.useState(),s=ox(i?`${i}-label`:void 0),c=e??t??a;return X(()=>{let i=e||t||!r?void 0:dS(n.current,s);a!==i&&o(i)}),c}function dS(e,t){let n=fS(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function fS(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function pS(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=lS(),o=ox(t),s=n?i:void 0,c=Ip(()=>Symbol(`labelable-control`)),l=b.useRef(!1),u=b.useRef(t!=null),d=Z(()=>{!l.current||a===Kp||(l.current=!1,a(c.current,void 0))});return X(()=>{if(a===Kp)return;let e;if(n){let n=r?.current;e=ep(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]),b.useEffect(()=>d,[d]),i??o}function mS({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=b.useRef(e!==void 0),[a,o]=b.useState(t);return[i?e:a,b.useCallback(e=>{i||o(e)},[])]}function hS(e,t){let{enabled:n=!0,getValue:r,id:i,value:a}=t,{registerFieldControl:o}=aS(),s=b.useRef(null);s.current||=Symbol(),X(()=>{let t=s.current;if(!(!t||!n))return o(t,{controlRef:e,getValue:r,id:i,value:a}),()=>{o(t,void 0)}},[e,n,r,i,o,a])}var gS=b.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:x,validationMode:S,validation:C}=aS(),w=h||s,T=m??a,E={...p,disabled:w},{labelId:D}=lS(),O=pS({id:i});X(()=>{let e=o!=null;C.inputRef.current?.value||e&&o!==``?x(!0):e&&o===``&&x(!1)},[C.inputRef,x,o]);let k=b.useRef(null);X(()=>{u&&k.current===eh(Pp(k.current))&&y(!0)},[u,y]);let[A]=mS({controlled:o,default:l,name:`FieldControl`,state:`value`}),j=o!==void 0,M=j?A:void 0,N=Z(()=>C.inputRef.current?.value);return hS(C.inputRef,{id:O,value:M,getValue:N}),m_(`input`,e,{ref:[t,k],state:E,props:[{id:O,disabled:w,name:T,ref:C.inputRef,"aria-labelledby":D,autoFocus:u,...j?{value:M}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,Dm(mm,e.nativeEvent)),_(t!==v.initialValue),x(t!==``)},onFocus(){y(!0)},onBlur(e){g(!0),y(!1),S===`onBlur`&&C.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(g(!0),C.commit(e.currentTarget.value))}},C.getInputValidationProps(),f],stateAttributesMapping:rS})}),_S=b.forwardRef(function(e,t){return(0,y.jsx)(gS,{ref:t,...e})});function vS({className:e,type:t,...n}){return(0,y.jsx)(_S,{type:t,"data-slot":`input`,className:qf(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function yS({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:qf(`group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var bS=Rx(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function xS({className:e,align:t=`inline-start`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:qf(bS({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var SS=Rx(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function CS({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,y.jsx)(Bx,{type:t,"data-size":r,variant:n,className:qf(SS({size:r}),e),...i})}function wS({className:e,...t}){return(0,y.jsx)(`span`,{className:qf(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function TS({className:e,...t}){return(0,y.jsx)(vS,{"data-slot":`input-group-control`,className:qf(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}function ES({className:e,...t}){return(0,y.jsx)(md,{role:`status`,"aria-label":`Loading`,className:qf(`spinner-line-fade size-4`,e),...t})}var DS=1e3,OS=1.2,kS=.1,AS=`localterm`,jS=`† `,MS=`npx @monotykamary/localterm@latest start`,NS=1500,PS=5e3,FS=.35,IS=`#ffc79944`,LS=`#ffc799`,RS=`#ff8080`,zS=`localterm:terminal-theme-id`,BS=`localterm:terminal-font-id`,VS=`localterm:terminal-font-size`,HS=`localterm:terminal-line-height`,US=`localterm:terminal-cursor-style`,WS=`localterm:terminal-cursor-blink`,GS=`localterm:terminal-scrollback`,KS=`localterm:terminal-scroll-on-user-input`,qS=`localterm:terminal-padding-x`,JS=`localterm:terminal-padding-y`,YS=`localterm-google-fonts`,XS=`localterm:nerd-font-enabled`,ZS=`flex w-full items-center gap-2.5 rounded-sm px-2.5 py-2 text-sm outline-none transition-colors`,QS=(e,t)=>{let n=t.toLowerCase(),r=e.toLowerCase();if(n===r)return 1;if(n.startsWith(r))return 2;if(n.includes(r))return 3;let i=eC(e,t);return i>0?4+(1-i/$S(e.length)):0},$S=e=>{let t=e;return t+=(e-1)*.5,t+=e*.5,t},eC=(e,t)=>{let n=e.toLowerCase(),r=t.toLowerCase(),i=0,a=0,o=-1;for(let e=0;e<r.length&&i<n.length;e++)r[e]===n[i]&&(a+=1,o===e-1&&(a+=.5),(e===0||r[e-1]===` `||r[e-1]===`-`)&&(a+=.5),o=e,i++);return i===n.length?a:0},tC=({open:e,onClose:t,commands:n})=>{let[r,i]=(0,b.useState)(``),[a,o]=(0,b.useState)(0),[s,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(!1),d=(0,b.useRef)(null),f=(0,b.useRef)(null),p=(0,b.useId)(),m=r?n.map(e=>({cmd:e,score:QS(r,e.label)})).filter(e=>e.score>0).sort((e,t)=>e.score-t.score).map(e=>e.cmd):n;(0,b.useEffect)(()=>{if(e){c(!0),i(``),o(0);let e=requestAnimationFrame(()=>u(!0));return()=>cancelAnimationFrame(e)}if(u(!1),s){let e=window.setTimeout(()=>c(!1),150);return()=>window.clearTimeout(e)}},[e]),(0,b.useEffect)(()=>{o(0)},[r]),(0,b.useEffect)(()=>{!e||m.length===0||(f.current?.children[a])?.scrollIntoView({block:`nearest`})},[a,m.length,e]),(0,b.useEffect)(()=>{if(!e||!s)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())};return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e,s,t]);let h=(0,b.useCallback)(()=>{let e=m[a];e&&(t(),e.action())},[a,m,t]),g=(0,b.useCallback)(e=>{if(e.key===`ArrowDown`){e.preventDefault(),o(e=>(e+1)%Math.max(1,m.length));return}if(e.key===`ArrowUp`){e.preventDefault(),o(e=>(e-1+Math.max(1,m.length))%Math.max(1,m.length));return}if(e.key===`Enter`){e.preventDefault(),h();return}},[h,m.length]);if(!s)return null;let _=e&&l;return(0,y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[18vh]`,children:[(0,y.jsx)(`div`,{"data-open":_||void 0,"data-closed":!_||void 0,className:qf(Nx),onClick:t}),(0,y.jsxs)(`div`,{role:`dialog`,"aria-label":`command palette`,"aria-modal":!0,"data-open":_||void 0,"data-closed":!_||void 0,className:qf(`relative z-10 w-[460px] max-h-[360px] flex flex-col overflow-hidden rounded-xl`,jx,Px),children:[(0,y.jsxs)(`div`,{className:`flex items-center border-b border-border/40 px-3`,children:[(0,y.jsx)(vd,{className:`size-4 shrink-0 text-muted-foreground/60`}),(0,y.jsx)(`input`,{ref:d,autoFocus:!0,type:`text`,value:r,onChange:e=>i(e.target.value),onKeyDown:g,placeholder:`Type a command…`,"aria-label":`search commands`,"aria-activedescendant":m[a]?`${p}-${m[a].id}`:void 0,"aria-controls":p,"aria-expanded":!0,"aria-haspopup":`listbox`,role:`combobox`,className:`h-10 w-full bg-transparent px-2.5 text-sm text-foreground outline-none placeholder:text-muted-foreground/70`})]}),(0,y.jsx)(`div`,{ref:f,id:p,role:`listbox`,className:`flex-1 overflow-y-auto overscroll-contain p-1.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:m.length===0?(0,y.jsx)(`div`,{className:`px-2.5 py-6 text-center text-sm text-muted-foreground/70`,children:`No matching commands`}):m.map((e,n)=>(0,y.jsxs)(`button`,{id:`${p}-${e.id}`,type:`button`,role:`option`,"aria-selected":n===a,className:qf(ZS,n===a&&`bg-foreground/10 text-foreground`),onMouseEnter:()=>o(n),onClick:()=>{t(),e.action()},children:[e.icon?(0,y.jsx)(`span`,{className:`shrink-0 text-muted-foreground/70`,children:e.icon}):(0,y.jsx)(`span`,{className:`w-4 shrink-0`}),(0,y.jsx)(`span`,{className:`flex-1 text-left`,children:e.label}),e.shortcut?(0,y.jsx)(`kbd`,{className:`shrink-0 rounded border border-border/40 bg-muted/30 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground/70`,children:e.shortcut}):null]},e.id))})]})]})},nC=b.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return m_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function rC({className:e,orientation:t=`horizontal`,...n}){return(0,y.jsx)(nC,{"data-slot":`separator`,orientation:t,className:qf(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}var iC=Rx(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0`,vertical:`flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});function aC({className:e,orientation:t,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:qf(iC({orientation:t}),e),...n})}function oC({className:e,render:t,...n}){return Xx({defaultTagName:`div`,props:e_({className:qf(`flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e)},n),render:t,state:{slot:`button-group-text`}})}var sC=e=>String(e),cC=`size-7 rounded-none border-0 bg-transparent text-foreground hover:bg-foreground/10 hover:text-foreground disabled:opacity-30 [&_svg]:size-3.5`,lC=`h-7 min-w-[3rem] cursor-ew-resize touch-none justify-center border-y-0 border-r border-l! border-border/60 bg-transparent px-1.5 text-xs font-medium tabular-nums text-foreground select-none hover:bg-foreground/5 focus-visible:outline-none focus-visible:bg-foreground/5`,uC={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1},dC=({value:e,min:t,max:n,step:r,ariaLabel:i,decrementAriaLabel:a,incrementAriaLabel:o,formatDisplay:s=sC,onValueChange:c})=>{let l=(0,b.useRef)(null),u=(0,b.useRef)(e),d=t=>{if(t.button===0){try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}l.current=t.clientX,u.current=e}},f=e=>{let t=l.current;if(t===null)return;let n=e.clientX-t,i=Math.round(n/5);i!==0&&c(u.current+i*r)},p=e=>{if(l.current!==null){try{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}catch{}l.current=null}};return(0,y.jsxs)(aC,{"aria-label":i,className:`h-7 overflow-hidden rounded-md border border-border/60`,children:[(0,y.jsx)(Bx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e-r),disabled:e<=t,"aria-label":a,className:cC,children:(0,y.jsx)(hd,{})}),(0,y.jsx)(oC,{role:`slider`,tabIndex:0,"aria-label":i,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-valuetext":s(e),"aria-orientation":`horizontal`,title:`Drag or use arrow keys to adjust`,className:lC,onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p,onPointerLeave:e=>{if(l.current===null)return;let t=!1;try{t=e.currentTarget.hasPointerCapture(e.pointerId)}catch{}t||(l.current=null)},onKeyDown:i=>{if(i.key===`Home`){i.preventDefault(),c(t);return}if(i.key===`End`){i.preventDefault(),c(n);return}let a=uC[i.key];a!==void 0&&(i.preventDefault(),c(e+a*r))},children:s(e)}),(0,y.jsx)(Bx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e+r),disabled:e>=n,"aria-label":o,className:cC,children:(0,y.jsx)(_d,{})})]})};function fC(e){let[t,n]=b.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}var pC=b.createContext(null),mC=b.createContext(null);function hC(){let e=b.useContext(pC);if(e===null)throw Error(Gg(60));return e}function gC(){let e=b.useContext(mC);if(e===null)throw Error(Gg(61));return e}var _C=(e,t)=>Object.is(e,t);function vC(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function yC(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:vC(t,e,n))}function bC(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:vC(e,t,n))}function xC(e,t,n){return e.filter(e=>!vC(t,e,n))}function SC(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function CC(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function wC(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(CC(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function TC(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return SC(e)}function EC(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?SC(e.value):SC(e)}function DC(e,t,n){function r(){return TC(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=CC(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function OC(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,y.jsx)(b.Fragment,{children:DC(r,t,n)},i)),e),[])}var kC={id:Q(e=>e.id),labelId:Q(e=>e.labelId),modal:Q(e=>e.modal),multiple:Q(e=>e.multiple),items:Q(e=>e.items),itemToStringLabel:Q(e=>e.itemToStringLabel),itemToStringValue:Q(e=>e.itemToStringValue),isItemEqualToValue:Q(e=>e.isItemEqualToValue),value:Q(e=>e.value),hasSelectedValue:Q(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:EC(t,r)!==``}),hasNullItemLabel:Q((e,t)=>t?wC(e.items):!1),open:Q(e=>e.open),mounted:Q(e=>e.mounted),forceMount:Q(e=>e.forceMount),transitionStatus:Q(e=>e.transitionStatus),openMethod:Q(e=>e.openMethod),activeIndex:Q(e=>e.activeIndex),selectedIndex:Q(e=>e.selectedIndex),isActive:Q((e,t)=>e.activeIndex===t),isSelected:Q((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>vC(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:vC(n,i,r)}),isSelectedByFocus:Q((e,t)=>e.selectedIndex===t),popupProps:Q(e=>e.popupProps),triggerProps:Q(e=>e.triggerProps),triggerElement:Q(e=>e.triggerElement),positionerElement:Q(e=>e.positionerElement),listElement:Q(e=>e.listElement),scrollUpArrowVisible:Q(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Q(e=>e.scrollDownArrowVisible),hasScrollArrows:Q(e=>e.hasScrollArrows)};function AC(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function jC(e,t){return Math.max(0,e-t)}function MC(e,t){if(t<=0)return 0;let n=AC(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function NC(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:x=!1,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w=_C,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=sS(),{setDirty:O,setTouched:k,setFocused:A,shouldValidateOnChange:j,validityData:M,setFilled:N,name:P,disabled:F,validation:I,validationMode:L}=aS(),ee=pS({id:t}),R=F||d,te=P??c,[z,B]=mS({controlled:n,default:x?r??qp:r,name:`Select`,state:`value`}),[V,H]=mS({controlled:a,default:o,name:`Select`,state:`open`}),ne=b.useRef([]),U=b.useRef([]),re=b.useRef(null),ie=b.useRef(null),ae=b.useRef(0),oe=b.useRef(null),se=b.useRef([]),ce=b.useRef(!1),le=b.useRef(!1),ue=b.useRef(null),de=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),fe=b.useRef(!1),{mounted:pe,setMounted:me,transitionStatus:he}=Fy(V),{openMethod:ge,triggerProps:_e}=Nb(V),ve=Ip(()=>new jy({id:ee,labelId:void 0,modal:m,multiple:x,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,value:z,open:V,mounted:pe,transitionStatus:he,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ye=Dy(ve,kC.activeIndex),be=Dy(ve,kC.selectedIndex),xe=Dy(ve,kC.triggerElement),Se=Dy(ve,kC.positionerElement),Ce=fC(ge),we=ge??Ce,Te=b.useMemo(()=>x&&Array.isArray(z)&&z.length===0?``:EC(z,C),[x,z,C]),Ee=b.useMemo(()=>x&&Array.isArray(z)?z.map(e=>EC(e,C)):EC(z,C),[x,z,C]);hS(Rm(ve.state.triggerElement),{id:ee,value:z,getValue:Z(()=>Ee)});let De=b.useRef(z);X(()=>{z!==De.current&&ve.set(`forceMount`,!0)},[ve,z]),X(()=>{N(x?Array.isArray(z)&&z.length>0:z!=null)},[x,z,N]),X(function(){if(V)return;let e=se.current;if(x){let t=Array.isArray(z)?z:[];if(t.length===0){ve.set(`selectedIndex`,null);return}let n=t[t.length-1],r=bC(e,n,w);ve.set(`selectedIndex`,r===-1?null:r);return}let t=bC(e,z,w);ve.set(`selectedIndex`,t===-1?null:t)},[x,V,z,se,w,ve]),Mb(z,()=>{D(te),O(z!==M.initialValue),j()?I.commit(z):I.commit(z,!0)});let Oe=Z((e,t)=>{if(s?.(e,t),!t.isCanceled&&(H(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),L===`onBlur`&&I.commit(z)),!e&&ve.state.activeIndex!==null)){let e=ne.current[ve.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),ke=Z(()=>{me(!1),ve.update({activeIndex:null,openMethod:null}),_?.(!1)});Vy({enabled:!h,open:V,ref:re,onComplete(){V||ke()}}),b.useImperativeHandle(h,()=>({unmount:ke}),[ke]);let Ae=Z((e,t)=>{i?.(e,t),!t.isCanceled&&B(e)}),je=Z(()=>{let e=ve.state.listElement||re.current;if(!e)return;let t=jC(e.scrollHeight,e.clientHeight),n=MC(e.scrollTop,t),r=n>0,i=n<t;ve.state.scrollUpArrowVisible!==r&&ve.set(`scrollUpArrowVisible`,r),ve.state.scrollDownArrowVisible!==i&&ve.set(`scrollDownArrowVisible`,i)}),Me=Zy({open:V,onOpenChange:Oe,elements:{reference:xe,floating:Se}}),{getReferenceProps:Ne,getFloatingProps:Pe,getItemProps:Fe}=ub([X_(Me,{enabled:!f&&!R,event:`mousedown`}),rv(Me,{bubbles:!1}),yb(Me,{enabled:!f&&!R,listRef:ne,activeIndex:ye,selectedIndex:be,disabledIndices:qp,onNavigate(e){e===null&&!V||ve.set(`activeIndex`,e)},focusItemOnHover:T}),Sb(Me,{enabled:!f&&!R&&(V||!x),listRef:U,activeIndex:ye,selectedIndex:be,onMatch(e){V?ve.set(`activeIndex`,e):Ae(se.current[e],Dm(`none`))},onTypingChange(e){ce.current=e}})]),Ie=b.useMemo(()=>e_(Ne(),_e,ee?{id:ee}:Jp),[Ne,_e,ee]);Jf(()=>{ve.update({popupProps:Pe(),triggerProps:Ie})}),X(()=>{ve.update({id:ee,modal:m,multiple:x,value:z,open:V,mounted:pe,transitionStatus:he,popupProps:Pe(),triggerProps:Ie,items:v,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,openMethod:we})},[ve,ee,m,x,z,V,pe,he,Pe,Ie,v,S,C,w,we]);let Le=b.useMemo(()=>({store:ve,name:te,required:p,disabled:R,readOnly:f,multiple:x,highlightItemOnHover:T,setValue:Ae,setOpen:Oe,listRef:ne,popupRef:re,scrollHandlerRef:ie,handleScrollArrowVisibility:je,scrollArrowsMountedCountRef:ae,getItemProps:Fe,events:Me.context.events,valueRef:oe,valuesRef:se,labelsRef:U,typingRef:ce,selectionRef:de,selectedItemTextRef:ue,validation:I,onOpenChangeComplete:_,keyboardActiveRef:le,alignItemWithTriggerActiveRef:fe,initialValueRef:De}),[ve,te,p,R,f,x,T,Ae,Oe,Fe,Me.context.events,I,_,je]),Re=Mm(g,I.inputRef),ze=x&&Array.isArray(z)&&z.length>0,Be=x?void 0:te,Ve=b.useMemo(()=>!x||!Array.isArray(z)||!te?null:z.map(e=>{let t=EC(e,C);return(0,y.jsx)(`input`,{type:`hidden`,form:l,name:te,value:t},t)}),[x,z,l,te,C]);return(0,y.jsx)(pC.Provider,{value:Le,children:(0,y.jsxs)(mC.Provider,{value:Me,children:[E,(0,y.jsx)(`input`,{...I.getInputValidationProps({onFocus(){ve.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.currentTarget.value,n=Dm(mm,e.nativeEvent);function r(){if(x)return;let e=se.current.find(e=>EC(e,C).toLowerCase()===t.toLowerCase()||TC(e,S).toLowerCase()===t.toLowerCase());e!=null&&(O(e!==M.initialValue),Ae(e,n),j()&&I.commit(e))}ve.set(`forceMount`,!0),queueMicrotask(r)}}),id:ee&&Be==null?`${ee}-hidden-input`:void 0,form:l,name:Be,autoComplete:u,value:Te,disabled:R,required:p&&!ze,readOnly:f,ref:Re,style:te?Km:Gm,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ve]})})}function PC(e,t){return e??t}function FC(e){let t=e.getBoundingClientRect(),n=Zf(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var IC=2,LC=400,RC=200,zC={...Xb,...rS,value:()=>null},BC=b.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=aS(),{labelId:m}=lS(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=hC(),T=p||C||a,E=Dy(h,kC.open),D=Dy(h,kC.value),O=Dy(h,kC.triggerProps),k=Dy(h,kC.positionerElement),A=Dy(h,kC.listElement),j=Dy(h,kC.id),M=Dy(h,kC.labelId),N=Dy(h,kC.hasSelectedValue),P=!N&&E,F=Dy(h,kC.hasNullItemLabel,P),I=i??j,L=PC(m,M);pS({id:I});let ee=Rm(k),R=b.useRef(null),{getButtonProps:te,buttonRef:z}=rx({disabled:T,native:o}),B=Mm(t,R,z,Z(e=>{h.set(`triggerElement`,e)})),V=Vp(),H=Vp(),ne=Vp(),U=Vp();b.useEffect(()=>{if(E)return N||F?U.start(RC,()=>{_.current.allowUnselectedMouseUp=!0,ne.start(RC,()=>{_.current.allowSelectedMouseUp=!0})}):ne.start(LC,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{ne.clear(),U.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},H.clear()},[E,N,F,_,H,ne,U]);let re=b.useMemo(()=>A?.id??uh(k)?.id,[A,k]),ie=e_(O,{id:I,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?re:void 0,"aria-labelledby":L,"aria-readonly":y||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:B,onFocus(e){u(!0),E&&S.current&&g(!1,Dm(mm,e.nativeEvent)),V.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){th(k,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(D))},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(e){if(E)return;let t=Pp(e.currentTarget);function n(e){if(!R.current)return;let t=e.target;if(th(R.current,t)||th(ee.current,t)||t===R.current)return;let n=FC(R.current);e.clientX>=n.left-IC&&e.clientX<=n.right+IC&&e.clientY>=n.top-IC&&e.clientY<=n.bottom+IC||g(!1,Dm(Cm,e))}H.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,te);ie.role=`combobox`;let ae={...f,open:E,disabled:T,value:D,readOnly:y,placeholder:!N};return m_(`button`,e,{ref:[t,R],state:ae,stateAttributesMapping:zC,props:ie})}),VC={value:()=>null},HC=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=hC(),u=Dy(c,kC.value),d=Dy(c,kC.items),f=Dy(c,kC.itemToStringLabel),p=Dy(c,kC.hasSelectedValue),m=!p&&a!=null&&i==null,h=Dy(c,kC.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?OC(u,d,f):DC(u,d,f)),m_(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:VC})}),UC=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o}=hC();return m_(`span`,e,{state:{open:Dy(o,kC.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:Yb})}),WC=b.createContext(void 0),GC=b.forwardRef(function(e,t){let{store:n}=hC(),r=Dy(n,kC.mounted),i=Dy(n,kC.forceMount);return r||i?(0,y.jsx)(WC.Provider,{value:!0,children:(0,y.jsx)(A_,{ref:t,...e})}):null}),KC=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function qC(){return b.useContext(KC)}function JC(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),o=b.useRef(0),s=Ip(XC).current,c=Ip(YC).current,[l,u]=b.useState(0),d=b.useRef(l),f=Z((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=Z(e=>{c.delete(e),d.current+=1,u(d.current)}),m=b.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(ZC).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);X(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),X(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),X(()=>()=>{n.current=[]},[n]),X(()=>()=>{r&&(r.current=[])},[r]);let h=Z(e=>(s.add(e),()=>{s.delete(e)}));X(()=>{s.forEach(e=>e(m))},[s,m]);let g=b.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,y.jsx)(KC.Provider,{value:g,children:t})}function YC(){return new Map}function XC(){return new Set}function ZC(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var QC=b.createContext(void 0);function $C(){return b.useContext(QC)?.direction??`ltr`}var ew=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=yh(e,t)||{};if(l==null)return{};let f=Lh(u),p={x:n,y:r},m=Th(i),h=Ch(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=vh(k,j,A),N=!c.arrow&&xh(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),tw=(e,t)=>({...ew(e),options:[e,t]}),nw={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await fy().fn(e)).data?.referenceHidden||a}}}},rw={sideX:`left`,sideY:`top`},iw={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=Zf(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:rw};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Pp(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=bh(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:rw.sideX,g=f===`top`?`bottom`:rw.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function aw(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function ow(e,t,n){let{rects:r,placement:i}=e;return{side:aw(t,bh(i),n),align:xh(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function sw(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:v,lazyFlip:y=!1,externalTree:x}=e,[S,C]=b.useState(null);!m&&S!==null&&C(null);let w=h.side||`flip`,T=h.align||`flip`,E=h.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=Z(D),k=D?O:t,A=Rm(t),j=Rm(m),M=$C()===`rtl`,N=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":M?`left`:`right`,"inline-start":M?`right`:`left`}[r],P=a===`center`?N:`${N}-${a}`,F=c,I=+(r===`bottom`),L=+(r===`top`),ee=+(r===`right`),R=+(r===`left`);typeof F==`number`?F={top:F+I,right:F+R,bottom:F+L,left:F+ee}:F&&={top:(F.top||0)+I,right:(F.right||0)+R,bottom:(F.bottom||0)+L,left:(F.left||0)+ee};let te={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:F},z=b.useRef(null),B=Rm(i),V=Rm(o),H=[sy(e=>{let t=ow(e,r,M),n=typeof B.current==`function`?B.current(t):B.current,i=typeof V.current==`function`?V.current(t):V.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,M,r])],ne=T===`none`&&w!==`shift`,U=!ne&&(l||g||w===`shift`),re=w===`none`?null:uy({...te,padding:{top:F.top+1,right:F.right+1,bottom:F.bottom+1,left:F.left+1},mainAxis:!g&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),ie=ne?null:cy(e=>{let t=Pp(e.elements.floating).documentElement;return{...te,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:U,limiter:l||g?void 0:ly(e=>{if(!z.current)return{};let{width:t,height:n}=z.current.getBoundingClientRect(),r=wh(bh(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})}},[te,l,g,F,T]);w===`shift`||T===`shift`||a===`center`?H.push(ie,re):H.push(re,ie),H.push(dy({...te,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!j.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=Zf(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),tw(()=>({element:z.current||Pp(z.current).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=bh(a),l=wh(c),u=z.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(ow(e,r,M)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,U&&l===`y`&&b?S:x),{}}},nw,v),X(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,p]);let ae=b.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:oe,elements:se,x:ce,y:le,middlewareData:ue,update:de,placement:fe,context:pe,isPositioned:me,floatingStyles:he}=Qy({rootContext:p,open:f?m:void 0,placement:P,middleware:H,strategy:n,whileElementsMounted:f?void 0:(...e)=>qv(...e,ae),nodeId:_,externalTree:x}),{sideX:ge,sideY:_e}=ue.adaptiveOrigin||rw,ve=me?n:`fixed`,ye=b.useMemo(()=>{let e=v?{position:ve,[ge]:ce,[_e]:le}:{position:ve,...he};return me||(e.opacity=0),e},[v,ve,ge,ce,_e,le,he,me]),be=b.useRef(null);X(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(cw(t)?t.current:t)||null;n!==be.current&&(oe.setPositionReference(n),be.current=n)},[m,oe,k,A]),b.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&cw(e)&&e.current!==be.current&&(oe.setPositionReference(e.current),be.current=e.current)},[m,oe,k,A]),b.useEffect(()=>{if(f&&m&&se.domReference&&se.floating)return qv(se.domReference,se.floating,de,ae)},[f,m,se,de,ae]);let xe=bh(fe),Se=aw(r,xe,M),Ce=xh(fe)||`center`,we=!!ue.hide?.referenceHidden;X(()=>{y&&m&&me&&C(xe)},[y,m,me,xe]);let Te=b.useMemo(()=>({position:`absolute`,top:ue.arrow?.y,left:ue.arrow?.x}),[ue.arrow]),Ee=ue.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:ye,arrowStyles:Te,arrowRef:z,arrowUncentered:Ee,side:Se,align:Ce,physicalSide:xe,anchorHidden:we,refs:oe,context:pe,isPositioned:me,update:de}),[ye,Te,z,Ee,Se,Ce,xe,we,oe,pe,me,de])}function cw(e){return e!=null&&`current`in e}var lw=b.createContext(void 0);function uw(){let e=b.useContext(lw);if(!e)throw Error(Gg(59));return e}function dw(e,t){e&&Object.assign(e.style,t)}var fw={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function pw(e){return e===`starting`?b_:Jp}function mw(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),m_(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},pw(r),i],stateAttributesMapping:Zb})}var hw=20;function gw(e,t,n,r){let[i,a]=b.useState(!1);X(()=>{if(!e||!t||n==null){a(!1);return}let r=Pp(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-hw)},[e,t,n]),rm(e&&(!t||i),r)}var _w={position:`fixed`},vw=b.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=S_,style:_,...v}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=hC(),A=gC(),j=Dy(x,kC.open),M=Dy(x,kC.mounted),N=Dy(x,kC.modal),P=Dy(x,kC.value),F=Dy(x,kC.openMethod),I=Dy(x,kC.positionerElement),L=Dy(x,kC.triggerElement),ee=Dy(x,kC.isItemEqualToValue),R=Dy(x,kC.transitionStatus),te=b.useRef(null),z=b.useRef(null),[B,V]=b.useState(h),H=M&&B&&F!==`touch`;!M&&B!==h&&V(h),X(()=>{M||(kC.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),kC.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),b.useImperativeHandle(w,()=>H),gw((H||N)&&j,F===`touch`,I,L);let ne=sw({anchor:n,floatingRootContext:A,positionMethod:r,mounted:M,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??H,collisionAvoidance:g,keepMounted:!0}),U=H?`none`:ne.side,re=H?_w:ne.positionerStyles,ie=mw(e,{open:j,side:U,align:ne.align,anchorHidden:ne.anchorHidden},{styles:re,transitionStatus:R,props:v,refs:[t,Z(e=>{x.set(`positionerElement`,e)})],hidden:!M,inert:!j}),ae=b.useRef(0),oe=Z(e=>{if(e.size===0&&ae.current===0||E.current.length===0)return;let t=ae.current;if(ae.current=e.size,e.size===t)return;let n=Dm(mm);if(t!==0&&!x.state.multiple&&P!==null&&bC(E.current,P,ee)===-1){let e=D.current,t=e!=null&&bC(E.current,e,ee)!==-1?e:null;k(t,n),t===null&&(x.set(`selectedIndex`,null),T.current=null)}if(t!==0&&x.state.multiple&&Array.isArray(P)){let e=e=>bC(E.current,e,ee)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!yC(P,e,ee)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&H){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};dw(I,e),dw(O.current,e)}}),se=b.useMemo(()=>({...ne,side:U,alignItemWithTriggerActive:H,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:te,scrollDownArrowRef:z}),[ne,U,H,V]);return(0,y.jsx)(JC,{elementsRef:S,labelsRef:C,onMapChange:oe,children:(0,y.jsxs)(lw.Provider,{value:se,children:[M&&N&&(0,y.jsx)(wx,{inert:Cx(!j),cutout:L}),ie]})})}),yw=`base-ui-disable-scrollbar`,bw={className:yw,getElement(e){return(0,y.jsx)(`style`,{nonce:e,href:yw,precedence:`base-ui:low`,children:`.${yw}{scrollbar-width:none}.${yw}::-webkit-scrollbar{display:none}`})}},xw=b.createContext(void 0);function Sw(e){let t=b.useContext(xw);if(t===void 0&&!e)throw Error(Gg(69));return t}var Cw=b.createContext(void 0),ww={disableStyleElements:!1};function Tw(){return b.useContext(Cw)??ww}var Ew={...Zb,...zy},Dw=b.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,selectedItemTextRef:f,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:h,scrollHandlerRef:g,listRef:_,highlightItemOnHover:v}=hC(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=uw(),O=Sw(!0)!=null,k=gC(),A=$C(),{nonce:j,disableStyleElements:M}=Tw(),N=Dy(s,kC.id),P=Dy(s,kC.open),F=Dy(s,kC.mounted),I=Dy(s,kC.popupProps),L=Dy(s,kC.transitionStatus),ee=Dy(s,kC.triggerElement),R=Dy(s,kC.positionerElement),te=Dy(s,kC.listElement),z=b.useRef(!1),B=b.useRef(!1),V=b.useRef({}),H=Gp(),ne=Z(e=>{if(!R||!c.current||!B.current)return;if(z.current||!C){h();return}let t=R.style.top===`0px`,n=R.style.bottom===`0px`;if(!t&&!n){h();return}let r=Aw(R),i=jw(R.getBoundingClientRect().height,`y`,r),a=Pp(R),o=getComputedStyle(R),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=Ow(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=kw(e),m=0,g=null,_=!1,v=!1,y=e=>{R.style.height=`${e}px`},b=(t,n)=>{let r=AC(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(z.current=!0),h()},x=t?p-f:f,S=Math.min(i+x,d);if(m=S,x<=1){b(x,t?p:0);return}if(d-S>1?t?v=!0:g=0:(_=!0,n&&f<p&&(g=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&y(m),v||g!=null){let t=kw(e),n=v?t:AC(g,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(z.current=!0),h()});b.useImperativeHandle(g,()=>ne,[ne]),Vy({open:P,ref:c,onComplete(){P&&l?.(!0)}});let U={open:P,transitionStatus:L,side:x,align:S};X(()=>{!R||!c.current||Object.keys(V.current).length||(V.current={top:R.style.top||`0`,left:R.style.left||`0`,right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[c,R]),X(()=>{P||C||(B.current=!1,z.current=!1,dw(R,V.current))},[P,C,R,c]),X(()=>{let e=c.current;if(!P||!ee||!R||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){B.current=!0,H.request(h),e.style.removeProperty(`--transform-origin`);return}let t=Pw(e);e.style.removeProperty(`--transform-origin`);try{let t=f.current,n=d.current,r=getComputedStyle(R),i=getComputedStyle(e),a=Pp(ee),o=Zf(R),c=Aw(ee),l=Mw(ee.getBoundingClientRect(),c),u=Mw(R.getBoundingClientRect(),c),p=l.height,m=te||e,g=m.scrollHeight,y=parseFloat(i.borderBottomWidth),b=parseFloat(r.marginTop)||10,x=parseFloat(r.marginBottom)||10,S=parseFloat(r.minHeight)||100,C=Ow(i),w=a.documentElement.clientHeight-b-x,E=a.documentElement.clientWidth,D=w-l.bottom+p,O,k=A===`rtl`?l.right-u.width:l.left,j=0;if(t&&n){let e=Mw(n.getBoundingClientRect(),c);O=Mw(t.getBoundingClientRect(),c),k=u.left+(A===`rtl`?e.right-O.right:e.left-O.left);let r=e.top-l.top+e.height/2;j=O.top-u.top+O.height/2-r}let M=D+j+x+y,N=Math.min(w,M),P=w-b-x,F=M-N,I=E-5;R.style.left=`${AC(k,5,I-u.width)}px`,R.style.height=`${N}px`,R.style.maxHeight=`auto`,R.style.marginTop=`${b}px`,R.style.marginBottom=`${x}px`,e.style.height=`100%`;let L=kw(m),H=F>=L-1;H&&(N=Math.min(w,u.height)-(F-L));let ne=l.top<20||l.bottom>w-20||Math.ceil(N)+1<Math.min(g,S),U=(o.visualViewport?.scale??1)!==1&&Tp;if(ne||U){B.current=!0,dw(R,V.current),T(!1);return}let re=Math.max(S,N);if(H){let e=Math.max(0,w-M);R.style.top=u.height>=P?`0`:`${e}px`,R.style.height=`${N}px`,m.scrollTop=kw(m)}else R.style.bottom=`0`,m.scrollTop=F;if(O){let t=u.top,n=u.height,r=O.top+O.height/2,i=AC(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(re===w||N>=C)&&(z.current=!0),h(),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0),B.current=!0}finally{t()}},[s,P,R,ee,d,f,c,h,C,T,H,E,D,te,_,v,A,w]),b.useEffect(()=>{if(!C||!R||!P)return;let e=Zf(R);function t(e){u(!1,Dm(Em,e))}return bp(e,`resize`,t)},[u,C,R,P]);let re={...te?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(e){p.current=!0,O&&bx.has(e.key)&&e.stopPropagation()},onMouseMove(){p.current=!1},onScroll(e){te||ne(e.currentTarget)},...C&&{style:te?{height:`100%`}:fw}},ie=m_(`div`,e,{ref:[t,c],state:U,stateAttributesMapping:Ew,props:[I,re,pw(L),{className:!te&&C?bw.className:void 0},o]});return(0,y.jsxs)(b.Fragment,{children:[!M&&bw.getElement(j),(0,y.jsx)(Y_,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:ie})]})});function Ow(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function kw(e){return jC(e.scrollHeight,e.clientHeight)}function Aw(e){return Wv.getScale(e)}function jw(e,t,n){return e/n[t]}function Mw(e,t){return Rh({x:jw(e.x,`x`,t),y:jw(e.y,`y`,t),width:jw(e.width,`x`,t),height:jw(e.height,`y`,t)})}var Nw=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Pw(e){let{style:t}=e,n={};for(let[e,r]of Nw)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of Nw){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Fw=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=hC(),{alignItemWithTriggerActive:c}=uw(),l=Dy(o,kC.hasScrollArrows),u=Dy(o,kC.openMethod),d=Dy(o,kC.multiple),f={id:`${Dy(o,kC.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:fw},className:l&&u!==`touch`?bw.className:void 0};return m_(`div`,e,{ref:[t,Z(e=>{o.set(`listElement`,e)})],props:[f,a]})}),Iw=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function Lw(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=qC(),f=b.useRef(-1),[p,m]=b.useState(a??(i===Iw.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=b.useRef(null),g=b.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return X(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),X(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),b.useMemo(()=>({ref:g,index:p}),[p,g])}var Rw=b.createContext(void 0);function zw(){let e=b.useContext(Rw);if(!e)throw Error(Gg(57));return e}var Bw=b.memo(b.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,style:c,...l}=e,u=b.useRef(null),d=Lw({label:a,textRef:u,indexGuessBehavior:Iw.GuessFromOrder}),{store:f,getItemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:x,selectedItemTextRef:S}=hC(),C=Dy(f,kC.isActive,d.index),w=Dy(f,kC.isSelected,d.index,i),T=Dy(f,kC.isSelectedByFocus,d.index),E=Dy(f,kC.isItemEqualToValue),D=d.index,O=D!==-1,k=b.useRef(null),A=Rm(D);X(()=>{if(!O)return;let e=v.current;return e[D]=i,()=>{delete e[D]}},[O,D,i,v]),X(()=>{if(!O)return;let e=f.state.value,t=e;x&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&vC(i,t,E)&&(f.set(`selectedIndex`,D),u.current&&(S.current=u.current))},[O,D,x,E,f,i,S]);let j={disabled:o,selected:w,highlighted:C},M=p({active:C,selected:w});M.id=void 0;let N=b.useRef(null),P=b.useRef(`mouse`),F=b.useRef(!1),{getButtonProps:I,buttonRef:L}=rx({disabled:o,focusableWhenDisabled:!0,native:s,composite:!0});function ee(e){let t=f.state.value;if(x){let n=Array.isArray(t)?t:[];h(w?xC(n,i,E):[...n,i],Dm(ym,e))}else h(i,Dm(ym,e)),m(!1,Dm(ym,e))}let R={role:`option`,"aria-selected":w,tabIndex:C?0:-1,onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(e){N.current=e.key,f.set(`activeIndex`,D),e.key===` `&&_.current&&e.preventDefault()},onClick(e){F.current=!1,!(e.type===`keydown`&&N.current===null)&&(o||e.type===`keydown`&&N.current===` `&&_.current||P.current!==`touch`&&!C||(N.current=null,ee(e.nativeEvent)))},onPointerEnter(e){P.current=e.pointerType},onPointerDown(e){P.current=e.pointerType,F.current=!0},onMouseUp(){if(o)return;if(F.current){F.current=!1;return}let e=!g.current.allowSelectedMouseUp&&w,t=!g.current.allowUnselectedMouseUp&&!w;e||t||P.current!==`touch`&&!C||k.current?.click()}},te=m_(`div`,e,{ref:[L,t,d.ref,k],state:j,props:[M,R,l,I]}),z=b.useMemo(()=>({selected:w,indexRef:A,textRef:u,selectedByFocus:T,hasRegistered:O}),[w,A,u,T,O]);return(0,y.jsx)(Rw.Provider,{value:z,children:te})})),Vw=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=zw();return n||r?(0,y.jsx)(Hw,{...e,ref:t}):null}),Hw=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=zw(),c=b.useRef(null),{transitionStatus:l,setMounted:u}=Fy(s),d=m_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:zy});return Vy({open:s,ref:c,onComplete(){s||u(!1)}}),d})),Uw=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=zw(),{selectedItemTextRef:o}=hC(),{className:s,render:c,style:l,...u}=e;return m_(`div`,e,{ref:[b.useCallback(e=>{if(!e||!a)return;let t=o.current===null||!o.current.isConnected;(i||t&&n.current===0)&&(o.current=e)},[o,n,i,a]),t,r],props:u})})),Ww=b.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=hC(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=uw(),_=Dy(l,c?kC.scrollUpArrowVisible:kC.scrollDownArrowVisible),v=Dy(l,kC.openMethod),y=_&&v!==`touch`,b=Vp(),x=c?g:h,{transitionStatus:S,setMounted:C}=Fy(y);X(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),Vy({open:y,ref:x,onComplete(){y||C(!1)}});let w=m_(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:S},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=jC(e.scrollHeight,e.clientHeight),r=MC(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=Gw(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s]});return y||o?w:null});function Gw(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?MC(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?MC(l.offsetTop+l.offsetHeight-r+i,a):a}var Kw=b.forwardRef(function(e,t){return(0,y.jsx)(Ww,{...e,ref:t,direction:`down`})}),qw=b.forwardRef(function(e,t){return(0,y.jsx)(Ww,{...e,ref:t,direction:`up`})}),Jw=NC;function Yw({className:e,...t}){return(0,y.jsx)(HC,{"data-slot":`select-value`,className:qf(`flex flex-1 text-left`,e),...t})}function Xw({className:e,size:t=`default`,children:n,...r}){return(0,y.jsxs)(BC,{"data-slot":`select-trigger`,"data-size":t,className:qf(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,y.jsx)(UC,{render:(0,y.jsx)(dd,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function Zw({className:e,children:t,footer:n,side:r=`bottom`,sideOffset:i=4,align:a=`center`,alignOffset:o=0,alignItemWithTrigger:s=!0,...c}){return(0,y.jsx)(GC,{children:(0,y.jsx)(vw,{side:r,sideOffset:i,align:a,alignOffset:o,alignItemWithTrigger:s,className:`isolate z-50`,children:(0,y.jsxs)(Dw,{"data-slot":`select-content`,"data-align-trigger":s,className:qf(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...c,children:[(0,y.jsx)($w,{}),(0,y.jsx)(Fw,{children:t}),(0,y.jsx)(eT,{}),n]})})})}function Qw({className:e,children:t,...n}){return(0,y.jsxs)(Bw,{"data-slot":`select-item`,className:qf(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,y.jsx)(Uw,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)(Vw,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(ud,{className:`pointer-events-none`})})]})}function $w({className:e,...t}){return(0,y.jsx)(qw,{"data-slot":`select-scroll-up-button`,className:qf(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(fd,{})})}function eT({className:e,...t}){return(0,y.jsx)(Kw,{"data-slot":`select-scroll-down-button`,className:qf(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(dd,{})})}var tT=`h-7 justify-between gap-1.5 rounded-md border-border/60 bg-transparent px-2 text-xs font-normal text-foreground shadow-none focus-visible:border-ring/40 focus-visible:ring-1 focus-visible:ring-ring/40 dark:bg-transparent`,nT=`max-h-72 w-(--anchor-width) origin-(--transform-origin) gap-0 overflow-x-hidden p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,rT=`rounded-sm py-1.5 pr-7 pl-2 text-xs hover:bg-foreground/10 hover:text-foreground focus:bg-foreground/10 focus:text-foreground`,iT=({value:e,items:t,ariaLabel:n,placeholder:r,onValueChange:i,open:a,onOpenChange:o,onItemHover:s,triggerClassName:c,triggerStyle:l,footerSlot:u})=>{let d=t.find(t=>t.id===e),f=d?.itemStyle?{...d.itemStyle,...l}:l;return(0,y.jsxs)(Jw,{value:e,onValueChange:i,open:a,onOpenChange:o,children:[(0,y.jsx)(Xw,{size:`sm`,"aria-label":n,className:qf(tT,`w-full`,c),style:f,children:(0,y.jsx)(Yw,{placeholder:r,children:()=>d?.label||r})}),(0,y.jsx)(Zw,{alignItemWithTrigger:!1,sideOffset:4,className:qf(nT,Dx,Ox),footer:u?(0,y.jsx)(`div`,{className:`border-t border-border/40 p-1`,children:u}):void 0,children:t.map(e=>(0,y.jsx)(Qw,{value:e.id,className:rT,style:e.itemStyle,onPointerEnter:s?()=>s(e.id):void 0,onFocus:s?()=>s(e.id):void 0,children:e.label},e.id))})]})};function aT(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=mS({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=Fy(o,!0,!0),[d,f]=b.useState(o),[{height:p,width:m},h]=b.useState({height:void 0,width:void 0}),g=ox(),[_,v]=b.useState(),y=_??g,[x,S]=b.useState(!1),[C,w]=b.useState(!1),T=b.useRef(null),E=b.useRef(null),D=b.useRef(null),O=b.useRef(null),k=By(O,!1),A=Z(e=>{let t=!o,n=Dm(hm,e.nativeEvent);if(r(t,n),n.isCanceled)return;let i=O.current;E.current===`css-animation`&&i!=null&&i.style.removeProperty(`animation-name`),!x&&!C&&(E.current!=null&&E.current!==`css-animation`&&!c&&t&&l(!0),E.current===`css-animation`&&(!d&&t&&f(!0),!c&&t&&l(!0))),s(t),E.current===`none`&&c&&!t&&l(!1)});return X(()=>{a&&E.current===`none`&&!o&&l(!1)},[a,o,t,l]),b.useMemo(()=>({abortControllerRef:T,animationTypeRef:E,disabled:i,handleTrigger:A,height:p,mounted:c,open:o,panelId:y,panelRef:O,runOnceAnimationsFinish:k,setDimensions:h,setHiddenUntilFound:S,setKeepMounted:w,setMounted:l,setOpen:s,setPanelIdState:v,setVisible:f,transitionDimensionRef:D,transitionStatus:u,visible:d,width:m}),[T,E,i,A,p,c,o,y,O,k,h,S,w,l,s,f,D,u,d,m])}var oT=b.createContext(void 0);function sT(){let e=b.useContext(oT);if(e===void 0)throw Error(Gg(15));return e}var cT=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Iy.startingStyle]=`startingStyle`,e[e.endingStyle=Iy.endingStyle]=`endingStyle`,e}({}),lT=function(e){return e.panelOpen=`data-panel-open`,e}({}),uT={[cT.open]:``},dT={[cT.closed]:``},fT={open(e){return e?{[lT.panelOpen]:``}:null}},pT={open(e){return e?uT:dT},...zy},mT=b.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=Z(o),d=aT({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=b.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=b.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=m_(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:pT});return(0,y.jsx)(oT.Provider,{value:p,children:m})}),hT={...fT,...zy},gT=b.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=sT(),{className:s,disabled:c=o,id:l,render:u,nativeButton:d=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=rx({disabled:c,focusableWhenDisabled:!0,native:d}),g=b.useMemo(()=>({"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i}),[n,r,i]);return m_(`button`,e,{state:a,ref:[t,h],props:[g,p,m],stateAttributesMapping:hT})}),_T=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function vT(e){let{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:a,keepMounted:o,id:s,mounted:c,onOpenChange:l,open:u,panelRef:d,runOnceAnimationsFinish:f,setDimensions:p,setMounted:m,setOpen:h,setVisible:g,transitionDimensionRef:_,visible:v,width:y}=e,x=b.useRef(!1),S=b.useRef(null),C=b.useRef(u),w=b.useRef(u),T=Gp(),E=b.useMemo(()=>n.current===`css-animation`?!v:!u&&!c,[u,c,v,n]),D=Mm(r,d,Z(e=>{if(!e)return;if(n.current==null||_.current==null){let t=getComputedStyle(e),r=t.animationName!==`none`&&t.animationName!==``,i=t.transitionDuration!==`0s`&&t.transitionDuration!==``;r&&i||(t.animationName===`none`&&t.transitionDuration!==`0s`?n.current=`css-transition`:t.animationName!==`none`&&t.transitionDuration===`0s`?n.current=`css-animation`:n.current=`none`),e.getAttribute(_T.orientation)===`horizontal`||t.transitionProperty.indexOf(`width`)>-1?_.current=`width`:_.current=`height`}if(n.current!==`css-transition`)return;(i===void 0||y===void 0)&&(p({height:e.scrollHeight,width:e.scrollWidth}),w.current&&e.style.setProperty(`transition-duration`,`0s`));let t=-1,r=-1;return t=Wp.request(()=>{w.current=!1,r=Wp.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{Wp.cancel(t),Wp.cancel(r)}}));return X(()=>{if(n.current!==`css-transition`)return;let e=d.current;if(!e)return;let r=-1;if(t.current!=null&&(t.current.abort(),t.current=null),u){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)}),!w.current&&!o&&e.setAttribute(cT.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=Wp.request(()=>{Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})})}else{if(e.scrollHeight===0&&e.scrollWidth===0)return;p({height:e.scrollHeight,width:e.scrollWidth});let n=new AbortController;t.current=n;let r=n.signal,i=null,a=cT.endingStyle;return i=new MutationObserver(o=>{o.some(e=>e.type===`attributes`&&e.attributeName===a)&&(i?.disconnect(),i=null,f(()=>{p({height:0,width:0}),e.style.removeProperty(`content-visibility`),m(!1),t.current===n&&(t.current=null)},r))}),i.observe(e,{attributes:!0,attributeFilter:[a]}),()=>{i?.disconnect(),T.cancel(),t.current===n&&(n.abort(),t.current=null)}}return()=>{Wp.cancel(r)}},[t,n,T,a,o,c,u,d,f,p,m]),X(()=>{if(n.current!==`css-animation`)return;let e=d.current;e&&(S.current=e.style.animationName||S.current,e.style.setProperty(`animation-name`,`none`),p({height:e.scrollHeight,width:e.scrollWidth}),!C.current&&!x.current&&e.style.removeProperty(`animation-name`),u?(t.current!=null&&(t.current.abort(),t.current=null),m(!0),g(!0)):(t.current=new AbortController,f(()=>{m(!1),g(!1),t.current=null},t.current.signal)))},[t,n,u,d,f,p,m,g,v]),Rp(()=>{let e=Wp.request(()=>{C.current=!1});return()=>Wp.cancel(e)}),X(()=>{if(!a)return;let e=d.current;if(!e)return;let t=-1,n=-1;return u&&x.current&&(e.style.transitionDuration=`0s`,p({height:e.scrollHeight,width:e.scrollWidth}),t=Wp.request(()=>{x.current=!1,n=Wp.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{Wp.cancel(t),Wp.cancel(n)}},[a,u,d,p]),X(()=>{let e=d.current;e&&a&&E&&(e.setAttribute(`hidden`,`until-found`),n.current===`css-transition`&&e.setAttribute(cT.startingStyle,``))},[a,E,n,d]),b.useEffect(function(){let e=d.current;if(!e)return;function t(e){x.current=!0,h(!0),l(!0,Dm(mm,e))}return bp(e,`beforematch`,t)},[l,d,h]),b.useMemo(()=>({props:{hidden:E,id:s,ref:D}}),[E,s,D])}var yT=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),bT=b.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{abortControllerRef:l,animationTypeRef:u,height:d,mounted:f,onOpenChange:p,open:m,panelId:h,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setHiddenUntilFound:y,setKeepMounted:x,setMounted:S,setPanelIdState:C,setOpen:w,setVisible:T,state:E,transitionDimensionRef:D,visible:O,width:k,transitionStatus:A}=sT(),j=r??!1,M=i??!1;X(()=>{if(o)return C(o),()=>{C(void 0)}},[o,C]),X(()=>{y(j)},[y,j]),X(()=>{x(M)},[x,M]);let{props:N}=vT({abortControllerRef:l,animationTypeRef:u,externalRef:t,height:d,hiddenUntilFound:j,id:h,keepMounted:M,mounted:f,onOpenChange:p,open:m,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setMounted:S,setOpen:w,setVisible:T,transitionDimensionRef:D,visible:O,width:k});Vy({open:m&&A===`idle`,ref:g,onComplete(){m&&v({height:void 0,width:void 0})}});let P=m_(`div`,e,{state:b.useMemo(()=>({...E,transitionStatus:A}),[E,A]),ref:[t,g],props:[N,{style:{[yT.collapsiblePanelHeight]:d===void 0?`auto`:`${d}px`,[yT.collapsiblePanelWidth]:k===void 0?`auto`:`${k}px`}},c],stateAttributesMapping:pT});return M||j||f?P:null});function xT({...e}){return(0,y.jsx)(mT,{"data-slot":`collapsible`,...e})}function ST({...e}){return(0,y.jsx)(gT,{"data-slot":`collapsible-trigger`,...e})}function CT({...e}){return(0,y.jsx)(bT,{"data-slot":`collapsible-content`,...e})}function wT({className:e,...t}){return(0,y.jsx)(`label`,{"data-slot":`label`,className:qf(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function TT({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`field-group`,className:qf(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var ET=Rx(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function DT({className:e,orientation:t=`vertical`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:qf(ET({orientation:t}),e),...n})}function OT({className:e,...t}){return(0,y.jsx)(wT,{"data-slot":`field-label`,className:qf(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}var kT=b.createContext(void 0);function AT(e){let t=b.useContext(kT);if(t===void 0&&!e)throw Error(Gg(47));return t}function jT(){return{...Jy(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var MT={...Xy,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),openMethod:Q(e=>e.openMethod),openChangeReason:Q(e=>e.openChangeReason),modal:Q(e=>e.modal),focusManagerModal:Q(e=>e.focusManagerModal),stickIfOpen:Q(e=>e.stickIfOpen),titleElementId:Q(e=>e.titleElementId),descriptionElementId:Q(e=>e.descriptionElementId),openOnHover:Q(e=>e.openOnHover),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},NT=class e extends My{constructor(e){let t={...jT(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),stickIfOpenTimeout:new Bp,triggerElements:new Ky},MT)}setOpen=(e,t)=>{let n=t.reason===gm,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let a=()=>{let n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),T_.flushSync(a)):a(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let r=Ip(()=>new e(n)).current,i=t??r;return Rp(r.disposeEffect),i}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function PT({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=NT.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});Jf(()=>{n===void 0&&u.state.open===!1&&r===!0&&u.update({open:!0,activeTriggerId:l})}),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a);let{openMethod:p,triggerProps:m}=Nb(d);Wy(u);let{forceUnmount:h}=Gy(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});b.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=b.useCallback(()=>{u.setOpen(!1,Dm(Tm))},[u]);b.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=$y({popupStore:u,onOpenChange:u.setOpen}),{getReferenceProps:v,getFloatingProps:x,getTriggerProps:S}=ub([rv(_,{outsidePressEvent:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),xb(_)]),C=b.useMemo(()=>v(m),[v,m]),w=b.useMemo(()=>S(m),[S,m]),T=b.useMemo(()=>x(),[x]);u.useSyncedValues({modal:o,openMethod:p,activeTriggerProps:C,inactiveTriggerProps:w,popupProps:T,floatingRootContext:_,nested:F_()!=null});let E=b.useMemo(()=>({store:u}),[u]);return(0,y.jsx)(kT.Provider,{value:E,children:typeof t==`function`?t({payload:f}):t})}function FT(e){return AT(!0)?(0,y.jsx)(PT,{props:e}):(0,y.jsx)(z_,{children:(0,y.jsx)(PT,{props:e})})}function IT(e,t){let n=b.useRef(null);return{preFocusGuardRef:n,handlePreFocusGuardFocus:Z(t=>{T_.flushSync(()=>{e.setOpen(!1,Dm(bm,t.nativeEvent,t.currentTarget))}),vg(n.current)?.focus()}),handleFocusTargetFocus:Z(n=>{let r=e.select(`positionerElement`);if(r&&yg(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{T_.flushSync(()=>{e.setOpen(!1,Dm(bm,n.nativeEvent,n.currentTarget))});let i=_g(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&th(r,i);){let e=i;if(i=mg(i),i===e)break}i?.focus()}})}}var LT=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,handle:o,payload:s,openOnHover:c=!1,delay:l=300,closeDelay:u=0,id:d,style:f,...p}=e,m=AT(!0),h=o?.store??m?.store;if(!h)throw Error(Gg(74));let g=ox(d),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),x=h.useState(`isOpenedByTrigger`,g),S=b.useRef(null),{registerTrigger:C,isMountedByThisTrigger:w}=Uy(g,S,h,{payload:s,disabled:i,openOnHover:c,closeDelay:u}),T=h.useState(`openChangeReason`),E=h.useState(`stickIfOpen`),D=h.useState(`openMethod`),O=h.useState(`focusManagerModal`),k=lb(v,{enabled:v!=null&&c&&(D!==`touch`||T!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Ab(),restMs:l,delay:{close:u},triggerElementRef:S,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),A=ub([X_(v,{enabled:v!=null,stickIfOpen:E})]),j=h.useState(`triggerProps`,w),M={disabled:i,open:x},{getButtonProps:N,buttonRef:P}=rx({disabled:i,native:a}),F=b.useMemo(()=>({open(e){return e&&T===`trigger-press`?Xb.open(e):Yb.open(e)}}),[T]),I=m_(`button`,e,{state:M,ref:[P,t,C,S],props:[A.getReferenceProps(),k,j,{[x_]:``,id:g},p,N],stateAttributesMapping:F}),{preFocusGuardRef:L,handlePreFocusGuardFocus:ee,handleFocusTargetFocus:R}=IT(h,S);return _&&!O?(0,y.jsxs)(b.Fragment,{children:[(0,y.jsx)(qm,{ref:L,onFocus:ee}),(0,y.jsx)(b.Fragment,{children:I},g),(0,y.jsx)(qm,{ref:h.context.triggerFocusTargetRef,onFocus:R})]}):(0,y.jsx)(b.Fragment,{children:I},g)}),RT=b.createContext(void 0);function zT(){let e=b.useContext(RT);if(e===void 0)throw Error(Gg(45));return e}var BT=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=AT();return i.useState(`mounted`)||n?(0,y.jsx)(RT.Provider,{value:n,children:(0,y.jsx)(A_,{ref:t,...r})}):null}),VT=b.createContext(void 0);function HT(){let e=b.useContext(VT);if(!e)throw Error(Gg(46));return e}var UT=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=C_,style:g,..._}=e,{store:v}=AT(),x=zT(),S=L_(),C=v.useState(`floatingRootContext`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`openChangeReason`),D=v.useState(`activeTriggerElement`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`transitionStatus`),N=v.useState(`hasViewport`),P=b.useRef(null),F=By(A,!1,!1),I=sw({anchor:i,floatingRootContext:C,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:x,nodeId:S,collisionAvoidance:h,adaptiveOrigin:N?iw:void 0}),L=C.useState(`domReferenceElement`);X(()=>{let e=L,t=P.current;if(e&&(P.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return F(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[L,F,v]);let ee={open:T,side:I.side,align:I.align,anchorHidden:I.anchorHidden,instant:j};gw(T&&O===!0&&E!==`trigger-hover`,k===`touch`,A,D);let R=b.useCallback(e=>{v.set(`positionerElement`,e)},[v]),te=mw(e,ee,{styles:I.positionerStyles,transitionStatus:M,props:_,refs:[t,R],hidden:!w,inert:!T});return(0,y.jsxs)(VT.Provider,{value:I,children:[w&&O===!0&&E!==`trigger-hover`&&(0,y.jsx)(wx,{ref:v.context.internalBackdropRef,inert:Cx(!T),cutout:D}),(0,y.jsx)(R_,{id:S,children:te})]})}),WT=b.createContext(void 0);function GT(){let[e,t]=b.useState(0),n=Z(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:b.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function KT(e){let{value:t,children:n}=e;return(0,y.jsx)(WT.Provider,{value:t,children:n})}var qT={...Zb,...zy},JT=b.forwardRef(function(e,t){let{className:n,render:r,initialFocus:i,finalFocus:a,style:o,...s}=e,{store:c}=AT(),l=HT(),u=Sw(!0)!=null,{context:d,hasClosePart:f}=GT(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),x=c.useState(`descriptionElementId`),S=c.useState(`modal`),C=c.useState(`mounted`),w=c.useState(`openChangeReason`),T=c.useState(`activeTriggerElement`),E=c.useState(`floatingRootContext`);Vy({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}});let D=c.useState(`disabled`),O=c.useState(`openOnHover`),k=c.useState(`closeDelay`);sb(E,{enabled:O&&!D,closeDelay:k});function A(e){return e===`touch`?c.context.popupRef.current:!0}let j=i===void 0?A:i,M={open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},N=S!==!1&&f;c.useSyncedValue(`focusManagerModal`,N);let P=b.useCallback(e=>{c.set(`popupElement`,e)},[c]),F=m_(`div`,e,{state:M,ref:[t,c.context.popupRef,P],props:[_,{"aria-labelledby":v,"aria-describedby":x,onKeyDown(e){u&&bx.has(e.key)&&e.stopPropagation()}},pw(g),s],stateAttributesMapping:qT});return(0,y.jsx)(Y_,{context:E,openInteractionType:m,modal:N,disabled:!C||w===`trigger-hover`,initialFocus:j,returnFocus:a,restoreFocus:`popup`,previousFocusableElement:tp(T)?T:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,y.jsx)(KT,{value:d,children:F})})});function YT({...e}){return(0,y.jsx)(FT,{"data-slot":`popover`,...e})}function XT({...e}){return(0,y.jsx)(LT,{"data-slot":`popover-trigger`,...e})}function ZT({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,y.jsx)(BT,{children:(0,y.jsx)(UT,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,y.jsx)(JT,{"data-slot":`popover-content`,className:qf(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}var QT=b.createContext(void 0);function $T(){let e=b.useContext(QT);if(e===void 0)throw Error(Gg(63));return e}var eE=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}({}),tE={...rS,checked(e){return e?{[eE.checked]:``}:{[eE.unchecked]:``}}},nE=b.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...x}=e,{clearErrors:S}=sS(),{state:C,setTouched:w,setDirty:T,validityData:E,setFilled:D,setFocused:O,shouldValidateOnChange:k,validationMode:A,disabled:j,name:M,validation:N}=aS(),{labelId:P}=lS(),F=j||m,I=M??l,L=Z(d),ee=b.useRef(null),R=Mm(ee,c,N.inputRef),te=b.useRef(null),z=ox(),B=pS({id:s,implicit:!1,controlRef:te}),V=u?void 0:B,[H,ne]=mS({controlled:n,default:!!i,name:`Switch`,state:`checked`});hS(te,{id:z,value:H}),X(()=>{ee.current&&D(ee.current.checked)},[ee,D]),Mb(H,()=>{S(I),T(H!==E.initialValue),D(H),k()?N.commit(H):N.commit(H,!0)});let{getButtonProps:U,buttonRef:re}=rx({disabled:F,native:u}),ie=uS(a,P,ee,!u,V),ae={id:u?B:z,role:`switch`,"aria-checked":H,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":ie,onFocus(){F||O(!0)},onBlur(){let e=ee.current;!e||F||(w(!0),O(!1),A===`onBlur`&&N.commit(e.checked))},onClick(e){f||F||(e.preventDefault(),ee.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},oe=b.useMemo(()=>e_({checked:H,disabled:F,form:o,id:V,name:I,required:p,style:I?Km:Gm,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:R,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=Dm(mm,e.nativeEvent);L?.(t,n),!n.isCanceled&&ne(t)},onFocus(){te.current?.focus()}},N.getInputValidationProps,_===void 0?Jp:{value:_}),[H,F,o,R,V,I,L,f,p,ne,N,_]),se=b.useMemo(()=>({...C,checked:H,disabled:F,readOnly:f,required:p}),[C,H,F,f,p]),ce=m_(`span`,e,{state:se,ref:[t,te,re],props:[ae,N.getValidationProps,x,U],stateAttributesMapping:tE});return(0,y.jsxs)(QT.Provider,{value:se,children:[ce,!H&&I&&g!==void 0&&(0,y.jsx)(`input`,{type:`hidden`,form:o,name:I,value:g}),(0,y.jsx)(`input`,{...oe,suppressHydrationWarning:!0})]})}),rE=b.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=aS(),s=$T();return m_(`span`,e,{state:{...o,...s},ref:t,stateAttributesMapping:tE,props:a})});function iE({className:e,size:t=`default`,...n}){return(0,y.jsx)(nE,{"data-slot":`switch`,"data-size":t,className:qf(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,y.jsx)(rE,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}var aE=b.createContext(void 0);function oE(e){let t=b.useContext(aE);if(t===void 0&&!e)throw Error(Gg(72));return t}var sE={...Xy,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),isInstantPhase:Q(e=>e.isInstantPhase),trackCursorAxis:Q(e=>e.trackCursorAxis),disableHoverablePopup:Q(e=>e.disableHoverablePopup),lastOpenChangeReason:Q(e=>e.openChangeReason),closeOnClick:Q(e=>e.closeOnClick),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},cE=class e extends My{constructor(e){super({...lE(),...e},{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Ky},sE)}setOpen=(e,t)=>{let n=t.reason,r=n===gm,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0);let o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};r?T_.flushSync(o):o()};static useStore(t,n){let r=Ip(()=>new e(n)).current,i=t??r,a=$y({popupStore:i,onOpenChange:i.setOpen});return i.state.floatingRootContext=a,i}};function lE(){return{...Jy(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var uE=xy(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=cE.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});Jf(()=>{r===void 0&&p.state.open===!1&&n===!0&&p.update({open:!0,activeTriggerId:d})}),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),X(()=>{m&&t&&p.setOpen(!1,Dm(wm))},[m,t,p]),p.useSyncedValue(`disabled`,t),Wy(p);let{forceUnmount:v,transitionStatus:x}=Gy(h,p),S=p.select(`floatingRootContext`),C=p.useState(`isInstantPhase`),w=p.useState(`instantType`),T=p.useState(`lastOpenChangeReason`),E=b.useRef(null);X(()=>{x===`ending`&&T===`none`||x!==`ending`&&C?(w!==`delay`&&(E.current=w),p.set(`instantType`,`delay`)):E.current!==null&&(p.set(`instantType`,E.current),E.current=null)},[x,C,T,w,p]),X(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let D=b.useCallback(()=>{p.setOpen(!1,Dm(Tm))},[p]);b.useImperativeHandle(o,()=>({unmount:v,close:D}),[v,D]);let{getReferenceProps:O,getFloatingProps:k,getTriggerProps:A}=ub([rv(S,{enabled:!t,referencePress:()=>p.select(`closeOnClick`)}),$_(S,{enabled:!t&&a!==`none`,axis:a===`none`?void 0:a})]),j=b.useMemo(()=>O(),[O]),M=b.useMemo(()=>A(),[A]),N=b.useMemo(()=>k(),[k]);return p.useSyncedValues({activeTriggerProps:j,inactiveTriggerProps:M,popupProps:N}),(0,y.jsx)(aE.Provider,{value:p,children:typeof f==`function`?f({payload:_}):f})}),dE=b.createContext(void 0);function fE(){return b.useContext(dE)}var pE=function(e){return e[e.popupOpen=Ub.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),mE=Sy(function(e,t){let{className:n,render:r,handle:i,payload:a,disabled:o,delay:s,closeOnClick:c=!0,closeDelay:l,id:u,style:d,...f}=e,p=oE(!0),m=i?.store??p;if(!m)throw Error(Gg(82));let h=ox(u),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=b.useRef(null),x=s??600,S=l??0,{registerTrigger:C,isMountedByThisTrigger:w}=Uy(h,y,m,{payload:a,closeOnClick:c,closeDelay:S}),T=fE(),{delayRef:E,isInstantPhase:D,hasProvider:O}=Am(v,{open:_});m.useSyncedValue(`isInstantPhase`,D);let k=m.useState(`disabled`),A=o??k,j=m.useState(`trackCursorAxis`),M=m.useState(`disableHoverablePopup`),N=lb(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!M&&j!==`both`?Ab():null,restMs(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:s??e??x),n},delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return l==null&&O&&(t=e),{close:t}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`}),P=tb(v,{enabled:!A}).reference,F={open:_},I=m.useState(`triggerProps`,w);return m_(`button`,e,{state:F,ref:[t,C,y],props:[N,P,I,{onPointerDown(){m.set(`closeOnClick`,c)},id:h,[pE.triggerDisabled]:A?``:void 0},f],stateAttributesMapping:Yb})}),hE=b.createContext(void 0);function gE(){let e=b.useContext(hE);if(e===void 0)throw Error(Gg(70));return e}var _E=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=k_({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,y.jsxs)(b.Fragment,{children:[l,c&&T_.createPortal(n,c)]})}),vE=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return oE().useState(`mounted`)||n?(0,y.jsx)(hE.Provider,{value:n,children:(0,y.jsx)(_E,{ref:t,...r})}):null}),yE=b.createContext(void 0);function bE(){let e=b.useContext(yE);if(e===void 0)throw Error(Gg(71));return e}var xE=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=C_,style:g,..._}=e,v=oE(),x=gE(),S=v.useState(`open`),C=v.useState(`mounted`),w=v.useState(`trackCursorAxis`),T=v.useState(`disableHoverablePopup`),E=v.useState(`floatingRootContext`),D=v.useState(`instantType`),O=v.useState(`transitionStatus`),k=sw({anchor:i,positionMethod:a,floatingRootContext:E,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:x,collisionAvoidance:h,adaptiveOrigin:v.useState(`hasViewport`)?iw:void 0}),A=mw(e,b.useMemo(()=>({open:S,side:k.side,align:k.align,anchorHidden:k.anchorHidden,instant:w===`none`?D:`tracking-cursor`}),[S,k.side,k.align,k.anchorHidden,w,D]),{styles:k.positionerStyles,transitionStatus:O,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!C,inert:!S||w===`both`||T});return(0,y.jsx)(yE.Provider,{value:k,children:A})}),SE={...Zb,...zy},CE=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=oE(),{side:s,align:c}=bE(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);Vy({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=o.useState(`disabled`),h=o.useState(`closeDelay`);return sb(p,{enabled:!m,closeDelay:h}),m_(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,pw(d),a],stateAttributesMapping:SE})}),wE=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=oE(),s=o.useState(`open`),c=o.useState(`instantType`),{arrowRef:l,side:u,align:d,arrowUncentered:f,arrowStyles:p}=bE();return m_(`div`,e,{state:{open:s,side:u,align:d,uncentered:f,instant:c},ref:[t,l],props:[{style:p,"aria-hidden":!0},a],stateAttributesMapping:Zb})}),TE=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=b.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=b.useMemo(()=>({open:t,close:n}),[t,n]);return(0,y.jsx)(dE.Provider,{value:i,children:(0,y.jsx)(km,{delay:a,timeoutMs:r,children:e.children})})};function EE({delay:e=0,...t}){return(0,y.jsx)(TE,{"data-slot":`tooltip-provider`,delay:e,...t})}function DE({...e}){return(0,y.jsx)(uE,{"data-slot":`tooltip`,...e})}function OE({...e}){return(0,y.jsx)(mE,{"data-slot":`tooltip-trigger`,...e})}function kE({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,y.jsx)(vE,{children:(0,y.jsx)(xE,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,y.jsxs)(CE,{"data-slot":`tooltip-content`,className:qf(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,y.jsx)(wE,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var AE=[{id:`block`,name:`Block`},{id:`bar`,name:`Bar`},{id:`underline`,name:`Underline`}],jE=`block`,ME=AE.map(e=>e.id),NE=e=>typeof e==`string`&&ME.includes(e),PE=e=>e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`),FE=`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,IE=`"Symbols Nerd Font"`,LE=e=>`"${PE(e)}", ${IE}, ${FE}`,RE=(e,t,n)=>({id:e,name:t,family:LE(t),source:n}),zE=RE(`geist-mono`,`Geist Mono`,`fontsource`),BE=RE(`jetbrains-mono`,`JetBrains Mono`,`google`),VE=RE(`fira-code`,`Fira Code`,`google`),HE=RE(`ibm-plex-mono`,`IBM Plex Mono`,`google`),UE=RE(`source-code-pro`,`Source Code Pro`,`google`),WE=RE(`roboto-mono`,`Roboto Mono`,`google`),GE=RE(`dm-mono`,`DM Mono`,`google`),KE=RE(`inconsolata`,`Inconsolata`,`google`),qE=RE(`space-mono`,`Space Mono`,`google`),JE=RE(`ubuntu-mono`,`Ubuntu Mono`,`google`),YE=[zE,RE(`anonymous-pro`,`Anonymous Pro`,`google`),GE,VE,HE,KE,BE,WE,UE,qE,JE],XE=zE.id,ZE=e=>e?YE.find(t=>t.id===e)??zE:zE,QE=()=>{let e=YE.filter(e=>e.source===`google`);return e.length===0?``:`https://fonts.googleapis.com/css2?${e.map(e=>`family=${e.name.replace(/ /g,`+`)}:wght@400;700`).join(`&`)}&display=swap`},$E=[{value:1e3,label:`1k lines`},{value:1e4,label:`10k lines`},{value:5e4,label:`50k lines`},{value:1e5,label:`100k lines`}],eD=1e4,tD=$E.map(e=>e.value),nD=e=>tD.includes(e),rD={id:`vesper`,name:`Vesper`,source:`raunofreiberg/vesper`,colors:{background:`#101010`,foreground:`#ffffff`,cursor:`#ffc799`,cursorAccent:`#101010`,selectionBackground:`#2a2a2a`,selectionForeground:`#ffffff`,black:`#101010`,red:`#ff8080`,green:`#99ffe4`,yellow:`#ffc799`,blue:`#a0a0a0`,magenta:`#ffc799`,cyan:`#99ffe4`,white:`#ffffff`,brightBlack:`#505050`,brightRed:`#ff9999`,brightGreen:`#b3ffe4`,brightYellow:`#ffd1a8`,brightBlue:`#b0b0b0`,brightMagenta:`#ffc799`,brightCyan:`#66ddcc`,brightWhite:`#ffffff`}},iD=[rD,{id:`ayu-mirage`,name:`Ayu Mirage`,source:`ayu-theme/vscode-ayu`,colors:{background:`#1f2430`,foreground:`#cccac2`,cursor:`#ffcc66`,cursorAccent:`#1f2430`,selectionBackground:`#34455a`,selectionForeground:`#cccac2`,black:`#171b24`,red:`#f28273`,green:`#87d96c`,yellow:`#fcca60`,blue:`#6acdff`,magenta:`#ddbbff`,cyan:`#93e2c8`,white:`#c7c7c7`,brightBlack:`#686868`,brightRed:`#f28779`,brightGreen:`#d5ff80`,brightYellow:`#ffcd66`,brightBlue:`#73d0ff`,brightMagenta:`#dfbfff`,brightCyan:`#95e6cb`,brightWhite:`#ffffff`}},{id:`catppuccin-frappe`,name:`Catppuccin Frappé`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#303446`,foreground:`#c6d0f5`,cursor:`#f2d5cf`,cursorAccent:`#232634`,selectionBackground:`#626880`,selectionForeground:`#c6d0f5`,black:`#51576d`,red:`#e78284`,green:`#a6d189`,yellow:`#e5c890`,blue:`#8caaee`,magenta:`#f4b8e4`,cyan:`#81c8be`,white:`#b5bfe2`,brightBlack:`#626880`,brightRed:`#e78284`,brightGreen:`#a6d189`,brightYellow:`#e5c890`,brightBlue:`#8caaee`,brightMagenta:`#f4b8e4`,brightCyan:`#81c8be`,brightWhite:`#a5adce`}},{id:`catppuccin-macchiato`,name:`Catppuccin Macchiato`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#24273a`,foreground:`#cad3f5`,cursor:`#f4dbd6`,cursorAccent:`#181926`,selectionBackground:`#5b6078`,selectionForeground:`#cad3f5`,black:`#494d64`,red:`#ed8796`,green:`#a6da95`,yellow:`#eed49f`,blue:`#8aadf4`,magenta:`#f5bde6`,cyan:`#8bd5ca`,white:`#b8c0e0`,brightBlack:`#5b6078`,brightRed:`#ed8796`,brightGreen:`#a6da95`,brightYellow:`#eed49f`,brightBlue:`#8aadf4`,brightMagenta:`#f5bde6`,brightCyan:`#8bd5ca`,brightWhite:`#a5adcb`}},{id:`catppuccin-mocha`,name:`Catppuccin Mocha`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#1e1e2e`,foreground:`#cdd6f4`,cursor:`#f5e0dc`,cursorAccent:`#11111b`,selectionBackground:`#585b70`,selectionForeground:`#cdd6f4`,black:`#45475a`,red:`#f38ba8`,green:`#a6e3a1`,yellow:`#f9e2af`,blue:`#89b4fa`,magenta:`#f5c2e7`,cyan:`#94e2d5`,white:`#bac2de`,brightBlack:`#585b70`,brightRed:`#f38ba8`,brightGreen:`#a6e3a1`,brightYellow:`#f9e2af`,brightBlue:`#89b4fa`,brightMagenta:`#f5c2e7`,brightCyan:`#94e2d5`,brightWhite:`#a6adc8`}},{id:`dracula`,name:`Dracula`,source:`dracula/visual-studio-code`,colors:{background:`#282a36`,foreground:`#f8f8f2`,cursor:`#f8f8f2`,cursorAccent:`#282a36`,selectionBackground:`#44475a`,selectionForeground:`#f8f8f2`,black:`#21222c`,red:`#ff5555`,green:`#50fa7b`,yellow:`#f1fa8c`,blue:`#bd93f9`,magenta:`#ff79c6`,cyan:`#8be9fd`,white:`#f8f8f2`,brightBlack:`#6272a4`,brightRed:`#ff6e6e`,brightGreen:`#69ff94`,brightYellow:`#ffffa5`,brightBlue:`#d6acff`,brightMagenta:`#ff92df`,brightCyan:`#a4ffff`,brightWhite:`#ffffff`}},{id:`github-dark`,name:`GitHub Dark Default`,source:`primer/github-vscode-theme + @primer/primitives`,colors:{background:`#0d1117`,foreground:`#e6edf3`,cursor:`#e6edf3`,cursorAccent:`#0d1117`,selectionBackground:`#264f78`,selectionForeground:`#e6edf3`,black:`#484f58`,red:`#ff7b72`,green:`#3fb950`,yellow:`#d29922`,blue:`#58a6ff`,magenta:`#bc8cff`,cyan:`#39c5cf`,white:`#b1bac4`,brightBlack:`#6e7681`,brightRed:`#ffa198`,brightGreen:`#56d364`,brightYellow:`#e3b341`,brightBlue:`#79c0ff`,brightMagenta:`#d2a8ff`,brightCyan:`#56d4dd`,brightWhite:`#ffffff`}},{id:`gruvbox-dark`,name:`Gruvbox Dark (Medium)`,source:`jdinhify/vscode-theme-gruvbox`,colors:{background:`#282828`,foreground:`#ebdbb2`,cursor:`#ebdbb2`,cursorAccent:`#282828`,selectionBackground:`#504945`,selectionForeground:`#ebdbb2`,black:`#3c3836`,red:`#cc241d`,green:`#98971a`,yellow:`#d79921`,blue:`#458588`,magenta:`#b16286`,cyan:`#689d6a`,white:`#a89984`,brightBlack:`#928374`,brightRed:`#fb4934`,brightGreen:`#b8bb26`,brightYellow:`#fabd2f`,brightBlue:`#83a598`,brightMagenta:`#d3869b`,brightCyan:`#8ec07c`,brightWhite:`#ebdbb2`}},{id:`monokai`,name:`Monokai`,source:`vscode/extensions/theme-monokai`,colors:{background:`#272822`,foreground:`#f8f8f2`,cursor:`#f8f8f0`,cursorAccent:`#272822`,selectionBackground:`#878b91`,selectionForeground:`#f8f8f2`,black:`#333333`,red:`#c4265e`,green:`#86b42b`,yellow:`#b3b42b`,blue:`#6a7ec8`,magenta:`#8c6bc8`,cyan:`#56adbc`,white:`#e3e3dd`,brightBlack:`#666666`,brightRed:`#f92672`,brightGreen:`#a6e22e`,brightYellow:`#e2e22e`,brightBlue:`#819aff`,brightMagenta:`#ae81ff`,brightCyan:`#66d9ef`,brightWhite:`#f8f8f2`}},{id:`night-owl`,name:`Night Owl`,source:`sdras/night-owl-vscode-theme`,colors:{background:`#011627`,foreground:`#d6deeb`,cursor:`#80a4c2`,cursorAccent:`#011627`,selectionBackground:`#1b90dd`,selectionForeground:`#d6deeb`,black:`#011627`,red:`#ef5350`,green:`#22da6e`,yellow:`#c5e478`,blue:`#82aaff`,magenta:`#c792ea`,cyan:`#21c7a8`,white:`#ffffff`,brightBlack:`#575656`,brightRed:`#ef5350`,brightGreen:`#22da6e`,brightYellow:`#ffeb95`,brightBlue:`#82aaff`,brightMagenta:`#c792ea`,brightCyan:`#7fdbca`,brightWhite:`#ffffff`}},{id:`nord`,name:`Nord`,source:`arcticicestudio/nord-visual-studio-code`,colors:{background:`#2e3440`,foreground:`#d8dee9`,cursor:`#d8dee9`,cursorAccent:`#2e3440`,selectionBackground:`#434c5e`,selectionForeground:`#eceff4`,black:`#3b4252`,red:`#bf616a`,green:`#a3be8c`,yellow:`#ebcb8b`,blue:`#81a1c1`,magenta:`#b48ead`,cyan:`#88c0d0`,white:`#e5e9f0`,brightBlack:`#4c566a`,brightRed:`#bf616a`,brightGreen:`#a3be8c`,brightYellow:`#ebcb8b`,brightBlue:`#81a1c1`,brightMagenta:`#b48ead`,brightCyan:`#8fbcbb`,brightWhite:`#eceff4`}},{id:`one-dark-pro`,name:`One Dark Pro`,source:`Binaryify/OneDark-Pro`,colors:{background:`#282c34`,foreground:`#abb2bf`,cursor:`#abb2bf`,cursorAccent:`#282c34`,selectionBackground:`#3e4452`,selectionForeground:`#abb2bf`,black:`#3f4451`,red:`#e05561`,green:`#8cc265`,yellow:`#d18f52`,blue:`#4aa5f0`,magenta:`#c162de`,cyan:`#42b3c2`,white:`#d7dae0`,brightBlack:`#4f5666`,brightRed:`#ff616e`,brightGreen:`#a5e075`,brightYellow:`#f0a45d`,brightBlue:`#4dc4ff`,brightMagenta:`#de73ff`,brightCyan:`#4cd1e0`,brightWhite:`#e6e6e6`}},{id:`solarized-dark`,name:`Solarized Dark`,source:`vscode/extensions/theme-solarized-dark`,colors:{background:`#002b36`,foreground:`#839496`,cursor:`#d30102`,cursorAccent:`#002b36`,selectionBackground:`#274642`,selectionForeground:`#93a1a1`,black:`#073642`,red:`#dc322f`,green:`#859900`,yellow:`#b58900`,blue:`#268bd2`,magenta:`#d33682`,cyan:`#2aa198`,white:`#eee8d5`,brightBlack:`#002b36`,brightRed:`#cb4b16`,brightGreen:`#586e75`,brightYellow:`#657b83`,brightBlue:`#839496`,brightMagenta:`#6c71c4`,brightCyan:`#93a1a1`,brightWhite:`#fdf6e3`}},{id:`synthwave-84`,name:`SynthWave '84`,source:`robb0wen/synthwave-vscode`,colors:{background:`#262335`,foreground:`#ffffff`,cursor:`#03edf9`,cursorAccent:`#262335`,selectionBackground:`#463465`,selectionForeground:`#ffffff`,black:`#2a2139`,red:`#fe4450`,green:`#72f1b8`,yellow:`#f3e70f`,blue:`#03edf9`,magenta:`#ff7edb`,cyan:`#03edf9`,white:`#ffffff`,brightBlack:`#495495`,brightRed:`#fe4450`,brightGreen:`#72f1b8`,brightYellow:`#fede5d`,brightBlue:`#03edf9`,brightMagenta:`#ff7edb`,brightCyan:`#03edf9`,brightWhite:`#ffffff`}},{id:`tokyo-night`,name:`Tokyo Night`,source:`enkia/tokyo-night-vscode-theme`,colors:{background:`#1a1b26`,foreground:`#a9b1d6`,cursor:`#c0caf5`,cursorAccent:`#1a1b26`,selectionBackground:`#515c7e`,selectionForeground:`#c0caf5`,black:`#363b54`,red:`#f7768e`,green:`#73daca`,yellow:`#e0af68`,blue:`#7aa2f7`,magenta:`#bb9af7`,cyan:`#7dcfff`,white:`#787c99`,brightBlack:`#363b54`,brightRed:`#f7768e`,brightGreen:`#73daca`,brightYellow:`#e0af68`,brightBlue:`#7aa2f7`,brightMagenta:`#bb9af7`,brightCyan:`#7dcfff`,brightWhite:`#acb0d0`}},{id:`tokyo-night-storm`,name:`Tokyo Night Storm`,source:`enkia/tokyo-night-vscode-theme`,colors:{background:`#24283b`,foreground:`#a9b1d6`,cursor:`#c0caf5`,cursorAccent:`#24283b`,selectionBackground:`#6f7bb6`,selectionForeground:`#c0caf5`,black:`#414868`,red:`#f7768e`,green:`#73daca`,yellow:`#e0af68`,blue:`#7aa2f7`,magenta:`#bb9af7`,cyan:`#7dcfff`,white:`#8089b3`,brightBlack:`#414868`,brightRed:`#f7768e`,brightGreen:`#73daca`,brightYellow:`#e0af68`,brightBlue:`#7aa2f7`,brightMagenta:`#bb9af7`,brightCyan:`#7dcfff`,brightWhite:`#a9b1d6`}}],aD=rD.id,oD=e=>e?iD.find(t=>t.id===e)??rD:rD,sD=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,cD=`text-xs font-normal text-muted-foreground`,lD=Object.fromEntries(YE.map(e=>[e.id,{fontFamily:e.family}])),uD=iD.map(e=>({id:e.id,label:e.name})),dD=YE.map(e=>({id:e.id,label:e.name,itemStyle:lD[e.id]})),fD=AE.map(e=>({id:e.id,label:e.name})),pD=$E.map(e=>({id:String(e.value),label:e.label})),mD=e=>e.toFixed(1),hD=({label:e,value:t,title:n,valueClassName:r})=>(0,y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,y.jsx)(`dt`,{className:cD,children:e}),(0,y.jsx)(`dd`,{title:n??t,className:qf(`min-w-0 truncate text-right text-foreground/90`,r),children:t})]}),gD=({themeId:e,onThemeChange:t,onThemePreview:n,fontId:r,onFontChange:i,onFontPreview:a,nerdFontEnabled:o,onNerdFontEnabledChange:s,fontSize:c,onFontSizeChange:l,lineHeight:u,onLineHeightChange:d,paddingX:f,onPaddingXChange:p,paddingY:m,onPaddingYChange:h,cursorStyle:g,onCursorStyleChange:_,onCursorStylePreview:v,cursorBlink:x,onCursorBlinkChange:S,scrollback:C,onScrollbackChange:w,scrollOnUserInput:T,onScrollOnUserInputChange:E,notificationsPermission:D,onNotificationsPermissionRequest:O,sessionInfo:k,onPopoverOpenChange:A,onClose:j})=>{let[M,N]=(0,b.useState)(!1),[P,F]=(0,b.useState)(!1),I=(0,b.useRef)(null);return(0,y.jsxs)(YT,{open:M,onOpenChange:e=>{N(e),A?.(e),e||(F(!1),n?.(null),a?.(null),v?.(null),j?.())},children:[(0,y.jsxs)(DE,{children:[(0,y.jsx)(OE,{render:(0,y.jsx)(XT,{render:(0,y.jsx)(Bx,{variant:`ghost`,size:`icon-sm`,"aria-label":`terminal settings`,className:`hover:text-foreground`})}),children:(0,y.jsx)(yd,{})}),M?null:(0,y.jsx)(kE,{side:`bottom`,sideOffset:8,children:`Settings`})]}),(0,y.jsx)(ZT,{ref:I,side:`bottom`,align:`end`,sideOffset:8,className:qf(`w-64 gap-0 overflow-hidden p-3`,Dx,Ox),children:(0,y.jsxs)(TT,{className:`gap-3`,children:[(0,y.jsxs)(DT,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(OT,{className:sD,children:`Theme`}),(0,y.jsx)(iT,{value:e,items:uD,ariaLabel:`select theme`,placeholder:`Theme`,onValueChange:e=>{e&&t(e)},onOpenChange:e=>{e||n?.(null)},onItemHover:n?e=>n(e):void 0})]}),(0,y.jsx)(rC,{className:`bg-border/40`}),(0,y.jsxs)(DT,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(OT,{className:sD,children:`Font`}),(0,y.jsx)(iT,{value:r,items:dD,ariaLabel:`select font`,placeholder:`Font`,open:P,onValueChange:e=>{e&&i(e)},onOpenChange:e=>{F(e),e||a?.(null)},onItemHover:a?e=>a(e):void 0}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:cD,children:`Size`}),(0,y.jsx)(dC,{value:c,min:9,max:24,step:1,ariaLabel:`terminal font size`,decrementAriaLabel:`decrease font size`,incrementAriaLabel:`increase font size`,onValueChange:l})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:cD,children:`Line height`}),(0,y.jsx)(dC,{value:u,min:1,max:2,step:kS,ariaLabel:`terminal line height`,decrementAriaLabel:`decrease line height`,incrementAriaLabel:`increase line height`,formatDisplay:mD,onValueChange:d})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(DE,{children:[(0,y.jsx)(OE,{render:(0,y.jsx)(`span`,{className:cD}),children:`Nerd Font icons`}),(0,y.jsx)(kE,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`Appends a Symbols Only Nerd Font to the font stack. Icon glyphs (Private Use Area codepoints) are resolved by the symbols font while all other characters render from the primary font above.`})]}),(0,y.jsx)(iE,{"aria-label":`toggle nerd font icons`,checked:o,onCheckedChange:s})]})]}),(0,y.jsx)(rC,{className:`bg-border/40`}),(0,y.jsxs)(DT,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(OT,{className:sD,children:`Window`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:cD,children:`Pad X`}),(0,y.jsx)(dC,{value:f,min:0,max:48,step:1,ariaLabel:`terminal horizontal padding`,decrementAriaLabel:`decrease horizontal padding`,incrementAriaLabel:`increase horizontal padding`,onValueChange:p})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:cD,children:`Pad Y`}),(0,y.jsx)(dC,{value:m,min:0,max:48,step:1,ariaLabel:`terminal vertical padding`,decrementAriaLabel:`decrease vertical padding`,incrementAriaLabel:`increase vertical padding`,onValueChange:h})]})]}),(0,y.jsx)(rC,{className:`bg-border/40`}),(0,y.jsxs)(DT,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(OT,{className:sD,children:`Notifications`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(DE,{children:[(0,y.jsx)(OE,{render:(0,y.jsx)(`span`,{className:cD}),children:`Desktop alerts`}),(0,y.jsx)(kE,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, OSC 9 sequences from the shell trigger browser notifications. Enable to receive alerts when the tab is in the background. Blocked permissions must be changed in browser settings.`})]}),(0,y.jsx)(iE,{"aria-label":`toggle desktop notifications`,checked:D===`granted`,disabled:D===`unsupported`||D===`denied`,onCheckedChange:e=>{e&&O()}})]})]}),(0,y.jsx)(rC,{className:`bg-border/40`}),(0,y.jsxs)(DT,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(OT,{className:sD,children:`Cursor`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:cD,children:`Style`}),(0,y.jsx)(iT,{value:g,items:fD,ariaLabel:`select cursor style`,placeholder:`Cursor style`,triggerClassName:`w-fit min-w-[7rem]`,onValueChange:e=>{NE(e)&&_(e)},onOpenChange:e=>{e||v?.(null)},onItemHover:v?e=>{NE(e)&&v?.(e)}:void 0})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:cD,children:`Blink`}),(0,y.jsx)(iE,{"aria-label":`toggle cursor blink`,checked:x,onCheckedChange:S})]})]}),(0,y.jsx)(rC,{className:`bg-border/40`}),(0,y.jsxs)(DT,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(OT,{className:sD,children:`Scrollback`}),(0,y.jsx)(iT,{value:String(C),items:pD,ariaLabel:`select scrollback`,placeholder:`Scrollback`,onValueChange:e=>{if(e===null)return;let t=Number(e);nD(t)&&w(t)}}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(DE,{children:[(0,y.jsx)(OE,{render:(0,y.jsx)(`span`,{className:cD}),children:`Pin to bottom on input`}),(0,y.jsx)(kE,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, typing scrolls the viewport back to the bottom. When off, the viewport stays where you scrolled — useful for reading history while typing.`})]}),(0,y.jsx)(iE,{"aria-label":`toggle pin to bottom on input`,checked:T,onCheckedChange:E})]})]}),k?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(rC,{className:`bg-border/40`}),(0,y.jsxs)(xT,{defaultOpen:!1,children:[(0,y.jsx)(ST,{render:(0,y.jsxs)(`button`,{type:`button`,className:`group/shell flex w-full items-center justify-between gap-2 rounded-sm py-1 text-left transition-colors outline-none hover:text-foreground/90 focus-visible:text-foreground/90`,children:[(0,y.jsx)(`span`,{className:sD,children:`Shell`}),(0,y.jsx)(dd,{className:`size-3 text-muted-foreground/60 transition-transform duration-200 ease-snappy will-change-transform group-aria-expanded/shell:rotate-180`})]})}),(0,y.jsx)(CT,{className:`h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 ease-snappy data-closed:h-0`,children:(0,y.jsxs)(`dl`,{className:`flex flex-col gap-1 pt-2 text-xs`,children:[(0,y.jsx)(hD,{label:`Name`,value:k.shellName}),(0,y.jsx)(hD,{label:`Path`,value:k.shell,title:k.shell}),(0,y.jsx)(hD,{label:`PID`,value:String(k.pid),valueClassName:`tabular-nums`}),(0,y.jsx)(hD,{label:`Cwd`,value:k.cwd,title:k.cwd})]})})]})]}):null]})})]})},_D=64*1024,vD=1*1024*1024,yD=4*1024,bD=1024,xD=1e3,SD=1e3;Object.freeze({status:`aborted`});function $(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var CD=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},wD=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},TD={};function ED(e){return e&&Object.assign(TD,e),TD}function DD(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function OD(e,t){return typeof t==`bigint`?t.toString():t}function kD(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function AD(e){return e==null}function jD(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function MD(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var ND=Symbol(`evaluating`);function PD(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ND)return r===void 0&&(r=ND,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function FD(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ID(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function LD(e){return JSON.stringify(e)}function RD(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var zD=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function BD(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var VD=kD(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function HD(e){if(BD(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(BD(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function UD(e){return HD(e)?{...e}:Array.isArray(e)?[...e]:e}var WD=new Set([`string`,`number`,`symbol`]);function GD(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function KD(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function qD(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function JD(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var YD={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function XD(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return KD(e,ID(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return FD(this,`shape`,e),e},checks:[]}))}function ZD(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return KD(e,ID(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return FD(this,`shape`,r),r},checks:[]}))}function QD(e,t){if(!HD(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return KD(e,ID(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return FD(this,`shape`,n),n}}))}function $D(e,t){if(!HD(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return KD(e,ID(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return FD(this,`shape`,n),n}}))}function eO(e,t){return KD(e,ID(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return FD(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function tO(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return KD(t,ID(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return FD(this,`shape`,i),i},checks:[]}))}function nO(e,t,n){return KD(t,ID(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return FD(this,`shape`,i),i}}))}function rO(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function iO(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function aO(e){return typeof e==`string`?e:e?.message}function oO(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=aO(e.inst?._zod.def?.error?.(e))??aO(t?.error?.(e))??aO(n.customError?.(e))??aO(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function sO(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function cO(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var lO=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,OD,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},uO=$(`$ZodError`,lO),dO=$(`$ZodError`,lO,{Parent:Error});function fO(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function pO(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var mO=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new CD;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>oO(e,a,ED())));throw zD(t,i?.callee),t}return o.value},hO=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>oO(e,a,ED())));throw zD(t,i?.callee),t}return o.value},gO=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new CD;return a.issues.length?{success:!1,error:new(e??uO)(a.issues.map(e=>oO(e,i,ED())))}:{success:!0,data:a.value}},_O=gO(dO),vO=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>oO(e,i,ED())))}:{success:!0,data:a.value}},yO=vO(dO),bO=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return mO(e)(t,n,i)},xO=e=>(t,n,r)=>mO(e)(t,n,r),SO=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return hO(e)(t,n,i)},CO=e=>async(t,n,r)=>hO(e)(t,n,r),wO=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return gO(e)(t,n,i)},TO=e=>(t,n,r)=>gO(e)(t,n,r),EO=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return vO(e)(t,n,i)},DO=e=>async(t,n,r)=>vO(e)(t,n,r),OO=/^[cC][^\s-]{8,}$/,kO=/^[0-9a-z]+$/,AO=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,jO=/^[0-9a-vA-V]{20}$/,MO=/^[A-Za-z0-9]{27}$/,NO=/^[a-zA-Z0-9_-]{21}$/,PO=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,FO=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,IO=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,LO=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,RO=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function zO(){return new RegExp(RO,`u`)}var BO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,VO=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,HO=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,UO=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,WO=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,GO=/^[A-Za-z0-9_-]*$/,KO=/^\+[1-9]\d{6,14}$/,qO=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,JO=RegExp(`^${qO}$`);function YO(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function XO(e){return RegExp(`^${YO(e)}$`)}function ZO(e){let t=YO({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${qO}T(?:${r})$`)}var QO=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},$O=/^-?\d+$/,ek=/^-?\d+(?:\.\d+)?$/,tk=/^(?:true|false)$/i,nk=/^[^A-Z]*$/,rk=/^[^a-z]*$/,ik=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ak={number:`number`,bigint:`bigint`,object:`date`},ok=$(`$ZodCheckLessThan`,(e,t)=>{ik.init(e,t);let n=ak[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sk=$(`$ZodCheckGreaterThan`,(e,t)=>{ik.init(e,t);let n=ak[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ck=$(`$ZodCheckMultipleOf`,(e,t)=>{ik.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):MD(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),lk=$(`$ZodCheckNumberFormat`,(e,t)=>{ik.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=YD[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=$O)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),uk=$(`$ZodCheckMaxLength`,(e,t)=>{var n;ik.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!AD(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=sO(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dk=$(`$ZodCheckMinLength`,(e,t)=>{var n;ik.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!AD(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=sO(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fk=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;ik.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!AD(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=sO(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),pk=$(`$ZodCheckStringFormat`,(e,t)=>{var n,r;ik.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),mk=$(`$ZodCheckRegex`,(e,t)=>{pk.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),hk=$(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=nk,pk.init(e,t)}),gk=$(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=rk,pk.init(e,t)}),_k=$(`$ZodCheckIncludes`,(e,t)=>{ik.init(e,t);let n=GD(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),vk=$(`$ZodCheckStartsWith`,(e,t)=>{ik.init(e,t);let n=RegExp(`^${GD(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),yk=$(`$ZodCheckEndsWith`,(e,t)=>{ik.init(e,t);let n=RegExp(`.*${GD(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),bk=$(`$ZodCheckOverwrite`,(e,t)=>{ik.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),xk=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
75
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return ua.get()},set promptLabel(e){ua.set(e)},get tooMuchOutput(){return fa.get()},set tooMuchOutput(e){fa.set(e)}}}_verifyIntegers(...e){for(Qu of e)if(Qu===1/0||isNaN(Qu)||Qu%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Qu of e)if(Qu&&(Qu===1/0||isNaN(Qu)||Qu%1!=0||Qu<0))throw Error(`This API only accepts positive integers`)}},ed=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),td=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),nd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),rd=e=>{let t=nd(e);return t.charAt(0).toUpperCase()+t.slice(1)},id={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ad=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},od=(0,b.createContext)({}),sd=()=>(0,b.useContext)(od),cd=(0,b.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=sd()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,b.createElement)(`svg`,{ref:c,...id,width:t??l??id.width,height:t??l??id.height,stroke:e??f,strokeWidth:m,className:ed(`lucide`,p,i),...!a&&!ad(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,b.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),ld=(e,t)=>{let n=(0,b.forwardRef)(({className:n,...r},i)=>(0,b.createElement)(cd,{ref:i,iconNode:t,className:ed(`lucide-${td(rd(e))}`,`lucide-${e}`,n),...r}));return n.displayName=rd(e),n},ud=ld(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),dd=ld(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),fd=ld(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),pd=ld(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),md=ld(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),hd=ld(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),gd=ld(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),_d=ld(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),vd=ld(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),yd=ld(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);function bd(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=bd(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function xd(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=bd(e))&&(r&&(r+=` `),r+=t);return r}var Sd=(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},Cd=(e,t)=>({classGroupId:e,validator:t}),wd=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Td=`-`,Ed=[],Dd=`arbitrary..`,Od=e=>{let t=jd(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Ad(e);let n=e.split(Td);return kd(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Sd(i,t):t:i||Ed}return n[e]||Ed}}},kd=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=kd(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Td):e.slice(t).join(Td),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Ad=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?Dd+r:void 0})(),jd=e=>{let{theme:t,classGroups:n}=e;return Md(n,t)},Md=(e,t)=>{let n=wd();for(let r in e){let i=e[r];Nd(i,n,r,t)}return n},Nd=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Pd(i,t,n,r)}},Pd=(e,t,n,r)=>{if(typeof e==`string`){Fd(e,t,n);return}if(typeof e==`function`){Id(e,t,n,r);return}Ld(e,t,n,r)},Fd=(e,t,n)=>{let r=e===``?t:Rd(t,e);r.classGroupId=n},Id=(e,t,n,r)=>{if(zd(e)){Nd(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Cd(n,e))},Ld=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Nd(o,Rd(t,a),n,r)}},Rd=(e,t)=>{let n=e,r=t.split(Td),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=wd(),n.nextPart.set(t,i)),n=i}return n},zd=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Bd=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)}}},Vd=`!`,Hd=`:`,Ud=[],Wd=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Gd=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===Hd){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(Vd)?(c=s.slice(0,-1),l=!0):s.startsWith(Vd)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Wd(t,l,c,u)};if(t){let e=t+Hd,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Wd(Ud,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Kd=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}},qd=e=>({cache:Bd(e.cacheSize),parseClassName:Gd(e),sortModifiers:Kd(e),...Od(e)}),Jd=/\s+/,Yd=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Jd),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+Vd: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},Xd=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Zd(n))&&(i&&(i+=` `),i+=r);return i},Zd=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Zd(e[r]))&&(n&&(n+=` `),n+=t);return n},Qd=(e,...t)=>{let n,r,i,a,o=o=>(n=qd(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=Yd(e,n);return i(e,a),a};return a=o,(...e)=>a(Xd(...e))},$d=[],ef=e=>{let t=t=>t[e]||$d;return t.isThemeGetter=!0,t},tf=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,nf=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rf=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,af=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,of=/\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$/,sf=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,cf=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lf=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,uf=e=>rf.test(e),df=e=>!!e&&!Number.isNaN(Number(e)),ff=e=>!!e&&Number.isInteger(Number(e)),pf=e=>e.endsWith(`%`)&&df(e.slice(0,-1)),mf=e=>af.test(e),hf=()=>!0,gf=e=>of.test(e)&&!sf.test(e),_f=()=>!1,vf=e=>cf.test(e),yf=e=>lf.test(e),bf=e=>!J(e)&&!Y(e),xf=e=>If(e,Bf,_f),J=e=>tf.test(e),Sf=e=>If(e,Vf,gf),Cf=e=>If(e,Hf,df),wf=e=>If(e,Wf,hf),Tf=e=>If(e,Uf,_f),Ef=e=>If(e,Rf,_f),Df=e=>If(e,zf,yf),Of=e=>If(e,Gf,vf),Y=e=>nf.test(e),kf=e=>Lf(e,Vf),Af=e=>Lf(e,Uf),jf=e=>Lf(e,Rf),Mf=e=>Lf(e,Bf),Nf=e=>Lf(e,zf),Pf=e=>Lf(e,Gf,!0),Ff=e=>Lf(e,Wf,!0),If=(e,t,n)=>{let r=tf.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Lf=(e,t,n=!1)=>{let r=nf.exec(e);return r?r[1]?t(r[1]):n:!1},Rf=e=>e===`position`||e===`percentage`,zf=e=>e===`image`||e===`url`,Bf=e=>e===`length`||e===`size`||e===`bg-size`,Vf=e=>e===`length`,Hf=e=>e===`number`,Uf=e=>e===`family-name`,Wf=e=>e===`number`||e===`weight`,Gf=e=>e===`shadow`,Kf=Qd(()=>{let e=ef(`color`),t=ef(`font`),n=ef(`text`),r=ef(`font-weight`),i=ef(`tracking`),a=ef(`leading`),o=ef(`breakpoint`),s=ef(`container`),c=ef(`spacing`),l=ef(`radius`),u=ef(`shadow`),d=ef(`inset-shadow`),f=ef(`text-shadow`),p=ef(`drop-shadow`),m=ef(`blur`),h=ef(`perspective`),g=ef(`aspect`),_=ef(`ease`),v=ef(`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(),Y,J],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Y,J,c],T=()=>[uf,`full`,`auto`,...w()],E=()=>[ff,`none`,`subgrid`,Y,J],D=()=>[`auto`,{span:[`full`,ff,Y,J]},ff,Y,J],O=()=>[ff,`auto`,Y,J],k=()=>[`auto`,`min`,`max`,`fr`,Y,J],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=()=>[uf,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[uf,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[uf,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,Y,J],L=()=>[...b(),jf,Ef,{position:[Y,J]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],R=()=>[`auto`,`cover`,`contain`,Mf,xf,{size:[Y,J]}],te=()=>[pf,kf,Sf],z=()=>[``,`none`,`full`,l,Y,J],B=()=>[``,df,kf,Sf],V=()=>[`solid`,`dashed`,`dotted`,`double`],H=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ne=()=>[df,pf,jf,Ef],U=()=>[``,`none`,m,Y,J],re=()=>[`none`,df,Y,J],ie=()=>[`none`,df,Y,J],ae=()=>[df,Y,J],oe=()=>[uf,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[mf],breakpoint:[mf],color:[hf],container:[mf],"drop-shadow":[mf],ease:[`in`,`out`,`in-out`],font:[bf],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[mf],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[mf],shadow:[mf],spacing:[`px`,df],text:[mf],"text-shadow":[mf],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,uf,J,Y,g]}],container:[`container`],columns:[{columns:[df,J,Y,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:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[ff,`auto`,Y,J]}],basis:[{basis:[uf,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[df,uf,`auto`,`initial`,`none`,J]}],grow:[{grow:[``,df,Y,J]}],shrink:[{shrink:[``,df,Y,J]}],order:[{order:[ff,`first`,`last`,`none`,Y,J]}],"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()}],pbs:[{pbs:w()}],pbe:[{pbe: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()}],mbs:[{mbs:M()}],mbe:[{mbe: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()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],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,kf,Sf]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Ff,wf]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,pf,J]}],"font-family":[{font:[Af,Tf,t]}],"font-features":[{"font-features":[J]}],"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,Y,J]}],"line-clamp":[{"line-clamp":[df,`none`,Y,Cf]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Y,J]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Y,J]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...V(),`wavy`]}],"text-decoration-thickness":[{decoration:[df,`from-font`,`auto`,Y,Sf]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[df,`auto`,Y,J]}],"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`,Y,J]}],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`,Y,J]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:R()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},ff,Y,J],radial:[``,Y,J],conic:[ff,Y,J]},Nf,Df]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":B()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...V(),`hidden`,`none`]}],"divide-style":[{divide:[...V(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...V(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[df,Y,J]}],"outline-w":[{outline:[``,df,kf,Sf]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Pf,Of]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Pf,Of]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:B()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[df,Sf]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Pf,Of]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[df,Y,J]}],"mix-blend":[{"mix-blend":[...H(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":H()}],"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":[df]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Y,J]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":[df]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Y,J]}],filter:[{filter:[``,`none`,Y,J]}],blur:[{blur:U()}],brightness:[{brightness:[df,Y,J]}],contrast:[{contrast:[df,Y,J]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Pf,Of]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,df,Y,J]}],"hue-rotate":[{"hue-rotate":[df,Y,J]}],invert:[{invert:[``,df,Y,J]}],saturate:[{saturate:[df,Y,J]}],sepia:[{sepia:[``,df,Y,J]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Y,J]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[df,Y,J]}],"backdrop-contrast":[{"backdrop-contrast":[df,Y,J]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,df,Y,J]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[df,Y,J]}],"backdrop-invert":[{"backdrop-invert":[``,df,Y,J]}],"backdrop-opacity":[{"backdrop-opacity":[df,Y,J]}],"backdrop-saturate":[{"backdrop-saturate":[df,Y,J]}],"backdrop-sepia":[{"backdrop-sepia":[``,df,Y,J]}],"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`,Y,J]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[df,`initial`,Y,J]}],ease:[{ease:[`linear`,`initial`,_,Y,J]}],delay:[{delay:[df,Y,J]}],animate:[{animate:[`none`,v,Y,J]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Y,J]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":[`scale-3d`],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[Y,J,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"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`,Y,J]}],"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-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":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-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":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`,Y,J]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[df,kf,Sf,Cf]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`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`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`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-bs`,`border-w-be`,`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-bs`,`border-color-be`,`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-mbs`,`scroll-mbe`,`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-pbs`,`scroll-pbe`,`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 qf(...e){return Kf(xd(e))}function Jf(e){let t=b.useRef(!0);t.current&&(t.current=!1,e())}function Yf(){return typeof window<`u`}function Xf(e){return $f(e)?(e.nodeName||``).toLowerCase():`#document`}function Zf(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qf(e){return(($f(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function $f(e){return Yf()?e instanceof Node||e instanceof Zf(e).Node:!1}function ep(e){return Yf()?e instanceof Element||e instanceof Zf(e).Element:!1}function tp(e){return Yf()?e instanceof HTMLElement||e instanceof Zf(e).HTMLElement:!1}function np(e){return!Yf()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Zf(e).ShadowRoot}function rp(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=mp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ip(e){return/^(table|td|th)$/.test(Xf(e))}function ap(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var op=/transform|translate|scale|rotate|perspective|filter/,sp=/paint|layout|strict|content/,cp=e=>!!e&&e!==`none`,lp;function up(e){let t=ep(e)?mp(e):e;return cp(t.transform)||cp(t.translate)||cp(t.scale)||cp(t.rotate)||cp(t.perspective)||!fp()&&(cp(t.backdropFilter)||cp(t.filter))||op.test(t.willChange||``)||sp.test(t.contain||``)}function dp(e){let t=gp(e);for(;tp(t)&&!pp(t);){if(up(t))return t;if(ap(t))return null;t=gp(t)}return null}function fp(){return lp??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),lp}function pp(e){return/^(html|body|#document)$/.test(Xf(e))}function mp(e){return Zf(e).getComputedStyle(e)}function hp(e){return ep(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gp(e){if(Xf(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||np(e)&&e.host||Qf(e);return np(t)?t.host:t}function _p(e){let t=gp(e);return pp(t)?e.ownerDocument?e.ownerDocument.body:e.body:tp(t)&&rp(t)?t:_p(t)}function vp(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=_p(e),i=r===e.ownerDocument?.body,a=Zf(r);if(i){let e=yp(a);return t.concat(a,a.visualViewport||[],rp(r)?r:[],e&&n?vp(e):[])}else return t.concat(r,vp(r,[],n))}function yp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function bp(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var xp=typeof navigator<`u`,Sp=jp(),Cp=Np(),wp=Mp(),Tp=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),Ep=Sp.platform===`MacIntel`&&Sp.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Sp.platform);xp&&/firefox/i.test(wp);var Dp=xp&&/apple/i.test(navigator.vendor);xp&&/Edg/i.test(wp);var Op=xp&&/android/i.test(Cp)||/android/i.test(wp),kp=xp&&Cp.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,Ap=wp.includes(`jsdom/`);function jp(){if(!xp)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 Mp(){if(!xp)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function Np(){if(!xp)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function Pp(e){return e?.ownerDocument||document}var X=typeof document<`u`?b.useLayoutEffect:()=>{},Fp={};function Ip(e,t){let n=b.useRef(Fp);return n.current===Fp&&(n.current=e(t)),n}var Lp=[];function Rp(e){b.useEffect(e,Lp)}var zp=0,Bp=class e{static create(){return new e}currentId=zp;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=zp,t()},e)}isStarted(){return this.currentId!==zp}clear=()=>{this.currentId!==zp&&(clearTimeout(this.currentId),this.currentId=zp)};disposeEffect=()=>this.clear};function Vp(){let e=Ip(Bp.create).current;return Rp(e.disposeEffect),e}var Hp=null;globalThis.requestAnimationFrame;var Up=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)}},Wp=class e{static create(){return new e}static request(e){return Up.request(e)}static cancel(e){return Up.cancel(e)}currentId=Hp;request(e){this.cancel(),this.currentId=Up.request(()=>{this.currentId=Hp,e()})}cancel=()=>{this.currentId!==Hp&&(Up.cancel(this.currentId),this.currentId=Hp)};disposeEffect=()=>this.cancel};function Gp(){let e=Ip(Wp.create).current;return Rp(e.disposeEffect),e}function Kp(){}var qp=Object.freeze([]),Jp=Object.freeze({}),Yp={},Xp={},Zp=``;function Qp(e){if(typeof document>`u`)return!1;let t=Pp(e);return Zf(t).innerWidth-t.documentElement.clientWidth>0}function $p(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Pp(e),n=t.documentElement,r=t.body,i=rp(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function em(e){let t=Pp(e),n=t.documentElement,r=t.body,i=rp(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function tm(e){let t=Pp(e),n=t.documentElement,r=t.body,i=Zf(n),a=0,o=0,s=!1,c=Wp.create();if(Tp&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,Yp={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Zp=n.style.scrollBehavior,Xp={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=rp(n)?n:r;if(s=$p(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,Yp),Object.assign(r.style,Xp),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Zp)}function d(){u(),c.request(l)}l();let f=bp(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var nm=new class{lockCount=0;restore=null;timeoutLock=Bp.create();timeoutUnlock=Bp.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Pp(e).documentElement,n=Zf(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=Kp;return}let r=Ep||!Qp(e);this.restore=r?em(e):tm(e)}};function rm(e=!0,t=null){X(()=>{if(e)return nm.acquire(t)},[e,t])}function im(e){e.preventDefault(),e.stopPropagation()}function am(e){return`nativeEvent`in e}function om(e){return e.pointerType===``&&e.isTrusted?!0:Op&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function sm(e){return Ap?!1:!Op&&e.width===0&&e.height===0||Op&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function cm(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function lm(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function um(e,t){return t!=null&&!cm(t)?0:typeof e==`function`?e():e}function dm(e,t,n){let r=um(e,n);return typeof r==`number`?r:r?.[t]}function fm(e){return typeof e==`function`?e():e}function pm(e,t){return t||e===`click`||e===`mousedown`}var mm=`none`,hm=`trigger-press`,gm=`trigger-hover`,_m=`trigger-focus`,vm=`outside-press`,ym=`item-press`,bm=`focus-out`,xm=`escape-key`,Sm=`list-navigation`,Cm=`cancel-open`,wm=`disabled`,Tm=`imperative-action`,Em=`window-resize`;function Dm(e,t,n,r){let i=!1,a=!1,o=r??Jp;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}}var Om=b.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Bp,currentIdRef:{current:null},currentContextRef:{current:null}});function km(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=b.useRef(n),a=b.useRef(n),o=b.useRef(null),s=b.useRef(null),c=Vp();return(0,y.jsx)(Om.Provider,{value:b.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Am(e,t={open:!1}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`floatingId`),{open:i}=t,{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=b.useContext(Om),[f,p]=b.useState(!1);return X(()=>{function e(){p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current}if(a.current&&!i&&a.current===r){if(p(!1),s){let t=r;return d.start(s,()=>{n.select(`open`)||a.current&&a.current!==t||e()}),()=>{d.clear()}}e()}},[i,r,a,o,s,c,l,d,n]),X(()=>{if(!i)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:n.setOpen,setIsInstantPhase:p},a.current=r,o.current={open:0,close:dm(c.current,`close`)},t!==null&&t!==r?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,Dm(mm))):(p(!1),e?.setIsInstantPhase(!1))},[i,r,n,a,o,s,c,l,d]),X(()=>()=>{l.current=null},[l]),b.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function jm(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Mm(e,t,n,r){let i=Ip(Pm).current;return Fm(i,e,t,n,r)&&Lm(i,[e,t,n,r]),i.callback}function Nm(e){let t=Ip(Pm).current;return Im(t,e)&&Lm(t,e),t.callback}function Pm(){return{callback:null,cleanup:null,refs:[]}}function Fm(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Im(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function Lm(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:}}}}}}function Rm(e){let t=Ip(zm,e).current;return t.next=e,X(t.effect),t}function zm(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Bm=b[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Vm=Bm&&Bm!==b.useLayoutEffect?Bm:e=>e();function Z(e){let t=Ip(Hm).current;return t.next=e,Vm(t.effect),t.trampoline}function Hm(){let e={next:void 0,callback:Um,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Um(){}var Wm={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Gm={...Wm,position:`fixed`,top:0,left:0},Km={...Wm,position:`absolute`},qm=b.forwardRef(function(e,t){let[n,r]=b.useState();X(()=>{Dp&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,y.jsx)(`span`,{...e,ref:t,style:Gm,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),Jm=`data-base-ui-focusable`,Ym=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Xm=`ArrowLeft`,Zm=`ArrowRight`,Qm=`ArrowUp`,$m=`ArrowDown`;function eh(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function th(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&np(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function nh(e){return`composedPath`in e?e.composedPath()[0]:e.target}function rh(e,t){if(!ep(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(th(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function ih(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function ah(e){return e.matches(`html,body`)}function oh(e){return tp(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function sh(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Ym}`)!=null}function ch(e){return e?e.getAttribute(`role`)===`combobox`&&oh(e):!1}function lh(e){if(!e||Ap)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function uh(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}var dh=[`top`,`right`,`bottom`,`left`],fh=Math.min,ph=Math.max,mh=Math.round,hh=Math.floor,gh=e=>({x:e,y:e}),_h={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function vh(e,t,n){return ph(e,fh(t,n))}function yh(e,t){return typeof e==`function`?e(t):e}function bh(e){return e.split(`-`)[0]}function xh(e){return e.split(`-`)[1]}function Sh(e){return e===`x`?`y`:`x`}function Ch(e){return e===`y`?`height`:`width`}function wh(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Th(e){return Sh(wh(e))}function Eh(e,t,n){n===void 0&&(n=!1);let r=xh(e),i=Th(e),a=Ch(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Fh(o)),[o,Fh(o)]}function Dh(e){let t=Fh(e);return[Oh(e),t,Oh(t)]}function Oh(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var kh=[`left`,`right`],Ah=[`right`,`left`],jh=[`top`,`bottom`],Mh=[`bottom`,`top`];function Nh(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ah:kh:t?kh:Ah;case`left`:case`right`:return t?jh:Mh;default:return[]}}function Ph(e,t,n,r){let i=xh(e),a=Nh(bh(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Oh)))),a}function Fh(e){let t=bh(e);return _h[t]+e.slice(t.length)}function Ih(e){return{top:0,right:0,bottom:0,left:0,...e}}function Lh(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ih(e)}function Rh(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function zh(e,t,n){return Math.floor(e/t)!==n}function Bh(e,t){return t<0||t>=e.length}function Vh(e,t){return Uh(e.current,{disabledIndices:t})}function Hh(e,t){return Uh(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Uh(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&Jh(e,a,r));return a}function Wh(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!Jh(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=hh(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!Jh(e,r,s))return r}};d&&im(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=Uh(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=Uh(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}Bh(e,f)&&(f=u)}if(n===`both`){let n=hh(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&im(t),u%o===o-1?r&&(f=Uh(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=Uh(e,{startingIndex:u,disabledIndices:s}),r&&zh(f,o,n)&&(f=Uh(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),zh(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&im(t),u%o===0?r&&(f=Uh(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=Uh(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&zh(f,o,n)&&(f=Uh(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),zh(f,o,n)&&(f=u));let c=hh(l/o)===n;Bh(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:Uh(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function Gh(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function Kh(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function qh(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function Jh(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?Xh(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function Yh(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Xh(e,t=e?mp(e):null){return!e||!e.isConnected||!t||Yh(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Zh=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Qh(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return np(n)?n.host:null}function $h(e){for(let t of Array.from(e.children))if(Xf(t)===`summary`)return t;return null}function eg(e,t){let n=$h(t);return!!n&&(e===n||th(n,e))}function tg(e){let t=e?Xf(e):``;return e!=null&&e.matches(Zh)&&(t!==`summary`||e.parentElement!=null&&Xf(e.parentElement)===`details`&&$h(e.parentElement)===e)&&(t!==`details`||$h(e)==null)&&(t!==`input`||e.type!==`hidden`)}function ng(e){if(!tg(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Qh(t)){let n=t!==e,r=Xf(t)===`slot`;if(t.hasAttribute(`inert`)||n&&Xf(t)===`details`&&!t.open&&!eg(e,t)||t.hasAttribute(`hidden`)||!r&&!rg(t,n))return!1}return!0}function rg(e,t){let n=mp(e);return t?n.display!==`none`:Xh(e,n)}function ig(e){let t=e.tabIndex;if(t<0){let t=Xf(e);if(t===`details`||t===`audio`||t===`video`||tp(e)&&e.isContentEditable)return 0}return t}function ag(e){if(Xf(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function og(e,t){let n=ag(e);if(!n)return!0;let r=t.find(e=>{let t=ag(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=ag(e);return t?.name===n.name&&t.form===n.form})===n}function sg(e){if(tp(e)&&Xf(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return tp(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function cg(e,t){sg(e).forEach(e=>{tg(e)&&t.push(e),cg(e,t)})}function lg(e,t,n){sg(e).forEach(e=>{tp(e)&&e.matches(t)&&n.push(e),lg(e,t,n)})}function ug(e){return ng(e)&&ig(e)>=0}function dg(e){let t=[];return cg(e,t),t.filter(ng)}function fg(e){let t=dg(e);return t.filter(e=>ig(e)>=0&&og(e,t))}function pg(e,t){let n=fg(e),r=n.length;if(r===0)return;let i=eh(Pp(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function mg(e){return pg(Pp(e).body,1)||e}function hg(e){return pg(Pp(e).body,-1)||e}function gg(e,t){if(!e)return null;let n=fg(Pp(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function _g(e){return gg(e,1)}function vg(e){return gg(e,-1)}function yg(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!th(n,r)}function bg(e){fg(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function xg(e){let t=[];lg(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Sg(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Sg(e,t.id,n)])}function Cg(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function wg(e){return`data-base-ui-${e}`}var Tg=0;function Eg(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(Tg);let a=()=>e?.focus({preventScroll:n});if(i)return a(),Kp;let o=requestAnimationFrame(a);return Tg=o,()=>{Tg===o&&(cancelAnimationFrame(o),Tg=0)}}var Dg={inert:new WeakMap,"aria-hidden":new WeakMap},Og=`data-base-ui-inert`,kg={inert:new WeakSet,"aria-hidden":new WeakSet},Ag=new WeakMap,jg=0;function Mg(e){return kg[e]}function Ng(e){return e?np(e)?e.host:Ng(e.parentNode):null}var Pg=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Ng(t);return e.contains(n)?n:null}).filter(e=>e!=null),Fg=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Ig=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{Xf(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function Lg(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=Pg(t,e),u=i?Pg(t,a):[],d=new Set(u),f=i?Ig(t,Fg(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=Dg[o],n=Mg(o);c=n,s=e;let r=Pg(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);Ig(t,Fg(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(Ag.get(e)||0)+1;Ag.set(e,t),m.push(e),t===1&&e.setAttribute(Og,``)}),jg+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(Ag.get(e)||0)-1;Ag.set(e,t),t||e.removeAttribute(Og)}),--jg,jg||(Dg.inert=new WeakMap,Dg[`aria-hidden`]=new WeakMap,kg.inert=new WeakSet,kg[`aria-hidden`]=new WeakSet,Ag=new WeakMap)}}function Rg(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=Pp(e[0]).body;return Lg(e,o,n,r,{mark:i,markerIgnoreElements:a})}var zg={...b},Bg=0;function Vg(e,t=`mui`){let[n,r]=b.useState(e),i=e||n;return b.useEffect(()=>{n??(Bg+=1,r(`${t}-${Bg}`))},[n,t]),i}var Hg=zg.useId;function Ug(e,t){if(Hg!==void 0){let n=Hg();return e??(t?`${t}-${n}`:n)}return Vg(e,t)}function Wg(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var Gg=Wg(`https://base-ui.com/production-error`,`Base UI`),Kg=19;function qg(e){return Kg>=e}function Jg(e){if(!b.isValidElement(e))return null;let t=e,n=t.props;return(qg(19)?n?.ref:t.ref)??null}function Yg(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Xg(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 Zg(e,t){return typeof e==`function`?e(t):e}function Qg(e,t){return typeof e==`function`?e(t):e}var $g={};function e_(e,t,n,r,i){if(!n&&!r&&!i&&!e)return n_(t);let a=n_(e);return t&&(a=r_(a,t)),n&&(a=r_(a,n)),r&&(a=r_(a,r)),i&&(a=r_(a,i)),a}function t_(e){if(e.length===0)return $g;if(e.length===1)return n_(e[0]);let t=n_(e[0]);for(let n=1;n<e.length;n+=1)t=r_(t,e[n]);return t}function n_(e){return s_(e)?{...c_(e,$g)}:i_(e)}function r_(e,t){return s_(t)?c_(t,e):a_(e,t)}function i_(e){let t={...e};for(let e in t){let n=t[e];o_(e,n)&&(t[e]=u_(n))}return t}function a_(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Yg(e.style,r);break;case`className`:e[n]=f_(e.className,r);break;default:o_(n,r)?e[n]=l_(e[n],r):e[n]=r}}return e}function o_(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 s_(e){return typeof e==`function`}function c_(e,t){return s_(e)?e(t):e??$g}function l_(e,t){return t?e?(...n)=>{let r=n[0];if(p_(r)){let i=r;d_(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:u_(t):e}function u_(e){return e&&((...t)=>{let n=t[0];return p_(n)&&d_(n),e(...t)})}function d_(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function f_(e,t){return t?e?t+` `+e:t:e}function p_(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function m_(e,t,n={}){let r=t.render,i=h_(t,n);return n.enabled===!1?null:v_(e,r,i,n.state??Jp)}function h_(e,t={}){let{className:n,style:r,render:i}=e,{state:a=Jp,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Zg(n,a):void 0,d=l?Qg(r,a):void 0,f=l?Xg(a,c):Jp,p=l&&s?g_(s):void 0,m=l?Yg(f,p)??{}:Jp;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=Nm([m.ref,Jg(i),...o]):m.ref=Mm(m.ref,Jg(i),o):Mm(null,null)),l?(u!==void 0&&(m.className=f_(m.className,u)),d!==void 0&&(m.style=Yg(m.style,d)),m):Jp}function g_(e){return Array.isArray(e)?t_(e):e_(void 0,e)}var __=Symbol.for(`react.lazy`);function v_(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=e_(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===__&&(i=b.Children.toArray(t)[0]),b.cloneElement(i,e)}if(e&&typeof e==`string`)return y_(e,n);throw Error(Gg(8))}function y_(e,t){return e===`button`?(0,b.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,b.createElement)(`img`,{alt:``,...t,key:t.key}):b.createElement(e,t)}var b_={style:{transition:`none`}},x_=`data-base-ui-click-trigger`,S_={fallbackAxisSide:`none`},C_={fallbackAxisSide:`end`},w_={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},T_=c(g()),E_=b.createContext(null),D_=()=>b.useContext(E_),O_=wg(`portal`);function k_(e={}){let{ref:t,container:n,componentProps:r=Jp,elementProps:i}=e,a=Ug(),o=D_()?.portalNode,[s,c]=b.useState(null),[l,u]=b.useState(null),d=Z(e=>{e!==null&&u(e)}),f=b.useRef(null);X(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&($f(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=m_(`div`,r,{ref:[t,d],props:[{id:a,[O_]:``},i]});return{portalNode:l,portalSubtree:s&&p?T_.createPortal(p,s):null}}var A_=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,style:s,...c}=e,{portalNode:l,portalSubtree:u}=k_({container:r,ref:t,componentProps:e,elementProps:c}),d=b.useRef(null),f=b.useRef(null),p=b.useRef(null),m=b.useRef(null),[h,g]=b.useState(null),_=b.useRef(!1),v=h?.modal,x=h?.open,S=typeof o==`boolean`?o:!!h&&!h.modal&&h.open&&!!l;b.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&yg(e)&&(e.type===`focusin`?_.current&&=(xg(l),!1):(bg(l),_.current=!0))}return jm(bp(l,`focusin`,e,!0),bp(l,`focusout`,e,!0))},[l,v]),b.useEffect(()=>{!l||x!==!1||(xg(l),_.current=!1)},[x,l]);let C=b.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,y.jsxs)(b.Fragment,{children:[u,(0,y.jsxs)(E_.Provider,{value:C,children:[S&&l&&(0,y.jsx)(qm,{"data-type":`outside`,ref:d,onFocus:e=>{yg(e,l)?p.current?.focus():hg(h?h.domReference:null)?.focus()}}),S&&l&&(0,y.jsx)(`span`,{"aria-owns":l.id,style:w_}),l&&T_.createPortal(n,l),S&&l&&(0,y.jsx)(qm,{"data-type":`outside`,ref:f,onFocus:e=>{yg(e,l)?m.current?.focus():(mg(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,Dm(`focus-out`,e.nativeEvent)))}})]})]})});function j_(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var M_=class{nodesRef={current:[]};events=j_();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},N_=b.createContext(null),P_=b.createContext(null),F_=()=>b.useContext(N_)?.id||null,I_=e=>{let t=b.useContext(P_);return e??t};function L_(e){let t=Ug(),n=I_(e),r=F_();return X(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function R_(e){let{children:t,id:n}=e,r=F_();return(0,y.jsx)(N_.Provider,{value:b.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function z_(e){let{children:t,externalTree:n}=e,r=Ip(()=>n??new M_).current;return(0,y.jsx)(P_.Provider,{value:r,children:t})}function B_(e){return e==null?e:`current`in e?e.current:e}function V_(e,t){let n=Zf(nh(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var H_=20,U_=[];function W_(){U_=U_.filter(e=>e.deref()?.isConnected)}function G_(e){W_(),e&&Xf(e)!==`body`&&(U_.push(new WeakRef(e)),U_.length>H_&&(U_=U_.slice(-H_)))}function K_(){return W_(),U_[U_.length-1]?.deref()}function q_(e){return e?ug(e)?e:fg(e)[0]||e:null}function J_(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=dg(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return ug(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Y_(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:x,dataRef:S}=h.context,C=Z(()=>S.current.floatingContext?.nodeId),w=i===!1,T=ch(_)&&w,E=b.useRef([`content`]),D=Rm(i),O=Rm(a),k=Rm(l),A=I_(p),j=D_(),M=b.useRef(!1),N=b.useRef(!1),P=b.useRef(!1),F=b.useRef(null),I=b.useRef(``),L=b.useRef(``),ee=b.useRef(null),R=b.useRef(null),te=Mm(ee,f,j?.beforeInsideRef),z=Mm(R,j?.afterInsideRef),B=Vp(),V=Vp(),H=Gp(),ne=j!=null,U=uh(v),re=Z((e=U)=>e?fg(e):[]),ie=Z(()=>m?.().filter(e=>e!=null)??[]);b.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&th(U,eh(Pp(U)))&&re().length===0&&!T&&im(e)}return bp(Pp(U),`keydown`,e)},[r,_,U,s,E,T,re]),b.useEffect(()=>{if(r||!g)return;let e=Pp(U);function t(){P.current=!1}function n(e){let t=nh(e),n=ie();P.current=!(th(v,t)||th(_,t)||th(j?.portalNode,t)||n.some(e=>e===t||th(e,t))),L.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(N.current=!0)}function i(){L.current=`keyboard`}return jm(bp(e,`pointerdown`,n,!0),bp(e,`pointerup`,t,!0),bp(e,`pointercancel`,t,!0),bp(e,`keydown`,i,!0))},[r,v,_,U,g,j,ie]),b.useEffect(()=>{if(r||!c)return;let e=Pp(U);function t(){N.current=!0,V.start(0,()=>{N.current=!1})}function n(e){let t=nh(e);ug(t)&&(F.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=nh(t);queueMicrotask(()=>{let a=C(),c=h.context.triggerElements,l=ie(),f=n?.hasAttribute(wg(`focus-guard`))&&[ee.current,R.current,j?.beforeInsideRef.current,j?.afterInsideRef.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,B_(d),B_(u)].includes(n),p=!(th(_,n)||th(v,n)||th(n,v)||th(j?.portalNode,n)||l.some(e=>e===n||th(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>th(e,n))||f||A&&(Sg(A.nodesRef.current,a).find(e=>th(e.context?.elements.floating,n)||th(e.context?.elements.domReference,n))||Cg(A.nodesRef.current,a).find(e=>[e.context?.elements.floating,uh(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&U&&J_(U,E),o&&r!==_&&!Xh(i)&&eh(e)===e.body){if(tp(U)&&(U.focus(),o===`popup`)){H.request(()=>{U.focus()});return}let e=re(),t=F.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||U;tp(n)&&n.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(T||!s)&&n&&p&&!N.current&&(T||n!==K_())&&(M.current=!0,h.setOpen(!1,Dm(bm,t)))})}function a(){P.current||(S.current.insideReactTree=!0,B.start(0,()=>{S.current.insideReactTree=!1}))}let l=tp(_)?_:null;if(!(!v&&!l))return jm(l&&bp(l,`focusout`,i),l&&bp(l,`pointerdown`,t),v&&bp(v,`focusin`,n),v&&bp(v,`focusout`,i),v&&j&&bp(v,`focusout`,a,!0))},[r,_,v,U,s,A,j,h,c,o,re,T,C,E,S,B,V,H,u,d,ie]),b.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(j?.portalNode?.querySelectorAll(`[${wg(`portal`)}]`)||[]),t=(A?Cg(A.nodesRef.current,C()):[]).find(e=>ch(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Rg([...[v,...e,ee.current,R.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,...ie()],t,B_(d),B_(u),T?_:null].filter(e=>e!=null),{ariaHidden:s||T,mark:!1}),i=Rg([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,E,j,T,A,C,u,d,ie]),X(()=>{if(!g||r||!tp(U))return;let e=eh(Pp(U));queueMicrotask(()=>{let t=D.current,n=typeof t==`function`?t(k.current||``):t;if(n===void 0||n===!1||th(U,e))return;let r=null,i=()=>(r??=re(U),r[0]||U),a;a=n===!0||n===null?i():B_(n),a||=i(),Eg(a,{preventScroll:a===U})})},[r,g,U,w,re,D,k]),X(()=>{if(r||!U)return;let e=Pp(U);G_(eh(e));function t(e){if(e.open||(I.current=V_(e.nativeEvent,L.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(M.current=!0),e.reason===`outside-press`)if(e.nested)M.current=!1;else if(om(e.nativeEvent)||sm(e.nativeEvent))M.current=!1;else{let e=!1;Pp(U).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?M.current=!1:M.current=!0}}x.on(`openchange`,t);function n(){let e=O.current,t=typeof e==`function`?e(I.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=_||K_();return e&&e.isConnected?e:null}let n=_||K_();return B_(t)||n||null}return()=>{x.off(`openchange`,t);let r=eh(e),i=ie(),a=th(v,r)||i.some(e=>e===r||th(e,r))||A&&Sg(A.nodesRef.current,C(),!1).some(e=>th(e.context?.elements.floating,r)),o=O.current,s=n();queueMicrotask(()=>{let t=q_(s),n=typeof o!=`boolean`;o&&!M.current&&tp(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),M.current=!1})}},[r,v,U,O,S,x,A,_,C,ie]),X(()=>{if(!Tp||g||!v)return;let e=eh(Pp(v));!tp(e)||!oh(e)||th(v,e)&&e.blur()},[g,v]),X(()=>{if(!(r||!j))return j.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{j.setFocusManagerState(null)}},[r,j,s,g,h,c,_]),X(()=>{if(!(r||!U))return J_(U,E),()=>{queueMicrotask(W_)}},[r,U,E]);let ae=!r&&(s?!T:!0)&&(ne||s);return(0,y.jsxs)(b.Fragment,{children:[ae&&(0,y.jsx)(qm,{"data-type":`inside`,ref:te,onFocus:e=>{if(s){let e=re();Eg(e[e.length-1])}else j?.portalNode&&(M.current=!1,yg(e,j.portalNode)?mg(_)?.focus():B_(d??j.beforeOutsideRef)?.focus())}}),n,ae&&(0,y.jsx)(qm,{"data-type":`inside`,ref:z,onFocus:e=>{s?Eg(re()[0]):j?.portalNode&&(c&&(M.current=!0),yg(e,j.portalNode)?hg(_)?.focus():B_(u??j.afterOutsideRef)?.focus())}})]})}function X_(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0,reason:u=hm}=t,d=b.useRef(void 0),f=Gp(),p=Vp(),m=b.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){let t=d.current,i=e.nativeEvent,m=n.select(`open`);if(e.button!==0||a===`click`||cm(t,!0)&&s)return;let h=r.current.openEvent,g=h?.type,_=n.select(`domReferenceElement`)!==e.currentTarget,v=m&&_||!(m&&o&&(!(h&&c)||g===`click`||g===`mousedown`)),y=nh(i);if(oh(y)){let e=Dm(u,i,y);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e);return}let b=e.currentTarget;f.request(()=>{let e=Dm(u,i,b);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e)})},onClick(e){if(a===`mousedown-only`)return;let t=d.current;if(a===`mousedown`&&t){d.current=void 0;return}if(cm(t,!0)&&s)return;let i=n.select(`open`),f=r.current.openEvent,m=n.select(`domReferenceElement`)!==e.currentTarget,h=i&&m||!(i&&o&&(!(f&&c)||lm(f))),g=Dm(u,e.nativeEvent,e.currentTarget);h&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,g)}):n.setOpen(h,g)},onKeyDown(){d.current=void 0}}),[r,a,s,n,c,o,f,p,l,u]);return b.useMemo(()=>i?{reference:m}:Jp,[i,m])}function Z_(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function Q_(e){return e!=null&&e.clientX!=null}function $_(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{enabled:s=!0,axis:c=`both`}=t,l=b.useRef(!1),u=b.useRef(null),[d,f]=b.useState(),[p,m]=b.useState([]),h=Z((e,t,r)=>{l.current||o.current.openEvent&&!Q_(o.current.openEvent)||n.set(`positionReference`,Z_(r??a,{x:e,y:t,axis:c,dataRef:o,pointerType:d}))}),g=Z(e=>{r?u.current||m([]):h(e.clientX,e.clientY,e.currentTarget)}),_=cm(d)?i:r,v=b.useCallback(()=>{if(!_||!s)return;let e=Zf(i);function t(e){th(i,nh(e))?(u.current?.(),u.current=null):h(e.clientX,e.clientY)}if(!o.current.openEvent||Q_(o.current.openEvent))return u.current=bp(e,`mousemove`,t),()=>{u.current?.(),u.current=null};n.set(`positionReference`,a)},[_,s,i,o,a,n,h]);b.useEffect(()=>v(),[v,p]),b.useEffect(()=>{s&&!i&&(l.current=!1)},[s,i]),b.useEffect(()=>{!s&&r&&(l.current=!0)},[s,r]);let y=b.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:g,onMouseEnter:g}},[g]);return b.useMemo(()=>s?{reference:y,trigger:y}:{},[s,y])}var ev={intentional:`onClick`,sloppy:`onPointerDown`};function tv(){return!1}function nv(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function rv(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),{dataRef:a}=n.context,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`sloppy`,referencePress:u=tv,referencePressEvent:d=`sloppy`,bubbles:f,externalTree:p}=t,m=I_(p),h=Z(typeof c==`function`?c:()=>!1),g=typeof c==`function`?h:c,_=g!==!1,v=Z(()=>l),y=b.useRef(!1),x=b.useRef(!1),S=b.useRef(!1),{escapeKey:C,outsidePress:w}=nv(f),T=b.useRef(null),E=Vp(),D=Vp(),O=Z(()=>{D.clear(),a.current.insideReactTree=!1}),k=b.useRef(!1),A=b.useRef(``),j=Z(u),M=Z(e=>{if(!r||!o||!s||e.key!==`Escape`||k.current)return;let t=a.current.floatingContext?.nodeId,i=m?Sg(m.nodesRef.current,t):[];if(!C&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let c=Dm(xm,am(e)?e.nativeEvent:e);n.setOpen(!1,c),!C&&!c.isPropagationAllowed&&e.stopPropagation()}),N=Z(()=>{a.current.insideReactTree=!0,D.start(0,O)});b.useEffect(()=>{if(!r||!o)return;a.current.__escapeKeyBubbles=C,a.current.__outsidePressBubbles=w;let e=new Bp,t=new Bp;function c(){e.clear(),k.current=!0}function l(){e.start(fp()?5:0,()=>{k.current=!1})}function u(){S.current=!0,t.start(0,()=>{S.current=!1})}function d(){y.current=!1,x.current=!1}function f(){let e=A.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function p(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=a.current.floatingContext?.nodeId,r=m&&Sg(m.nodesRef.current,t).some(t=>ih(e,t.context?.elements.floating));return ih(e,n.select(`floatingElement`))||ih(e,n.select(`domReferenceElement`))||r}function b(e){if(p(e)){O();return}if(a.current.insideReactTree){O();return}let r=nh(e),i=`[${wg(`inert`)}]`,o=ep(r)?r.getRootNode():null,s=Array.from((np(o)?o:Pp(n.select(`floatingElement`))).querySelectorAll(i)),c=n.context.triggerElements;if(r&&(c.hasElement(r)||c.hasMatchingElement(e=>th(e,r))))return;let l=ep(r)?r:null;for(;l&&!pp(l);){let e=gp(l);if(pp(e)||!ep(e))break;l=e}if(s.length&&ep(r)&&!ah(r)&&!th(r,n.select(`floatingElement`))&&s.every(e=>!th(l,e)))return;if(tp(r)&&!(`touches`in e)){let t=pp(r),n=mp(r),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=r.offsetWidth-r.clientWidth:e.offsetX>r.clientWidth),d=s&&e.offsetY>r.clientHeight;if(u||d)return}if(h(e))return;if(f()===`intentional`&&S.current){t.clear(),S.current=!1;return}if(typeof g==`function`&&!g(e))return;let u=a.current.floatingContext?.nodeId,d=m?Sg(m.nodesRef.current,u):[];if(d.length>0){let e=!0;if(d.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,Dm(vm,e)),O()}function D(e){f()!==`sloppy`||e.pointerType===`touch`||!n.select(`open`)||!o||ih(e,n.select(`floatingElement`))||ih(e,n.select(`domReferenceElement`))||b(e)}function j(e){if(f()!==`sloppy`||!n.select(`open`)||!o||ih(e,n.select(`floatingElement`))||ih(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function N(e,t){let n=nh(e);if(!n)return;let r=bp(n,e.type,()=>{t(e),r()})}function P(e){A.current=`touch`,N(e,j)}function F(e){E.clear(),e.type===`pointerdown`&&(A.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&N(e,e=>{e.type===`pointerdown`?D(e):b(e)})}function I(e){if(!y.current)return;let n=x.current;if(d(),f()===`intentional`){if(e.type===`pointercancel`){n&&u();return}if(!h(e)){if(n){u();return}typeof g==`function`&&!g(e)||(t.clear(),S.current=!0,O())}}}function L(e){if(f()!==`sloppy`||!T.current||ih(e,n.select(`floatingElement`))||ih(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-T.current.startX),i=Math.abs(t.clientY-T.current.startY),a=Math.sqrt(r*r+i*i);a>5&&(T.current.dismissOnTouchEnd=!0),a>10&&(b(e),E.clear(),T.current=null)}function ee(e){N(e,L)}function R(e){f()!==`sloppy`||!T.current||ih(e,n.select(`floatingElement`))||ih(e,n.select(`domReferenceElement`))||(T.current.dismissOnTouchEnd&&b(e),E.clear(),T.current=null)}function te(e){N(e,R)}let z=Pp(i),B=jm(s&&jm(bp(z,`keydown`,M),bp(z,`compositionstart`,c),bp(z,`compositionend`,l)),_&&jm(bp(z,`click`,F,!0),bp(z,`pointerdown`,F,!0),bp(z,`pointerup`,I,!0),bp(z,`pointercancel`,I,!0),bp(z,`mousedown`,F,!0),bp(z,`mouseup`,I,!0),bp(z,`touchstart`,P,!0),bp(z,`touchmove`,ee,!0),bp(z,`touchend`,te,!0)));return()=>{B(),e.clear(),t.clear(),d(),S.current=!1}},[a,i,s,_,g,r,o,C,w,M,O,v,m,n,E]),b.useEffect(O,[g,O]);let P=b.useMemo(()=>({onKeyDown:M,[ev[d]]:e=>{j()&&n.setOpen(!1,Dm(hm,e.nativeEvent))},...d!==`intentional`&&{onClick(e){j()&&n.setOpen(!1,Dm(`trigger-press`,e.nativeEvent))}}}),[M,n,d,j]),F=Z(e=>{if(!r||!o||e.button!==0)return;let t=nh(e.nativeEvent);th(n.select(`floatingElement`),t)&&(y.current||(y.current=!0,x.current=!1))}),I=Z(e=>{!r||!o||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&y.current&&(x.current=!0)}),L=b.useMemo(()=>({onKeyDown:M,onPointerDown:I,onMouseDown:I,onClickCapture:N,onMouseDownCapture(e){N(),F(e)},onPointerDownCapture(e){N(),F(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[M,N,F,I]);return b.useMemo(()=>o?{reference:P,floating:L,trigger:P}:{},[o,P,L])}function iv(e,t,n){let{reference:r,floating:i}=e,a=wh(t),o=Th(t),s=Ch(o),c=bh(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(xh(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function av(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=yh(t,e),p=Lh(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Rh(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Rh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ov=50,sv=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:av},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=iv(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ov&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=iv(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},cv=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=yh(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=bh(r),_=wh(o),v=bh(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Fh(o)]:Dh(o)),x=p!==`none`;!d&&x&&b.push(...Ph(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Eh(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==wh(t))||T.every(e=>wh(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=wh(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function lv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uv(e){return dh.some(t=>e[t]>=0)}var dv=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=yh(e,t);switch(i){case`referenceHidden`:{let e=lv(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:uv(e)}}}case`escaped`:{let e=lv(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:uv(e)}}}default:return{}}}}},fv=new Set([`left`,`top`]);async function pv(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=bh(n),s=xh(n),c=wh(n)===`y`,l=fv.has(o)?-1:1,u=a&&c?-1:1,d=yh(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var mv=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await pv(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},hv=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=yh(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=wh(bh(i)),p=Sh(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=vh(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=vh(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},gv=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=yh(e,t),u={x:n,y:r},d=wh(i),f=Sh(d),p=u[f],m=u[d],h=yh(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=fv.has(bh(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},_v=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=yh(e,t),u=await o.detectOverflow(t,l),d=bh(i),f=xh(i),p=wh(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=fh(h-u[g],v),x=fh(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=ph(u.left,0),t=ph(u.right,0),n=ph(u.top,0),r=ph(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:ph(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:ph(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function vv(e){let t=mp(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=tp(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=mh(n)!==a||mh(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function yv(e){return ep(e)?e:e.contextElement}function bv(e){let t=yv(e);if(!tp(t))return gh(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=vv(t),o=(a?mh(n.width):n.width)/r,s=(a?mh(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var xv=gh(0);function Sv(e){let t=Zf(e);return!fp()||!t.visualViewport?xv:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Cv(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Zf(e)?!1:t}function wv(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=yv(e),o=gh(1);t&&(r?ep(r)&&(o=bv(r)):o=bv(e));let s=Cv(a,n,r)?Sv(a):gh(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Zf(a),t=r&&ep(r)?Zf(r):r,n=e,i=yp(n);for(;i&&r&&t!==n;){let e=bv(i),t=i.getBoundingClientRect(),r=mp(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Zf(i),i=yp(n)}}return Rh({width:u,height:d,x:c,y:l})}function Tv(e,t){let n=hp(e).scrollLeft;return t?t.left+n:wv(Qf(e)).left+n}function Ev(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Tv(e,n),y:n.top+t.scrollTop}}function Dv(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Qf(r),s=t?ap(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=gh(1),u=gh(0),d=tp(r);if((d||!d&&!a)&&((Xf(r)!==`body`||rp(o))&&(c=hp(r)),d)){let e=wv(r);l=bv(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ev(o,c):gh(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ov(e){return Array.from(e.getClientRects())}function kv(e){let t=Qf(e),n=hp(e),r=e.ownerDocument.body,i=ph(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ph(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Tv(e),s=-n.scrollTop;return mp(r).direction===`rtl`&&(o+=ph(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Av=25;function jv(e,t){let n=Zf(e),r=Qf(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=fp();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Tv(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Av&&(a-=o)}else l<=Av&&(a+=l);return{width:a,height:o,x:s,y:c}}function Mv(e,t){let n=wv(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=tp(e)?bv(e):gh(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Nv(e,t,n){let r;if(t===`viewport`)r=jv(e,n);else if(t===`document`)r=kv(Qf(e));else if(ep(t))r=Mv(t,n);else{let n=Sv(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Rh(r)}function Pv(e,t){let n=gp(e);return n===t||!ep(n)||pp(n)?!1:mp(n).position===`fixed`||Pv(n,t)}function Fv(e,t){let n=t.get(e);if(n)return n;let r=vp(e,[],!1).filter(e=>ep(e)&&Xf(e)!==`body`),i=null,a=mp(e).position===`fixed`,o=a?gp(e):e;for(;ep(o)&&!pp(o);){let t=mp(o),n=up(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||rp(o)&&!n&&Pv(e,o))?r=r.filter(e=>e!==o):i=t,o=gp(o)}return t.set(e,r),r}function Iv(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ap(t)?[]:Fv(t,this._c):[].concat(n),r],o=Nv(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Nv(t,a[e],i);s=ph(n.top,s),c=fh(n.right,c),l=fh(n.bottom,l),u=ph(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Lv(e){let{width:t,height:n}=vv(e);return{width:t,height:n}}function Rv(e,t,n){let r=tp(t),i=Qf(t),a=n===`fixed`,o=wv(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=gh(0);function l(){c.x=Tv(i)}if(r||!r&&!a)if((Xf(t)!==`body`||rp(i))&&(s=hp(t)),r){let e=wv(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Ev(i,s):gh(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function zv(e){return mp(e).position===`static`}function Bv(e,t){if(!tp(e)||mp(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Qf(e)===n&&(n=n.ownerDocument.body),n}function Vv(e,t){let n=Zf(e);if(ap(e))return n;if(!tp(e)){let t=gp(e);for(;t&&!pp(t);){if(ep(t)&&!zv(t))return t;t=gp(t)}return n}let r=Bv(e,t);for(;r&&ip(r)&&zv(r);)r=Bv(r,t);return r&&pp(r)&&zv(r)&&!up(r)?n:r||dp(e)||n}var Hv=async function(e){let t=this.getOffsetParent||Vv,n=this.getDimensions,r=await n(e.floating);return{reference:Rv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Uv(e){return mp(e).direction===`rtl`}var Wv={convertOffsetParentRelativeRectToViewportRelativeRect:Dv,getDocumentElement:Qf,getClippingRect:Iv,getOffsetParent:Vv,getElementRects:Hv,getClientRects:Ov,getDimensions:Lv,getScale:bv,isElement:ep,isRTL:Uv};function Gv(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Kv(e,t){let n=null,r,i=Qf(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=hh(d),h=hh(i.clientWidth-(u+f)),g=hh(i.clientHeight-(d+p)),_=hh(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ph(0,fh(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Gv(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function qv(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=yv(e),u=i||a?[...l?vp(l):[],...t?vp(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Kv(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?wv(e):null;c&&g();function g(){let t=wv(e);h&&!Gv(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Jv=mv,Yv=hv,Xv=cv,Zv=_v,Qv=dv,$v=gv,ey=(e,t,n)=>{let r=new Map,i={platform:Wv,...n},a={...i.platform,_c:r};return sv(e,t,{...i,platform:a})},ty=typeof document<`u`?b.useLayoutEffect:function(){};function ny(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ny(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!ny(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ry(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function iy(e,t){let n=ry(e);return Math.round(t*n)/n}function ay(e){let t=b.useRef(e);return ty(()=>{t.current=e}),t}function oy(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=b.useState(r);ny(f,r)||p(r);let[m,h]=b.useState(null),[g,_]=b.useState(null),v=b.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=b.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=b.useRef(null),w=b.useRef(null),T=b.useRef(u),E=c!=null,D=ay(c),O=ay(i),k=ay(l),A=b.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),ey(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!ny(T.current,t)&&(T.current=t,T_.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);ty(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=b.useRef(!1);ty(()=>(j.current=!0,()=>{j.current=!1}),[]),ty(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=b.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=b.useMemo(()=>({reference:x,floating:S}),[x,S]),P=b.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=iy(N.floating,u.x),r=iy(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ry(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return b.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var sy=(e,t)=>{let n=Jv(e);return{name:n.name,fn:n.fn,options:[e,t]}},cy=(e,t)=>{let n=Yv(e);return{name:n.name,fn:n.fn,options:[e,t]}},ly=(e,t)=>({fn:$v(e).fn,options:[e,t]}),uy=(e,t)=>{let n=Xv(e);return{name:n.name,fn:n.fn,options:[e,t]}},dy=(e,t)=>{let n=Zv(e);return{name:n.name,fn:n.fn,options:[e,t]}},fy=(e,t)=>{let n=Qv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(Gg(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},py=o((e=>{var t=f();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})),my=o(((e,t)=>{t.exports=py()})),hy=o((e=>{var t=f(),n=my();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}})),gy=o(((e,t)=>{t.exports=hy()})),_y=[],vy=void 0;function yy(){return vy}function by(e){_y.push(e)}function xy(e){let t=(t,n)=>{let r=Ip(Cy).current,i;try{vy=r;for(let e of _y)e.before(r);i=e(t,n);for(let e of _y)e.after(r);r.didInitialize=!0}finally{vy=void 0}return i};return t.displayName=e.displayName||e.name,t}function Sy(e){return b.forwardRef(xy(e))}function Cy(){return{didInitialize:!1}}var wy=my(),Ty=gy(),Ey=qg(19)?ky:Ay;function Dy(e,t,n,r,i){return Ey(e,t,n,r,i)}function Oy(e,t,n,r,i){let a=b.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,wy.useSyncExternalStore)(e.subscribe,a,a)}by({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,wy.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function ky(e,t,n,r,i){let a=yy();if(!a)return Oy(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 Ay(e,t,n,r,i){return(0,Ty.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var jy=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 Dy(this,e,t,n,r)}},My=class extends jy{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){b.useDebugValue(e),X(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;X(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;X(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){b.useDebugValue(e);let n=t!==void 0;X(()=>{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 b.useDebugValue(e),Dy(this,this.selectors[e],t,n,r)}useContextCallback(e,t){b.useDebugValue(e);let n=Z(t??Kp);this.context[e]=n}useStateSetter(e){let t=b.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)}})}},Ny={open:Q(e=>e.open),transitionStatus:Q(e=>e.transitionStatus),domReferenceElement:Q(e=>e.domReferenceElement),referenceElement:Q(e=>e.positionReference??e.referenceElement),floatingElement:Q(e=>e.floatingElement),floatingId:Q(e=>e.floatingId)},Py=class extends My{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:j_(),nested:n,triggerElements:i},Ny),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&lm(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function Fy(e,t=!1,n=!1){let[r,i]=b.useState(e&&t?`idle`:void 0),[a,o]=b.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),X(()=>{if(!e&&a&&r!==`ending`&&n){let e=Wp.request(()=>{i(`ending`)});return()=>{Wp.cancel(e)}}},[e,a,r,n]),X(()=>{if(!e||t)return;let n=Wp.request(()=>{i(void 0)});return()=>{Wp.cancel(n)}},[t,e]),X(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=Wp.request(()=>{i(`idle`)});return()=>{Wp.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}var Iy=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),Ly={[Iy.startingStyle]:``},Ry={[Iy.endingStyle]:``},zy={transitionStatus(e){return e===`starting`?Ly:e===`ending`?Ry:null}};function By(e,t=!1,n=!0){let r=Gp();return Z((i,a=null)=>{r.cancel();let o=B_(e);if(o==null)return;let s=o,c=()=>{T_.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=Iy.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function Vy(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=Z(i),o=By(r,n,!1);b.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}function Hy(e,t){let n=b.useRef(null),r=b.useRef(null);return b.useCallback(i=>{if(e!==void 0){if(n.current!==null){let e=n.current,i=r.current,a=t.context.triggerElements.getById(e);i&&a===i&&t.context.triggerElements.delete(e),n.current=null,r.current=null}i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i))}},[t,e])}function Uy(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Hy(e,n),o=Z(t=>{if(a(t),!t||!n.select(`open`))return;let i=n.select(`activeTriggerId`);if(i===e){n.update({activeTriggerElement:t,...r});return}i??n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return X(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function Wy(e){let t=e.useState(`open`);X(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function Gy(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=Fy(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=Z(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Vy({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var Ky=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function qy(){return new Py({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Ky,floatingId:``,syncOnly:!1,nested:!1,onOpenChange:void 0})}function Jy(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:qy(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Jp,inactiveTriggerProps:Jp,popupProps:Jp}}var Yy=Q(e=>e.triggerIdProp??e.activeTriggerId),Xy={open:Q(e=>e.openProp??e.open),mounted:Q(e=>e.mounted),transitionStatus:Q(e=>e.transitionStatus),floatingRootContext:Q(e=>e.floatingRootContext),preventUnmountingOnClose:Q(e=>e.preventUnmountingOnClose),payload:Q(e=>e.payload),activeTriggerId:Yy,activeTriggerElement:Q(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Q((e,t)=>t!==void 0&&Yy(e)===t),isOpenedByTrigger:Q((e,t)=>t!==void 0&&Yy(e)===t&&e.open),isMountedByTrigger:Q((e,t)=>t!==void 0&&Yy(e)===t&&e.mounted),triggerProps:Q((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Q(e=>e.popupProps),popupElement:Q(e=>e.popupElement),positionerElement:Q(e=>e.positionerElement)};function Zy(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Ug(),a=F_()!=null,o=Ip(()=>new Py({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ky,floatingId:i,syncOnly:!1,nested:a})).current;return X(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=ep(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Qy(e={}){let{nodeId:t,externalTree:n}=e,r=Zy(e),i=e.rootContext||r,a={reference:i.useState(`referenceElement`),floating:i.useState(`floatingElement`),domReference:i.useState(`domReferenceElement`)},[o,s]=b.useState(null),c=b.useRef(null),l=I_(n);X(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);let u=oy({...e,elements:{...a,...o&&{reference:o}}}),d=b.useCallback(e=>{let t=ep(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;s(t),u.refs.setReference(t)},[u.refs]),[f,p]=b.useState(void 0),[m,h]=b.useState(null);i.useSyncedValue(`referenceElement`,f??null);let g=ep(f)?f:null;i.useSyncedValue(`domReferenceElement`,f===void 0?a.domReference:g),i.useSyncedValue(`floatingElement`,m);let _=b.useCallback(e=>{(ep(e)||e===null)&&(c.current=e,p(e)),(ep(u.refs.reference.current)||u.refs.reference.current===null||e!==null&&!ep(e))&&u.refs.setReference(e)},[u.refs,p]),v=b.useCallback(e=>{h(e),u.refs.setFloating(e)},[u.refs]),y=b.useMemo(()=>({...u.refs,setReference:_,setFloating:v,setPositionReference:d,domReference:c}),[u.refs,_,v,d]),x=b.useMemo(()=>({...u.elements,domReference:a.domReference}),[u.elements,a.domReference]),S=i.useState(`open`),C=i.useState(`floatingId`),w=b.useMemo(()=>({...u,dataRef:i.context.dataRef,open:S,onOpenChange:i.setOpen,events:i.context.events,floatingId:C,refs:y,elements:x,nodeId:t,rootStore:i}),[u,y,x,t,i,S,C]);return X(()=>{i.context.dataRef.current.floatingContext=w;let e=l?.nodesRef.current.find(e=>e.id===t);e&&(e.context=w)}),b.useMemo(()=>({...u,context:w,refs:y,elements:x,rootStore:i}),[u,y,x,w,i])}function $y(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,i=Ug(),a=F_()!=null,o=t.useState(`open`),s=t.useState(`activeTriggerElement`),c=t.useState(n?`popupElement`:`positionerElement`),l=t.context.triggerElements,u=Ip(()=>new Py({open:o,transitionStatus:void 0,referenceElement:s,floatingElement:c,triggerElements:l,onOpenChange:r,floatingId:i,syncOnly:!0,nested:a})).current;return X(()=>{let e={open:o,floatingId:i,referenceElement:s,floatingElement:c};ep(s)&&(e.domReferenceElement=s),u.state.positionReference===u.state.referenceElement&&(e.positionReference=s),u.update(e)},[o,i,s,c,u]),u.context.onOpenChange=r,u.context.nested=a,u}var eb=kp&&Dp;function tb(e,t={}){let n=`rootStore`in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,delay:o}=t,s=b.useRef(!1),c=b.useRef(null),l=Vp(),u=b.useRef(!0);b.useEffect(()=>{let e=n.select(`domReferenceElement`);if(!a)return;let t=Zf(e);function r(){let e=n.select(`domReferenceElement`);!n.select(`open`)&&tp(e)&&e===eh(Pp(e))&&(s.current=!0)}function i(){u.current=!0}function o(){u.current=!1}return jm(bp(t,`blur`,r),eb&&bp(t,`keydown`,i,!0),eb&&bp(t,`pointerdown`,o,!0))},[n,a]),b.useEffect(()=>{if(!a)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=n.select(`domReferenceElement`);ep(e)&&(c.current=e,s.current=!0)}}return r.on(`openchange`,e),()=>{r.off(`openchange`,e)}},[r,a,n]);let d=b.useMemo(()=>({onMouseLeave(){s.current=!1,c.current=null},onFocus(e){let t=e.currentTarget;if(s.current){if(c.current===t)return;s.current=!1,c.current=null}let r=nh(e.nativeEvent);if(ep(r)){if(eb&&!e.relatedTarget){if(!u.current&&!oh(r))return}else if(!lh(r))return}let i=rh(e.relatedTarget,n.context.triggerElements),{nativeEvent:a,currentTarget:d}=e,f=typeof o==`function`?o():o;if(n.select(`open`)&&i||f===0||f===void 0){n.setOpen(!0,Dm(_m,a,d));return}l.start(f,()=>{s.current||n.setOpen(!0,Dm(_m,a,d))})},onBlur(e){s.current=!1,c.current=null;let t=e.relatedTarget,r=e.nativeEvent,a=ep(t)&&t.hasAttribute(wg(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let e=n.select(`domReferenceElement`),o=eh(Pp(e));!t&&o===e||th(i.current.floatingContext?.refs.floating.current,o)||th(e,o)||a||rh(t??o,n.context.triggerElements)||n.setOpen(!1,Dm(_m,r))})}}),[i,n,l,o]);return b.useMemo(()=>a?{reference:d,trigger:d}:{},[a,d])}var nb=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Bp,this.restTimeout=new Bp,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},rb=new WeakMap;function ib(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&rb.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),rb.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function ab(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=rb.get(n);a&&a!==e&&ib(a),ib(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,rb.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function ob(e){let t=Ip(nb.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||=t,Rp(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function sb(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:c=0,nodeId:l}=t,u=ob(n),d=I_(),f=F_(),p=Z(()=>pm(o.current.openEvent?.type,u.interactedInside)),m=Z(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),h=Z(e=>rh(e,n.context.triggerElements)),g=b.useCallback(e=>{let t=dm(c,`close`,u.pointerType),r=()=>{n.setOpen(!1,Dm(gm,e)),d?.events.emit(`floating.closed`,e)};t?u.openChangeTimeout.start(t,r):(u.openChangeTimeout.clear(),r())},[c,n,u,d]),_=Z(()=>{ib(u)}),v=Z(e=>{let t=nh(e);if(!sh(t)){u.interactedInside=!1;return}u.interactedInside=t?.closest(`[aria-haspopup]`)!=null});X(()=>{r||(u.pointerType=void 0,u.restTimeoutPending=!1,u.interactedInside=!1,_())},[r,u,_]),b.useEffect(()=>_,[_]),X(()=>{if(s&&r&&u.handleCloseOptions?.blockPointerEvents&&m()&&ep(a)&&i){let e=a,t=i,n=Pp(i),r=d?.nodesRef.current.find(e=>e.id===f)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),ab(u,{scopeElement:u.handleCloseOptions?.getScope?.()??u.pointerEventsScopeElement??r??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{_()}}},[s,r,a,i,u,m,d,f,_]);let y=Vp();b.useEffect(()=>{if(!s)return;function e(){u.openChangeTimeout.clear(),y.clear(),d?.events.off(`floating.closed`,r),_()}function t(e){if(d&&f&&Sg(d.nodesRef.current,f).length>0){d.events.on(`floating.closed`,r);return}if(h(e.relatedTarget))return;let t=o.current.floatingContext?.nodeId??l,n=e.relatedTarget;if(!(d&&t&&ep(n)&&Sg(d.nodesRef.current,t,!1).some(e=>th(e.context?.elements.floating,n)))){if(u.handler){u.handler(e);return}_(),p()||g(e)}}function r(e){!d||!f||Sg(d.nodesRef.current,f).length>0||y.start(0,()=>{d.events.off(`floating.closed`,r),n.setOpen(!1,Dm(gm,e)),d.events.emit(`floating.closed`,e)})}let a=i;return jm(a&&bp(a,`mouseenter`,e),a&&bp(a,`mouseleave`,t),a&&bp(a,`pointerdown`,v,!0),()=>{d?.events.off(`floating.closed`,r)})},[s,i,n,o,l,p,h,g,_,v,u,d,f,y])}var cb={current:null};function lb(e,t={}){let n=`rootStore`in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:d=cb,externalTree:f,isActiveTrigger:p=!0,getHandleCloseContext:m,isClosing:h}=t,g=I_(f),_=ob(n),v=b.useRef(!1),y=Rm(s),x=Rm(o),S=Rm(l),C=Rm(a),w=Rm(h);p&&(_.handleCloseOptions=y.current?.__options);let T=Z(()=>pm(r.current.openEvent?.type,_.interactedInside)),E=Z(e=>rh(e,n.context.triggerElements)),D=Z((e,t,r)=>{let i=n.context.triggerElements;if(i.hasElement(t))return!e||!th(e,t);if(!ep(r))return!1;let a=r;return i.hasMatchingElement(e=>th(e,a))&&(!e||!th(e,a))}),O=Z((e,t=!0)=>{let r=dm(x.current,`close`,_.pointerType);r?_.openChangeTimeout.start(r,()=>{n.setOpen(!1,Dm(gm,e)),g?.events.emit(`floating.closed`,e)}):t&&(_.openChangeTimeout.clear(),n.setOpen(!1,Dm(gm,e)),g?.events.emit(`floating.closed`,e))}),k=Z(()=>{_.handler&&=(Pp(n.select(`domReferenceElement`)).removeEventListener(`mousemove`,_.handler),void 0)}),A=Z(()=>{ib(_)});return b.useEffect(()=>k,[k]),b.useEffect(()=>{if(!a)return;function e(e){e.open?v.current=!1:(v.current=e.reason===gm,k(),_.openChangeTimeout.clear(),_.restTimeout.clear(),_.blockMouseMove=!0,_.restTimeoutPending=!1)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[a,i,_,k]),b.useEffect(()=>{if(!a)return;let e=d.current??(p?n.select(`domReferenceElement`):null);if(!ep(e))return;function t(e){if(_.openChangeTimeout.clear(),_.blockMouseMove=!1,c&&!cm(_.pointerType))return;let t=fm(S.current),r=dm(x.current,`open`,_.pointerType),i=nh(e),a=e.currentTarget??null,o=n.select(`domReferenceElement`),s=a;if(ep(i)&&!n.context.triggerElements.hasElement(i)){for(let e of n.context.triggerElements.elements())if(th(e,i)){s=e;break}}ep(a)&&ep(o)&&!n.context.triggerElements.hasElement(a)&&th(a,o)&&(s=o);let l=s==null?!1:D(o,s,i),u=n.select(`open`),d=w.current?.()??n.select(`transitionStatus`)===`ending`,f=!u&&d&&v.current,p=!l&&ep(s)&&ep(o)&&th(o,s)&&f,m=t>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){n.setOpen(!0,Dm(gm,e,s));return}m||(r?_.openChangeTimeout.start(r,()=>{g&&n.setOpen(!0,Dm(gm,e,s))}):g&&n.setOpen(!0,Dm(gm,e,s)))}function i(e){if(T()){A();return}k();let t=Pp(n.select(`domReferenceElement`));_.restTimeout.clear(),_.restTimeoutPending=!1;let i=r.current.floatingContext??m?.();if(!E(e.relatedTarget)){if(y.current&&i){n.select(`open`)||_.openChangeTimeout.clear();let r=d.current;_.handler=y.current({...i,tree:g,x:e.clientX,y:e.clientY,onClose(){A(),k(),C.current&&!T()&&r===n.select(`domReferenceElement`)&&O(e,!0)}}),t.addEventListener(`mousemove`,_.handler),_.handler(e);return}(_.pointerType!==`touch`||!th(n.select(`floatingElement`),e.relatedTarget))&&O(e)}}return u?jm(bp(e,`mousemove`,t,{once:!0}),bp(e,`mouseenter`,t),bp(e,`mouseleave`,i)):jm(bp(e,`mouseenter`,t),bp(e,`mouseleave`,i))},[k,A,r,x,O,n,a,y,_,p,D,T,E,c,u,S,d,g,C,m,w]),b.useMemo(()=>{if(!a)return;function e(e){_.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`),a=n.select(`open`),o=D(i,r,e.target);if(c&&!cm(_.pointerType))return;if(a&&o&&_.handleCloseOptions?.blockPointerEvents){let e=n.select(`floatingElement`);e&&ab(_,{scopeElement:_.handleCloseOptions?.getScope?.()??r.ownerDocument.body,referenceElement:r,floatingElement:e})}let s=fm(S.current);if(a&&!o||s===0||!o&&_.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;_.restTimeout.clear();function l(){if(_.restTimeoutPending=!1,T())return;let e=n.select(`open`);!_.blockMouseMove&&(!e||o)&&n.setOpen(!0,Dm(gm,t,r))}_.pointerType===`touch`?T_.flushSync(()=>{l()}):o&&a?l():(_.restTimeoutPending=!0,_.restTimeout.start(s,l))}}},[a,_,T,D,c,n,S])}function ub(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=b.useCallback(t=>db(t,e,`reference`),t),o=b.useCallback(t=>db(t,e,`floating`),n),s=b.useCallback(t=>db(t,e,`item`),r),c=b.useCallback(t=>db(t,e,`trigger`),i);return b.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function db(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[Jm]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&fb(a,s,i,r)}return fb(a,e,i,r),a}function fb(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var pb=`Escape`;function mb(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function hb(e,t){return mb(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function gb(e,t,n){return mb(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function _b(e,t,n){return mb(t,n?e===Xm:e===Zm,e===$m)}function vb(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===pb:mb(t,n?e===Zm:e===Xm,e===Qm)}function yb(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:s,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:h=!1,virtual:g=!1,focusItemOnOpen:_=`auto`,focusItemOnHover:v=!0,openOnArrowKeyDown:y=!0,disabledIndices:x=void 0,orientation:S=`vertical`,parentOrientation:C,cols:w=1,id:T,resetOnPointerLeave:E=!0,externalTree:D}=t,O=Rm(uh(i)),k=F_(),A=I_(D);X(()=>{o.current.orientation=S},[o,S]);let j=ch(a),M=b.useRef(_),N=b.useRef(d??-1),P=b.useRef(null),F=b.useRef(!0),I=Z(e=>{l(N.current===-1?null:N.current,e)}),L=b.useRef(I),ee=b.useRef(!!i),R=b.useRef(r),te=b.useRef(!1),z=b.useRef(!1),B=b.useRef(null),V=Rm(x),H=Rm(r),ne=Rm(d),U=Rm(E),re=Z(()=>{function e(e){g?A?.events.emit(`virtualfocus`,e):B.current=Eg(e,{sync:te.current,preventScroll:!0})}let t=s.current[N.current],n=z.current;t&&e(t),(te.current?e=>e():requestAnimationFrame)(()=>{let r=s.current[N.current]||t;r&&(t||e(r),oe&&(n||!F.current)&&r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});X(()=>{u&&(r&&i?(N.current=d??-1,M.current&&d!=null&&(z.current=!0,I())):ee.current&&(N.current=-1,L.current()))},[u,r,i,d,I]),X(()=>{if(u){if(!r){te.current=!1;return}if(i)if(c==null){if(te.current=!1,ne.current!=null)return;if(ee.current&&(N.current=-1,re()),(!R.current||!ee.current)&&M.current&&(P.current!=null||M.current===!0&&P.current==null)){let e=0,t=()=>{s.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(N.current=P.current==null||gb(P.current,S,h)||m?Vh(s):Hh(s),P.current=null,I())};t()}}else Bh(s.current,c)||(N.current=c,re(),z.current=!1)}},[u,r,i,c,ne,m,s,S,h,I,re,V]),X(()=>{if(!u||i||!A||g||!ee.current)return;let e=A.nodesRef.current,t=e.find(e=>e.id===k)?.context?.elements.floating,n=eh(Pp(i)),r=e.some(e=>e.context&&th(e.context.elements.floating,n));t&&!r&&F.current&&t.focus({preventScroll:!0})},[u,i,A,k,g]),X(()=>{L.current=I,R.current=r,ee.current=!!i}),X(()=>{r||(P.current=null,M.current=_)},[r,_]);let ie=c!=null,ae=Z(e=>{if(!H.current)return;let t=s.current.indexOf(e.currentTarget);t!==-1&&(N.current!==t||c!==t)&&(N.current=t,I(e))}),oe=b.useMemo(()=>({onFocus(e){te.current=!0,ae(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){te.current=!0,z.current=!1,v&&ae(e)},onPointerLeave(e){if(!H.current||!F.current||e.pointerType===`touch`)return;te.current=!0;let t=e.relatedTarget;if(!(!v||s.current.includes(t))&&U.current&&(B.current?.(),B.current=null,N.current=-1,I(e),!g)){let e=O.current,t=eh(Pp(e));e&&th(e,t)&&e.focus({preventScroll:!0})}}}),[ae,H,O,v,s,I,U,g]),se=b.useCallback(()=>C??A?.nodesRef.current.find(e=>e.id===k)?.context?.dataRef?.current.orientation,[k,A,C]),ce=Z(e=>{if(F.current=!1,te.current=!0,e.which===229||!H.current&&e.currentTarget===O.current)return;if(m&&vb(e.key,S,h,w)){hb(e.key,se())||im(e),n.setOpen(!1,Dm(Sm,e.nativeEvent)),tp(a)&&(g?A?.events.emit(`virtualfocus`,a):a.focus());return}let t=N.current,i=Vh(s,x),o=Hh(s,x);if(j||(e.key===`Home`&&(im(e),N.current=i,I(e)),e.key===`End`&&(im(e),N.current=o,I(e))),w>1){let t=Array.from({length:s.current.length},()=>({width:1,height:1})),n=Gh(t,w,!1),r=n.findIndex(e=>e!=null&&!Jh(s.current,e,x)),a=n.reduce((e,t,n)=>t!=null&&!Jh(s.current,t,x)?n:e,-1),c=n[Wh(n.map(e=>e==null?null:s.current[e]),{event:e,orientation:S,loopFocus:p,rtl:h,cols:w,disabledIndices:qh([...(typeof x==`function`?null:x)||s.current.map((e,t)=>Jh(s.current,t,x)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:Kh(N.current>o?i:N.current,t,n,w,e.key===`ArrowDown`?`bl`:e.key===(h?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(N.current=c,I(e)),S===`both`)return}if(hb(e.key,S)){if(im(e),r&&!g&&eh(e.currentTarget.ownerDocument)===e.currentTarget){N.current=gb(e.key,S,h)?i:o,I(e);return}gb(e.key,S,h)?p?t>=o?f&&t!==s.current.length?N.current=-1:(te.current=!1,N.current=i):N.current=Uh(s.current,{startingIndex:t,disabledIndices:x}):N.current=Math.min(o,Uh(s.current,{startingIndex:t,disabledIndices:x})):p?t<=i?f&&t!==-1?N.current=s.current.length:(te.current=!1,N.current=o):N.current=Uh(s.current,{startingIndex:t,decrement:!0,disabledIndices:x}):N.current=Math.max(i,Uh(s.current,{startingIndex:t,decrement:!0,disabledIndices:x})),Bh(s.current,N.current)&&(N.current=-1),I(e)}}),le=b.useMemo(()=>g&&r&&ie&&{"aria-activedescendant":`${T}-${c}`},[g,r,ie,T,c]),ue=b.useMemo(()=>({"aria-orientation":S===`both`?void 0:S,...j?{}:le,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!g){let t=nh(e.nativeEvent);if(t&&!th(O.current,t))return;im(e),n.setOpen(!1,Dm(bm,e.nativeEvent)),tp(a)&&a.focus();return}ce(e)},onPointerMove(){F.current=!0}}),[le,ce,O,S,j,n,r,g,a]),de=b.useMemo(()=>{function e(e){_===`auto`&&om(e.nativeEvent)&&(M.current=!g)}function t(e){M.current=_,_===`auto`&&sm(e.nativeEvent)&&(M.current=!0)}return{onKeyDown(e){let t=n.select(`open`);F.current=!1;let r=e.key.startsWith(`Arrow`),i=_b(e.key,se(),h),a=hb(e.key,S),o=(m?i:a)||e.key===`Enter`||e.key.trim()===``;if(g&&t)return ce(e);if(!(!t&&!y&&r)){if(o){let t=hb(e.key,se());P.current=m&&t?null:e.key}if(m){i&&(im(e),t?(N.current=Vh(s,V.current),I(e)):n.setOpen(!0,Dm(Sm,e.nativeEvent,e.currentTarget)));return}a&&(ne.current!=null&&(N.current=ne.current),im(e),!t&&y?n.setOpen(!0,Dm(Sm,e.nativeEvent,e.currentTarget)):ce(e),t&&I(e))}},onFocus(e){n.select(`open`)&&!g&&(N.current=-1,I(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[ce,V,_,s,m,I,n,y,S,se,h,ne,g]),fe=b.useMemo(()=>({...le,...de}),[le,de]);return b.useMemo(()=>u?{reference:fe,floating:ue,item:oe,trigger:de}:{},[u,fe,ue,de,oe])}var bb=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function xb(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{role:s=`dialog`}=t,c=Ug(),l=a?.id||c,u=b.useMemo(()=>uh(o)?.id||i,[o,i]),d=bb.get(s)??s,f=F_()!=null,p=b.useMemo(()=>d===`tooltip`||s===`label`?Jp:{"aria-haspopup":d===`alertdialog`?`dialog`:d,"aria-expanded":`false`,...d===`listbox`&&{role:`combobox`},...d===`menu`&&f&&{role:`menuitem`},...s===`select`&&{"aria-autocomplete":`none`},...s===`combobox`&&{"aria-autocomplete":`list`}},[d,f,s]),m=b.useMemo(()=>d===`tooltip`||s===`label`?{[`aria-${s===`label`?`labelledby`:`describedby`}`]:r?u:void 0}:{...p,"aria-expanded":r?`true`:`false`,"aria-controls":r?u:void 0,...d===`menu`&&{id:l}},[d,u,r,l,s,p]),h=b.useMemo(()=>{let e={id:u,...d&&{role:d}};return d===`tooltip`||s===`label`?e:{...e,...d===`menu`&&{"aria-labelledby":l}}},[d,u,l,s]),g=b.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${u}-fui-option`}};switch(s){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[u,s]);return b.useMemo(()=>({reference:m,floating:h,item:g,trigger:p}),[m,h,p,g])}function Sb(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,i=n.useState(`open`),{listRef:a,elementsRef:o,activeIndex:s,onMatch:c,onTypingChange:l,enabled:u=!0,resetMs:d=750,selectedIndex:f=null}=t,p=Vp(),m=b.useRef(``),h=b.useRef(f??s??-1),g=b.useRef(null);X(()=>{!i&&f!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[i,f,p]),X(()=>{i&&m.current===``&&(h.current=f??s??-1)},[i,f,s]);let _=Z(e=>{e?r.current.typing||(r.current.typing=e,l?.(e)):r.current.typing&&(r.current.typing=e,l?.(e))}),v=Z(e=>{function t(e){let t=o?.current[e];return!t||Xh(t)}function n(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let r=a.current;if(m.current.length>0&&e.key===` `&&(im(e),_(!0)),m.current.length>0&&m.current[0]!==` `&&n(r,m.current)===-1&&e.key!==` `&&_(!1),r==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;i&&e.key!==` `&&(im(e),_(!0));let l=m.current===``;l&&(h.current=f??s??-1),r.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(d,()=>{m.current=``,h.current=g.current,_(!1)});let u=((l?f??s??-1:h.current)??0)+1,v=n(r,m.current,u);v===-1?e.key!==` `&&(m.current=``,_(!1)):(c?.(v),g.current=v)}),y=Z(e=>{let t=e.relatedTarget,r=n.select(`domReferenceElement`),i=n.select(`floatingElement`),a=th(r,t),o=th(i,t);a||o||(p.clear(),m.current=``,h.current=g.current,_(!1))}),x=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]),S=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return b.useMemo(()=>u?{reference:x,floating:S}:{},[u,x,S])}var Cb=.1,wb=Cb*Cb,Tb=.5;function Eb(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Db(e,t,n,r,i,a,o,s,c,l){let u=!1;return Eb(e,t,n,r,i,a)&&(u=!u),Eb(e,t,i,a,o,s)&&(u=!u),Eb(e,t,o,s,c,l)&&(u=!u),Eb(e,t,c,l,n,r)&&(u=!u),u}function Ob(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function kb(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Ab(e={}){let{blockPointerEvents:t=!1}=e,n=new Bp,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*wb;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=nh(r),g=r.type===`mouseleave`,_=th(u,h),v=th(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&ep(r.relatedTarget)&&th(u,r.relatedTarget))return;function y(){return!!(s&&Sg(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=kb(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=kb(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=kb(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=kb(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!Ob(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Tb/2:Tb*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Tb+1,o=C||T?S.bottom-Tb:S.top,s=C?T?S.bottom-Tb:S.top:S.bottom-Tb;M=Db(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Tb/2:Tb*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Tb,o=C||T?S.top+Tb:S.bottom,s=C?T?S.top+Tb:S.bottom:S.top+Tb;M=Db(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Tb/2:Tb*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Tb+1,o=w||E?S.right-Tb:S.left,s=w?E?S.right-Tb:S.left:S.right-Tb;M=Db(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Tb/2:Tb*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Tb,o=w||E?S.left+Tb:S.right,s=w?E?S.left+Tb:S.right:S.left+Tb;M=Db(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function jb(e){let t=b.useRef(``),n=b.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:b.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Mb(e,t){let n=b.useRef(e),r=Z(t);X(()=>{n.current!==e&&r(n.current)},[e,r]),X(()=>{n.current=e},[e])}function Nb(e){let[t,n]=b.useState(null),r=Z((t,r)=>{e||n(r||(Ep?`touch`:``))});Mb(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=jb(r);return b.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function Pb(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),s=t.useState(`modal`),c=t.useState(`popupElement`),{openMethod:l,triggerProps:u}=Nb(a);Wy(t);let{forceUnmount:d}=Gy(a,t),f=b.useCallback(()=>{t.setOpen(!1,Dm(Tm))},[t]);b.useImperativeHandle(r,()=>({unmount:d,close:f}),[d,f]);let p=$y({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[m,h]=b.useState(0),[g,_]=b.useState(0),v=m===0,y=xb(p),x=rv(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:s===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=nh(e);if(v&&!o){let e=n;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||th(e,c)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:v});rm(a&&s===!0,c);let{getReferenceProps:S,getFloatingProps:C,getTriggerProps:w}=ub([y,x]);t.useContextCallback(`onNestedDialogOpen`,(e,t)=>{h(e),_(t)}),t.useContextCallback(`onNestedDialogClose`,()=>{h(0),_(0)}),b.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(m+1,g+ +!!i),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,m,g,n]);let T=b.useMemo(()=>S(u),[S,u]),E=b.useMemo(()=>w(u),[w,u]),D=b.useMemo(()=>C(),[C]);t.useSyncedValues({openMethod:l,activeTriggerProps:T,inactiveTriggerProps:E,popupProps:D,floatingRootContext:p,nestedOpenDialogCount:m,nestedOpenDrawerCount:g})}var Fb=b.createContext(void 0);function Ib(e){let t=b.useContext(Fb);if(e===!1&&t===void 0)throw Error(Gg(27));return t}var Lb={...Xy,modal:Q(e=>e.modal),nested:Q(e=>e.nested),nestedOpenDialogCount:Q(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Q(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Q(e=>e.disablePointerDismissal),openMethod:Q(e=>e.openMethod),descriptionElementId:Q(e=>e.descriptionElementId),titleElementId:Q(e=>e.titleElementId),viewportElement:Q(e=>e.viewportElement),role:Q(e=>e.role)},Rb=class e extends My{constructor(e){super(zb(e),{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new Ky,onOpenChange:void 0,onOpenChangeComplete:void 0},Lb)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};static useStore(t,n){let r=Ip(()=>new e(n)).current;return t??r}};function zb(e={}){return{...Jy(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}var Bb=b.createContext(!1);function Vb(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:o,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Ib(!0),d=!!u,f=Rb.useStore(s?.store,{open:r,openProp:n,activeTriggerId:l,triggerIdProp:c,modal:!0,disablePointerDismissal:!0,nested:d,role:`alertdialog`});f.useControlledProp(`openProp`,n),f.useControlledProp(`triggerIdProp`,c),f.useSyncedValue(`nested`,d),f.useContextCallback(`onOpenChange`,i),f.useContextCallback(`onOpenChangeComplete`,a);let p=f.useState(`payload`);Pb({store:f,actionsRef:o,parentContext:u?.store.context,isDrawer:!1,onOpenChange:i,triggerIdProp:c});let m=b.useMemo(()=>({store:f}),[f]);return(0,y.jsx)(Bb.Provider,{value:!1,children:(0,y.jsx)(Fb.Provider,{value:m,children:typeof t==`function`?t({payload:p}):t})})}var Hb=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Iy.startingStyle]=`startingStyle`,e[e.endingStyle=Iy.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),Ub=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),Wb={[Ub.popupOpen]:``},Gb={[Ub.popupOpen]:``,[Ub.pressed]:``},Kb={[Hb.open]:``},qb={[Hb.closed]:``},Jb={[Hb.anchorHidden]:``},Yb={open(e){return e?Wb:null}},Xb={open(e){return e?Gb:null}},Zb={open(e){return e?Kb:qb},anchorHidden(e){return e?Jb:null}},Qb={...Zb,...zy},$b=b.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=Ib(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return m_(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Qb,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),ex=b.createContext(void 0);function tx(e=!1){let t=b.useContext(ex);if(t===void 0&&!e)throw Error(Gg(16));return t}function nx(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:b.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 rx(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=b.useRef(null),s=tx(!0),c=a??s!==void 0,{props:l}=nx({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=b.useCallback(()=>{let e=o.current;ix(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return X(u,[u]),{getButtonProps:b.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return e_({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(d_(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=ix(a),l=!i&&ax(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(d_(e),a?.(e),e.target===e.currentTarget&&i&&c&&ix(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?void 0:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Z(e=>{o.current=e,u()})}}function ix(e){return tp(e)&&e.tagName===`BUTTON`}function ax(e){return!!(e?.tagName===`A`&&e?.href)}function ox(e){return Ug(e,`base-ui`)}var sx=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Ib(),c=ox(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),m_(`p`,e,{ref:t,props:[{id:c},o]})}),cx=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),lx=function(e){return e[e.open=Hb.open]=`open`,e[e.closed=Hb.closed]=`closed`,e[e.startingStyle=Hb.startingStyle]=`startingStyle`,e[e.endingStyle=Hb.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),ux=b.createContext(void 0);function dx(){let e=b.useContext(ux);if(e===void 0)throw Error(Gg(26));return e}var fx=`ArrowUp`,px=`ArrowDown`,mx=`ArrowLeft`,hx=`ArrowRight`,gx=`Home`,_x=new Set([mx,hx]),vx=new Set([fx,px]),yx=new Set([..._x,...vx]);new Set([...yx,gx,`End`]);var bx=new Set([fx,px,mx,hx,gx,`End`]),xx={...Zb,...zy,nestedDialogOpen(e){return e?{[lx.nestedDialogOpen]:``}:null}},Sx=b.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,style:o,...s}=e,{store:c}=Ib(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),b=c.useState(`titleElementId`),x=c.useState(`transitionStatus`),S=c.useState(`role`);dx(),Vy({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?c.context.popupRef.current:!0}let w=i===void 0?C:i,T=m_(`div`,e,{state:{open:_,nested:h,transitionStatus:x,nestedDialogOpen:g>0},props:[f,{"aria-labelledby":b??void 0,"aria-describedby":l??void 0,role:S,tabIndex:-1,hidden:!m,onKeyDown(e){bx.has(e.key)&&e.stopPropagation()},style:{[cx.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,c.useStateSetter(`popupElement`)],stateAttributesMapping:xx});return(0,y.jsx)(Y_,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:r,modal:p!==!1,restoreFocus:`popup`,children:T})});function Cx(e){return qg(19)?e:e?`true`:void 0}var wx=b.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,y.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),Tx=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Ib(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,y.jsx)(ux.Provider,{value:n,children:(0,y.jsxs)(A_,{ref:t,...r,children:[a&&o===!0&&(0,y.jsx)(wx,{ref:i.context.internalBackdropRef,inert:Cx(!s)}),e.children]})}):null}),Ex=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Ib(),c=ox(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),m_(`h2`,e,{ref:t,props:[{id:c},o]})}),Dx=`border border-border/60 bg-background/70 text-muted-foreground shadow-xs ring-0 backdrop-blur-md`,Ox=`duration-150 ease-snappy data-closed:duration-100 data-closed:fade-out-0 data-closed:zoom-out-95 data-closed:blur-out-[5px] data-closed:slide-out-to-top-2 data-open:fade-in-0 data-open:zoom-in-95 data-open:blur-in-[5px] data-open:slide-in-from-top-2`,kx=`fixed inset-0 isolate z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs`,Ax=`duration-150 ease-snappy data-closed:duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,jx=`border border-border/60 bg-background/90 text-foreground shadow-lg ring-0`,Mx=`duration-150 ease-snappy data-closed:duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,Nx=`absolute inset-0 bg-black/10 supports-backdrop-filter:backdrop-blur-xs transition-[opacity,backdrop-filter] duration-150 ease-snappy data-[closed]:opacity-0 data-[open]:opacity-100`,Px=`transition-[opacity,transform] duration-150 ease-snappy data-[closed]:opacity-0 data-[closed]:scale-95 data-[open]:opacity-100 data-[open]:scale-100`,Fx=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=rx({disabled:i,focusableWhenDisabled:a,native:o});return m_(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),Ix=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Lx=xd,Rx=(e,t)=>n=>{if(t?.variants==null)return Lx(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Ix(t)||Ix(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Lx(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},zx=Rx(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5`,lg:`h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-9`,"icon-xs":`size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function Bx({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,y.jsx)(Fx,{"data-slot":`button`,className:qf(zx({variant:t,size:n,className:e})),...r})}function Vx({...e}){return(0,y.jsx)(Vb,{"data-slot":`alert-dialog`,...e})}function Hx({...e}){return(0,y.jsx)(Tx,{"data-slot":`alert-dialog-portal`,...e})}function Ux({className:e,...t}){return(0,y.jsx)($b,{"data-slot":`alert-dialog-overlay`,className:qf(kx,Ax,e),...t})}function Wx({className:e,size:t=`default`,...n}){return(0,y.jsxs)(Hx,{children:[(0,y.jsx)(Ux,{}),(0,y.jsx)(Sx,{"data-slot":`alert-dialog-content`,"data-size":t,className:qf(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-popover-foreground outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg`,jx,Mx,e),...n})]})}function Gx({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:qf(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Kx({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:qf(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function qx({className:e,...t}){return(0,y.jsx)(Ex,{"data-slot":`alert-dialog-title`,className:qf(`font-heading text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Jx({className:e,...t}){return(0,y.jsx)(sx,{"data-slot":`alert-dialog-description`,className:qf(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Yx({className:e,...t}){return(0,y.jsx)(Bx,{"data-slot":`alert-dialog-action`,className:qf(e),...t})}function Xx(e){return m_(e.defaultTagName??`div`,e,e)}var Zx=Rx(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function Qx({className:e,variant:t=`default`,render:n,...r}){return Xx({defaultTagName:`span`,props:e_({className:qf(Zx({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var $x=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}({}),eS={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},tS={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},nS={disabled:!1,...tS},rS={valid(e){return e===null?null:e?{[$x.valid]:``}:{[$x.invalid]:``}}},iS=b.createContext({invalid:void 0,name:void 0,validityData:{state:eS,errors:[],error:``,value:``,initialValue:null},setValidityData:Kp,disabled:void 0,touched:tS.touched,setTouched:Kp,dirty:tS.dirty,setDirty:Kp,filled:tS.filled,setFilled:Kp,focused:tS.focused,setFocused:Kp,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:nS,markedDirtyRef:{current:!1},registerFieldControl:Kp,validation:{getValidationProps:(e=Jp)=>e,getInputValidationProps:(e=Jp)=>e,inputRef:{current:null},commit:async()=>{}}});function aS(e=!0){let t=b.useContext(iS);if(t.setValidityData===Kp&&!e)throw Error(Gg(28));return t}var oS=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Kp,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function sS(){return b.useContext(oS)}var cS=b.createContext({controlId:void 0,registerControlId:Kp,labelId:void 0,setLabelId:Kp,messageIds:[],setMessageIds:Kp,getDescriptionProps:e=>e});function lS(){return b.useContext(cS)}function uS(e,t,n,r=!0,i){let[a,o]=b.useState(),s=ox(i?`${i}-label`:void 0),c=e??t??a;return X(()=>{let i=e||t||!r?void 0:dS(n.current,s);a!==i&&o(i)}),c}function dS(e,t){let n=fS(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function fS(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function pS(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=lS(),o=ox(t),s=n?i:void 0,c=Ip(()=>Symbol(`labelable-control`)),l=b.useRef(!1),u=b.useRef(t!=null),d=Z(()=>{!l.current||a===Kp||(l.current=!1,a(c.current,void 0))});return X(()=>{if(a===Kp)return;let e;if(n){let n=r?.current;e=ep(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]),b.useEffect(()=>d,[d]),i??o}function mS({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=b.useRef(e!==void 0),[a,o]=b.useState(t);return[i?e:a,b.useCallback(e=>{i||o(e)},[])]}function hS(e,t){let{enabled:n=!0,getValue:r,id:i,value:a}=t,{registerFieldControl:o}=aS(),s=b.useRef(null);s.current||=Symbol(),X(()=>{let t=s.current;if(!(!t||!n))return o(t,{controlRef:e,getValue:r,id:i,value:a}),()=>{o(t,void 0)}},[e,n,r,i,o,a])}var gS=b.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:x,validationMode:S,validation:C}=aS(),w=h||s,T=m??a,E={...p,disabled:w},{labelId:D}=lS(),O=pS({id:i});X(()=>{let e=o!=null;C.inputRef.current?.value||e&&o!==``?x(!0):e&&o===``&&x(!1)},[C.inputRef,x,o]);let k=b.useRef(null);X(()=>{u&&k.current===eh(Pp(k.current))&&y(!0)},[u,y]);let[A]=mS({controlled:o,default:l,name:`FieldControl`,state:`value`}),j=o!==void 0,M=j?A:void 0,N=Z(()=>C.inputRef.current?.value);return hS(C.inputRef,{id:O,value:M,getValue:N}),m_(`input`,e,{ref:[t,k],state:E,props:[{id:O,disabled:w,name:T,ref:C.inputRef,"aria-labelledby":D,autoFocus:u,...j?{value:M}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,Dm(mm,e.nativeEvent)),_(t!==v.initialValue),x(t!==``)},onFocus(){y(!0)},onBlur(e){g(!0),y(!1),S===`onBlur`&&C.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(g(!0),C.commit(e.currentTarget.value))}},C.getInputValidationProps(),f],stateAttributesMapping:rS})}),_S=b.forwardRef(function(e,t){return(0,y.jsx)(gS,{ref:t,...e})});function vS({className:e,type:t,...n}){return(0,y.jsx)(_S,{type:t,"data-slot":`input`,className:qf(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function yS({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:qf(`group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var bS=Rx(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function xS({className:e,align:t=`inline-start`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:qf(bS({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var SS=Rx(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function CS({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,y.jsx)(Bx,{type:t,"data-size":r,variant:n,className:qf(SS({size:r}),e),...i})}function wS({className:e,...t}){return(0,y.jsx)(`span`,{className:qf(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function TS({className:e,...t}){return(0,y.jsx)(vS,{"data-slot":`input-group-control`,className:qf(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}function ES({className:e,...t}){return(0,y.jsx)(md,{role:`status`,"aria-label":`Loading`,className:qf(`spinner-line-fade size-4`,e),...t})}var DS=1e3,OS=1.2,kS=.1,AS=`localterm`,jS=`† `,MS=`npx @monotykamary/localterm@latest start`,NS=1500,PS=5e3,FS=.35,IS=`#ffc79944`,LS=`#ffc799`,RS=`#ff8080`,zS=`localterm:terminal-theme-id`,BS=`localterm:terminal-font-id`,VS=`localterm:terminal-font-size`,HS=`localterm:terminal-line-height`,US=`localterm:terminal-cursor-style`,WS=`localterm:terminal-cursor-blink`,GS=`localterm:terminal-scrollback`,KS=`localterm:terminal-scroll-on-user-input`,qS=`localterm:terminal-padding-x`,JS=`localterm:terminal-padding-y`,YS=`localterm-google-fonts`,XS=`localterm:nerd-font-enabled`,ZS=`flex w-full items-center gap-2.5 rounded-sm px-2.5 py-2 text-sm outline-none transition-colors`,QS=(e,t)=>{let n=t.toLowerCase(),r=e.toLowerCase();if(n===r)return 1;if(n.startsWith(r))return 2;if(n.includes(r))return 3;let i=eC(e,t);return i>0?4+(1-i/$S(e.length)):0},$S=e=>{let t=e;return t+=(e-1)*.5,t+=e*.5,t},eC=(e,t)=>{let n=e.toLowerCase(),r=t.toLowerCase(),i=0,a=0,o=-1;for(let e=0;e<r.length&&i<n.length;e++)r[e]===n[i]&&(a+=1,o===e-1&&(a+=.5),(e===0||r[e-1]===` `||r[e-1]===`-`)&&(a+=.5),o=e,i++);return i===n.length?a:0},tC=({open:e,onClose:t,commands:n})=>{let[r,i]=(0,b.useState)(``),[a,o]=(0,b.useState)(0),[s,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(!1),d=(0,b.useRef)(null),f=(0,b.useRef)(null),p=(0,b.useId)(),m=r?n.map(e=>({cmd:e,score:QS(r,e.label)})).filter(e=>e.score>0).sort((e,t)=>e.score-t.score).map(e=>e.cmd):n;(0,b.useEffect)(()=>{if(e){c(!0),i(``),o(0);let e=requestAnimationFrame(()=>u(!0));return()=>cancelAnimationFrame(e)}if(u(!1),s){let e=window.setTimeout(()=>c(!1),150);return()=>window.clearTimeout(e)}},[e]),(0,b.useEffect)(()=>{o(0)},[r]),(0,b.useEffect)(()=>{!e||m.length===0||(f.current?.children[a])?.scrollIntoView({block:`nearest`})},[a,m.length,e]),(0,b.useEffect)(()=>{if(!e||!s)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())};return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e,s,t]);let h=(0,b.useCallback)(()=>{let e=m[a];e&&(t(),e.action())},[a,m,t]),g=(0,b.useCallback)(e=>{if(e.key===`ArrowDown`){e.preventDefault(),o(e=>(e+1)%Math.max(1,m.length));return}if(e.key===`ArrowUp`){e.preventDefault(),o(e=>(e-1+Math.max(1,m.length))%Math.max(1,m.length));return}if(e.key===`Enter`){e.preventDefault(),h();return}},[h,m.length]);if(!s)return null;let _=e&&l;return(0,y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[18vh]`,children:[(0,y.jsx)(`div`,{"data-open":_||void 0,"data-closed":!_||void 0,className:qf(Nx),onClick:t}),(0,y.jsxs)(`div`,{role:`dialog`,"aria-label":`command palette`,"aria-modal":!0,"data-open":_||void 0,"data-closed":!_||void 0,className:qf(`relative z-10 w-[460px] max-h-[360px] flex flex-col overflow-hidden rounded-xl`,jx,Px),children:[(0,y.jsxs)(`div`,{className:`flex items-center border-b border-border/40 px-3`,children:[(0,y.jsx)(vd,{className:`size-4 shrink-0 text-muted-foreground/60`}),(0,y.jsx)(`input`,{ref:d,autoFocus:!0,type:`text`,value:r,onChange:e=>i(e.target.value),onKeyDown:g,placeholder:`Type a command…`,"aria-label":`search commands`,"aria-activedescendant":m[a]?`${p}-${m[a].id}`:void 0,"aria-controls":p,"aria-expanded":!0,"aria-haspopup":`listbox`,role:`combobox`,className:`h-10 w-full bg-transparent px-2.5 text-sm text-foreground outline-none placeholder:text-muted-foreground/70`})]}),(0,y.jsx)(`div`,{ref:f,id:p,role:`listbox`,className:`flex-1 overflow-y-auto overscroll-contain p-1.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:m.length===0?(0,y.jsx)(`div`,{className:`px-2.5 py-6 text-center text-sm text-muted-foreground/70`,children:`No matching commands`}):m.map((e,n)=>(0,y.jsxs)(`button`,{id:`${p}-${e.id}`,type:`button`,role:`option`,"aria-selected":n===a,className:qf(ZS,n===a&&`bg-foreground/10 text-foreground`),onMouseEnter:()=>o(n),onClick:()=>{t(),e.action()},children:[e.icon?(0,y.jsx)(`span`,{className:`shrink-0 text-muted-foreground/70`,children:e.icon}):(0,y.jsx)(`span`,{className:`w-4 shrink-0`}),(0,y.jsx)(`span`,{className:`flex-1 text-left`,children:e.label}),e.shortcut?(0,y.jsx)(`kbd`,{className:`shrink-0 rounded border border-border/40 bg-muted/30 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground/70`,children:e.shortcut}):null]},e.id))})]})]})},nC=b.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return m_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function rC({className:e,orientation:t=`horizontal`,...n}){return(0,y.jsx)(nC,{"data-slot":`separator`,orientation:t,className:qf(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}var iC=Rx(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0`,vertical:`flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});function aC({className:e,orientation:t,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:qf(iC({orientation:t}),e),...n})}function oC({className:e,render:t,...n}){return Xx({defaultTagName:`div`,props:e_({className:qf(`flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e)},n),render:t,state:{slot:`button-group-text`}})}var sC=e=>String(e),cC=`size-7 rounded-none border-0 bg-transparent text-foreground hover:bg-foreground/10 hover:text-foreground disabled:opacity-30 [&_svg]:size-3.5`,lC=`h-7 min-w-[3rem] cursor-ew-resize touch-none justify-center border-y-0 border-r border-l! border-border/60 bg-transparent px-1.5 text-xs font-medium tabular-nums text-foreground select-none hover:bg-foreground/5 focus-visible:outline-none focus-visible:bg-foreground/5`,uC={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1},dC=({value:e,min:t,max:n,step:r,ariaLabel:i,decrementAriaLabel:a,incrementAriaLabel:o,formatDisplay:s=sC,onValueChange:c})=>{let l=(0,b.useRef)(null),u=(0,b.useRef)(e),d=t=>{if(t.button===0){try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}l.current=t.clientX,u.current=e}},f=e=>{let t=l.current;if(t===null)return;let n=e.clientX-t,i=Math.round(n/5);i!==0&&c(u.current+i*r)},p=e=>{if(l.current!==null){try{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}catch{}l.current=null}};return(0,y.jsxs)(aC,{"aria-label":i,className:`h-7 overflow-hidden rounded-md border border-border/60`,children:[(0,y.jsx)(Bx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e-r),disabled:e<=t,"aria-label":a,className:cC,children:(0,y.jsx)(hd,{})}),(0,y.jsx)(oC,{role:`slider`,tabIndex:0,"aria-label":i,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-valuetext":s(e),"aria-orientation":`horizontal`,title:`Drag or use arrow keys to adjust`,className:lC,onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p,onPointerLeave:e=>{if(l.current===null)return;let t=!1;try{t=e.currentTarget.hasPointerCapture(e.pointerId)}catch{}t||(l.current=null)},onKeyDown:i=>{if(i.key===`Home`){i.preventDefault(),c(t);return}if(i.key===`End`){i.preventDefault(),c(n);return}let a=uC[i.key];a!==void 0&&(i.preventDefault(),c(e+a*r))},children:s(e)}),(0,y.jsx)(Bx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e+r),disabled:e>=n,"aria-label":o,className:cC,children:(0,y.jsx)(_d,{})})]})};function fC(e){let[t,n]=b.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}var pC=b.createContext(null),mC=b.createContext(null);function hC(){let e=b.useContext(pC);if(e===null)throw Error(Gg(60));return e}function gC(){let e=b.useContext(mC);if(e===null)throw Error(Gg(61));return e}var _C=(e,t)=>Object.is(e,t);function vC(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function yC(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:vC(t,e,n))}function bC(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:vC(e,t,n))}function xC(e,t,n){return e.filter(e=>!vC(t,e,n))}function SC(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function CC(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function wC(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(CC(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function TC(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return SC(e)}function EC(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?SC(e.value):SC(e)}function DC(e,t,n){function r(){return TC(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=CC(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function OC(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,y.jsx)(b.Fragment,{children:DC(r,t,n)},i)),e),[])}var kC={id:Q(e=>e.id),labelId:Q(e=>e.labelId),modal:Q(e=>e.modal),multiple:Q(e=>e.multiple),items:Q(e=>e.items),itemToStringLabel:Q(e=>e.itemToStringLabel),itemToStringValue:Q(e=>e.itemToStringValue),isItemEqualToValue:Q(e=>e.isItemEqualToValue),value:Q(e=>e.value),hasSelectedValue:Q(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:EC(t,r)!==``}),hasNullItemLabel:Q((e,t)=>t?wC(e.items):!1),open:Q(e=>e.open),mounted:Q(e=>e.mounted),forceMount:Q(e=>e.forceMount),transitionStatus:Q(e=>e.transitionStatus),openMethod:Q(e=>e.openMethod),activeIndex:Q(e=>e.activeIndex),selectedIndex:Q(e=>e.selectedIndex),isActive:Q((e,t)=>e.activeIndex===t),isSelected:Q((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>vC(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:vC(n,i,r)}),isSelectedByFocus:Q((e,t)=>e.selectedIndex===t),popupProps:Q(e=>e.popupProps),triggerProps:Q(e=>e.triggerProps),triggerElement:Q(e=>e.triggerElement),positionerElement:Q(e=>e.positionerElement),listElement:Q(e=>e.listElement),scrollUpArrowVisible:Q(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Q(e=>e.scrollDownArrowVisible),hasScrollArrows:Q(e=>e.hasScrollArrows)};function AC(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function jC(e,t){return Math.max(0,e-t)}function MC(e,t){if(t<=0)return 0;let n=AC(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function NC(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:x=!1,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w=_C,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=sS(),{setDirty:O,setTouched:k,setFocused:A,shouldValidateOnChange:j,validityData:M,setFilled:N,name:P,disabled:F,validation:I,validationMode:L}=aS(),ee=pS({id:t}),R=F||d,te=P??c,[z,B]=mS({controlled:n,default:x?r??qp:r,name:`Select`,state:`value`}),[V,H]=mS({controlled:a,default:o,name:`Select`,state:`open`}),ne=b.useRef([]),U=b.useRef([]),re=b.useRef(null),ie=b.useRef(null),ae=b.useRef(0),oe=b.useRef(null),se=b.useRef([]),ce=b.useRef(!1),le=b.useRef(!1),ue=b.useRef(null),de=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),fe=b.useRef(!1),{mounted:pe,setMounted:me,transitionStatus:he}=Fy(V),{openMethod:ge,triggerProps:_e}=Nb(V),ve=Ip(()=>new jy({id:ee,labelId:void 0,modal:m,multiple:x,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,value:z,open:V,mounted:pe,transitionStatus:he,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ye=Dy(ve,kC.activeIndex),be=Dy(ve,kC.selectedIndex),xe=Dy(ve,kC.triggerElement),Se=Dy(ve,kC.positionerElement),Ce=fC(ge),we=ge??Ce,Te=b.useMemo(()=>x&&Array.isArray(z)&&z.length===0?``:EC(z,C),[x,z,C]),Ee=b.useMemo(()=>x&&Array.isArray(z)?z.map(e=>EC(e,C)):EC(z,C),[x,z,C]);hS(Rm(ve.state.triggerElement),{id:ee,value:z,getValue:Z(()=>Ee)});let De=b.useRef(z);X(()=>{z!==De.current&&ve.set(`forceMount`,!0)},[ve,z]),X(()=>{N(x?Array.isArray(z)&&z.length>0:z!=null)},[x,z,N]),X(function(){if(V)return;let e=se.current;if(x){let t=Array.isArray(z)?z:[];if(t.length===0){ve.set(`selectedIndex`,null);return}let n=t[t.length-1],r=bC(e,n,w);ve.set(`selectedIndex`,r===-1?null:r);return}let t=bC(e,z,w);ve.set(`selectedIndex`,t===-1?null:t)},[x,V,z,se,w,ve]),Mb(z,()=>{D(te),O(z!==M.initialValue),j()?I.commit(z):I.commit(z,!0)});let Oe=Z((e,t)=>{if(s?.(e,t),!t.isCanceled&&(H(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),L===`onBlur`&&I.commit(z)),!e&&ve.state.activeIndex!==null)){let e=ne.current[ve.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),ke=Z(()=>{me(!1),ve.update({activeIndex:null,openMethod:null}),_?.(!1)});Vy({enabled:!h,open:V,ref:re,onComplete(){V||ke()}}),b.useImperativeHandle(h,()=>({unmount:ke}),[ke]);let Ae=Z((e,t)=>{i?.(e,t),!t.isCanceled&&B(e)}),je=Z(()=>{let e=ve.state.listElement||re.current;if(!e)return;let t=jC(e.scrollHeight,e.clientHeight),n=MC(e.scrollTop,t),r=n>0,i=n<t;ve.state.scrollUpArrowVisible!==r&&ve.set(`scrollUpArrowVisible`,r),ve.state.scrollDownArrowVisible!==i&&ve.set(`scrollDownArrowVisible`,i)}),Me=Zy({open:V,onOpenChange:Oe,elements:{reference:xe,floating:Se}}),{getReferenceProps:Ne,getFloatingProps:Pe,getItemProps:Fe}=ub([X_(Me,{enabled:!f&&!R,event:`mousedown`}),rv(Me,{bubbles:!1}),yb(Me,{enabled:!f&&!R,listRef:ne,activeIndex:ye,selectedIndex:be,disabledIndices:qp,onNavigate(e){e===null&&!V||ve.set(`activeIndex`,e)},focusItemOnHover:T}),Sb(Me,{enabled:!f&&!R&&(V||!x),listRef:U,activeIndex:ye,selectedIndex:be,onMatch(e){V?ve.set(`activeIndex`,e):Ae(se.current[e],Dm(`none`))},onTypingChange(e){ce.current=e}})]),Ie=b.useMemo(()=>e_(Ne(),_e,ee?{id:ee}:Jp),[Ne,_e,ee]);Jf(()=>{ve.update({popupProps:Pe(),triggerProps:Ie})}),X(()=>{ve.update({id:ee,modal:m,multiple:x,value:z,open:V,mounted:pe,transitionStatus:he,popupProps:Pe(),triggerProps:Ie,items:v,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,openMethod:we})},[ve,ee,m,x,z,V,pe,he,Pe,Ie,v,S,C,w,we]);let Le=b.useMemo(()=>({store:ve,name:te,required:p,disabled:R,readOnly:f,multiple:x,highlightItemOnHover:T,setValue:Ae,setOpen:Oe,listRef:ne,popupRef:re,scrollHandlerRef:ie,handleScrollArrowVisibility:je,scrollArrowsMountedCountRef:ae,getItemProps:Fe,events:Me.context.events,valueRef:oe,valuesRef:se,labelsRef:U,typingRef:ce,selectionRef:de,selectedItemTextRef:ue,validation:I,onOpenChangeComplete:_,keyboardActiveRef:le,alignItemWithTriggerActiveRef:fe,initialValueRef:De}),[ve,te,p,R,f,x,T,Ae,Oe,Fe,Me.context.events,I,_,je]),Re=Mm(g,I.inputRef),ze=x&&Array.isArray(z)&&z.length>0,Be=x?void 0:te,Ve=b.useMemo(()=>!x||!Array.isArray(z)||!te?null:z.map(e=>{let t=EC(e,C);return(0,y.jsx)(`input`,{type:`hidden`,form:l,name:te,value:t},t)}),[x,z,l,te,C]);return(0,y.jsx)(pC.Provider,{value:Le,children:(0,y.jsxs)(mC.Provider,{value:Me,children:[E,(0,y.jsx)(`input`,{...I.getInputValidationProps({onFocus(){ve.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.currentTarget.value,n=Dm(mm,e.nativeEvent);function r(){if(x)return;let e=se.current.find(e=>EC(e,C).toLowerCase()===t.toLowerCase()||TC(e,S).toLowerCase()===t.toLowerCase());e!=null&&(O(e!==M.initialValue),Ae(e,n),j()&&I.commit(e))}ve.set(`forceMount`,!0),queueMicrotask(r)}}),id:ee&&Be==null?`${ee}-hidden-input`:void 0,form:l,name:Be,autoComplete:u,value:Te,disabled:R,required:p&&!ze,readOnly:f,ref:Re,style:te?Km:Gm,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ve]})})}function PC(e,t){return e??t}function FC(e){let t=e.getBoundingClientRect(),n=Zf(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var IC=2,LC=400,RC=200,zC={...Xb,...rS,value:()=>null},BC=b.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=aS(),{labelId:m}=lS(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=hC(),T=p||C||a,E=Dy(h,kC.open),D=Dy(h,kC.value),O=Dy(h,kC.triggerProps),k=Dy(h,kC.positionerElement),A=Dy(h,kC.listElement),j=Dy(h,kC.id),M=Dy(h,kC.labelId),N=Dy(h,kC.hasSelectedValue),P=!N&&E,F=Dy(h,kC.hasNullItemLabel,P),I=i??j,L=PC(m,M);pS({id:I});let ee=Rm(k),R=b.useRef(null),{getButtonProps:te,buttonRef:z}=rx({disabled:T,native:o}),B=Mm(t,R,z,Z(e=>{h.set(`triggerElement`,e)})),V=Vp(),H=Vp(),ne=Vp(),U=Vp();b.useEffect(()=>{if(E)return N||F?U.start(RC,()=>{_.current.allowUnselectedMouseUp=!0,ne.start(RC,()=>{_.current.allowSelectedMouseUp=!0})}):ne.start(LC,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{ne.clear(),U.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},H.clear()},[E,N,F,_,H,ne,U]);let re=b.useMemo(()=>A?.id??uh(k)?.id,[A,k]),ie=e_(O,{id:I,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?re:void 0,"aria-labelledby":L,"aria-readonly":y||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:B,onFocus(e){u(!0),E&&S.current&&g(!1,Dm(mm,e.nativeEvent)),V.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){th(k,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(D))},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(e){if(E)return;let t=Pp(e.currentTarget);function n(e){if(!R.current)return;let t=e.target;if(th(R.current,t)||th(ee.current,t)||t===R.current)return;let n=FC(R.current);e.clientX>=n.left-IC&&e.clientX<=n.right+IC&&e.clientY>=n.top-IC&&e.clientY<=n.bottom+IC||g(!1,Dm(Cm,e))}H.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,te);ie.role=`combobox`;let ae={...f,open:E,disabled:T,value:D,readOnly:y,placeholder:!N};return m_(`button`,e,{ref:[t,R],state:ae,stateAttributesMapping:zC,props:ie})}),VC={value:()=>null},HC=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=hC(),u=Dy(c,kC.value),d=Dy(c,kC.items),f=Dy(c,kC.itemToStringLabel),p=Dy(c,kC.hasSelectedValue),m=!p&&a!=null&&i==null,h=Dy(c,kC.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?OC(u,d,f):DC(u,d,f)),m_(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:VC})}),UC=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o}=hC();return m_(`span`,e,{state:{open:Dy(o,kC.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:Yb})}),WC=b.createContext(void 0),GC=b.forwardRef(function(e,t){let{store:n}=hC(),r=Dy(n,kC.mounted),i=Dy(n,kC.forceMount);return r||i?(0,y.jsx)(WC.Provider,{value:!0,children:(0,y.jsx)(A_,{ref:t,...e})}):null}),KC=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function qC(){return b.useContext(KC)}function JC(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),o=b.useRef(0),s=Ip(XC).current,c=Ip(YC).current,[l,u]=b.useState(0),d=b.useRef(l),f=Z((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=Z(e=>{c.delete(e),d.current+=1,u(d.current)}),m=b.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(ZC).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);X(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),X(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),X(()=>()=>{n.current=[]},[n]),X(()=>()=>{r&&(r.current=[])},[r]);let h=Z(e=>(s.add(e),()=>{s.delete(e)}));X(()=>{s.forEach(e=>e(m))},[s,m]);let g=b.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,y.jsx)(KC.Provider,{value:g,children:t})}function YC(){return new Map}function XC(){return new Set}function ZC(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var QC=b.createContext(void 0);function $C(){return b.useContext(QC)?.direction??`ltr`}var ew=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=yh(e,t)||{};if(l==null)return{};let f=Lh(u),p={x:n,y:r},m=Th(i),h=Ch(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=vh(k,j,A),N=!c.arrow&&xh(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),tw=(e,t)=>({...ew(e),options:[e,t]}),nw={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await fy().fn(e)).data?.referenceHidden||a}}}},rw={sideX:`left`,sideY:`top`},iw={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=Zf(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:rw};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Pp(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=bh(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:rw.sideX,g=f===`top`?`bottom`:rw.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function aw(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function ow(e,t,n){let{rects:r,placement:i}=e;return{side:aw(t,bh(i),n),align:xh(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function sw(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:v,lazyFlip:y=!1,externalTree:x}=e,[S,C]=b.useState(null);!m&&S!==null&&C(null);let w=h.side||`flip`,T=h.align||`flip`,E=h.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=Z(D),k=D?O:t,A=Rm(t),j=Rm(m),M=$C()===`rtl`,N=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":M?`left`:`right`,"inline-start":M?`right`:`left`}[r],P=a===`center`?N:`${N}-${a}`,F=c,I=+(r===`bottom`),L=+(r===`top`),ee=+(r===`right`),R=+(r===`left`);typeof F==`number`?F={top:F+I,right:F+R,bottom:F+L,left:F+ee}:F&&={top:(F.top||0)+I,right:(F.right||0)+R,bottom:(F.bottom||0)+L,left:(F.left||0)+ee};let te={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:F},z=b.useRef(null),B=Rm(i),V=Rm(o),H=[sy(e=>{let t=ow(e,r,M),n=typeof B.current==`function`?B.current(t):B.current,i=typeof V.current==`function`?V.current(t):V.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,M,r])],ne=T===`none`&&w!==`shift`,U=!ne&&(l||g||w===`shift`),re=w===`none`?null:uy({...te,padding:{top:F.top+1,right:F.right+1,bottom:F.bottom+1,left:F.left+1},mainAxis:!g&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),ie=ne?null:cy(e=>{let t=Pp(e.elements.floating).documentElement;return{...te,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:U,limiter:l||g?void 0:ly(e=>{if(!z.current)return{};let{width:t,height:n}=z.current.getBoundingClientRect(),r=wh(bh(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})}},[te,l,g,F,T]);w===`shift`||T===`shift`||a===`center`?H.push(ie,re):H.push(re,ie),H.push(dy({...te,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!j.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=Zf(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),tw(()=>({element:z.current||Pp(z.current).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=bh(a),l=wh(c),u=z.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(ow(e,r,M)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,U&&l===`y`&&b?S:x),{}}},nw,v),X(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,p]);let ae=b.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:oe,elements:se,x:ce,y:le,middlewareData:ue,update:de,placement:fe,context:pe,isPositioned:me,floatingStyles:he}=Qy({rootContext:p,open:f?m:void 0,placement:P,middleware:H,strategy:n,whileElementsMounted:f?void 0:(...e)=>qv(...e,ae),nodeId:_,externalTree:x}),{sideX:ge,sideY:_e}=ue.adaptiveOrigin||rw,ve=me?n:`fixed`,ye=b.useMemo(()=>{let e=v?{position:ve,[ge]:ce,[_e]:le}:{position:ve,...he};return me||(e.opacity=0),e},[v,ve,ge,ce,_e,le,he,me]),be=b.useRef(null);X(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(cw(t)?t.current:t)||null;n!==be.current&&(oe.setPositionReference(n),be.current=n)},[m,oe,k,A]),b.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&cw(e)&&e.current!==be.current&&(oe.setPositionReference(e.current),be.current=e.current)},[m,oe,k,A]),b.useEffect(()=>{if(f&&m&&se.domReference&&se.floating)return qv(se.domReference,se.floating,de,ae)},[f,m,se,de,ae]);let xe=bh(fe),Se=aw(r,xe,M),Ce=xh(fe)||`center`,we=!!ue.hide?.referenceHidden;X(()=>{y&&m&&me&&C(xe)},[y,m,me,xe]);let Te=b.useMemo(()=>({position:`absolute`,top:ue.arrow?.y,left:ue.arrow?.x}),[ue.arrow]),Ee=ue.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:ye,arrowStyles:Te,arrowRef:z,arrowUncentered:Ee,side:Se,align:Ce,physicalSide:xe,anchorHidden:we,refs:oe,context:pe,isPositioned:me,update:de}),[ye,Te,z,Ee,Se,Ce,xe,we,oe,pe,me,de])}function cw(e){return e!=null&&`current`in e}var lw=b.createContext(void 0);function uw(){let e=b.useContext(lw);if(!e)throw Error(Gg(59));return e}function dw(e,t){e&&Object.assign(e.style,t)}var fw={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function pw(e){return e===`starting`?b_:Jp}function mw(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),m_(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},pw(r),i],stateAttributesMapping:Zb})}var hw=20;function gw(e,t,n,r){let[i,a]=b.useState(!1);X(()=>{if(!e||!t||n==null){a(!1);return}let r=Pp(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-hw)},[e,t,n]),rm(e&&(!t||i),r)}var _w={position:`fixed`},vw=b.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=S_,style:_,...v}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=hC(),A=gC(),j=Dy(x,kC.open),M=Dy(x,kC.mounted),N=Dy(x,kC.modal),P=Dy(x,kC.value),F=Dy(x,kC.openMethod),I=Dy(x,kC.positionerElement),L=Dy(x,kC.triggerElement),ee=Dy(x,kC.isItemEqualToValue),R=Dy(x,kC.transitionStatus),te=b.useRef(null),z=b.useRef(null),[B,V]=b.useState(h),H=M&&B&&F!==`touch`;!M&&B!==h&&V(h),X(()=>{M||(kC.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),kC.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),b.useImperativeHandle(w,()=>H),gw((H||N)&&j,F===`touch`,I,L);let ne=sw({anchor:n,floatingRootContext:A,positionMethod:r,mounted:M,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??H,collisionAvoidance:g,keepMounted:!0}),U=H?`none`:ne.side,re=H?_w:ne.positionerStyles,ie=mw(e,{open:j,side:U,align:ne.align,anchorHidden:ne.anchorHidden},{styles:re,transitionStatus:R,props:v,refs:[t,Z(e=>{x.set(`positionerElement`,e)})],hidden:!M,inert:!j}),ae=b.useRef(0),oe=Z(e=>{if(e.size===0&&ae.current===0||E.current.length===0)return;let t=ae.current;if(ae.current=e.size,e.size===t)return;let n=Dm(mm);if(t!==0&&!x.state.multiple&&P!==null&&bC(E.current,P,ee)===-1){let e=D.current,t=e!=null&&bC(E.current,e,ee)!==-1?e:null;k(t,n),t===null&&(x.set(`selectedIndex`,null),T.current=null)}if(t!==0&&x.state.multiple&&Array.isArray(P)){let e=e=>bC(E.current,e,ee)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!yC(P,e,ee)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&H){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};dw(I,e),dw(O.current,e)}}),se=b.useMemo(()=>({...ne,side:U,alignItemWithTriggerActive:H,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:te,scrollDownArrowRef:z}),[ne,U,H,V]);return(0,y.jsx)(JC,{elementsRef:S,labelsRef:C,onMapChange:oe,children:(0,y.jsxs)(lw.Provider,{value:se,children:[M&&N&&(0,y.jsx)(wx,{inert:Cx(!j),cutout:L}),ie]})})}),yw=`base-ui-disable-scrollbar`,bw={className:yw,getElement(e){return(0,y.jsx)(`style`,{nonce:e,href:yw,precedence:`base-ui:low`,children:`.${yw}{scrollbar-width:none}.${yw}::-webkit-scrollbar{display:none}`})}},xw=b.createContext(void 0);function Sw(e){let t=b.useContext(xw);if(t===void 0&&!e)throw Error(Gg(69));return t}var Cw=b.createContext(void 0),ww={disableStyleElements:!1};function Tw(){return b.useContext(Cw)??ww}var Ew={...Zb,...zy},Dw=b.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,selectedItemTextRef:f,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:h,scrollHandlerRef:g,listRef:_,highlightItemOnHover:v}=hC(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=uw(),O=Sw(!0)!=null,k=gC(),A=$C(),{nonce:j,disableStyleElements:M}=Tw(),N=Dy(s,kC.id),P=Dy(s,kC.open),F=Dy(s,kC.mounted),I=Dy(s,kC.popupProps),L=Dy(s,kC.transitionStatus),ee=Dy(s,kC.triggerElement),R=Dy(s,kC.positionerElement),te=Dy(s,kC.listElement),z=b.useRef(!1),B=b.useRef(!1),V=b.useRef({}),H=Gp(),ne=Z(e=>{if(!R||!c.current||!B.current)return;if(z.current||!C){h();return}let t=R.style.top===`0px`,n=R.style.bottom===`0px`;if(!t&&!n){h();return}let r=Aw(R),i=jw(R.getBoundingClientRect().height,`y`,r),a=Pp(R),o=getComputedStyle(R),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=Ow(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=kw(e),m=0,g=null,_=!1,v=!1,y=e=>{R.style.height=`${e}px`},b=(t,n)=>{let r=AC(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(z.current=!0),h()},x=t?p-f:f,S=Math.min(i+x,d);if(m=S,x<=1){b(x,t?p:0);return}if(d-S>1?t?v=!0:g=0:(_=!0,n&&f<p&&(g=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&y(m),v||g!=null){let t=kw(e),n=v?t:AC(g,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(z.current=!0),h()});b.useImperativeHandle(g,()=>ne,[ne]),Vy({open:P,ref:c,onComplete(){P&&l?.(!0)}});let U={open:P,transitionStatus:L,side:x,align:S};X(()=>{!R||!c.current||Object.keys(V.current).length||(V.current={top:R.style.top||`0`,left:R.style.left||`0`,right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[c,R]),X(()=>{P||C||(B.current=!1,z.current=!1,dw(R,V.current))},[P,C,R,c]),X(()=>{let e=c.current;if(!P||!ee||!R||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){B.current=!0,H.request(h),e.style.removeProperty(`--transform-origin`);return}let t=Pw(e);e.style.removeProperty(`--transform-origin`);try{let t=f.current,n=d.current,r=getComputedStyle(R),i=getComputedStyle(e),a=Pp(ee),o=Zf(R),c=Aw(ee),l=Mw(ee.getBoundingClientRect(),c),u=Mw(R.getBoundingClientRect(),c),p=l.height,m=te||e,g=m.scrollHeight,y=parseFloat(i.borderBottomWidth),b=parseFloat(r.marginTop)||10,x=parseFloat(r.marginBottom)||10,S=parseFloat(r.minHeight)||100,C=Ow(i),w=a.documentElement.clientHeight-b-x,E=a.documentElement.clientWidth,D=w-l.bottom+p,O,k=A===`rtl`?l.right-u.width:l.left,j=0;if(t&&n){let e=Mw(n.getBoundingClientRect(),c);O=Mw(t.getBoundingClientRect(),c),k=u.left+(A===`rtl`?e.right-O.right:e.left-O.left);let r=e.top-l.top+e.height/2;j=O.top-u.top+O.height/2-r}let M=D+j+x+y,N=Math.min(w,M),P=w-b-x,F=M-N,I=E-5;R.style.left=`${AC(k,5,I-u.width)}px`,R.style.height=`${N}px`,R.style.maxHeight=`auto`,R.style.marginTop=`${b}px`,R.style.marginBottom=`${x}px`,e.style.height=`100%`;let L=kw(m),H=F>=L-1;H&&(N=Math.min(w,u.height)-(F-L));let ne=l.top<20||l.bottom>w-20||Math.ceil(N)+1<Math.min(g,S),U=(o.visualViewport?.scale??1)!==1&&Tp;if(ne||U){B.current=!0,dw(R,V.current),T(!1);return}let re=Math.max(S,N);if(H){let e=Math.max(0,w-M);R.style.top=u.height>=P?`0`:`${e}px`,R.style.height=`${N}px`,m.scrollTop=kw(m)}else R.style.bottom=`0`,m.scrollTop=F;if(O){let t=u.top,n=u.height,r=O.top+O.height/2,i=AC(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(re===w||N>=C)&&(z.current=!0),h(),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0),B.current=!0}finally{t()}},[s,P,R,ee,d,f,c,h,C,T,H,E,D,te,_,v,A,w]),b.useEffect(()=>{if(!C||!R||!P)return;let e=Zf(R);function t(e){u(!1,Dm(Em,e))}return bp(e,`resize`,t)},[u,C,R,P]);let re={...te?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(e){p.current=!0,O&&bx.has(e.key)&&e.stopPropagation()},onMouseMove(){p.current=!1},onScroll(e){te||ne(e.currentTarget)},...C&&{style:te?{height:`100%`}:fw}},ie=m_(`div`,e,{ref:[t,c],state:U,stateAttributesMapping:Ew,props:[I,re,pw(L),{className:!te&&C?bw.className:void 0},o]});return(0,y.jsxs)(b.Fragment,{children:[!M&&bw.getElement(j),(0,y.jsx)(Y_,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:ie})]})});function Ow(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function kw(e){return jC(e.scrollHeight,e.clientHeight)}function Aw(e){return Wv.getScale(e)}function jw(e,t,n){return e/n[t]}function Mw(e,t){return Rh({x:jw(e.x,`x`,t),y:jw(e.y,`y`,t),width:jw(e.width,`x`,t),height:jw(e.height,`y`,t)})}var Nw=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Pw(e){let{style:t}=e,n={};for(let[e,r]of Nw)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of Nw){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Fw=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=hC(),{alignItemWithTriggerActive:c}=uw(),l=Dy(o,kC.hasScrollArrows),u=Dy(o,kC.openMethod),d=Dy(o,kC.multiple),f={id:`${Dy(o,kC.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:fw},className:l&&u!==`touch`?bw.className:void 0};return m_(`div`,e,{ref:[t,Z(e=>{o.set(`listElement`,e)})],props:[f,a]})}),Iw=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function Lw(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=qC(),f=b.useRef(-1),[p,m]=b.useState(a??(i===Iw.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=b.useRef(null),g=b.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return X(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),X(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),b.useMemo(()=>({ref:g,index:p}),[p,g])}var Rw=b.createContext(void 0);function zw(){let e=b.useContext(Rw);if(!e)throw Error(Gg(57));return e}var Bw=b.memo(b.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,style:c,...l}=e,u=b.useRef(null),d=Lw({label:a,textRef:u,indexGuessBehavior:Iw.GuessFromOrder}),{store:f,getItemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:x,selectedItemTextRef:S}=hC(),C=Dy(f,kC.isActive,d.index),w=Dy(f,kC.isSelected,d.index,i),T=Dy(f,kC.isSelectedByFocus,d.index),E=Dy(f,kC.isItemEqualToValue),D=d.index,O=D!==-1,k=b.useRef(null),A=Rm(D);X(()=>{if(!O)return;let e=v.current;return e[D]=i,()=>{delete e[D]}},[O,D,i,v]),X(()=>{if(!O)return;let e=f.state.value,t=e;x&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&vC(i,t,E)&&(f.set(`selectedIndex`,D),u.current&&(S.current=u.current))},[O,D,x,E,f,i,S]);let j={disabled:o,selected:w,highlighted:C},M=p({active:C,selected:w});M.id=void 0;let N=b.useRef(null),P=b.useRef(`mouse`),F=b.useRef(!1),{getButtonProps:I,buttonRef:L}=rx({disabled:o,focusableWhenDisabled:!0,native:s,composite:!0});function ee(e){let t=f.state.value;if(x){let n=Array.isArray(t)?t:[];h(w?xC(n,i,E):[...n,i],Dm(ym,e))}else h(i,Dm(ym,e)),m(!1,Dm(ym,e))}let R={role:`option`,"aria-selected":w,tabIndex:C?0:-1,onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(e){N.current=e.key,f.set(`activeIndex`,D),e.key===` `&&_.current&&e.preventDefault()},onClick(e){F.current=!1,!(e.type===`keydown`&&N.current===null)&&(o||e.type===`keydown`&&N.current===` `&&_.current||P.current!==`touch`&&!C||(N.current=null,ee(e.nativeEvent)))},onPointerEnter(e){P.current=e.pointerType},onPointerDown(e){P.current=e.pointerType,F.current=!0},onMouseUp(){if(o)return;if(F.current){F.current=!1;return}let e=!g.current.allowSelectedMouseUp&&w,t=!g.current.allowUnselectedMouseUp&&!w;e||t||P.current!==`touch`&&!C||k.current?.click()}},te=m_(`div`,e,{ref:[L,t,d.ref,k],state:j,props:[M,R,l,I]}),z=b.useMemo(()=>({selected:w,indexRef:A,textRef:u,selectedByFocus:T,hasRegistered:O}),[w,A,u,T,O]);return(0,y.jsx)(Rw.Provider,{value:z,children:te})})),Vw=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=zw();return n||r?(0,y.jsx)(Hw,{...e,ref:t}):null}),Hw=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=zw(),c=b.useRef(null),{transitionStatus:l,setMounted:u}=Fy(s),d=m_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:zy});return Vy({open:s,ref:c,onComplete(){s||u(!1)}}),d})),Uw=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=zw(),{selectedItemTextRef:o}=hC(),{className:s,render:c,style:l,...u}=e;return m_(`div`,e,{ref:[b.useCallback(e=>{if(!e||!a)return;let t=o.current===null||!o.current.isConnected;(i||t&&n.current===0)&&(o.current=e)},[o,n,i,a]),t,r],props:u})})),Ww=b.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=hC(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=uw(),_=Dy(l,c?kC.scrollUpArrowVisible:kC.scrollDownArrowVisible),v=Dy(l,kC.openMethod),y=_&&v!==`touch`,b=Vp(),x=c?g:h,{transitionStatus:S,setMounted:C}=Fy(y);X(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),Vy({open:y,ref:x,onComplete(){y||C(!1)}});let w=m_(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:S},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=jC(e.scrollHeight,e.clientHeight),r=MC(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=Gw(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s]});return y||o?w:null});function Gw(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?MC(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?MC(l.offsetTop+l.offsetHeight-r+i,a):a}var Kw=b.forwardRef(function(e,t){return(0,y.jsx)(Ww,{...e,ref:t,direction:`down`})}),qw=b.forwardRef(function(e,t){return(0,y.jsx)(Ww,{...e,ref:t,direction:`up`})}),Jw=NC;function Yw({className:e,...t}){return(0,y.jsx)(HC,{"data-slot":`select-value`,className:qf(`flex flex-1 text-left`,e),...t})}function Xw({className:e,size:t=`default`,children:n,...r}){return(0,y.jsxs)(BC,{"data-slot":`select-trigger`,"data-size":t,className:qf(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,y.jsx)(UC,{render:(0,y.jsx)(dd,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function Zw({className:e,children:t,footer:n,side:r=`bottom`,sideOffset:i=4,align:a=`center`,alignOffset:o=0,alignItemWithTrigger:s=!0,...c}){return(0,y.jsx)(GC,{children:(0,y.jsx)(vw,{side:r,sideOffset:i,align:a,alignOffset:o,alignItemWithTrigger:s,className:`isolate z-50`,children:(0,y.jsxs)(Dw,{"data-slot":`select-content`,"data-align-trigger":s,className:qf(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...c,children:[(0,y.jsx)($w,{}),(0,y.jsx)(Fw,{children:t}),(0,y.jsx)(eT,{}),n]})})})}function Qw({className:e,children:t,...n}){return(0,y.jsxs)(Bw,{"data-slot":`select-item`,className:qf(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,y.jsx)(Uw,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)(Vw,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(ud,{className:`pointer-events-none`})})]})}function $w({className:e,...t}){return(0,y.jsx)(qw,{"data-slot":`select-scroll-up-button`,className:qf(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(fd,{})})}function eT({className:e,...t}){return(0,y.jsx)(Kw,{"data-slot":`select-scroll-down-button`,className:qf(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(dd,{})})}var tT=`h-7 justify-between gap-1.5 rounded-md border-border/60 bg-transparent px-2 text-xs font-normal text-foreground shadow-none focus-visible:border-ring/40 focus-visible:ring-1 focus-visible:ring-ring/40 dark:bg-transparent`,nT=`max-h-72 w-(--anchor-width) origin-(--transform-origin) gap-0 overflow-x-hidden p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,rT=`rounded-sm py-1.5 pr-7 pl-2 text-xs hover:bg-foreground/10 hover:text-foreground focus:bg-foreground/10 focus:text-foreground`,iT=({value:e,items:t,ariaLabel:n,placeholder:r,onValueChange:i,open:a,onOpenChange:o,onItemHover:s,triggerClassName:c,triggerStyle:l,footerSlot:u})=>{let d=t.find(t=>t.id===e),f=d?.itemStyle?{...d.itemStyle,...l}:l;return(0,y.jsxs)(Jw,{value:e,onValueChange:i,open:a,onOpenChange:o,children:[(0,y.jsx)(Xw,{size:`sm`,"aria-label":n,className:qf(tT,`w-full`,c),style:f,children:(0,y.jsx)(Yw,{placeholder:r,children:()=>d?.label||r})}),(0,y.jsx)(Zw,{alignItemWithTrigger:!1,sideOffset:4,className:qf(nT,Dx,Ox),footer:u?(0,y.jsx)(`div`,{className:`border-t border-border/40 p-1`,children:u}):void 0,children:t.map(e=>(0,y.jsx)(Qw,{value:e.id,className:rT,style:e.itemStyle,onPointerEnter:s?()=>s(e.id):void 0,onFocus:s?()=>s(e.id):void 0,children:e.label},e.id))})]})};function aT(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=mS({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=Fy(o,!0,!0),[d,f]=b.useState(o),[{height:p,width:m},h]=b.useState({height:void 0,width:void 0}),g=ox(),[_,v]=b.useState(),y=_??g,[x,S]=b.useState(!1),[C,w]=b.useState(!1),T=b.useRef(null),E=b.useRef(null),D=b.useRef(null),O=b.useRef(null),k=By(O,!1),A=Z(e=>{let t=!o,n=Dm(hm,e.nativeEvent);if(r(t,n),n.isCanceled)return;let i=O.current;E.current===`css-animation`&&i!=null&&i.style.removeProperty(`animation-name`),!x&&!C&&(E.current!=null&&E.current!==`css-animation`&&!c&&t&&l(!0),E.current===`css-animation`&&(!d&&t&&f(!0),!c&&t&&l(!0))),s(t),E.current===`none`&&c&&!t&&l(!1)});return X(()=>{a&&E.current===`none`&&!o&&l(!1)},[a,o,t,l]),b.useMemo(()=>({abortControllerRef:T,animationTypeRef:E,disabled:i,handleTrigger:A,height:p,mounted:c,open:o,panelId:y,panelRef:O,runOnceAnimationsFinish:k,setDimensions:h,setHiddenUntilFound:S,setKeepMounted:w,setMounted:l,setOpen:s,setPanelIdState:v,setVisible:f,transitionDimensionRef:D,transitionStatus:u,visible:d,width:m}),[T,E,i,A,p,c,o,y,O,k,h,S,w,l,s,f,D,u,d,m])}var oT=b.createContext(void 0);function sT(){let e=b.useContext(oT);if(e===void 0)throw Error(Gg(15));return e}var cT=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Iy.startingStyle]=`startingStyle`,e[e.endingStyle=Iy.endingStyle]=`endingStyle`,e}({}),lT=function(e){return e.panelOpen=`data-panel-open`,e}({}),uT={[cT.open]:``},dT={[cT.closed]:``},fT={open(e){return e?{[lT.panelOpen]:``}:null}},pT={open(e){return e?uT:dT},...zy},mT=b.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=Z(o),d=aT({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=b.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=b.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=m_(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:pT});return(0,y.jsx)(oT.Provider,{value:p,children:m})}),hT={...fT,...zy},gT=b.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=sT(),{className:s,disabled:c=o,id:l,render:u,nativeButton:d=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=rx({disabled:c,focusableWhenDisabled:!0,native:d}),g=b.useMemo(()=>({"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i}),[n,r,i]);return m_(`button`,e,{state:a,ref:[t,h],props:[g,p,m],stateAttributesMapping:hT})}),_T=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function vT(e){let{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:a,keepMounted:o,id:s,mounted:c,onOpenChange:l,open:u,panelRef:d,runOnceAnimationsFinish:f,setDimensions:p,setMounted:m,setOpen:h,setVisible:g,transitionDimensionRef:_,visible:v,width:y}=e,x=b.useRef(!1),S=b.useRef(null),C=b.useRef(u),w=b.useRef(u),T=Gp(),E=b.useMemo(()=>n.current===`css-animation`?!v:!u&&!c,[u,c,v,n]),D=Mm(r,d,Z(e=>{if(!e)return;if(n.current==null||_.current==null){let t=getComputedStyle(e),r=t.animationName!==`none`&&t.animationName!==``,i=t.transitionDuration!==`0s`&&t.transitionDuration!==``;r&&i||(t.animationName===`none`&&t.transitionDuration!==`0s`?n.current=`css-transition`:t.animationName!==`none`&&t.transitionDuration===`0s`?n.current=`css-animation`:n.current=`none`),e.getAttribute(_T.orientation)===`horizontal`||t.transitionProperty.indexOf(`width`)>-1?_.current=`width`:_.current=`height`}if(n.current!==`css-transition`)return;(i===void 0||y===void 0)&&(p({height:e.scrollHeight,width:e.scrollWidth}),w.current&&e.style.setProperty(`transition-duration`,`0s`));let t=-1,r=-1;return t=Wp.request(()=>{w.current=!1,r=Wp.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{Wp.cancel(t),Wp.cancel(r)}}));return X(()=>{if(n.current!==`css-transition`)return;let e=d.current;if(!e)return;let r=-1;if(t.current!=null&&(t.current.abort(),t.current=null),u){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)}),!w.current&&!o&&e.setAttribute(cT.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=Wp.request(()=>{Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})})}else{if(e.scrollHeight===0&&e.scrollWidth===0)return;p({height:e.scrollHeight,width:e.scrollWidth});let n=new AbortController;t.current=n;let r=n.signal,i=null,a=cT.endingStyle;return i=new MutationObserver(o=>{o.some(e=>e.type===`attributes`&&e.attributeName===a)&&(i?.disconnect(),i=null,f(()=>{p({height:0,width:0}),e.style.removeProperty(`content-visibility`),m(!1),t.current===n&&(t.current=null)},r))}),i.observe(e,{attributes:!0,attributeFilter:[a]}),()=>{i?.disconnect(),T.cancel(),t.current===n&&(n.abort(),t.current=null)}}return()=>{Wp.cancel(r)}},[t,n,T,a,o,c,u,d,f,p,m]),X(()=>{if(n.current!==`css-animation`)return;let e=d.current;e&&(S.current=e.style.animationName||S.current,e.style.setProperty(`animation-name`,`none`),p({height:e.scrollHeight,width:e.scrollWidth}),!C.current&&!x.current&&e.style.removeProperty(`animation-name`),u?(t.current!=null&&(t.current.abort(),t.current=null),m(!0),g(!0)):(t.current=new AbortController,f(()=>{m(!1),g(!1),t.current=null},t.current.signal)))},[t,n,u,d,f,p,m,g,v]),Rp(()=>{let e=Wp.request(()=>{C.current=!1});return()=>Wp.cancel(e)}),X(()=>{if(!a)return;let e=d.current;if(!e)return;let t=-1,n=-1;return u&&x.current&&(e.style.transitionDuration=`0s`,p({height:e.scrollHeight,width:e.scrollWidth}),t=Wp.request(()=>{x.current=!1,n=Wp.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{Wp.cancel(t),Wp.cancel(n)}},[a,u,d,p]),X(()=>{let e=d.current;e&&a&&E&&(e.setAttribute(`hidden`,`until-found`),n.current===`css-transition`&&e.setAttribute(cT.startingStyle,``))},[a,E,n,d]),b.useEffect(function(){let e=d.current;if(!e)return;function t(e){x.current=!0,h(!0),l(!0,Dm(mm,e))}return bp(e,`beforematch`,t)},[l,d,h]),b.useMemo(()=>({props:{hidden:E,id:s,ref:D}}),[E,s,D])}var yT=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),bT=b.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{abortControllerRef:l,animationTypeRef:u,height:d,mounted:f,onOpenChange:p,open:m,panelId:h,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setHiddenUntilFound:y,setKeepMounted:x,setMounted:S,setPanelIdState:C,setOpen:w,setVisible:T,state:E,transitionDimensionRef:D,visible:O,width:k,transitionStatus:A}=sT(),j=r??!1,M=i??!1;X(()=>{if(o)return C(o),()=>{C(void 0)}},[o,C]),X(()=>{y(j)},[y,j]),X(()=>{x(M)},[x,M]);let{props:N}=vT({abortControllerRef:l,animationTypeRef:u,externalRef:t,height:d,hiddenUntilFound:j,id:h,keepMounted:M,mounted:f,onOpenChange:p,open:m,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setMounted:S,setOpen:w,setVisible:T,transitionDimensionRef:D,visible:O,width:k});Vy({open:m&&A===`idle`,ref:g,onComplete(){m&&v({height:void 0,width:void 0})}});let P=m_(`div`,e,{state:b.useMemo(()=>({...E,transitionStatus:A}),[E,A]),ref:[t,g],props:[N,{style:{[yT.collapsiblePanelHeight]:d===void 0?`auto`:`${d}px`,[yT.collapsiblePanelWidth]:k===void 0?`auto`:`${k}px`}},c],stateAttributesMapping:pT});return M||j||f?P:null});function xT({...e}){return(0,y.jsx)(mT,{"data-slot":`collapsible`,...e})}function ST({...e}){return(0,y.jsx)(gT,{"data-slot":`collapsible-trigger`,...e})}function CT({...e}){return(0,y.jsx)(bT,{"data-slot":`collapsible-content`,...e})}function wT({className:e,...t}){return(0,y.jsx)(`label`,{"data-slot":`label`,className:qf(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function TT({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`field-group`,className:qf(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var ET=Rx(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function DT({className:e,orientation:t=`vertical`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:qf(ET({orientation:t}),e),...n})}function OT({className:e,...t}){return(0,y.jsx)(wT,{"data-slot":`field-label`,className:qf(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}var kT=b.createContext(void 0);function AT(e){let t=b.useContext(kT);if(t===void 0&&!e)throw Error(Gg(47));return t}function jT(){return{...Jy(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var MT={...Xy,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),openMethod:Q(e=>e.openMethod),openChangeReason:Q(e=>e.openChangeReason),modal:Q(e=>e.modal),focusManagerModal:Q(e=>e.focusManagerModal),stickIfOpen:Q(e=>e.stickIfOpen),titleElementId:Q(e=>e.titleElementId),descriptionElementId:Q(e=>e.descriptionElementId),openOnHover:Q(e=>e.openOnHover),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},NT=class e extends My{constructor(e){let t={...jT(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),stickIfOpenTimeout:new Bp,triggerElements:new Ky},MT)}setOpen=(e,t)=>{let n=t.reason===gm,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let a=()=>{let n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),T_.flushSync(a)):a(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let r=Ip(()=>new e(n)).current,i=t??r;return Rp(r.disposeEffect),i}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function PT({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=NT.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});Jf(()=>{n===void 0&&u.state.open===!1&&r===!0&&u.update({open:!0,activeTriggerId:l})}),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a);let{openMethod:p,triggerProps:m}=Nb(d);Wy(u);let{forceUnmount:h}=Gy(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});b.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=b.useCallback(()=>{u.setOpen(!1,Dm(Tm))},[u]);b.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=$y({popupStore:u,onOpenChange:u.setOpen}),{getReferenceProps:v,getFloatingProps:x,getTriggerProps:S}=ub([rv(_,{outsidePressEvent:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),xb(_)]),C=b.useMemo(()=>v(m),[v,m]),w=b.useMemo(()=>S(m),[S,m]),T=b.useMemo(()=>x(),[x]);u.useSyncedValues({modal:o,openMethod:p,activeTriggerProps:C,inactiveTriggerProps:w,popupProps:T,floatingRootContext:_,nested:F_()!=null});let E=b.useMemo(()=>({store:u}),[u]);return(0,y.jsx)(kT.Provider,{value:E,children:typeof t==`function`?t({payload:f}):t})}function FT(e){return AT(!0)?(0,y.jsx)(PT,{props:e}):(0,y.jsx)(z_,{children:(0,y.jsx)(PT,{props:e})})}function IT(e,t){let n=b.useRef(null);return{preFocusGuardRef:n,handlePreFocusGuardFocus:Z(t=>{T_.flushSync(()=>{e.setOpen(!1,Dm(bm,t.nativeEvent,t.currentTarget))}),vg(n.current)?.focus()}),handleFocusTargetFocus:Z(n=>{let r=e.select(`positionerElement`);if(r&&yg(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{T_.flushSync(()=>{e.setOpen(!1,Dm(bm,n.nativeEvent,n.currentTarget))});let i=_g(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&th(r,i);){let e=i;if(i=mg(i),i===e)break}i?.focus()}})}}var LT=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,handle:o,payload:s,openOnHover:c=!1,delay:l=300,closeDelay:u=0,id:d,style:f,...p}=e,m=AT(!0),h=o?.store??m?.store;if(!h)throw Error(Gg(74));let g=ox(d),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),x=h.useState(`isOpenedByTrigger`,g),S=b.useRef(null),{registerTrigger:C,isMountedByThisTrigger:w}=Uy(g,S,h,{payload:s,disabled:i,openOnHover:c,closeDelay:u}),T=h.useState(`openChangeReason`),E=h.useState(`stickIfOpen`),D=h.useState(`openMethod`),O=h.useState(`focusManagerModal`),k=lb(v,{enabled:v!=null&&c&&(D!==`touch`||T!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Ab(),restMs:l,delay:{close:u},triggerElementRef:S,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),A=ub([X_(v,{enabled:v!=null,stickIfOpen:E})]),j=h.useState(`triggerProps`,w),M={disabled:i,open:x},{getButtonProps:N,buttonRef:P}=rx({disabled:i,native:a}),F=b.useMemo(()=>({open(e){return e&&T===`trigger-press`?Xb.open(e):Yb.open(e)}}),[T]),I=m_(`button`,e,{state:M,ref:[P,t,C,S],props:[A.getReferenceProps(),k,j,{[x_]:``,id:g},p,N],stateAttributesMapping:F}),{preFocusGuardRef:L,handlePreFocusGuardFocus:ee,handleFocusTargetFocus:R}=IT(h,S);return _&&!O?(0,y.jsxs)(b.Fragment,{children:[(0,y.jsx)(qm,{ref:L,onFocus:ee}),(0,y.jsx)(b.Fragment,{children:I},g),(0,y.jsx)(qm,{ref:h.context.triggerFocusTargetRef,onFocus:R})]}):(0,y.jsx)(b.Fragment,{children:I},g)}),RT=b.createContext(void 0);function zT(){let e=b.useContext(RT);if(e===void 0)throw Error(Gg(45));return e}var BT=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=AT();return i.useState(`mounted`)||n?(0,y.jsx)(RT.Provider,{value:n,children:(0,y.jsx)(A_,{ref:t,...r})}):null}),VT=b.createContext(void 0);function HT(){let e=b.useContext(VT);if(!e)throw Error(Gg(46));return e}var UT=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=C_,style:g,..._}=e,{store:v}=AT(),x=zT(),S=L_(),C=v.useState(`floatingRootContext`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`openChangeReason`),D=v.useState(`activeTriggerElement`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`transitionStatus`),N=v.useState(`hasViewport`),P=b.useRef(null),F=By(A,!1,!1),I=sw({anchor:i,floatingRootContext:C,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:x,nodeId:S,collisionAvoidance:h,adaptiveOrigin:N?iw:void 0}),L=C.useState(`domReferenceElement`);X(()=>{let e=L,t=P.current;if(e&&(P.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return F(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[L,F,v]);let ee={open:T,side:I.side,align:I.align,anchorHidden:I.anchorHidden,instant:j};gw(T&&O===!0&&E!==`trigger-hover`,k===`touch`,A,D);let R=b.useCallback(e=>{v.set(`positionerElement`,e)},[v]),te=mw(e,ee,{styles:I.positionerStyles,transitionStatus:M,props:_,refs:[t,R],hidden:!w,inert:!T});return(0,y.jsxs)(VT.Provider,{value:I,children:[w&&O===!0&&E!==`trigger-hover`&&(0,y.jsx)(wx,{ref:v.context.internalBackdropRef,inert:Cx(!T),cutout:D}),(0,y.jsx)(R_,{id:S,children:te})]})}),WT=b.createContext(void 0);function GT(){let[e,t]=b.useState(0),n=Z(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:b.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function KT(e){let{value:t,children:n}=e;return(0,y.jsx)(WT.Provider,{value:t,children:n})}var qT={...Zb,...zy},JT=b.forwardRef(function(e,t){let{className:n,render:r,initialFocus:i,finalFocus:a,style:o,...s}=e,{store:c}=AT(),l=HT(),u=Sw(!0)!=null,{context:d,hasClosePart:f}=GT(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),x=c.useState(`descriptionElementId`),S=c.useState(`modal`),C=c.useState(`mounted`),w=c.useState(`openChangeReason`),T=c.useState(`activeTriggerElement`),E=c.useState(`floatingRootContext`);Vy({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}});let D=c.useState(`disabled`),O=c.useState(`openOnHover`),k=c.useState(`closeDelay`);sb(E,{enabled:O&&!D,closeDelay:k});function A(e){return e===`touch`?c.context.popupRef.current:!0}let j=i===void 0?A:i,M={open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},N=S!==!1&&f;c.useSyncedValue(`focusManagerModal`,N);let P=b.useCallback(e=>{c.set(`popupElement`,e)},[c]),F=m_(`div`,e,{state:M,ref:[t,c.context.popupRef,P],props:[_,{"aria-labelledby":v,"aria-describedby":x,onKeyDown(e){u&&bx.has(e.key)&&e.stopPropagation()}},pw(g),s],stateAttributesMapping:qT});return(0,y.jsx)(Y_,{context:E,openInteractionType:m,modal:N,disabled:!C||w===`trigger-hover`,initialFocus:j,returnFocus:a,restoreFocus:`popup`,previousFocusableElement:tp(T)?T:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,y.jsx)(KT,{value:d,children:F})})});function YT({...e}){return(0,y.jsx)(FT,{"data-slot":`popover`,...e})}function XT({...e}){return(0,y.jsx)(LT,{"data-slot":`popover-trigger`,...e})}function ZT({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,y.jsx)(BT,{children:(0,y.jsx)(UT,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,y.jsx)(JT,{"data-slot":`popover-content`,className:qf(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}var QT=b.createContext(void 0);function $T(){let e=b.useContext(QT);if(e===void 0)throw Error(Gg(63));return e}var eE=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}({}),tE={...rS,checked(e){return e?{[eE.checked]:``}:{[eE.unchecked]:``}}},nE=b.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...x}=e,{clearErrors:S}=sS(),{state:C,setTouched:w,setDirty:T,validityData:E,setFilled:D,setFocused:O,shouldValidateOnChange:k,validationMode:A,disabled:j,name:M,validation:N}=aS(),{labelId:P}=lS(),F=j||m,I=M??l,L=Z(d),ee=b.useRef(null),R=Mm(ee,c,N.inputRef),te=b.useRef(null),z=ox(),B=pS({id:s,implicit:!1,controlRef:te}),V=u?void 0:B,[H,ne]=mS({controlled:n,default:!!i,name:`Switch`,state:`checked`});hS(te,{id:z,value:H}),X(()=>{ee.current&&D(ee.current.checked)},[ee,D]),Mb(H,()=>{S(I),T(H!==E.initialValue),D(H),k()?N.commit(H):N.commit(H,!0)});let{getButtonProps:U,buttonRef:re}=rx({disabled:F,native:u}),ie=uS(a,P,ee,!u,V),ae={id:u?B:z,role:`switch`,"aria-checked":H,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":ie,onFocus(){F||O(!0)},onBlur(){let e=ee.current;!e||F||(w(!0),O(!1),A===`onBlur`&&N.commit(e.checked))},onClick(e){f||F||(e.preventDefault(),ee.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},oe=b.useMemo(()=>e_({checked:H,disabled:F,form:o,id:V,name:I,required:p,style:I?Km:Gm,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:R,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=Dm(mm,e.nativeEvent);L?.(t,n),!n.isCanceled&&ne(t)},onFocus(){te.current?.focus()}},N.getInputValidationProps,_===void 0?Jp:{value:_}),[H,F,o,R,V,I,L,f,p,ne,N,_]),se=b.useMemo(()=>({...C,checked:H,disabled:F,readOnly:f,required:p}),[C,H,F,f,p]),ce=m_(`span`,e,{state:se,ref:[t,te,re],props:[ae,N.getValidationProps,x,U],stateAttributesMapping:tE});return(0,y.jsxs)(QT.Provider,{value:se,children:[ce,!H&&I&&g!==void 0&&(0,y.jsx)(`input`,{type:`hidden`,form:o,name:I,value:g}),(0,y.jsx)(`input`,{...oe,suppressHydrationWarning:!0})]})}),rE=b.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=aS(),s=$T();return m_(`span`,e,{state:{...o,...s},ref:t,stateAttributesMapping:tE,props:a})});function iE({className:e,size:t=`default`,...n}){return(0,y.jsx)(nE,{"data-slot":`switch`,"data-size":t,className:qf(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,y.jsx)(rE,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}var aE=b.createContext(void 0);function oE(e){let t=b.useContext(aE);if(t===void 0&&!e)throw Error(Gg(72));return t}var sE={...Xy,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),isInstantPhase:Q(e=>e.isInstantPhase),trackCursorAxis:Q(e=>e.trackCursorAxis),disableHoverablePopup:Q(e=>e.disableHoverablePopup),lastOpenChangeReason:Q(e=>e.openChangeReason),closeOnClick:Q(e=>e.closeOnClick),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},cE=class e extends My{constructor(e){super({...lE(),...e},{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Ky},sE)}setOpen=(e,t)=>{let n=t.reason,r=n===gm,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0);let o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};r?T_.flushSync(o):o()};static useStore(t,n){let r=Ip(()=>new e(n)).current,i=t??r,a=$y({popupStore:i,onOpenChange:i.setOpen});return i.state.floatingRootContext=a,i}};function lE(){return{...Jy(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var uE=xy(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=cE.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});Jf(()=>{r===void 0&&p.state.open===!1&&n===!0&&p.update({open:!0,activeTriggerId:d})}),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),X(()=>{m&&t&&p.setOpen(!1,Dm(wm))},[m,t,p]),p.useSyncedValue(`disabled`,t),Wy(p);let{forceUnmount:v,transitionStatus:x}=Gy(h,p),S=p.select(`floatingRootContext`),C=p.useState(`isInstantPhase`),w=p.useState(`instantType`),T=p.useState(`lastOpenChangeReason`),E=b.useRef(null);X(()=>{x===`ending`&&T===`none`||x!==`ending`&&C?(w!==`delay`&&(E.current=w),p.set(`instantType`,`delay`)):E.current!==null&&(p.set(`instantType`,E.current),E.current=null)},[x,C,T,w,p]),X(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let D=b.useCallback(()=>{p.setOpen(!1,Dm(Tm))},[p]);b.useImperativeHandle(o,()=>({unmount:v,close:D}),[v,D]);let{getReferenceProps:O,getFloatingProps:k,getTriggerProps:A}=ub([rv(S,{enabled:!t,referencePress:()=>p.select(`closeOnClick`)}),$_(S,{enabled:!t&&a!==`none`,axis:a===`none`?void 0:a})]),j=b.useMemo(()=>O(),[O]),M=b.useMemo(()=>A(),[A]),N=b.useMemo(()=>k(),[k]);return p.useSyncedValues({activeTriggerProps:j,inactiveTriggerProps:M,popupProps:N}),(0,y.jsx)(aE.Provider,{value:p,children:typeof f==`function`?f({payload:_}):f})}),dE=b.createContext(void 0);function fE(){return b.useContext(dE)}var pE=function(e){return e[e.popupOpen=Ub.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),mE=Sy(function(e,t){let{className:n,render:r,handle:i,payload:a,disabled:o,delay:s,closeOnClick:c=!0,closeDelay:l,id:u,style:d,...f}=e,p=oE(!0),m=i?.store??p;if(!m)throw Error(Gg(82));let h=ox(u),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=b.useRef(null),x=s??600,S=l??0,{registerTrigger:C,isMountedByThisTrigger:w}=Uy(h,y,m,{payload:a,closeOnClick:c,closeDelay:S}),T=fE(),{delayRef:E,isInstantPhase:D,hasProvider:O}=Am(v,{open:_});m.useSyncedValue(`isInstantPhase`,D);let k=m.useState(`disabled`),A=o??k,j=m.useState(`trackCursorAxis`),M=m.useState(`disableHoverablePopup`),N=lb(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!M&&j!==`both`?Ab():null,restMs(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:s??e??x),n},delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return l==null&&O&&(t=e),{close:t}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`}),P=tb(v,{enabled:!A}).reference,F={open:_},I=m.useState(`triggerProps`,w);return m_(`button`,e,{state:F,ref:[t,C,y],props:[N,P,I,{onPointerDown(){m.set(`closeOnClick`,c)},id:h,[pE.triggerDisabled]:A?``:void 0},f],stateAttributesMapping:Yb})}),hE=b.createContext(void 0);function gE(){let e=b.useContext(hE);if(e===void 0)throw Error(Gg(70));return e}var _E=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=k_({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,y.jsxs)(b.Fragment,{children:[l,c&&T_.createPortal(n,c)]})}),vE=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return oE().useState(`mounted`)||n?(0,y.jsx)(hE.Provider,{value:n,children:(0,y.jsx)(_E,{ref:t,...r})}):null}),yE=b.createContext(void 0);function bE(){let e=b.useContext(yE);if(e===void 0)throw Error(Gg(71));return e}var xE=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=C_,style:g,..._}=e,v=oE(),x=gE(),S=v.useState(`open`),C=v.useState(`mounted`),w=v.useState(`trackCursorAxis`),T=v.useState(`disableHoverablePopup`),E=v.useState(`floatingRootContext`),D=v.useState(`instantType`),O=v.useState(`transitionStatus`),k=sw({anchor:i,positionMethod:a,floatingRootContext:E,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:x,collisionAvoidance:h,adaptiveOrigin:v.useState(`hasViewport`)?iw:void 0}),A=mw(e,b.useMemo(()=>({open:S,side:k.side,align:k.align,anchorHidden:k.anchorHidden,instant:w===`none`?D:`tracking-cursor`}),[S,k.side,k.align,k.anchorHidden,w,D]),{styles:k.positionerStyles,transitionStatus:O,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!C,inert:!S||w===`both`||T});return(0,y.jsx)(yE.Provider,{value:k,children:A})}),SE={...Zb,...zy},CE=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=oE(),{side:s,align:c}=bE(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);Vy({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=o.useState(`disabled`),h=o.useState(`closeDelay`);return sb(p,{enabled:!m,closeDelay:h}),m_(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,pw(d),a],stateAttributesMapping:SE})}),wE=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=oE(),s=o.useState(`open`),c=o.useState(`instantType`),{arrowRef:l,side:u,align:d,arrowUncentered:f,arrowStyles:p}=bE();return m_(`div`,e,{state:{open:s,side:u,align:d,uncentered:f,instant:c},ref:[t,l],props:[{style:p,"aria-hidden":!0},a],stateAttributesMapping:Zb})}),TE=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=b.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=b.useMemo(()=>({open:t,close:n}),[t,n]);return(0,y.jsx)(dE.Provider,{value:i,children:(0,y.jsx)(km,{delay:a,timeoutMs:r,children:e.children})})};function EE({delay:e=0,...t}){return(0,y.jsx)(TE,{"data-slot":`tooltip-provider`,delay:e,...t})}function DE({...e}){return(0,y.jsx)(uE,{"data-slot":`tooltip`,...e})}function OE({...e}){return(0,y.jsx)(mE,{"data-slot":`tooltip-trigger`,...e})}function kE({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,y.jsx)(vE,{children:(0,y.jsx)(xE,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,y.jsxs)(CE,{"data-slot":`tooltip-content`,className:qf(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,y.jsx)(wE,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var AE=[{id:`block`,name:`Block`},{id:`bar`,name:`Bar`},{id:`underline`,name:`Underline`}],jE=`block`,ME=AE.map(e=>e.id),NE=e=>typeof e==`string`&&ME.includes(e),PE=e=>e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`),FE=`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,IE=`"Symbols Nerd Font"`,LE=(e,t)=>`"${PE(e)}"${t?`, ${IE}`:``}, ${FE}`,RE=(e,t,n)=>({id:e,name:t,family:LE(t,!0),source:n}),zE=RE(`geist-mono`,`Geist Mono`,`fontsource`),BE=RE(`jetbrains-mono`,`JetBrains Mono`,`google`),VE=RE(`fira-code`,`Fira Code`,`google`),HE=RE(`ibm-plex-mono`,`IBM Plex Mono`,`google`),UE=RE(`source-code-pro`,`Source Code Pro`,`google`),WE=RE(`roboto-mono`,`Roboto Mono`,`google`),GE=RE(`dm-mono`,`DM Mono`,`google`),KE=RE(`inconsolata`,`Inconsolata`,`google`),qE=RE(`space-mono`,`Space Mono`,`google`),JE=RE(`ubuntu-mono`,`Ubuntu Mono`,`google`),YE=[zE,RE(`anonymous-pro`,`Anonymous Pro`,`google`),GE,VE,HE,KE,BE,WE,UE,qE,JE];zE.id;var XE=e=>e?YE.find(t=>t.id===e)??zE:zE,ZE=(e,t)=>LE(e.name,t),QE=()=>{let e=YE.filter(e=>e.source===`google`);return e.length===0?``:`https://fonts.googleapis.com/css2?${e.map(e=>`family=${e.name.replace(/ /g,`+`)}:wght@400;700`).join(`&`)}&display=swap`},$E=[{value:1e3,label:`1k lines`},{value:1e4,label:`10k lines`},{value:5e4,label:`50k lines`},{value:1e5,label:`100k lines`}],eD=1e4,tD=$E.map(e=>e.value),nD=e=>tD.includes(e),rD={id:`vesper`,name:`Vesper`,source:`raunofreiberg/vesper`,colors:{background:`#101010`,foreground:`#ffffff`,cursor:`#ffc799`,cursorAccent:`#101010`,selectionBackground:`#2a2a2a`,selectionForeground:`#ffffff`,black:`#101010`,red:`#ff8080`,green:`#99ffe4`,yellow:`#ffc799`,blue:`#a0a0a0`,magenta:`#ffc799`,cyan:`#99ffe4`,white:`#ffffff`,brightBlack:`#505050`,brightRed:`#ff9999`,brightGreen:`#b3ffe4`,brightYellow:`#ffd1a8`,brightBlue:`#b0b0b0`,brightMagenta:`#ffc799`,brightCyan:`#66ddcc`,brightWhite:`#ffffff`}},iD=[rD,{id:`ayu-mirage`,name:`Ayu Mirage`,source:`ayu-theme/vscode-ayu`,colors:{background:`#1f2430`,foreground:`#cccac2`,cursor:`#ffcc66`,cursorAccent:`#1f2430`,selectionBackground:`#34455a`,selectionForeground:`#cccac2`,black:`#171b24`,red:`#f28273`,green:`#87d96c`,yellow:`#fcca60`,blue:`#6acdff`,magenta:`#ddbbff`,cyan:`#93e2c8`,white:`#c7c7c7`,brightBlack:`#686868`,brightRed:`#f28779`,brightGreen:`#d5ff80`,brightYellow:`#ffcd66`,brightBlue:`#73d0ff`,brightMagenta:`#dfbfff`,brightCyan:`#95e6cb`,brightWhite:`#ffffff`}},{id:`catppuccin-frappe`,name:`Catppuccin Frappé`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#303446`,foreground:`#c6d0f5`,cursor:`#f2d5cf`,cursorAccent:`#232634`,selectionBackground:`#626880`,selectionForeground:`#c6d0f5`,black:`#51576d`,red:`#e78284`,green:`#a6d189`,yellow:`#e5c890`,blue:`#8caaee`,magenta:`#f4b8e4`,cyan:`#81c8be`,white:`#b5bfe2`,brightBlack:`#626880`,brightRed:`#e78284`,brightGreen:`#a6d189`,brightYellow:`#e5c890`,brightBlue:`#8caaee`,brightMagenta:`#f4b8e4`,brightCyan:`#81c8be`,brightWhite:`#a5adce`}},{id:`catppuccin-macchiato`,name:`Catppuccin Macchiato`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#24273a`,foreground:`#cad3f5`,cursor:`#f4dbd6`,cursorAccent:`#181926`,selectionBackground:`#5b6078`,selectionForeground:`#cad3f5`,black:`#494d64`,red:`#ed8796`,green:`#a6da95`,yellow:`#eed49f`,blue:`#8aadf4`,magenta:`#f5bde6`,cyan:`#8bd5ca`,white:`#b8c0e0`,brightBlack:`#5b6078`,brightRed:`#ed8796`,brightGreen:`#a6da95`,brightYellow:`#eed49f`,brightBlue:`#8aadf4`,brightMagenta:`#f5bde6`,brightCyan:`#8bd5ca`,brightWhite:`#a5adcb`}},{id:`catppuccin-mocha`,name:`Catppuccin Mocha`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#1e1e2e`,foreground:`#cdd6f4`,cursor:`#f5e0dc`,cursorAccent:`#11111b`,selectionBackground:`#585b70`,selectionForeground:`#cdd6f4`,black:`#45475a`,red:`#f38ba8`,green:`#a6e3a1`,yellow:`#f9e2af`,blue:`#89b4fa`,magenta:`#f5c2e7`,cyan:`#94e2d5`,white:`#bac2de`,brightBlack:`#585b70`,brightRed:`#f38ba8`,brightGreen:`#a6e3a1`,brightYellow:`#f9e2af`,brightBlue:`#89b4fa`,brightMagenta:`#f5c2e7`,brightCyan:`#94e2d5`,brightWhite:`#a6adc8`}},{id:`dracula`,name:`Dracula`,source:`dracula/visual-studio-code`,colors:{background:`#282a36`,foreground:`#f8f8f2`,cursor:`#f8f8f2`,cursorAccent:`#282a36`,selectionBackground:`#44475a`,selectionForeground:`#f8f8f2`,black:`#21222c`,red:`#ff5555`,green:`#50fa7b`,yellow:`#f1fa8c`,blue:`#bd93f9`,magenta:`#ff79c6`,cyan:`#8be9fd`,white:`#f8f8f2`,brightBlack:`#6272a4`,brightRed:`#ff6e6e`,brightGreen:`#69ff94`,brightYellow:`#ffffa5`,brightBlue:`#d6acff`,brightMagenta:`#ff92df`,brightCyan:`#a4ffff`,brightWhite:`#ffffff`}},{id:`github-dark`,name:`GitHub Dark Default`,source:`primer/github-vscode-theme + @primer/primitives`,colors:{background:`#0d1117`,foreground:`#e6edf3`,cursor:`#e6edf3`,cursorAccent:`#0d1117`,selectionBackground:`#264f78`,selectionForeground:`#e6edf3`,black:`#484f58`,red:`#ff7b72`,green:`#3fb950`,yellow:`#d29922`,blue:`#58a6ff`,magenta:`#bc8cff`,cyan:`#39c5cf`,white:`#b1bac4`,brightBlack:`#6e7681`,brightRed:`#ffa198`,brightGreen:`#56d364`,brightYellow:`#e3b341`,brightBlue:`#79c0ff`,brightMagenta:`#d2a8ff`,brightCyan:`#56d4dd`,brightWhite:`#ffffff`}},{id:`gruvbox-dark`,name:`Gruvbox Dark (Medium)`,source:`jdinhify/vscode-theme-gruvbox`,colors:{background:`#282828`,foreground:`#ebdbb2`,cursor:`#ebdbb2`,cursorAccent:`#282828`,selectionBackground:`#504945`,selectionForeground:`#ebdbb2`,black:`#3c3836`,red:`#cc241d`,green:`#98971a`,yellow:`#d79921`,blue:`#458588`,magenta:`#b16286`,cyan:`#689d6a`,white:`#a89984`,brightBlack:`#928374`,brightRed:`#fb4934`,brightGreen:`#b8bb26`,brightYellow:`#fabd2f`,brightBlue:`#83a598`,brightMagenta:`#d3869b`,brightCyan:`#8ec07c`,brightWhite:`#ebdbb2`}},{id:`monokai`,name:`Monokai`,source:`vscode/extensions/theme-monokai`,colors:{background:`#272822`,foreground:`#f8f8f2`,cursor:`#f8f8f0`,cursorAccent:`#272822`,selectionBackground:`#878b91`,selectionForeground:`#f8f8f2`,black:`#333333`,red:`#c4265e`,green:`#86b42b`,yellow:`#b3b42b`,blue:`#6a7ec8`,magenta:`#8c6bc8`,cyan:`#56adbc`,white:`#e3e3dd`,brightBlack:`#666666`,brightRed:`#f92672`,brightGreen:`#a6e22e`,brightYellow:`#e2e22e`,brightBlue:`#819aff`,brightMagenta:`#ae81ff`,brightCyan:`#66d9ef`,brightWhite:`#f8f8f2`}},{id:`night-owl`,name:`Night Owl`,source:`sdras/night-owl-vscode-theme`,colors:{background:`#011627`,foreground:`#d6deeb`,cursor:`#80a4c2`,cursorAccent:`#011627`,selectionBackground:`#1b90dd`,selectionForeground:`#d6deeb`,black:`#011627`,red:`#ef5350`,green:`#22da6e`,yellow:`#c5e478`,blue:`#82aaff`,magenta:`#c792ea`,cyan:`#21c7a8`,white:`#ffffff`,brightBlack:`#575656`,brightRed:`#ef5350`,brightGreen:`#22da6e`,brightYellow:`#ffeb95`,brightBlue:`#82aaff`,brightMagenta:`#c792ea`,brightCyan:`#7fdbca`,brightWhite:`#ffffff`}},{id:`nord`,name:`Nord`,source:`arcticicestudio/nord-visual-studio-code`,colors:{background:`#2e3440`,foreground:`#d8dee9`,cursor:`#d8dee9`,cursorAccent:`#2e3440`,selectionBackground:`#434c5e`,selectionForeground:`#eceff4`,black:`#3b4252`,red:`#bf616a`,green:`#a3be8c`,yellow:`#ebcb8b`,blue:`#81a1c1`,magenta:`#b48ead`,cyan:`#88c0d0`,white:`#e5e9f0`,brightBlack:`#4c566a`,brightRed:`#bf616a`,brightGreen:`#a3be8c`,brightYellow:`#ebcb8b`,brightBlue:`#81a1c1`,brightMagenta:`#b48ead`,brightCyan:`#8fbcbb`,brightWhite:`#eceff4`}},{id:`one-dark-pro`,name:`One Dark Pro`,source:`Binaryify/OneDark-Pro`,colors:{background:`#282c34`,foreground:`#abb2bf`,cursor:`#abb2bf`,cursorAccent:`#282c34`,selectionBackground:`#3e4452`,selectionForeground:`#abb2bf`,black:`#3f4451`,red:`#e05561`,green:`#8cc265`,yellow:`#d18f52`,blue:`#4aa5f0`,magenta:`#c162de`,cyan:`#42b3c2`,white:`#d7dae0`,brightBlack:`#4f5666`,brightRed:`#ff616e`,brightGreen:`#a5e075`,brightYellow:`#f0a45d`,brightBlue:`#4dc4ff`,brightMagenta:`#de73ff`,brightCyan:`#4cd1e0`,brightWhite:`#e6e6e6`}},{id:`solarized-dark`,name:`Solarized Dark`,source:`vscode/extensions/theme-solarized-dark`,colors:{background:`#002b36`,foreground:`#839496`,cursor:`#d30102`,cursorAccent:`#002b36`,selectionBackground:`#274642`,selectionForeground:`#93a1a1`,black:`#073642`,red:`#dc322f`,green:`#859900`,yellow:`#b58900`,blue:`#268bd2`,magenta:`#d33682`,cyan:`#2aa198`,white:`#eee8d5`,brightBlack:`#002b36`,brightRed:`#cb4b16`,brightGreen:`#586e75`,brightYellow:`#657b83`,brightBlue:`#839496`,brightMagenta:`#6c71c4`,brightCyan:`#93a1a1`,brightWhite:`#fdf6e3`}},{id:`synthwave-84`,name:`SynthWave '84`,source:`robb0wen/synthwave-vscode`,colors:{background:`#262335`,foreground:`#ffffff`,cursor:`#03edf9`,cursorAccent:`#262335`,selectionBackground:`#463465`,selectionForeground:`#ffffff`,black:`#2a2139`,red:`#fe4450`,green:`#72f1b8`,yellow:`#f3e70f`,blue:`#03edf9`,magenta:`#ff7edb`,cyan:`#03edf9`,white:`#ffffff`,brightBlack:`#495495`,brightRed:`#fe4450`,brightGreen:`#72f1b8`,brightYellow:`#fede5d`,brightBlue:`#03edf9`,brightMagenta:`#ff7edb`,brightCyan:`#03edf9`,brightWhite:`#ffffff`}},{id:`tokyo-night`,name:`Tokyo Night`,source:`enkia/tokyo-night-vscode-theme`,colors:{background:`#1a1b26`,foreground:`#a9b1d6`,cursor:`#c0caf5`,cursorAccent:`#1a1b26`,selectionBackground:`#515c7e`,selectionForeground:`#c0caf5`,black:`#363b54`,red:`#f7768e`,green:`#73daca`,yellow:`#e0af68`,blue:`#7aa2f7`,magenta:`#bb9af7`,cyan:`#7dcfff`,white:`#787c99`,brightBlack:`#363b54`,brightRed:`#f7768e`,brightGreen:`#73daca`,brightYellow:`#e0af68`,brightBlue:`#7aa2f7`,brightMagenta:`#bb9af7`,brightCyan:`#7dcfff`,brightWhite:`#acb0d0`}},{id:`tokyo-night-storm`,name:`Tokyo Night Storm`,source:`enkia/tokyo-night-vscode-theme`,colors:{background:`#24283b`,foreground:`#a9b1d6`,cursor:`#c0caf5`,cursorAccent:`#24283b`,selectionBackground:`#6f7bb6`,selectionForeground:`#c0caf5`,black:`#414868`,red:`#f7768e`,green:`#73daca`,yellow:`#e0af68`,blue:`#7aa2f7`,magenta:`#bb9af7`,cyan:`#7dcfff`,white:`#8089b3`,brightBlack:`#414868`,brightRed:`#f7768e`,brightGreen:`#73daca`,brightYellow:`#e0af68`,brightBlue:`#7aa2f7`,brightMagenta:`#bb9af7`,brightCyan:`#7dcfff`,brightWhite:`#a9b1d6`}}];rD.id;var aD=e=>e?iD.find(t=>t.id===e)??rD:rD,oD=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,sD=`text-xs font-normal text-muted-foreground`,cD=Object.fromEntries(YE.map(e=>[e.id,{fontFamily:e.family}])),lD=iD.map(e=>({id:e.id,label:e.name})),uD=YE.map(e=>({id:e.id,label:e.name,itemStyle:cD[e.id]})),dD=AE.map(e=>({id:e.id,label:e.name})),fD=$E.map(e=>({id:String(e.value),label:e.label})),pD=e=>e.toFixed(1),mD=({label:e,value:t,title:n,valueClassName:r})=>(0,y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,y.jsx)(`dt`,{className:sD,children:e}),(0,y.jsx)(`dd`,{title:n??t,className:qf(`min-w-0 truncate text-right text-foreground/90`,r),children:t})]}),hD=({themeId:e,onThemeChange:t,onThemePreview:n,fontId:r,onFontChange:i,onFontPreview:a,nerdFontEnabled:o,onNerdFontEnabledChange:s,fontSize:c,onFontSizeChange:l,lineHeight:u,onLineHeightChange:d,paddingX:f,onPaddingXChange:p,paddingY:m,onPaddingYChange:h,cursorStyle:g,onCursorStyleChange:_,onCursorStylePreview:v,cursorBlink:x,onCursorBlinkChange:S,scrollback:C,onScrollbackChange:w,scrollOnUserInput:T,onScrollOnUserInputChange:E,notificationsPermission:D,onNotificationsPermissionRequest:O,sessionInfo:k,onPopoverOpenChange:A,onClose:j})=>{let[M,N]=(0,b.useState)(!1),[P,F]=(0,b.useState)(!1),I=(0,b.useRef)(null);return(0,y.jsxs)(YT,{open:M,onOpenChange:e=>{N(e),A?.(e),e||(F(!1),n?.(null),a?.(null),v?.(null),j?.())},children:[(0,y.jsxs)(DE,{children:[(0,y.jsx)(OE,{render:(0,y.jsx)(XT,{render:(0,y.jsx)(Bx,{variant:`ghost`,size:`icon-sm`,"aria-label":`terminal settings`,className:`hover:text-foreground`})}),children:(0,y.jsx)(yd,{})}),M?null:(0,y.jsx)(kE,{side:`bottom`,sideOffset:8,children:`Settings`})]}),(0,y.jsx)(ZT,{ref:I,side:`bottom`,align:`end`,sideOffset:8,className:qf(`w-64 gap-0 overflow-hidden p-3`,Dx,Ox),children:(0,y.jsxs)(TT,{className:`gap-3`,children:[(0,y.jsxs)(DT,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(OT,{className:oD,children:`Theme`}),(0,y.jsx)(iT,{value:e,items:lD,ariaLabel:`select theme`,placeholder:`Theme`,onValueChange:e=>{e&&t(e)},onOpenChange:e=>{e||n?.(null)},onItemHover:n?e=>n(e):void 0})]}),(0,y.jsx)(rC,{className:`bg-border/40`}),(0,y.jsxs)(DT,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(OT,{className:oD,children:`Font`}),(0,y.jsx)(iT,{value:r,items:uD,ariaLabel:`select font`,placeholder:`Font`,open:P,onValueChange:e=>{e&&i(e)},onOpenChange:e=>{F(e),e||a?.(null)},onItemHover:a?e=>a(e):void 0}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:sD,children:`Size`}),(0,y.jsx)(dC,{value:c,min:9,max:24,step:1,ariaLabel:`terminal font size`,decrementAriaLabel:`decrease font size`,incrementAriaLabel:`increase font size`,onValueChange:l})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:sD,children:`Line height`}),(0,y.jsx)(dC,{value:u,min:1,max:2,step:kS,ariaLabel:`terminal line height`,decrementAriaLabel:`decrease line height`,incrementAriaLabel:`increase line height`,formatDisplay:pD,onValueChange:d})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(DE,{children:[(0,y.jsx)(OE,{render:(0,y.jsx)(`span`,{className:sD}),children:`Nerd Font icons`}),(0,y.jsx)(kE,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`Appends a Symbols Only Nerd Font to the font stack. Icon glyphs (Private Use Area codepoints) are resolved by the symbols font while all other characters render from the primary font above.`})]}),(0,y.jsx)(iE,{"aria-label":`toggle nerd font icons`,checked:o,onCheckedChange:s})]})]}),(0,y.jsx)(rC,{className:`bg-border/40`}),(0,y.jsxs)(DT,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(OT,{className:oD,children:`Window`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:sD,children:`Pad X`}),(0,y.jsx)(dC,{value:f,min:0,max:48,step:1,ariaLabel:`terminal horizontal padding`,decrementAriaLabel:`decrease horizontal padding`,incrementAriaLabel:`increase horizontal padding`,onValueChange:p})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:sD,children:`Pad Y`}),(0,y.jsx)(dC,{value:m,min:0,max:48,step:1,ariaLabel:`terminal vertical padding`,decrementAriaLabel:`decrease vertical padding`,incrementAriaLabel:`increase vertical padding`,onValueChange:h})]})]}),(0,y.jsx)(rC,{className:`bg-border/40`}),(0,y.jsxs)(DT,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(OT,{className:oD,children:`Notifications`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(DE,{children:[(0,y.jsx)(OE,{render:(0,y.jsx)(`span`,{className:sD}),children:`Desktop alerts`}),(0,y.jsx)(kE,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, OSC 9 sequences from the shell trigger browser notifications. Enable to receive alerts when the tab is in the background. Blocked permissions must be changed in browser settings.`})]}),(0,y.jsx)(iE,{"aria-label":`toggle desktop notifications`,checked:D===`granted`,disabled:D===`unsupported`||D===`denied`,onCheckedChange:e=>{e&&O()}})]})]}),(0,y.jsx)(rC,{className:`bg-border/40`}),(0,y.jsxs)(DT,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(OT,{className:oD,children:`Cursor`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:sD,children:`Style`}),(0,y.jsx)(iT,{value:g,items:dD,ariaLabel:`select cursor style`,placeholder:`Cursor style`,triggerClassName:`w-fit min-w-[7rem]`,onValueChange:e=>{NE(e)&&_(e)},onOpenChange:e=>{e||v?.(null)},onItemHover:v?e=>{NE(e)&&v?.(e)}:void 0})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:sD,children:`Blink`}),(0,y.jsx)(iE,{"aria-label":`toggle cursor blink`,checked:x,onCheckedChange:S})]})]}),(0,y.jsx)(rC,{className:`bg-border/40`}),(0,y.jsxs)(DT,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(OT,{className:oD,children:`Scrollback`}),(0,y.jsx)(iT,{value:String(C),items:fD,ariaLabel:`select scrollback`,placeholder:`Scrollback`,onValueChange:e=>{if(e===null)return;let t=Number(e);nD(t)&&w(t)}}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(DE,{children:[(0,y.jsx)(OE,{render:(0,y.jsx)(`span`,{className:sD}),children:`Pin to bottom on input`}),(0,y.jsx)(kE,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, typing scrolls the viewport back to the bottom. When off, the viewport stays where you scrolled — useful for reading history while typing.`})]}),(0,y.jsx)(iE,{"aria-label":`toggle pin to bottom on input`,checked:T,onCheckedChange:E})]})]}),k?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(rC,{className:`bg-border/40`}),(0,y.jsxs)(xT,{defaultOpen:!1,children:[(0,y.jsx)(ST,{render:(0,y.jsxs)(`button`,{type:`button`,className:`group/shell flex w-full items-center justify-between gap-2 rounded-sm py-1 text-left transition-colors outline-none hover:text-foreground/90 focus-visible:text-foreground/90`,children:[(0,y.jsx)(`span`,{className:oD,children:`Shell`}),(0,y.jsx)(dd,{className:`size-3 text-muted-foreground/60 transition-transform duration-200 ease-snappy will-change-transform group-aria-expanded/shell:rotate-180`})]})}),(0,y.jsx)(CT,{className:`h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 ease-snappy data-closed:h-0`,children:(0,y.jsxs)(`dl`,{className:`flex flex-col gap-1 pt-2 text-xs`,children:[(0,y.jsx)(mD,{label:`Name`,value:k.shellName}),(0,y.jsx)(mD,{label:`Path`,value:k.shell,title:k.shell}),(0,y.jsx)(mD,{label:`PID`,value:String(k.pid),valueClassName:`tabular-nums`}),(0,y.jsx)(mD,{label:`Cwd`,value:k.cwd,title:k.cwd})]})})]})]}):null]})})]})},gD=64*1024,_D=1*1024*1024,vD=4*1024,yD=1024,bD=1e3,xD=1e3;Object.freeze({status:`aborted`});function $(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var SD=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},CD=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},wD={};function TD(e){return e&&Object.assign(wD,e),wD}function ED(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function DD(e,t){return typeof t==`bigint`?t.toString():t}function OD(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function kD(e){return e==null}function AD(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function jD(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var MD=Symbol(`evaluating`);function ND(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==MD)return r===void 0&&(r=MD,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function PD(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function FD(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function ID(e){return JSON.stringify(e)}function LD(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var RD=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function zD(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var BD=OD(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function VD(e){if(zD(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(zD(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function HD(e){return VD(e)?{...e}:Array.isArray(e)?[...e]:e}var UD=new Set([`string`,`number`,`symbol`]);function WD(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function GD(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function KD(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function qD(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var JD={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function YD(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return GD(e,FD(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return PD(this,`shape`,e),e},checks:[]}))}function XD(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return GD(e,FD(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return PD(this,`shape`,r),r},checks:[]}))}function ZD(e,t){if(!VD(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return GD(e,FD(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return PD(this,`shape`,n),n}}))}function QD(e,t){if(!VD(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return GD(e,FD(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return PD(this,`shape`,n),n}}))}function $D(e,t){return GD(e,FD(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return PD(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function eO(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return GD(t,FD(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return PD(this,`shape`,i),i},checks:[]}))}function tO(e,t,n){return GD(t,FD(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return PD(this,`shape`,i),i}}))}function nO(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function rO(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function iO(e){return typeof e==`string`?e:e?.message}function aO(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=iO(e.inst?._zod.def?.error?.(e))??iO(t?.error?.(e))??iO(n.customError?.(e))??iO(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function oO(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function sO(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var cO=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,DD,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},lO=$(`$ZodError`,cO),uO=$(`$ZodError`,cO,{Parent:Error});function dO(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function fO(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var pO=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new SD;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>aO(e,a,TD())));throw RD(t,i?.callee),t}return o.value},mO=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>aO(e,a,TD())));throw RD(t,i?.callee),t}return o.value},hO=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new SD;return a.issues.length?{success:!1,error:new(e??lO)(a.issues.map(e=>aO(e,i,TD())))}:{success:!0,data:a.value}},gO=hO(uO),_O=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>aO(e,i,TD())))}:{success:!0,data:a.value}},vO=_O(uO),yO=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return pO(e)(t,n,i)},bO=e=>(t,n,r)=>pO(e)(t,n,r),xO=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return mO(e)(t,n,i)},SO=e=>async(t,n,r)=>mO(e)(t,n,r),CO=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return hO(e)(t,n,i)},wO=e=>(t,n,r)=>hO(e)(t,n,r),TO=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return _O(e)(t,n,i)},EO=e=>async(t,n,r)=>_O(e)(t,n,r),DO=/^[cC][^\s-]{8,}$/,OO=/^[0-9a-z]+$/,kO=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,AO=/^[0-9a-vA-V]{20}$/,jO=/^[A-Za-z0-9]{27}$/,MO=/^[a-zA-Z0-9_-]{21}$/,NO=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,PO=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,FO=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,IO=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,LO=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function RO(){return new RegExp(LO,`u`)}var zO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,BO=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,VO=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,HO=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,UO=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,WO=/^[A-Za-z0-9_-]*$/,GO=/^\+[1-9]\d{6,14}$/,KO=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,qO=RegExp(`^${KO}$`);function JO(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function YO(e){return RegExp(`^${JO(e)}$`)}function XO(e){let t=JO({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${KO}T(?:${r})$`)}var ZO=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},QO=/^-?\d+$/,$O=/^-?\d+(?:\.\d+)?$/,ek=/^(?:true|false)$/i,tk=/^[^A-Z]*$/,nk=/^[^a-z]*$/,rk=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ik={number:`number`,bigint:`bigint`,object:`date`},ak=$(`$ZodCheckLessThan`,(e,t)=>{rk.init(e,t);let n=ik[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ok=$(`$ZodCheckGreaterThan`,(e,t)=>{rk.init(e,t);let n=ik[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sk=$(`$ZodCheckMultipleOf`,(e,t)=>{rk.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):jD(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ck=$(`$ZodCheckNumberFormat`,(e,t)=>{rk.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=JD[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=QO)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),lk=$(`$ZodCheckMaxLength`,(e,t)=>{var n;rk.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!kD(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=oO(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),uk=$(`$ZodCheckMinLength`,(e,t)=>{var n;rk.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!kD(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=oO(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dk=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;rk.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!kD(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=oO(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),fk=$(`$ZodCheckStringFormat`,(e,t)=>{var n,r;rk.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),pk=$(`$ZodCheckRegex`,(e,t)=>{fk.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),mk=$(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=tk,fk.init(e,t)}),hk=$(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=nk,fk.init(e,t)}),gk=$(`$ZodCheckIncludes`,(e,t)=>{rk.init(e,t);let n=WD(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),_k=$(`$ZodCheckStartsWith`,(e,t)=>{rk.init(e,t);let n=RegExp(`^${WD(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),vk=$(`$ZodCheckEndsWith`,(e,t)=>{rk.init(e,t);let n=RegExp(`.*${WD(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),yk=$(`$ZodCheckOverwrite`,(e,t)=>{rk.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),bk=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
76
76
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
77
|
-
`))}},
|
|
77
|
+
`))}},xk={major:4,minor:3,patch:6},Sk=$(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=xk;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=nO(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new SD;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=nO(e,t))});else{if(e.issues.length===t)continue;r||=nO(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(nO(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new SD;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new SD;return o.then(e=>t(e,r,a))}return t(o,r,a)}}ND(e,`~standard`,()=>({validate:t=>{try{let n=gO(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return vO(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ck=$(`$ZodString`,(e,t)=>{Sk.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ZO(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),wk=$(`$ZodStringFormat`,(e,t)=>{fk.init(e,t),Ck.init(e,t)}),Tk=$(`$ZodGUID`,(e,t)=>{t.pattern??=PO,wk.init(e,t)}),Ek=$(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=FO(e)}else t.pattern??=FO();wk.init(e,t)}),Dk=$(`$ZodEmail`,(e,t)=>{t.pattern??=IO,wk.init(e,t)}),Ok=$(`$ZodURL`,(e,t)=>{wk.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),kk=$(`$ZodEmoji`,(e,t)=>{t.pattern??=RO(),wk.init(e,t)}),Ak=$(`$ZodNanoID`,(e,t)=>{t.pattern??=MO,wk.init(e,t)}),jk=$(`$ZodCUID`,(e,t)=>{t.pattern??=DO,wk.init(e,t)}),Mk=$(`$ZodCUID2`,(e,t)=>{t.pattern??=OO,wk.init(e,t)}),Nk=$(`$ZodULID`,(e,t)=>{t.pattern??=kO,wk.init(e,t)}),Pk=$(`$ZodXID`,(e,t)=>{t.pattern??=AO,wk.init(e,t)}),Fk=$(`$ZodKSUID`,(e,t)=>{t.pattern??=jO,wk.init(e,t)}),Ik=$(`$ZodISODateTime`,(e,t)=>{t.pattern??=XO(t),wk.init(e,t)}),Lk=$(`$ZodISODate`,(e,t)=>{t.pattern??=qO,wk.init(e,t)}),Rk=$(`$ZodISOTime`,(e,t)=>{t.pattern??=YO(t),wk.init(e,t)}),zk=$(`$ZodISODuration`,(e,t)=>{t.pattern??=NO,wk.init(e,t)}),Bk=$(`$ZodIPv4`,(e,t)=>{t.pattern??=zO,wk.init(e,t),e._zod.bag.format=`ipv4`}),Vk=$(`$ZodIPv6`,(e,t)=>{t.pattern??=BO,wk.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Hk=$(`$ZodCIDRv4`,(e,t)=>{t.pattern??=VO,wk.init(e,t)}),Uk=$(`$ZodCIDRv6`,(e,t)=>{t.pattern??=HO,wk.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Wk(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Gk=$(`$ZodBase64`,(e,t)=>{t.pattern??=UO,wk.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Wk(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Kk(e){if(!WO.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Wk(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var qk=$(`$ZodBase64URL`,(e,t)=>{t.pattern??=WO,wk.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Kk(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Jk=$(`$ZodE164`,(e,t)=>{t.pattern??=GO,wk.init(e,t)});function Yk(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Xk=$(`$ZodJWT`,(e,t)=>{wk.init(e,t),e._zod.check=n=>{Yk(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Zk=$(`$ZodNumber`,(e,t)=>{Sk.init(e,t),e._zod.pattern=e._zod.bag.pattern??$O,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Qk=$(`$ZodNumberFormat`,(e,t)=>{ck.init(e,t),Zk.init(e,t)}),$k=$(`$ZodBoolean`,(e,t)=>{Sk.init(e,t),e._zod.pattern=ek,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),eA=$(`$ZodUnknown`,(e,t)=>{Sk.init(e,t),e._zod.parse=e=>e}),tA=$(`$ZodNever`,(e,t)=>{Sk.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function nA(e,t,n){e.issues.length&&t.issues.push(...rO(n,e.issues)),t.value[n]=e.value}var rA=$(`$ZodArray`,(e,t)=>{Sk.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>nA(t,n,e))):nA(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function iA(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...rO(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function aA(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=qD(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function oA(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>iA(e,n,i,t,u))):iA(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var sA=$(`$ZodObject`,(e,t)=>{if(Sk.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=OD(()=>aA(t));ND(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=zD,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>iA(n,t,e,s,r))):iA(i,t,e,s,r)}return i?oA(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),cA=$(`$ZodObjectJIT`,(e,t)=>{sA.init(e,t);let n=e._zod.parse,r=OD(()=>aA(t)),i=e=>{let t=new bk([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=ID(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=ID(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
|
78
78
|
if (${n}.issues.length) {
|
|
79
79
|
if (${o} in input) {
|
|
80
80
|
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
@@ -108,8 +108,8 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
|
|
|
108
108
|
newResult[${o}] = ${n}.value;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=BD,s=!TD.jitless,c=s&&VD.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?sA([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function uA(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!rO(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>oO(e,r,ED())))}),t)}var dA=$(`$ZodUnion`,(e,t)=>{Ck.init(e,t),PD(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),PD(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),PD(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),PD(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>jD(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>uA(t,i,e,a)):uA(s,i,e,a)}}),fA=$(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,dA.init(e,t);let n=e._zod.parse;PD(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=kD(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!BD(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),pA=$(`$ZodIntersection`,(e,t)=>{Ck.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>hA(e,t,n)):hA(e,i,a)}});function mA(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(HD(e)&&HD(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=mA(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=mA(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function hA(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),rO(e))return e;let o=mA(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var gA=$(`$ZodEnum`,(e,t)=>{Ck.init(e,t);let n=DD(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>WD.has(typeof e)).map(e=>typeof e==`string`?GD(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),_A=$(`$ZodLiteral`,(e,t)=>{if(Ck.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?GD(e):e?GD(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),vA=$(`$ZodTransform`,(e,t)=>{Ck.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new wD(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new CD;return n.value=i,n}});function yA(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var bA=$(`$ZodOptional`,(e,t)=>{Ck.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,PD(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),PD(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${jD(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>yA(t,e.value)):yA(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),xA=$(`$ZodExactOptional`,(e,t)=>{bA.init(e,t),PD(e._zod,`values`,()=>t.innerType._zod.values),PD(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),SA=$(`$ZodNullable`,(e,t)=>{Ck.init(e,t),PD(e._zod,`optin`,()=>t.innerType._zod.optin),PD(e._zod,`optout`,()=>t.innerType._zod.optout),PD(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${jD(e.source)}|null)$`):void 0}),PD(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),CA=$(`$ZodDefault`,(e,t)=>{Ck.init(e,t),e._zod.optin=`optional`,PD(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>wA(e,t)):wA(r,t)}});function wA(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var TA=$(`$ZodPrefault`,(e,t)=>{Ck.init(e,t),e._zod.optin=`optional`,PD(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),EA=$(`$ZodNonOptional`,(e,t)=>{Ck.init(e,t),PD(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>DA(t,e)):DA(i,e)}});function DA(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var OA=$(`$ZodCatch`,(e,t)=>{Ck.init(e,t),PD(e._zod,`optin`,()=>t.innerType._zod.optin),PD(e._zod,`optout`,()=>t.innerType._zod.optout),PD(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>oO(e,n,ED()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>oO(e,n,ED()))},input:e.value}),e.issues=[]),e)}}),kA=$(`$ZodPipe`,(e,t)=>{Ck.init(e,t),PD(e._zod,`values`,()=>t.in._zod.values),PD(e._zod,`optin`,()=>t.in._zod.optin),PD(e._zod,`optout`,()=>t.out._zod.optout),PD(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>AA(e,t.in,n)):AA(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>AA(e,t.out,n)):AA(r,t.out,n)}});function AA(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var jA=$(`$ZodReadonly`,(e,t)=>{Ck.init(e,t),PD(e._zod,`propValues`,()=>t.innerType._zod.propValues),PD(e._zod,`values`,()=>t.innerType._zod.values),PD(e._zod,`optin`,()=>t.innerType?._zod?.optin),PD(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(MA):MA(r)}});function MA(e){return e.value=Object.freeze(e.value),e}var NA=$(`$ZodCustom`,(e,t)=>{ik.init(e,t),Ck.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>PA(t,n,r,e));PA(i,n,r,e)}});function PA(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(cO(e))}}var FA,IA=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function LA(){return new IA}(FA=globalThis).__zod_globalRegistry??(FA.__zod_globalRegistry=LA());var RA=globalThis.__zod_globalRegistry;function zA(e,t){return new e({type:`string`,...qD(t)})}function BA(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...qD(t)})}function VA(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...qD(t)})}function HA(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...qD(t)})}function UA(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...qD(t)})}function WA(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...qD(t)})}function GA(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...qD(t)})}function KA(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...qD(t)})}function qA(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...qD(t)})}function JA(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...qD(t)})}function YA(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...qD(t)})}function XA(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...qD(t)})}function ZA(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...qD(t)})}function QA(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...qD(t)})}function $A(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...qD(t)})}function ej(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...qD(t)})}function tj(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...qD(t)})}function nj(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...qD(t)})}function rj(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...qD(t)})}function ij(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...qD(t)})}function aj(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...qD(t)})}function oj(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...qD(t)})}function sj(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...qD(t)})}function cj(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...qD(t)})}function lj(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...qD(t)})}function uj(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...qD(t)})}function dj(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...qD(t)})}function fj(e,t){return new e({type:`number`,checks:[],...qD(t)})}function pj(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...qD(t)})}function mj(e,t){return new e({type:`boolean`,...qD(t)})}function hj(e){return new e({type:`unknown`})}function gj(e,t){return new e({type:`never`,...qD(t)})}function _j(e,t){return new ok({check:`less_than`,...qD(t),value:e,inclusive:!1})}function vj(e,t){return new ok({check:`less_than`,...qD(t),value:e,inclusive:!0})}function yj(e,t){return new sk({check:`greater_than`,...qD(t),value:e,inclusive:!1})}function bj(e,t){return new sk({check:`greater_than`,...qD(t),value:e,inclusive:!0})}function xj(e,t){return new ck({check:`multiple_of`,...qD(t),value:e})}function Sj(e,t){return new uk({check:`max_length`,...qD(t),maximum:e})}function Cj(e,t){return new dk({check:`min_length`,...qD(t),minimum:e})}function wj(e,t){return new fk({check:`length_equals`,...qD(t),length:e})}function Tj(e,t){return new mk({check:`string_format`,format:`regex`,...qD(t),pattern:e})}function Ej(e){return new hk({check:`string_format`,format:`lowercase`,...qD(e)})}function Dj(e){return new gk({check:`string_format`,format:`uppercase`,...qD(e)})}function Oj(e,t){return new _k({check:`string_format`,format:`includes`,...qD(t),includes:e})}function kj(e,t){return new vk({check:`string_format`,format:`starts_with`,...qD(t),prefix:e})}function Aj(e,t){return new yk({check:`string_format`,format:`ends_with`,...qD(t),suffix:e})}function jj(e){return new bk({check:`overwrite`,tx:e})}function Mj(e){return jj(t=>t.normalize(e))}function Nj(){return jj(e=>e.trim())}function Pj(){return jj(e=>e.toLowerCase())}function Fj(){return jj(e=>e.toUpperCase())}function Ij(){return jj(e=>RD(e))}function Lj(e,t,n){return new e({type:`array`,element:t,...qD(n)})}function Rj(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...qD(n)})}function zj(e){let t=Bj(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(cO(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(cO(r))}},e(n.value,n)));return t}function Bj(e,t){let n=new ik({check:`custom`,...qD(t)});return n._zod.check=e,n}function Vj(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??RA,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Hj(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Hj(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Gj(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Uj(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
111
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=zD,s=!wD.jitless,c=s&&BD.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?oA([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function lA(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!nO(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>aO(e,r,TD())))}),t)}var uA=$(`$ZodUnion`,(e,t)=>{Sk.init(e,t),ND(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),ND(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),ND(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),ND(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>AD(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>lA(t,i,e,a)):lA(s,i,e,a)}}),dA=$(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,uA.init(e,t);let n=e._zod.parse;ND(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=OD(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!zD(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),fA=$(`$ZodIntersection`,(e,t)=>{Sk.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>mA(e,t,n)):mA(e,i,a)}});function pA(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(VD(e)&&VD(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=pA(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=pA(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function mA(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),nO(e))return e;let o=pA(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var hA=$(`$ZodEnum`,(e,t)=>{Sk.init(e,t);let n=ED(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>UD.has(typeof e)).map(e=>typeof e==`string`?WD(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),gA=$(`$ZodLiteral`,(e,t)=>{if(Sk.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?WD(e):e?WD(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),_A=$(`$ZodTransform`,(e,t)=>{Sk.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new CD(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new SD;return n.value=i,n}});function vA(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var yA=$(`$ZodOptional`,(e,t)=>{Sk.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,ND(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ND(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${AD(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>vA(t,e.value)):vA(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),bA=$(`$ZodExactOptional`,(e,t)=>{yA.init(e,t),ND(e._zod,`values`,()=>t.innerType._zod.values),ND(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),xA=$(`$ZodNullable`,(e,t)=>{Sk.init(e,t),ND(e._zod,`optin`,()=>t.innerType._zod.optin),ND(e._zod,`optout`,()=>t.innerType._zod.optout),ND(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${AD(e.source)}|null)$`):void 0}),ND(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),SA=$(`$ZodDefault`,(e,t)=>{Sk.init(e,t),e._zod.optin=`optional`,ND(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>CA(e,t)):CA(r,t)}});function CA(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var wA=$(`$ZodPrefault`,(e,t)=>{Sk.init(e,t),e._zod.optin=`optional`,ND(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),TA=$(`$ZodNonOptional`,(e,t)=>{Sk.init(e,t),ND(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>EA(t,e)):EA(i,e)}});function EA(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var DA=$(`$ZodCatch`,(e,t)=>{Sk.init(e,t),ND(e._zod,`optin`,()=>t.innerType._zod.optin),ND(e._zod,`optout`,()=>t.innerType._zod.optout),ND(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>aO(e,n,TD()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>aO(e,n,TD()))},input:e.value}),e.issues=[]),e)}}),OA=$(`$ZodPipe`,(e,t)=>{Sk.init(e,t),ND(e._zod,`values`,()=>t.in._zod.values),ND(e._zod,`optin`,()=>t.in._zod.optin),ND(e._zod,`optout`,()=>t.out._zod.optout),ND(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>kA(e,t.in,n)):kA(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>kA(e,t.out,n)):kA(r,t.out,n)}});function kA(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var AA=$(`$ZodReadonly`,(e,t)=>{Sk.init(e,t),ND(e._zod,`propValues`,()=>t.innerType._zod.propValues),ND(e._zod,`values`,()=>t.innerType._zod.values),ND(e._zod,`optin`,()=>t.innerType?._zod?.optin),ND(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(jA):jA(r)}});function jA(e){return e.value=Object.freeze(e.value),e}var MA=$(`$ZodCustom`,(e,t)=>{rk.init(e,t),Sk.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>NA(t,n,r,e));NA(i,n,r,e)}});function NA(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(sO(e))}}var PA,FA=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function IA(){return new FA}(PA=globalThis).__zod_globalRegistry??(PA.__zod_globalRegistry=IA());var LA=globalThis.__zod_globalRegistry;function RA(e,t){return new e({type:`string`,...KD(t)})}function zA(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...KD(t)})}function BA(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...KD(t)})}function VA(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...KD(t)})}function HA(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...KD(t)})}function UA(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...KD(t)})}function WA(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...KD(t)})}function GA(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...KD(t)})}function KA(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...KD(t)})}function qA(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...KD(t)})}function JA(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...KD(t)})}function YA(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...KD(t)})}function XA(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...KD(t)})}function ZA(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...KD(t)})}function QA(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...KD(t)})}function $A(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...KD(t)})}function ej(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...KD(t)})}function tj(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...KD(t)})}function nj(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...KD(t)})}function rj(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...KD(t)})}function ij(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...KD(t)})}function aj(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...KD(t)})}function oj(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...KD(t)})}function sj(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...KD(t)})}function cj(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...KD(t)})}function lj(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...KD(t)})}function uj(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...KD(t)})}function dj(e,t){return new e({type:`number`,checks:[],...KD(t)})}function fj(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...KD(t)})}function pj(e,t){return new e({type:`boolean`,...KD(t)})}function mj(e){return new e({type:`unknown`})}function hj(e,t){return new e({type:`never`,...KD(t)})}function gj(e,t){return new ak({check:`less_than`,...KD(t),value:e,inclusive:!1})}function _j(e,t){return new ak({check:`less_than`,...KD(t),value:e,inclusive:!0})}function vj(e,t){return new ok({check:`greater_than`,...KD(t),value:e,inclusive:!1})}function yj(e,t){return new ok({check:`greater_than`,...KD(t),value:e,inclusive:!0})}function bj(e,t){return new sk({check:`multiple_of`,...KD(t),value:e})}function xj(e,t){return new lk({check:`max_length`,...KD(t),maximum:e})}function Sj(e,t){return new uk({check:`min_length`,...KD(t),minimum:e})}function Cj(e,t){return new dk({check:`length_equals`,...KD(t),length:e})}function wj(e,t){return new pk({check:`string_format`,format:`regex`,...KD(t),pattern:e})}function Tj(e){return new mk({check:`string_format`,format:`lowercase`,...KD(e)})}function Ej(e){return new hk({check:`string_format`,format:`uppercase`,...KD(e)})}function Dj(e,t){return new gk({check:`string_format`,format:`includes`,...KD(t),includes:e})}function Oj(e,t){return new _k({check:`string_format`,format:`starts_with`,...KD(t),prefix:e})}function kj(e,t){return new vk({check:`string_format`,format:`ends_with`,...KD(t),suffix:e})}function Aj(e){return new yk({check:`overwrite`,tx:e})}function jj(e){return Aj(t=>t.normalize(e))}function Mj(){return Aj(e=>e.trim())}function Nj(){return Aj(e=>e.toLowerCase())}function Pj(){return Aj(e=>e.toUpperCase())}function Fj(){return Aj(e=>LD(e))}function Ij(e,t,n){return new e({type:`array`,element:t,...KD(n)})}function Lj(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...KD(n)})}function Rj(e){let t=zj(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(sO(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(sO(r))}},e(n.value,n)));return t}function zj(e,t){let n=new rk({check:`custom`,...KD(t)});return n._zod.check=e,n}function Bj(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??LA,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Vj(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Vj(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Wj(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Hj(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
112
112
|
|
|
113
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Wj(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:qj(t,`input`,e.processors),output:qj(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Gj(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Gj(r.element,n);if(r.type===`set`)return Gj(r.valueType,n);if(r.type===`lazy`)return Gj(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Gj(r.innerType,n);if(r.type===`intersection`)return Gj(r.left,n)||Gj(r.right,n);if(r.type===`record`||r.type===`map`)return Gj(r.keyType,n)||Gj(r.valueType,n);if(r.type===`pipe`)return Gj(r.in,n)||Gj(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Gj(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Gj(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Gj(e,n))return!0;return!!(r.rest&&Gj(r.rest,n))}return!1}var Kj=(e,t={})=>n=>{let r=Vj({...n,processors:t});return Hj(e,r),Uj(r,e),Wj(r,e)},qj=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Vj({...i??{},target:a,io:t,processors:n});return Hj(e,o),Uj(o,e),Wj(o,e)},Jj={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Yj=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Jj[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Xj=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},Zj=(e,t,n,r)=>{n.type=`boolean`},Qj=(e,t,n,r)=>{n.not={}},$j=(e,t,n,r)=>{let i=e._zod.def,a=DD(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},eM=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},tM=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},nM=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},rM=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Hj(a.element,t,{...r,path:[...r.path,`items`]})},iM=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Hj(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Hj(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},aM=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Hj(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},oM=(e,t,n,r)=>{let i=e._zod.def,a=Hj(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Hj(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},sM=(e,t,n,r)=>{let i=e._zod.def,a=Hj(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},cM=(e,t,n,r)=>{let i=e._zod.def;Hj(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},lM=(e,t,n,r)=>{let i=e._zod.def;Hj(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},uM=(e,t,n,r)=>{let i=e._zod.def;Hj(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},dM=(e,t,n,r)=>{let i=e._zod.def;Hj(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},fM=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Hj(a,t,r);let o=t.seen.get(e);o.ref=a},pM=(e,t,n,r)=>{let i=e._zod.def;Hj(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},mM=(e,t,n,r)=>{let i=e._zod.def;Hj(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},hM=$(`ZodISODateTime`,(e,t)=>{Lk.init(e,t),VM.init(e,t)});function gM(e){return cj(hM,e)}var _M=$(`ZodISODate`,(e,t)=>{Rk.init(e,t),VM.init(e,t)});function vM(e){return lj(_M,e)}var yM=$(`ZodISOTime`,(e,t)=>{zk.init(e,t),VM.init(e,t)});function bM(e){return uj(yM,e)}var xM=$(`ZodISODuration`,(e,t)=>{Bk.init(e,t),VM.init(e,t)});function SM(e){return dj(xM,e)}var CM=(e,t)=>{uO.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>pO(e,t)},flatten:{value:t=>fO(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,OD,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,OD,2)}},isEmpty:{get(){return e.issues.length===0}}})};$(`ZodError`,CM);var wM=$(`ZodError`,CM,{Parent:Error}),TM=mO(wM),EM=hO(wM),DM=gO(wM),OM=vO(wM),kM=bO(wM),AM=xO(wM),jM=SO(wM),MM=CO(wM),NM=wO(wM),PM=TO(wM),FM=EO(wM),IM=DO(wM),LM=$(`ZodType`,(e,t)=>(Ck.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:qj(e,`input`),output:qj(e,`output`)}}),e.toJSONSchema=Kj(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(ID(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>KD(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>TM(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>DM(e,t,n),e.parseAsync=async(t,n)=>EM(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>OM(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>kM(e,t,n),e.decode=(t,n)=>AM(e,t,n),e.encodeAsync=async(t,n)=>jM(e,t,n),e.decodeAsync=async(t,n)=>MM(e,t,n),e.safeEncode=(t,n)=>NM(e,t,n),e.safeDecode=(t,n)=>PM(e,t,n),e.safeEncodeAsync=async(t,n)=>FM(e,t,n),e.safeDecodeAsync=async(t,n)=>IM(e,t,n),e.refine=(t,n)=>e.check(QN(t,n)),e.superRefine=t=>e.check($N(t)),e.overwrite=t=>e.check(jj(t)),e.optional=()=>PN(e),e.exactOptional=()=>IN(e),e.nullable=()=>RN(e),e.nullish=()=>PN(RN(e)),e.nonoptional=t=>WN(e,t),e.array=()=>vN(e),e.or=t=>SN([e,t]),e.and=t=>EN(e,t),e.transform=t=>JN(e,MN(t)),e.default=t=>BN(e,t),e.prefault=t=>HN(e,t),e.catch=t=>KN(e,t),e.pipe=t=>JN(e,t),e.readonly=()=>XN(e),e.describe=t=>{let n=e.clone();return RA.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return RA.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return RA.get(e);let n=e.clone();return RA.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),RM=$(`_ZodString`,(e,t)=>{wk.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yj(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Tj(...t)),e.includes=(...t)=>e.check(Oj(...t)),e.startsWith=(...t)=>e.check(kj(...t)),e.endsWith=(...t)=>e.check(Aj(...t)),e.min=(...t)=>e.check(Cj(...t)),e.max=(...t)=>e.check(Sj(...t)),e.length=(...t)=>e.check(wj(...t)),e.nonempty=(...t)=>e.check(Cj(1,...t)),e.lowercase=t=>e.check(Ej(t)),e.uppercase=t=>e.check(Dj(t)),e.trim=()=>e.check(Nj()),e.normalize=(...t)=>e.check(Mj(...t)),e.toLowerCase=()=>e.check(Pj()),e.toUpperCase=()=>e.check(Fj()),e.slugify=()=>e.check(Ij())}),zM=$(`ZodString`,(e,t)=>{wk.init(e,t),RM.init(e,t),e.email=t=>e.check(BA(HM,t)),e.url=t=>e.check(KA(GM,t)),e.jwt=t=>e.check(sj(oN,t)),e.emoji=t=>e.check(qA(KM,t)),e.guid=t=>e.check(VA(UM,t)),e.uuid=t=>e.check(HA(WM,t)),e.uuidv4=t=>e.check(UA(WM,t)),e.uuidv6=t=>e.check(WA(WM,t)),e.uuidv7=t=>e.check(GA(WM,t)),e.nanoid=t=>e.check(JA(qM,t)),e.guid=t=>e.check(VA(UM,t)),e.cuid=t=>e.check(YA(JM,t)),e.cuid2=t=>e.check(XA(YM,t)),e.ulid=t=>e.check(ZA(XM,t)),e.base64=t=>e.check(ij(rN,t)),e.base64url=t=>e.check(aj(iN,t)),e.xid=t=>e.check(QA(ZM,t)),e.ksuid=t=>e.check($A(QM,t)),e.ipv4=t=>e.check(ej($M,t)),e.ipv6=t=>e.check(tj(eN,t)),e.cidrv4=t=>e.check(nj(tN,t)),e.cidrv6=t=>e.check(rj(nN,t)),e.e164=t=>e.check(oj(aN,t)),e.datetime=t=>e.check(gM(t)),e.date=t=>e.check(vM(t)),e.time=t=>e.check(bM(t)),e.duration=t=>e.check(SM(t))});function BM(e){return zA(zM,e)}var VM=$(`ZodStringFormat`,(e,t)=>{Tk.init(e,t),RM.init(e,t)}),HM=$(`ZodEmail`,(e,t)=>{Ok.init(e,t),VM.init(e,t)}),UM=$(`ZodGUID`,(e,t)=>{Ek.init(e,t),VM.init(e,t)}),WM=$(`ZodUUID`,(e,t)=>{Dk.init(e,t),VM.init(e,t)}),GM=$(`ZodURL`,(e,t)=>{kk.init(e,t),VM.init(e,t)}),KM=$(`ZodEmoji`,(e,t)=>{Ak.init(e,t),VM.init(e,t)}),qM=$(`ZodNanoID`,(e,t)=>{jk.init(e,t),VM.init(e,t)}),JM=$(`ZodCUID`,(e,t)=>{Mk.init(e,t),VM.init(e,t)}),YM=$(`ZodCUID2`,(e,t)=>{Nk.init(e,t),VM.init(e,t)}),XM=$(`ZodULID`,(e,t)=>{Pk.init(e,t),VM.init(e,t)}),ZM=$(`ZodXID`,(e,t)=>{Fk.init(e,t),VM.init(e,t)}),QM=$(`ZodKSUID`,(e,t)=>{Ik.init(e,t),VM.init(e,t)}),$M=$(`ZodIPv4`,(e,t)=>{Vk.init(e,t),VM.init(e,t)}),eN=$(`ZodIPv6`,(e,t)=>{Hk.init(e,t),VM.init(e,t)}),tN=$(`ZodCIDRv4`,(e,t)=>{Uk.init(e,t),VM.init(e,t)}),nN=$(`ZodCIDRv6`,(e,t)=>{Wk.init(e,t),VM.init(e,t)}),rN=$(`ZodBase64`,(e,t)=>{Kk.init(e,t),VM.init(e,t)}),iN=$(`ZodBase64URL`,(e,t)=>{Jk.init(e,t),VM.init(e,t)}),aN=$(`ZodE164`,(e,t)=>{Yk.init(e,t),VM.init(e,t)}),oN=$(`ZodJWT`,(e,t)=>{Zk.init(e,t),VM.init(e,t)}),sN=$(`ZodNumber`,(e,t)=>{Qk.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xj(e,t,n,r),e.gt=(t,n)=>e.check(yj(t,n)),e.gte=(t,n)=>e.check(bj(t,n)),e.min=(t,n)=>e.check(bj(t,n)),e.lt=(t,n)=>e.check(_j(t,n)),e.lte=(t,n)=>e.check(vj(t,n)),e.max=(t,n)=>e.check(vj(t,n)),e.int=t=>e.check(uN(t)),e.safe=t=>e.check(uN(t)),e.positive=t=>e.check(yj(0,t)),e.nonnegative=t=>e.check(bj(0,t)),e.negative=t=>e.check(_j(0,t)),e.nonpositive=t=>e.check(vj(0,t)),e.multipleOf=(t,n)=>e.check(xj(t,n)),e.step=(t,n)=>e.check(xj(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function cN(e){return fj(sN,e)}var lN=$(`ZodNumberFormat`,(e,t)=>{$k.init(e,t),sN.init(e,t)});function uN(e){return pj(lN,e)}var dN=$(`ZodBoolean`,(e,t)=>{eA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zj(e,t,n,r)});function fN(e){return mj(dN,e)}var pN=$(`ZodUnknown`,(e,t)=>{tA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function mN(){return hj(pN)}var hN=$(`ZodNever`,(e,t)=>{nA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qj(e,t,n,r)});function gN(e){return gj(hN,e)}var _N=$(`ZodArray`,(e,t)=>{iA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rM(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Cj(t,n)),e.nonempty=t=>e.check(Cj(1,t)),e.max=(t,n)=>e.check(Sj(t,n)),e.length=(t,n)=>e.check(wj(t,n)),e.unwrap=()=>e.element});function vN(e,t){return Lj(_N,e,t)}var yN=$(`ZodObject`,(e,t)=>{lA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>iM(e,t,n,r),PD(e,`shape`,()=>t.shape),e.keyof=()=>ON(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:mN()}),e.loose=()=>e.clone({...e._zod.def,catchall:mN()}),e.strict=()=>e.clone({...e._zod.def,catchall:gN()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>QD(e,t),e.safeExtend=t=>$D(e,t),e.merge=t=>eO(e,t),e.pick=t=>XD(e,t),e.omit=t=>ZD(e,t),e.partial=(...t)=>tO(NN,e,t[0]),e.required=(...t)=>nO(UN,e,t[0])});function bN(e,t){return new yN({type:`object`,shape:e??{},...qD(t)})}var xN=$(`ZodUnion`,(e,t)=>{dA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aM(e,t,n,r),e.options=t.options});function SN(e,t){return new xN({type:`union`,options:e,...qD(t)})}var CN=$(`ZodDiscriminatedUnion`,(e,t)=>{xN.init(e,t),fA.init(e,t)});function wN(e,t,n){return new CN({type:`union`,options:t,discriminator:e,...qD(n)})}var TN=$(`ZodIntersection`,(e,t)=>{pA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oM(e,t,n,r)});function EN(e,t){return new TN({type:`intersection`,left:e,right:t})}var DN=$(`ZodEnum`,(e,t)=>{gA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$j(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new DN({...t,checks:[],...qD(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new DN({...t,checks:[],...qD(r),entries:i})}});function ON(e,t){return new DN({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...qD(t)})}var kN=$(`ZodLiteral`,(e,t)=>{_A.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eM(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function AN(e,t){return new kN({type:`literal`,values:Array.isArray(e)?e:[e],...qD(t)})}var jN=$(`ZodTransform`,(e,t)=>{vA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nM(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new wD(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(cO(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(cO(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function MN(e){return new jN({type:`transform`,transform:e})}var NN=$(`ZodOptional`,(e,t)=>{bA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function PN(e){return new NN({type:`optional`,innerType:e})}var FN=$(`ZodExactOptional`,(e,t)=>{xA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function IN(e){return new FN({type:`optional`,innerType:e})}var LN=$(`ZodNullable`,(e,t)=>{SA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function RN(e){return new LN({type:`nullable`,innerType:e})}var zN=$(`ZodDefault`,(e,t)=>{CA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function BN(e,t){return new zN({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():UD(t)}})}var VN=$(`ZodPrefault`,(e,t)=>{TA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function HN(e,t){return new VN({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():UD(t)}})}var UN=$(`ZodNonOptional`,(e,t)=>{EA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function WN(e,t){return new UN({type:`nonoptional`,innerType:e,...qD(t)})}var GN=$(`ZodCatch`,(e,t)=>{OA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function KN(e,t){return new GN({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var qN=$(`ZodPipe`,(e,t)=>{kA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fM(e,t,n,r),e.in=t.in,e.out=t.out});function JN(e,t){return new qN({type:`pipe`,in:e,out:t})}var YN=$(`ZodReadonly`,(e,t)=>{jA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function XN(e){return new YN({type:`readonly`,innerType:e})}var ZN=$(`ZodCustom`,(e,t)=>{NA.init(e,t),LM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tM(e,t,n,r)});function QN(e,t={}){return Rj(ZN,e,t)}function $N(e){return zj(e)}bN({ok:fN(),sessions:cN().int().nonnegative()}).strict(),wN(`type`,[bN({type:AN(`input`),data:BM().max(_D)}).strict(),bN({type:AN(`resize`),cols:cN().int().positive().max(xD),rows:cN().int().positive().max(SD),pixelWidth:cN().int().nonnegative().optional(),pixelHeight:cN().int().nonnegative().optional()}).strict()]);var eP=wN(`type`,[bN({type:AN(`output`),data:BM().max(vD)}).strict(),bN({type:AN(`exit`),code:cN().int().nullable()}).strict(),bN({type:AN(`title`),title:BM().max(yD)}).strict(),bN({type:AN(`session`),shell:BM().min(1),shellName:BM().min(1),pid:cN().int().nonnegative(),cwd:BM().min(1),title:BM().max(yD)}).strict(),bN({type:AN(`cwd`),cwd:BM().min(1)}).strict(),bN({type:AN(`foreground`),process:BM().max(256).nullable()}).strict(),bN({type:AN(`notification`),body:BM().min(1).max(bD)}).strict()]),tP=2.4,nP=.04045,rP=12.92,iP=.055,aP=1.055,oP=.0031308,sP=24389/27,cP=216/24389,lP=.95047,uP=1,dP=1.08883,fP=.008856,pP=7.787,mP=e=>{let t=e/255;return t<=nP?t/rP:((t+iP)/aP)**+tP},hP=e=>e<=0?0:e>=1?255:Math.round(e<=oP?rP*e*255:(aP*e**(1/tP)-iP)*255),gP=e=>e>fP?Math.cbrt(e):pP*e+16/116,_P=e=>{let t=mP(e.r),n=mP(e.g),r=mP(e.b);return{x:.4124564*t+.3575761*n+.1804375*r,y:.2126729*t+.7151522*n+.072175*r,z:.0193339*t+.119192*n+.9503041*r}},vP=e=>{let t=3.2404542*e.x-1.5371385*e.y-.4985314*e.z,n=-.969266*e.x+1.8760108*e.y+.041556*e.z,r=.0556434*e.x-.2040259*e.y+1.0572252*e.z;return{r:hP(t),g:hP(n),b:hP(r)}},yP=e=>{let t=e.x/lP,n=e.y/uP,r=e.z/dP,i=gP(t),a=gP(n),o=gP(r);return{l:116*a-16,a:500*(i-a),b:200*(a-o)}},bP=(e,t)=>{let n=e*e*e;return n>cP?t*n:t*((116*e-16)/sP)},xP=e=>{let t=(e.l+16)/116,n=e.a/500+t,r=t-e.b/200;return{x:bP(n,lP),y:bP(t,uP),z:bP(r,dP)}},SP=e=>yP(_P(e)),CP=e=>vP(xP(e)),wP=e=>{let t=e.replace(/^#/,``);return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}},TP=e=>{let t=Math.max(0,Math.min(255,Math.round(e.r))),n=Math.max(0,Math.min(255,Math.round(e.g))),r=Math.max(0,Math.min(255,Math.round(e.b)));return`#${t.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`},EP=e=>SP(wP(e)),DP=e=>TP(CP(e)),OP=6,kP=5,AP=24,jP=25,MP=(e,t,n)=>({l:t.l+e*(n.l-t.l),a:t.a+e*(n.a-t.a),b:t.b+e*(n.b-t.b)}),NP=(e,t=!1)=>{let n=e.background??`#000000`,r=e.foreground??`#ffffff`,i=[EP(n),EP(e.red??`#ff0000`),EP(e.green??`#00ff00`),EP(e.yellow??`#ffff00`),EP(e.blue??`#0000ff`),EP(e.magenta??`#ff00ff`),EP(e.cyan??`#00ffff`),EP(r)];if(i[7].l<i[0].l&&!t){let e=i[0];i[0]=i[7],i[7]=e}let a=[];for(let e=0;e<OP;e++){let t=MP(e/kP,i[0],i[1]),n=MP(e/kP,i[2],i[3]),r=MP(e/kP,i[4],i[5]),o=MP(e/kP,i[6],i[7]);for(let e=0;e<OP;e++){let i=MP(e/kP,t,n),s=MP(e/kP,r,o);for(let e=0;e<OP;e++){let t=MP(e/kP,i,s);a.push(DP(t))}}}for(let e=0;e<AP;e++){let t=(e+1)/jP;a.push(DP(MP(t,i[0],i[7])))}return a},PP=`Symbols Nerd Font`,FP=``,IP=async e=>{if(!(typeof document>`u`)&&e.name)try{await document.fonts.ready;let t=[document.fonts.load(`16px "${e.name}"`),document.fonts.load(`bold 16px "${e.name}"`),document.fonts.load(`16px "${PP}"`,FP),document.fonts.load(`bold 16px "${PP}"`,FP)];await Promise.all(t)}catch{}},LP=(e,t)=>`\x1b[${e};${t+1}u`,RP=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},zP=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),BP=(e,t)=>{let n=e.buffer.active,r=Math.max(0,n.baseY-n.viewportY),i=r===0;try{t.fit()}catch{return!1}try{if(i)return e.scrollToBottom(),!0;let t=e.buffer.active;if(r>t.baseY)return e.scrollToBottom(),!0;let n=t.baseY-r-t.viewportY;n!==0&&e.scrollLines(n)}catch{}return!0},VP=(e,t)=>`\r\n\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,HP={block:{blink:`\x1B[1 q`,steady:`\x1B[2 q`},underline:{blink:`\x1B[3 q`,steady:`\x1B[4 q`},bar:{blink:`\x1B[5 q`,steady:`\x1B[6 q`}},UP=(e,t)=>{let n=t?`blink`:`steady`;return`\x1b[?25h${HP[e][n]}`},WP=(e,t)=>`${UP(e,t)}\r\n\x1b[2;32m[reconnected]\x1b[0m\r\n\r\n`,GP=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,KP=55296,qP=56319,JP=(e,t)=>{if(e.length<=t)return[e];let n=[],r=0;for(;r<e.length;){let i=Math.min(r+t,e.length);if(i<e.length){let t=e.charCodeAt(i-1);t>=KP&&t<=qP&&--i}i===r&&(i=r+t),n.push(e.slice(r,i)),r=i}return n},YP=(e,t)=>{if(t.wasAtBottom){e.scrollToBottom();return}let n=e.buffer.active,r=Math.max(0,n.baseY-t.distanceFromBottom)-n.viewportY;r!==0&&e.scrollLines(r)},XP=new class{terminal=null;chunks=[];scheduled=!1;attach(e){this.terminal=e}detach(){this.flush(),this.terminal=null}push(e){this.chunks.push(e),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush()))}flush(){this.scheduled=!1;let e=this.chunks,t=this.terminal;if(this.chunks=[],!(!t||e.length===0)){if(e.length===1){t.write(e[0]);return}t.write(e.join(``))}}},ZP=e=>e[0]===3,QP=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},$P=1/kS,eF=e=>Math.round(e*$P)/$P,tF=e=>{if(!Number.isFinite(e))return OS;let t=eF(e);return t<1?1:t>2?2:t},nF=1/1,rF=e=>Math.round(e*nF)/nF,iF=e=>{if(!Number.isFinite(e))return 0;let t=rF(e);return t<0?0:t>48?48:t},aF=e=>{if(!Number.isFinite(e))return 0;let t=rF(e);return t<0?0:t>48?48:t},oF=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},sF=(e,t)=>e.key!==`k`&&e.key!==`K`?!1:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,cF=(e,t)=>e.key!==`f`&&e.key!==`F`?!1:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,lF=(e,t)=>e.code===`Backslash`?e.altKey&&!e.metaKey&&!e.ctrlKey?!0:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey:!1,uF=()=>{if(typeof window>`u`)return!0;try{let e=window.localStorage.getItem(WS);return e===`true`?!0:e!==`false`}catch{return!0}},dF=()=>{if(typeof window>`u`)return jE;try{let e=window.localStorage.getItem(US);return NE(e)?e:jE}catch{return jE}},fF=()=>{if(typeof window>`u`)return XE;try{return ZE(window.localStorage.getItem(BS)).id}catch{return XE}},pF=()=>{if(typeof window>`u`)return 13;try{let e=window.localStorage.getItem(VS);return e===null||e===``?13:QP(Number(e))}catch{return 13}},mF=()=>{if(typeof window>`u`)return OS;try{let e=window.localStorage.getItem(HS);return e===null||e===``?OS:tF(Number(e))}catch{return OS}},hF=()=>{if(typeof window>`u`)return eD;try{let e=window.localStorage.getItem(GS);if(e===null||e===``)return eD;let t=Number(e);return nD(t)?t:eD}catch{return eD}},gF=()=>{if(typeof window>`u`)return!0;try{let e=window.localStorage.getItem(KS);return e===`true`?!0:e!==`false`}catch{return!0}},_F=()=>{if(typeof window>`u`)return aD;try{return oD(window.localStorage.getItem(zS)).id}catch{return aD}},vF=()=>{if(typeof window>`u`)return 0;try{let e=window.localStorage.getItem(qS);return e===null||e===``?0:iF(Number(e))}catch{return 0}},yF=()=>{if(typeof window>`u`)return 0;try{let e=window.localStorage.getItem(JS);return e===null||e===``?0:aF(Number(e))}catch{return 0}},bF=()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(XS)===`true`}catch{return!1}},xF=`<path d='m6 8 4 4-4 4M12 16h6'/>`,SF=[`<circle cx='7' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='12' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='17' cy='12' r='1.5' fill='currentColor' stroke='none'/>`].join(``),CF={ready:`hsl(220 8% 46%)`,running:`hsl(142 72% 45%)`,"alive-quiet":`hsl(210 65% 50%)`,dead:`hsl(0 72% 50%)`},wF={ready:`hsl(220 10% 16%)`,running:`hsl(142 85% 12%)`,"alive-quiet":`hsl(210 70% 14%)`,dead:`hsl(0 80% 12%)`},TF={ready:xF,running:SF,"alive-quiet":xF,dead:xF},EF=`<circle cx='19' cy='7' r='3.5' fill='hsl(0 72% 50%)' stroke='white' stroke-width='1.5'/>`,DF=(e,t=!1)=>{let n=CF[e],r=wF[e],i=TF[e],a=t?EF:``;return[`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' color='${r}' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='${e===`dead`?FS:1}'>`,`<rect x='2' y='4' width='20' height='16' rx='2' fill='${n}'/>`,i,a,`</svg>`].join(``)},OF=`ready`,kF=null,AF=!1,jF=(e,t)=>kF===null||e!==OF||t!==AF,MF=(e,t)=>{OF=e,kF=e,AF=t},NF=()=>{OF=`ready`,kF=null,AF=!1},PF=(e,t=!1)=>{if(typeof document>`u`||!jF(e,t))return;MF(e,t);let n=`data:image/svg+xml,${encodeURIComponent(DF(e,t))}`,r=document.querySelector(`link[rel="icon"]`);r||(r=document.createElement(`link`),r.rel=`icon`,document.head.appendChild(r)),r.type=`image/svg+xml`,r.href=n},FF=`/api/health`,IF=async()=>{try{return(await fetch(FF)).ok}catch{return!1}},LF=(e,t)=>t.buffer.active.type===`alternate`?e.deltaMode===WheelEvent.DOM_DELTA_PIXEL:!1,RF=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(WS,String(e))}catch{}},zF=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(US,e)}catch{}},BF=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(BS,e)}catch{}},VF=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(VS,String(e))}catch{}},HF=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(HS,String(e))}catch{}},UF=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(GS,String(e))}catch{}},WF=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(KS,String(e))}catch{}},GF=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(zS,e)}catch{}},KF=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(qS,String(e))}catch{}},qF=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(JS,String(e))}catch{}},JF=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(XS,String(e))}catch{}},YF=e=>e||`localterm`,XF=e=>`${jS}${e||`localterm`}`,ZF={matchBackground:IS,activeMatchBackground:LS,activeMatchBorder:RS,matchOverviewRuler:LS,activeMatchColorOverviewRuler:RS},QF=`cwd`,$F=e=>{let t=new URL(`/ws`,window.location.href);t.protocol=t.protocol===`https:`?`wss:`:`ws:`;let n=e??new URLSearchParams(window.location.search).get(QF);return n&&t.searchParams.set(QF,n),t.toString()},eI=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(QF,e),t.toString()},tI=({onModalOpenChange:e,onForegroundProcessChange:t}={})=>{let n=(0,b.useRef)(null),r=(0,b.useRef)(null),i=(0,b.useRef)(!1),a=(0,b.useRef)(null),o=(0,b.useRef)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(null),d=(0,b.useRef)(null),f=(0,b.useRef)(_F()),p=(0,b.useRef)(fF()),m=(0,b.useRef)(pF()),h=(0,b.useRef)(mF()),g=(0,b.useRef)(dF()),_=(0,b.useRef)(uF()),v=(0,b.useRef)(hF()),x=(0,b.useRef)(gF()),C=(0,b.useRef)(vF()),w=(0,b.useRef)(yF()),T=(0,b.useRef)(bF()),E=(0,b.useRef)(null),O=(0,b.useRef)(null),k=(0,b.useRef)(null),A=(0,b.useRef)(null),[j,M]=(0,b.useState)(null),[N,P]=(0,b.useState)(0),[F,I]=(0,b.useState)(!1),[L,ee]=(0,b.useState)(!1),[R,te]=(0,b.useState)(!1),[z,B]=(0,b.useState)(!1),V=(0,b.useRef)(null),[H,ne]=(0,b.useState)(0),[U,re]=(0,b.useState)(!1),[ie,ae]=(0,b.useState)(!1),oe=(0,b.useRef)(null),se=(0,b.useRef)(!1),ce=U||ie;se.current=ie;let[le,ue]=(0,b.useState)(``),[de,fe]=(0,b.useState)({resultIndex:-1,resultCount:0}),[pe,me]=(0,b.useState)(f.current),[he,ge]=(0,b.useState)(null),_e=he??pe,ve=(0,b.useMemo)(()=>oD(_e),[_e]),ye=(0,b.useMemo)(()=>({...ve.colors,extendedAnsi:NP(ve.colors)}),[ve]),[be,xe]=(0,b.useState)(p.current),[Se,Ce]=(0,b.useState)(null),we=Se??be,[Te,Ee]=(0,b.useState)(T.current),De=(0,b.useMemo)(()=>ZE(we),[we]),[Oe,ke]=(0,b.useState)(m.current),[Ae,je]=(0,b.useState)(h.current),[Me,Ne]=(0,b.useState)(g.current),[Pe,Fe]=(0,b.useState)(null),Ie=Pe??Me,[Le,Re]=(0,b.useState)(_.current),[ze,Be]=(0,b.useState)(v.current),[Ve,He]=(0,b.useState)(x.current),[Ue,We]=(0,b.useState)(C.current),[Ge,Ke]=(0,b.useState)(w.current),[Je,Xe]=(0,b.useState)(null),[Ze,Qe]=(0,b.useState)(`Notification`in window?Notification.permission:`unsupported`),[$e,et]=(0,b.useState)(null),tt=(0,b.useRef)(null),nt=(0,b.useMemo)(oF,[]);(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let c=!1,l=!1,u=!1,y=``,b=null,C=null,w=null,T=null,j=null,N=`ready`,F=!1,I=!1,L=[0],ee=()=>L[L.length-1]??0,R=()=>{j!==null&&(window.clearTimeout(j),j=null),N!==`running`&&T===null&&(T=window.setTimeout(()=>{T=null,!(c||l)&&(N=`running`,F=!1,PF(`running`))},250)),j=window.setTimeout(()=>{j=null,T!==null&&(window.clearTimeout(T),T=null),N===`running`&&(document.hidden&&(F=!0),I?(N=`alive-quiet`,PF(`alive-quiet`,F)):(N=`ready`,PF(`ready`,F)))},750)},te=()=>{T!==null&&(window.clearTimeout(T),T=null),j!==null&&(window.clearTimeout(j),j=null),(N!==`ready`||F)&&(N=`ready`,F=!1,PF(`ready`))},z=ZE(p.current);IP(z).then(()=>{if(c)return;let e=r.current;e&&e.clearTextureAtlas(),B._core._charSizeService.measure(),De()});let B=new $u({allowProposedApi:!0,cursorBlink:_.current,cursorStyle:g.current,fontFamily:z.family,fontSize:m.current,lineHeight:h.current,scrollback:v.current,theme:{...oD(f.current).colors,extendedAnsi:NP(oD(f.current).colors)},macOptionIsMeta:!0,scrollOnUserInput:x.current,windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0},scrollbar:{showScrollbar:!1}});r.current=B,XP.attach(B);let H=new D;E.current=H,B.loadAddon(H),B.loadAddon(new Nn),B.loadAddon(new S),B.loadAddon(new qe),B.loadAddon(new Ye);let ne=new Dn;B.loadAddon(ne),B.unicode.activeVersion=`15`;let U=new ut;B.loadAddon(U),o.current=U;let re=U.onDidChangeResults(fe);B.open(e),H.proposeDimensions&&=()=>{if(!B||!B.element||!B.element.parentElement)return;let e=B,t=e._core._renderService.dimensions.css.cell.width,n=e._core._renderService.dimensions.css.cell.height;if(t===0||n===0)return;let r=window.getComputedStyle(B.element.parentElement),i=window.getComputedStyle(B.element),a=Math.max(0,parseInt(r.getPropertyValue(`width`)))-(parseInt(i.getPropertyValue(`padding-right`))+parseInt(i.getPropertyValue(`padding-left`))),o=parseInt(r.getPropertyValue(`height`))-(parseInt(i.getPropertyValue(`padding-top`))+parseInt(i.getPropertyValue(`padding-bottom`)));return{cols:Math.max(2,Math.floor(a/t)),rows:Math.max(1,Math.floor(o/n))}};let ie=()=>{let e=B.buffer.active,t=e.length,n=B.rows,r=e.viewportY+n>=t,i=t>n,a=k.current,o=A.current;if(!(!a||!o)&&(a.classList.toggle(`xterm-scrollbar-visible`,!r&&i),i)){let r=n/t,i=e.viewportY/t;o.style.height=`${r*100}%`,o.style.top=`${i*100}%`}};ie();let ae=B.onScroll(ie),oe=!1,se=0,ce=0,le=e=>{if(e.button===0){oe=!0,se=e.clientY,ce=B.buffer.active.viewportY;try{e.target.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}},ue=e=>{if(!oe)return;let t=k.current;if(!t)return;let n=t.clientHeight,r=B.buffer.active.length-B.rows;if(r<=0||n<=0)return;let i=n/r,a=e.clientY-se,o=Math.max(0,Math.min(r,ce+Math.round(a/i)));o!==B.buffer.active.viewportY&&B.scrollLines(o-B.buffer.active.viewportY)},de=()=>{oe=!1},pe=e=>{if(e.button!==0||e.target===A.current)return;let t=k.current;if(!t)return;let n=t.getBoundingClientRect(),r=(e.clientY-n.top)/n.height,i=B.buffer.active,a=i.length,o=Math.max(0,Math.min(a-B.rows,Math.round(r*a)-Math.floor(B.rows/2)));B.scrollLines(o-i.viewportY)},me=A.current,he=k.current;me&&(me.addEventListener(`pointerdown`,le),me.addEventListener(`pointermove`,ue),me.addEventListener(`pointerup`,de),me.addEventListener(`pointercancel`,de)),he&&he.addEventListener(`pointerdown`,pe);try{let e=new ia;e.onContextLoss(()=>e.dispose()),B.loadAddon(e)}catch{}let ge=B.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let t=e[0],n=typeof t==`number`?t:1;return L.push(n),!0}),_e=B.parser.registerCsiHandler({prefix:`<`,final:`u`},e=>{let t=e[0],n=typeof t==`number`&&t>0?t:1;for(let e=0;e<n&&L.length>1;e+=1)L.pop();return!0}),ve=B.parser.registerCsiHandler({prefix:`=`,final:`u`},e=>{let t=e[0],n=e[1];if(typeof t!=`number`)return!0;let r=t,i=typeof n==`number`&&n>0?n:1,a=L.length-1,o=L[a]??0;return i===1?L[a]=r:i===2?L[a]=o|r:i===3&&(L[a]=o&~r),!0}),ye=B.parser.registerCsiHandler({final:`J`},ZP),be=B.parser.registerCsiHandler({prefix:`?`,final:`J`},ZP),xe=e=>{b?.readyState===WebSocket.OPEN&&b.send(JSON.stringify(e))},Se=()=>{let e=d.current;e&&cancelAnimationFrame(e.frameId),d.current=null},Ce=()=>{let e=d.current;e&&YP(B,e.anchor)},we=e=>{Se(),d.current={anchor:e,frameId:requestAnimationFrame(()=>{Ce(),d.current=null})}};B.attachCustomWheelEventHandler(e=>LF(e,B)?(e.preventDefault(),!1):!0),B.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(lF(e,nt)){if(e.type===`keydown`){e.preventDefault();let t=document.getElementById(`new-shell-link`);t instanceof HTMLAnchorElement&&t.click()}return!1}if(sF(e,nt))return e.type===`keydown`&&(e.preventDefault(),V.current?.()),!1;if(cF(e,nt))return e.type===`keydown`&&(e.preventDefault(),O.current?.()),!1;if(e.type===`keydown`&&e.key===`Enter`){let t=zP(e),n=(ee()&1)!=0;if(t!==0&&n)return e.preventDefault(),xe({type:`input`,data:LP(13,t)}),!1;if(t===1)return e.preventDefault(),xe({type:`input`,data:`
|
|
114
|
-
`}),!1}return!0});let Te=e=>{if(l)return;let t=e.trim();t&&(y=t,document.title=YF(t))};s.current=()=>B.focus();let Ee=(e,t)=>{let n=B,r=n._core._renderService?.dimensions?.css?.canvas?.width,i=n._core._renderService?.dimensions?.css?.canvas?.height;xe({type:`resize`,cols:e,rows:t,...r!=null&&i!=null?{pixelWidth:Math.round(r),pixelHeight:Math.round(i)}:{}})},De=()=>{let e=RP(B);BP(B,H)&&(we(e),Ee(B.cols,B.rows))},Oe=()=>{w!==null&&window.clearTimeout(w),w=window.setTimeout(()=>{w=null,De()},80)};B.onData(e=>{for(let t of JP(e,_D))xe({type:`input`,data:t})}),B.onResize(({cols:e,rows:t})=>Ee(e,t));let ke=new ResizeObserver(Oe),Ae=()=>{!document.hidden&&F&&(F=!1,PF(N))};document.addEventListener(`visibilitychange`,Ae),ke.observe(e),De(),requestAnimationFrame(()=>B.focus());let je=e=>{if(!l){if(l=!0,e===null||e===0){window.close(),setTimeout(()=>{c||(te(),PF(`dead`),B.write(GP(e)),document.title=XF(y),M({reason:`shell-exited`,exitCode:e}),Xe(null))},100);return}te(),PF(`dead`),B.write(GP(e)),document.title=XF(y),M({reason:`shell-exited`,exitCode:e}),Xe(null)}},Me=(e,t,n)=>{l||(l=!0,te(),PF(`dead`),B.write(VP(e,t)),document.title=XF(y),M({reason:`connection-lost`,closeCode:e,closeReason:t,wasClean:n}),Xe(null))},Ne=()=>{if(c)return;let e=new WebSocket($F(tt.current));b=e,e.addEventListener(`open`,()=>{c||b!==e||(u=!0,P(0),Ee(B.cols,B.rows))}),e.addEventListener(`message`,n=>{if(c||b!==e)return;let r;try{r=JSON.parse(typeof n.data==`string`?n.data:String(n.data))}catch{return}if(typeof r==`object`&&r&&r.type===`output`&&typeof r.data==`string`){let e=r.data;XP.push(e),R();return}let i=eP.safeParse(r);if(!i.success)return;let a=i.data;if(a.type===`title`)Te(a.title);else if(a.type===`session`)Xe({shell:a.shell,shellName:a.shellName,pid:a.pid,cwd:a.cwd,title:a.title}),et(a.cwd),Te(a.title);else if(a.type===`cwd`)et(a.cwd);else if(a.type===`foreground`){let e=a.process!==null;t?.(e),!e&&N===`alive-quiet`&&(N=`ready`,PF(`ready`,F)),I=e}else a.type===`notification`?`Notification`in window&&Notification.permission===`granted`&&new Notification(a.body):a.type===`exit`&&(te(),je(a.code))}),e.addEventListener(`close`,t=>{if(b===e&&(b=null,!c&&!l)){if(u){console.warn(`[localterm] websocket closed: code=${t.code} reason=${JSON.stringify(t.reason)} wasClean=${t.wasClean}`),Me(t.code,t.reason,t.wasClean);return}P(e=>e+1),C=window.setTimeout(Ne,DS)}}),e.addEventListener(`error`,t=>{console.warn(`[localterm] websocket error`,t);try{e.close()}catch{}})};return a.current=()=>{if(!c){l=!1,u=!1,M(null),Xe(null),P(0),PF(`ready`),t?.(!1),C!==null&&(window.clearTimeout(C),C=null);try{b?.close()}catch{}b=null,Ne()}},Ne(),i.current=!0,()=>{c=!0,a.current=null,s.current=null,o.current=null,r.current=null,i.current=!1,E.current=null,k.current=null,A.current=null,me&&(me.removeEventListener(`pointerdown`,le),me.removeEventListener(`pointermove`,ue),me.removeEventListener(`pointerup`,de),me.removeEventListener(`pointercancel`,de)),he&&he.removeEventListener(`pointerdown`,pe),re.dispose(),ae.dispose(),ge.dispose(),_e.dispose(),ve.dispose(),ye.dispose(),be.dispose(),C!==null&&window.clearTimeout(C),w!==null&&window.clearTimeout(w),Se(),te(),document.removeEventListener(`visibilitychange`,Ae),ke.disconnect();try{b?.close()}catch{}b=null,XP.detach(),B.dispose(),document.title=AS}},[]),(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.theme=ye)},[ye]),(0,b.useEffect)(()=>{if(!i.current||!r.current)return;let e=!1;return IP(De).then(()=>{if(e)return;let t=r.current;if(!t)return;t.options.fontFamily=De.family,t.clearTextureAtlas();let n=E.current;n&&BP(t,n)}),()=>{e=!0}},[De,Te]);let rt=(0,b.useCallback)(e=>{me(e),ge(null),GF(e)},[]),it=(0,b.useCallback)(e=>{xe(e),Ce(null),BF(e)},[]),at=(0,b.useCallback)(e=>{Ee(e),JF(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.fontSize=Oe;let t=E.current;t&&BP(e,t)},[Oe]);let ot=(0,b.useCallback)(e=>{let t=QP(e);ke(t),VF(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.lineHeight=Ae;let t=E.current;t&&BP(e,t)},[Ae]);let st=(0,b.useCallback)(e=>{let t=tF(e);je(t),HF(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorStyle=Ie)},[Ie]);let ct=(0,b.useCallback)(e=>{Ne(e),Fe(null),zF(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorBlink=Le)},[Le]);let lt=(0,b.useCallback)(e=>{Re(e),RF(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollback=ze)},[ze]);let dt=(0,b.useCallback)(e=>{Be(e),UF(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollOnUserInput=Ve)},[Ve]);let ft=(0,b.useCallback)(e=>{He(e),WF(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;let t=E.current;t&&BP(e,t)},[Ue,Ge]);let pt=(0,b.useCallback)(e=>{let t=iF(e);We(t),KF(t)},[]),mt=(0,b.useCallback)(e=>{let t=aF(e);Ke(t),qF(t)},[]),ht=(0,b.useCallback)(()=>{`Notification`in window&&Notification.requestPermission().then(e=>{Qe(e)})},[]);(0,b.useEffect)(()=>{if(!R)return;let e=c.current;e&&(e.focus(),e.select())},[R,H]);let gt=(0,b.useCallback)(e=>{if(!e){o.current?.clearDecorations(),fe({resultIndex:-1,resultCount:0});return}o.current?.findNext(e,{decorations:ZF})},[]),_t=(0,b.useCallback)(e=>{e&&o.current?.findPrevious(e,{decorations:ZF})},[]),vt=(0,b.useCallback)(()=>{te(!1),ue(``),fe({resultIndex:-1,resultCount:0}),o.current?.clearDecorations(),s.current?.()},[]),yt=(0,b.useCallback)(()=>{oe.current!==null&&(window.clearTimeout(oe.current),oe.current=null),re(!0)},[]),bt=(0,b.useCallback)(()=>{oe.current=window.setTimeout(()=>{oe.current=null,se.current||re(!1)},200)},[]),xt=(0,b.useCallback)(e=>{ae(e),e||(oe.current!==null&&window.clearTimeout(oe.current),oe.current=window.setTimeout(()=>{oe.current=null,re(!1)},200))},[]);V.current=(0,b.useCallback)(()=>{B(e=>!e)},[]);let St=(0,b.useCallback)(()=>{B(!1),s.current?.()},[]),Ct=(0,b.useCallback)(()=>{te(!0),B(!1),ne(e=>e+1)},[]);O.current=Ct;let wt=(0,b.useCallback)(e=>{let t=e.target.value;ue(t),gt(t)},[gt]),Tt=(0,b.useCallback)(e=>{if(cF(e.nativeEvent,nt)){e.preventDefault(),e.currentTarget.select();return}if(e.key===`Escape`){e.preventDefault(),vt();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?_t(le):gt(le))},[vt,gt,_t,nt,le]),Et=(0,b.useCallback)(()=>{ee(!0),a.current?.(),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{l.current=null,ee(!1)},800)},[]),Dt=(0,b.useCallback)(()=>{navigator.clipboard.writeText(MS).then(()=>{I(!0),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,I(!1)},NS)}).catch(()=>{})},[]);(0,b.useEffect)(()=>()=>{oe.current!==null&&(window.clearTimeout(oe.current),oe.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),u.current!==null&&(window.clearTimeout(u.current),u.current=null)},[]),(0,b.useEffect)(()=>{if(tt.current=$e,!$e)return;let e=new URL(window.location.href);e.searchParams.set(QF,$e),window.history.replaceState(null,``,e)},[$e]);let Ot=eI($e),kt=j!==null,At=!kt&&N>=2,jt=kt||At,Mt=j!==null&&j.reason!==`shell-exited`||At;(0,b.useEffect)(()=>{if(!Mt)return;let e=Date.now(),t=!1,n=null,i=i=>{if(t)return;if(i){let e=r.current;e&&(e.write(WP(Ie,Le)),e.refresh(0,e.rows-1),e.focus()),a.current?.();return}let s=Date.now()-e<5e3?250:PS;n=window.setTimeout(o,s)},o=()=>{IF().then(i)};return o(),()=>{t=!0,n!==null&&window.clearTimeout(n)}},[Mt]),(0,b.useEffect)(()=>{e?.(jt),jt&&B(!1)},[jt,e]);let Nt=de.resultCount===0?`0/0`:`${de.resultIndex+1}/${de.resultCount}`,Pt=ve.colors.background??`#101010`,Ft=(0,b.useMemo)(()=>{let e=nt?`⌘`:`Ctrl+`,t=iD.map(e=>({id:`theme:${e.id}`,label:`Theme: ${e.name}`,category:`Theme`,action:()=>rt(e.id)})),n=YE.map(e=>({id:`font:${e.id}`,label:`Font: ${e.name}`,category:`Font`,action:()=>it(e.id)}));return[...t,...n,{id:`find`,label:`Find in terminal`,category:`Search`,shortcut:`${e}F`,icon:(0,y.jsx)(vd,{className:`size-3.5`}),action:Ct},{id:`new-shell`,label:`Open new shell`,category:`Tab`,shortcut:`Alt+T`,icon:(0,y.jsx)(_d,{className:`size-3.5`}),action:()=>{let e=document.getElementById(`new-shell-link`);e instanceof HTMLAnchorElement&&e.click()}},...AE.map(e=>({id:`cursor:${e.id}`,label:`Cursor: ${e.name}`,category:`Cursor`,action:()=>ct(e.id)})),{id:`cursor-blink`,label:`Cursor blink: ${Le?`On`:`Off`}`,category:`Cursor`,action:()=>lt(!Le)},{id:`font-size-up`,label:`Increase font size`,category:`Font`,shortcut:`${e}+`,icon:(0,y.jsx)(gd,{className:`size-3.5`}),action:()=>ot(Oe+1)},{id:`font-size-down`,label:`Decrease font size`,category:`Font`,shortcut:`${e}-`,icon:(0,y.jsx)(gd,{className:`size-3.5`}),action:()=>ot(Oe-1)},{id:`scroll-on-input`,label:`Pin to bottom on input: ${Ve?`On`:`Off`}`,category:`Scrollback`,action:()=>ft(!Ve)}]},[nt,rt,it,Ct,ct,Le,lt,Oe,ot,Ve,ft]);return(0,y.jsxs)(`div`,{className:`h-dvh w-dvw`,style:{background:Pt},children:[(0,y.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,y.jsx)(`div`,{ref:n,"aria-label":`terminal session`,className:`absolute`,style:{top:Ge,right:Ue,bottom:Ge,left:Ue}}),(0,y.jsx)(`div`,{ref:k,className:`xterm-scrollbar-track`,style:{top:Ge,right:Ue,bottom:Ge},children:(0,y.jsx)(`div`,{ref:A,className:`xterm-scrollbar-thumb`})}),j===null?null:(0,y.jsx)(Qx,{variant:`destructive`,role:`status`,"aria-live":`polite`,className:`absolute top-2 left-3 z-10`,children:j.reason===`shell-exited`?j.exitCode===null?`exited`:`exited · code ${j.exitCode}`:`disconnected · code ${j.closeCode}`}),(0,y.jsxs)(`div`,{className:qf(`absolute right-0 top-0 z-10 flex flex-col items-end pr-3 pt-1`,ce?`pointer-events-auto`:`pointer-events-none`),onMouseEnter:yt,onMouseLeave:bt,children:[(0,y.jsx)(`div`,{"aria-hidden":`true`,className:qf(`pointer-events-auto mr-0.5 h-[2px] w-5 rounded-full bg-muted-foreground/25 transition-opacity duration-150`,ce||R?`opacity-0`:`opacity-100`)}),!R&&(0,y.jsxs)(`div`,{role:`toolbar`,"aria-label":`terminal actions`,className:qf(`mt-1 flex items-center gap-0.5 rounded-md border border-border/60 bg-background/70 p-0.5 text-muted-foreground shadow-xs backdrop-blur-md`,`transition-[opacity,transform] duration-200 ease-snappy`,ce?`translate-y-0 opacity-100`:`pointer-events-none -translate-y-1 opacity-0`),onMouseDown:e=>e.preventDefault(),onKeyDown:()=>s.current?.(),children:[(0,y.jsx)(gD,{themeId:pe,onThemeChange:rt,onThemePreview:ge,fontId:be,onFontChange:it,onFontPreview:Ce,nerdFontEnabled:Te,onNerdFontEnabledChange:at,fontSize:Oe,onFontSizeChange:ot,lineHeight:Ae,onLineHeightChange:st,cursorStyle:Me,onCursorStyleChange:ct,onCursorStylePreview:Fe,cursorBlink:Le,onCursorBlinkChange:lt,scrollback:ze,onScrollbackChange:dt,scrollOnUserInput:Ve,onScrollOnUserInputChange:ft,paddingX:Ue,onPaddingXChange:pt,paddingY:Ge,onPaddingYChange:mt,notificationsPermission:Ze,onNotificationsPermissionRequest:ht,sessionInfo:Je,onPopoverOpenChange:xt,onClose:s.current??void 0}),(0,y.jsx)(Bx,{variant:`ghost`,size:`icon-sm`,onClick:Ct,"aria-label":`find in terminal`,className:`hover:text-foreground`,children:(0,y.jsx)(vd,{})}),(0,y.jsx)(Bx,{variant:`ghost`,size:`icon-sm`,nativeButton:!1,"aria-label":`open a new shell in a new browser tab`,render:(0,y.jsx)(`a`,{id:`new-shell-link`,href:Ot,target:`_blank`,rel:`noopener noreferrer`}),className:`hover:text-foreground`,children:(0,y.jsx)(_d,{})})]}),R&&(0,y.jsxs)(yS,{role:`search`,"aria-label":`find in terminal`,className:`mt-1 w-80 border-border/60 bg-background/70 text-muted-foreground shadow-xs backdrop-blur-md dark:bg-background/70`,children:[(0,y.jsx)(TS,{ref:c,type:`search`,value:le,onChange:wt,onKeyDown:Tt,placeholder:`Find`,"aria-label":`find query`,className:`text-xs`}),(0,y.jsxs)(xS,{align:`inline-end`,children:[(0,y.jsx)(wS,{role:`status`,"aria-label":`match count`,className:`text-xs tabular-nums`,children:Nt}),(0,y.jsx)(CS,{size:`icon-xs`,onClick:()=>_t(le),disabled:de.resultCount===0,"aria-label":`previous match`,children:(0,y.jsx)(fd,{})}),(0,y.jsx)(CS,{size:`icon-xs`,onClick:()=>gt(le),disabled:de.resultCount===0,"aria-label":`next match`,children:(0,y.jsx)(dd,{})})]})]})]})]}),(0,y.jsx)(tC,{open:z,onClose:St,commands:Ft}),(0,y.jsx)(Vx,{open:jt,children:(0,y.jsx)(Wx,{children:j===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Gx,{children:[(0,y.jsxs)(qx,{className:`flex items-center gap-2`,children:[(0,y.jsx)(ES,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Lost connection`]}),(0,y.jsx)(Jx,{children:`The localterm server isn't responding. Start it again from your terminal, then retry.`})]}),(0,y.jsxs)(yS,{children:[(0,y.jsx)(TS,{readOnly:!0,value:MS,"aria-label":`restart command`,className:`font-mono`}),(0,y.jsx)(xS,{align:`inline-end`,children:(0,y.jsx)(CS,{size:`icon-xs`,onClick:Dt,"aria-label":F?`Copied`:`Copy restart command`,children:F?(0,y.jsx)(ud,{}):(0,y.jsx)(pd,{})})})]}),(0,y.jsx)(Kx,{children:(0,y.jsxs)(Yx,{onClick:Et,disabled:L,children:[L?(0,y.jsx)(ES,{"data-icon":`inline-start`}):null,`Retry`]})})]}):j.reason===`shell-exited`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Gx,{children:[(0,y.jsx)(qx,{children:`Shell ended`}),(0,y.jsx)(Jx,{children:j.exitCode===null||j.exitCode===0?`Open a new shell to keep going, or close this tab.`:`Exit code ${j.exitCode}. Open a new shell to keep going.`})]}),(0,y.jsx)(Kx,{children:(0,y.jsx)(Yx,{onClick:()=>window.open(Ot,`_blank`,`noopener,noreferrer`),children:`New shell`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Gx,{children:[(0,y.jsxs)(qx,{className:`flex items-center gap-2`,children:[(0,y.jsx)(ES,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Connection lost`]}),(0,y.jsxs)(Jx,{children:[`The browser lost its connection to the localterm daemon (close code`,` `,j.closeCode,j.closeReason?` · ${j.closeReason}`:``,`). Reconnecting spawns a fresh shell. The previous one can't be reattached.`]})]}),(0,y.jsx)(Kx,{children:(0,y.jsxs)(Yx,{onClick:Et,disabled:L,children:[L?(0,y.jsx)(ES,{"data-icon":`inline-start`}):null,`Reconnect`]})})]})})})]})},nI=()=>{let e=(0,b.useRef)(!1),t=(0,b.useRef)(!1);return(0,b.useEffect)(()=>{let n=n=>{e.current||t.current&&n.preventDefault()},r=()=>window.addEventListener(`beforeunload`,n);return window.addEventListener(`keydown`,r,{once:!0}),()=>{window.removeEventListener(`keydown`,r),window.removeEventListener(`beforeunload`,n)}},[]),(0,y.jsx)(tI,{onModalOpenChange:(0,b.useCallback)(t=>{e.current=t},[]),onForegroundProcessChange:(0,b.useCallback)(e=>{t.current=e},[])})};NF(),PF(`ready`),(()=>{if(typeof document>`u`||document.getElementById(`localterm-google-fonts`))return;let e=QE();if(!e)return;let t=document.createElement(`link`);t.id=YS,t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)})();var rI=document.getElementById(`root`);if(!rI)throw Error(`Root element not found`);(0,x.createRoot)(rI).render((0,y.jsx)(b.StrictMode,{children:(0,y.jsx)(EE,{delay:300,children:(0,y.jsx)(nI,{})})}));
|
|
115
|
-
//# sourceMappingURL=index-
|
|
113
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Uj(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Kj(t,`input`,e.processors),output:Kj(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Wj(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Wj(r.element,n);if(r.type===`set`)return Wj(r.valueType,n);if(r.type===`lazy`)return Wj(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Wj(r.innerType,n);if(r.type===`intersection`)return Wj(r.left,n)||Wj(r.right,n);if(r.type===`record`||r.type===`map`)return Wj(r.keyType,n)||Wj(r.valueType,n);if(r.type===`pipe`)return Wj(r.in,n)||Wj(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Wj(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Wj(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Wj(e,n))return!0;return!!(r.rest&&Wj(r.rest,n))}return!1}var Gj=(e,t={})=>n=>{let r=Bj({...n,processors:t});return Vj(e,r),Hj(r,e),Uj(r,e)},Kj=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Bj({...i??{},target:a,io:t,processors:n});return Vj(e,o),Hj(o,e),Uj(o,e)},qj={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Jj=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=qj[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Yj=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},Xj=(e,t,n,r)=>{n.type=`boolean`},Zj=(e,t,n,r)=>{n.not={}},Qj=(e,t,n,r)=>{let i=e._zod.def,a=ED(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},$j=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},eM=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},tM=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},nM=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Vj(a.element,t,{...r,path:[...r.path,`items`]})},rM=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Vj(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Vj(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},iM=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Vj(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},aM=(e,t,n,r)=>{let i=e._zod.def,a=Vj(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Vj(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},oM=(e,t,n,r)=>{let i=e._zod.def,a=Vj(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},sM=(e,t,n,r)=>{let i=e._zod.def;Vj(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},cM=(e,t,n,r)=>{let i=e._zod.def;Vj(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},lM=(e,t,n,r)=>{let i=e._zod.def;Vj(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},uM=(e,t,n,r)=>{let i=e._zod.def;Vj(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},dM=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Vj(a,t,r);let o=t.seen.get(e);o.ref=a},fM=(e,t,n,r)=>{let i=e._zod.def;Vj(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},pM=(e,t,n,r)=>{let i=e._zod.def;Vj(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},mM=$(`ZodISODateTime`,(e,t)=>{Ik.init(e,t),BM.init(e,t)});function hM(e){return sj(mM,e)}var gM=$(`ZodISODate`,(e,t)=>{Lk.init(e,t),BM.init(e,t)});function _M(e){return cj(gM,e)}var vM=$(`ZodISOTime`,(e,t)=>{Rk.init(e,t),BM.init(e,t)});function yM(e){return lj(vM,e)}var bM=$(`ZodISODuration`,(e,t)=>{zk.init(e,t),BM.init(e,t)});function xM(e){return uj(bM,e)}var SM=(e,t)=>{lO.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>fO(e,t)},flatten:{value:t=>dO(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,DD,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,DD,2)}},isEmpty:{get(){return e.issues.length===0}}})};$(`ZodError`,SM);var CM=$(`ZodError`,SM,{Parent:Error}),wM=pO(CM),TM=mO(CM),EM=hO(CM),DM=_O(CM),OM=yO(CM),kM=bO(CM),AM=xO(CM),jM=SO(CM),MM=CO(CM),NM=wO(CM),PM=TO(CM),FM=EO(CM),IM=$(`ZodType`,(e,t)=>(Sk.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Kj(e,`input`),output:Kj(e,`output`)}}),e.toJSONSchema=Gj(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(FD(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>GD(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>wM(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>EM(e,t,n),e.parseAsync=async(t,n)=>TM(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>DM(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>OM(e,t,n),e.decode=(t,n)=>kM(e,t,n),e.encodeAsync=async(t,n)=>AM(e,t,n),e.decodeAsync=async(t,n)=>jM(e,t,n),e.safeEncode=(t,n)=>MM(e,t,n),e.safeDecode=(t,n)=>NM(e,t,n),e.safeEncodeAsync=async(t,n)=>PM(e,t,n),e.safeDecodeAsync=async(t,n)=>FM(e,t,n),e.refine=(t,n)=>e.check(ZN(t,n)),e.superRefine=t=>e.check(QN(t)),e.overwrite=t=>e.check(Aj(t)),e.optional=()=>NN(e),e.exactOptional=()=>FN(e),e.nullable=()=>LN(e),e.nullish=()=>NN(LN(e)),e.nonoptional=t=>UN(e,t),e.array=()=>_N(e),e.or=t=>xN([e,t]),e.and=t=>TN(e,t),e.transform=t=>qN(e,jN(t)),e.default=t=>zN(e,t),e.prefault=t=>VN(e,t),e.catch=t=>GN(e,t),e.pipe=t=>qN(e,t),e.readonly=()=>YN(e),e.describe=t=>{let n=e.clone();return LA.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return LA.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return LA.get(e);let n=e.clone();return LA.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),LM=$(`_ZodString`,(e,t)=>{Ck.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jj(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(wj(...t)),e.includes=(...t)=>e.check(Dj(...t)),e.startsWith=(...t)=>e.check(Oj(...t)),e.endsWith=(...t)=>e.check(kj(...t)),e.min=(...t)=>e.check(Sj(...t)),e.max=(...t)=>e.check(xj(...t)),e.length=(...t)=>e.check(Cj(...t)),e.nonempty=(...t)=>e.check(Sj(1,...t)),e.lowercase=t=>e.check(Tj(t)),e.uppercase=t=>e.check(Ej(t)),e.trim=()=>e.check(Mj()),e.normalize=(...t)=>e.check(jj(...t)),e.toLowerCase=()=>e.check(Nj()),e.toUpperCase=()=>e.check(Pj()),e.slugify=()=>e.check(Fj())}),RM=$(`ZodString`,(e,t)=>{Ck.init(e,t),LM.init(e,t),e.email=t=>e.check(zA(VM,t)),e.url=t=>e.check(GA(WM,t)),e.jwt=t=>e.check(oj(aN,t)),e.emoji=t=>e.check(KA(GM,t)),e.guid=t=>e.check(BA(HM,t)),e.uuid=t=>e.check(VA(UM,t)),e.uuidv4=t=>e.check(HA(UM,t)),e.uuidv6=t=>e.check(UA(UM,t)),e.uuidv7=t=>e.check(WA(UM,t)),e.nanoid=t=>e.check(qA(KM,t)),e.guid=t=>e.check(BA(HM,t)),e.cuid=t=>e.check(JA(qM,t)),e.cuid2=t=>e.check(YA(JM,t)),e.ulid=t=>e.check(XA(YM,t)),e.base64=t=>e.check(rj(nN,t)),e.base64url=t=>e.check(ij(rN,t)),e.xid=t=>e.check(ZA(XM,t)),e.ksuid=t=>e.check(QA(ZM,t)),e.ipv4=t=>e.check($A(QM,t)),e.ipv6=t=>e.check(ej($M,t)),e.cidrv4=t=>e.check(tj(eN,t)),e.cidrv6=t=>e.check(nj(tN,t)),e.e164=t=>e.check(aj(iN,t)),e.datetime=t=>e.check(hM(t)),e.date=t=>e.check(_M(t)),e.time=t=>e.check(yM(t)),e.duration=t=>e.check(xM(t))});function zM(e){return RA(RM,e)}var BM=$(`ZodStringFormat`,(e,t)=>{wk.init(e,t),LM.init(e,t)}),VM=$(`ZodEmail`,(e,t)=>{Dk.init(e,t),BM.init(e,t)}),HM=$(`ZodGUID`,(e,t)=>{Tk.init(e,t),BM.init(e,t)}),UM=$(`ZodUUID`,(e,t)=>{Ek.init(e,t),BM.init(e,t)}),WM=$(`ZodURL`,(e,t)=>{Ok.init(e,t),BM.init(e,t)}),GM=$(`ZodEmoji`,(e,t)=>{kk.init(e,t),BM.init(e,t)}),KM=$(`ZodNanoID`,(e,t)=>{Ak.init(e,t),BM.init(e,t)}),qM=$(`ZodCUID`,(e,t)=>{jk.init(e,t),BM.init(e,t)}),JM=$(`ZodCUID2`,(e,t)=>{Mk.init(e,t),BM.init(e,t)}),YM=$(`ZodULID`,(e,t)=>{Nk.init(e,t),BM.init(e,t)}),XM=$(`ZodXID`,(e,t)=>{Pk.init(e,t),BM.init(e,t)}),ZM=$(`ZodKSUID`,(e,t)=>{Fk.init(e,t),BM.init(e,t)}),QM=$(`ZodIPv4`,(e,t)=>{Bk.init(e,t),BM.init(e,t)}),$M=$(`ZodIPv6`,(e,t)=>{Vk.init(e,t),BM.init(e,t)}),eN=$(`ZodCIDRv4`,(e,t)=>{Hk.init(e,t),BM.init(e,t)}),tN=$(`ZodCIDRv6`,(e,t)=>{Uk.init(e,t),BM.init(e,t)}),nN=$(`ZodBase64`,(e,t)=>{Gk.init(e,t),BM.init(e,t)}),rN=$(`ZodBase64URL`,(e,t)=>{qk.init(e,t),BM.init(e,t)}),iN=$(`ZodE164`,(e,t)=>{Jk.init(e,t),BM.init(e,t)}),aN=$(`ZodJWT`,(e,t)=>{Xk.init(e,t),BM.init(e,t)}),oN=$(`ZodNumber`,(e,t)=>{Zk.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yj(e,t,n,r),e.gt=(t,n)=>e.check(vj(t,n)),e.gte=(t,n)=>e.check(yj(t,n)),e.min=(t,n)=>e.check(yj(t,n)),e.lt=(t,n)=>e.check(gj(t,n)),e.lte=(t,n)=>e.check(_j(t,n)),e.max=(t,n)=>e.check(_j(t,n)),e.int=t=>e.check(lN(t)),e.safe=t=>e.check(lN(t)),e.positive=t=>e.check(vj(0,t)),e.nonnegative=t=>e.check(yj(0,t)),e.negative=t=>e.check(gj(0,t)),e.nonpositive=t=>e.check(_j(0,t)),e.multipleOf=(t,n)=>e.check(bj(t,n)),e.step=(t,n)=>e.check(bj(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function sN(e){return dj(oN,e)}var cN=$(`ZodNumberFormat`,(e,t)=>{Qk.init(e,t),oN.init(e,t)});function lN(e){return fj(cN,e)}var uN=$(`ZodBoolean`,(e,t)=>{$k.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xj(e,t,n,r)});function dN(e){return pj(uN,e)}var fN=$(`ZodUnknown`,(e,t)=>{eA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function pN(){return mj(fN)}var mN=$(`ZodNever`,(e,t)=>{tA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zj(e,t,n,r)});function hN(e){return hj(mN,e)}var gN=$(`ZodArray`,(e,t)=>{rA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nM(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Sj(t,n)),e.nonempty=t=>e.check(Sj(1,t)),e.max=(t,n)=>e.check(xj(t,n)),e.length=(t,n)=>e.check(Cj(t,n)),e.unwrap=()=>e.element});function _N(e,t){return Ij(gN,e,t)}var vN=$(`ZodObject`,(e,t)=>{cA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rM(e,t,n,r),ND(e,`shape`,()=>t.shape),e.keyof=()=>DN(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:pN()}),e.loose=()=>e.clone({...e._zod.def,catchall:pN()}),e.strict=()=>e.clone({...e._zod.def,catchall:hN()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>ZD(e,t),e.safeExtend=t=>QD(e,t),e.merge=t=>$D(e,t),e.pick=t=>YD(e,t),e.omit=t=>XD(e,t),e.partial=(...t)=>eO(MN,e,t[0]),e.required=(...t)=>tO(HN,e,t[0])});function yN(e,t){return new vN({type:`object`,shape:e??{},...KD(t)})}var bN=$(`ZodUnion`,(e,t)=>{uA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>iM(e,t,n,r),e.options=t.options});function xN(e,t){return new bN({type:`union`,options:e,...KD(t)})}var SN=$(`ZodDiscriminatedUnion`,(e,t)=>{bN.init(e,t),dA.init(e,t)});function CN(e,t,n){return new SN({type:`union`,options:t,discriminator:e,...KD(n)})}var wN=$(`ZodIntersection`,(e,t)=>{fA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aM(e,t,n,r)});function TN(e,t){return new wN({type:`intersection`,left:e,right:t})}var EN=$(`ZodEnum`,(e,t)=>{hA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qj(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new EN({...t,checks:[],...KD(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new EN({...t,checks:[],...KD(r),entries:i})}});function DN(e,t){return new EN({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...KD(t)})}var ON=$(`ZodLiteral`,(e,t)=>{gA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$j(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function kN(e,t){return new ON({type:`literal`,values:Array.isArray(e)?e:[e],...KD(t)})}var AN=$(`ZodTransform`,(e,t)=>{_A.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tM(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new CD(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(sO(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(sO(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function jN(e){return new AN({type:`transform`,transform:e})}var MN=$(`ZodOptional`,(e,t)=>{yA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function NN(e){return new MN({type:`optional`,innerType:e})}var PN=$(`ZodExactOptional`,(e,t)=>{bA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function FN(e){return new PN({type:`optional`,innerType:e})}var IN=$(`ZodNullable`,(e,t)=>{xA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function LN(e){return new IN({type:`nullable`,innerType:e})}var RN=$(`ZodDefault`,(e,t)=>{SA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zN(e,t){return new RN({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():HD(t)}})}var BN=$(`ZodPrefault`,(e,t)=>{wA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function VN(e,t){return new BN({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():HD(t)}})}var HN=$(`ZodNonOptional`,(e,t)=>{TA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function UN(e,t){return new HN({type:`nonoptional`,innerType:e,...KD(t)})}var WN=$(`ZodCatch`,(e,t)=>{DA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function GN(e,t){return new WN({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var KN=$(`ZodPipe`,(e,t)=>{OA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dM(e,t,n,r),e.in=t.in,e.out=t.out});function qN(e,t){return new KN({type:`pipe`,in:e,out:t})}var JN=$(`ZodReadonly`,(e,t)=>{AA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fM(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function YN(e){return new JN({type:`readonly`,innerType:e})}var XN=$(`ZodCustom`,(e,t)=>{MA.init(e,t),IM.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eM(e,t,n,r)});function ZN(e,t={}){return Lj(XN,e,t)}function QN(e){return Rj(e)}yN({ok:dN(),sessions:sN().int().nonnegative()}).strict(),CN(`type`,[yN({type:kN(`input`),data:zM().max(gD)}).strict(),yN({type:kN(`resize`),cols:sN().int().positive().max(bD),rows:sN().int().positive().max(xD),pixelWidth:sN().int().nonnegative().optional(),pixelHeight:sN().int().nonnegative().optional()}).strict()]);var $N=CN(`type`,[yN({type:kN(`output`),data:zM().max(_D)}).strict(),yN({type:kN(`exit`),code:sN().int().nullable()}).strict(),yN({type:kN(`title`),title:zM().max(vD)}).strict(),yN({type:kN(`session`),shell:zM().min(1),shellName:zM().min(1),pid:sN().int().nonnegative(),cwd:zM().min(1),title:zM().max(vD)}).strict(),yN({type:kN(`cwd`),cwd:zM().min(1)}).strict(),yN({type:kN(`foreground`),process:zM().max(256).nullable()}).strict(),yN({type:kN(`notification`),body:zM().min(1).max(yD)}).strict()]),eP=2.4,tP=.04045,nP=12.92,rP=.055,iP=1.055,aP=.0031308,oP=24389/27,sP=216/24389,cP=.95047,lP=1,uP=1.08883,dP=.008856,fP=7.787,pP=e=>{let t=e/255;return t<=tP?t/nP:((t+rP)/iP)**+eP},mP=e=>e<=0?0:e>=1?255:Math.round(e<=aP?nP*e*255:(iP*e**(1/eP)-rP)*255),hP=e=>e>dP?Math.cbrt(e):fP*e+16/116,gP=e=>{let t=pP(e.r),n=pP(e.g),r=pP(e.b);return{x:.4124564*t+.3575761*n+.1804375*r,y:.2126729*t+.7151522*n+.072175*r,z:.0193339*t+.119192*n+.9503041*r}},_P=e=>{let t=3.2404542*e.x-1.5371385*e.y-.4985314*e.z,n=-.969266*e.x+1.8760108*e.y+.041556*e.z,r=.0556434*e.x-.2040259*e.y+1.0572252*e.z;return{r:mP(t),g:mP(n),b:mP(r)}},vP=e=>{let t=e.x/cP,n=e.y/lP,r=e.z/uP,i=hP(t),a=hP(n),o=hP(r);return{l:116*a-16,a:500*(i-a),b:200*(a-o)}},yP=(e,t)=>{let n=e*e*e;return n>sP?t*n:t*((116*e-16)/oP)},bP=e=>{let t=(e.l+16)/116,n=e.a/500+t,r=t-e.b/200;return{x:yP(n,cP),y:yP(t,lP),z:yP(r,uP)}},xP=e=>vP(gP(e)),SP=e=>_P(bP(e)),CP=e=>{let t=e.replace(/^#/,``);return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}},wP=e=>{let t=Math.max(0,Math.min(255,Math.round(e.r))),n=Math.max(0,Math.min(255,Math.round(e.g))),r=Math.max(0,Math.min(255,Math.round(e.b)));return`#${t.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`},TP=e=>xP(CP(e)),EP=e=>wP(SP(e)),DP=6,OP=5,kP=24,AP=25,jP=(e,t,n)=>({l:t.l+e*(n.l-t.l),a:t.a+e*(n.a-t.a),b:t.b+e*(n.b-t.b)}),MP=(e,t=!1)=>{let n=e.background??`#000000`,r=e.foreground??`#ffffff`,i=[TP(n),TP(e.red??`#ff0000`),TP(e.green??`#00ff00`),TP(e.yellow??`#ffff00`),TP(e.blue??`#0000ff`),TP(e.magenta??`#ff00ff`),TP(e.cyan??`#00ffff`),TP(r)];if(i[7].l<i[0].l&&!t){let e=i[0];i[0]=i[7],i[7]=e}let a=[];for(let e=0;e<DP;e++){let t=jP(e/OP,i[0],i[1]),n=jP(e/OP,i[2],i[3]),r=jP(e/OP,i[4],i[5]),o=jP(e/OP,i[6],i[7]);for(let e=0;e<DP;e++){let i=jP(e/OP,t,n),s=jP(e/OP,r,o);for(let e=0;e<DP;e++){let t=jP(e/OP,i,s);a.push(EP(t))}}}for(let e=0;e<kP;e++){let t=(e+1)/AP;a.push(EP(jP(t,i[0],i[7])))}return a},NP=`Symbols Nerd Font`,PP=``,FP=async e=>{if(!(typeof document>`u`)&&e.name)try{await document.fonts.ready;let t=[document.fonts.load(`16px "${e.name}"`),document.fonts.load(`bold 16px "${e.name}"`),document.fonts.load(`16px "${NP}"`,PP),document.fonts.load(`bold 16px "${NP}"`,PP)];await Promise.all(t)}catch{}},IP=(e,t)=>`\x1b[${e};${t+1}u`,LP=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},RP=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),zP=(e,t)=>{let n=e.buffer.active,r=Math.max(0,n.baseY-n.viewportY),i=r===0;try{t.fit()}catch{return!1}try{if(i)return e.scrollToBottom(),!0;let t=e.buffer.active;if(r>t.baseY)return e.scrollToBottom(),!0;let n=t.baseY-r-t.viewportY;n!==0&&e.scrollLines(n)}catch{}return!0},BP=(e,t)=>`\r\n\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,VP={block:{blink:`\x1B[1 q`,steady:`\x1B[2 q`},underline:{blink:`\x1B[3 q`,steady:`\x1B[4 q`},bar:{blink:`\x1B[5 q`,steady:`\x1B[6 q`}},HP=(e,t)=>{let n=t?`blink`:`steady`;return`\x1b[?25h${VP[e][n]}`},UP=(e,t)=>`${HP(e,t)}\r\n\x1b[2;32m[reconnected]\x1b[0m\r\n\r\n`,WP=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,GP=55296,KP=56319,qP=(e,t)=>{if(e.length<=t)return[e];let n=[],r=0;for(;r<e.length;){let i=Math.min(r+t,e.length);if(i<e.length){let t=e.charCodeAt(i-1);t>=GP&&t<=KP&&--i}i===r&&(i=r+t),n.push(e.slice(r,i)),r=i}return n},JP=(e,t)=>{if(t.wasAtBottom){e.scrollToBottom();return}let n=e.buffer.active;if(t.distanceFromBottom>n.baseY){e.scrollToBottom();return}let r=n.baseY-t.distanceFromBottom-n.viewportY;r!==0&&e.scrollLines(r)},YP=new class{terminal=null;chunks=[];scheduled=!1;afterFlush=null;attach(e){this.terminal=e}setAfterFlush(e){this.afterFlush=e}detach(){this.flush(),this.terminal=null,this.afterFlush=null}push(e){this.chunks.push(e),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush()))}flush(){this.scheduled=!1;let e=this.chunks,t=this.terminal;this.chunks=[],!(!t||e.length===0)&&(e.length===1?t.write(e[0]):t.write(e.join(``)),this.afterFlush?.())}},XP=e=>e[0]===3,ZP=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},QP=1/kS,$P=e=>Math.round(e*QP)/QP,eF=e=>{if(!Number.isFinite(e))return OS;let t=$P(e);return t<1?1:t>2?2:t},tF=1/1,nF=e=>Math.round(e*tF)/tF,rF=e=>{if(!Number.isFinite(e))return 0;let t=nF(e);return t<0?0:t>48?48:t},iF=e=>{if(!Number.isFinite(e))return 0;let t=nF(e);return t<0?0:t>48?48:t},aF=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},oF=(e,t,n)=>e.key!==t&&e.key!==t.toUpperCase()?!1:n?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,sF=(e,t)=>oF(e,`k`,t),cF=(e,t)=>oF(e,`f`,t),lF=(e,t)=>e.code===`Backslash`?e.altKey&&!e.metaKey&&!e.ctrlKey?!0:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey:!1,uF=e=>{if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);return t===null||t.trim()===``?null:t}catch{return null}},dF=(e,t)=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,t)}catch{}},fF=(e,t,n)=>({load:()=>{let r=uF(e);if(r===null)return t;let i=Number(r);return Number.isFinite(i)?n(i):t},store:t=>dF(e,String(t))}),pF=(e,t)=>({load:()=>{let n=uF(e);return n===`true`?!0:n===`false`?!1:t},store:t=>dF(e,String(t))}),mF=(e,t,n)=>({load:()=>{let r=uF(e);return r!==null&&n(r)?r:t},store:t=>dF(e,t)}),hF=(e,t,n)=>({load:()=>t(uF(e)),store:t=>dF(e,n(t))}),gF=pF(WS,!0),_F=gF.load,vF=gF.store,yF=mF(US,jE,NE),bF=yF.load,xF=yF.store,SF=hF(BS,e=>XE(e).id,e=>e),CF=SF.load,wF=SF.store,TF=fF(VS,13,ZP),EF=TF.load,DF=TF.store,OF=fF(HS,OS,eF),kF=OF.load,AF=OF.store,jF=fF(GS,eD,e=>nD(e)?e:eD),MF=jF.load,NF=jF.store,PF=pF(KS,!0),FF=PF.load,IF=PF.store,LF=hF(zS,e=>aD(e).id,e=>e),RF=LF.load,zF=LF.store,BF=fF(qS,0,rF),VF=BF.load,HF=BF.store,UF=fF(JS,0,iF),WF=UF.load,GF=UF.store,KF=pF(XS,!1),qF=KF.load,JF=KF.store,YF=`<path d='m6 8 4 4-4 4M12 16h6'/>`,XF=[`<circle cx='7' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='12' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='17' cy='12' r='1.5' fill='currentColor' stroke='none'/>`].join(``),ZF={ready:`hsl(220 8% 46%)`,running:`hsl(142 72% 45%)`,"alive-quiet":`hsl(210 65% 50%)`,dead:`hsl(0 72% 50%)`},QF={ready:`hsl(220 10% 16%)`,running:`hsl(142 85% 12%)`,"alive-quiet":`hsl(210 70% 14%)`,dead:`hsl(0 80% 12%)`},$F={ready:YF,running:XF,"alive-quiet":YF,dead:YF},eI=`<circle cx='19' cy='7' r='3.5' fill='hsl(0 72% 50%)' stroke='white' stroke-width='1.5'/>`,tI=(e,t=!1)=>{let n=ZF[e],r=QF[e],i=$F[e],a=t?eI:``;return[`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' color='${r}' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='${e===`dead`?FS:1}'>`,`<rect x='2' y='4' width='20' height='16' rx='2' fill='${n}'/>`,i,a,`</svg>`].join(``)},nI=`ready`,rI=null,iI=!1,aI=(e,t)=>rI===null||e!==nI||t!==iI,oI=(e,t)=>{nI=e,rI=e,iI=t},sI=()=>{nI=`ready`,rI=null,iI=!1},cI=(e,t=!1)=>{if(typeof document>`u`||!aI(e,t))return;oI(e,t);let n=`data:image/svg+xml,${encodeURIComponent(tI(e,t))}`,r=document.querySelector(`link[rel="icon"]`);r||(r=document.createElement(`link`),r.rel=`icon`,document.head.appendChild(r)),r.type=`image/svg+xml`,r.href=n},lI=`/api/health`,uI=async()=>{try{return(await fetch(lI)).ok}catch{return!1}},dI=(e,t)=>t.buffer.active.type!==`alternate`||t.modes.mouseTrackingMode!==`none`?!1:e.deltaMode===WheelEvent.DOM_DELTA_PIXEL,fI=e=>e||`localterm`,pI=e=>`${jS}${e||`localterm`}`,mI={matchBackground:IS,activeMatchBackground:LS,activeMatchBorder:RS,matchOverviewRuler:LS,activeMatchColorOverviewRuler:RS},hI=`cwd`,gI=e=>{let t=new URL(`/ws`,window.location.href);t.protocol=t.protocol===`https:`?`wss:`:`ws:`;let n=e??new URLSearchParams(window.location.search).get(hI);return n&&t.searchParams.set(hI,n),t.toString()},_I=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(hI,e),t.toString()},vI=({onModalOpenChange:e,onForegroundProcessChange:t}={})=>{let n=(0,b.useRef)(null),r=(0,b.useRef)(null),i=(0,b.useRef)(!1),a=(0,b.useRef)(null),o=(0,b.useRef)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(null),d=(0,b.useRef)(null),f=(0,b.useRef)(RF()),p=(0,b.useRef)(CF()),m=(0,b.useRef)(EF()),h=(0,b.useRef)(kF()),g=(0,b.useRef)(bF()),_=(0,b.useRef)(_F()),v=(0,b.useRef)(MF()),x=(0,b.useRef)(FF()),C=(0,b.useRef)(VF()),w=(0,b.useRef)(WF()),T=(0,b.useRef)(qF()),E=(0,b.useRef)(null),O=(0,b.useRef)(null),k=(0,b.useRef)(null),A=(0,b.useRef)(null),[j,M]=(0,b.useState)(null),[N,P]=(0,b.useState)(0),[F,I]=(0,b.useState)(!1),[L,ee]=(0,b.useState)(!1),[R,te]=(0,b.useState)(!1),[z,B]=(0,b.useState)(!1),V=(0,b.useRef)(null),[H,ne]=(0,b.useState)(0),[U,re]=(0,b.useState)(!1),[ie,ae]=(0,b.useState)(!1),oe=(0,b.useRef)(null),se=(0,b.useRef)(!1),ce=U||ie;se.current=ie;let[le,ue]=(0,b.useState)(``),[de,fe]=(0,b.useState)({resultIndex:-1,resultCount:0}),[pe,me]=(0,b.useState)(f.current),[he,ge]=(0,b.useState)(null),_e=he??pe,ve=(0,b.useMemo)(()=>aD(_e),[_e]),ye=(0,b.useMemo)(()=>({...ve.colors,extendedAnsi:MP(ve.colors)}),[ve]),[be,xe]=(0,b.useState)(p.current),[Se,Ce]=(0,b.useState)(null),we=Se??be,[Te,Ee]=(0,b.useState)(T.current),De=(0,b.useMemo)(()=>XE(we),[we]),[Oe,ke]=(0,b.useState)(m.current),[Ae,je]=(0,b.useState)(h.current),[Me,Ne]=(0,b.useState)(g.current),[Pe,Fe]=(0,b.useState)(null),Ie=Pe??Me,[Le,Re]=(0,b.useState)(_.current),[ze,Be]=(0,b.useState)(v.current),[Ve,He]=(0,b.useState)(x.current),[Ue,We]=(0,b.useState)(C.current),[Ge,Ke]=(0,b.useState)(w.current),[Je,Xe]=(0,b.useState)(null),[Ze,Qe]=(0,b.useState)(`Notification`in window?Notification.permission:`unsupported`),[$e,et]=(0,b.useState)(null),tt=(0,b.useRef)(null),nt=(0,b.useRef)(!1),rt=(0,b.useMemo)(aF,[]);(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let c=!1,l=!1,u=!1,y=``,b=null,C=null,w=null,j=null,N=null,F=0,I=`ready`,L=!1,ee=!1,R=[0],te=()=>R[R.length-1]??0,z=()=>{let e=performance.now()-F;if(e<750){N=window.setTimeout(z,750-e);return}N=null,j!==null&&(window.clearTimeout(j),j=null),I===`running`&&(document.hidden&&(L=!0),ee?(I=`alive-quiet`,cI(`alive-quiet`,L)):(I=`ready`,cI(`ready`,L)))},B=()=>{I!==`running`&&j===null&&(j=window.setTimeout(()=>{j=null,!(c||l)&&(I=`running`,L=!1,cI(`running`))},250)),F=performance.now(),N===null&&(N=window.setTimeout(z,750))},H=()=>{j!==null&&(window.clearTimeout(j),j=null),N!==null&&(window.clearTimeout(N),N=null),(I!==`ready`||L)&&(I=`ready`,L=!1,cI(`ready`))},ne=XE(p.current);FP(ne).then(()=>{if(c)return;let e=r.current;e&&e.clearTextureAtlas(),U._core._charSizeService.measure(),ke()});let U=new $u({allowProposedApi:!0,cursorBlink:_.current,cursorStyle:g.current,fontFamily:ZE(ne,T.current),fontSize:m.current,lineHeight:h.current,scrollback:v.current,theme:{...aD(f.current).colors,extendedAnsi:MP(aD(f.current).colors)},macOptionIsMeta:!0,scrollOnUserInput:x.current,windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0},scrollbar:{showScrollbar:!1}});r.current=U,YP.attach(U);let re=new D;E.current=re,U.loadAddon(re),U.loadAddon(new Nn),U.loadAddon(new S),U.loadAddon(new qe),U.loadAddon(new Ye),U.loadAddon(new Dn);let ie=new ut;U.loadAddon(ie),o.current=ie;let ae=ie.onDidChangeResults(fe);U.open(e),re.proposeDimensions&&=()=>{if(!U||!U.element||!U.element.parentElement)return;let e=U,t=e._core._renderService.dimensions.css.cell.width,n=e._core._renderService.dimensions.css.cell.height;if(t===0||n===0)return;let r=window.getComputedStyle(U.element.parentElement),i=window.getComputedStyle(U.element),a=Math.max(0,parseInt(r.getPropertyValue(`width`)))-(parseInt(i.getPropertyValue(`padding-right`))+parseInt(i.getPropertyValue(`padding-left`))),o=parseInt(r.getPropertyValue(`height`))-(parseInt(i.getPropertyValue(`padding-top`))+parseInt(i.getPropertyValue(`padding-bottom`)));return{cols:Math.max(2,Math.floor(a/t)),rows:Math.max(1,Math.floor(o/n))}};let oe=()=>{let e=U.buffer.active,t=e.length,n=U.rows,r=e.viewportY+n>=t,i=t>n,a=k.current,o=A.current;if(!(!a||!o)&&(a.classList.toggle(`xterm-scrollbar-visible`,!r&&i),i)){let r=n/t,i=e.viewportY/t;o.style.height=`${r*100}%`,o.style.top=`${i*100}%`}};oe();let se=U.onScroll(oe);YP.setAfterFlush(oe);let ce=!1,le=0,ue=0,de=e=>{if(e.button===0){ce=!0,le=e.clientY,ue=U.buffer.active.viewportY;try{e.target.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}},pe=e=>{if(!ce)return;let t=k.current;if(!t)return;let n=t.clientHeight,r=U.buffer.active.length-U.rows;if(r<=0||n<=0)return;let i=n/r,a=e.clientY-le,o=Math.max(0,Math.min(r,ue+Math.round(a/i)));o!==U.buffer.active.viewportY&&U.scrollLines(o-U.buffer.active.viewportY)},me=()=>{ce=!1},he=e=>{if(e.button!==0||e.target===A.current)return;let t=k.current;if(!t)return;let n=t.getBoundingClientRect(),r=(e.clientY-n.top)/n.height,i=U.buffer.active,a=i.length,o=Math.max(0,Math.min(a-U.rows,Math.round(r*a)-Math.floor(U.rows/2)));U.scrollLines(o-i.viewportY)},ge=A.current,_e=k.current;ge&&(ge.addEventListener(`pointerdown`,de),ge.addEventListener(`pointermove`,pe),ge.addEventListener(`pointerup`,me),ge.addEventListener(`pointercancel`,me)),_e&&_e.addEventListener(`pointerdown`,he);try{let e=new ia;e.onContextLoss(()=>e.dispose()),U.loadAddon(e)}catch{}let ve=U.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let t=e[0],n=typeof t==`number`?t:1;return R.push(n),!0}),ye=U.parser.registerCsiHandler({prefix:`<`,final:`u`},e=>{let t=e[0],n=typeof t==`number`&&t>0?t:1;for(let e=0;e<n&&R.length>1;e+=1)R.pop();return!0}),be=U.parser.registerCsiHandler({prefix:`=`,final:`u`},e=>{let t=e[0],n=e[1];if(typeof t!=`number`)return!0;let r=t,i=typeof n==`number`&&n>0?n:1,a=R.length-1,o=R[a]??0;return i===1?R[a]=r:i===2?R[a]=o|r:i===3&&(R[a]=o&~r),!0}),xe=U.parser.registerCsiHandler({final:`J`},XP),Se=U.parser.registerCsiHandler({prefix:`?`,final:`J`},XP),Ce=e=>{b?.readyState===WebSocket.OPEN&&b.send(JSON.stringify(e))},we=()=>{let e=d.current;e&&cancelAnimationFrame(e.frameId),d.current=null},Te=()=>{let e=d.current;e&&JP(U,e.anchor)},Ee=e=>{we(),d.current={anchor:e,frameId:requestAnimationFrame(()=>{Te(),d.current=null})}};U.attachCustomWheelEventHandler(e=>dI(e,U)?(e.preventDefault(),!1):!0),U.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(lF(e,rt)){if(e.type===`keydown`){e.preventDefault();let t=document.getElementById(`new-shell-link`);t instanceof HTMLAnchorElement&&t.click()}return!1}if(sF(e,rt))return e.type===`keydown`&&(e.preventDefault(),V.current?.()),!1;if(cF(e,rt))return e.type===`keydown`&&(e.preventDefault(),O.current?.()),!1;if(e.type===`keydown`&&e.key===`Enter`){let t=RP(e),n=(te()&1)!=0;if(t!==0&&n)return e.preventDefault(),Ce({type:`input`,data:IP(13,t)}),!1;if(t===1)return e.preventDefault(),Ce({type:`input`,data:`
|
|
114
|
+
`}),!1}return!0});let De=e=>{if(l)return;let t=e.trim();t&&(y=t,document.title=fI(t))};s.current=()=>U.focus();let Oe=(e,t)=>{let n=U,r=n._core._renderService?.dimensions?.css?.canvas?.width,i=n._core._renderService?.dimensions?.css?.canvas?.height;Ce({type:`resize`,cols:e,rows:t,...r!=null&&i!=null?{pixelWidth:Math.round(r),pixelHeight:Math.round(i)}:{}})},ke=()=>{let e=LP(U);zP(U,re)&&(Ee(e),Oe(U.cols,U.rows))},Ae=()=>{w!==null&&window.clearTimeout(w),w=window.setTimeout(()=>{w=null,ke()},80)};U.onData(e=>{for(let t of qP(e,gD))Ce({type:`input`,data:t})}),U.onResize(({cols:e,rows:t})=>{Oe(e,t),oe()});let je=new ResizeObserver(Ae),Me=()=>{!document.hidden&&L&&(L=!1,cI(I))};document.addEventListener(`visibilitychange`,Me),je.observe(e),ke(),requestAnimationFrame(()=>U.focus());let Ne=e=>{if(!l){if(l=!0,e===null||e===0){window.close(),setTimeout(()=>{c||(H(),cI(`dead`),U.write(WP(e)),document.title=pI(y),M({reason:`shell-exited`,exitCode:e}),Xe(null))},100);return}H(),cI(`dead`),U.write(WP(e)),document.title=pI(y),M({reason:`shell-exited`,exitCode:e}),Xe(null)}},Pe=(e,t,n)=>{l||(l=!0,H(),cI(`dead`),U.write(BP(e,t)),document.title=pI(y),M({reason:`connection-lost`,closeCode:e,closeReason:t,wasClean:n}),Xe(null))},Fe=()=>{if(c)return;let e=new WebSocket(gI(tt.current));b=e,e.addEventListener(`open`,()=>{c||b!==e||(u=!0,nt.current=!0,P(0),Oe(U.cols,U.rows))}),e.addEventListener(`message`,n=>{if(c||b!==e)return;let r;try{r=JSON.parse(typeof n.data==`string`?n.data:String(n.data))}catch{return}if(typeof r==`object`&&r&&r.type===`output`&&typeof r.data==`string`){let e=r.data;YP.push(e),B();return}let i=$N.safeParse(r);if(!i.success)return;let a=i.data;if(a.type===`title`)De(a.title);else if(a.type===`session`)Xe({shell:a.shell,shellName:a.shellName,pid:a.pid,cwd:a.cwd,title:a.title}),et(a.cwd),De(a.title);else if(a.type===`cwd`)et(a.cwd);else if(a.type===`foreground`){let e=a.process!==null;t?.(e),!e&&I===`alive-quiet`&&(I=`ready`,cI(`ready`,L)),ee=e}else a.type===`notification`?`Notification`in window&&Notification.permission===`granted`&&new Notification(a.body):a.type===`exit`&&(H(),Ne(a.code))}),e.addEventListener(`close`,t=>{if(b===e&&(b=null,nt.current=!1,!c&&!l)){if(u){console.warn(`[localterm] websocket closed: code=${t.code} reason=${JSON.stringify(t.reason)} wasClean=${t.wasClean}`),Pe(t.code,t.reason,t.wasClean);return}P(e=>e+1),C=window.setTimeout(Fe,DS)}}),e.addEventListener(`error`,t=>{console.warn(`[localterm] websocket error`,t);try{e.close()}catch{}})};return a.current=()=>{if(!c){l=!1,u=!1,nt.current=!1,M(null),Xe(null),P(0),cI(`ready`),t?.(!1),C!==null&&(window.clearTimeout(C),C=null);try{b?.close()}catch{}b=null,Fe()}},Fe(),i.current=!0,()=>{c=!0,i.current=!1,ge&&(ge.removeEventListener(`pointerdown`,de),ge.removeEventListener(`pointermove`,pe),ge.removeEventListener(`pointerup`,me),ge.removeEventListener(`pointercancel`,me)),_e&&_e.removeEventListener(`pointerdown`,he),ae.dispose(),se.dispose(),ve.dispose(),ye.dispose(),be.dispose(),xe.dispose(),Se.dispose(),C!==null&&window.clearTimeout(C),w!==null&&window.clearTimeout(w),we(),H(),document.removeEventListener(`visibilitychange`,Me),je.disconnect();try{b?.close()}catch{}b=null,YP.detach(),U.dispose(),document.title=AS}},[]),(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.theme=ye)},[ye]),(0,b.useEffect)(()=>{if(!i.current||!r.current)return;let e=!1;return FP(De).then(()=>{if(e)return;let t=r.current;if(!t)return;t.options.fontFamily=ZE(De,Te),t.clearTextureAtlas();let n=E.current;n&&zP(t,n)}),()=>{e=!0}},[De,Te]);let it=(0,b.useCallback)(e=>{me(e),ge(null),zF(e)},[]),at=(0,b.useCallback)(e=>{xe(e),Ce(null),wF(e)},[]),ot=(0,b.useCallback)(e=>{Ee(e),JF(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.fontSize=Oe;let t=E.current;t&&zP(e,t)},[Oe]);let st=(0,b.useCallback)(e=>{let t=ZP(e);ke(t),DF(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.lineHeight=Ae;let t=E.current;t&&zP(e,t)},[Ae]);let ct=(0,b.useCallback)(e=>{let t=eF(e);je(t),AF(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorStyle=Ie)},[Ie]);let lt=(0,b.useCallback)(e=>{Ne(e),Fe(null),xF(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorBlink=Le)},[Le]);let dt=(0,b.useCallback)(e=>{Re(e),vF(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollback=ze)},[ze]);let ft=(0,b.useCallback)(e=>{Be(e),NF(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollOnUserInput=Ve)},[Ve]);let pt=(0,b.useCallback)(e=>{He(e),IF(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;let t=E.current;t&&zP(e,t)},[Ue,Ge]);let mt=(0,b.useCallback)(e=>{let t=rF(e);We(t),HF(t)},[]),ht=(0,b.useCallback)(e=>{let t=iF(e);Ke(t),GF(t)},[]),gt=(0,b.useCallback)(()=>{`Notification`in window&&Notification.requestPermission().then(e=>{Qe(e)})},[]);(0,b.useEffect)(()=>{if(!R)return;let e=c.current;e&&(e.focus(),e.select())},[R,H]);let _t=(0,b.useCallback)(e=>{if(!e){o.current?.clearDecorations(),fe({resultIndex:-1,resultCount:0});return}o.current?.findNext(e,{decorations:mI})},[]),vt=(0,b.useCallback)(e=>{e&&o.current?.findPrevious(e,{decorations:mI})},[]),yt=(0,b.useCallback)(()=>{te(!1),ue(``),fe({resultIndex:-1,resultCount:0}),o.current?.clearDecorations(),s.current?.()},[]),bt=(0,b.useCallback)(()=>{oe.current!==null&&(window.clearTimeout(oe.current),oe.current=null),re(!0)},[]),xt=(0,b.useCallback)(()=>{oe.current=window.setTimeout(()=>{oe.current=null,se.current||re(!1)},200)},[]),St=(0,b.useCallback)(e=>{ae(e),e||(oe.current!==null&&window.clearTimeout(oe.current),oe.current=window.setTimeout(()=>{oe.current=null,re(!1)},200))},[]);V.current=(0,b.useCallback)(()=>{B(e=>!e)},[]);let Ct=(0,b.useCallback)(()=>{B(!1),s.current?.()},[]),wt=(0,b.useCallback)(()=>{te(!0),B(!1),ne(e=>e+1)},[]);O.current=wt;let Tt=(0,b.useCallback)(e=>{let t=e.target.value;ue(t),_t(t)},[_t]),Et=(0,b.useCallback)(e=>{if(cF(e.nativeEvent,rt)){e.preventDefault(),e.currentTarget.select();return}if(e.key===`Escape`){e.preventDefault(),yt();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?vt(le):_t(le))},[yt,_t,vt,rt,le]),Dt=(0,b.useCallback)(()=>{ee(!0),a.current?.(),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{l.current=null,ee(!1)},800)},[]),Ot=(0,b.useCallback)(()=>{navigator.clipboard.writeText(MS).then(()=>{I(!0),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,I(!1)},NS)}).catch(()=>{})},[]);(0,b.useEffect)(()=>()=>{oe.current!==null&&(window.clearTimeout(oe.current),oe.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),u.current!==null&&(window.clearTimeout(u.current),u.current=null)},[]),(0,b.useEffect)(()=>{if(tt.current=$e,!$e)return;let e=new URL(window.location.href);if(e.searchParams.get(hI)!==$e){e.searchParams.set(hI,$e);try{window.history.replaceState(null,``,e)}catch{}}},[$e]);let kt=_I($e),At=j!==null,jt=!At&&N>=2,Mt=At||jt,Nt=j!==null&&j.reason!==`shell-exited`||jt;(0,b.useEffect)(()=>{if(!Nt)return;let e=Date.now(),t=!1,n=null,i=i=>{if(t||nt.current)return;if(i){let e=r.current;e&&(e.write(UP(Ie,Le)),e.refresh(0,e.rows-1),e.focus()),a.current?.();return}let s=Date.now()-e<5e3?250:PS;n=window.setTimeout(o,s)},o=()=>{uI().then(i)};return o(),()=>{t=!0,n!==null&&window.clearTimeout(n)}},[Nt,Ie,Le]),(0,b.useEffect)(()=>{e?.(Mt),Mt&&B(!1)},[Mt,e]);let Pt=de.resultCount===0?`0/0`:`${de.resultIndex+1}/${de.resultCount}`,Ft=ve.colors.background??`#101010`,It=(0,b.useMemo)(()=>{let e=rt?`⌘`:`Ctrl+`,t=iD.map(e=>({id:`theme:${e.id}`,label:`Theme: ${e.name}`,category:`Theme`,action:()=>it(e.id)})),n=YE.map(e=>({id:`font:${e.id}`,label:`Font: ${e.name}`,category:`Font`,action:()=>at(e.id)}));return[...t,...n,{id:`find`,label:`Find in terminal`,category:`Search`,shortcut:`${e}F`,icon:(0,y.jsx)(vd,{className:`size-3.5`}),action:wt},{id:`new-shell`,label:`Open new shell`,category:`Tab`,shortcut:`Alt+T`,icon:(0,y.jsx)(_d,{className:`size-3.5`}),action:()=>{let e=document.getElementById(`new-shell-link`);e instanceof HTMLAnchorElement&&e.click()}},...AE.map(e=>({id:`cursor:${e.id}`,label:`Cursor: ${e.name}`,category:`Cursor`,action:()=>lt(e.id)})),{id:`cursor-blink`,label:`Cursor blink: ${Le?`On`:`Off`}`,category:`Cursor`,action:()=>dt(!Le)},{id:`font-size-up`,label:`Increase font size`,category:`Font`,shortcut:`${e}+`,icon:(0,y.jsx)(gd,{className:`size-3.5`}),action:()=>st(Oe+1)},{id:`font-size-down`,label:`Decrease font size`,category:`Font`,shortcut:`${e}-`,icon:(0,y.jsx)(gd,{className:`size-3.5`}),action:()=>st(Oe-1)},{id:`scroll-on-input`,label:`Pin to bottom on input: ${Ve?`On`:`Off`}`,category:`Scrollback`,action:()=>pt(!Ve)}]},[rt,it,at,wt,lt,Le,dt,Oe,st,Ve,pt]);return(0,y.jsxs)(`div`,{className:`h-dvh w-dvw`,style:{background:Ft},children:[(0,y.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,y.jsx)(`div`,{ref:n,"aria-label":`terminal session`,className:`absolute`,style:{top:Ge,right:Ue,bottom:Ge,left:Ue}}),(0,y.jsx)(`div`,{ref:k,className:`xterm-scrollbar-track`,style:{top:Ge,right:Ue,bottom:Ge},children:(0,y.jsx)(`div`,{ref:A,className:`xterm-scrollbar-thumb`})}),j===null?null:(0,y.jsx)(Qx,{variant:`destructive`,role:`status`,"aria-live":`polite`,className:`absolute top-2 left-3 z-10`,children:j.reason===`shell-exited`?j.exitCode===null?`exited`:`exited · code ${j.exitCode}`:`disconnected · code ${j.closeCode}`}),(0,y.jsxs)(`div`,{className:qf(`absolute right-0 top-0 z-10 flex flex-col items-end pr-3 pt-1`,ce?`pointer-events-auto`:`pointer-events-none`),onMouseEnter:bt,onMouseLeave:xt,children:[(0,y.jsx)(`div`,{"aria-hidden":`true`,className:qf(`pointer-events-auto mr-0.5 h-[2px] w-5 rounded-full bg-muted-foreground/25 transition-opacity duration-150`,ce||R?`opacity-0`:`opacity-100`)}),!R&&(0,y.jsxs)(`div`,{role:`toolbar`,"aria-label":`terminal actions`,className:qf(`mt-1 flex items-center gap-0.5 rounded-md border border-border/60 bg-background/70 p-0.5 text-muted-foreground shadow-xs backdrop-blur-md`,`transition-[opacity,transform] duration-200 ease-snappy`,ce?`translate-y-0 opacity-100`:`pointer-events-none -translate-y-1 opacity-0`),onMouseDown:e=>e.preventDefault(),onKeyDown:()=>s.current?.(),children:[(0,y.jsx)(hD,{themeId:pe,onThemeChange:it,onThemePreview:ge,fontId:be,onFontChange:at,onFontPreview:Ce,nerdFontEnabled:Te,onNerdFontEnabledChange:ot,fontSize:Oe,onFontSizeChange:st,lineHeight:Ae,onLineHeightChange:ct,cursorStyle:Me,onCursorStyleChange:lt,onCursorStylePreview:Fe,cursorBlink:Le,onCursorBlinkChange:dt,scrollback:ze,onScrollbackChange:ft,scrollOnUserInput:Ve,onScrollOnUserInputChange:pt,paddingX:Ue,onPaddingXChange:mt,paddingY:Ge,onPaddingYChange:ht,notificationsPermission:Ze,onNotificationsPermissionRequest:gt,sessionInfo:Je,onPopoverOpenChange:St,onClose:s.current??void 0}),(0,y.jsx)(Bx,{variant:`ghost`,size:`icon-sm`,onClick:wt,"aria-label":`find in terminal`,className:`hover:text-foreground`,children:(0,y.jsx)(vd,{})}),(0,y.jsx)(Bx,{variant:`ghost`,size:`icon-sm`,nativeButton:!1,"aria-label":`open a new shell in a new browser tab`,render:(0,y.jsx)(`a`,{id:`new-shell-link`,href:kt,target:`_blank`,rel:`noopener noreferrer`}),className:`hover:text-foreground`,children:(0,y.jsx)(_d,{})})]}),R&&(0,y.jsxs)(yS,{role:`search`,"aria-label":`find in terminal`,className:`mt-1 w-80 border-border/60 bg-background/70 text-muted-foreground shadow-xs backdrop-blur-md dark:bg-background/70`,children:[(0,y.jsx)(TS,{ref:c,type:`search`,value:le,onChange:Tt,onKeyDown:Et,placeholder:`Find`,"aria-label":`find query`,className:`text-xs`}),(0,y.jsxs)(xS,{align:`inline-end`,children:[(0,y.jsx)(wS,{role:`status`,"aria-label":`match count`,className:`text-xs tabular-nums`,children:Pt}),(0,y.jsx)(CS,{size:`icon-xs`,onClick:()=>vt(le),disabled:de.resultCount===0,"aria-label":`previous match`,children:(0,y.jsx)(fd,{})}),(0,y.jsx)(CS,{size:`icon-xs`,onClick:()=>_t(le),disabled:de.resultCount===0,"aria-label":`next match`,children:(0,y.jsx)(dd,{})})]})]})]})]}),(0,y.jsx)(tC,{open:z,onClose:Ct,commands:It}),(0,y.jsx)(Vx,{open:Mt,children:(0,y.jsx)(Wx,{children:j===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Gx,{children:[(0,y.jsxs)(qx,{className:`flex items-center gap-2`,children:[(0,y.jsx)(ES,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Lost connection`]}),(0,y.jsx)(Jx,{children:`The localterm server isn't responding. Start it again from your terminal, then retry.`})]}),(0,y.jsxs)(yS,{children:[(0,y.jsx)(TS,{readOnly:!0,value:MS,"aria-label":`restart command`,className:`font-mono`}),(0,y.jsx)(xS,{align:`inline-end`,children:(0,y.jsx)(CS,{size:`icon-xs`,onClick:Ot,"aria-label":F?`Copied`:`Copy restart command`,children:F?(0,y.jsx)(ud,{}):(0,y.jsx)(pd,{})})})]}),(0,y.jsx)(Kx,{children:(0,y.jsxs)(Yx,{onClick:Dt,disabled:L,children:[L?(0,y.jsx)(ES,{"data-icon":`inline-start`}):null,`Retry`]})})]}):j.reason===`shell-exited`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Gx,{children:[(0,y.jsx)(qx,{children:`Shell ended`}),(0,y.jsx)(Jx,{children:j.exitCode===null||j.exitCode===0?`Open a new shell to keep going, or close this tab.`:`Exit code ${j.exitCode}. Open a new shell to keep going.`})]}),(0,y.jsx)(Kx,{children:(0,y.jsx)(Yx,{onClick:()=>window.open(kt,`_blank`,`noopener,noreferrer`),children:`New shell`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Gx,{children:[(0,y.jsxs)(qx,{className:`flex items-center gap-2`,children:[(0,y.jsx)(ES,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Connection lost`]}),(0,y.jsxs)(Jx,{children:[`The browser lost its connection to the localterm daemon (close code`,` `,j.closeCode,j.closeReason?` · ${j.closeReason}`:``,`). Reconnecting spawns a fresh shell. The previous one can't be reattached.`]})]}),(0,y.jsx)(Kx,{children:(0,y.jsxs)(Yx,{onClick:Dt,disabled:L,children:[L?(0,y.jsx)(ES,{"data-icon":`inline-start`}):null,`Reconnect`]})})]})})})]})},yI=()=>{let e=(0,b.useRef)(!1),t=(0,b.useRef)(!1);return(0,b.useEffect)(()=>{let n=n=>{e.current||t.current&&n.preventDefault()},r=()=>window.addEventListener(`beforeunload`,n);return window.addEventListener(`keydown`,r,{once:!0}),()=>{window.removeEventListener(`keydown`,r),window.removeEventListener(`beforeunload`,n)}},[]),(0,y.jsx)(vI,{onModalOpenChange:(0,b.useCallback)(t=>{e.current=t},[]),onForegroundProcessChange:(0,b.useCallback)(e=>{t.current=e},[])})};sI(),cI(`ready`),(()=>{if(typeof document>`u`||document.getElementById(`localterm-google-fonts`))return;let e=QE();if(!e)return;let t=document.createElement(`link`);t.id=YS,t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)})();var bI=document.getElementById(`root`);if(!bI)throw Error(`Root element not found`);(0,x.createRoot)(bI).render((0,y.jsx)(b.StrictMode,{children:(0,y.jsx)(EE,{delay:300,children:(0,y.jsx)(yI,{})})}));
|
|
115
|
+
//# sourceMappingURL=index-TQyjKb-9.js.map
|