@jinn-network/client 0.2.0-canary.775efb4e → 0.2.0-canary.8de487a2

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.
@@ -19,13 +19,13 @@ Defaulting to \`null\`.`}go(Mo,`getInvalidValueError`);var No=Co,Po=To,Fo=L.forw
19
19
  `,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``}(n||(t.C0=n={})),function(e){e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`}(r||(t.C1=r={})),function(e){e.ST=`${n.ESC}\\`}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;let r=n(2584),i={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};t.evaluateKeyboardEvent=function(e,t,n,a){let o={type:0,cancel:!1,key:void 0},s=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`:e.key===`UIKeyInputRightArrow`?o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`);break;case 8:if(e.altKey){o.key=r.C0.ESC+r.C0.DEL;break}o.key=r.C0.DEL;break;case 9:if(e.shiftKey){o.key=r.C0.ESC+`[Z`;break}o.key=r.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,o.cancel=!0;break;case 27:o.key=r.C0.ESC,e.altKey&&(o.key=r.C0.ESC+r.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`D`,o.key===r.C0.ESC+`[1;3D`&&(o.key=r.C0.ESC+(n?`b`:`[1;5D`))):o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`;break;case 39:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`C`,o.key===r.C0.ESC+`[1;3C`&&(o.key=r.C0.ESC+(n?`f`:`[1;5C`))):o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`;break;case 38:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`A`,n||o.key!==r.C0.ESC+`[1;3A`||(o.key=r.C0.ESC+`[1;5A`)):o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`;break;case 40:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`B`,n||o.key!==r.C0.ESC+`[1;3B`||(o.key=r.C0.ESC+`[1;5B`)):o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`;break;case 45:e.shiftKey||e.ctrlKey||(o.key=r.C0.ESC+`[2~`);break;case 46:o.key=s?r.C0.ESC+`[3;`+(s+1)+`~`:r.C0.ESC+`[3~`;break;case 36:o.key=s?r.C0.ESC+`[1;`+(s+1)+`H`:t?r.C0.ESC+`OH`:r.C0.ESC+`[H`;break;case 35:o.key=s?r.C0.ESC+`[1;`+(s+1)+`F`:t?r.C0.ESC+`OF`:r.C0.ESC+`[F`;break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=r.C0.ESC+`[5;`+(s+1)+`~`:o.key=r.C0.ESC+`[5~`;break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=r.C0.ESC+`[6;`+(s+1)+`~`:o.key=r.C0.ESC+`[6~`;break;case 112:o.key=s?r.C0.ESC+`[1;`+(s+1)+`P`:r.C0.ESC+`OP`;break;case 113:o.key=s?r.C0.ESC+`[1;`+(s+1)+`Q`:r.C0.ESC+`OQ`;break;case 114:o.key=s?r.C0.ESC+`[1;`+(s+1)+`R`:r.C0.ESC+`OR`;break;case 115:o.key=s?r.C0.ESC+`[1;`+(s+1)+`S`:r.C0.ESC+`OS`;break;case 116:o.key=s?r.C0.ESC+`[15;`+(s+1)+`~`:r.C0.ESC+`[15~`;break;case 117:o.key=s?r.C0.ESC+`[17;`+(s+1)+`~`:r.C0.ESC+`[17~`;break;case 118:o.key=s?r.C0.ESC+`[18;`+(s+1)+`~`:r.C0.ESC+`[18~`;break;case 119:o.key=s?r.C0.ESC+`[19;`+(s+1)+`~`:r.C0.ESC+`[19~`;break;case 120:o.key=s?r.C0.ESC+`[20;`+(s+1)+`~`:r.C0.ESC+`[20~`;break;case 121:o.key=s?r.C0.ESC+`[21;`+(s+1)+`~`:r.C0.ESC+`[21~`;break;case 122:o.key=s?r.C0.ESC+`[23;`+(s+1)+`~`:r.C0.ESC+`[23~`;break;case 123:o.key=s?r.C0.ESC+`[24;`+(s+1)+`~`:r.C0.ESC+`[24~`;break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(n&&!a||!e.altKey||e.metaKey)!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(o.key=r.C0.US),e.key===`@`&&(o.key=r.C0.NUL)):e.keyCode===65&&(o.type=1);else{let t=i[e.keyCode]?.[+!!e.shiftKey];if(t)o.key=r.C0.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),o.key=r.C0.ESC+n}else if(e.keyCode===32)o.key=r.C0.ESC+(e.ctrlKey?r.C0.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=r.C0.ESC+t,o.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=r.C0.DEL:e.keyCode===219?o.key=r.C0.ESC:e.keyCode===220?o.key=r.C0.FS:e.keyCode===221&&(o.key=r.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},225:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;let n=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],r=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],i;t.UnicodeV6=class{constructor(){if(this.version=`6`,!i){i=new Uint8Array(65536),i.fill(1),i[0]=0,i.fill(0,1,32),i.fill(0,127,160),i.fill(2,4352,4448),i[9001]=2,i[9002]=2,i.fill(2,11904,42192),i[12351]=1,i.fill(2,44032,55204),i.fill(2,63744,64256),i.fill(2,65040,65050),i.fill(2,65072,65136),i.fill(2,65280,65377),i.fill(2,65504,65511);for(let e=0;e<n.length;++e)i.fill(0,n[e][0],n[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?i[e]:function(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,r)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}}},5981:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{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._onWriteParsed=this.register(new r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let n;for(this._isSyncWriting=!0;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._pendingData>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||Date.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=>Date.now()-n>=12?setTimeout((()=>this._innerWrite(0,e))):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.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),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=a},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,r=/^[\da-f]+$/;function i(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=n.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),r.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}},t.toRgbString=function(e,t=16){let[n,r,a]=e;return`rgb:${i(n,t)}/${i(r,t)}/${i(a,t)}`}},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;let r=n(482),i=n(8742),a=n(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,`HOOK`,t)}put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._ident,`PUT`,(0,r.utf32ToString)(e,t,n))}unhook(e,t=!0){if(this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].unhook(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,`UNHOOK`,e);this._active=o,this._ident=0}};let s=new i.Params;s.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data=``,this._params=s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():s,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,n),this._data.length>a.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then((e=>(this._params=s,this._data=``,this._hitLimit=!1,e)));return this._params=s,this._data=``,this._hitLimit=!1,t}}},2015:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;let r=n(844),i=n(8742),a=n(6242),o=n(6351);class s{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}}t.TransitionTable=s,t.VT500_TRANSITION_TABLE=function(){let e=new s(4095),t=Array.apply(null,Array(256)).map(((e,t)=>t)),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}();class c extends r.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new i.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,r.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new o.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},(()=>!0))}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r,i=0,a=0,o=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](this._params),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 4:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],r=this._oscParser.end(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let n=o;n<t;++n){switch(i=e[n],a=this._transitions.table[this.currentState<<8|(i<160?i:160)],a>>4){case 2:for(let r=n+1;;++r){if(r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|i],s=o?o.length-1:-1;for(;s>=0&&(r=o[s](this._params),!0!==r);s--)if(r instanceof Promise)return this._preserveStack(3,o,s,a,n),r;s<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingCodepoint=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++n<t&&(i=e[n])>47&&i<60);n--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let c=this._escHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(r=c[l](),!0!==r);l--)if(r instanceof Promise)return this._preserveStack(4,c,l,a,n),r;l<0&&this._escHandlerFb(this._collect<<8|i),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let r=n+1;;++r)if(r>=t||(i=e[r])===24||i===26||i===27||i>127&&i<160){this._dcsParser.put(e,n,r),n=r-1;break}break;case 14:if(r=this._dcsParser.unhook(i!==24&&i!==26),r)return this._preserveStack(6,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let r=n+1;;r++)if(r>=t||(i=e[r])<32||i>127&&i<160){this._oscParser.put(e,n,r),n=r-1;break}break;case 6:if(r=this._oscParser.end(i!==24&&i!==26),r)return this._preserveStack(5,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&a}}}t.EscapeSequenceParser=c},6242:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;let r=n(5770),i=n(482),a=[];t.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,`START`)}_put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._id,`PUT`,(0,i.utf32ToString)(e,t,n))}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].end(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._id,`END`,e);this._active=a,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,i.utf32ToString)(e,t,n),this._data.length>r.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then((e=>(this._data=``,this._hitLimit=!1,e)));return this._data=``,this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;let n=2147483647;class r{static fromArray(e){let t=new r;if(!e.length)return t;for(let n=+!!Array.isArray(e[0]);n<e.length;++n){let r=e[n];if(Array.isArray(r))for(let e=0;e<r.length;++e)t.addSubParam(r[e]);else t.addParam(r)}return t}constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let e=new r(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>n?n:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>n?n:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[t-1];r[t-1]=~i?Math.min(10*i+e,n):e}}t.Params=r},5741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=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)}}},8771:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;let r=n(3785),i=n(511);t.BufferApiView=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 r.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;let r=n(511);t.BufferLineApiView=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 r.CellData)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}}},8285:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;let r=n(8771),i=n(8460),a=n(844);class o extends a.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new r.BufferApiView(this._core.buffers.normal,`normal`),this._alternate=new r.BufferApiView(this._core.buffers.alt,`alternate`),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)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=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)}}},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=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}}},744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;let a=n(8460),o=n(844),s=n(5295),c=n(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let l=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new s.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t,n){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};t.BufferService=l=r([i(0,c.IOptionsService)],l)},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;let a=n(2585),o=n(8460),s=n(844),c={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button!==4&&e.action===1&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function l(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),e.action===32?n|=32:e.action!==0||t||(n|=3)),n}let u=String.fromCharCode,d={DEFAULT:e=>{let t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`${u(t[0])}${u(t[1])}${u(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.x};${e.y}${t}`}},f=t.CoreMouseService=class extends s.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(c))this.addProtocol(e,c[e]);for(let e of Object.keys(d))this.addEncoding(e,d[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=f=r([i(0,a.IBufferService),i(1,a.ICoreService)],f)},6975:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;let a=n(1439),o=n(8460),s=n(844),c=n(2585),l=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=t.CoreService=class extends s.Disposable{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}reset(){this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onBinary.fire(e))}};t.CoreService=d=r([i(0,c.IBufferService),i(1,c.ILogService),i(2,c.IOptionsService)],d)},9074:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;let r=n(8055),i=n(8460),a=n(844),o=n(6106),s=0,c=0;class l extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new u(e);if(t){let e=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,(t=>{s=t.options.x??0,c=s+(t.options.width??1),e>=s&&e<c&&(!n||(t.options.layer??`bottom`)===n)&&r(t)}))}}t.DecorationService=l;class u extends a.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=r.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=r.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new i.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new i.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;let r=n(2585),i=n(8343);class a{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=a,t.InstantiationService=class{constructor(){this._services=new a,this._services.set(r.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=(0,i.getServiceDependencies)(e).sort(((e,t)=>e.index-t.index)),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id}.`);r.push(n)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}}},7866:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(844),o=n(2585),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},7302:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;let r=n(8460),i=n(844);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`courier-new, courier, monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:n(6114).isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRulerWidth:0};let a=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`];class o extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new r.EventEmitter),this.onOptionChange=this._onOptionChange.event;let n=Object.assign({},t.DEFAULT_OPTIONS);for(let t in e)if(t in n)try{let r=e[t];n[t]=this._sanitizeAndValidateOption(t,r)}catch(e){console.error(e)}this.rawOptions=n,this.options=Object.assign({},n),this._setupOptions()}onSpecificOptionChange(e,t){return this.onOptionChange((n=>{n===e&&t(this.rawOptions[e])}))}onMultipleOptionChange(e,t){return this.onOptionChange((n=>{e.indexOf(n)!==-1&&t()}))}_setupOptions(){let e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},n=(e,n)=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);n=this._sanitizeAndValidateOption(e,n),this.rawOptions[e]!==n&&(this.rawOptions[e]=n,this._onOptionChange.fire(e))};for(let t in this.rawOptions){let r={get:e.bind(this,t),set:n.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(e,n){switch(e){case`cursorStyle`:if(n||=t.DEFAULT_OPTIONS[e],!function(e){return e===`block`||e===`underline`||e===`bar`}(n))throw Error(`"${n}" is not a valid value for ${e}`);break;case`wordSeparator`:n||=t.DEFAULT_OPTIONS[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof n==`number`&&1<=n&&n<=1e3)break;n=a.includes(n)?n:t.DEFAULT_OPTIONS[e];break;case`cursorWidth`:n=Math.floor(n);case`lineHeight`:case`tabStopWidth`:if(n<1)throw Error(`${e} cannot be less than 1, value: ${n}`);break;case`minimumContrastRatio`:n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case`scrollback`:if((n=Math.min(n,4294967295))<0)throw Error(`${e} cannot be less than 0, value: ${n}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(n<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${n}`);break;case`rows`:case`cols`:if(!n&&n!==0)throw Error(`${e} must be numeric, value: ${n}`);break;case`windowsPty`:n??={}}return n}}t.OptionsService=o},2660:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;let a=n(2585),o=t.OscLinkService=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)))}};t.OscLinkService=o=r([i(0,a.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(8343);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)},1480:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;let r=n(8460),i=n(225);t.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,n=e.length;for(let r=0;r<n;++r){let i=e.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=n)return t+this.wcwidth(i);let a=e.charCodeAt(r);56320<=a&&a<=57343?i=1024*(i-55296)+a-56320+65536:t+=this.wcwidth(a)}t+=this.wcwidth(i)}return t}}}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;let t=n(9042),i=n(3236),a=n(844),o=n(5741),s=n(8285),c=n(7975),l=n(7090),u=[`cols`,`rows`];class d extends a.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions=Object.assign({},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(u.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 element(){return this._core.element}get parser(){return this._parser||=new c.ParserApi(this._core),this._parser}get unicode(){return this._checkProposedApi(),new l.UnicodeApi(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 s.BufferNamespaceApi(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}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,wraparoundMode:e.wraparound}}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()}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),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
20
20
  `,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 t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))})),Ho=o(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.FitAddon=r():n.FitAddon=r()})(self,(()=>(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core,t=e._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue(`height`)),a=Math.max(0,parseInt(r.getPropertyValue(`width`))),o=window.getComputedStyle(this._terminal.element),s=i-(parseInt(o.getPropertyValue(`padding-top`))+parseInt(o.getPropertyValue(`padding-bottom`))),c=a-(parseInt(o.getPropertyValue(`padding-right`))+parseInt(o.getPropertyValue(`padding-left`)))-n;return{cols:Math.max(2,Math.floor(c/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()))})),Uo=o(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.WebLinksAddon=r():n.WebLinksAddon=r()})(self,(()=>(()=>{var e={6:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkComputer=t.WebLinkProvider=void 0,t.WebLinkProvider=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let r=n.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map((e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e)))}};class n{static computeLink(e,t,r,i){let a=new RegExp(t.source,(t.flags||``)+`g`),[o,s]=n._getWindowedLineStrings(e-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let e=l[0];try{let t=new URL(e),n=decodeURI(t.toString());if(e!==n&&e+`/`!==n)continue}catch{continue}let[t,a]=n._mapStrIdx(r,s,0,l.index),[o,c]=n._mapStrIdx(r,t,a,e.length);if(t===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:t+1},end:{x:c,y:o+1}};u.push({range:d,text:e,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),n.isWrapped&&o.indexOf(` `)===-1););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}}t.LinkComputer=n}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.WebLinksAddon=void 0;let t=n(6),i=/https?:[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function a(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}e.WebLinksAddon=class{constructor(e=a,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let n=this._options,r=n.urlRegex||i;this._linkProvider=this._terminal.registerLinkProvider(new t.WebLinkProvider(this._terminal,r,this._handler,n))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}}})(),r})()))})),Wo=Vo(),Go=Ho(),Ko=Uo(),qo=dr(`inline-flex items-center rounded-sm border px-1.5 py-0.5 font-mono text-[10px] font-medium uppercase tracking-[0.14em] transition-colors`,{variants:{variant:{default:`border-transparent bg-[var(--accent-sky)] text-[var(--bg-sunken)]`,secondary:`border-transparent bg-[var(--bg-sunken)] text-[var(--fg-muted)]`,destructive:`border-[var(--severity-blocking-border)] bg-[var(--severity-blocking-bg)] text-[var(--severity-blocking-fg)]`,warning:`border-[var(--severity-warning-border)] bg-[var(--severity-warning-bg)] text-[var(--severity-warning-fg)]`,success:`border-[var(--severity-success-border)] bg-[var(--severity-success-bg)] text-[var(--severity-success-fg)]`,outline:`border-[var(--border)] bg-transparent text-[var(--fg)]`,pill:`rounded-full border-[var(--wane)] bg-transparent text-[var(--wane)] normal-case tracking-[0.12em] px-1.5`}},defaultVariants:{variant:`default`}});function q({className:e,variant:t,...n}){return(0,R.jsx)(`span`,{className:U(qo({variant:t}),e),...n})}function Jo({agentGated:e=!1}={}){let t=(0,L.useRef)(null),[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(null);(0,L.useEffect)(()=>{if(!t.current)return;let e=!1,n=null,i=null,o=null,c=window.location.protocol===`https:`?`wss`:`ws`,u=new WebSocket(`${c}://${window.location.host}/api/agent/ws`),d=()=>{if(i||!t.current)return i;let r=new Wo.Terminal({fontFamily:`"JetBrains Mono", ui-monospace, Menlo, monospace`,fontSize:13,lineHeight:1.3,letterSpacing:0,theme:{background:`#070d18`,foreground:`#f2f7fc`,cursor:`#dcb866`,selectionBackground:`#1f3a66`,black:`#0c1628`,red:`#a85a5a`,green:`#6a9b8f`,yellow:`#dcb866`,blue:`#7aa7dc`,magenta:`#7a6db0`,cyan:`#a8c8ea`,white:`#a4b0c2`,brightBlack:`#33394a`,brightRed:`#c87a7a`,brightGreen:`#8abbaf`,brightYellow:`#ead08e`,brightBlue:`#a8c8ea`,brightMagenta:`#9a8dd0`,brightCyan:`#cbdef3`,brightWhite:`#f2f7fc`},convertEol:!0,scrollback:5e3,allowProposedApi:!0}),a=new Go.FitAddon;r.loadAddon(a),r.loadAddon(new Ko.WebLinksAddon),r.open(t.current);let s=()=>{if(!(e||!t.current)&&!(t.current.offsetWidth===0||t.current.offsetHeight===0))try{a.fit()}catch{}};return n=window.requestAnimationFrame(s),o=new ResizeObserver(()=>{s()}),o.observe(t.current),r.onData(e=>{u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({kind:`input`,data:e}))}),r.onResize(({cols:e,rows:t})=>{u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({kind:`resize`,cols:e,rows:t}))}),i=r,r};return u.onopen=()=>{a(!0),d()},u.onclose=()=>a(!1),u.onerror=()=>a(!1),u.onmessage=e=>{try{let t=JSON.parse(e.data);t.kind===`data`&&typeof t.data==`string`?i?.write(t.data):t.kind===`meta`?(r({active:!!t.autoMode,reason:t.reason??``}),typeof t.agentReady==`boolean`&&s(t.agentReady)):t.kind===`auth_url`&&typeof t.url==`string`||(t.kind===`error`?t.recoverable&&t.remediation?l({message:t.message??`agent failed to start`,remediation:t.remediation}):i?.write(`\r\n\x1b[31m[error] ${t.message??`unknown error`}\x1b[0m\r\n`):t.kind===`exit`&&i?.write(`\r
21
21
  \x1B[33m[claude session exited]\x1B[0m\r
22
- `))}catch{}},()=>{e=!0,n!==null&&window.cancelAnimationFrame(n),u.close(),o?.disconnect(),i?.dispose()}},[]);let u=e&&!o;return(0,R.jsxs)(`div`,{className:`flex h-full w-full flex-col bg-[var(--bg-sunken)]`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border bg-[var(--bg-elevated)] px-4 py-2`,children:[(0,R.jsx)(`span`,{className:U(`font-mono text-[11px] tracking-[0.05em]`,i?`text-[var(--vow-green)]`:`text-[var(--fg-dim)]`),children:i?`● connected`:`○ disconnected`}),n&&(0,R.jsx)(q,{variant:n.active?`warning`:`secondary`,title:n.active?`Claude Code Auto Mode is active`:n.reason,children:n.active?`Auto Mode`:`Default permissions`})]}),c&&(0,R.jsxs)(fo,{variant:`blocking`,className:`m-3 flex flex-col gap-2`,children:[(0,R.jsx)(po,{className:`text-[var(--break-red)]`,children:`Agent panel unavailable`}),(0,R.jsx)(mo,{className:`font-mono text-xs text-[var(--fg-muted)]`,children:c.message}),c.remediation&&(0,R.jsxs)(`p`,{className:`font-mono text-xs text-[var(--fg-dim)]`,children:[(0,R.jsx)(`span`,{className:`text-[var(--fg-muted)]`,children:`Fix · `}),c.remediation]})]}),(0,R.jsx)(`div`,{ref:t,className:U(`w-full flex-1 bg-[var(--bg-sunken)] p-3`,`min-h-[400px]`,u&&`invisible hidden`)}),u&&!c&&(0,R.jsx)(Yo,{})]})}function Yo(){return(0,R.jsx)(`div`,{className:`flex w-full flex-1 items-center justify-center bg-[var(--bg-sunken)] px-6`,children:(0,R.jsxs)(`div`,{className:`flex max-w-[34ch] flex-col items-center gap-4 text-center`,children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`jinn-anim-pulse h-2 w-2 rounded-full bg-[var(--seer-violet)]`}),(0,R.jsx)(`p`,{className:`font-mono text-xs text-[var(--fg-muted)]`,children:`The agent will come online once harness setup is complete.`})]})})}var Xo={pluginBuilderUi:!1,embeddedAgent:!1};function Zo(){let e=typeof window>`u`?void 0:window.__JINN_FEATURES__;return!e||typeof e!=`object`?Xo:{pluginBuilderUi:e.pluginBuilderUi===!0,embeddedAgent:e.embeddedAgent===!0}}function Qo({envelope:e,chainExplorerBase:t}){let n=ts(e),r=ns(e.generatedAt),[i,a]=(0,L.useState)(`idle`),[o,s]=(0,L.useState)(null),c=e.details,l=(typeof c?.category==`string`?c.category:void 0)===`insufficient_funds`,u=typeof c?.address==`string`?c.address:null,d=typeof c?.requiredWei==`string`?c.requiredWei:typeof c?.needWei==`string`?c.needWei:null,f=typeof c?.haveWei==`string`?c.haveWei:null,p=(typeof c?.txHash==`string`?c.txHash:null)??n,m=(0,L.useCallback)(async()=>{a(`retrying`),s(null);try{await B.retryBootstrap(),a(`success`)}catch(e){a(`error`),s(e instanceof Error?e.message:String(e))}},[]);return(0,R.jsxs)(fo,{variant:`blocking`,className:`flex flex-col gap-3 px-5 py-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,R.jsxs)(po,{className:`text-[var(--break-red)]`,children:[`Bootstrap halted · `,e.code]}),r&&(0,R.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--fg-dim)]`,children:r})]}),(0,R.jsx)(mo,{className:`break-words font-mono text-xs text-foreground`,children:e.message}),l&&u&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)($o,{label:`Send ETH to`,children:u}),d&&(0,R.jsx)($o,{label:`Required`,children:es(d)}),f&&(0,R.jsx)($o,{label:`Currently have`,children:es(f)}),d&&f&&(0,R.jsx)($o,{label:`Shortfall`,children:es((BigInt(d)-BigInt(f)).toString())})]}),!l&&e.hint&&(0,R.jsxs)(`p`,{className:`font-mono text-xs text-[var(--fg-muted)]`,children:[(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`Fix · `}),e.hint]}),p&&(0,R.jsx)(W,{asChild:!0,variant:`link`,size:`sm`,className:`self-start px-0`,children:(0,R.jsxs)(`a`,{href:`${t}/tx/${p}`,target:`_blank`,rel:`noopener noreferrer`,children:[`view failed tx`,(0,R.jsx)(kn,{})]})}),(0,R.jsxs)(`div`,{className:`mt-1 flex items-center gap-3`,children:[(0,R.jsx)(W,{variant:`destructive`,size:`sm`,type:`button`,onClick:()=>{m()},disabled:i===`retrying`,children:i===`retrying`?`Retrying…`:i===`success`?`Resuming…`:`Retry`}),i===`success`&&(0,R.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--fg-muted)]`,children:`Daemon resumed — waiting for bootstrap to complete`}),i===`error`&&o&&(0,R.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--break-red)]`,children:o})]}),i===`idle`&&(0,R.jsxs)(`p`,{className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:[`Once you've addressed the cause above, click Retry or`,` `,(0,R.jsx)(`code`,{className:`text-[var(--fg-muted)]`,children:`jinn run`}),` to resume from the persisted state.`]})]})}function $o({label:e,children:t}){return(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`min-w-[100px] shrink-0 font-mono text-[11px] text-[var(--fg-dim)]`,children:e}),(0,R.jsx)(`span`,{className:`break-all font-mono text-[11px] text-foreground`,children:t})]})}function es(e){try{let t=BigInt(e),n=Number(t)/0xde0b6b3a7640000;return n===0?`0 ETH`:n<1e-6?`${t} wei`:`${n.toFixed(6).replace(/\.?0+$/,``)} ETH`}catch{return e}}function ts(e){let t=[e.details?.txHash,e.details?.cause,e.message];for(let e of t){if(typeof e!=`string`)continue;let t=/(0x[a-fA-F0-9]{64})/.exec(e);if(t)return t[1]}return null}function ns(e){try{let t=Date.now()-Date.parse(e);if(!Number.isFinite(t)||t<0)return null;let n=Math.round(t/1e3);if(n<60)return`${n}s ago`;let r=Math.round(n/60);return r<60?`${r}m ago`:`${Math.round(r/60)}h ago`}catch{return null}}var rs=Object.defineProperty,is=(e,t)=>rs(e,`name`,{value:t,configurable:!0}),as=`dismissableLayer.update`,os=`dismissableLayer.pointerDownOutside`,ss=`dismissableLayer.focusOutside`,cs,ls=L.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),us=L.forwardRef(is(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=L.useContext(ls),[d,f]=L.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=L.useState({}),h=Kn(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=L.useRef(!1),C=ps(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:L.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=ms(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=aa(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return L.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),L.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(cs=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),hs(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=cs))}},[d,p,n,u]),L.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),hs())},[d,u]),L.useEffect(()=>{let e=is(()=>m({}),`handleUpdate`);return document.addEventListener(as,e),()=>document.removeEventListener(as,e)},[]),(0,R.jsx)(Gi.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:K(e.onFocusCapture,w.onFocusCapture),onBlurCapture:K(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:K(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function ds(){let e=L.useContext(ls),[t,n]=L.useState(null);return L.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}is(ds,`useDismissableLayerSurface`);var fs=is(()=>!0,`IS_TRUE`);function ps(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=fs}=t,s=aa(e),c=L.useRef(!1),l=L.useRef(!1),u=L.useRef(new Map),d=L.useRef(()=>{});return L.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}is(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}is(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}is(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}is(p,`handleInteractionBubble`);let m=is(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||gs(os,s,p,{discrete:!0})};if(is(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:is(()=>c.current=!0,`onPointerDownCapture`)}}is(ps,`usePointerDownOutside`);function ms(e,t=globalThis?.document){let n=aa(e),r=L.useRef(!1);return L.useEffect(()=>{let e=is(e=>{e.target&&!r.current&&gs(ss,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:is(()=>r.current=!0,`onFocusCapture`),onBlurCapture:is(()=>r.current=!1,`onBlurCapture`)}}is(ms,`useFocusOutside`);function hs(){let e=new CustomEvent(as);document.dispatchEvent(e)}is(hs,`dispatchUpdate`);function gs(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Ki(i,a):i.dispatchEvent(a)}is(gs,`handleAndDispatchCustomEvent`);var _s=L.useId||(()=>void 0),vs=0;function ys(e){let[t,n]=L.useState(_s());return qi(()=>{e||n(e=>e??String(vs++))},[e]),e||(t?`radix-${t}`:``)}var bs=[`top`,`right`,`bottom`,`left`],xs=Math.min,Ss=Math.max,Cs=Math.round,ws=Math.floor,Ts=e=>({x:e,y:e}),Es={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ds(e,t,n){return Ss(e,xs(t,n))}function Os(e,t){return typeof e==`function`?e(t):e}function ks(e){return e.split(`-`)[0]}function As(e){return e.split(`-`)[1]}function js(e){return e===`x`?`y`:`x`}function Ms(e){return e===`y`?`height`:`width`}function Ns(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ps(e){return js(Ns(e))}function Fs(e,t,n){n===void 0&&(n=!1);let r=As(e),i=Ps(e),a=Ms(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ws(o)),[o,Ws(o)]}function Is(e){let t=Ws(e);return[Ls(e),t,Ls(t)]}function Ls(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Rs=[`left`,`right`],zs=[`right`,`left`],Bs=[`top`,`bottom`],Vs=[`bottom`,`top`];function Hs(e,t,n){switch(e){case`top`:case`bottom`:return n?t?zs:Rs:t?Rs:zs;case`left`:case`right`:return t?Bs:Vs;default:return[]}}function Us(e,t,n,r){let i=As(e),a=Hs(ks(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ls)))),a}function Ws(e){let t=ks(e);return Es[t]+e.slice(t.length)}function Gs(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ks(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Gs(e)}function qs(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 Js(e,t,n){let{reference:r,floating:i}=e,a=Ns(t),o=Ps(t),s=Ms(o),c=ks(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(As(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 Ys(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}=Os(t,e),p=Ks(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=qs(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=qs(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 Xs=50,Zs=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ys},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Js(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<Xs&&(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}=Js(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Qs=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}=Os(e,t)||{};if(l==null)return{};let d=Ks(u),f={x:n,y:r},p=Ps(i),m=Ms(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=xs(d[_],T),D=xs(d[v],T),O=E,ee=C-h[m]-D,k=C/2-h[m]/2+w,A=Ds(O,k,ee),j=!c.arrow&&As(i)!=null&&k!==A&&a.reference[m]/2-(k<O?E:D)-h[m]/2<0,M=j?k<O?k-O:k-ee:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),$s=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}=Os(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ks(r),_=Ns(o),v=ks(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ws(o)]:Is(o)),x=p!==`none`;!d&&x&&b.push(...Us(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=Fs(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`&&_!==Ns(t))||T.every(e=>Ns(e.placement)!==_||e.overflows[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=Ns(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 ec(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function tc(e){return bs.some(t=>e[t]>=0)}var nc=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Os(e,t);switch(i){case`referenceHidden`:{let e=ec(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:tc(e)}}}case`escaped`:{let e=ec(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:tc(e)}}}default:return{}}}}},rc=new Set([`left`,`top`]);async function ic(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ks(n),s=As(n),c=Ns(n)===`y`,l=rc.has(o)?-1:1,u=a&&c?-1:1,d=Os(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 ac=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 ic(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}}}}},oc=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}=Os(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ns(ks(i)),p=js(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=Ds(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=Ds(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}}}}}},sc=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}=Os(e,t),u={x:n,y:r},d=Ns(i),f=js(d),p=u[f],m=u[d],h=Os(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=rc.has(ks(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}}}},cc=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}=Os(e,t),u=await o.detectOverflow(t,l),d=ks(i),f=As(i),p=Ns(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=xs(h-u[g],v),x=xs(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=Ss(u.left,0),t=Ss(u.right,0),n=Ss(u.top,0),r=Ss(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Ss(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Ss(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 lc(){return typeof window<`u`}function uc(e){return pc(e)?(e.nodeName||``).toLowerCase():`#document`}function dc(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fc(e){return((pc(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function pc(e){return lc()?e instanceof Node||e instanceof dc(e).Node:!1}function mc(e){return lc()?e instanceof Element||e instanceof dc(e).Element:!1}function hc(e){return lc()?e instanceof HTMLElement||e instanceof dc(e).HTMLElement:!1}function gc(e){return!lc()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof dc(e).ShadowRoot}function _c(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Oc(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function vc(e){return/^(table|td|th)$/.test(uc(e))}function yc(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var bc=/transform|translate|scale|rotate|perspective|filter/,xc=/paint|layout|strict|content/,Sc=e=>!!e&&e!==`none`,Cc;function wc(e){let t=mc(e)?Oc(e):e;return Sc(t.transform)||Sc(t.translate)||Sc(t.scale)||Sc(t.rotate)||Sc(t.perspective)||!Ec()&&(Sc(t.backdropFilter)||Sc(t.filter))||bc.test(t.willChange||``)||xc.test(t.contain||``)}function Tc(e){let t=Ac(e);for(;hc(t)&&!Dc(t);){if(wc(t))return t;if(yc(t))return null;t=Ac(t)}return null}function Ec(){return Cc??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Cc}function Dc(e){return/^(html|body|#document)$/.test(uc(e))}function Oc(e){return dc(e).getComputedStyle(e)}function kc(e){return mc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ac(e){if(uc(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||gc(e)&&e.host||fc(e);return gc(t)?t.host:t}function jc(e){let t=Ac(e);return Dc(t)?e.ownerDocument?e.ownerDocument.body:e.body:hc(t)&&_c(t)?t:jc(t)}function Mc(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=jc(e),i=r===e.ownerDocument?.body,a=dc(r);if(i){let e=Nc(a);return t.concat(a,a.visualViewport||[],_c(r)?r:[],e&&n?Mc(e):[])}else return t.concat(r,Mc(r,[],n))}function Nc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Pc(e){let t=Oc(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=hc(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Cs(n)!==a||Cs(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Fc(e){return mc(e)?e:e.contextElement}function Ic(e){let t=Fc(e);if(!hc(t))return Ts(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Pc(t),o=(a?Cs(n.width):n.width)/r,s=(a?Cs(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Lc=Ts(0);function Rc(e){let t=dc(e);return!Ec()||!t.visualViewport?Lc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zc(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==dc(e)?!1:t}function Bc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Fc(e),o=Ts(1);t&&(r?mc(r)&&(o=Ic(r)):o=Ic(e));let s=zc(a,n,r)?Rc(a):Ts(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=dc(a),t=r&&mc(r)?dc(r):r,n=e,i=Nc(n);for(;i&&r&&t!==n;){let e=Ic(i),t=i.getBoundingClientRect(),r=Oc(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=dc(i),i=Nc(n)}}return qs({width:u,height:d,x:c,y:l})}function Vc(e,t){let n=kc(e).scrollLeft;return t?t.left+n:Bc(fc(e)).left+n}function Hc(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Vc(e,n),y:n.top+t.scrollTop}}function Uc(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=fc(r),s=t?yc(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ts(1),u=Ts(0),d=hc(r);if((d||!d&&!a)&&((uc(r)!==`body`||_c(o))&&(c=kc(r)),d)){let e=Bc(r);l=Ic(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Hc(o,c):Ts(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 Wc(e){return Array.from(e.getClientRects())}function Gc(e){let t=fc(e),n=kc(e),r=e.ownerDocument.body,i=Ss(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Ss(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Vc(e),s=-n.scrollTop;return Oc(r).direction===`rtl`&&(o+=Ss(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Kc=25;function qc(e,t){let n=dc(e),r=fc(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ec();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Vc(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<=Kc&&(a-=o)}else l<=Kc&&(a+=l);return{width:a,height:o,x:s,y:c}}function Jc(e,t){let n=Bc(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=hc(e)?Ic(e):Ts(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Yc(e,t,n){let r;if(t===`viewport`)r=qc(e,n);else if(t===`document`)r=Gc(fc(e));else if(mc(t))r=Jc(t,n);else{let n=Rc(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return qs(r)}function Xc(e,t){let n=Ac(e);return n===t||!mc(n)||Dc(n)?!1:Oc(n).position===`fixed`||Xc(n,t)}function Zc(e,t){let n=t.get(e);if(n)return n;let r=Mc(e,[],!1).filter(e=>mc(e)&&uc(e)!==`body`),i=null,a=Oc(e).position===`fixed`,o=a?Ac(e):e;for(;mc(o)&&!Dc(o);){let t=Oc(o),n=wc(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||_c(o)&&!n&&Xc(e,o))?r=r.filter(e=>e!==o):i=t,o=Ac(o)}return t.set(e,r),r}function Qc(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?yc(t)?[]:Zc(t,this._c):[].concat(n),r],o=Yc(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=Yc(t,a[e],i);s=Ss(n.top,s),c=xs(n.right,c),l=xs(n.bottom,l),u=Ss(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function $c(e){let{width:t,height:n}=Pc(e);return{width:t,height:n}}function el(e,t,n){let r=hc(t),i=fc(t),a=n===`fixed`,o=Bc(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ts(0);function l(){c.x=Vc(i)}if(r||!r&&!a)if((uc(t)!==`body`||_c(i))&&(s=kc(t)),r){let e=Bc(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?Hc(i,s):Ts(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 tl(e){return Oc(e).position===`static`}function nl(e,t){if(!hc(e)||Oc(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return fc(e)===n&&(n=n.ownerDocument.body),n}function rl(e,t){let n=dc(e);if(yc(e))return n;if(!hc(e)){let t=Ac(e);for(;t&&!Dc(t);){if(mc(t)&&!tl(t))return t;t=Ac(t)}return n}let r=nl(e,t);for(;r&&vc(r)&&tl(r);)r=nl(r,t);return r&&Dc(r)&&tl(r)&&!wc(r)?n:r||Tc(e)||n}var il=async function(e){let t=this.getOffsetParent||rl,n=this.getDimensions,r=await n(e.floating);return{reference:el(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function al(e){return Oc(e).direction===`rtl`}var ol={convertOffsetParentRelativeRectToViewportRelativeRect:Uc,getDocumentElement:fc,getClippingRect:Qc,getOffsetParent:rl,getElementRects:il,getClientRects:Wc,getDimensions:$c,getScale:Ic,isElement:mc,isRTL:al};function sl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function cl(e,t){let n=null,r,i=fc(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=ws(d),h=ws(i.clientWidth-(u+f)),g=ws(i.clientHeight-(d+p)),_=ws(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Ss(0,xs(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&&!sl(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 ll(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=Fc(e),u=i||a?[...l?Mc(l):[],...t?Mc(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?cl(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?Bc(e):null;c&&g();function g(){let t=Bc(e);h&&!sl(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 ul=ac,dl=oc,fl=$s,pl=cc,ml=nc,hl=Qs,gl=sc,_l=(e,t,n)=>{let r=new Map,i={platform:ol,...n},a={...i.platform,_c:r};return Zs(e,t,{...i,platform:a})},vl=typeof document<`u`?L.useLayoutEffect:function(){};function yl(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(!yl(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)&&!yl(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function bl(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xl(e,t){let n=bl(e);return Math.round(t*n)/n}function Sl(e){let t=L.useRef(e);return vl(()=>{t.current=e}),t}function Cl(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]=L.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=L.useState(r);yl(f,r)||p(r);let[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=L.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=L.useRef(null),C=L.useRef(null),w=L.useRef(u),T=c!=null,E=Sl(c),D=Sl(i),O=Sl(l),ee=L.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),_l(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};k.current&&!yl(w.current,t)&&(w.current=t,Wi.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);vl(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let k=L.useRef(!1);vl(()=>(k.current=!0,()=>{k.current=!1}),[]),vl(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,ee);ee()}},[b,x,ee,E,T]);let A=L.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),j=L.useMemo(()=>({reference:b,floating:x}),[b,x]),M=L.useMemo(()=>{let e={position:n,left:0,top:0};if(!j.floating)return e;let t=xl(j.floating,u.x),r=xl(j.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...bl(j.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,j.floating,u.x,u.y]);return L.useMemo(()=>({...u,update:ee,refs:A,elements:j,floatingStyles:M}),[u,ee,A,j,M])}var wl=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:hl({element:r.current,padding:i}).fn(n):r?hl({element:r,padding:i}).fn(n):{}}}},Tl=(e,t)=>{let n=ul(e);return{name:n.name,fn:n.fn,options:[e,t]}},El=(e,t)=>{let n=dl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dl=(e,t)=>({fn:gl(e).fn,options:[e,t]}),Ol=(e,t)=>{let n=fl(e);return{name:n.name,fn:n.fn,options:[e,t]}},kl=(e,t)=>{let n=pl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Al=(e,t)=>{let n=ml(e);return{name:n.name,fn:n.fn,options:[e,t]}},jl=(e,t)=>{let n=wl(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Ml(e){let[t,n]=L.useState(void 0);return qi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Nl=Object.defineProperty,Pl=(e,t)=>Nl(e,`name`,{value:t,configurable:!0}),Fl=`Popper`,[Il,Ll]=ra(Fl),[Rl,zl]=Il(Fl),Bl=Pl(e=>{let{__scopePopper:t,children:n}=e,[r,i]=L.useState(null),[a,o]=L.useState(void 0);return(0,R.jsx)(Rl,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Vl=`PopperAnchor`,Hl=L.forwardRef(Pl(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=zl(Vl,n),o=L.useRef(null),s=a.onAnchorChange,c=Kn(t,L.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=L.useRef(null);L.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Yl(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,R.jsx)(Gi.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Ul=`PopperContent`,[Wl,Gl]=Il(Ul),Kl=L.forwardRef(Pl(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=zl(Ul,n),[_,v]=L.useState(null),y=Kn(t,v),[b,x]=L.useState(null),S=Ml(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,ee={padding:E,boundary:D.filter(ql),altBoundary:O},{refs:k,floatingStyles:A,placement:j,isPositioned:M,middlewareData:N}=Cl({strategy:`fixed`,placement:T,whileElementsMounted:Pl((...e)=>ll(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Tl({mainAxis:i+w,alignmentAxis:o}),c&&El({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Dl():void 0,...ee}),c&&Ol({...ee}),kl({...ee,apply:Pl(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&jl({element:b,padding:s}),Jl({arrowWidth:C,arrowHeight:w}),f&&Al({strategy:`referenceHidden`,...ee,boundary:O?ee.boundary:void 0})]}),te=g.setPlacementState;qi(()=>(te(j),()=>{te(void 0)}),[j,te]);let[P,F]=Yl(j),ne=aa(m);qi(()=>{M&&ne?.()},[M,ne]);let re=N.arrow?.x,ie=N.arrow?.y,ae=N.arrow?.centerOffset!==0,[I,oe]=L.useState();return qi(()=>{_&&oe(window.getComputedStyle(_).zIndex)},[_]),(0,R.jsx)(`div`,{ref:k.setFloating,"data-radix-popper-content-wrapper":``,style:{...A,transform:M?A.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:I,"--radix-popper-transform-origin":[N.transformOrigin?.x,N.transformOrigin?.y].join(` `),...N.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,R.jsx)(Wl,{scope:n,placedSide:P,placedAlign:F,onArrowChange:x,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,R.jsx)(Gi.div,{"data-side":P,"data-align":F,...h,ref:y,style:{...h.style,animation:M?h.style?.animation:`none`}})})})},`PopperContent`));function ql(e){return e!==null}Pl(ql,`isNotNull`);var Jl=Pl(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Yl(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Yl(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Pl(Yl,`getSideAndAlignFromPlacement`);var Xl=Bl,Zl=Hl,Ql=Kl,$l=Object.defineProperty,eu=L.forwardRef(((e,t)=>$l(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=L.useState(!1);qi(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Wi.createPortal((0,R.jsx)(Gi.div,{...r,ref:t}),o):null},`Portal`)),tu=L.useEffectEvent,nu=L.useInsertionEffect;function ru(e){if(typeof tu==`function`)return tu(e);let t=L.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof nu==`function`?nu(()=>{t.current=e}):qi(()=>{t.current=e}),L.useMemo(()=>((...e)=>t.current?.(...e)),[])}var iu=Object.defineProperty,au=(e,t)=>iu(e,`name`,{value:t,configurable:!0}),ou=L.useInsertionEffect||qi;function su({prop:e,defaultProp:t,onChange:n=au(()=>{},`onChange`),caller:r}){let[i,a,o]=cu({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,L.useCallback(t=>{if(s){let n=lu(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}au(su,`useControllableState`);function cu({defaultProp:e,onChange:t}){let[n,r]=L.useState(e),i=L.useRef(n),a=L.useRef(t);return ou(()=>{a.current=t},[t]),L.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}au(cu,`useUncontrolledState`);function lu(e){return typeof e==`function`}au(lu,`isFunction`);var uu=Symbol(`RADIX:SYNC_STATE`);function du(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=ru(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=L.useReducer((t,n)=>{if(n.type===uu)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=L.useRef(p);L.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=L.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return L.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:uu,state:i})},[i,d.state,c]),[h,f]}au(du,`useControllableStateReducer`);var fu=Object.defineProperty,pu=(e,t)=>fu(e,`name`,{value:t,configurable:!0}),mu=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),hu=L.forwardRef(pu(function(e,t){return(0,R.jsx)(Gi.span,{...e,ref:t,style:{...mu,...e.style}})},`VisuallyHidden`)),gu=Object.defineProperty,_u=(e,t)=>gu(e,`name`,{value:t,configurable:!0}),[vu,yu]=ra(`Tooltip`,[Ll]),bu=Ll(),xu=`TooltipProvider`,Su=700,Cu=`tooltip.open`,[wu,Tu]=vu(xu),Eu=_u(e=>{let{__scopeTooltip:t,delayDuration:n=Su,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=L.useRef(!0),s=L.useRef(!1),c=L.useRef(0);return L.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,R.jsx)(wu,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:L.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:L.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:L.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),Du=`Tooltip`,[Ou,ku]=vu(Du),Au=_u(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Tu(Du,e.__scopeTooltip),l=bu(t),[u,d]=L.useState(null),[f,p]=L.useState(void 0),m=ys(),h=L.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=L.useRef(!1),[y,b]=su({prop:r,defaultProp:i??!1,onChange:_u(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Cu))):c.onClose(),a?.(e)},`onChange`),caller:Du}),x=L.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=L.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=L.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=L.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);L.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let T=f??m;return(0,R.jsx)(Xl,{...l,children:(0,R.jsx)(Ou,{scope:t,contentId:T,setContentId:p,open:y,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:L.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:L.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})},`Tooltip`),ju=`TooltipTrigger`,Mu=L.forwardRef(_u(function(e,t){let{__scopeTooltip:n,...r}=e,i=ku(ju,n),a=Tu(ju,n),o=bu(n),s=Kn(t,L.useRef(null),i.onTriggerChange),c=L.useRef(!1),l=L.useRef(!1),u=L.useCallback(()=>c.current=!1,[]);return L.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,R.jsx)(Zl,{asChild:!0,...o,children:(0,R.jsx)(Gi.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:K(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:K(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:K(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:K(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:K(e.onBlur,i.onClose),onClick:K(e.onClick,i.onClose)})})},`TooltipTrigger`)),Nu=`TooltipPortal`,[Pu,Fu]=vu(Nu,{forceMount:void 0}),Iu=_u(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=ku(Nu,t);return(0,R.jsx)(Pu,{scope:t,forceMount:n,children:(0,R.jsx)(Zi,{present:n||a.open,children:(0,R.jsx)(eu,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),Lu=`TooltipContent`,Ru=L.forwardRef(_u(function(e,t){let n=Fu(Lu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=ku(Lu,e.__scopeTooltip);return(0,R.jsx)(Zi,{present:r||o.open,children:o.disableHoverableContent?(0,R.jsx)(Vu,{side:i,...a,ref:t}):(0,R.jsx)(zu,{side:i,...a,ref:t})})},`TooltipContent`)),zu=L.forwardRef(_u(function(e,t){let n=ku(Lu,e.__scopeTooltip),r=Tu(Lu,e.__scopeTooltip),i=L.useRef(null),a=Kn(t,i),[o,s]=L.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=L.useCallback(()=>{s(null),d(!1)},[d]),p=L.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Uu(r,Hu(r,n.getBoundingClientRect())),a=Wu(t.getBoundingClientRect()),o=Ku([...i,...a]);s(o),d(!0)},[d]);return L.useEffect(()=>()=>f(),[f]),L.useEffect(()=>{if(c&&u){let e=_u(e=>p(e,u),`handleTriggerLeave`),t=_u(e=>p(e,c),`handleContentLeave`);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),L.useEffect(()=>{if(o){let e=_u(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Gu(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,R.jsx)(Vu,{...e,ref:a})},`TooltipContentHoverable`)),Bu=Xn(`TooltipContent`),Vu=L.forwardRef(_u(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=ku(Lu,n),u=bu(n),{onClose:d}=l;L.useEffect(()=>(document.addEventListener(Cu,d),()=>document.removeEventListener(Cu,d)),[d]),L.useEffect(()=>{if(l.trigger){let e=_u(e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]);let{setContentId:f}=l;return qi(()=>(f(a),()=>{f(void 0)}),[a,f]),(0,R.jsx)(us,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,R.jsxs)(Ql,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,R.jsx)(Bu,{children:r}),i?(0,R.jsx)(hu,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`));function Hu(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}_u(Hu,`getExitSideFromRect`);function Uu(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}_u(Uu,`getPaddedExitPoints`);function Wu(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}_u(Wu,`getPointsFromRect`);function Gu(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}_u(Gu,`isPointInPolygon`);function Ku(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),qu(t)}_u(Ku,`getHull`);function qu(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}_u(qu,`getHullPresorted`);var Ju=Eu,Yu=Au,Xu=Mu,Zu=Iu,Qu=Ru,$u=Ju,ed=Yu,td=Xu,nd=L.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,R.jsx)(Zu,{children:(0,R.jsx)(Qu,{ref:r,sideOffset:t,className:U(`z-50 overflow-hidden rounded-md border border-border bg-popover px-2.5 py-1.5 font-mono text-[11px] text-popover-foreground shadow-md`,`data-[state=delayed-open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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`,e),...n})}));nd.displayName=Qu.displayName;function rd({chain:e}){return(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(q,{variant:e===`base`?`secondary`:`outline`,children:`Testnet`}),(0,R.jsx)($u,{delayDuration:120,children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`span`,{children:(0,R.jsx)(q,{variant:`secondary`,className:`border-dashed border-border opacity-60`,children:`Mainnet · soon`})})}),(0,R.jsx)(nd,{children:`Mainnet support is coming. v1 supports testnet only.`})]})})]})}function id({status:e}){return e===`done`?(0,R.jsxs)(q,{variant:`success`,className:`gap-1.5`,children:[(0,R.jsx)(wn,{className:`h-3 w-3`}),`Done`]}):e===`error`?(0,R.jsxs)(q,{variant:`destructive`,className:`gap-1.5`,children:[(0,R.jsx)(Vn,{className:`h-3 w-3`}),`Failed`]}):e===`active`?(0,R.jsxs)(q,{variant:`warning`,className:`gap-2`,children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`jinn-anim-pulse h-1.5 w-1.5 rounded-full bg-[var(--accent-gold)]`}),`Active`]}):(0,R.jsx)(q,{variant:`secondary`,children:`Queued`})}var ad={1:`Provisioning your wallet`,2:`Fund your wallet`,3:`Joining Jinn`,4:`Pick your first SolverNet`,5:`Set up harness + model`};function od({phase:e,status:t,children:n}){let r=t===`active`,i=t===`error`,a=t===`done`,o=r||i,s=i?`text-[var(--break-red)]`:r?`text-[var(--accent-gold)]`:a?`text-[var(--accent-sky)]`:`text-[var(--fg-dim)]`,c=i||r?`text-foreground`:a?`text-[var(--fg-muted)]`:`text-[var(--fg-dim)]`,l=o?`font-serif text-[28px] leading-[1.2]`:`font-mono text-[14px] leading-[1.2]`;return(0,R.jsxs)(`li`,{className:`phase-row border-t border-border`,"data-status":t,"data-testid":`onboarding-phase-${e}`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-[3rem_1fr_auto] items-baseline gap-4 py-4`,children:[(0,R.jsx)(`span`,{className:U(`font-mono text-xs tabular-nums tracking-[0.05em] transition-colors duration-200`,s),children:String(e).padStart(2,`0`)}),(0,R.jsx)(`span`,{className:U(l,c,`transition-colors duration-200`),children:ad[e]}),(0,R.jsx)(id,{status:t})]}),o&&n&&(0,R.jsx)(`div`,{className:`jinn-anim-fade-slide ml-12 pb-5 pr-2`,children:n})]})}function sd({label:e,step:t,serviceIndex:n,serviceId:r,safeAddress:i,explorer:a,contractRevertReason:o}){let s=!!o;return(0,R.jsxs)(`div`,{className:U(`flex flex-col gap-3 rounded-md border bg-[var(--bg-elevated)] px-4 py-3`,s?`border-[var(--break-red)]`:`border-border`),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:U(`jinn-anim-pulse h-1.5 w-1.5 rounded-full`,s?`bg-[var(--break-red)]`:`bg-[var(--accent-sky)]`)}),(0,R.jsx)(`span`,{className:`font-mono text-sm text-foreground`,children:e}),(0,R.jsx)(`span`,{className:U(`ml-auto font-mono text-[10px]`,s?`text-[var(--break-red)]`:`text-[var(--fg-dim)]`),children:s?`binding failed · will retry`:`running · no action needed`})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-1 font-mono text-[11px] text-[var(--fg-muted)] md:grid-cols-[120px_1fr]`,children:[(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`Current step`}),(0,R.jsx)(`span`,{children:cd(t)}),n!==void 0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`Service`}),(0,R.jsxs)(`span`,{children:[`#`,n,r===void 0?``:` · id ${r}`]})]}),i&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`Safe`}),(0,R.jsx)(`a`,{href:`${a}/address/${i}`,target:`_blank`,rel:`noopener noreferrer`,className:`break-all text-[var(--accent-sky)] hover:underline`,children:i})]}),o&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`Contract revert reason`}),(0,R.jsx)(`code`,{className:`break-words text-xs text-[var(--break-red)]`,children:o})]})]})]})}function cd(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var ld=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`div`,{ref:n,className:U(`animate-pulse rounded-md bg-muted`,e),...t}));ld.displayName=`Skeleton`;function ud(e){return e.contractId===`swe-rebench-v2`&&e.status===`launched`}function dd(e){return!ud(e)&&/smoke/i.test(e.name??``)}var fd=new Set([`subsystem_not_ready`,`registry_unavailable`]);function pd(e){if(e&&typeof e==`object`&&`code`in e){let t=e.code;if(typeof t==`string`)return t}if(e instanceof Error&&e.message.includes(`subsystem_not_ready`))return`subsystem_not_ready`}function md({onJoined:e,joinedCids:t}){let n=ut({queryKey:[`solvernets`,`registry`],queryFn:()=>B.solvernets.listRegistry(),refetchInterval:5e3,retry:!1}),r=n.data?.summaries.find(ud),i=r?.manifestCid,a=i!==void 0&&t.includes(i),o=dt({mutationFn:async()=>{if(!r)throw Error(`no swe-rebench-v2 registry entry`);return B.operator.join(r.manifestCid,{name:r.name,contract:{id:r.contractId,version:r.contractVersion},roles:[`solver`]})},onSuccess:()=>{r&&e(r.manifestCid)}});if(n.isLoading)return(0,R.jsxs)(`div`,{"data-testid":`onboarding-solvernet-loading`,className:`flex flex-col gap-3`,children:[(0,R.jsx)(ld,{className:`h-6 w-48`}),(0,R.jsx)(ld,{className:`h-24 w-full`})]});let s=n.isError?pd(n.error):void 0;return n.isError&&!fd.has(s??``)?(0,R.jsxs)(fo,{variant:`blocking`,"data-testid":`onboarding-solvernet-error`,children:[(0,R.jsx)(po,{children:`Could not load SolverNets.`}),(0,R.jsx)(mo,{children:`The daemon could not read the SolverNet registry. Retry once startup finishes; check daemon logs if it keeps failing.`})]}):r?(0,R.jsxs)(G,{"data-testid":`onboarding-solvernet-card`,"data-manifest-cid":r.manifestCid,children:[(0,R.jsxs)(zi,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(Bi,{className:`font-mono text-[15px]`,children:r.name}),a?(0,R.jsx)(q,{"data-testid":`onboarding-solvernet-joined`,children:`Joined`}):(0,R.jsx)(q,{variant:`secondary`,children:`Recommended`})]}),(0,R.jsx)(Vi,{children:`Pick your first SolverNet; add more later.`})]}),(0,R.jsxs)(Hi,{className:`flex items-center justify-between gap-4`,children:[(0,R.jsx)(`p`,{className:`text-sm text-[var(--fg-muted)]`,children:`Solve coding tasks; your node claims and submits solutions.`}),!a&&(0,R.jsx)(W,{"data-testid":`onboarding-solvernet-join`,onClick:()=>o.mutate(),disabled:o.isPending,children:o.isPending?`Joining…`:`Join`})]})]}):(0,R.jsxs)(`div`,{"data-testid":`onboarding-solvernet-starting`,className:`flex items-center gap-3 font-mono text-[12px] text-[var(--fg-muted)]`,children:[(0,R.jsx)(ld,{className:`h-4 w-4 rounded-full`}),`Finding your first SolverNet…`]})}var hd=`claude-code`,gd=`codex`,_d=`hermes-agent`,vd={"claude-code-learner":hd,"codex-code-learner":gd},yd={[hd]:`Claude Code`,[gd]:`Codex`,[_d]:`Hermes Agent`,"swe-rebench-v2-evaluator":`SWE-rebench v2 Evaluator`};function bd(e){return e?vd[e]??e:``}function xd(e){let t=bd(e);return yd[t]??t}function Sd(e,t){let n=xd(e);return t?`${n} ${t}`:n}function Cd(e,t){return bd(e)===bd(t)}var wd=[{label:`Haiku`,id:`claude-haiku-4-5-20251001`},{label:`Sonnet`,id:`claude-sonnet-4-6`},{label:`Opus`,id:`claude-opus-4-7`}],Td=[{label:`GPT-5.4 Mini`,id:`gpt-5.4-mini`},{label:`GPT-5.5`,id:`gpt-5.5`},{label:`GPT-5.4`,id:`gpt-5.4`},{label:`GPT-5.3 Codex`,id:`gpt-5.3-codex`},{label:`GPT-5.3 Codex Spark`,id:`gpt-5.3-codex-spark`}],Ed=[{label:`Claude Opus 4.7 (OpenRouter)`,id:`anthropic/claude-opus-4.7`},{label:`Claude Sonnet 4.6 (OpenRouter)`,id:`anthropic/claude-sonnet-4.6`},{label:`Hy3 Preview`,id:`tencent/hy3-preview`},{label:`DeepSeek V4 Pro`,id:`deepseek/deepseek-v4-pro`},{label:`DeepSeek V4 Flash`,id:`deepseek/deepseek-v4-flash`},{label:`Gemini 3.1 Flash Lite`,id:`google/gemini-3.1-flash-lite`},{label:`Kimi K2.6`,id:`moonshotai/kimi-k2.6`},{label:`Owl Alpha`,id:`openrouter/owl-alpha`},{label:`MiniMax M2.7`,id:`minimax/minimax-m2.7`}];function Dd(e){return bd(e)===gd}function Od(e){return bd(e)===_d}function kd(e){return Od(e)?Ed:Dd(e)?Td:wd}function Ad(e){return kd(e)[0].id}function jd(e,t){let n=kd(t).find(t=>t.id===e)??null??wd.find(t=>t.id===e)??Td.find(t=>t.id===e)??Ed.find(t=>t.id===e)??null;return n?{canonical:n,label:n.label,isCustom:!1}:{canonical:null,label:`Custom (${e})`,isCustom:!0}}function Md(e){let t=e+`CollectionProvider`,[n,r]=ra(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=L.useRef(null),a=L.useRef(new Map).current;return(0,R.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=qn(s),l=L.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=Kn(t,a(s,n).collectionRef);return(0,R.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=qn(u),p=L.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=L.useRef(null),s=Kn(t,o),c=a(u,n);return L.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,R.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return L.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var Nd=!1;function Pd(){let[e,t]=L.useState(Nd);return L.useEffect(()=>{Nd||(Nd=!0,t(!0))},[]),e}var Fd=L.useSyncExternalStore;function Id(){return()=>{}}function Ld(){return Fd(Id,()=>!0,()=>!1)}var Rd=typeof Fd==`function`?Ld:Pd,zd=Object.defineProperty,Bd=(e,t)=>zd(e,`name`,{value:t,configurable:!0}),Vd=`rovingFocusGroup.onEntryFocus`,Hd={bubbles:!1,cancelable:!0},Ud=`RovingFocusGroup`,[Wd,Gd,Kd]=Md(Ud),[qd,Jd]=ra(Ud,[Kd]),[Yd,Xd]=qd(Ud),Zd=L.forwardRef(Bd(function(e,t){return(0,R.jsx)(Wd.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(Wd.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(Qd,{...e,ref:t})})})},`RovingFocusGroup`)),Qd=L.forwardRef(Bd(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=L.useRef(null),p=Kn(t,f),m=sa(a),[h,g]=su({prop:o,defaultProp:s??null,onChange:c,caller:Ud}),[_,v]=L.useState(!1),y=aa(l),b=Gd(n),x=L.useRef(!1),[S,C]=L.useState(0);return L.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Vd,y),()=>e.removeEventListener(Vd,y)},[y]),(0,R.jsx)(Yd,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:L.useCallback(e=>g(e),[g]),onItemShiftTab:L.useCallback(()=>v(!0),[]),onFocusableItemAdd:L.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:L.useCallback(()=>C(e=>e-1),[]),children:(0,R.jsx)(Gi.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:K(e.onMouseDown,()=>{x.current=!0}),onFocus:K(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Vd,Hd);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);af([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:K(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),$d=`RovingFocusGroupItem`,ef=L.forwardRef(Bd(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=ys(),l=a||c,u=Xd($d,n),d=u.currentTabStopId===l,f=Gd(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=Rd();return qi(()=>{if(!(!g||!r))return p(),()=>m()},[g,r,p,m]),L.useEffect(()=>{if(!(g||!r))return p(),()=>m()},[g,r,p,m]),(0,R.jsx)(Wd.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,R.jsx)(Gi.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:K(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:K(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:K(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=rf(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?of(n,r+1):n.slice(r+1)}setTimeout(()=>af(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),tf={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function nf(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Bd(nf,`getDirectionAwareKey`);function rf(e,t,n){let r=nf(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return tf[r]}Bd(rf,`getFocusIntent`);function af(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Bd(af,`focusFirst`);function of(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Bd(of,`wrapArray`);var sf=Zd,cf=ef,lf=Object.defineProperty,uf=(e,t)=>lf(e,`name`,{value:t,configurable:!0}),df=`Radio`,[ff,pf]=ra(df),[mf,hf]=ff(df);function gf(e){let{__scopeRadio:t,checked:n=!1,children:r,disabled:i,form:a,name:o,onCheck:s,required:c,value:l=`on`,internal_do_not_use_render:u}=e,[d,f]=L.useState(null),[p,m]=L.useState(null),h=L.useRef(!1),[g,_]=L.useReducer(e=>e+1,0),v={checked:n,disabled:i,required:c,name:o,form:a,value:l,control:d,setControl:f,hasConsumerStoppedPropagationRef:h,userInteractionCount:g,onUserInteraction:_,isFormControl:!d||!!a||!!d.closest(`form`),bubbleInput:p,setBubbleInput:m,onCheck:uf(()=>s?.(),`onCheck`)};return(0,R.jsx)(mf,{scope:t,...v,children:Cf(u)?u(v):r})}uf(gf,`RadioProvider`);var _f=`RadioTrigger`,vf=L.forwardRef(uf(function({__scopeRadio:e,onClick:t,...n},r){let{checked:i,disabled:a,value:o,setControl:s,onCheck:c,hasConsumerStoppedPropagationRef:l,onUserInteraction:u,isFormControl:d,bubbleInput:f}=hf(_f,e),p=Kn(r,s);return(0,R.jsx)(Gi.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":wf(i),"data-disabled":a?``:void 0,disabled:a,value:o,...n,ref:p,onClick:K(t,e=>{i||(u(),c()),f&&d&&(l.current=e.isPropagationStopped(),l.current||e.stopPropagation())})})},`RadioTrigger`)),yf=`RadioIndicator`,bf=L.forwardRef(uf(function(e,t){let{__scopeRadio:n,forceMount:r,...i}=e,a=hf(yf,n);return(0,R.jsx)(Zi,{present:r||a.checked,children:(0,R.jsx)(Gi.span,{"data-state":wf(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})},`RadioIndicator`)),xf=`RadioBubbleInput`,Sf=L.forwardRef(uf(function({__scopeRadio:e,onClick:t,...n},r){let{control:i,checked:a,required:o,disabled:s,name:c,value:l,form:u,bubbleInput:d,setBubbleInput:f,hasConsumerStoppedPropagationRef:p,userInteractionCount:m}=hf(xf,e),h=Kn(r,f),g=Ml(i),_=L.useRef(!1),v=L.useRef(a),y=L.useRef(m);L.useEffect(()=>{let e=d;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=m!==y.current;y.current=m;let i=v.current!==a;v.current=a;let o=!(r&&p.current);if(i&&n){_.current=!r;let t=new Event(`click`,{bubbles:o});n.call(e,a),e.dispatchEvent(t),_.current=!1}},[d,a,p,m]);let b=L.useRef(a);return(0,R.jsx)(Gi.input,{type:`radio`,"aria-hidden":!0,defaultChecked:b.current,required:o,disabled:s,name:c,value:l,form:u,...n,tabIndex:-1,ref:h,onClick:K(t,e=>{_.current&&e.stopPropagation()}),style:{...n.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`RadioBubbleInput`));function Cf(e){return typeof e==`function`}uf(Cf,`isFunction`);function wf(e){return e?`checked`:`unchecked`}uf(wf,`getState`);var Tf=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Ef=`RadioGroup`,[Df,Of]=ra(Ef,[Jd,pf]),kf=Jd(),Af=pf(),[jf,Mf]=Df(Ef),Nf=L.forwardRef(uf(function(e,t){let{__scopeRadioGroup:n,name:r,form:i,defaultValue:a,value:o,required:s=!1,disabled:c=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...p}=e,m=kf(n),h=sa(u),[g,_]=su({prop:o,defaultProp:a??null,onChange:f,caller:Ef}),[v,y]=L.useState(null),b=Kn(t,y),x=L.useRef(g);return L.useEffect(()=>{let e=i?v?.ownerDocument.getElementById(i):v?.closest(`form`);if(e instanceof HTMLFormElement){let t=uf(()=>_(x.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[v,i,_]),(0,R.jsx)(jf,{scope:n,name:r,form:i,required:s,disabled:c,value:g,onValueChange:_,children:(0,R.jsx)(sf,{asChild:!0,...m,orientation:l,dir:h,loop:d,children:(0,R.jsx)(Gi.div,{role:`radiogroup`,"aria-required":s,"aria-orientation":l,"data-disabled":c?``:void 0,dir:h,...p,ref:b})})})},`RadioGroup`)),Pf=`RadioGroupItemProvider`,Ff=`RadioGroupItemTrigger`;function If(e){let{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:a}=e,o=Mf(Pf,t),s=Af(t),c=o.disabled||r;return(0,R.jsx)(gf,{...s,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:a,children:i})}uf(If,`RadioGroupItemProvider`);var Lf=L.forwardRef(uf(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=kf(n),a=Af(n),{checked:o,disabled:s}=hf(Ff,a.__scopeRadio),c=L.useRef(null),l=Kn(t,c),u=L.useRef(!1);return L.useEffect(()=>{let e=uf(e=>{Tf.includes(e.key)&&(u.current=!0)},`handleKeyDown`),t=uf(()=>u.current=!1,`handleKeyUp`);return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,R.jsx)(cf,{asChild:!0,...i,focusable:!s,active:o,children:(0,R.jsx)(vf,{...a,...r,ref:l,onKeyDown:K(r.onKeyDown,e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:K(r.onFocus,()=>{u.current&&c.current?.click()})})})},`RadioGroupItemTrigger`)),Rf=L.forwardRef(uf(function(e,t){let{__scopeRadioGroup:n,value:r,disabled:i,...a}=e;return(0,R.jsx)(If,{__scopeRadioGroup:n,value:r,disabled:i,internal_do_not_use_render:({isFormControl:e})=>(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Lf,{...a,ref:t,__scopeRadioGroup:n}),e&&(0,R.jsx)(zf,{__scopeRadioGroup:n})]})})},`RadioGroupItem`)),zf=L.forwardRef(uf(function(e,t){let{__scopeRadioGroup:n,...r}=e;return(0,R.jsx)(Sf,{...Af(n),...r,ref:t})},`RadioGroupItemBubbleInput`)),Bf=L.forwardRef(uf(function(e,t){let{__scopeRadioGroup:n,...r}=e;return(0,R.jsx)(bf,{...Af(n),...r,ref:t})},`RadioGroupIndicator`)),Vf=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Nf,{className:U(`grid gap-2`,e),...t,ref:n}));Vf.displayName=Nf.displayName;var Hf=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Rf,{ref:n,className:U(`aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,R.jsx)(Bf,{className:`flex items-center justify-center`,children:(0,R.jsx)(En,{className:`h-2.5 w-2.5 fill-current text-current`})})}));Hf.displayName=Rf.displayName;var Uf=Object.defineProperty,Wf=L.forwardRef(((e,t)=>Uf(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,R.jsx)(Gi.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),Gf=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Wf,{ref:n,className:U(`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)] peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,e),...t}));Gf.displayName=Wf.displayName;function Kf({protocol:e,node:t,machine:n}){return(0,R.jsx)(`span`,{"data-testid":`tier-dots`,className:`inline-flex items-center gap-1`,"aria-hidden":!0,children:[{id:`protocol`,active:e},{id:`node`,active:t},{id:`machine`,active:n}].map(e=>(0,R.jsx)(`span`,{"data-tier":e.id,"data-active":e.active?`true`:`false`,className:U(`size-1.5 rounded-full border border-current transition-colors`,e.active?`bg-current text-[var(--accent-sky)]`:`bg-transparent text-[var(--fg-dim)]`)},e.id))})}var qf=[gd,hd,_d],Jf=new Set([`harness_not_found`,`subsystem_not_ready`]);function Yf({onSelectionChange:e}){let[t,n]=(0,L.useState)(gd),[r,i]=(0,L.useState)(Ad(gd)),a=ut({queryKey:[`onboarding-harness-readiness`,t],refetchInterval:5e3,queryFn:async()=>{try{return await B.harnessReadiness(t)}catch(e){let t=e.code;if(t&&Jf.has(t))return null;throw e}}}),o=a.data,s=o?.ready===!0,c=o?.ready===!1;(0,L.useEffect)(()=>{e({harness:t,model:r,ready:s})},[t,r,s,e]);function l(e){n(e),i(Ad(e))}let u=kd(t);return(0,R.jsxs)(G,{"data-testid":`onboarding-harness-card`,children:[(0,R.jsxs)(zi,{children:[(0,R.jsx)(Bi,{className:`font-mono text-[15px]`,children:`Harness & model`}),(0,R.jsx)(`p`,{className:`text-sm text-[var(--fg-muted)]`,children:`The harness and model your node uses for its work.`})]}),(0,R.jsxs)(Hi,{className:`flex flex-col gap-5`,children:[(0,R.jsx)(Vf,{value:t,onValueChange:l,className:`gap-2`,children:qf.map(e=>{let n=e===t,r=n?s?`Ready`:c?`Setup required`:`Checking…`:`Select to check`;return(0,R.jsxs)(`label`,{htmlFor:`onboarding-harness-${e}`,className:`flex cursor-pointer items-center gap-3 rounded-[var(--radius-2)] border border-border px-3 py-2.5`,"data-testid":`onboarding-harness-row-${e}`,children:[(0,R.jsx)(Hf,{value:e,id:`onboarding-harness-${e}`}),(0,R.jsx)(`span`,{className:`flex-1 font-mono text-[13px]`,children:xd(e)}),(0,R.jsx)(Kf,{protocol:!0,node:!0,machine:n?s:!1}),(0,R.jsx)(q,{variant:r===`Ready`?`default`:`secondary`,children:r})]},e)})}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(Gf,{htmlFor:`onboarding-model-select`,className:`text-[var(--fg-muted)]`,children:`Model`}),(0,R.jsx)(`select`,{id:`onboarding-model-select`,"data-testid":`onboarding-model-select`,value:r,onChange:e=>i(e.target.value),className:`rounded-[var(--radius-1)] border border-border bg-transparent px-2 py-1.5 font-mono text-[13px]`,children:u.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),c&&(0,R.jsxs)(`div`,{"data-testid":`onboarding-harness-not-ready`,className:`flex flex-col gap-2 rounded-[var(--radius-2)] border border-[var(--break-red)] px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[12px] text-[var(--break-red)]`,children:o?.reason??`This harness needs setup before your node can use it.`}),o?.nextStep?.description&&(0,R.jsx)(`span`,{className:`text-sm text-[var(--fg-muted)]`,children:o.nextStep.description}),o?.nextStep?.cli&&(0,R.jsx)(`code`,{className:`rounded-[var(--radius-1)] bg-[var(--bg-sunken)] px-2 py-1 font-mono text-[12px]`,children:o.nextStep.cli}),(0,R.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-testid":`onboarding-harness-recheck`,onClick:()=>void a.refetch(),className:`self-start`,children:`Recheck`})]})]})]})}var Xf=new Set([`complete`,`safe_binding_pending`]);function Zf(e){return e.mode===`running`||Xf.has(e.currentStep)}var Qf={wallet:{phase:1,subState:null},safe_predicted:{phase:1,subState:null},awaiting_funding:{phase:2,subState:null},safe_deployed:{phase:3,subState:`Deploying`},service_created:{phase:3,subState:`Deploying`},service_activated:{phase:3,subState:`Deploying`},agents_registered:{phase:3,subState:`Deploying`},service_deployed:{phase:3,subState:`Deploying`},service_staked:{phase:3,subState:`Deploying`},staked:{phase:3,subState:`Deploying`},mech_deployed:{phase:3,subState:`Joining the network`},agent_registered:{phase:3,subState:`Joining the network`},safe_binding_pending:{phase:3,subState:`Binding identity`}};function $f(e){return Qf[e]??{phase:1,subState:null}}function ep(e,t,n){return e<t?e===2&&n===!1?`active`:`done`:e===t?`active`:`queued`}var tp=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--accent-gold)]`;function np(){let e=Ye(),{data:t,isLoading:n}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap(),refetchInterval:2e3}),[r,i]=(0,L.useState)(null),a=(0,L.useCallback)(e=>i(e),[]),o=Object.keys(t?.joinedSolverNets??{}),s=o[0],c=dt({mutationFn:async()=>{s&&r&&await B.operator.join(s,{roles:[`solver`],harness:r.harness,model:r.model}),await B.operator.completeOnboarding()},onSuccess:()=>{e.invalidateQueries({queryKey:[`bootstrap`]})}}),l=(0,L.useCallback)(()=>{e.invalidateQueries({queryKey:[`bootstrap`]})},[e]),u=o.length>0&&r?.ready===!0&&!!r?.model;if(n||!t)return(0,R.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background`,children:(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Connecting…`})});let d=t.chain===`base`?`https://basescan.org`:`https://sepolia.basescan.org`,f=t.master_address??``,{phase:p,subState:m}=$f(t.currentStep),h=Zf(t)?o.length>0?5:4:p,g=t.error,_=t.services??[],v=_.find(e=>e.step===t.currentStep)??_[0],y=t.funding?.targetMet,b=Zo().embeddedAgent;return(0,R.jsx)(`div`,{className:`min-h-screen w-full bg-background text-foreground`,children:(0,R.jsxs)(`div`,{className:`mx-auto grid max-w-[1280px] grid-cols-12 gap-10 px-10 py-10`,children:[(0,R.jsxs)(`section`,{className:U(`col-span-12 flex flex-col gap-8`,b&&`lg:col-span-7`),children:[(0,R.jsxs)(`header`,{className:`flex items-baseline justify-between`,children:[(0,R.jsx)(`span`,{className:tp,children:`Jinn · Onboarding`}),(0,R.jsx)(rd,{chain:t.chain})]}),(0,R.jsx)(`h1`,{className:`font-serif text-[76px] leading-[1.05] text-foreground`,children:`Welcome to Jinn.`}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-testid":`onboarding-progress`,"aria-label":`Onboarding progress`,children:[(0,R.jsx)(Fo,{value:Math.min(100,(h-1)/4*100)}),(0,R.jsxs)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:[`Phase `,h,` of 5`]})]}),(0,R.jsx)(`ol`,{className:`flex flex-col`,children:[1,2,3,4,5].map(e=>{let n=ep(e,h,y),r=g&&e===h&&e<=3;return(0,R.jsxs)(od,{phase:e,status:r?`error`:n,children:[r&&(0,R.jsx)(Qo,{envelope:g,chainExplorerBase:d}),!r&&e===2&&n===`active`&&f&&(0,R.jsx)(zo,{address:f,minimumWei:t.funding?.targetWei??`10000000000000000`,currentBalanceWei:t.funding?.eth_balance,chainExplorerBase:d,chain:t.chain,onSharedDefaultRpc:t.rpcUrl===t.defaultRpcUrl}),!r&&e===3&&n===`active`&&(0,R.jsx)(sd,{label:m??`Working`,step:t.currentStep,serviceIndex:v?.index,serviceId:v?.service_id,safeAddress:v?.safe_address,explorer:d,contractRevertReason:v?.error_revert_reason??null}),e===4&&n===`active`&&(0,R.jsx)(md,{onJoined:l,joinedCids:o}),e===5&&n===`active`&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,R.jsx)(Yf,{onSelectionChange:a}),c.isError&&(0,R.jsxs)(fo,{variant:`blocking`,"data-testid":`onboarding-enter-error`,children:[(0,R.jsx)(po,{children:`Could not enter the dashboard.`}),(0,R.jsx)(mo,{children:`Saving your harness selection or completing onboarding failed. Try again; check daemon logs if it keeps failing.`})]}),(0,R.jsx)(W,{"data-testid":`onboarding-enter-dashboard`,disabled:!u||c.isPending,onClick:()=>c.mutate(),className:`self-start`,children:c.isPending?`Starting…`:`Enter dashboard`})]})]},e)})})]}),b&&(0,R.jsxs)(`aside`,{className:`col-span-12 flex flex-col gap-3 lg:col-span-5`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Ask Claude`}),(0,R.jsx)(G,{className:`h-[calc(100vh-220px)] min-h-[520px] overflow-hidden p-0`,children:(0,R.jsx)(Jo,{agentGated:!1})})]})]})})}var rp=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--accent-gold)]`,ip=`font-serif font-normal leading-[1.05] text-foreground text-[64px]`;function ap({connection:e}){let[t,n]=(0,L.useState)(!1);return(0,R.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background px-10 py-16 text-foreground`,"data-testid":`daemon-offline-screen`,children:(0,R.jsxs)(`div`,{className:`flex w-full max-w-xl flex-col gap-6`,children:[(0,R.jsx)(`span`,{className:rp,children:`Jinn · offline`}),(0,R.jsx)(`h1`,{className:ip,children:`Daemon not running.`}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`p`,{className:`font-mono text-sm text-[var(--fg-muted)]`,children:`Open a terminal and run:`}),(0,R.jsx)(`code`,{className:`self-start rounded bg-[var(--bg-elevated)] px-2 py-1 font-mono text-sm text-foreground`,children:`jinn run`}),(0,R.jsx)(`p`,{className:`font-mono text-xs text-[var(--fg-dim)]`,children:`(or the command you originally used to start it)`})]}),(0,R.jsxs)(`p`,{className:`font-mono text-sm text-[var(--fg-muted)]`,children:[`Reconnecting…`,e.attempts>0&&(0,R.jsxs)(`span`,{className:`ml-1 text-[var(--fg-dim)]`,children:[`(attempt `,e.attempts,`)`]})]}),(0,R.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start text-[var(--fg-dim)] hover:text-foreground`,onClick:()=>n(e=>!e),"aria-expanded":t,children:[t?(0,R.jsx)(Cn,{}):(0,R.jsx)(xn,{}),t?`Hide details`:`Show details`]}),t&&e.lastError&&(0,R.jsx)(G,{className:`bg-[var(--bg-elevated)]`,children:(0,R.jsx)(Hi,{className:`px-3 py-2`,children:(0,R.jsx)(`p`,{className:`font-mono text-xs text-[var(--fg-muted)]`,children:e.lastError})})})]})})}var op={blocking:`border-l-[var(--severity-blocking-fg)] bg-[var(--severity-blocking-bg)]`,warning:`border-l-[var(--severity-warning-fg)] bg-[var(--severity-warning-bg)]`,info:`border-l-[var(--severity-info-fg)]`},sp={blocking:`text-[var(--severity-blocking-fg)]`,warning:`text-[var(--severity-warning-fg)]`,info:`text-[var(--severity-info-fg)]`};function cp({notice:e}){return(0,R.jsxs)(`li`,{"data-kind":e.kind,"data-severity":e.severity,"aria-label":`${e.severity} notice: ${e.message}`,className:U(`flex items-baseline gap-3 border-l-2 px-4 py-2 font-mono text-[12px] text-foreground`,op[e.severity]),children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:U(`min-w-[64px] font-mono text-[11px] font-medium uppercase tracking-[0.14em]`,sp[e.severity]),children:e.severity}),(0,R.jsx)(`span`,{className:`flex-1`,children:e.message}),e.jumpTo?(0,R.jsx)($t,{href:e.jumpTo,className:`font-mono text-[var(--accent-sky)] no-underline hover:text-[var(--accent-sky-hover)]`,children:`resolve →`}):null]})}function lp({notices:e}){return e.length===0?null:(0,R.jsx)(`section`,{"aria-label":`Notifications`,role:`region`,children:(0,R.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.map((e,t)=>(0,R.jsx)(cp,{notice:e},`${e.kind}-${t}`))})})}var up=(0,L.createContext)({restartPending:!1,setRestartPending:()=>{}});function dp(){return(0,L.useContext)(up)}var fp=3,pp=1e3*60*60*24*90;function mp(e){if(!e||e.balanceWei===void 0)return null;try{if(e.minEthWei!==void 0&&BigInt(e.balanceWei)<BigInt(e.minEthWei))return`blocking`}catch{}let t=Number(e.runwayDaysExcess);return Number.isFinite(t)&&t<fp?`warning`:null}function hp(e){let t=[],n=e.status;e.bootstrap.mode!==`running`&&t.push({kind:`bootstrap_blocked`,severity:`blocking`,message:e.bootstrap.blockingReason??`Bootstrap incomplete`,jumpTo:`/`});for(let e of n.funds.chains){let n=e.wallet??`wallet`;if(e.empty){t.push({kind:`funding_empty`,severity:`blocking`,message:`Gas exhausted — ${n} on ${e.chain} can't cover the next transaction.`,jumpTo:`/overview`});continue}e.runwayDays<fp&&t.push({kind:`funding_low`,severity:`warning`,message:`Gas runway low — ${n} on ${e.chain} below threshold; top up soon.`,jumpTo:`/overview`})}if(!n.harness.ready){let e=n.harness.name===null?`A harness`:`Harness ${n.harness.name}`,r=n.harness.reason?`: ${n.harness.reason}`:``;t.push({kind:`harness_not_ready`,severity:`blocking`,message:`${e} is not ready${r}.`,jumpTo:`/operator/memberships`})}return n.rpc.reachable||t.push({kind:`rpc_unreachable`,severity:`blocking`,message:`RPC endpoint is unreachable.`,jumpTo:`/operator/network`}),Object.keys(n.joinedSolverNets).length===0&&e.bootstrap.mode===`running`&&t.push({kind:`no_solvernets_joined`,severity:`info`,message:`No SolverNets joined. Browse the registry to start earning.`,jumpTo:`/operator/registry`}),n.services.some(e=>!e.safeBound)&&t.push({kind:`safe_binding_pending`,severity:`warning`,message:`Safe wallet binding is pending.`,jumpTo:`/overview`}),n.restartPending&&t.push({kind:`restart_required`,severity:`warning`,message:`A configuration change is pending — restart to apply.`,jumpTo:`/overview`}),n.latestVersion&&n.latestVersion!==n.daemonVersion&&t.push({kind:`update_available`,severity:`info`,message:`Daemon ${n.latestVersion} available (running ${n.daemonVersion}).`}),n.passwordRotatedAt&&(e.now??Date.now())-new Date(n.passwordRotatedAt).getTime()>pp&&t.push({kind:`password_rotation_due`,severity:`info`,message:`Keystore password is over 90 days old.`,jumpTo:`/operator/security`}),t}var gp={blocking:0,warning:1,info:2},_p=1800*1e3,vp=60*1e3,yp=[`intent`];function bp(e,t){if(!t||t.balanceWei===void 0)return null;let n=1/0;if(t.runwayDaysExcess!==void 0&&t.runwayDaysExcess!==null){let e=Number(t.runwayDaysExcess);Number.isFinite(e)&&(n=e)}let r=mp(t)===`blocking`;return{chain:e,wallet:t.address??null,runwayDays:n,empty:r}}function xp(e,t,n){let r=e??{},i=t??{},a=[],o=bp(`Base Sepolia`,r.masterGas);o&&a.push(o);let s=bp(`Ethereum Sepolia`,r.l1MasterGas);s&&a.push(s);let c=Array.isArray(r.fleet?.services)?r.fleet.services:[],l=i.joinedSolverNets&&typeof i.joinedSolverNets==`object`?i.joinedSolverNets:{};return{funds:{eth:String(r.masterGas?.balanceWei??`0`),chains:a},harness:{ready:r.harness?.ready!==!1,name:typeof r.harness?.name==`string`?r.harness.name:null,reason:typeof r.harness?.reason==`string`?r.harness.reason:null},rpc:{reachable:!0},restartPending:n,daemonVersion:String(r.version??`0.0.0`),latestVersion:typeof r.latestVersion==`string`?r.latestVersion:void 0,services:c.map(e=>({safeBound:e?.safeBoundToAgent!==!1})),joinedSolverNets:l,passwordRotatedAt:typeof r.security?.lastPasswordRotationAt==`string`?r.security.lastPasswordRotationAt:void 0}}function Sp(){let e=sn(),{restartPending:t}=dp(),n=ut({queryKey:[`status`],queryFn:()=>B.getStatus()}),r=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap()}),{events:i}=Un(yp),[a,o]=(0,L.useState)(()=>Date.now());(0,L.useEffect)(()=>{let e=setInterval(()=>o(Date.now()),vp);return()=>clearInterval(e)},[]);let s=(0,L.useMemo)(()=>{let e=a-_p,t=new Set,n=i.filter(n=>{if(n.kind!==`intent`||n.errorCode!==`claim_failed`)return!1;let r=Date.parse(n.ts);return Number.isNaN(r)||r<e||t.has(n.id)?!1:(t.add(n.id),!0)});if(n.length===0)return null;let r=n.length;return{kind:`claim_failed`,severity:`warning`,message:`${r} claim attempt${r===1?``:`s`} failed in the last 30 minutes. Check Tasks for details.`,jumpTo:`/overview`,details:{count:r,sinceMs:e}}},[i,a]);return(0,L.useMemo)(()=>{if(e.status===`disconnected`)return[{kind:`rpc_unreachable`,severity:`blocking`,message:`Daemon offline. What you see may be stale. Reconnecting automatically…`}];if(!n.data||!r.data)return[];let i=hp({bootstrap:r.data,status:xp(n.data,r.data,t)});return(s?[...i,s]:[...i]).sort((e,t)=>gp[e.severity]-gp[t.severity])},[e.status,t,n.data,r.data,s])}function Cp({header:e,tabs:t,rail:n,children:r}){let i=n!=null,a=Sp(),o=a.length>0?`grid-rows-[auto_auto_auto_minmax(0,1fr)]`:`grid-rows-[auto_auto_minmax(0,1fr)]`;return(0,R.jsxs)(`div`,{className:U(`grid h-screen w-full overflow-hidden bg-background text-foreground`,i?`grid-cols-[1fr_320px]`:`grid-cols-1`,o),children:[(0,R.jsx)(`div`,{className:`col-span-full border-b border-border`,children:e}),(0,R.jsx)(`div`,{className:`col-span-full border-b border-border`,children:t}),a.length>0&&(0,R.jsx)(`div`,{className:`col-span-full border-b border-border`,children:(0,R.jsx)(lp,{notices:a})}),(0,R.jsx)(`main`,{className:`min-h-0 overflow-y-auto`,children:r}),i&&(0,R.jsx)(`aside`,{className:`h-full min-h-0 overflow-y-auto border-l border-border`,children:n})]})}function wp(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;let n=document.implementation.createHTMLDocument(),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}var Tp=(()=>{let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function Ep(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}var Dp=null;function Op(e={}){return Dp||(e.includeStyleProperties?(Dp=e.includeStyleProperties,Dp):(Dp=Ep(window.getComputedStyle(document.documentElement)),Dp))}function kp(e,t){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace(`px`,``)):0}function Ap(e){let t=kp(e,`border-left-width`),n=kp(e,`border-right-width`);return e.clientWidth+t+n}function jp(e){let t=kp(e,`border-top-width`),n=kp(e,`border-bottom-width`);return e.clientHeight+t+n}function Mp(e,t={}){return{width:t.width||Ap(e),height:t.height||jp(e)}}function Np(){let e,t;try{t=process}catch{}let n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}var Pp=16384;function Fp(e){(e.width>Pp||e.height>Pp)&&(e.width>Pp&&e.height>Pp?e.width>e.height?(e.height*=Pp/e.width,e.width=Pp):(e.width*=Pp/e.height,e.height=Pp):e.width>Pp?(e.height*=Pp/e.width,e.width=Pp):(e.width*=Pp/e.height,e.height=Pp))}function Ip(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=n,r.crossOrigin=`anonymous`,r.decoding=`async`,r.src=e})}async function Lp(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function Rp(e,t,n){let r=`http://www.w3.org/2000/svg`,i=document.createElementNS(r,`svg`),a=document.createElementNS(r,`foreignObject`);return i.setAttribute(`width`,`${t}`),i.setAttribute(`height`,`${n}`),i.setAttribute(`viewBox`,`0 0 ${t} ${n}`),a.setAttribute(`width`,`100%`),a.setAttribute(`height`,`100%`),a.setAttribute(`x`,`0`),a.setAttribute(`y`,`0`),a.setAttribute(`externalResourcesRequired`,`true`),i.appendChild(a),a.appendChild(e),Lp(i)}var zp=(e,t)=>{if(e instanceof t)return!0;let n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||zp(n,t)};function Bp(e){let t=e.getPropertyValue(`content`);return`${e.cssText} content: '${t.replace(/'|"/g,``)}';`}function Vp(e,t){return Op(t).map(t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?` !important`:``};`).join(` `)}function Hp(e,t,n,r){let i=`.${e}:${t}`,a=n.cssText?Bp(n):Vp(n,r);return document.createTextNode(`${i}{${a}}`)}function Up(e,t,n,r){let i=window.getComputedStyle(e,n),a=i.getPropertyValue(`content`);if(a===``||a===`none`)return;let o=Tp();try{t.className=`${t.className} ${o}`}catch{return}let s=document.createElement(`style`);s.appendChild(Hp(o,n,i,r)),t.appendChild(s)}function Wp(e,t,n){Up(e,t,`:before`,n),Up(e,t,`:after`,n)}var Gp=`application/font-woff`,Kp=`image/jpeg`,qp={woff:Gp,woff2:Gp,ttf:`application/font-truetype`,eot:`application/vnd.ms-fontobject`,png:`image/png`,jpg:Kp,jpeg:Kp,gif:`image/gif`,tiff:`image/tiff`,svg:`image/svg+xml`,webp:`image/webp`};function Jp(e){let t=/\.([^./]*?)$/g.exec(e);return t?t[1]:``}function Yp(e){return qp[Jp(e).toLowerCase()]||``}function Xp(e){return e.split(/,/)[1]}function Zp(e){return e.search(/^(data:)/)!==-1}function Qp(e,t){return`data:${t};base64,${e}`}async function $p(e,t,n){let r=await fetch(e,t);if(r.status===404)throw Error(`Resource "${r.url}" not found`);let i=await r.blob();return new Promise((e,t)=>{let a=new FileReader;a.onerror=t,a.onloadend=()=>{try{e(n({res:r,result:a.result}))}catch(e){t(e)}},a.readAsDataURL(i)})}var em={};function tm(e,t,n){let r=e.replace(/\?.*/,``);return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,``)),t?`[${t}]${r}`:r}async function nm(e,t,n){let r=tm(e,t,n.includeQueryParams);if(em[r]!=null)return em[r];n.cacheBust&&(e+=(/\?/.test(e)?`&`:`?`)+new Date().getTime());let i;try{i=Qp(await $p(e,n.fetchRequestInit,({res:e,result:n})=>(t||=e.headers.get(`Content-Type`)||``,Xp(n))),t)}catch(t){i=n.imagePlaceholder||``;let r=`Failed to fetch resource: ${e}`;t&&(r=typeof t==`string`?t:t.message),r&&console.warn(r)}return em[r]=i,i}async function rm(e){let t=e.toDataURL();return t===`data:,`?e.cloneNode(!1):Ip(t)}async function im(e,t){if(e.currentSrc){let t=document.createElement(`canvas`),n=t.getContext(`2d`);return t.width=e.clientWidth,t.height=e.clientHeight,n?.drawImage(e,0,0,t.width,t.height),Ip(t.toDataURL())}let n=e.poster;return Ip(await nm(n,Yp(n),t))}async function am(e,t){try{if(e?.contentDocument?.body)return await hm(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function om(e,t){return zp(e,HTMLCanvasElement)?rm(e):zp(e,HTMLVideoElement)?im(e,t):zp(e,HTMLIFrameElement)?am(e,t):e.cloneNode(cm(e))}var sm=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SLOT`,cm=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SVG`;async function lm(e,t,n){if(cm(t))return t;let r=[];return r=sm(e)&&e.assignedNodes?Ep(e.assignedNodes()):zp(e,HTMLIFrameElement)&&e.contentDocument?.body?Ep(e.contentDocument.body.childNodes):Ep((e.shadowRoot??e).childNodes),r.length===0||zp(e,HTMLVideoElement)||await r.reduce((e,r)=>e.then(()=>hm(r,n)).then(e=>{e&&t.appendChild(e)}),Promise.resolve()),t}function um(e,t,n){let r=t.style;if(!r)return;let i=window.getComputedStyle(e);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):Op(n).forEach(n=>{let a=i.getPropertyValue(n);n===`font-size`&&a.endsWith(`px`)&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),zp(e,HTMLIFrameElement)&&n===`display`&&a===`inline`&&(a=`block`),n===`d`&&t.getAttribute(`d`)&&(a=`path(${t.getAttribute(`d`)})`),r.setProperty(n,a,i.getPropertyPriority(n))})}function dm(e,t){zp(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),zp(e,HTMLInputElement)&&t.setAttribute(`value`,e.value)}function fm(e,t){if(zp(e,HTMLSelectElement)){let n=t,r=Array.from(n.children).find(t=>e.value===t.getAttribute(`value`));r&&r.setAttribute(`selected`,``)}}function pm(e,t,n){return zp(t,Element)&&(um(e,t,n),Wp(e,t,n),dm(e,t),fm(e,t)),t}async function mm(e,t){let n=e.querySelectorAll?e.querySelectorAll(`use`):[];if(n.length===0)return e;let r={};for(let i=0;i<n.length;i++){let a=n[i].getAttribute(`xlink:href`);if(a){let n=e.querySelector(a),i=document.querySelector(a);!n&&i&&!r[a]&&(r[a]=await hm(i,t,!0))}}let i=Object.values(r);if(i.length){let t=`http://www.w3.org/1999/xhtml`,n=document.createElementNS(t,`svg`);n.setAttribute(`xmlns`,t),n.style.position=`absolute`,n.style.width=`0`,n.style.height=`0`,n.style.overflow=`hidden`,n.style.display=`none`;let r=document.createElementNS(t,`defs`);n.appendChild(r);for(let e=0;e<i.length;e++)r.appendChild(i[e]);e.appendChild(n)}return e}async function hm(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(e=>om(e,t)).then(n=>lm(e,n,t)).then(n=>pm(e,n,t)).then(e=>mm(e,t))}var gm=/url\((['"]?)([^'"]+?)\1\)/g,_m=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,vm=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function ym(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}function bm(e){let t=[];return e.replace(gm,(e,n,r)=>(t.push(r),e)),t.filter(e=>!Zp(e))}async function xm(e,t,n,r,i){try{let a=n?wp(t,n):t,o=Yp(t),s;return s=i?Qp(await i(a),o):await nm(a,o,r),e.replace(ym(t),`$1${s}$3`)}catch{}return e}function Sm(e,{preferredFontFormat:t}){return t?e.replace(vm,e=>{for(;;){let[n,,r]=_m.exec(e)||[];if(!r)return``;if(r===t)return`src: ${n};`}}):e}function Cm(e){return e.search(gm)!==-1}async function wm(e,t,n){if(!Cm(e))return e;let r=Sm(e,n);return bm(r).reduce((e,r)=>e.then(e=>xm(e,r,t,n)),Promise.resolve(r))}async function Tm(e,t,n){let r=t.style?.getPropertyValue(e);if(r){let i=await wm(r,null,n);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function Em(e,t){await Tm(`background`,e,t)||await Tm(`background-image`,e,t),await Tm(`mask`,e,t)||await Tm(`-webkit-mask`,e,t)||await Tm(`mask-image`,e,t)||await Tm(`-webkit-mask-image`,e,t)}async function Dm(e,t){let n=zp(e,HTMLImageElement);if(!(n&&!Zp(e.src))&&!(zp(e,SVGImageElement)&&!Zp(e.href.baseVal)))return;let r=n?e.src:e.href.baseVal,i=await nm(r,Yp(r),t);await new Promise((r,a)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){a(e)}}:a;let o=e;o.decode&&=r,o.loading===`lazy`&&(o.loading=`eager`),n?(e.srcset=``,e.src=i):e.href.baseVal=i})}async function Om(e,t){let n=Ep(e.childNodes).map(e=>km(e,t));await Promise.all(n).then(()=>e)}async function km(e,t){zp(e,Element)&&(await Em(e,t),await Dm(e,t),await Om(e,t))}function Am(e,t){let{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);let r=t.style;return r!=null&&Object.keys(r).forEach(e=>{n[e]=r[e]}),e}var jm={};async function Mm(e){let t=jm[e];return t??(t={url:e,cssText:await(await fetch(e)).text()},jm[e]=t,t)}async function Nm(e,t){let n=e.cssText,r=/url\(["']?([^"')]+)["']?\)/g,i=(n.match(/url\([^)]+\)/g)||[]).map(async i=>{let a=i.replace(r,`$1`);return a.startsWith(`https://`)||(a=new URL(a,e.url).href),$p(a,t.fetchRequestInit,({result:e})=>(n=n.replace(i,`url(${e})`),[i,e]))});return Promise.all(i).then(()=>n)}function Pm(e){if(e==null)return[];let t=[],n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,``),r=RegExp(`((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})`,`gi`);for(;;){let e=r.exec(n);if(e===null)break;t.push(e[0])}n=n.replace(r,``);let i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a=RegExp(`((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})`,`gi`);for(;;){let e=i.exec(n);if(e===null){if(e=a.exec(n),e===null)break;i.lastIndex=a.lastIndex}else a.lastIndex=i.lastIndex;t.push(e[0])}return t}async function Fm(e,t){let n=[],r=[];return e.forEach(n=>{if(`cssRules`in n)try{Ep(n.cssRules||[]).forEach((e,i)=>{if(e.type===CSSRule.IMPORT_RULE){let a=i+1,o=e.href,s=Mm(o).then(e=>Nm(e,t)).then(e=>Pm(e).forEach(e=>{try{n.insertRule(e,e.startsWith(`@import`)?a+=1:n.cssRules.length)}catch(t){console.error(`Error inserting rule from remote css`,{rule:e,error:t})}})).catch(e=>{console.error(`Error loading remote css`,e.toString())});r.push(s)}})}catch(i){let a=e.find(e=>e.href==null)||document.styleSheets[0];n.href!=null&&r.push(Mm(n.href).then(e=>Nm(e,t)).then(e=>Pm(e).forEach(e=>{a.insertRule(e,a.cssRules.length)})).catch(e=>{console.error(`Error loading remote stylesheet`,e)})),console.error(`Error inlining remote css file`,i)}}),Promise.all(r).then(()=>(e.forEach(e=>{if(`cssRules`in e)try{Ep(e.cssRules||[]).forEach(e=>{n.push(e)})}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}}),n))}function Im(e){return e.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>Cm(e.style.getPropertyValue(`src`)))}async function Lm(e,t){if(e.ownerDocument==null)throw Error(`Provided element is not within a Document`);return Im(await Fm(Ep(e.ownerDocument.styleSheets),t))}function Rm(e){return e.trim().replace(/["']/g,``)}function zm(e){let t=new Set;function n(e){(e.style.fontFamily||getComputedStyle(e).fontFamily).split(`,`).forEach(e=>{t.add(Rm(e))}),Array.from(e.children).forEach(e=>{e instanceof HTMLElement&&n(e)})}return n(e),t}async function Bm(e,t){let n=await Lm(e,t),r=zm(e);return(await Promise.all(n.filter(e=>r.has(Rm(e.style.fontFamily))).map(e=>{let n=e.parentStyleSheet?e.parentStyleSheet.href:null;return wm(e.cssText,n,t)}))).join(`
23
- `)}async function Vm(e,t){let n=t.fontEmbedCSS==null?t.skipFonts?null:await Bm(e,t):t.fontEmbedCSS;if(n){let t=document.createElement(`style`),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}async function Hm(e,t={}){let{width:n,height:r}=Mp(e,t),i=await hm(e,t,!0);return await Vm(i,t),await km(i,t),Am(i,t),await Rp(i,n,r)}async function Um(e,t={}){let{width:n,height:r}=Mp(e,t),i=await Ip(await Hm(e,t)),a=document.createElement(`canvas`),o=a.getContext(`2d`),s=t.pixelRatio||Np(),c=t.canvasWidth||n,l=t.canvasHeight||r;return a.width=c*s,a.height=l*s,t.skipAutoScale||Fp(a),a.style.width=`${c}`,a.style.height=`${l}`,t.backgroundColor&&(o.fillStyle=t.backgroundColor,o.fillRect(0,0,a.width,a.height)),o.drawImage(i,0,0,a.width,a.height),a}async function Wm(e,t={}){return(await Um(e,t)).toDataURL()}async function Gm(){try{return(await Wm(document.body,{canvasWidth:1600,cacheBust:!0})).replace(/^data:image\/png;base64,/,``)}catch{return}}function Km(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}var qm={background:`var(--bg-raised, var(--bg))`,border:`1px solid var(--border)`,borderRadius:`10px`,padding:`20px`,maxWidth:`420px`,fontFamily:`'JetBrains Mono', monospace`,fontSize:`12px`,color:`var(--fg)`};function Jm(){let[e,t]=(0,L.useState)(`idle`),[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(null);async function o(){t(`loading-manifest`),a(null);try{let e=await B.debugReport.manifest();r(e),t(`reviewing`)}catch(e){a(e instanceof Error?e.message:String(e)),t(`error`)}}function s(){t(`idle`),r(null),a(null)}async function c(){t(`building`),a(null);try{let e=await Gm();Km(await B.debugReport.download(e),`jinn-debug-report-${new Date().toISOString().slice(0,10)}.tar.gz`),s()}catch(e){a(e instanceof Error?e.message:String(e)),t(`error`)}}return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void o(),disabled:e===`loading-manifest`||e===`building`,style:{background:`transparent`,border:`1px solid var(--border)`,borderRadius:`6px`,padding:`4px 10px`,fontFamily:`'JetBrains Mono', monospace`,fontSize:`11px`,letterSpacing:`0.08em`,textTransform:`uppercase`,color:`var(--fg-muted)`,cursor:e===`building`?`wait`:`pointer`},children:e===`building`?`building report…`:`debug report`}),(e===`reviewing`||e===`building`||e===`error`)&&(0,R.jsx)(`div`,{role:`dialog`,"aria-label":`Download debug report`,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.45)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e3},onClick:s,children:(0,R.jsxs)(`div`,{style:qm,onClick:e=>e.stopPropagation(),children:[(0,R.jsx)(`h2`,{style:{fontFamily:`'Instrument Serif', 'Times New Roman', serif`,fontSize:`22px`,margin:`0 0 8px`,color:`var(--fg)`},children:`Download debug report`}),(0,R.jsx)(`p`,{style:{color:`var(--fg-muted)`,margin:`0 0 14px`,lineHeight:1.5},children:`A support bundle for debugging this daemon. Secret values in the config, logs, and events are redacted — but the screenshot is not (see below). Review what it contains:`}),n&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,R.jsx)(`div`,{style:{color:`var(--fg-dim)`,marginBottom:`4px`},children:`Bundle contents`}),(0,R.jsx)(`ul`,{style:{margin:0,paddingLeft:`18px`,color:`var(--fg)`},children:n.files.map(e=>(0,R.jsx)(`li`,{children:e},e))})]}),(0,R.jsxs)(`div`,{style:{marginBottom:`14px`},children:[(0,R.jsx)(`div`,{style:{color:`var(--fg-dim)`,marginBottom:`4px`},children:`Redacted`}),(0,R.jsx)(`ul`,{style:{margin:0,paddingLeft:`18px`,color:`var(--fg-muted)`},children:n.redaction.redacted.map(e=>(0,R.jsx)(`li`,{children:e},e))})]}),n.redaction.notRedacted&&n.redaction.notRedacted.length>0&&(0,R.jsxs)(`div`,{style:{marginBottom:`14px`},children:[(0,R.jsx)(`div`,{style:{color:`var(--break-red)`,marginBottom:`4px`},children:`Not redacted — review before sharing`}),(0,R.jsx)(`ul`,{style:{margin:0,paddingLeft:`18px`,color:`var(--fg-muted)`},children:n.redaction.notRedacted.map(e=>(0,R.jsx)(`li`,{children:e},e))})]})]}),i&&(0,R.jsx)(`p`,{style:{color:`var(--break-red)`,margin:`0 0 12px`},children:i}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`10px`,justifyContent:`flex-end`},children:[(0,R.jsx)(`button`,{type:`button`,onClick:s,style:{background:`transparent`,border:`1px solid var(--border)`,borderRadius:`6px`,padding:`6px 12px`,fontFamily:`'JetBrains Mono', monospace`,fontSize:`11px`,color:`var(--fg-muted)`,cursor:`pointer`},children:`Cancel`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void c(),disabled:e===`building`,style:{background:`var(--fg)`,border:`1px solid var(--fg)`,borderRadius:`6px`,padding:`6px 12px`,fontFamily:`'JetBrains Mono', monospace`,fontSize:`11px`,color:`var(--bg)`,cursor:e===`building`?`wait`:`pointer`},children:e===`building`?`Building…`:`Download`})]})]})})]})}function Ym({network:e}){return(0,R.jsxs)(`header`,{className:`flex items-center justify-between px-6 py-3.5`,children:[(0,R.jsx)($t,{href:`/overview`,className:`font-serif text-[26px] text-foreground no-underline`,children:`jinn operator`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(q,{variant:`outline`,children:e}),(0,R.jsx)(Jm,{})]})]})}var Xm=[{path:`/overview`,label:`Dashboard`},{path:`/events`,label:`Events`},{path:`/operator`,label:`Settings`}];function Zm(){let[e]=Kt(),t=e.split(/[?#]/)[0]||`/`,n=t===`/launcher`||t.startsWith(`/launcher/`),{data:r}=ut({queryKey:[`solvernets`,`launched`,`top-tabs`],queryFn:()=>B.solvernets.listLaunched(),refetchInterval:3e4,enabled:!n}),i=Zo().pluginBuilderUi?[...Xm,{path:`/build`,label:`Build`}]:Xm;return(0,R.jsx)(`nav`,{className:`-mb-px flex px-6`,children:(n||(r?.records.length??0)>0?[...i,{path:`/launcher`,label:`Launcher`}]:i).map(e=>{let n=t===e.path||t.startsWith(`${e.path}/`);return(0,R.jsx)($t,{href:e.path,"data-active":n?`true`:`false`,className:U(`border-b px-4 py-3.5 font-mono text-[11px] font-medium uppercase tracking-[0.14em] no-underline transition-colors`,n?`border-primary text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:e.label},e.path)})})}function Qm({agentGated:e}){return(0,R.jsxs)(`div`,{className:`agent-rail flex h-full min-w-0 flex-col gap-3 overflow-hidden p-4`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground [overflow-wrap:anywhere]`,children:`Claude`}),(0,R.jsx)(Jo,{agentGated:e})]})}function $m(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var eh=e=>{switch(e){case`success`:return rh;case`info`:return ah;case`warning`:return ih;case`error`:return oh;default:return null}},th=Array(12).fill(0),nh=({visible:e,className:t})=>L.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},L.createElement(`div`,{className:`sonner-spinner`},th.map((e,t)=>L.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),rh=L.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},L.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),ih=L.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},L.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),ah=L.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},L.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),oh=L.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},L.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),sh=L.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},L.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),L.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),ch=()=>{let[e,t]=L.useState(document.hidden);return L.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},lh=1,uh=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:lh++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0||e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],L.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(fh(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!L.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!L.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!L.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!L.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||lh++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},dh=(e,t)=>{let n=t?.id||lh++;return uh.addToast({title:e,...t,id:n}),n},fh=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,ph=Object.assign(dh,{success:uh.success,info:uh.info,warning:uh.warning,error:uh.error,custom:uh.custom,message:uh.message,promise:uh.promise,dismiss:uh.dismiss,loading:uh.loading},{getHistory:()=>uh.toasts,getToasts:()=>uh.getActiveToasts()});$m(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function mh(e){return e.label!==void 0}var hh=3,gh=`24px`,_h=`16px`,vh=4e3,yh=356,bh=14,xh=45,Sh=200;function Ch(...e){return e.filter(Boolean).join(` `)}function wh(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Th=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,D]=L.useState(null),[O,ee]=L.useState(null),[k,A]=L.useState(!1),[j,M]=L.useState(!1),[N,te]=L.useState(!1),[P,F]=L.useState(!1),[ne,re]=L.useState(!1),[ie,ae]=L.useState(0),[I,oe]=L.useState(0),se=L.useRef(n.duration||y||vh),ce=L.useRef(null),le=L.useRef(null),ue=c===0,de=c+1<=o,fe=n.type,pe=n.dismissible!==!1,me=n.className||``,he=n.descriptionClassName||``,ge=L.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),_e=L.useMemo(()=>n.closeButton??p,[n.closeButton,p]),ve=L.useMemo(()=>n.duration||y||vh,[n.duration,y]),ye=L.useRef(0),be=L.useRef(0),xe=L.useRef(0),Se=L.useRef(null),[Ce,we]=b.split(`-`),Te=L.useMemo(()=>s.reduce((e,t,n)=>n>=ge?e:e+t.height,0),[s,ge]),Ee=ch(),De=n.invert||t,Oe=fe===`loading`;be.current=L.useMemo(()=>ge*x+Te,[ge,Te]),L.useEffect(()=>{se.current=ve},[ve]),L.useEffect(()=>{A(!0)},[]),L.useEffect(()=>{let e=le.current;if(e){let t=e.getBoundingClientRect().height;return oe(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),L.useLayoutEffect(()=>{if(!k)return;let e=le.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,oe(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[k,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let ke=L.useCallback(()=>{M(!0),ae(be.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Sh)},[n,d,a,be]);L.useEffect(()=>{if(n.promise&&fe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||Ee?(()=>{if(xe.current<ye.current){let e=new Date().getTime()-ye.current;se.current-=e}xe.current=new Date().getTime()})():se.current!==1/0&&(ye.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),ke()},se.current)),()=>clearTimeout(e)},[u,i,n,fe,Ee,ke]),L.useEffect(()=>{n.delete&&(ke(),n.onDismiss==null||n.onDismiss.call(n,n))},[ke,n.delete]);function Ae(){return w?.loading?L.createElement(`div`,{className:Ch(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":fe===`loading`},w.loading):L.createElement(nh,{className:Ch(C?.loader,n?.classNames?.loader),visible:fe===`loading`})}let je=n.icon||w?.[fe]||eh(fe);return L.createElement(`li`,{tabIndex:0,ref:le,className:Ch(_,me,C?.toast,n?.classNames?.toast,C?.default,C?.[fe],n?.classNames?.[fe]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":k,"data-promise":!!n.promise,"data-swiped":ne,"data-removed":j,"data-visible":de,"data-y-position":Ce,"data-x-position":we,"data-index":c,"data-front":ue,"data-swiping":N,"data-dismissible":pe,"data-type":fe,"data-invert":De,"data-swipe-out":P,"data-swipe-direction":O,"data-expanded":!!(u||S&&k),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${j?ie:be.current}px`,"--initial-height":S?`auto`:`${I}px`,...m,...n.style},onDragEnd:()=>{te(!1),D(null),Se.current=null},onPointerDown:e=>{e.button!==2&&(Oe||!pe||(ce.current=new Date,ae(be.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(te(!0),Se.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(P||!pe)return;Se.current=null;let e=Number(le.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(le.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ce.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=xh||a>.11){ae(be.current),n.onDismiss==null||n.onDismiss.call(n,n),ee(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),ke(),F(!0);return}else{var o,s;(o=le.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=le.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}re(!1),te(!1),D(null)},onPointerMove:t=>{var n,r;if(!Se.current||!pe||window.getSelection()?.toString().length>0)return;let i=t.clientY-Se.current.y,a=t.clientX-Se.current.x,o=e.swipeDirections??wh(b);!E&&(Math.abs(a)>1||Math.abs(i)>1)&&D(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(E===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&re(!0),(n=le.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=le.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},_e&&!n.jsx&&fe!==`loading`?L.createElement(`button`,{"aria-label":T,"data-disabled":Oe,"data-close-button":!0,onClick:Oe||!pe?()=>{}:()=>{ke(),n.onDismiss==null||n.onDismiss.call(n,n)},className:Ch(C?.closeButton,n?.classNames?.closeButton)},w?.close??sh):null,(fe||n.icon||n.promise)&&n.icon!==null&&(w?.[fe]!==null||n.icon)?L.createElement(`div`,{"data-icon":``,className:Ch(C?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ae():null,n.type===`loading`?null:je):null,L.createElement(`div`,{"data-content":``,className:Ch(C?.content,n?.classNames?.content)},L.createElement(`div`,{"data-title":``,className:Ch(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?L.createElement(`div`,{"data-description":``,className:Ch(v,he,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),L.isValidElement(n.cancel)?n.cancel:n.cancel&&mh(n.cancel)?L.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{mh(n.cancel)&&pe&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),ke())},className:Ch(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,L.isValidElement(n.action)?n.action:n.action&&mh(n.action)?L.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{mh(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&ke())},className:Ch(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Eh(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function Dh(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?_h:gh;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var Oh=L.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=hh,toastOptions:g,dir:_=Eh(),gap:v=bh,icons:y,containerAriaLabel:b=`Notifications`}=e,[x,S]=L.useState([]),C=L.useMemo(()=>n?x.filter(e=>e.toasterId===n):x.filter(e=>!e.toasterId),[x,n]),w=L.useMemo(()=>Array.from(new Set([i].concat(C.filter(e=>e.position).map(e=>e.position)))),[C,i]),[T,E]=L.useState([]),[D,O]=L.useState(!1),[ee,k]=L.useState(!1),[A,j]=L.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),M=L.useRef(null),N=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),te=L.useRef(null),P=L.useRef(!1),F=L.useCallback(e=>{S(t=>(t.find(t=>t.id===e.id)?.delete||uh.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return L.useEffect(()=>uh.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{S(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{Wi.flushSync(()=>{S(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[x]),L.useEffect(()=>{if(d!==`system`){j(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?j(`dark`):j(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{j(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{j(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),L.useEffect(()=>{x.length<=1&&O(!1)},[x]),L.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;O(!0),(t=M.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===M.current||M.current?.contains(document.activeElement))&&O(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),L.useEffect(()=>{if(M.current)return()=>{te.current&&(te.current.focus({preventScroll:!0}),te.current=null,P.current=!1)}},[M.current]),L.createElement(`section`,{ref:t,"aria-label":`${b} ${N}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},w.map((t,n)=>{let[i,a]=t.split(`-`);return C.length?L.createElement(`ol`,{key:t,dir:_===`auto`?Eh():_,tabIndex:-1,ref:M,className:c,"data-sonner-toaster":!0,"data-sonner-theme":A,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${T[0]?.height||0}px`,"--width":`${yh}px`,"--gap":`${v}px`,...m,...Dh(l,u)},onBlur:e=>{P.current&&!e.currentTarget.contains(e.relatedTarget)&&(P.current=!1,te.current&&=(te.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||P.current||(P.current=!0,te.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{ee||O(!1)},onDragEnd:()=>O(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||k(!0)},onPointerUp:()=>k(!1)},C.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>L.createElement(Th,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:ee,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:F,toasts:C.filter(e=>e.position==n.position),heights:T.filter(e=>e.position==n.position),setHeights:E,expandByDefault:o,gap:v,expanded:D,swipeDirections:e.swipeDirections}))):null}))}),kh=L.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,R.jsx)(`div`,{ref:i,role:n?`none`:`separator`,"aria-orientation":t,className:U(`shrink-0 bg-border`,t===`horizontal`?`h-px w-full`:`h-full w-px`,e),...r}));kh.displayName=`Separator`;function Ah(e){if(e==null)return null;let t=e-Date.now();if(t<=0)return null;let n=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`}),r=Math.round(t/6e4);if(r<60)return n.format(r,`minute`);let i=Math.round(t/36e5);return i<24?n.format(i,`hour`):n.format(Math.round(t/864e5),`day`)}var jh=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,Mh=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,Nh=`font-mono text-[24px] font-medium tracking-[-0.01em] text-foreground`,Ph=`font-mono text-[12px] font-medium text-[var(--fg-muted)]`,Fh=`font-mono text-[12px] text-[var(--fg-dim)]`;function Ih(e,t,n){switch(e){case`ready`:return{value:t,copy:null};case`error`:return{value:`unavailable`,copy:n??`Your OLAS rewards are temporarily unavailable.`};case`pending`:return{value:`pending`,copy:`No rewards yet — they show up here as your node earns them.`}}}function Lh({totalEth:e,runwayDays:t,runwaySeverity:n=null,olasPending:r,olasClaimed:i,olasClaimedLast24h:a,olasState:o,olasError:s,lastClaimAt:c,lastPasswordRotationAt:l,onTopUp:u,onClaim:d,claimPending:f=!1,actionsDisabled:p=!1,topupDailyCap:m,topupCallsRemaining:h,topupCooldownExpiresAt:g}){let[,_]=Kt(),{value:v,copy:y}=Ih(o,r,s),b=Number.parseFloat(r),x=p||f||o!==`ready`||!(Number.isFinite(b)&&b>0),S=h!==void 0&&m!==void 0,C=S&&h===0,w=Ah(g),T=S?C?w?`Daily faucet cap reached · resets ${w}`:`Daily faucet cap reached`:`${h} of ${m} top-ups left today`:null;return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{role:`region`,"aria-label":`Wallet`,"data-testid":`wallet-card`,className:`flex flex-col gap-6 p-6`,children:[(0,R.jsx)(`span`,{className:jh,children:`Wallet`}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,"data-testid":`wallet-section-rewards`,children:[(0,R.jsx)(`span`,{className:Mh,children:`Rewards`}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,"data-testid":`olas-pending-region`,"aria-live":`polite`,"aria-atomic":`true`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Pending OLAS`}),(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`text-2xl font-bold tracking-tight`,"data-testid":`olas-pending-value`,style:o===`error`?{color:`var(--break-red)`}:void 0,children:v}),o===`ready`&&(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`OLAS`})]}),y&&(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`olas-pending-state`,children:y})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,"data-testid":`olas-claimed-24h-region`,"aria-live":`polite`,"aria-atomic":`true`,children:[(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Claimed last 24hrs`}),(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`text-base font-medium`,"data-testid":`olas-claimed-24h-value`,style:o===`error`?{color:`var(--break-red)`}:void 0,children:a??(o===`error`?`unavailable`:`pending`)}),a!==null&&(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`OLAS`})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Lifetime claimed`}),(0,R.jsx)(`span`,{className:`text-base font-medium`,"data-testid":`olas-claimed-value`,children:o===`error`?`unavailable`:i}),o!==`error`&&(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`OLAS`})]}),c&&(0,R.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`last claim `,(0,R.jsx)(`time`,{dateTime:c,children:c})]})]}),(0,R.jsx)(W,{variant:`secondary`,size:`sm`,"aria-label":`Claim OLAS`,onClick:d,disabled:x,"data-testid":`wallet-claim`,className:`self-start`,children:f?`Claiming OLAS`:`Claim OLAS`})]}),(0,R.jsx)(kh,{}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,"data-testid":`wallet-section-gas`,children:[(0,R.jsx)(`span`,{className:Mh,children:`Gas`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:Nh,children:e}),(0,R.jsx)(`span`,{className:Ph,children:`ETH`}),(0,R.jsx)(`span`,{className:Fh,children:`·`}),(0,R.jsxs)(`span`,{"data-testid":`wallet-runway`,"data-runway-severity":n??`none`,className:Fh,style:n===`blocking`?{color:`var(--severity-blocking-fg)`}:n===`warning`?{color:`var(--severity-warning-fg)`}:void 0,children:[t,`d runway`]})]}),(0,R.jsx)(W,{variant:`outline`,size:`sm`,"aria-label":`Top up from faucet`,onClick:u,disabled:p||C,"data-testid":`wallet-topup`,className:`self-start`,children:`Top up from faucet (free)`}),T&&(0,R.jsx)(`span`,{className:Fh,"data-testid":`wallet-topup-quota`,children:T})]}),(0,R.jsx)(kh,{}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,"data-testid":`wallet-section-password`,children:[(0,R.jsx)(`span`,{className:Mh,children:`Password`}),(0,R.jsxs)(`span`,{className:`font-mono text-[12px] text-[var(--fg-dim)]`,children:[`last rotated:`,` `,l?(0,R.jsx)(`time`,{dateTime:l,className:`text-[var(--fg-muted)]`,children:l}):(0,R.jsx)(`span`,{className:`text-[var(--fg-muted)]`,children:`never`})]}),(0,R.jsx)(W,{variant:`secondary`,size:`sm`,"aria-label":`Change password`,onClick:()=>_(`/operator/security`),"data-testid":`wallet-change-password`,className:`self-start`,children:`Change password`})]})]})})}var Rh=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,zh=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,Bh=`font-mono text-[14px] text-foreground`,Vh=`font-mono text-[14px] text-[var(--fg-muted)]`;function Hh(e){return e.length<10?e:`${e.slice(0,6)}…${e.slice(-4)}`}function Uh(){return(0,R.jsx)(`span`,{"data-testid":`identity-stat-empty`,className:Vh,children:`—`})}async function Wh(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select(),t.setSelectionRange(0,e.length);try{if(document.execCommand(`copy`)!==!0)throw Error(`Copy command failed`)}finally{t.remove()}}function Gh({label:e,children:t}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(`span`,{className:zh,children:e}),t]})}function Kh({label:e,address:t,testId:n}){return(0,R.jsx)(Gh,{label:e,children:t?(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,"data-testid":n,"aria-label":`Copy full ${e} address`,onClick:()=>{t&&Wh(t).catch(()=>{})},className:`cursor-copy border-0 bg-transparent p-0 text-left ${Bh}`,children:Hh(t)})}),(0,R.jsx)(nd,{children:t})]}):(0,R.jsx)(Uh,{})})}function qh({masterAddress:e,safeAddress:t,serviceId:n,agentId:r,services:i=[],bindingError:a}){let o=i.find(e=>e.agentId!==null&&!e.safeBoundToAgent),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(a??null),h=async()=>{if(o){u(!0),f(null),m(null);try{let e=(await B.retryAgentBinding({serviceIndex:o.index})).attempts[0];e?.status===`success`?(f(`success`),c(!1)):(f(`reverted`),m(e?.detail??`Bind reverted on chain.`))}catch(e){f(`reverted`),m(e instanceof Error?e.message:String(e))}finally{u(!1)}}};return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{role:`region`,"aria-label":`Identity`,"data-testid":`identity-card`,className:`flex flex-col gap-6 p-6`,children:[(0,R.jsx)(`span`,{className:Rh,children:`Identity`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-8`,children:[(0,R.jsx)(Gh,{label:`Service`,children:n===null?(0,R.jsx)(Uh,{}):(0,R.jsxs)(`span`,{"data-testid":`identity-service-id`,className:Bh,children:[`#`,n]})}),(0,R.jsx)(Gh,{label:`Agent`,children:(0,R.jsxs)(`span`,{className:`flex items-center gap-2 ${Bh}`,children:[r===null?(0,R.jsx)(Uh,{}):`#${r}`,o&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>c(e=>!e),className:`cursor-pointer rounded-full border border-[var(--wane)] bg-transparent px-1.5 py-px font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--wane)]`,children:`binding pending`}),d===`success`&&(0,R.jsx)(q,{variant:`success`,className:`rounded-full normal-case tracking-[0.12em]`,children:`bound`})]})}),(0,R.jsx)(Kh,{label:`Master`,address:e,testId:`identity-master-address`}),(0,R.jsx)(Kh,{label:`Safe`,address:t,testId:`identity-safe-address`})]}),o&&(0,R.jsxs)(fo,{variant:`warning`,"data-testid":`identity-state-message-safe-not-bound`,className:`flex flex-col gap-2`,children:[(0,R.jsxs)(mo,{children:[`Service #`,o.index,` Safe is not yet bound to agent #`,o.agentId,`. The bootstrap left it unbound; retry to attempt the ERC-1271 bind again.`]}),s&&p&&(0,R.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--break-red)]`,children:p}),(0,R.jsx)(W,{variant:`default`,size:`sm`,onClick:()=>{s||c(!0),h()},disabled:l,className:`self-start`,children:l?`Retrying…`:`Retry binding`})]}),r===null&&(0,R.jsx)(fo,{variant:`warning`,"data-testid":`identity-state-message-agent-id-not-minted`,children:(0,R.jsx)(mo,{children:`Agent ID has not yet been minted. The daemon mints it during bootstrap; if this persists, check the bootstrap logs.`})})]})})}var Jh=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,Yh=`flex items-center gap-2 font-mono text-[17px] font-medium text-foreground`;function Xh({tone:e}){return(0,R.jsx)(`span`,{"aria-hidden":`true`,className:U(`inline-block h-2 w-2 rounded-full`,e===`good`?`bg-[var(--vow-green)]`:e===`bad`?`bg-[var(--break-red)]`:`bg-[var(--fg-muted)]`)})}function Zh({daemonStatus:e,daemonStateMessage:t,rpcStatus:n,onRestart:r}){let[,i]=Kt(),[a,o]=(0,L.useState)(null),s=e===`running`,c=n===`healthy`;function l(){a||!r||(o(`restart`),Promise.resolve().then(r).catch(e=>console.error(`[node-health] restart failed:`,e)).finally(()=>o(null)))}return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{"data-testid":`node-health-card`,"aria-labelledby":`node-health-heading`,className:`flex flex-col gap-4 p-6`,children:[(0,R.jsx)(`h2`,{id:`node-health-heading`,className:U(Jh,`m-0 text-[var(--fg-dim)]`),children:`Node health`}),(0,R.jsxs)(`div`,{"data-testid":`node-health-daemon-row`,"data-status":e,className:`flex flex-col gap-2`,children:[(0,R.jsx)(`span`,{className:Jh,children:`Daemon`}),(0,R.jsxs)(`span`,{className:Yh,children:[(0,R.jsx)(Xh,{tone:s?`good`:`bad`}),s?`Running`:`Stopped`]}),t&&(0,R.jsx)(`span`,{"data-testid":`node-health-daemon-state`,className:`font-mono text-[12px] leading-snug text-[var(--fg-muted)]`,children:t}),(0,R.jsx)(`div`,{className:`mt-2 flex gap-2`,children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`span`,{tabIndex:s?-1:0,children:(0,R.jsx)(W,{variant:`outline`,size:`sm`,disabled:!s||a!==null,"data-testid":`node-health-restart`,onClick:l,children:a===`restart`?`Restarting...`:`Restart`})})}),(0,R.jsx)(nd,{children:s?`Restart the daemon. The dashboard reconnects when it comes back.`:`Daemon is stopped — re-run jinn from your terminal to start it.`})]})})]}),(0,R.jsxs)(`div`,{"data-testid":`node-health-rpc-row`,"data-status":n,className:`flex flex-col gap-2`,children:[(0,R.jsx)(`span`,{className:Jh,children:`RPC`}),(0,R.jsxs)(`span`,{className:Yh,children:[(0,R.jsx)(Xh,{tone:c?`good`:`bad`}),c?`Healthy`:`Unreachable`]}),(0,R.jsx)(`div`,{className:`mt-2 flex gap-2`,children:(0,R.jsx)(W,{variant:`outline`,size:`sm`,"data-testid":`node-health-rpc-settings`,onClick:()=>i(`/operator/network`),children:`Manage RPC`})})]})]})})}var Qh=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,R.jsx)(`table`,{ref:n,className:U(`w-full caption-bottom font-mono text-[12px]`,e),...t})}));Qh.displayName=`Table`;var $h=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`thead`,{ref:n,className:U(`[&_tr]:border-b [&_tr]:border-border`,e),...t}));$h.displayName=`TableHeader`;var eg=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`tbody`,{ref:n,className:U(`[&_tr:last-child]:border-0`,e),...t}));eg.displayName=`TableBody`;var tg=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`tfoot`,{ref:n,className:U(`border-t border-border bg-muted/50 font-medium [&>tr]:last:border-b-0`,e),...t}));tg.displayName=`TableFooter`;var ng=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`tr`,{ref:n,className:U(`border-b border-border transition-colors hover:bg-[var(--bg-sunken)]/50 data-[state=selected]:bg-[var(--bg-sunken)]`,e),...t}));ng.displayName=`TableRow`;var rg=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`th`,{ref:n,className:U(`h-8 px-2 text-left align-middle font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,e),...t}));rg.displayName=`TableHead`;var ig=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`td`,{ref:n,className:U(`px-2 py-2 align-middle`,e),...t}));ig.displayName=`TableCell`;var ag=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`caption`,{ref:n,className:U(`mt-4 text-[12px] text-[var(--fg-muted)]`,e),...t}));ag.displayName=`TableCaption`;var og=new Set([`DISCOVERED`,`CLAIMED`,`WAITING`,`PRE_SNAPSHOT`,`RUNNING`,`POST_SNAPSHOT`,`PACKAGING`,`DELIVERING`]);function sg(e,t=6,n=4){return e.length<=t+n+1?e:`${e.slice(0,t)}…${e.slice(-n)}`}function cg(e){return e===`restoration`?`solve`:e===`evaluation`?`evaluate`:`—`}function lg(e){return e===`COMPLETE`?{label:`succeeded`,detail:`COMPLETE`,tone:`good`}:e===`FAILED`?{label:`failed`,detail:`FAILED`,tone:`bad`}:e===`RACE_LOST`?{label:`race-lost`,detail:`RACE_LOST`,tone:`neutral`}:og.has(e)?{label:`active`,detail:e.toLowerCase().replace(/_/g,` `),tone:`active`}:{label:e.toLowerCase().replace(/_/g,` `),detail:e,tone:`neutral`}}function ug(e){return e===`bad`?`destructive`:e===`good`?`success`:e===`active`?`default`:`outline`}function dg(e,t){switch(e){case`pass`:return{label:`pass`,tone:`good`};case`fail`:return{label:`fail`,tone:`bad`};case`awaiting`:return{label:t===`evaluation`?`awaiting`:`awaiting eval`,tone:`neutral`};case`accepted`:return{label:`accepted`,tone:`good`};case`rejected`:return{label:`rejected`,tone:`bad`};default:return null}}function fg(e){if(!e)return`—`;let t=Math.floor((Date.now()-e)/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function pg(e){return e===`solving`||e===`solver`?`solver`:e===`evaluating`||e===`evaluator`?`evaluator`:e}var mg=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground m-0`;function hg({children:e,className:t}){return(0,R.jsx)(`h3`,{className:U(mg,t),children:e})}function gg({label:e,children:t}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(hg,{children:e}),(0,R.jsx)(`div`,{className:`font-mono text-[12px] text-foreground`,children:t})]})}function _g({joined:e,tasks:t}){let[,n]=Kt(),[r,i]=(0,L.useState)(e[0]?.manifestCid??e[0]?.name??null),a=(0,L.useMemo)(()=>e.find(e=>(e.manifestCid??e.name)===r)??e[0]??null,[e,r]),o=(0,L.useMemo)(()=>a?t.filter(t=>{if(t.state===`FAILED`){if(t.runStartedAt===null)return!1;let e=(t.failureReason??``).toLowerCase();if(e.includes(`not ready`)||e.includes(`not enabled`))return!1}return e.length<=1?!0:t.solverType&&a.solverType?t.solverType===a.solverType:t.manifestCid&&a.manifestCid?t.manifestCid===a.manifestCid:!0}):[],[t,a,e.length,r]);return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{role:`region`,"aria-label":`Activity`,"data-testid":`activity-card`,children:[(0,R.jsxs)(zi,{className:`flex flex-row items-center justify-between gap-3 pb-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(vn,{className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),(0,R.jsx)(Bi,{children:`Activity`})]}),(0,R.jsxs)(W,{variant:`secondary`,size:`sm`,"data-testid":`activity-view-event-log`,onClick:()=>n(`/events`),children:[(0,R.jsx)(Mn,{className:`h-3 w-3`,"aria-hidden":`true`}),`View event log`]})]}),(0,R.jsx)(Hi,{children:(0,R.jsxs)(`div`,{className:`grid items-start gap-6 [grid-template-columns:minmax(160px,200px)_minmax(0,1fr)_minmax(180px,220px)]`,children:[(0,R.jsxs)(`div`,{"data-testid":`activity-joined`,className:`flex min-w-0 flex-col gap-3`,children:[(0,R.jsx)(hg,{children:`Joined`}),e.length===0?(0,R.jsx)(`p`,{className:`m-0 font-mono text-[12px] text-muted-foreground`,children:`No SolverNets joined.`}):(0,R.jsx)(io,{className:`max-h-[280px]`,children:(0,R.jsx)(`div`,{className:`flex flex-col gap-1 pr-2`,children:e.map(e=>{let t=e.manifestCid??e.name,n=t===(a?.manifestCid??a?.name);return(0,R.jsx)(W,{variant:`ghost`,size:`sm`,"data-testid":`activity-joined-row-${t}`,"data-state":n?`active`:void 0,"aria-current":n?`true`:void 0,onClick:()=>i(t),className:U(`h-auto w-full justify-start gap-0 rounded-sm border-l-2 px-2.5 py-1.5 font-mono text-[12px] normal-case tracking-normal`,n?`border-l-primary bg-accent text-foreground`:`border-l-transparent text-muted-foreground hover:bg-accent hover:text-foreground`),children:(0,R.jsx)(`span`,{className:`truncate`,children:e.name})},t)})})}),(0,R.jsxs)(W,{variant:`outline`,size:`sm`,"data-testid":`activity-join-more`,onClick:()=>n(`/operator/registry`),className:`self-start`,children:[(0,R.jsx)(Ln,{className:`h-3 w-3`,"aria-hidden":`true`}),`Join more SolverNets`]})]}),(0,R.jsxs)(`div`,{"data-testid":`activity-tasks`,className:`flex min-w-0 flex-col gap-3`,children:[a&&(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[20px] font-normal leading-tight text-foreground`,children:a.name}),o.length===0?(0,R.jsx)(`p`,{className:`m-0 font-mono text-[12px] text-muted-foreground`,children:`No task runs recorded yet.`}):(0,R.jsx)(`div`,{"data-testid":`activity-tasks-table`,children:(0,R.jsxs)(Qh,{children:[(0,R.jsx)($h,{children:(0,R.jsxs)(ng,{className:`hover:bg-transparent`,children:[(0,R.jsx)(rg,{children:`Run`}),(0,R.jsx)(rg,{children:`Task`}),(0,R.jsx)(rg,{children:`State`}),(0,R.jsx)(rg,{children:`Outcome`}),(0,R.jsx)(rg,{children:`Started`})]})}),(0,R.jsx)(eg,{children:o.map(e=>{let t=lg(e.state),r=dg(e.outcome,e.taskRole),i=t.tone===`active`;return(0,R.jsxs)(ng,{"data-active":i?`true`:void 0,"data-testid":`activity-task-row-${e.requestId}`,className:U(`border-l-2`,i?`border-l-primary bg-primary/[0.06]`:`border-l-transparent`),children:[(0,R.jsx)(ig,{className:`text-muted-foreground`,children:cg(e.taskRole)}),(0,R.jsx)(ig,{children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,className:`bg-transparent p-0 font-mono text-[12px] text-[var(--accent-sky)] underline-offset-4 hover:underline`,onClick:()=>n(`/events?requestId=${encodeURIComponent(e.requestId)}`),children:sg(e.requestId)})}),(0,R.jsx)(nd,{children:e.requestId})]})}),(0,R.jsx)(ig,{children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,className:`cursor-help bg-transparent p-0`,children:(0,R.jsx)(q,{variant:ug(t.tone),children:t.label})})}),(0,R.jsx)(nd,{children:t.detail})]})}),(0,R.jsx)(ig,{children:r?(0,R.jsx)(q,{variant:ug(r.tone),children:r.label}):(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,R.jsx)(ig,{className:`text-muted-foreground`,children:fg(e.runStartedAt??e.stateUpdatedAt)})]},e.requestId)})})]})})]}),(0,R.jsxs)(`div`,{"data-testid":`activity-settings`,className:`flex min-w-0 flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,R.jsx)(hg,{children:`Settings`}),(0,R.jsxs)(W,{variant:`link`,size:`sm`,"data-testid":`activity-settings-edit`,onClick:()=>n(`/operator/memberships`),className:`h-auto gap-1 p-0 text-[11px] uppercase tracking-[0.14em]`,children:[(0,R.jsx)(In,{className:`h-3 w-3`,"aria-hidden":`true`}),`Edit`]})]}),a?(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsx)(gg,{label:`Roles`,children:a.roles.length===0?(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:a.roles.map(e=>(0,R.jsx)(q,{variant:`outline`,children:pg(e)},e))})}),(0,R.jsx)(kh,{}),(0,R.jsx)(gg,{label:`Harness`,children:a.harness??`—`}),(0,R.jsx)(kh,{}),(0,R.jsx)(gg,{label:`Model`,children:(0,R.jsx)(`span`,{className:U(!a.model&&`text-muted-foreground`),children:a.model??`—`})}),(0,R.jsx)(kh,{}),(0,R.jsx)(gg,{label:`Plugins`,children:!a.plugins||a.plugins.length===0?(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,R.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1.5 p-0`,children:a.plugins.map(e=>(0,R.jsxs)(`li`,{"data-testid":`activity-plugin-${e.name}`,className:`flex items-center gap-2 overflow-hidden`,children:[(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,className:`cursor-help truncate bg-transparent p-0 text-left font-mono text-[12px] text-foreground`,children:e.displayName})}),(0,R.jsx)(nd,{children:e.name})]}),e.defaultIncluded&&(0,R.jsx)(q,{variant:`secondary`,className:`shrink-0`,children:`default`})]},e.name))})})]}):(0,R.jsx)(`p`,{className:`m-0 font-mono text-[12px] text-muted-foreground`,children:`No SolverNet selected.`})]})]})})]})})}function vg(e){let t=new Date(e);return`${String(t.getUTCHours()).padStart(2,`0`)}:${String(t.getUTCMinutes()).padStart(2,`0`)} UTC`}function yg(e){return`$${(e/1e6).toFixed(4)}`}function bg({aiUnits:e}){if(!e)return null;let t=e.credentials.filter(e=>e.paused);return t.length===0?null:(0,R.jsx)(`div`,{className:`flex flex-col gap-2`,children:t.map(e=>{let t=typeof e.usdMicrosThisBlock==`number`&&typeof e.usdMicrosThisWeek==`number`&&typeof e.capPerBlockUsdMicros==`number`&&typeof e.capPerWeekUsdMicros==`number`,n=e.usdMicrosThisBlock??0,r=e.usdMicrosThisWeek??0,i=e.capPerBlockUsdMicros??0,a=e.capPerWeekUsdMicros??0,o=(t?n>=i:e.unitsThisBlock>=e.capPerBlock)?`block`:`week`,s=o===`block`?e.blockResetsAt:e.weekResetsAt,c=o===`block`?`6h`:`7d`,l=t?`${e.estimated?`estimated`:`metered`} ${o===`block`?`${yg(n)} / ${yg(i)}`:`${yg(r)} / ${yg(a)}`}`:o===`block`?`${e.unitsThisBlock} / ${e.capPerBlock} units`:`${e.unitsThisWeek} / ${e.capPerWeek} units`,u=o===`block`?`this block`:`this 7-day window`,d=e.active??!0;return(0,R.jsxs)(fo,{variant:`warning`,"data-testid":`ai-units-pause-alert-${e.credentialId}`,children:[(0,R.jsx)(Tn,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,R.jsxs)(po,{className:`font-mono text-[13px]`,children:[`Paused — `,c,` spend cap reached`,d?(0,R.jsx)(`span`,{className:`ml-2 text-foreground`,"data-testid":`ai-units-credential-state-${e.credentialId}`,children:`(Active)`}):null]}),(0,R.jsx)(mo,{className:`font-mono text-[12px] text-muted-foreground`,children:(0,R.jsxs)(`span`,{children:[`Credential `,(0,R.jsx)(`span`,{className:`text-foreground`,children:e.credentialId}),` used`,` `,l,` `,u,`. Claims resume at `,(0,R.jsx)(`span`,{className:`text-foreground`,children:vg(s)}),`.`]})})]},e.credentialId)})})}var xg=[{name:`network-tools`,version:`0.1.0`,defaultIncluded:!0},{name:`claude-code-learner`,version:`0.2.0`,defaultIncluded:!0}],Sg=new Set([`swe-rebench-v2-runtime`]),Cg={"network-tools":`Network Tools`,"claude-code-learner":`Learner`,"swe-rebench-v2-runtime":`SWE-rebench v2 Runtime`,"jinn-prediction-plugin":`Prediction Runtime`},wg=`bundled:`;function Tg(e){return Cg[e]??e}function Eg(e){return e.startsWith(wg)?e.slice(8):e}function Dg(e){let t=bd(e)===_d;return xg.filter(e=>!(t&&e.name===`claude-code-learner`)).map(e=>({name:e.name,displayName:Tg(e.name),source:`bundled`,version:e.version,defaultIncluded:!0}))}function Og({harness:e,explicit:t,disabledDefaults:n,catalogCompatible:r=[]}){let i=new Set(n.map(Eg)),a=new Set(t.map(Eg));new Map(t.map(e=>[Eg(e),e]));let o=[],s=new Set;for(let t of Dg(e))s.has(t.name)||(s.add(t.name),!i.has(t.name)&&o.push(t));for(let e of r){if(s.has(e.name))continue;s.add(e.name);let t=Sg.has(e.name),n=a.has(e.name);!t&&!n||t&&i.has(e.name)||o.push({name:e.name,displayName:Tg(e.name),source:`catalog`,version:e.version,defaultIncluded:t})}for(let e of t){let t=Eg(e);s.has(t)||(s.add(t),o.push({name:t,displayName:Tg(t),source:e.startsWith(wg)?`bundled`:`custom`,version:`configured`,defaultIncluded:!1}))}return o}function kg(e){if(!e||!/^\d+$/.test(e))return`—`;try{let t=BigInt(e);return(Number(t)/0xde0b6b3a7640000).toFixed(4)}catch{return`—`}}function Ag(e){return!e||e.length<12?e??null:`${e.slice(0,6)}…${e.slice(-4)}`}function jg(){let[e,t]=(0,L.useState)(null),n=Ye(),{data:r}=ut({queryKey:[`dripQuota`],queryFn:()=>B.getDripQuota(),refetchInterval:3e4}),{data:i,isError:a}=ut({queryKey:[`status`],queryFn:()=>B.getStatus(),refetchInterval:5e3}),{data:o,isError:s}=ut({queryKey:[`rewards`],queryFn:()=>B.getRewards(),refetchInterval:3e4}),{data:c}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap(),refetchInterval:3e4}),{data:l}=ut({queryKey:[`solvernets`,`catalog`],queryFn:()=>B.getSolverNets(),refetchInterval:5*6e4}),u=(i?.fleet?.services??[]).map(e=>({index:e.index,serviceId:e.serviceId??null,safeAddress:e.safeAddress??``,agentId:e.agentId??null,safeBoundToAgent:e.safeBoundToAgent??!1})),d=u.find(e=>e.serviceId!==null)?.serviceId??null,f=s||o?.readState===`error`?`error`:o?`ready`:`pending`,p=f===`ready`?kg(o?.totalPending??`0`):`—`,m=f===`ready`?kg(o?.totalClaimed??`0`):`—`,h=i?.rewards?.claimedStakingRewardsLast24hWei==null?i?`0.0000`:null:kg(i.rewards.claimedStakingRewardsLast24hWei),g=o?.error??(s?`OLAS rewards temporarily unavailable.`:null),_=kg(i?.masterGas?.balanceWei),v=i?.masterGas?.runwayDaysExcess??`—`,y=mp(i?.masterGas??{}),b=i?.balances?.eth,x=kg(b?.master?.balanceWei??void 0),S=kg(b?.agent?.balanceWei??void 0),C=kg(b?.safe?.balanceWei??void 0),w=(0,L.useMemo)(()=>{let e=[],t=c?.joinedSolverNets;if(!t)return e;for(let[n,r]of Object.entries(t)){if(!r)continue;let t=r.contract?l?.nets.find(e=>e.contract.id===r.contract?.id&&e.contract.version===r.contract?.version):void 0,i=Og({harness:r.harness,explicit:Array.isArray(r.plugins)?r.plugins:[],disabledDefaults:Array.isArray(r.disabledDefaultPlugins)?r.disabledDefaultPlugins:[],catalogCompatible:t?.compatiblePlugins});e.push({name:r.name??r.manifestCid??n,manifestCid:r.manifestCid??n,solverType:r.contract?`${r.contract.id}.${r.contract.version}`:void 0,roles:Array.isArray(r.roles)?r.roles:[],harness:r.harness,model:r.model,plugins:i})}return e},[c,l]),T=(0,L.useMemo)(()=>{let e=new Map,t=t=>{if(t)for(let n of t)n.requestId&&(e.has(n.requestId)||e.set(n.requestId,{requestId:n.requestId,manifestCid:n.manifestCid??null,solverType:n.solverType??null,taskRole:n.taskRole,state:n.state,implName:n.implName??null,windowStartTs:n.windowStartTs??0,runStartedAt:n.runStartedAt??null,stateUpdatedAt:n.stateUpdatedAt,deliveryTxHash:n.deliveryTxHash??null,failureReason:n.failureReason??null,outcome:n.outcome??null}))};return t(i?.taskRuns?.recentTasks),t(i?.taskRuns?.inFlight),t(i?.predictionV1?.recentTasks),Array.from(e.values()).sort((e,t)=>t.stateUpdatedAt-e.stateUpdatedAt)},[i]),E=a&&i===void 0?`stopped`:`running`,D=(e,n,r)=>{t(e),Promise.resolve().then(n).then(t=>{ph.success(e,{description:t?.message,duration:r?.autoClearMs??5e3})}).catch(t=>{ph.error(`${e} failed`,{description:t instanceof Error?t.message:String(t),duration:1/0})}).finally(()=>t(null))};return(0,R.jsxs)(`div`,{"data-testid":`overview-page-grid`,className:`grid items-start gap-6 p-6 [grid-template-columns:minmax(0,1fr)_minmax(0,380px)]`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,R.jsx)(bg,{aiUnits:i?.aiUnits}),(0,R.jsx)(_g,{joined:w,tasks:T})]}),(0,R.jsxs)(`aside`,{className:`flex flex-col gap-6`,children:[(0,R.jsx)(Zh,{daemonStatus:E,daemonStateMessage:void 0,rpcStatus:`healthy`,onStop:async()=>{if(!(await B.stopDaemon()).ok)throw Error(`Stop request failed.`)},onRestart:async()=>{if(!(await B.restartDaemon({forceRespawn:!0})).ok)throw Error(`Restart request failed.`)}}),(0,R.jsx)(qh,{masterAddress:c?.master_address??null,agentAddress:null,safeAddress:u[0]?.safeAddress??null,serviceId:d,agentId:u[0]?.agentId??null,services:u}),(0,R.jsx)(Lh,{totalEth:_,runwayDays:v,runwaySeverity:y,actionsDisabled:e!==null,perRole:{master:x,agent:S,safe:C},olasPending:p,olasClaimed:m,olasClaimedLast24h:h,olasState:f,olasError:g,lastClaimAt:o?.lastClaimAt??null,lastPasswordRotationAt:i?.security?.lastPasswordRotationAt??null,topupDailyCap:r?.dailyCap,topupCallsRemaining:r?.callsRemaining,topupCooldownExpiresAt:r?.cooldownExpiresAt??null,onTopUp:()=>D(`Top up gas`,async()=>{let e=await B.triggerDrip({batch:!0});if(n.invalidateQueries({queryKey:[`dripQuota`]}),!e.ok)throw e.reason===`topup_cooldown`?Error(`Daily faucet cap reached. Try again after the cooldown.`):Error(e.reason??`Gas top-up failed.`);let t=e.txHashes?.length??0;if(t===0)return{message:`Gas top-up checked; the faucet sent no funds.`};let r=Ag(e.txHashes.at(-1));return{message:t===1?`Gas topped up · tx ${r}`:`Gas topped up: ${t} drips · last tx ${r}`}},{autoClearMs:5e3}),onClaim:()=>D(`Claim OLAS`,async()=>{let e=await B.claimRewards();if(!e.ok)throw Error(e.error??`Reward claim failed.`);await Promise.all([n.invalidateQueries({queryKey:[`rewards`]}),n.invalidateQueries({queryKey:[`status`]}),n.invalidateQueries({queryKey:[`activity-events`]})]);let t=e.result?.submitted??0;if(t===0)return{message:`No pending OLAS to claim.`};let r=e.result?.claims?.map(e=>e.txHash).filter(e=>!!e).at(-1),i=Ag(r);return{message:i?`Claim submitted · tx ${i}`:`Claim submitted: ${t} claim${t===1?``:`s`}`}},{autoClearMs:5e3}),claimPending:e===`Claim OLAS`})]})]})}var Mg=[`task_posted`,`intent_registry_failed`,`request_claimed`,`delivery_submitted`,`evaluation_submitted`,`reward_claimed`,`balance_topup`,`engine_transition`,`tick_error`,`race_lost`,`startup`,`shutdown`],Ng={task_posted:{label:`Task posted`,description:`A new task intent was published on-chain.`,tone:`info`},intent_registry_failed:{label:`Intent registry failed`,description:`Posting a task intent to the registry did not succeed.`,tone:`error`},request_claimed:{label:`Request claimed`,description:`The solver claimed a task request to work on.`,tone:`info`},delivery_submitted:{label:`Delivery submitted`,description:`A completed solution was delivered on-chain.`,tone:`success`},evaluation_submitted:{label:`Evaluation submitted`,description:`An evaluation verdict was submitted for a delivery.`,tone:`success`},reward_claimed:{label:`Reward claimed`,description:`OLAS rewards were collected to your wallet.`,tone:`reward`},balance_topup:{label:`Balance top-up`,description:`Gas balance was topped up from the faucet.`,tone:`info`},engine_transition:{label:`Engine transition`,description:`A task run moved to a new lifecycle state.`,tone:`info`},tick_error:{label:`Tick error`,description:`An error occurred during a daemon polling tick.`,tone:`error`},race_lost:{label:`Race lost`,description:`A claim or evaluation lost the on-chain race (task already filled or evaluation deadline passed); no action needed.`,tone:`neutral`},startup:{label:`Daemon started`,description:`The jinn daemon process started.`,tone:`neutral`},shutdown:{label:`Daemon stopped`,description:`The jinn daemon process shut down.`,tone:`neutral`}};function Pg(e){let t=e.replace(/_/g,` `).trim();return t.length===0?`Event`:t.charAt(0).toUpperCase()+t.slice(1)}function Fg(e){return Ng[e]||{label:Pg(e),description:`A daemon lifecycle event.`,tone:`neutral`}}function Ig(e,t){if(t===`failed`)return`destructive`;if(t===`warn`)return`warning`;let n=Fg(e).tone;return n===`error`?`destructive`:n===`warning`?`warning`:n===`success`||n===`reward`?`success`:n===`neutral`?`secondary`:`default`}var Lg=50;function Rg(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().replace(`T`,` `).slice(0,19)}function zg(e,t=8,n=4){return e.length<=t+n+1?e:`${e.slice(0,t)}...${e.slice(-n)}`}function Bg(e){return e.requestId??e.solverType??`-`}function Vg(){let[e]=Kt();return(0,L.useMemo)(()=>{let t=e.includes(`?`)?e.split(`?`)[1]:``,n=typeof window>`u`?``:window.location.search.replace(/^\?/,``);return new URLSearchParams(t||n).get(`requestId`)?.trim()||void 0},[e])}function Hg({pageSize:e=Lg}={}){let t=Vg(),[n,r]=(0,L.useState)([]),[i,a]=(0,L.useState)(`all`),o=ft({queryKey:[`activity-events`,n,i,t,e],queryFn:({pageParam:r})=>B.getActivityEvents({kinds:n.length>0?n:void 0,outcome:i===`all`?void 0:i,requestId:t,beforeId:typeof r==`number`?r:void 0,limit:e}),initialPageParam:void 0,getNextPageParam:e=>e.nextCursor??void 0}),s=o.data?.pages??[],c=s.flatMap(e=>e.events),l=s[0]?.counts??{};function u(e){r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}return(0,R.jsxs)(`main`,{"data-testid":`events-page`,className:`mx-auto flex w-full max-w-6xl flex-col gap-5 p-6`,children:[(0,R.jsxs)(`header`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(`h1`,{className:`m-0 font-serif text-[32px] font-normal leading-tight text-foreground`,children:`Events`}),(0,R.jsx)(`p`,{className:`m-0 font-mono text-[12px] text-muted-foreground`,children:`Persistent lifecycle activity from this operator.`})]}),(0,R.jsx)(W,{asChild:!0,variant:`secondary`,size:`sm`,children:(0,R.jsx)($t,{href:`/overview`,"data-testid":`events-back`,children:`Overview`})})]}),t&&(0,R.jsxs)(fo,{variant:`info`,"data-testid":`events-request-scope`,children:[(0,R.jsx)(po,{children:`Request scoped`}),(0,R.jsxs)(mo,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)(`span`,{className:`break-all`,children:[`Showing events for `,t]}),(0,R.jsx)(W,{asChild:!0,variant:`link`,size:`sm`,className:`h-auto p-0`,children:(0,R.jsxs)($t,{href:`/events`,"data-testid":`events-clear-request`,children:[(0,R.jsx)(Hn,{"aria-hidden":`true`}),`Clear`]})})]})]}),(0,R.jsxs)(G,{children:[(0,R.jsxs)(zi,{children:[(0,R.jsx)(Bi,{children:`Filters`}),(0,R.jsx)(Vi,{children:`Kind and outcome filters page through the same durable log.`})]}),(0,R.jsxs)(Hi,{className:`flex flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Kind`}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Mg.map(e=>{let t=n.includes(e),r=Fg(e);return(0,R.jsxs)(W,{type:`button`,size:`sm`,variant:t?`outline`:`secondary`,"aria-pressed":t?`true`:`false`,"data-testid":`events-kind-filter-${e}`,onClick:()=>u(e),className:`normal-case tracking-normal`,children:[r.label,l[e]!==void 0&&(0,R.jsx)(q,{variant:`secondary`,children:l[e]})]},e)})})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Outcome`}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`all`,`ok`,`failed`,`warn`].map(e=>(0,R.jsx)(W,{type:`button`,size:`sm`,variant:i===e?`outline`:`secondary`,"aria-pressed":i===e?`true`:`false`,"data-testid":`events-outcome-${e}`,onClick:()=>a(e),children:e},e))})]})]})]}),(0,R.jsxs)(G,{"data-testid":`events-list-section`,children:[(0,R.jsxs)(zi,{children:[(0,R.jsx)(Bi,{children:`Event Log`}),(0,R.jsxs)(Vi,{children:[c.length,` loaded`]})]}),(0,R.jsxs)(Hi,{className:`flex flex-col gap-4`,children:[o.isLoading&&(0,R.jsxs)(`div`,{"data-testid":`events-loading`,className:`flex items-center gap-2 font-mono text-[12px] text-muted-foreground`,children:[(0,R.jsx)(Nn,{className:`animate-spin`,"aria-hidden":`true`}),`Loading events`]}),o.isError&&(0,R.jsxs)(fo,{variant:`blocking`,"data-testid":`events-error`,children:[(0,R.jsx)(po,{children:`Events unavailable`}),(0,R.jsxs)(mo,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsx)(`span`,{children:o.error instanceof Error?o.error.message:`Failed to load events.`}),(0,R.jsx)(W,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{o.refetch()},children:`Retry`})]})]}),!o.isLoading&&!o.isError&&c.length===0&&(0,R.jsx)(`p`,{"data-testid":`events-empty`,className:`m-0 font-mono text-[12px] text-muted-foreground`,children:`No events match the current filters.`}),c.length>0&&(0,R.jsx)(`div`,{"data-testid":`events-list`,className:`overflow-x-auto`,children:(0,R.jsxs)(Qh,{children:[(0,R.jsx)($h,{children:(0,R.jsxs)(ng,{className:`hover:bg-transparent`,children:[(0,R.jsx)(rg,{children:`Time`}),(0,R.jsx)(rg,{children:`Kind`}),(0,R.jsx)(rg,{children:`Subject`}),(0,R.jsx)(rg,{children:`Outcome`}),(0,R.jsx)(rg,{children:`Tx`}),(0,R.jsx)(rg,{className:`w-8`})]})}),(0,R.jsx)(eg,{children:c.map(e=>{let t=Fg(e.kind);return(0,R.jsxs)(ng,{"data-testid":`events-row`,children:[(0,R.jsx)(ig,{className:`whitespace-nowrap text-muted-foreground`,children:Rg(e.ts)}),(0,R.jsx)(ig,{children:(0,R.jsx)(q,{variant:Ig(e.kind,e.outcome),children:t.label})}),(0,R.jsx)(ig,{className:`max-w-[280px] font-mono text-[12px]`,children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`span`,{className:U(e.requestId&&`cursor-help`),children:e.requestId?zg(e.requestId):Bg(e)})}),e.requestId&&(0,R.jsx)(nd,{children:e.requestId})]})}),(0,R.jsx)(ig,{children:(0,R.jsx)(q,{variant:Ig(e.kind,e.outcome),children:e.outcome??`-`})}),(0,R.jsx)(ig,{className:`font-mono text-[12px] text-muted-foreground`,children:e.txHash?zg(e.txHash,6,4):`-`}),(0,R.jsx)(ig,{className:`text-right`,children:(0,R.jsx)(W,{asChild:!0,variant:`ghost`,size:`icon`,"aria-label":`Inspect event ${e.id}`,children:(0,R.jsx)($t,{href:`/events/${e.id}`,"data-testid":`events-row-link`,children:(0,R.jsx)(Sn,{"aria-hidden":`true`})})})})]},e.id)})})]})}),o.hasNextPage&&(0,R.jsxs)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`events-load-more`,disabled:o.isFetchingNextPage,onClick:()=>{o.fetchNextPage()},className:`self-start`,children:[o.isFetchingNextPage&&(0,R.jsx)(Nn,{className:`animate-spin`,"aria-hidden":`true`}),o.isFetchingNextPage?`Loading`:`Load more`]})]})]})]})}function Ug(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toISOString().replace(`T`,` `).slice(0,19)} UTC`}function Wg(e){return e===`base`?`https://basescan.org`:`https://sepolia.basescan.org`}function Gg({label:e,children:t}){return(0,R.jsxs)(`div`,{className:`grid gap-1 py-2 sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-4`,children:[(0,R.jsx)(`dt`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:e}),(0,R.jsx)(`dd`,{className:`m-0 break-all font-mono text-[12px] text-foreground`,children:t})]})}function Kg(){let e=Wt().id??``,{data:t}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap()}),{data:n,isLoading:r,isError:i,error:a,refetch:o}=ut({queryKey:[`activity-events`,`detail`,e],queryFn:()=>B.getActivityEvent(e),enabled:e.length>0}),s=n?Fg(n.kind):null,c=Wg(t?.chain);return(0,R.jsxs)(`main`,{"data-testid":`event-detail`,className:`mx-auto flex w-full max-w-4xl flex-col gap-5 p-6`,children:[(0,R.jsxs)(`header`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(`h1`,{className:`m-0 font-serif text-[32px] font-normal leading-tight text-foreground`,children:s?s.label:`Event`}),(0,R.jsxs)(`p`,{className:`m-0 font-mono text-[12px] text-muted-foreground`,children:[`Event `,e]})]}),(0,R.jsx)(W,{asChild:!0,variant:`secondary`,size:`sm`,children:(0,R.jsxs)($t,{href:`/events`,"data-testid":`event-detail-back`,children:[(0,R.jsx)(yn,{"aria-hidden":`true`}),`Events`]})})]}),r&&(0,R.jsxs)(`div`,{"data-testid":`event-detail-loading`,className:`flex items-center gap-2 font-mono text-[12px] text-muted-foreground`,children:[(0,R.jsx)(Nn,{className:`animate-spin`,"aria-hidden":`true`}),`Loading event`]}),i&&(0,R.jsxs)(fo,{variant:`blocking`,"data-testid":`event-detail-error`,children:[(0,R.jsx)(po,{children:`Event unavailable`}),(0,R.jsxs)(mo,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsx)(`span`,{children:a?.status===404?`This event could not be found.`:a instanceof Error?a.message:`Failed to load this event.`}),(0,R.jsx)(W,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{o()},children:`Retry`})]})]}),n&&s&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(G,{"data-testid":`event-detail-summary`,children:[(0,R.jsxs)(zi,{children:[(0,R.jsx)(Bi,{children:`Summary`}),(0,R.jsx)(Vi,{children:s.description})]}),(0,R.jsxs)(Hi,{className:`flex flex-wrap gap-2`,children:[(0,R.jsx)(q,{variant:Ig(n.kind,n.outcome),children:n.outcome??`-`}),(0,R.jsx)(q,{variant:`outline`,children:Ug(n.ts)})]})]}),(0,R.jsxs)(G,{"data-testid":`event-detail-payload`,children:[(0,R.jsxs)(zi,{children:[(0,R.jsx)(Bi,{children:`Details`}),(0,R.jsx)(Vi,{children:`Raw event fields from the persistent activity log.`})]}),(0,R.jsx)(Hi,{children:(0,R.jsxs)(`dl`,{className:`m-0`,children:[(0,R.jsx)(Gg,{label:`Event id`,children:n.id}),(0,R.jsx)(kh,{}),(0,R.jsx)(Gg,{label:`Kind`,children:n.kind}),(0,R.jsx)(kh,{}),(0,R.jsx)(Gg,{label:`Request id`,children:n.requestId??`-`}),(0,R.jsx)(kh,{}),(0,R.jsx)(Gg,{label:`Service index`,children:n.serviceIndex===null?`-`:n.serviceIndex}),(0,R.jsx)(kh,{}),(0,R.jsx)(Gg,{label:`Solver type`,children:n.solverType??`-`}),(0,R.jsx)(kh,{}),(0,R.jsx)(Gg,{label:`Transaction`,children:n.txHash?(0,R.jsx)(W,{asChild:!0,variant:`link`,size:`sm`,className:`h-auto justify-start p-0 font-mono text-[12px] normal-case tracking-normal`,children:(0,R.jsxs)(`a`,{"data-testid":`event-detail-tx-link`,href:`${c}/tx/${n.txHash}`,target:`_blank`,rel:`noreferrer`,children:[n.txHash,(0,R.jsx)(kn,{"aria-hidden":`true`})]})}):`-`}),(0,R.jsx)(kh,{}),(0,R.jsx)(Gg,{label:`Detail`,children:n.detail??`-`})]})})]})]})]})}function qg(e,t){let n=e??[];return n.includes(t)?n:[...n,t]}function Jg(e){if(!e||!/^\d+$/.test(e))return`—`;try{let t=BigInt(e);return t===0n?`0 ETH`:t>=100000000000000n?`${Yg(t,18,t>=1000000000000000000n?4:6)} ETH`:t>=1000000000n?`${Yg(t,9,4)} gwei`:`${t.toLocaleString()} wei`}catch{return`—`}}function Yg(e,t,n){let r=10n**BigInt(t),i=e/r,a=e%r;if(a===0n||n===0)return i.toString();let o=a.toString().padStart(t,`0`).slice(0,n).replace(/0+$/,``);return o?`${i}.${o}`:i.toString()}function Xg(e){let t=e.trim();if(t.length===0)return null;if(!/^\d+$/.test(t))throw Error(`not a non-negative integer`);return BigInt(t)}var Zg={launching:{variant:`default`,label:`Launching`},launched:{variant:`success`,label:`Launched`},paused:{variant:`pill`,label:`Paused`},retired:{variant:`outline`,label:`Retired`},failed:{variant:`destructive`,label:`Failed`}};function Qg(e){return e.length<=16?e:`${e.slice(0,8)}…${e.slice(-6)}`}function $g(e){try{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().replace(`T`,` `).slice(0,16)+` UTC`}catch{return e}}function e_({status:e}){let t=Zg[e]??Zg.launching;return(0,R.jsx)(q,{variant:t.variant,className:`whitespace-nowrap`,children:t.label})}function t_({postCounts:e,loading:t,error:n}){let r;return r=n?(0,R.jsx)(`span`,{className:`text-[var(--wane)]`,children:`posts unavailable`}):t&&!e?(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`…`}):!e||e.h24===0?(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`No recent posts`}):(0,R.jsxs)(`span`,{className:`text-[var(--fg-muted)]`,children:[e.h1,` · `,e.h6,` · `,e.h24]}),(0,R.jsxs)(`div`,{"data-testid":`launcher-owned-row-postcounts`,className:`flex flex-col items-end gap-0.5 font-mono text-[12px]`,children:[(0,R.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:`recent posts (1h · 6h · 24h)`}),r]})}function n_({label:e}){return(0,R.jsx)(q,{"data-testid":`launcher-owned-row-role`,variant:`outline`,className:`normal-case tracking-[0.12em] text-[var(--fg-muted)]`,children:e})}function r_({record:e,postCounts:t,postCountsLoading:n,postCountsError:r}){let[,i]=Kt(),a=`/launcher/launched/${encodeURIComponent(e.solverNetId)}`,o=e.summary,s=o?.name??e.solverNetId,c=o===void 0?null:`${o.contractId}.${o.contractVersion}`;return(0,R.jsx)(`a`,{href:a,"data-testid":`launcher-owned-row`,"data-solvernet-id":e.solverNetId,"data-has-summary":o===void 0?`false`:`true`,onClick:e=>{e.preventDefault(),i(a)},className:`block text-inherit no-underline`,children:(0,R.jsxs)(G,{className:U(`grid grid-cols-[1fr_auto] items-center gap-4 p-4`,`transition-colors hover:bg-[var(--bg-sunken)]/40 cursor-pointer`),children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,R.jsx)(`div`,{"data-testid":`launcher-owned-row-primary`,className:U(`truncate text-foreground`,o===void 0?`font-mono text-[14px] font-medium`:`font-serif text-[18px] font-normal tracking-[-0.01em]`),children:s}),c!==null&&(0,R.jsx)(`div`,{"data-testid":`launcher-owned-row-contract`,className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:c}),o!==void 0&&(0,R.jsxs)(`div`,{"data-testid":`launcher-owned-row-prices`,className:`flex flex-wrap gap-x-3.5 font-mono text-[12px] text-[var(--fg-muted)]`,children:[(0,R.jsxs)(`span`,{children:[`solution `,Jg(o.solutionPriceWei)]}),(0,R.jsxs)(`span`,{children:[`verdict `,Jg(o.verdictPriceWei)]})]}),o!==void 0&&o.openRoles.length>0&&(0,R.jsx)(`div`,{"data-testid":`launcher-owned-row-roles`,className:`flex flex-wrap gap-1.5`,children:o.openRoles.map(e=>(0,R.jsx)(n_,{label:e},e))}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-x-3.5 font-mono text-[12px] text-[var(--fg-muted)]`,children:[(0,R.jsxs)(`span`,{children:[`cid `,Qg(e.manifestCid)]}),(0,R.jsxs)(`span`,{children:[`launched `,$g(e.launchedAt)]})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-col items-end gap-2`,children:[(0,R.jsx)(e_,{status:e.status}),(0,R.jsx)(t_,{postCounts:t,loading:n,error:r})]})]})})}function i_(){return(0,R.jsxs)(G,{"data-testid":`launcher-empty-state`,className:`flex flex-col gap-3.5 p-8`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-mono text-[18px] font-medium tracking-[-0.01em] text-foreground`,children:`No SolverNets created yet.`}),(0,R.jsx)(`p`,{className:`m-0 text-[14px] leading-relaxed text-[var(--fg-muted)]`,children:`Create a SolverNet to direct operators toward a specific kind of knowledge work.`}),(0,R.jsx)(`div`,{children:(0,R.jsx)(W,{asChild:!0,variant:`default`,size:`lg`,children:(0,R.jsx)($t,{href:`/launcher/create`,children:`Create SolverNet`})})})]})}function a_(){let{data:e,isLoading:t,isError:n,error:r,refetch:i}=ut({queryKey:[`solvernets`,`launched`,`owned`],queryFn:()=>B.solvernets.listLaunched(),refetchInterval:3e4}),a=(e?.records??[]).map(e=>e.manifestCid),o=ut({queryKey:[`discovery`,`task-post-counts`,`launcher`,a],queryFn:()=>B.discovery.getTaskPostCounts(a),enabled:a.length>0,refetchInterval:3e4}),s=o.data?.byCid;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-4 p-6`,children:[(0,R.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,R.jsx)(`h1`,{className:`m-0 font-serif text-[32px] font-normal text-foreground`,children:`Your SolverNets`}),(e?.records.length??0)>0&&(0,R.jsx)(W,{asChild:!0,variant:`default`,"data-testid":`launcher-create-cta`,children:(0,R.jsx)($t,{href:`/launcher/create`,children:`Create SolverNet`})})]}),t&&(0,R.jsx)(`p`,{"data-testid":`launcher-loading`,className:`m-0 font-mono text-[13px] text-[var(--fg-muted)]`,children:`Loading…`}),n&&(0,R.jsxs)(fo,{"data-testid":`launcher-error`,variant:`blocking`,className:`flex items-center justify-between gap-4 border-l-0 border border-destructive p-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(po,{className:`font-mono text-[13px] font-medium text-destructive`,children:`Failed to load your SolverNets.`}),(0,R.jsx)(mo,{className:`text-[12px] text-[var(--fg-muted)]`,children:r instanceof Error?r.message:`Unknown error`})]}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>{i()},children:`Retry`})]}),!t&&!n&&e&&e.records.length===0&&(0,R.jsx)(i_,{}),!t&&!n&&e&&e.records.length>0&&(0,R.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.records.map(e=>(0,R.jsx)(r_,{record:e,postCounts:s?.[e.manifestCid],postCountsLoading:o.isLoading,postCountsError:o.isError},e.solverNetId))})]})}var o_=L.forwardRef(({className:e,type:t,...n},r)=>(0,R.jsx)(`input`,{type:t,ref:r,className:U(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 font-mono text-[13px] text-foreground transition-colors`,`placeholder:text-[var(--fg-dim)]`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,e),...n}));o_.displayName=`Input`;function s_({current:e,total:t=5}){return(0,R.jsxs)(`div`,{"data-testid":`launcher-create-progress`,className:`flex items-center gap-3 font-mono text-[11px] uppercase tracking-[0.14em] text-fg-muted`,children:[(0,R.jsxs)(`span`,{"data-testid":`launcher-create-step-counter`,children:[`Step `,e,` of `,t]}),(0,R.jsx)(`div`,{className:`flex max-w-[320px] flex-1 gap-1`,children:Array.from({length:t}).map((t,n)=>{let r=n+1,i=r<=e;return(0,R.jsx)(`span`,{"data-testid":`launcher-create-progress-pip-${r}`,"data-filled":i?`true`:`false`,className:U(`h-[3px] flex-1 rounded-sm`,i?`bg-accent-sky`:`bg-border`)},r)})})]})}function c_({step:e,total:t=5,title:n,blurb:r,children:i,footer:a,error:o}){return(0,R.jsxs)(`main`,{"data-testid":`launcher-create-step-${e}`,className:`mx-auto flex max-w-[720px] flex-col gap-5 p-6`,children:[(0,R.jsx)(s_,{current:e,total:t}),(0,R.jsxs)(`header`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(`h1`,{className:`m-0 font-serif text-[32px] font-normal leading-tight tracking-[-0.01em] text-foreground`,children:n}),r&&(0,R.jsx)(`p`,{className:`m-0 text-[14px] leading-relaxed text-fg-muted`,children:r})]}),o&&(0,R.jsx)(fo,{variant:`blocking`,"data-testid":`launcher-create-error`,className:`font-mono text-[13px]`,children:(0,R.jsx)(mo,{children:o})}),(0,R.jsx)(`div`,{className:`flex flex-col gap-4`,children:i}),(0,R.jsx)(kh,{}),(0,R.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:a})]})}function l_({onBack:e,onNext:t,nextLabel:n=`Next`,nextDisabled:r=!1,busy:i=!1,right:a}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{children:e&&(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`lg`,"data-testid":`launcher-create-back`,onClick:e,disabled:i,children:`Back`})}),(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,t&&(0,R.jsx)(W,{type:`button`,size:`lg`,"data-testid":`launcher-create-next`,onClick:t,disabled:r||i,children:n})]})]})}function u_({label:e,helperText:t,error:n,children:r,asLabel:i=!0}){let a=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Gf,{children:e}),r,n?(0,R.jsx)(`span`,{className:`font-mono text-[12px] text-break-red`,children:n}):t&&(0,R.jsx)(`span`,{className:`font-mono text-[11px] text-fg-dim`,children:t})]});return i?(0,R.jsx)(`label`,{className:`flex flex-col gap-1.5`,children:a}):(0,R.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:a})}var d_=`flex w-full rounded-md border border-input bg-transparent px-3 py-2 font-mono text-[13px] text-foreground placeholder:text-fg-dim focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`;function f_({draft:e,onAdvance:t,busy:n,error:r}){let[i,a]=(0,L.useState)(e.name??``),[o,s]=(0,L.useState)(e.description??``),[c,l]=(0,L.useState)(!1),u=c&&i.trim().length===0?`Name is required.`:null,d=c&&o.trim().length===0?`Description is required.`:null,f=async n=>{n?.preventDefault(),l(!0),!(i.trim().length===0||o.trim().length===0)&&await t({name:i.trim(),description:o.trim(),completedSteps:qg(e.completedSteps,`define`)})};return(0,R.jsx)(c_,{step:1,title:`Name your SolverNet`,blurb:`Pick a short, recognisable name and describe what kind of knowledge work this SolverNet directs operators toward.`,error:r,footer:(0,R.jsx)(l_,{onNext:()=>{f()},nextDisabled:i.trim().length===0||o.trim().length===0,busy:n}),children:(0,R.jsxs)(`form`,{onSubmit:e=>{f(e)},className:`flex flex-col gap-4`,children:[(0,R.jsx)(u_,{label:`Name`,error:u,helperText:`Shown in the registry catalog and the operator opt-in cards.`,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-name`,type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. Polymarket forecasts`,className:U(u&&`border-break-red`),disabled:n})}),(0,R.jsx)(u_,{label:`Description`,error:d,helperText:`One or two sentences. Operators read this when deciding whether to opt in.`,children:(0,R.jsx)(`textarea`,{"data-testid":`launcher-create-description`,value:o,onChange:e=>s(e.target.value),rows:4,placeholder:`Forecast resolved Polymarket outcomes; rewarded by Brier score on verified resolutions.`,className:U(d_,`min-h-[96px] resize-y`,d&&`border-break-red`),disabled:n})}),(0,R.jsx)(W,{type:`submit`,className:`hidden`,"aria-hidden":!0,tabIndex:-1})]})})}var p_={id:`prediction`,version:`v1`,name:`Prediction`,description:`Forecast resolved outcomes. Solvers submit a probability for a binary market; evaluators score against the on-chain resolution using Brier loss.`,schemas:{task:{name:`prediction.v1 Task`,description:`A binary Polymarket market with resolution time, condition id, and orderbook snapshot.`},solution:{name:`prediction.v1 Solution`,description:`A scalar probability in [0, 1] that the market resolves YES.`},verdict:{name:`prediction.v1 Verdict`,description:`Brier-loss score derived from the solver probability and the resolved outcome.`}},evaluationFunction:{id:`prediction.brier-loss.v1`,deterministic:!0,inputs:[`prediction.v1 Task`,`prediction.v1 Solution`,`Polymarket/UMA resolution`],output:`prediction.v1 Verdict`},aggregationFunction:{id:`prediction.trailing-mean-brier-spread.v1`,deterministic:!0,inputs:[`SCORED prediction.v1 Verdicts`],output:`trailing mean brierSpread`,windowDays:84},claimPolicyDefaults:{mode:`parallel`,maxClaims:25,maxClaimsPerOperator:1,claimLeaseTtlSeconds:1800},credentialRequirements:{creator:[{id:`polymarket.public.market-data.read`,kind:`public-api`,required:!0,description:`Read public Polymarket market metadata and orderbook snapshots for Task creation.`}],solver:[],evaluator:[{id:`polymarket.public.resolution.read`,kind:`public-api`,required:!0,description:`Read public Polymarket/UMA final market state for resolution mapping.`}]},generatorDefaults:{cadenceMs:360*60*1e3,submissionWindowMs:360*60*1e3,maxNewRoundsPerPoll:25,maxNewRoundsPerDay:100,maxOpenRounds:250,minTimeToResolutionHours:24,maxTimeToResolutionHours:168,minLiquidityUsd:`10000`,minVolume24hUsd:`2500`,maxYesSpread:`0.10`,maxOrderbookAgeSeconds:60}},m_={id:`swe-rebench-v2`,version:`v1`,name:`SWE-rebench v2`,description:`Code-issue benchmark sourced from the nebius/SWE-rebench-leaderboard HuggingFace dataset. Solvers submit a patch; evaluators run the upstream eval.py harness inside the per-instance Docker image and emit a 0/1 Verdict against the FAIL_TO_PASS / PASS_TO_PASS tests.`,schemas:{task:{name:`swe-rebench-v2.v1 Task`,description:`A reference to a HuggingFace dataset row by (hf_dataset, hf_split, instance_id), plus repo + base_commit + language + problem statement.`},solution:{name:`swe-rebench-v2.v1 Solution`,description:`A unified diff patch (git-format), with optional self-reported cost. The trajectory blob is pinned daemon-side and referenced via the envelope, not the payload.`},verdict:{name:`swe-rebench-v2.v1 Verdict`,description:`Score 0 or 1 based on whether the patch passes the per-instance Docker test suite, plus passed_match flag and evaluator cost. The test log is pinned daemon-side and surfaced via the verdict-artifact metadata.`}},evaluationFunction:{id:`swe-rebench-v2.docker-test-suite.v1`,deterministic:!0,inputs:[`swe-rebench-v2.v1 Task`,`swe-rebench-v2.v1 Solution`,`per-instance Docker image`],output:`swe-rebench-v2.v1 Verdict`},aggregationFunction:{id:`swe-rebench-v2.multi-winrate.v1`,deterministic:!0,inputs:[`SCORED swe-rebench-v2.v1 Verdicts`],output:`mean / complexityWeighted / byLanguage / frontierResolved / parityTripRate`,windowDays:30},claimPolicyDefaults:{mode:`parallel`,maxClaims:5,maxClaimsPerOperator:5,claimLeaseTtlSeconds:3600},credentialRequirements:{creator:[{id:`huggingface.public.datasets-server.read`,kind:`public-api`,required:!0,description:`Read public HuggingFace dataset rows from the nebius/SWE-rebench-leaderboard splits.`}],solver:[],evaluator:[{id:`docker.local.run`,kind:`local-runtime`,required:!0,description:`Run per-instance Docker images that ship with the upstream eval.py harness.`},{id:`huggingface.public.datasets-server.read`,kind:`public-api`,required:!0,description:`Read the HF dataset row referenced by the Task to recover test_patch + FAIL_TO_PASS / PASS_TO_PASS.`}]},generatorDefaults:{N_target_successes:5,posting_window_ms:1440*60*1e3,post_batch_size:25,claimLeaseTtlSeconds:3600}},h_={"prediction.v1":p_,"swe-rebench-v2.v1":m_},g_=`font-mono text-[11px] uppercase tracking-[0.14em] text-fg-dim`;function __({draft:e,template:t=p_,onAdvance:n,onBack:r,busy:i,error:a}){return(0,R.jsx)(c_,{step:2,title:`Review contract`,blurb:`The contract defines the schemas, evaluation, and aggregation that this SolverNet will pin to its manifest.`,error:a,footer:(0,R.jsx)(l_,{onBack:r,onNext:()=>{n({templateContractId:t.id,templateContractVersion:t.version,completedSteps:qg(e.completedSteps,`reviewContract`)})},busy:i}),children:(0,R.jsx)(G,{"data-testid":`launcher-create-template`,"data-template-id":`${t.id}.${t.version}`,children:(0,R.jsxs)(Hi,{className:`flex flex-col gap-4 p-6`,children:[(0,R.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:g_,children:[t.id,`.`,t.version]}),(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[24px] font-normal text-foreground`,children:t.name}),(0,R.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed text-fg-muted`,children:t.description})]}),(0,R.jsxs)(v_,{title:`Schemas`,children:[(0,R.jsx)(y_,{label:`Task`,value:t.schemas.task.name,hint:t.schemas.task.description}),(0,R.jsx)(y_,{label:`Solution`,value:t.schemas.solution.name,hint:t.schemas.solution.description}),(0,R.jsx)(y_,{label:`Verdict`,value:t.schemas.verdict.name,hint:t.schemas.verdict.description})]}),(0,R.jsxs)(v_,{title:`Evaluation function`,children:[(0,R.jsx)(y_,{label:`Id`,value:t.evaluationFunction.id,mono:!0}),(0,R.jsx)(y_,{label:`Deterministic`,value:t.evaluationFunction.deterministic?`yes`:`no`}),(0,R.jsx)(y_,{label:`Inputs`,value:t.evaluationFunction.inputs.join(`, `)}),(0,R.jsx)(y_,{label:`Output`,value:t.evaluationFunction.output})]}),(0,R.jsxs)(v_,{title:`Aggregation function`,children:[(0,R.jsx)(y_,{label:`Id`,value:t.aggregationFunction.id,mono:!0}),(0,R.jsx)(y_,{label:`Window`,value:t.aggregationFunction.windowDays===void 0?`—`:`${t.aggregationFunction.windowDays} days`}),(0,R.jsx)(y_,{label:`Output`,value:t.aggregationFunction.output})]}),(0,R.jsxs)(v_,{title:`Claim policy defaults`,children:[(0,R.jsx)(y_,{label:`Mode`,value:t.claimPolicyDefaults.mode}),(0,R.jsx)(y_,{label:`Max claims`,value:String(t.claimPolicyDefaults.maxClaims)}),(0,R.jsx)(y_,{label:`Per operator`,value:String(t.claimPolicyDefaults.maxClaimsPerOperator)}),(0,R.jsx)(y_,{label:`Lease TTL`,value:`${t.claimPolicyDefaults.claimLeaseTtlSeconds}s`})]}),(0,R.jsxs)(v_,{title:`Credential requirements`,children:[(0,R.jsx)(b_,{role:`creator`,creds:t.credentialRequirements.creator}),(0,R.jsx)(b_,{role:`solver`,creds:t.credentialRequirements.solver}),(0,R.jsx)(b_,{role:`evaluator`,creds:t.credentialRequirements.evaluator})]})]})})})}function v_({title:e,children:t}){return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(kh,{}),(0,R.jsx)(`h3`,{className:U(`m-0 pt-2 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-fg-muted`),children:e}),(0,R.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t})]})}function y_({label:e,value:t,hint:n,mono:r}){return(0,R.jsxs)(`div`,{className:`grid grid-cols-[140px_1fr] items-baseline gap-3`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] tracking-[0.06em] text-fg-dim`,children:e}),(0,R.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,R.jsx)(`span`,{className:U(`text-[13px] text-foreground`,r?`font-mono`:`font-sans`),children:t}),n&&(0,R.jsx)(`span`,{className:`font-mono text-[12px] leading-relaxed text-fg-muted`,children:n})]})]})}function b_({role:e,creds:t}){return(0,R.jsxs)(`div`,{"data-testid":`launcher-create-credentials-${e}`,className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(`div`,{className:`font-mono text-[11px] capitalize tracking-[0.06em] text-fg-dim`,children:e}),t.length===0?(0,R.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`None.`}):t.map(e=>(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5 font-mono text-[12px] leading-relaxed`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-accent-sky`,children:e.id}),(0,R.jsx)(q,{variant:`secondary`,children:e.kind}),e.required&&(0,R.jsx)(q,{variant:`warning`,children:`required`})]}),(0,R.jsx)(`div`,{className:`text-fg-muted`,children:e.description})]},e.id))]})}var x_=`flex w-full rounded-md border border-input bg-transparent px-3 py-2 font-mono text-[13px] text-foreground placeholder:text-fg-dim focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 resize-y`;function S_(e){let t=e.template??p_;switch(t.id){case`prediction`:return(0,R.jsx)(A_,{...e,template:t});case`swe-rebench-v2`:return(0,R.jsx)(N_,{...e,template:t});default:return(0,R.jsx)(c_,{step:3,title:`Configure generator`,blurb:`No generator form is registered for this template.`,error:e.error??null,footer:(0,R.jsx)(l_,{onBack:e.onBack,onNext:()=>{},nextDisabled:!0,busy:e.busy}),children:(0,R.jsx)(`div`,{"data-testid":`launcher-create-generator-unsupported`})})}}var C_=6e4;function w_(e,t){return typeof e==`number`&&Number.isFinite(e)?String(e):typeof e==`string`&&e.trim().length>0?e.trim():String(t)}function T_(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).join(`, `):``}function E_(e){let t=p_.generatorDefaults;return{cadenceMs:w_(e?.cadenceMs,t.cadenceMs),windowMs:w_(e?.windowMs??e?.submissionWindowMs,t.submissionWindowMs),resolveGapMs:w_(e?.resolveGapMs,3600*1e3),maxNewRoundsPerPoll:w_(e?.maxNewRoundsPerPoll,t.maxNewRoundsPerPoll),maxNewRoundsPerDay:w_(e?.maxNewRoundsPerDay,t.maxNewRoundsPerDay),maxOpenRounds:w_(e?.maxOpenRounds,t.maxOpenRounds),allowlistConditionIds:T_(e?.allowlistConditionIds),blocklistConditionIds:T_(e?.blocklistConditionIds)}}function D_(e){let t={},n=O_(e.cadenceMs);n===null?t.cadenceMs=`Must be a positive integer (ms).`:n<C_&&(t.cadenceMs=`Cadence must be at least ${C_/1e3}s.`);let r=O_(e.windowMs);r===null&&(t.windowMs=`Must be a positive integer (ms).`);let i=O_(e.resolveGapMs);i===null&&(t.resolveGapMs=`Must be a positive integer (ms).`);let a=O_(e.maxNewRoundsPerPoll);a===null&&(t.maxNewRoundsPerPoll=`Must be a positive integer.`);let o=O_(e.maxNewRoundsPerDay);o===null&&(t.maxNewRoundsPerDay=`Must be a positive integer.`);let s=O_(e.maxOpenRounds);return s===null&&(t.maxOpenRounds=`Must be a positive integer.`),Object.keys(t).length>0?{ok:!1,errors:t}:{ok:!0,errors:{},generatorConfig:{cadenceMs:n,windowMs:r,resolveGapMs:i,submissionWindowMs:r,maxNewRoundsPerPoll:a,maxNewRoundsPerDay:o,maxOpenRounds:s,allowlistConditionIds:k_(e.allowlistConditionIds),blocklistConditionIds:k_(e.blocklistConditionIds)}}}function O_(e){let t=e.trim();if(t.length===0||!/^\d+$/.test(t))return null;let n=Number(t);return!Number.isFinite(n)||n<=0?null:n}function k_(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function A_({draft:e,onAdvance:t,onBack:n,busy:r,error:i}){let[a,o]=(0,L.useState)((0,L.useMemo)(()=>E_(e.generatorConfig),[e.generatorConfig])),[s,c]=(0,L.useState)(!1),l=s?D_(a):{ok:!0,errors:{}},u=s?l.errors:{},d=()=>{c(!0);let n=D_(a);!n.ok||!n.generatorConfig||t({generatorConfig:n.generatorConfig,completedSteps:qg(e.completedSteps,`configureGenerator`)})},f=(e,t)=>{o(n=>({...n,[e]:t}))};return(0,R.jsxs)(c_,{step:3,title:`Configure generator`,blurb:`The auto-generator polls Polymarket and posts Tasks while the SolverNet is launched. Defaults are tuned for a healthy idle SolverNet — adjust to match your appetite.`,error:i,footer:(0,R.jsx)(l_,{onBack:n,onNext:d,busy:r,nextDisabled:s&&!l.ok}),children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-1 gap-3.5 sm:grid-cols-2`,children:[(0,R.jsx)(u_,{label:`Cadence (ms)`,helperText:`How often the generator polls Polymarket. Minimum 60s.`,error:u.cadenceMs??null,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-cadenceMs`,type:`text`,inputMode:`numeric`,value:a.cadenceMs,onChange:e=>f(`cadenceMs`,e.target.value),className:U(u.cadenceMs&&`border-break-red`),disabled:r})}),(0,R.jsx)(u_,{label:`Submission window (ms)`,helperText:`How long Tasks stay open for solving.`,error:u.windowMs??null,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-windowMs`,type:`text`,inputMode:`numeric`,value:a.windowMs,onChange:e=>f(`windowMs`,e.target.value),className:U(u.windowMs&&`border-break-red`),disabled:r})}),(0,R.jsx)(u_,{label:`Resolve gap (ms)`,helperText:`Cushion between window-close and resolution.`,error:u.resolveGapMs??null,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-resolveGapMs`,type:`text`,inputMode:`numeric`,value:a.resolveGapMs,onChange:e=>f(`resolveGapMs`,e.target.value),className:U(u.resolveGapMs&&`border-break-red`),disabled:r})}),(0,R.jsx)(u_,{label:`Max rounds / poll`,helperText:`Cap on new Tasks per generator tick.`,error:u.maxNewRoundsPerPoll??null,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-maxNewRoundsPerPoll`,type:`text`,inputMode:`numeric`,value:a.maxNewRoundsPerPoll,onChange:e=>f(`maxNewRoundsPerPoll`,e.target.value),className:U(u.maxNewRoundsPerPoll&&`border-break-red`),disabled:r})}),(0,R.jsx)(u_,{label:`Max rounds / day`,helperText:`Daily ceiling across all polls.`,error:u.maxNewRoundsPerDay??null,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-maxNewRoundsPerDay`,type:`text`,inputMode:`numeric`,value:a.maxNewRoundsPerDay,onChange:e=>f(`maxNewRoundsPerDay`,e.target.value),className:U(u.maxNewRoundsPerDay&&`border-break-red`),disabled:r})}),(0,R.jsx)(u_,{label:`Max open rounds`,helperText:`Concurrent open Tasks before back-off kicks in.`,error:u.maxOpenRounds??null,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-maxOpenRounds`,type:`text`,inputMode:`numeric`,value:a.maxOpenRounds,onChange:e=>f(`maxOpenRounds`,e.target.value),className:U(u.maxOpenRounds&&`border-break-red`),disabled:r})})]}),(0,R.jsx)(u_,{label:`Allowlist condition ids`,helperText:`Comma-separated. If non-empty, only these markets are considered.`,children:(0,R.jsx)(`textarea`,{"data-testid":`launcher-create-allowlistConditionIds`,value:a.allowlistConditionIds,onChange:e=>f(`allowlistConditionIds`,e.target.value),rows:2,placeholder:`0xabc…, 0xdef…`,className:x_,disabled:r})}),(0,R.jsx)(u_,{label:`Blocklist condition ids`,helperText:`Comma-separated. Markets here are skipped, even if they pass the eligibility filters.`,children:(0,R.jsx)(`textarea`,{"data-testid":`launcher-create-blocklistConditionIds`,value:a.blocklistConditionIds,onChange:e=>f(`blocklistConditionIds`,e.target.value),rows:2,placeholder:`0xabc…`,className:x_,disabled:r})})]})}function j_(e){let t=m_.generatorDefaults,n=typeof e?.claimPolicy==`object`&&e.claimPolicy!==null?e.claimPolicy:{};return{N_target_successes:w_(e?.N_target_successes,t.N_target_successes),posting_window_ms:w_(e?.posting_window_ms,t.posting_window_ms),post_batch_size:w_(e?.post_batch_size,t.post_batch_size),maxClaimsPerOperator:w_(e?.maxClaimsPerOperator??n.maxClaimsPerOperator,t.maxClaimsPerOperator??t.N_target_successes),claimLeaseTtlSeconds:w_(e?.claimLeaseTtlSeconds??n.claimLeaseTtlSeconds,t.claimLeaseTtlSeconds)}}function M_(e){let t={},n=O_(e.N_target_successes);n===null&&(t.N_target_successes=`Must be a positive integer.`);let r=O_(e.posting_window_ms);r===null&&(t.posting_window_ms=`Must be a positive integer (ms).`);let i=O_(e.post_batch_size);i===null&&(t.post_batch_size=`Must be a positive integer.`);let a=O_(e.maxClaimsPerOperator);a===null&&(t.maxClaimsPerOperator=`Must be a positive integer.`);let o=O_(e.claimLeaseTtlSeconds);return o===null&&(t.claimLeaseTtlSeconds=`Must be a positive integer (seconds).`),Object.keys(t).length>0?{ok:!1,errors:t}:{ok:!0,errors:{},generatorConfig:{N_target_successes:n,posting_window_ms:r,post_batch_size:i,maxClaimsPerOperator:a,claimLeaseTtlSeconds:o}}}function N_({draft:e,onAdvance:t,onBack:n,busy:r,error:i}){let[a,o]=(0,L.useState)((0,L.useMemo)(()=>j_(e.generatorConfig),[e.generatorConfig])),[s,c]=(0,L.useState)(!1),l=s?M_(a):{ok:!0,errors:{}},u=s?l.errors:{},d=()=>{c(!0);let n=M_(a);!n.ok||!n.generatorConfig||t({generatorConfig:n.generatorConfig,completedSteps:qg(e.completedSteps,`configureGenerator`)})},f=(e,t)=>{o(n=>({...n,[e]:t}))};return(0,R.jsx)(c_,{step:3,title:`Configure generator`,blurb:`The generator pulls SWE-rebench v2 instances from the HuggingFace pool and posts Tasks until enough successful Verdicts accumulate or the posting cap is hit.`,error:i,footer:(0,R.jsx)(l_,{onBack:n,onNext:d,busy:r,nextDisabled:s&&!l.ok}),children:(0,R.jsxs)(`div`,{className:`grid grid-cols-1 gap-3.5 sm:grid-cols-2`,children:[(0,R.jsx)(u_,{label:`Target successful Verdicts per instance`,helperText:`How many score=1 Verdicts saturate a SWE instance and stop further Task posting.`,error:u.N_target_successes??null,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-N_target_successes`,type:`text`,inputMode:`numeric`,value:a.N_target_successes,onChange:e=>f(`N_target_successes`,e.target.value),className:U(u.N_target_successes&&`border-break-red`),disabled:r})}),(0,R.jsx)(u_,{label:`Posting window (ms)`,helperText:`On-chain claim-window deadline for each posting. Reposts trigger on claim-budget exhaustion observed via the indexer, not this window.`,error:u.posting_window_ms??null,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-posting_window_ms`,type:`text`,inputMode:`numeric`,value:a.posting_window_ms,onChange:e=>f(`posting_window_ms`,e.target.value),className:U(u.posting_window_ms&&`border-break-red`),disabled:r})}),(0,R.jsx)(u_,{label:`Post batch size`,helperText:`Maximum number of SWE instances to post in one creator tick.`,error:u.post_batch_size??null,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-post_batch_size`,type:`text`,inputMode:`numeric`,value:a.post_batch_size,onChange:e=>f(`post_batch_size`,e.target.value),className:U(u.post_batch_size&&`border-break-red`),disabled:r})}),(0,R.jsx)(u_,{label:`Max claims per operator`,helperText:`Optional cap; each posting is still limited by remaining target successes.`,error:u.maxClaimsPerOperator??null,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-maxClaimsPerOperator`,type:`text`,inputMode:`numeric`,value:a.maxClaimsPerOperator,onChange:e=>f(`maxClaimsPerOperator`,e.target.value),className:U(u.maxClaimsPerOperator&&`border-break-red`),disabled:r})}),(0,R.jsx)(u_,{label:`Claim lease (seconds)`,helperText:`How long a claimed SWE task slot stays leased.`,error:u.claimLeaseTtlSeconds??null,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-claimLeaseTtlSeconds`,type:`text`,inputMode:`numeric`,value:a.claimLeaseTtlSeconds,onChange:e=>f(`claimLeaseTtlSeconds`,e.target.value),className:U(u.claimLeaseTtlSeconds&&`border-break-red`),disabled:r})})]})})}function P_(e,t){let n={},r,i;try{r=Xg(e),r===null?n.solutionPriceWei=`Required.`:r<0n&&(n.solutionPriceWei=`Must be non-negative.`)}catch{n.solutionPriceWei=`Must be a non-negative integer (wei).`,r=null}try{i=Xg(t),i===null?n.verdictPriceWei=`Required.`:i<0n&&(n.verdictPriceWei=`Must be non-negative.`)}catch{n.verdictPriceWei=`Must be a non-negative integer (wei).`,i=null}return r!==null&&i!==null&&!n.solutionPriceWei&&!n.verdictPriceWei&&r===0n&&i===0n&&(n.combined=`At least one price must be positive.`),{ok:Object.keys(n).length===0,errors:n,solutionWei:r??void 0,verdictWei:i??void 0}}function F_(e,t,n,r){if(!e||!/^\d+$/.test(e)||t===void 0||n===void 0)return null;let i;try{i=BigInt(e)}catch{return null}let a=t+n*BigInt(r);return a<=0n?null:{tasks:Number(i/a),perTaskWei:a}}function I_({draft:e,template:t=p_,onAdvance:n,onBack:r,fundingSafeAddress:i,fundingSafeBalanceWei:a,busy:o,error:s}){let[c,l]=(0,L.useState)(e.solutionPriceWei??``),[u,d]=(0,L.useState)(e.verdictPriceWei??``),[f,p]=(0,L.useState)(!1),m=(0,L.useMemo)(()=>P_(c,u),[c,u]),h=t.claimPolicyDefaults.maxClaimsPerOperator,g=(0,L.useMemo)(()=>F_(a??null,m.solutionWei,m.verdictWei,h),[a,m.solutionWei,m.verdictWei,h]),_=()=>{p(!0),m.ok&&n({solutionPriceWei:c,verdictPriceWei:u,completedSteps:qg(e.completedSteps,`configurePricing`)})},v=f?m.errors:{};return(0,R.jsxs)(c_,{step:4,title:`Configure pricing`,blurb:`Set what each Task pays out. The funding Safe is your launcher's master Safe; pricing applies per claim and per verdict.`,error:s,footer:(0,R.jsx)(l_,{onBack:r,onNext:_,busy:o,nextDisabled:f&&!m.ok}),children:[(0,R.jsx)(u_,{label:`Funding Safe`,helperText:`Tasks are funded from this Safe at launch. Defaults to your launcher master Safe.`,asLabel:!1,children:(0,R.jsx)(`div`,{"data-testid":`launcher-create-fundingSafe`,className:`rounded-md border border-border bg-surface-sunken px-3 py-2.5 font-mono text-[13px] text-fg-muted break-all`,children:i??`— (master Safe will be picked at launch)`})}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 gap-3.5 sm:grid-cols-2`,children:[(0,R.jsx)(u_,{label:`Solution price (wei)`,helperText:`≈ ${Jg(m.solutionWei?.toString())}`,error:v.solutionPriceWei??null,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-solutionPriceWei`,type:`text`,inputMode:`numeric`,value:c,onChange:e=>l(e.target.value),placeholder:`e.g. 100000000000000 (0.0001 ETH)`,className:U(v.solutionPriceWei&&`border-break-red`),disabled:o})}),(0,R.jsx)(u_,{label:`Verdict price (wei)`,helperText:`≈ ${Jg(m.verdictWei?.toString())}`,error:v.verdictPriceWei??null,children:(0,R.jsx)(o_,{"data-testid":`launcher-create-verdictPriceWei`,type:`text`,inputMode:`numeric`,value:u,onChange:e=>d(e.target.value),placeholder:`e.g. 50000000000000 (0.00005 ETH)`,className:U(v.verdictPriceWei&&`border-break-red`),disabled:o})})]}),v.combined&&(0,R.jsx)(`div`,{"data-testid":`launcher-create-pricing-combined-error`,className:`font-mono text-[12px] text-break-red`,children:v.combined}),(0,R.jsx)(G,{"data-testid":`launcher-create-projection`,children:(0,R.jsxs)(Hi,{className:`flex flex-col gap-2.5 p-5`,children:[(0,R.jsx)(`h3`,{className:`m-0 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-fg-muted`,children:`Runway projection`}),(0,R.jsx)(kh,{}),(0,R.jsx)(L_,{label:`Safe balance`,value:a?`${Jg(a)} (${a} wei)`:`—`}),(0,R.jsx)(L_,{label:`Per-Task cost`,value:g?`${Jg(g.perTaskWei.toString())} (${g.perTaskWei} wei)`:`—`,hint:`solution + verdict × maxClaimsPerOperator (${h})`}),(0,R.jsx)(L_,{label:`Projected Tasks`,value:g?`~${g.tasks.toLocaleString(`en-US`)}`:`—`,hint:`Approximate; ignores gas and any in-flight reservations.`,testId:`launcher-create-projected-tasks`})]})})]})}function L_({label:e,value:t,hint:n,testId:r}){return(0,R.jsxs)(`div`,{"data-testid":r,className:`grid grid-cols-[160px_1fr] items-baseline gap-3`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] tracking-[0.06em] text-fg-dim`,children:e}),(0,R.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[13px] text-foreground`,children:t}),n&&(0,R.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:n})]})]})}var R_=1500,z_=[`pinning`,`recording`,`broadcasting`,`confirming`,`spawning`],B_={pinning:`Pinning manifest`,recording:`Recording draft`,broadcasting:`Broadcasting tx`,confirming:`Confirming on-chain`,spawning:`Spawning generator`};function V_({draft:e,template:t=p_,onUpdateDraft:n,onBack:r,onLaunchFailure:i,navigateTo:a,pollIntervalMs:o=R_}){let[,s]=Kt(),c=a??s,[l,u]=(0,L.useState)((0,L.useMemo)(()=>e.openRoles&&e.openRoles.length>0?e.openRoles:[`solver`,`evaluator`],[e.openRoles])),[d,f]=(0,L.useState)({kind:`idle`}),p=(0,L.useRef)(!1);(0,L.useEffect)(()=>()=>{p.current=!0},[]);let m=e=>{u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},h=async()=>{if(l.length!==0){f(e=>e.kind===`failed`?{kind:`idle`}:e),p.current=!1;try{await n({openRoles:l,completedSteps:qg(e.completedSteps,`configurePricing`)});let t=await B.solvernets.launch(e.draftId);if(p.current)return;let r=`pinning`;for(f({kind:`launching`,phase:r,solverNetId:t.solverNetId});;){if(p.current)return;let e;try{e=await B.solvernets.get(t.solverNetId)}catch{if(p.current)return;await Q_(o);continue}if(e.launchProgress?.phase&&(r=e.launchProgress.phase),e.status===`launched`){f({kind:`launching`,phase:`spawning`,solverNetId:t.solverNetId}),c(`/launcher/launched/${encodeURIComponent(t.solverNetId)}`);return}if(e.status===`failed`){let n=e.launchProgress?.txError?.message??`Launch failed during ${r}.`;f({kind:`failed`,message:n,solverNetId:t.solverNetId}),i?.();return}f({kind:`launching`,phase:r,solverNetId:t.solverNetId}),await Q_(o)}}catch(e){if(p.current)return;f({kind:`failed`,message:e instanceof Error?e.message:String(e)}),i?.()}}},g=d.kind===`launching`,_=l.length===0||g;return(0,R.jsxs)(c_,{step:5,title:`Review & launch`,blurb:`One last check. The Launch button signs the manifest, pins it to IPFS, and broadcasts the registry transaction.`,footer:(0,R.jsx)(l_,{onBack:r,onNext:()=>{h()},nextLabel:g?`Launching…`:`Launch`,nextDisabled:_,busy:g,right:g&&(0,R.jsx)(H_,{current:d.kind===`launching`?d.phase:`pinning`})}),children:[(0,R.jsx)(U_,{draft:e,template:t}),(0,R.jsxs)(u_,{label:`Open roles`,helperText:`Operators can opt in to any role you open here. Most launchers want both.`,asLabel:!1,children:[(0,R.jsxs)(`div`,{"data-testid":`launcher-create-openRoles`,className:`flex flex-col gap-2.5`,children:[(0,R.jsx)(Z_,{role:`solver`,checked:l.includes(`solver`),onChange:()=>m(`solver`),disabled:g}),(0,R.jsx)(Z_,{role:`evaluator`,checked:l.includes(`evaluator`),onChange:()=>m(`evaluator`),disabled:g})]}),l.length===0&&(0,R.jsx)(`span`,{"data-testid":`launcher-create-openRoles-error`,className:`font-mono text-[12px] text-break-red`,children:`At least one role must be open.`})]}),d.kind===`failed`&&(0,R.jsxs)(fo,{variant:`blocking`,"data-testid":`launcher-create-launch-failure`,children:[(0,R.jsx)(po,{className:`font-mono text-[13px] font-medium text-break-red`,children:`Launch failed.`}),(0,R.jsx)(mo,{className:`font-mono text-[12px] text-fg-muted`,children:d.message}),(0,R.jsxs)(`div`,{className:`mt-2.5 flex gap-2`,children:[(0,R.jsx)(W,{type:`button`,size:`sm`,"data-testid":`launcher-create-launch-retry`,onClick:()=>{h()},children:`Retry`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-create-launch-abandon`,onClick:()=>{c(`/launcher`)},children:`Abandon`})]})]})]})}function H_({current:e}){let t=z_.indexOf(e);return(0,R.jsxs)(`div`,{"data-testid":`launcher-create-launch-progress`,"data-phase":e,className:`flex items-center gap-1.5 font-mono text-[11px] tracking-[0.06em] text-fg-muted`,children:[(0,R.jsx)(`span`,{"data-testid":`launcher-create-launch-phase`,children:B_[e]}),(0,R.jsx)(`div`,{className:`flex gap-[3px]`,children:z_.map((e,n)=>(0,R.jsx)(`span`,{"data-testid":`launcher-create-launch-phase-pip-${e}`,"data-active":n<=t?`true`:`false`,className:U(`h-[3px] w-2 rounded-sm`,n<=t?`bg-accent-sky`:`bg-border`)},e))})]})}function U_({draft:e,template:t}){let n=e.generatorConfig??{};return(0,R.jsx)(G,{"data-testid":`launcher-create-manifest-summary`,children:(0,R.jsxs)(Hi,{className:`flex flex-col gap-3 p-6`,children:[(0,R.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-[11px] uppercase tracking-[0.14em] text-fg-dim`,children:[e.templateContractId??t.id,`.`,e.templateContractVersion??t.version]}),(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[24px] font-normal text-foreground`,children:e.name??`— unnamed`}),e.description&&(0,R.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed text-fg-muted`,children:e.description})]}),(0,R.jsx)(kh,{}),(0,R.jsxs)(Y_,{children:[(0,R.jsx)(X_,{label:`Solution price`,value:K_(e.solutionPriceWei)}),(0,R.jsx)(X_,{label:`Verdict price`,value:K_(e.verdictPriceWei)}),t.id===`prediction`?(0,R.jsx)(W_,{generator:n}):(0,R.jsx)(G_,{generator:n})]})]})})}function W_({generator:e}){let t=q_(e.cadenceMs),n=q_(e.windowMs??e.submissionWindowMs),r=q_(e.maxOpenRounds);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(X_,{label:`Cadence`,value:t?`${t} ms`:`—`}),(0,R.jsx)(X_,{label:`Window`,value:n?`${n} ms`:`—`}),(0,R.jsx)(X_,{label:`Max open rounds`,value:r??`—`}),(0,R.jsx)(X_,{label:`Allowlist`,value:J_(e.allowlistConditionIds)}),(0,R.jsx)(X_,{label:`Blocklist`,value:J_(e.blocklistConditionIds)})]})}function G_({generator:e}){let t=q_(e.N_target_successes),n=q_(e.posting_window_ms),r=q_(e.post_batch_size);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(X_,{label:`Target successes`,value:t??`—`}),(0,R.jsx)(X_,{label:`Posting window`,value:n?`${n} ms`:`—`}),(0,R.jsx)(X_,{label:`Batch size`,value:r??`—`})]})}function K_(e){return e?`${e} wei (${Jg(e)})`:`—`}function q_(e){return typeof e==`number`&&Number.isFinite(e)?String(e):typeof e==`string`&&/^\d+$/.test(e.trim())?e.trim():null}function J_(e){return Array.isArray(e)&&e.length>0?`${e.length} entries`:`none`}function Y_({children:e}){return(0,R.jsx)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-2 sm:grid-cols-2`,children:e})}function X_({label:e,value:t}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.12em] text-fg-dim`,children:e}),(0,R.jsx)(`span`,{className:`font-mono text-[13px] text-foreground`,children:t})]})}function Z_({role:e,checked:t,onChange:n,disabled:r}){return(0,R.jsxs)(`label`,{className:U(`flex items-center gap-2.5`,r?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,R.jsx)(`input`,{"data-testid":`launcher-create-openRoles-${e}`,type:`checkbox`,checked:t,onChange:n,disabled:r,className:`h-4 w-4 cursor-pointer accent-accent-sky`}),(0,R.jsx)(`span`,{className:`font-mono text-[13px] text-foreground`,children:e})]})}function Q_(e){return new Promise(t=>setTimeout(t,e))}var $_=`jinn.launcher-create.draftId.v1`;function ev(){if(typeof window>`u`)return null;try{return window.localStorage.getItem($_)}catch{return null}}function tv(e){if(!(typeof window>`u`))try{e===null?window.localStorage.removeItem($_):window.localStorage.setItem($_,e)}catch{}}function nv(){if(typeof window>`u`)return null;let e=new URLSearchParams(window.location.search).get(`template`);return e&&e.length>0?e:null}function rv({templateKey:e}={}){let t=e??nv()??`prediction.v1`,n=(0,L.useMemo)(()=>h_[t]??null,[t]),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(1),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null),p=(0,L.useRef)(!1),{data:m}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap(),refetchInterval:3e4}),{data:h}=ut({queryKey:[`status`],queryFn:()=>B.getStatus(),refetchInterval:3e4}),g=m?.master_address??h?.master_address??null,_=h?.masterGas?.balanceWei??null;(0,L.useEffect)(()=>{if(p.current)return;p.current=!0;let e=!1;return(async()=>{let t=ev();if(t)try{let n=await B.solvernets.getDraft(t);if(e)return;i(n);return}catch{tv(null)}try{let t=await B.solvernets.createDraft();if(e)return;tv(t.draftId),i(t)}catch(t){if(e)return;o(t instanceof Error?t.message:`Failed to create draft.`)}})(),()=>{e=!0}},[]);let v=async e=>{if(r){u(!0),f(null);try{let t=await B.solvernets.updateDraft(r.draftId,e);i(t),c(e=>e<5?e+1:e)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},y=async e=>{if(r){u(!0),f(null);try{let t=await B.solvernets.updateDraft(r.draftId,e);i(t)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},b=()=>{f(null),c(e=>e>1?e-1:e)},x=()=>{f(null)};if(n===null)return(0,R.jsxs)(`main`,{"data-testid":`launcher-create-unknown-template`,"data-template-key":t,className:`mx-auto flex max-w-[720px] flex-col gap-4 p-6`,children:[(0,R.jsx)(`h1`,{className:`m-0 font-serif text-[28px] font-normal text-foreground`,children:`Unknown SolverNet template`}),(0,R.jsx)(fo,{variant:`blocking`,children:(0,R.jsxs)(mo,{className:`font-mono text-[13px]`,children:[`No template registered for `,(0,R.jsx)(`code`,{children:t}),`. Available keys:`,` `,Object.keys(h_).map(e=>`?template=${e}`).join(`, `),`.`]})})]});if(a)return(0,R.jsxs)(`main`,{"data-testid":`launcher-create-bootstrap-error`,className:`mx-auto flex max-w-[720px] flex-col gap-4 p-6`,children:[(0,R.jsx)(`h1`,{className:`m-0 font-serif text-[28px] font-normal text-foreground`,children:`Couldn't start a new draft`}),(0,R.jsxs)(fo,{variant:`blocking`,children:[(0,R.jsx)(po,{className:`font-mono text-[12px]`,children:`Bootstrap error`}),(0,R.jsx)(mo,{className:`font-mono text-[13px]`,children:a})]})]});if(!r)return(0,R.jsx)(`main`,{"data-testid":`launcher-create-loading`,className:`p-6 font-mono text-[13px] text-fg-muted`,children:`Loading draft…`});switch(s){case 1:return(0,R.jsx)(f_,{draft:r,onAdvance:v,busy:l,error:d});case 2:return(0,R.jsx)(__,{draft:r,template:n,onAdvance:v,onBack:b,busy:l,error:d});case 3:return(0,R.jsx)(S_,{draft:r,template:n,onAdvance:v,onBack:b,busy:l,error:d});case 4:return(0,R.jsx)(I_,{draft:r,template:n,onAdvance:v,onBack:b,fundingSafeAddress:g,fundingSafeBalanceWei:_??null,busy:l,error:d});case 5:return(0,R.jsx)(V_,{draft:r,template:n,onUpdateDraft:y,onBack:b,onLaunchFailure:x});default:return(0,R.jsx)(f_,{draft:r,onAdvance:v,busy:l,error:d})}}function iv(e){return e?e.length<=16?e:`${e.slice(0,8)}…${e.slice(-6)}`:``}function av(e){return e?e.length<=12?e:`${e.slice(0,6)}…${e.slice(-4)}`:``}function ov(e){if(!e)return`—`;try{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().replace(`T`,` `).slice(0,16)+` UTC`}catch{return e}}var sv={launched:[`paused`,`retired`],paused:[`launched`,`retired`]};function cv(e,t,n){let r=10n**BigInt(t),i=e/r,a=e%r;if(a===0n||n===0)return i.toString();let o=a.toString().padStart(t,`0`).slice(0,n).replace(/0+$/,``);return o?`${i}.${o}`:i.toString()}function lv(e){if(!e||!/^\d+$/.test(e))return`—`;try{let t=BigInt(e);return t===0n?`0 ETH`:t>=100000000000000n?`${cv(t,18,t>=1000000000000000000n?4:6)} ETH`:t>=1000000000n?`${cv(t,9,4)} gwei`:`${t.toLocaleString()} wei`}catch{return`—`}}var uv=175000n*11500000n;function dv(e,t,n,r=uv){if(!e||!/^\d+$/.test(e)||!t||!/^\d+$/.test(t)||!n||!/^\d+$/.test(n))return null;let i;try{i=BigInt(e)}catch{return null}let a=BigInt(t)+BigInt(n)+r;if(a<=0n)return null;let o=Number(i/a);return{tasks:o,perTaskWei:a,lowRunway:o<100}}var fv=6e4;function pv(e){let t=e??{};return{cadenceMs:gv(t.cadenceMs),windowMs:gv(t.windowMs??t.submissionWindowMs),resolveGapMs:gv(t.resolveGapMs),maxNewRoundsPerPoll:gv(t.maxNewRoundsPerPoll),maxNewRoundsPerDay:gv(t.maxNewRoundsPerDay),maxOpenRounds:gv(t.maxOpenRounds),allowlistConditionIds:_v(t.allowlistConditionIds),blocklistConditionIds:_v(t.blocklistConditionIds)}}function mv(e,t){let n=e??{},r=hv(n.claimPolicy),i=t?.contract.claimPolicyDefaults??{maxClaims:5,maxClaimsPerOperator:5,claimLeaseTtlSeconds:3600};return{N_target_successes:gv(n.N_target_successes),posting_window_ms:gv(n.posting_window_ms),post_batch_size:gv(n.post_batch_size),maxClaimsPerOperator:gv(n.maxClaimsPerOperator??r.maxClaimsPerOperator??i.maxClaimsPerOperator),claimLeaseTtlSeconds:gv(n.claimLeaseTtlSeconds??r.claimLeaseTtlSeconds??i.claimLeaseTtlSeconds)}}function hv(e){return typeof e==`object`&&e?e:{}}function gv(e){return typeof e==`number`&&Number.isFinite(e)?String(e):typeof e==`string`&&e.trim().length>0?e.trim():``}function _v(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).join(`, `):``}function vv(e){let t=e.trim();if(!t||!/^\d+$/.test(t))return null;let n=Number(t);return!Number.isFinite(n)||n<=0?null:n}function yv(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function bv(e,t){let n={},r={};for(let i of[`cadenceMs`,`windowMs`,`resolveGapMs`,`maxNewRoundsPerPoll`,`maxNewRoundsPerDay`,`maxOpenRounds`]){if(e[i]===t[i]||e[i].trim().length===0)continue;let a=vv(e[i]);if(a===null){n[i]=`Must be a positive integer.`;continue}if(i===`cadenceMs`&&a<fv){n[i]=`Cadence must be at least ${fv/1e3}s.`;continue}i===`windowMs`?r.submissionWindowMs=a:r[i]=a}for(let n of[`allowlistConditionIds`,`blocklistConditionIds`])e[n]!==t[n]&&(r[n]=yv(e[n]));return{ok:Object.keys(n).length===0,patch:r,errors:n}}function xv(e,t){let n={},r={};for(let i of[`N_target_successes`,`posting_window_ms`,`post_batch_size`,`maxClaimsPerOperator`,`claimLeaseTtlSeconds`]){if(e[i]===t[i]||e[i].trim().length===0)continue;let a=vv(e[i]);if(a===null){n[i]=i===`posting_window_ms`?`Must be a positive integer (ms).`:i===`claimLeaseTtlSeconds`?`Must be a positive integer (seconds).`:`Must be a positive integer.`;continue}r[i]=a}return{ok:Object.keys(n).length===0,patch:r,errors:n}}function Sv(e,t){if(t)return t.id===`swe-rebench-v2`&&t.version===`v1`;if(e.summary?.contractId===`swe-rebench-v2`&&e.summary.contractVersion===`v1`)return!0;let n=e.generatorConfig??{};return Object.prototype.hasOwnProperty.call(n,`N_target_successes`)||Object.prototype.hasOwnProperty.call(n,`N_max_postings_per_task`)||Object.prototype.hasOwnProperty.call(n,`posting_window_ms`)||Object.prototype.hasOwnProperty.call(n,`cooldown_ms`)}function Cv({record:e,manifest:t,template:n,onSave:r}){return Sv(e,n)?(0,R.jsx)(Ev,{record:e,manifest:t,onSave:r}):(0,R.jsx)(Tv,{record:e,onSave:r})}function wv({record:e,configExpanded:t,setConfigExpanded:n,children:r}){return(0,R.jsxs)(G,{"data-testid":`launcher-launched-generator-panel`,role:`region`,"aria-label":`Generator`,className:`flex flex-col gap-4 p-6`,children:[(0,R.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[22px] font-normal text-foreground`,children:`Generator`}),(0,R.jsx)(Mv,{record:e})]}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-launched-generator-toggle`,"aria-expanded":t,"aria-controls":`launcher-launched-generator-config`,onClick:()=>n(e=>!e),children:t?`Hide config`:`Edit config`})]}),(0,R.jsxs)(`dl`,{className:`m-0 grid gap-y-2 gap-x-4 [grid-template-columns:repeat(auto-fit,minmax(180px,1fr))]`,children:[(0,R.jsx)(Iv,{label:`Last poll`,value:ov(e.generatorState?.lastPollAt),testid:`launcher-launched-generator-last-poll`}),(0,R.jsx)(Iv,{label:`Generator enabled`,value:e.generatorEnabled?`yes`:`no`,testid:`launcher-launched-generator-enabled`}),e.generatorState?.totalPosted!==void 0&&(0,R.jsx)(Iv,{label:`Total posted`,value:String(e.generatorState.totalPosted),testid:`launcher-launched-generator-total-posted`}),e.generatorState?.lastPostedInstanceId!==void 0&&(0,R.jsx)(Iv,{label:`Last posted`,value:e.generatorState.lastPostedInstanceId,testid:`launcher-launched-generator-last-posted`})]}),(0,R.jsx)(Ov,{record:e}),(0,R.jsx)(jv,{record:e}),e.generatorState?.lastError&&(0,R.jsx)(Av,{record:e}),r]})}function Tv({record:e,onSave:t}){let n=(0,L.useMemo)(()=>pv(e.generatorConfig),[e.generatorConfig]),[r,i]=(0,L.useState)(n),[a,o]=(0,L.useState)({kind:`idle`}),[s,c]=(0,L.useState)(!1);(0,L.useEffect)(()=>{i(t=>JSON.stringify(t)===JSON.stringify(e())?n:t);function e(){return n}},[JSON.stringify(e.generatorConfig)]);let l=(e,t)=>{i(n=>({...n,[e]:t}))},u=(0,L.useMemo)(()=>bv(r,n),[r,n]),d=Object.keys(u.patch).length>0,f=a.kind===`saving`;return(0,R.jsx)(wv,{record:e,configExpanded:s,setConfigExpanded:c,children:s&&(0,R.jsxs)(`div`,{id:`launcher-launched-generator-config`,"data-testid":`launcher-launched-generator-config`,className:`flex flex-col gap-3.5 pt-3.5`,children:[(0,R.jsx)(kh,{}),(0,R.jsx)(`h3`,{className:`m-0 font-mono text-[11px] uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Hot-apply config`}),(0,R.jsxs)(`div`,{className:`grid gap-3.5 [grid-template-columns:repeat(auto-fit,minmax(220px,1fr))]`,children:[(0,R.jsx)(Pv,{label:`Cadence (ms)`,testid:`launcher-launched-generator-cadenceMs`,value:r.cadenceMs,onChange:e=>l(`cadenceMs`,e),error:u.errors.cadenceMs,disabled:f}),(0,R.jsx)(Pv,{label:`Submission window (ms)`,testid:`launcher-launched-generator-windowMs`,value:r.windowMs,onChange:e=>l(`windowMs`,e),error:u.errors.windowMs,disabled:f}),(0,R.jsx)(Pv,{label:`Resolve gap (ms)`,testid:`launcher-launched-generator-resolveGapMs`,value:r.resolveGapMs,onChange:e=>l(`resolveGapMs`,e),error:u.errors.resolveGapMs,disabled:f}),(0,R.jsx)(Pv,{label:`Max rounds / poll`,testid:`launcher-launched-generator-maxNewRoundsPerPoll`,value:r.maxNewRoundsPerPoll,onChange:e=>l(`maxNewRoundsPerPoll`,e),error:u.errors.maxNewRoundsPerPoll,disabled:f}),(0,R.jsx)(Pv,{label:`Max rounds / day`,testid:`launcher-launched-generator-maxNewRoundsPerDay`,value:r.maxNewRoundsPerDay,onChange:e=>l(`maxNewRoundsPerDay`,e),error:u.errors.maxNewRoundsPerDay,disabled:f}),(0,R.jsx)(Pv,{label:`Max open rounds`,testid:`launcher-launched-generator-maxOpenRounds`,value:r.maxOpenRounds,onChange:e=>l(`maxOpenRounds`,e),error:u.errors.maxOpenRounds,disabled:f})]}),(0,R.jsx)(Fv,{label:`Allowlist condition ids`,testid:`launcher-launched-generator-allowlistConditionIds`,value:r.allowlistConditionIds,onChange:e=>l(`allowlistConditionIds`,e),disabled:f}),(0,R.jsx)(Fv,{label:`Blocklist condition ids`,testid:`launcher-launched-generator-blocklistConditionIds`,value:r.blocklistConditionIds,onChange:e=>l(`blocklistConditionIds`,e),disabled:f}),(0,R.jsx)(Dv,{dirty:d,saving:f,validationOk:u.ok,saveStatus:a,onSubmit:async()=>{if(!(!u.ok||!d||f)){o({kind:`saving`});try{await t(u.patch),o({kind:`saved`,at:new Date})}catch(e){o({kind:`error`,message:e instanceof Error?e.message:String(e)})}}}})]})})}function Ev({record:e,manifest:t,onSave:n}){let r=(0,L.useMemo)(()=>mv(e.generatorConfig,t),[e.generatorConfig,t]),[i,a]=(0,L.useState)(r),[o,s]=(0,L.useState)({kind:`idle`}),[c,l]=(0,L.useState)(!1);(0,L.useEffect)(()=>{a(e=>JSON.stringify(e)===JSON.stringify(r)?r:e)},[JSON.stringify(e.generatorConfig)]);let u=(e,t)=>{a(n=>({...n,[e]:t}))},d=(0,L.useMemo)(()=>xv(i,r),[i,r]),f=Object.keys(d.patch).length>0,p=o.kind===`saving`;return(0,R.jsx)(wv,{record:e,configExpanded:c,setConfigExpanded:l,children:c&&(0,R.jsxs)(`div`,{id:`launcher-launched-generator-config`,"data-testid":`launcher-launched-generator-config`,className:`flex flex-col gap-3.5 pt-3.5`,children:[(0,R.jsx)(kh,{}),(0,R.jsx)(`h3`,{className:`m-0 font-mono text-[11px] uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Hot-apply config`}),(0,R.jsxs)(`div`,{className:`grid gap-3.5 [grid-template-columns:repeat(auto-fit,minmax(220px,1fr))]`,children:[(0,R.jsx)(Pv,{label:`Target successful Verdicts per instance`,testid:`launcher-launched-generator-N_target_successes`,value:i.N_target_successes,onChange:e=>u(`N_target_successes`,e),error:d.errors.N_target_successes,disabled:p}),(0,R.jsx)(Pv,{label:`Posting window (ms)`,testid:`launcher-launched-generator-posting_window_ms`,value:i.posting_window_ms,onChange:e=>u(`posting_window_ms`,e),error:d.errors.posting_window_ms,disabled:p}),(0,R.jsx)(Pv,{label:`Post batch size`,testid:`launcher-launched-generator-post_batch_size`,value:i.post_batch_size,onChange:e=>u(`post_batch_size`,e),error:d.errors.post_batch_size,disabled:p})]}),(0,R.jsx)(`h3`,{className:`m-0 font-mono text-[11px] uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Claim policy`}),(0,R.jsxs)(`div`,{className:`grid gap-3.5 [grid-template-columns:repeat(auto-fit,minmax(180px,1fr))]`,children:[(0,R.jsx)(Pv,{label:`Max claims per operator`,testid:`launcher-launched-generator-maxClaimsPerOperator`,value:i.maxClaimsPerOperator,onChange:e=>u(`maxClaimsPerOperator`,e),error:d.errors.maxClaimsPerOperator,disabled:p}),(0,R.jsx)(Pv,{label:`Claim lease (seconds)`,testid:`launcher-launched-generator-claimLeaseTtlSeconds`,value:i.claimLeaseTtlSeconds,onChange:e=>u(`claimLeaseTtlSeconds`,e),error:d.errors.claimLeaseTtlSeconds,disabled:p})]}),(0,R.jsx)(Dv,{dirty:f,saving:p,validationOk:d.ok,saveStatus:o,onSubmit:async()=>{if(!(!d.ok||!f||p)){s({kind:`saving`});try{await n(d.patch),s({kind:`saved`,at:new Date})}catch(e){s({kind:`error`,message:e instanceof Error?e.message:String(e)})}}}})]})})}function Dv({dirty:e,saving:t,validationOk:n,saveStatus:r,onSubmit:i}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2`,children:[(0,R.jsx)(kh,{}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[(0,R.jsx)(Nv,{status:r}),(0,R.jsx)(W,{type:`button`,variant:`default`,"data-testid":`launcher-launched-generator-save`,onClick:()=>{i()},disabled:!(e&&n&&!t),children:t?`Saving…`:`Save`})]})]})}function Ov({record:e}){let t=e.generatorState?.lastPollSummary;return kv(t)?(0,R.jsxs)(`dl`,{"data-testid":`launcher-launched-generator-pool-summary`,className:`m-0 grid gap-y-2 gap-x-4 [grid-template-columns:repeat(auto-fit,minmax(120px,1fr))]`,children:[(0,R.jsx)(Iv,{label:`Pool`,value:String(t.poolSize),testid:`launcher-launched-generator-poolSize`}),(0,R.jsx)(Iv,{label:`Posted`,value:String(t.posted),testid:`launcher-launched-generator-posted`}),(0,R.jsx)(Iv,{label:`Unposted`,value:String(t.unposted),testid:`launcher-launched-generator-unposted`}),(0,R.jsx)(Iv,{label:`Live`,value:String(t.live),testid:`launcher-launched-generator-live`}),(0,R.jsx)(Iv,{label:`Repostable`,value:String(t.repostable),testid:`launcher-launched-generator-repostable`}),(0,R.jsx)(Iv,{label:`Saturated`,value:String(t.saturated),testid:`launcher-launched-generator-saturated`})]}):null}function kv(e){if(typeof e!=`object`||!e)return!1;let t=e;return[`poolSize`,`posted`,`unposted`,`live`,`repostable`,`saturated`].every(e=>typeof t[e]==`number`)}function Av({record:e}){return(0,R.jsxs)(`div`,{"data-testid":`launcher-launched-generator-error`,className:`flex flex-col gap-1 rounded-md border border-destructive bg-card p-3`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-[12px] font-medium text-destructive`,children:[`Last error · `,ov(e.generatorState?.lastError?.at)]}),(0,R.jsx)(`span`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:e.generatorState?.lastError?.message})]})}function jv({record:e}){let t=e.generatorState?.poolPublicationUpdatedAt;if(!t)return null;let n=e.generatorState?.poolPublicationPriorSize,r=e.generatorState?.poolPublicationCurrentSize,i=typeof n==`number`&&typeof r==`number`?`Pool grew from ${n} → ${r} scorable tasks`:`Pool re-published`;return(0,R.jsxs)(fo,{"data-testid":`launcher-launched-generator-pool-republished`,variant:`default`,children:[(0,R.jsx)(po,{children:`Vetted pool re-published`}),(0,R.jsxs)(mo,{children:[i,` · `,ov(t)]})]})}function Mv({record:e}){let t=e.generatorEnabled,n=e.generatorState?.lastError?{variant:`destructive`,label:`Errored`}:t?{variant:`success`,label:`Enabled`}:{variant:`outline`,label:`Disabled`};return(0,R.jsx)(q,{"data-testid":`launcher-launched-generator-state-badge`,variant:n.variant,children:n.label})}function Nv({status:e}){return e.kind===`saving`?(0,R.jsx)(`span`,{"data-testid":`launcher-launched-generator-save-status`,className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:`Saving…`}):e.kind===`saved`?(0,R.jsxs)(`span`,{"data-testid":`launcher-launched-generator-save-status`,className:`font-mono text-[12px] text-[var(--vow-green)]`,children:[`Saved at `,e.at.toISOString().slice(11,16),` UTC`]}):e.kind===`error`?(0,R.jsxs)(`span`,{"data-testid":`launcher-launched-generator-save-status`,className:`font-mono text-[12px] text-destructive`,children:[`Save failed: `,e.message]}):(0,R.jsx)(`span`,{"data-testid":`launcher-launched-generator-save-status`,className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:`Edits hot-apply without restart.`})}function Pv({label:e,testid:t,value:n,onChange:r,error:i,disabled:a}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(Gf,{htmlFor:t,className:`font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:e}),(0,R.jsx)(o_,{id:t,"data-testid":t,type:`text`,inputMode:`numeric`,value:n,onChange:e=>r(e.target.value),disabled:a,className:U(i&&`border-destructive`)}),i&&(0,R.jsx)(`span`,{"data-testid":`${t}-error`,className:`font-mono text-[11px] text-destructive`,children:i})]})}function Fv({label:e,testid:t,value:n,onChange:r,disabled:i}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(Gf,{htmlFor:t,className:`font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:e}),(0,R.jsx)(`textarea`,{id:t,"data-testid":t,value:n,onChange:e=>r(e.target.value),disabled:i,rows:2,placeholder:`0xabc…, 0xdef…`,className:`flex w-full resize-y rounded-md border border-input bg-transparent px-3 py-2 font-mono text-[13px] text-foreground transition-colors placeholder:text-[var(--fg-dim)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`})]})}function Iv({label:e,value:t,testid:n}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,R.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:e}),(0,R.jsx)(`dd`,{"data-testid":n,className:`m-0 font-mono text-[13px] text-foreground`,children:t})]})}var Lv=Object.defineProperty,Rv=(e,t)=>Lv(e,`name`,{value:t,configurable:!0}),zv=`focusScope.autoFocusOnMount`,Bv=`focusScope.autoFocusOnUnmount`,Vv={bubbles:!1,cancelable:!0},Hv=L.forwardRef(Rv(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=L.useState(null),l=aa(i),u=aa(a),d=L.useRef(null),f=Kn(t,c),p=L.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;L.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Yv(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Yv(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Yv(s)};Rv(e,`handleFocusIn`),Rv(t,`handleFocusOut`),Rv(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),L.useEffect(()=>{if(s){Xv.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(zv,Vv);s.addEventListener(zv,l),s.dispatchEvent(t),t.defaultPrevented||(Uv($v(Gv(s)),{select:!0}),document.activeElement===e&&Yv(s))}return()=>{s.removeEventListener(zv,l),setTimeout(()=>{let t=new CustomEvent(Bv,Vv);s.addEventListener(Bv,u),s.dispatchEvent(t),t.defaultPrevented||Yv(e??document.body,{select:!0}),s.removeEventListener(Bv,u),Xv.remove(p)},0)}}},[s,l,u,p]);let m=L.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Wv(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Yv(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Yv(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,R.jsx)(Gi.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function Uv(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Yv(r,{select:t}),document.activeElement!==n)return}Rv(Uv,`focusFirst`);function Wv(e){let t=Gv(e);return[Kv(t,e),Kv(t.reverse(),e)]}Rv(Wv,`getTabbableEdges`);function Gv(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Rv(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}Rv(Gv,`getTabbableCandidates`);function Kv(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):qv(r,{upTo:t})))return r}Rv(Kv,`findVisible`);function qv(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}Rv(qv,`isHidden`);function Jv(e){return e instanceof HTMLInputElement&&`select`in e}Rv(Jv,`isSelectableInput`);function Yv(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Jv(e)&&t&&e.select()}}Rv(Yv,`focus`);var Xv=Zv();function Zv(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Qv(e,t),e.unshift(t)},remove(t){e=Qv(e,t),e[0]?.resume()}}}Rv(Zv,`createFocusScopesStack`);function Qv(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Rv(Qv,`arrayRemove`);function $v(e){return e.filter(e=>e.tagName!==`A`)}Rv($v,`removeLinks`);var ey=0,ty=null;function ny(){L.useEffect(()=>{ty||={start:ry(),end:ry()};let{start:e,end:t}=ty;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),ey++,()=>{ey===1&&(ty?.start.remove(),ty?.end.remove(),ty=null),ey=Math.max(0,ey-1)}},[])}function ry(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var iy=function(){return iy=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},iy.apply(this,arguments)};function ay(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function oy(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var sy=`right-scroll-bar-position`,cy=`width-before-scroll-bar`,ly=`with-scroll-bars-hidden`,uy=`--removed-body-scroll-bar-size`;function dy(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function fy(e,t){var n=(0,L.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var py=typeof window<`u`?L.useLayoutEffect:L.useEffect,my=new WeakMap;function hy(e,t){var n=fy(t||null,function(t){return e.forEach(function(e){return dy(e,t)})});return py(function(){var t=my.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||dy(e,null)}),i.forEach(function(e){r.has(e)||dy(e,a)})}my.set(n,e)},[e]),n}function gy(e){return e}function _y(e,t){t===void 0&&(t=gy);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function vy(e){e===void 0&&(e={});var t=_y(null);return t.options=iy({async:!0,ssr:!1},e),t}var yy=function(e){var t=e.sideCar,n=ay(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return L.createElement(r,iy({},n))};yy.isSideCarExport=!0;function by(e,t){return e.useMedium(t),yy}var xy=vy(),Sy=function(){},Cy=L.forwardRef(function(e,t){var n=L.useRef(null),r=L.useState({onScrollCapture:Sy,onWheelCapture:Sy,onTouchMoveCapture:Sy}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=ay(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=hy([n,t]),C=iy(iy({},b),i);return L.createElement(L.Fragment,null,u&&L.createElement(x,{sideCar:xy,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?L.cloneElement(L.Children.only(s),iy(iy({},C),{ref:S})):L.createElement(v,iy({},C,{className:c,ref:S}),s))});Cy.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Cy.classNames={fullWidth:cy,zeroRight:sy};var wy,Ty=function(){if(wy)return wy;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Ey(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Ty();return t&&e.setAttribute(`nonce`,t),e}function Dy(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Oy(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var ky=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ey())&&(Dy(t,n),Oy(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ay=function(){var e=ky();return function(t,n){L.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},jy=function(){var e=Ay();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},My={left:0,top:0,right:0,gap:0},Ny=function(e){return parseInt(e||``,10)||0},Py=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Ny(n),Ny(r),Ny(i)]},Fy=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return My;var t=Py(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Iy=jy(),Ly=`data-scroll-locked`,Ry=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
24
- .${ly} {
22
+ `))}catch{}},()=>{e=!0,n!==null&&window.cancelAnimationFrame(n),u.close(),o?.disconnect(),i?.dispose()}},[]);let u=e&&!o;return(0,R.jsxs)(`div`,{className:`flex h-full w-full flex-col bg-[var(--bg-sunken)]`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border bg-[var(--bg-elevated)] px-4 py-2`,children:[(0,R.jsx)(`span`,{className:U(`font-mono text-[11px] tracking-[0.05em]`,i?`text-[var(--vow-green)]`:`text-[var(--fg-dim)]`),children:i?`● connected`:`○ disconnected`}),n&&(0,R.jsx)(q,{variant:n.active?`warning`:`secondary`,title:n.active?`Claude Code Auto Mode is active`:n.reason,children:n.active?`Auto Mode`:`Default permissions`})]}),c&&(0,R.jsxs)(fo,{variant:`blocking`,className:`m-3 flex flex-col gap-2`,children:[(0,R.jsx)(po,{className:`text-[var(--break-red)]`,children:`Agent panel unavailable`}),(0,R.jsx)(mo,{className:`font-mono text-xs text-[var(--fg-muted)]`,children:c.message}),c.remediation&&(0,R.jsxs)(`p`,{className:`font-mono text-xs text-[var(--fg-dim)]`,children:[(0,R.jsx)(`span`,{className:`text-[var(--fg-muted)]`,children:`Fix · `}),c.remediation]})]}),(0,R.jsx)(`div`,{ref:t,className:U(`w-full flex-1 bg-[var(--bg-sunken)] p-3`,`min-h-[400px]`,u&&`invisible hidden`)}),u&&!c&&(0,R.jsx)(Yo,{})]})}function Yo(){return(0,R.jsx)(`div`,{className:`flex w-full flex-1 items-center justify-center bg-[var(--bg-sunken)] px-6`,children:(0,R.jsxs)(`div`,{className:`flex max-w-[34ch] flex-col items-center gap-4 text-center`,children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`jinn-anim-pulse h-2 w-2 rounded-full bg-[var(--seer-violet)]`}),(0,R.jsx)(`p`,{className:`font-mono text-xs text-[var(--fg-muted)]`,children:`The agent will come online once harness setup is complete.`})]})})}var Xo={pluginBuilderUi:!1,embeddedAgent:!1};function Zo(){let e=typeof window>`u`?void 0:window.__JINN_FEATURES__;return!e||typeof e!=`object`?Xo:{pluginBuilderUi:e.pluginBuilderUi===!0,embeddedAgent:e.embeddedAgent===!0}}function Qo({envelope:e,chainExplorerBase:t}){let n=ts(e),r=ns(e.generatedAt),[i,a]=(0,L.useState)(`idle`),[o,s]=(0,L.useState)(null),c=e.details,l=(typeof c?.category==`string`?c.category:void 0)===`insufficient_funds`,u=typeof c?.address==`string`?c.address:null,d=typeof c?.requiredWei==`string`?c.requiredWei:typeof c?.needWei==`string`?c.needWei:null,f=typeof c?.haveWei==`string`?c.haveWei:null,p=(typeof c?.txHash==`string`?c.txHash:null)??n,m=(0,L.useCallback)(async()=>{a(`retrying`),s(null);try{await B.retryBootstrap(),a(`success`)}catch(e){a(`error`),s(e instanceof Error?e.message:String(e))}},[]);return(0,R.jsxs)(fo,{variant:`blocking`,className:`flex flex-col gap-3 px-5 py-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,R.jsxs)(po,{className:`text-[var(--break-red)]`,children:[`Bootstrap halted · `,e.code]}),r&&(0,R.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--fg-dim)]`,children:r})]}),(0,R.jsx)(mo,{className:`break-words font-mono text-xs text-foreground`,children:e.message}),l&&u&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)($o,{label:`Send ETH to`,children:u}),d&&(0,R.jsx)($o,{label:`Required`,children:es(d)}),f&&(0,R.jsx)($o,{label:`Currently have`,children:es(f)}),d&&f&&(0,R.jsx)($o,{label:`Shortfall`,children:es((BigInt(d)-BigInt(f)).toString())})]}),!l&&e.hint&&(0,R.jsxs)(`p`,{className:`font-mono text-xs text-[var(--fg-muted)]`,children:[(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`Fix · `}),e.hint]}),p&&(0,R.jsx)(W,{asChild:!0,variant:`link`,size:`sm`,className:`self-start px-0`,children:(0,R.jsxs)(`a`,{href:`${t}/tx/${p}`,target:`_blank`,rel:`noopener noreferrer`,children:[`view failed tx`,(0,R.jsx)(kn,{})]})}),(0,R.jsxs)(`div`,{className:`mt-1 flex items-center gap-3`,children:[(0,R.jsx)(W,{variant:`destructive`,size:`sm`,type:`button`,onClick:()=>{m()},disabled:i===`retrying`,children:i===`retrying`?`Retrying…`:i===`success`?`Resuming…`:`Retry`}),i===`success`&&(0,R.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--fg-muted)]`,children:`Daemon resumed — waiting for bootstrap to complete`}),i===`error`&&o&&(0,R.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--break-red)]`,children:o})]}),i===`idle`&&(0,R.jsxs)(`p`,{className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:[`Once you've addressed the cause above, click Retry or`,` `,(0,R.jsx)(`code`,{className:`text-[var(--fg-muted)]`,children:`jinn run`}),` to resume from the persisted state.`]})]})}function $o({label:e,children:t}){return(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`min-w-[100px] shrink-0 font-mono text-[11px] text-[var(--fg-dim)]`,children:e}),(0,R.jsx)(`span`,{className:`break-all font-mono text-[11px] text-foreground`,children:t})]})}function es(e){try{let t=BigInt(e),n=Number(t)/0xde0b6b3a7640000;return n===0?`0 ETH`:n<1e-6?`${t} wei`:`${n.toFixed(6).replace(/\.?0+$/,``)} ETH`}catch{return e}}function ts(e){let t=[e.details?.txHash,e.details?.cause,e.message];for(let e of t){if(typeof e!=`string`)continue;let t=/(0x[a-fA-F0-9]{64})/.exec(e);if(t)return t[1]}return null}function ns(e){try{let t=Date.now()-Date.parse(e);if(!Number.isFinite(t)||t<0)return null;let n=Math.round(t/1e3);if(n<60)return`${n}s ago`;let r=Math.round(n/60);return r<60?`${r}m ago`:`${Math.round(r/60)}h ago`}catch{return null}}var rs=Object.defineProperty,is=(e,t)=>rs(e,`name`,{value:t,configurable:!0}),as=`dismissableLayer.update`,os=`dismissableLayer.pointerDownOutside`,ss=`dismissableLayer.focusOutside`,cs,ls=L.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),us=L.forwardRef(is(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=L.useContext(ls),[d,f]=L.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=L.useState({}),h=Kn(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=L.useRef(!1),C=ps(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:L.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=ms(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=aa(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return L.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),L.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(cs=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),hs(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=cs))}},[d,p,n,u]),L.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),hs())},[d,u]),L.useEffect(()=>{let e=is(()=>m({}),`handleUpdate`);return document.addEventListener(as,e),()=>document.removeEventListener(as,e)},[]),(0,R.jsx)(Gi.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:K(e.onFocusCapture,w.onFocusCapture),onBlurCapture:K(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:K(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function ds(){let e=L.useContext(ls),[t,n]=L.useState(null);return L.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}is(ds,`useDismissableLayerSurface`);var fs=is(()=>!0,`IS_TRUE`);function ps(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=fs}=t,s=aa(e),c=L.useRef(!1),l=L.useRef(!1),u=L.useRef(new Map),d=L.useRef(()=>{});return L.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}is(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}is(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}is(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}is(p,`handleInteractionBubble`);let m=is(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||gs(os,s,p,{discrete:!0})};if(is(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:is(()=>c.current=!0,`onPointerDownCapture`)}}is(ps,`usePointerDownOutside`);function ms(e,t=globalThis?.document){let n=aa(e),r=L.useRef(!1);return L.useEffect(()=>{let e=is(e=>{e.target&&!r.current&&gs(ss,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:is(()=>r.current=!0,`onFocusCapture`),onBlurCapture:is(()=>r.current=!1,`onBlurCapture`)}}is(ms,`useFocusOutside`);function hs(){let e=new CustomEvent(as);document.dispatchEvent(e)}is(hs,`dispatchUpdate`);function gs(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Ki(i,a):i.dispatchEvent(a)}is(gs,`handleAndDispatchCustomEvent`);var _s=L.useId||(()=>void 0),vs=0;function ys(e){let[t,n]=L.useState(_s());return qi(()=>{e||n(e=>e??String(vs++))},[e]),e||(t?`radix-${t}`:``)}var bs=[`top`,`right`,`bottom`,`left`],xs=Math.min,Ss=Math.max,Cs=Math.round,ws=Math.floor,Ts=e=>({x:e,y:e}),Es={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ds(e,t,n){return Ss(e,xs(t,n))}function Os(e,t){return typeof e==`function`?e(t):e}function ks(e){return e.split(`-`)[0]}function As(e){return e.split(`-`)[1]}function js(e){return e===`x`?`y`:`x`}function Ms(e){return e===`y`?`height`:`width`}function Ns(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ps(e){return js(Ns(e))}function Fs(e,t,n){n===void 0&&(n=!1);let r=As(e),i=Ps(e),a=Ms(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ws(o)),[o,Ws(o)]}function Is(e){let t=Ws(e);return[Ls(e),t,Ls(t)]}function Ls(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Rs=[`left`,`right`],zs=[`right`,`left`],Bs=[`top`,`bottom`],Vs=[`bottom`,`top`];function Hs(e,t,n){switch(e){case`top`:case`bottom`:return n?t?zs:Rs:t?Rs:zs;case`left`:case`right`:return t?Bs:Vs;default:return[]}}function Us(e,t,n,r){let i=As(e),a=Hs(ks(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ls)))),a}function Ws(e){let t=ks(e);return Es[t]+e.slice(t.length)}function Gs(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ks(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Gs(e)}function qs(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 Js(e,t,n){let{reference:r,floating:i}=e,a=Ns(t),o=Ps(t),s=Ms(o),c=ks(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(As(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 Ys(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}=Os(t,e),p=Ks(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=qs(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=qs(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 Xs=50,Zs=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ys},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Js(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<Xs&&(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}=Js(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Qs=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}=Os(e,t)||{};if(l==null)return{};let d=Ks(u),f={x:n,y:r},p=Ps(i),m=Ms(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=xs(d[_],T),D=xs(d[v],T),O=E,ee=C-h[m]-D,k=C/2-h[m]/2+w,A=Ds(O,k,ee),j=!c.arrow&&As(i)!=null&&k!==A&&a.reference[m]/2-(k<O?E:D)-h[m]/2<0,M=j?k<O?k-O:k-ee:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),$s=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}=Os(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ks(r),_=Ns(o),v=ks(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ws(o)]:Is(o)),x=p!==`none`;!d&&x&&b.push(...Us(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=Fs(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`&&_!==Ns(t))||T.every(e=>Ns(e.placement)!==_||e.overflows[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=Ns(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 ec(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function tc(e){return bs.some(t=>e[t]>=0)}var nc=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Os(e,t);switch(i){case`referenceHidden`:{let e=ec(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:tc(e)}}}case`escaped`:{let e=ec(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:tc(e)}}}default:return{}}}}},rc=new Set([`left`,`top`]);async function ic(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ks(n),s=As(n),c=Ns(n)===`y`,l=rc.has(o)?-1:1,u=a&&c?-1:1,d=Os(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 ac=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 ic(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}}}}},oc=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}=Os(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ns(ks(i)),p=js(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=Ds(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=Ds(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}}}}}},sc=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}=Os(e,t),u={x:n,y:r},d=Ns(i),f=js(d),p=u[f],m=u[d],h=Os(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=rc.has(ks(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}}}},cc=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}=Os(e,t),u=await o.detectOverflow(t,l),d=ks(i),f=As(i),p=Ns(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=xs(h-u[g],v),x=xs(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=Ss(u.left,0),t=Ss(u.right,0),n=Ss(u.top,0),r=Ss(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Ss(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Ss(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 lc(){return typeof window<`u`}function uc(e){return pc(e)?(e.nodeName||``).toLowerCase():`#document`}function dc(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fc(e){return((pc(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function pc(e){return lc()?e instanceof Node||e instanceof dc(e).Node:!1}function mc(e){return lc()?e instanceof Element||e instanceof dc(e).Element:!1}function hc(e){return lc()?e instanceof HTMLElement||e instanceof dc(e).HTMLElement:!1}function gc(e){return!lc()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof dc(e).ShadowRoot}function _c(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Oc(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function vc(e){return/^(table|td|th)$/.test(uc(e))}function yc(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var bc=/transform|translate|scale|rotate|perspective|filter/,xc=/paint|layout|strict|content/,Sc=e=>!!e&&e!==`none`,Cc;function wc(e){let t=mc(e)?Oc(e):e;return Sc(t.transform)||Sc(t.translate)||Sc(t.scale)||Sc(t.rotate)||Sc(t.perspective)||!Ec()&&(Sc(t.backdropFilter)||Sc(t.filter))||bc.test(t.willChange||``)||xc.test(t.contain||``)}function Tc(e){let t=Ac(e);for(;hc(t)&&!Dc(t);){if(wc(t))return t;if(yc(t))return null;t=Ac(t)}return null}function Ec(){return Cc??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Cc}function Dc(e){return/^(html|body|#document)$/.test(uc(e))}function Oc(e){return dc(e).getComputedStyle(e)}function kc(e){return mc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ac(e){if(uc(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||gc(e)&&e.host||fc(e);return gc(t)?t.host:t}function jc(e){let t=Ac(e);return Dc(t)?e.ownerDocument?e.ownerDocument.body:e.body:hc(t)&&_c(t)?t:jc(t)}function Mc(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=jc(e),i=r===e.ownerDocument?.body,a=dc(r);if(i){let e=Nc(a);return t.concat(a,a.visualViewport||[],_c(r)?r:[],e&&n?Mc(e):[])}else return t.concat(r,Mc(r,[],n))}function Nc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Pc(e){let t=Oc(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=hc(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Cs(n)!==a||Cs(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Fc(e){return mc(e)?e:e.contextElement}function Ic(e){let t=Fc(e);if(!hc(t))return Ts(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Pc(t),o=(a?Cs(n.width):n.width)/r,s=(a?Cs(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Lc=Ts(0);function Rc(e){let t=dc(e);return!Ec()||!t.visualViewport?Lc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zc(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==dc(e)?!1:t}function Bc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Fc(e),o=Ts(1);t&&(r?mc(r)&&(o=Ic(r)):o=Ic(e));let s=zc(a,n,r)?Rc(a):Ts(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=dc(a),t=r&&mc(r)?dc(r):r,n=e,i=Nc(n);for(;i&&r&&t!==n;){let e=Ic(i),t=i.getBoundingClientRect(),r=Oc(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=dc(i),i=Nc(n)}}return qs({width:u,height:d,x:c,y:l})}function Vc(e,t){let n=kc(e).scrollLeft;return t?t.left+n:Bc(fc(e)).left+n}function Hc(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Vc(e,n),y:n.top+t.scrollTop}}function Uc(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=fc(r),s=t?yc(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ts(1),u=Ts(0),d=hc(r);if((d||!d&&!a)&&((uc(r)!==`body`||_c(o))&&(c=kc(r)),d)){let e=Bc(r);l=Ic(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Hc(o,c):Ts(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 Wc(e){return Array.from(e.getClientRects())}function Gc(e){let t=fc(e),n=kc(e),r=e.ownerDocument.body,i=Ss(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Ss(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Vc(e),s=-n.scrollTop;return Oc(r).direction===`rtl`&&(o+=Ss(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Kc=25;function qc(e,t){let n=dc(e),r=fc(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ec();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Vc(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<=Kc&&(a-=o)}else l<=Kc&&(a+=l);return{width:a,height:o,x:s,y:c}}function Jc(e,t){let n=Bc(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=hc(e)?Ic(e):Ts(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Yc(e,t,n){let r;if(t===`viewport`)r=qc(e,n);else if(t===`document`)r=Gc(fc(e));else if(mc(t))r=Jc(t,n);else{let n=Rc(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return qs(r)}function Xc(e,t){let n=Ac(e);return n===t||!mc(n)||Dc(n)?!1:Oc(n).position===`fixed`||Xc(n,t)}function Zc(e,t){let n=t.get(e);if(n)return n;let r=Mc(e,[],!1).filter(e=>mc(e)&&uc(e)!==`body`),i=null,a=Oc(e).position===`fixed`,o=a?Ac(e):e;for(;mc(o)&&!Dc(o);){let t=Oc(o),n=wc(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||_c(o)&&!n&&Xc(e,o))?r=r.filter(e=>e!==o):i=t,o=Ac(o)}return t.set(e,r),r}function Qc(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?yc(t)?[]:Zc(t,this._c):[].concat(n),r],o=Yc(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=Yc(t,a[e],i);s=Ss(n.top,s),c=xs(n.right,c),l=xs(n.bottom,l),u=Ss(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function $c(e){let{width:t,height:n}=Pc(e);return{width:t,height:n}}function el(e,t,n){let r=hc(t),i=fc(t),a=n===`fixed`,o=Bc(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ts(0);function l(){c.x=Vc(i)}if(r||!r&&!a)if((uc(t)!==`body`||_c(i))&&(s=kc(t)),r){let e=Bc(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?Hc(i,s):Ts(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 tl(e){return Oc(e).position===`static`}function nl(e,t){if(!hc(e)||Oc(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return fc(e)===n&&(n=n.ownerDocument.body),n}function rl(e,t){let n=dc(e);if(yc(e))return n;if(!hc(e)){let t=Ac(e);for(;t&&!Dc(t);){if(mc(t)&&!tl(t))return t;t=Ac(t)}return n}let r=nl(e,t);for(;r&&vc(r)&&tl(r);)r=nl(r,t);return r&&Dc(r)&&tl(r)&&!wc(r)?n:r||Tc(e)||n}var il=async function(e){let t=this.getOffsetParent||rl,n=this.getDimensions,r=await n(e.floating);return{reference:el(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function al(e){return Oc(e).direction===`rtl`}var ol={convertOffsetParentRelativeRectToViewportRelativeRect:Uc,getDocumentElement:fc,getClippingRect:Qc,getOffsetParent:rl,getElementRects:il,getClientRects:Wc,getDimensions:$c,getScale:Ic,isElement:mc,isRTL:al};function sl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function cl(e,t){let n=null,r,i=fc(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=ws(d),h=ws(i.clientWidth-(u+f)),g=ws(i.clientHeight-(d+p)),_=ws(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Ss(0,xs(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&&!sl(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 ll(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=Fc(e),u=i||a?[...l?Mc(l):[],...t?Mc(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?cl(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?Bc(e):null;c&&g();function g(){let t=Bc(e);h&&!sl(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 ul=ac,dl=oc,fl=$s,pl=cc,ml=nc,hl=Qs,gl=sc,_l=(e,t,n)=>{let r=new Map,i={platform:ol,...n},a={...i.platform,_c:r};return Zs(e,t,{...i,platform:a})},vl=typeof document<`u`?L.useLayoutEffect:function(){};function yl(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(!yl(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)&&!yl(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function bl(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xl(e,t){let n=bl(e);return Math.round(t*n)/n}function Sl(e){let t=L.useRef(e);return vl(()=>{t.current=e}),t}function Cl(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]=L.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=L.useState(r);yl(f,r)||p(r);let[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=L.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=L.useRef(null),C=L.useRef(null),w=L.useRef(u),T=c!=null,E=Sl(c),D=Sl(i),O=Sl(l),ee=L.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),_l(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};k.current&&!yl(w.current,t)&&(w.current=t,Wi.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);vl(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let k=L.useRef(!1);vl(()=>(k.current=!0,()=>{k.current=!1}),[]),vl(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,ee);ee()}},[b,x,ee,E,T]);let A=L.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),j=L.useMemo(()=>({reference:b,floating:x}),[b,x]),M=L.useMemo(()=>{let e={position:n,left:0,top:0};if(!j.floating)return e;let t=xl(j.floating,u.x),r=xl(j.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...bl(j.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,j.floating,u.x,u.y]);return L.useMemo(()=>({...u,update:ee,refs:A,elements:j,floatingStyles:M}),[u,ee,A,j,M])}var wl=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:hl({element:r.current,padding:i}).fn(n):r?hl({element:r,padding:i}).fn(n):{}}}},Tl=(e,t)=>{let n=ul(e);return{name:n.name,fn:n.fn,options:[e,t]}},El=(e,t)=>{let n=dl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dl=(e,t)=>({fn:gl(e).fn,options:[e,t]}),Ol=(e,t)=>{let n=fl(e);return{name:n.name,fn:n.fn,options:[e,t]}},kl=(e,t)=>{let n=pl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Al=(e,t)=>{let n=ml(e);return{name:n.name,fn:n.fn,options:[e,t]}},jl=(e,t)=>{let n=wl(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Ml(e){let[t,n]=L.useState(void 0);return qi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Nl=Object.defineProperty,Pl=(e,t)=>Nl(e,`name`,{value:t,configurable:!0}),Fl=`Popper`,[Il,Ll]=ra(Fl),[Rl,zl]=Il(Fl),Bl=Pl(e=>{let{__scopePopper:t,children:n}=e,[r,i]=L.useState(null),[a,o]=L.useState(void 0);return(0,R.jsx)(Rl,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Vl=`PopperAnchor`,Hl=L.forwardRef(Pl(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=zl(Vl,n),o=L.useRef(null),s=a.onAnchorChange,c=Kn(t,L.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=L.useRef(null);L.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Yl(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,R.jsx)(Gi.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Ul=`PopperContent`,[Wl,Gl]=Il(Ul),Kl=L.forwardRef(Pl(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=zl(Ul,n),[_,v]=L.useState(null),y=Kn(t,v),[b,x]=L.useState(null),S=Ml(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,ee={padding:E,boundary:D.filter(ql),altBoundary:O},{refs:k,floatingStyles:A,placement:j,isPositioned:M,middlewareData:N}=Cl({strategy:`fixed`,placement:T,whileElementsMounted:Pl((...e)=>ll(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Tl({mainAxis:i+w,alignmentAxis:o}),c&&El({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Dl():void 0,...ee}),c&&Ol({...ee}),kl({...ee,apply:Pl(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&jl({element:b,padding:s}),Jl({arrowWidth:C,arrowHeight:w}),f&&Al({strategy:`referenceHidden`,...ee,boundary:O?ee.boundary:void 0})]}),te=g.setPlacementState;qi(()=>(te(j),()=>{te(void 0)}),[j,te]);let[P,F]=Yl(j),ne=aa(m);qi(()=>{M&&ne?.()},[M,ne]);let re=N.arrow?.x,ie=N.arrow?.y,ae=N.arrow?.centerOffset!==0,[I,oe]=L.useState();return qi(()=>{_&&oe(window.getComputedStyle(_).zIndex)},[_]),(0,R.jsx)(`div`,{ref:k.setFloating,"data-radix-popper-content-wrapper":``,style:{...A,transform:M?A.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:I,"--radix-popper-transform-origin":[N.transformOrigin?.x,N.transformOrigin?.y].join(` `),...N.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,R.jsx)(Wl,{scope:n,placedSide:P,placedAlign:F,onArrowChange:x,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,R.jsx)(Gi.div,{"data-side":P,"data-align":F,...h,ref:y,style:{...h.style,animation:M?h.style?.animation:`none`}})})})},`PopperContent`));function ql(e){return e!==null}Pl(ql,`isNotNull`);var Jl=Pl(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Yl(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Yl(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Pl(Yl,`getSideAndAlignFromPlacement`);var Xl=Bl,Zl=Hl,Ql=Kl,$l=Object.defineProperty,eu=L.forwardRef(((e,t)=>$l(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=L.useState(!1);qi(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Wi.createPortal((0,R.jsx)(Gi.div,{...r,ref:t}),o):null},`Portal`)),tu=L.useEffectEvent,nu=L.useInsertionEffect;function ru(e){if(typeof tu==`function`)return tu(e);let t=L.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof nu==`function`?nu(()=>{t.current=e}):qi(()=>{t.current=e}),L.useMemo(()=>((...e)=>t.current?.(...e)),[])}var iu=Object.defineProperty,au=(e,t)=>iu(e,`name`,{value:t,configurable:!0}),ou=L.useInsertionEffect||qi;function su({prop:e,defaultProp:t,onChange:n=au(()=>{},`onChange`),caller:r}){let[i,a,o]=cu({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,L.useCallback(t=>{if(s){let n=lu(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}au(su,`useControllableState`);function cu({defaultProp:e,onChange:t}){let[n,r]=L.useState(e),i=L.useRef(n),a=L.useRef(t);return ou(()=>{a.current=t},[t]),L.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}au(cu,`useUncontrolledState`);function lu(e){return typeof e==`function`}au(lu,`isFunction`);var uu=Symbol(`RADIX:SYNC_STATE`);function du(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=ru(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=L.useReducer((t,n)=>{if(n.type===uu)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=L.useRef(p);L.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=L.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return L.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:uu,state:i})},[i,d.state,c]),[h,f]}au(du,`useControllableStateReducer`);var fu=Object.defineProperty,pu=(e,t)=>fu(e,`name`,{value:t,configurable:!0}),mu=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),hu=L.forwardRef(pu(function(e,t){return(0,R.jsx)(Gi.span,{...e,ref:t,style:{...mu,...e.style}})},`VisuallyHidden`)),gu=Object.defineProperty,_u=(e,t)=>gu(e,`name`,{value:t,configurable:!0}),[vu,yu]=ra(`Tooltip`,[Ll]),bu=Ll(),xu=`TooltipProvider`,Su=700,Cu=`tooltip.open`,[wu,Tu]=vu(xu),Eu=_u(e=>{let{__scopeTooltip:t,delayDuration:n=Su,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=L.useRef(!0),s=L.useRef(!1),c=L.useRef(0);return L.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,R.jsx)(wu,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:L.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:L.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:L.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),Du=`Tooltip`,[Ou,ku]=vu(Du),Au=_u(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Tu(Du,e.__scopeTooltip),l=bu(t),[u,d]=L.useState(null),[f,p]=L.useState(void 0),m=ys(),h=L.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=L.useRef(!1),[y,b]=su({prop:r,defaultProp:i??!1,onChange:_u(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Cu))):c.onClose(),a?.(e)},`onChange`),caller:Du}),x=L.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=L.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=L.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=L.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);L.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let T=f??m;return(0,R.jsx)(Xl,{...l,children:(0,R.jsx)(Ou,{scope:t,contentId:T,setContentId:p,open:y,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:L.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:L.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})},`Tooltip`),ju=`TooltipTrigger`,Mu=L.forwardRef(_u(function(e,t){let{__scopeTooltip:n,...r}=e,i=ku(ju,n),a=Tu(ju,n),o=bu(n),s=Kn(t,L.useRef(null),i.onTriggerChange),c=L.useRef(!1),l=L.useRef(!1),u=L.useCallback(()=>c.current=!1,[]);return L.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,R.jsx)(Zl,{asChild:!0,...o,children:(0,R.jsx)(Gi.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:K(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:K(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:K(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:K(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:K(e.onBlur,i.onClose),onClick:K(e.onClick,i.onClose)})})},`TooltipTrigger`)),Nu=`TooltipPortal`,[Pu,Fu]=vu(Nu,{forceMount:void 0}),Iu=_u(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=ku(Nu,t);return(0,R.jsx)(Pu,{scope:t,forceMount:n,children:(0,R.jsx)(Zi,{present:n||a.open,children:(0,R.jsx)(eu,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),Lu=`TooltipContent`,Ru=L.forwardRef(_u(function(e,t){let n=Fu(Lu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=ku(Lu,e.__scopeTooltip);return(0,R.jsx)(Zi,{present:r||o.open,children:o.disableHoverableContent?(0,R.jsx)(Vu,{side:i,...a,ref:t}):(0,R.jsx)(zu,{side:i,...a,ref:t})})},`TooltipContent`)),zu=L.forwardRef(_u(function(e,t){let n=ku(Lu,e.__scopeTooltip),r=Tu(Lu,e.__scopeTooltip),i=L.useRef(null),a=Kn(t,i),[o,s]=L.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=L.useCallback(()=>{s(null),d(!1)},[d]),p=L.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Uu(r,Hu(r,n.getBoundingClientRect())),a=Wu(t.getBoundingClientRect()),o=Ku([...i,...a]);s(o),d(!0)},[d]);return L.useEffect(()=>()=>f(),[f]),L.useEffect(()=>{if(c&&u){let e=_u(e=>p(e,u),`handleTriggerLeave`),t=_u(e=>p(e,c),`handleContentLeave`);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),L.useEffect(()=>{if(o){let e=_u(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Gu(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,R.jsx)(Vu,{...e,ref:a})},`TooltipContentHoverable`)),Bu=Xn(`TooltipContent`),Vu=L.forwardRef(_u(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=ku(Lu,n),u=bu(n),{onClose:d}=l;L.useEffect(()=>(document.addEventListener(Cu,d),()=>document.removeEventListener(Cu,d)),[d]),L.useEffect(()=>{if(l.trigger){let e=_u(e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]);let{setContentId:f}=l;return qi(()=>(f(a),()=>{f(void 0)}),[a,f]),(0,R.jsx)(us,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,R.jsxs)(Ql,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,R.jsx)(Bu,{children:r}),i?(0,R.jsx)(hu,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`));function Hu(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}_u(Hu,`getExitSideFromRect`);function Uu(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}_u(Uu,`getPaddedExitPoints`);function Wu(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}_u(Wu,`getPointsFromRect`);function Gu(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}_u(Gu,`isPointInPolygon`);function Ku(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),qu(t)}_u(Ku,`getHull`);function qu(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}_u(qu,`getHullPresorted`);var Ju=Eu,Yu=Au,Xu=Mu,Zu=Iu,Qu=Ru,$u=Ju,ed=Yu,td=Xu,nd=L.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,R.jsx)(Zu,{children:(0,R.jsx)(Qu,{ref:r,sideOffset:t,className:U(`z-50 overflow-hidden rounded-md border border-border bg-popover px-2.5 py-1.5 font-mono text-[11px] text-popover-foreground shadow-md`,`data-[state=delayed-open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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`,e),...n})}));nd.displayName=Qu.displayName;function rd({chain:e}){return(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(q,{variant:e===`base`?`secondary`:`outline`,children:`Testnet`}),(0,R.jsx)($u,{delayDuration:120,children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`span`,{children:(0,R.jsx)(q,{variant:`secondary`,className:`border-dashed border-border opacity-60`,children:`Mainnet · soon`})})}),(0,R.jsx)(nd,{children:`Mainnet support is coming. v1 supports testnet only.`})]})})]})}function id({status:e}){return e===`done`?(0,R.jsxs)(q,{variant:`success`,className:`gap-1.5`,children:[(0,R.jsx)(wn,{className:`h-3 w-3`}),`Done`]}):e===`error`?(0,R.jsxs)(q,{variant:`destructive`,className:`gap-1.5`,children:[(0,R.jsx)(Vn,{className:`h-3 w-3`}),`Failed`]}):e===`active`?(0,R.jsxs)(q,{variant:`warning`,className:`gap-2`,children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`jinn-anim-pulse h-1.5 w-1.5 rounded-full bg-[var(--accent-gold)]`}),`Active`]}):(0,R.jsx)(q,{variant:`secondary`,children:`Queued`})}var ad={1:`Provisioning your wallet`,2:`Fund your wallet`,3:`Joining Jinn`,4:`Pick your first SolverNet`,5:`Set up harness + model`};function od({phase:e,status:t,children:n}){let r=t===`active`,i=t===`error`,a=t===`done`,o=r||i,s=i?`text-[var(--break-red)]`:r?`text-[var(--accent-gold)]`:a?`text-[var(--accent-sky)]`:`text-[var(--fg-dim)]`,c=i||r?`text-foreground`:a?`text-[var(--fg-muted)]`:`text-[var(--fg-dim)]`,l=o?`font-serif text-[28px] leading-[1.2]`:`font-mono text-[14px] leading-[1.2]`;return(0,R.jsxs)(`li`,{className:`phase-row border-t border-border`,"data-status":t,"data-testid":`onboarding-phase-${e}`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-[3rem_1fr_auto] items-baseline gap-4 py-4`,children:[(0,R.jsx)(`span`,{className:U(`font-mono text-xs tabular-nums tracking-[0.05em] transition-colors duration-200`,s),children:String(e).padStart(2,`0`)}),(0,R.jsx)(`span`,{className:U(l,c,`transition-colors duration-200`),children:ad[e]}),(0,R.jsx)(id,{status:t})]}),o&&n&&(0,R.jsx)(`div`,{className:`jinn-anim-fade-slide ml-12 pb-5 pr-2`,children:n})]})}function sd({label:e,step:t,serviceIndex:n,serviceId:r,safeAddress:i,explorer:a,contractRevertReason:o}){let s=!!o;return(0,R.jsxs)(`div`,{className:U(`flex flex-col gap-3 rounded-md border bg-[var(--bg-elevated)] px-4 py-3`,s?`border-[var(--break-red)]`:`border-border`),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:U(`jinn-anim-pulse h-1.5 w-1.5 rounded-full`,s?`bg-[var(--break-red)]`:`bg-[var(--accent-sky)]`)}),(0,R.jsx)(`span`,{className:`font-mono text-sm text-foreground`,children:e}),(0,R.jsx)(`span`,{className:U(`ml-auto font-mono text-[10px]`,s?`text-[var(--break-red)]`:`text-[var(--fg-dim)]`),children:s?`binding failed · will retry`:`running · no action needed`})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-1 font-mono text-[11px] text-[var(--fg-muted)] md:grid-cols-[120px_1fr]`,children:[(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`Current step`}),(0,R.jsx)(`span`,{children:cd(t)}),n!==void 0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`Service`}),(0,R.jsxs)(`span`,{children:[`#`,n,r===void 0?``:` · id ${r}`]})]}),i&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`Safe`}),(0,R.jsx)(`a`,{href:`${a}/address/${i}`,target:`_blank`,rel:`noopener noreferrer`,className:`break-all text-[var(--accent-sky)] hover:underline`,children:i})]}),o&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`Contract revert reason`}),(0,R.jsx)(`code`,{className:`break-words text-xs text-[var(--break-red)]`,children:o})]})]})]})}function cd(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var ld=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`div`,{ref:n,className:U(`animate-pulse rounded-md bg-muted`,e),...t}));ld.displayName=`Skeleton`;function ud(e){return e.contractId===`swe-rebench-v2`&&e.status===`launched`}function dd(e){return!ud(e)&&/smoke/i.test(e.name??``)}var fd=new Set([`subsystem_not_ready`,`registry_unavailable`]);function pd(e){if(e&&typeof e==`object`&&`code`in e){let t=e.code;if(typeof t==`string`)return t}if(e instanceof Error&&e.message.includes(`subsystem_not_ready`))return`subsystem_not_ready`}function md({onJoined:e,joinedCids:t}){let n=ut({queryKey:[`solvernets`,`registry`],queryFn:()=>B.solvernets.listRegistry(),refetchInterval:5e3,retry:!1}),r=n.data?.summaries.find(ud),i=r?.manifestCid,a=i!==void 0&&t.includes(i),o=dt({mutationFn:async()=>{if(!r)throw Error(`no swe-rebench-v2 registry entry`);return B.operator.join(r.manifestCid,{name:r.name,contract:{id:r.contractId,version:r.contractVersion},roles:[`solver`]})},onSuccess:()=>{r&&e(r.manifestCid)}});if(n.isLoading)return(0,R.jsxs)(`div`,{"data-testid":`onboarding-solvernet-loading`,className:`flex flex-col gap-3`,children:[(0,R.jsx)(ld,{className:`h-6 w-48`}),(0,R.jsx)(ld,{className:`h-24 w-full`})]});let s=n.isError?pd(n.error):void 0;return n.isError&&!fd.has(s??``)?(0,R.jsxs)(fo,{variant:`blocking`,"data-testid":`onboarding-solvernet-error`,children:[(0,R.jsx)(po,{children:`Could not load SolverNets.`}),(0,R.jsx)(mo,{children:`The daemon could not read the SolverNet registry. Retry once startup finishes; check daemon logs if it keeps failing.`})]}):r?(0,R.jsxs)(G,{"data-testid":`onboarding-solvernet-card`,"data-manifest-cid":r.manifestCid,children:[(0,R.jsxs)(zi,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(Bi,{className:`font-mono text-[15px]`,children:r.name}),a?(0,R.jsx)(q,{"data-testid":`onboarding-solvernet-joined`,children:`Joined`}):(0,R.jsx)(q,{variant:`secondary`,children:`Recommended`})]}),(0,R.jsx)(Vi,{children:`Pick your first SolverNet; add more later.`})]}),(0,R.jsxs)(Hi,{className:`flex items-center justify-between gap-4`,children:[(0,R.jsx)(`p`,{className:`text-sm text-[var(--fg-muted)]`,children:`Solve coding tasks; your node claims and submits solutions.`}),!a&&(0,R.jsx)(W,{"data-testid":`onboarding-solvernet-join`,onClick:()=>o.mutate(),disabled:o.isPending,children:o.isPending?`Joining…`:`Join`})]})]}):(0,R.jsxs)(`div`,{"data-testid":`onboarding-solvernet-starting`,className:`flex items-center gap-3 font-mono text-[12px] text-[var(--fg-muted)]`,children:[(0,R.jsx)(ld,{className:`h-4 w-4 rounded-full`}),`Finding your first SolverNet…`]})}var hd=`claude-code`,gd=`codex`,_d=`hermes-agent`,vd={"claude-code-learner":hd,"codex-code-learner":gd},yd={[hd]:`Claude Code`,[gd]:`Codex`,[_d]:`Hermes Agent`,"swe-rebench-v2-evaluator":`SWE-rebench v2 Evaluator`};function bd(e){return e?vd[e]??e:``}function xd(e){let t=bd(e);return yd[t]??t}function Sd(e,t){let n=xd(e);return t?`${n} ${t}`:n}function Cd(e,t){return bd(e)===bd(t)}var wd=[{label:`Haiku`,id:`claude-haiku-4-5-20251001`},{label:`Sonnet`,id:`claude-sonnet-4-6`},{label:`Opus`,id:`claude-opus-4-7`}],Td=[{label:`GPT-5.4 Mini`,id:`gpt-5.4-mini`},{label:`GPT-5.5`,id:`gpt-5.5`},{label:`GPT-5.4`,id:`gpt-5.4`},{label:`GPT-5.3 Codex`,id:`gpt-5.3-codex`},{label:`GPT-5.3 Codex Spark`,id:`gpt-5.3-codex-spark`}],Ed=[{label:`Claude Opus 4.7 (OpenRouter)`,id:`anthropic/claude-opus-4.7`,provider:`openrouter`},{label:`Claude Sonnet 4.6 (OpenRouter)`,id:`anthropic/claude-sonnet-4.6`,provider:`openrouter`},{label:`Hy3 Preview`,id:`tencent/hy3-preview`,provider:`openrouter`},{label:`DeepSeek V4 Pro`,id:`deepseek/deepseek-v4-pro`,provider:`openrouter`},{label:`DeepSeek V4 Flash`,id:`deepseek/deepseek-v4-flash`,provider:`openrouter`},{label:`Gemini 3.1 Flash Lite`,id:`google/gemini-3.1-flash-lite`,provider:`openrouter`},{label:`Kimi K2.6`,id:`moonshotai/kimi-k2.6`,provider:`openrouter`},{label:`Owl Alpha`,id:`openrouter/owl-alpha`,provider:`openrouter`},{label:`MiniMax M2.7`,id:`minimax/minimax-m2.7`,provider:`openrouter`}];function Dd(e){return bd(e)===gd}function Od(e){return bd(e)===_d}function kd(e){return Od(e)?Ed:Dd(e)?Td:wd}function Ad(e){return kd(e)[0].id}function jd(e,t){let n=kd(t).find(t=>t.id===e);return n?n.provider:(wd.find(t=>t.id===e)??Td.find(t=>t.id===e)??Ed.find(t=>t.id===e))?.provider}function Md(e,t){let n=kd(t).find(t=>t.id===e)??null??wd.find(t=>t.id===e)??Td.find(t=>t.id===e)??Ed.find(t=>t.id===e)??null;return n?{canonical:n,label:n.label,isCustom:!1}:{canonical:null,label:`Custom (${e})`,isCustom:!0}}function Nd(e){let t=e+`CollectionProvider`,[n,r]=ra(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=L.useRef(null),a=L.useRef(new Map).current;return(0,R.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=qn(s),l=L.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=Kn(t,a(s,n).collectionRef);return(0,R.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=qn(u),p=L.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=L.useRef(null),s=Kn(t,o),c=a(u,n);return L.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,R.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return L.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var Pd=!1;function Fd(){let[e,t]=L.useState(Pd);return L.useEffect(()=>{Pd||(Pd=!0,t(!0))},[]),e}var Id=L.useSyncExternalStore;function Ld(){return()=>{}}function Rd(){return Id(Ld,()=>!0,()=>!1)}var zd=typeof Id==`function`?Rd:Fd,Bd=Object.defineProperty,Vd=(e,t)=>Bd(e,`name`,{value:t,configurable:!0}),Hd=`rovingFocusGroup.onEntryFocus`,Ud={bubbles:!1,cancelable:!0},Wd=`RovingFocusGroup`,[Gd,Kd,qd]=Nd(Wd),[Jd,Yd]=ra(Wd,[qd]),[Xd,Zd]=Jd(Wd),Qd=L.forwardRef(Vd(function(e,t){return(0,R.jsx)(Gd.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(Gd.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)($d,{...e,ref:t})})})},`RovingFocusGroup`)),$d=L.forwardRef(Vd(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=L.useRef(null),p=Kn(t,f),m=sa(a),[h,g]=su({prop:o,defaultProp:s??null,onChange:c,caller:Wd}),[_,v]=L.useState(!1),y=aa(l),b=Kd(n),x=L.useRef(!1),[S,C]=L.useState(0);return L.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Hd,y),()=>e.removeEventListener(Hd,y)},[y]),(0,R.jsx)(Xd,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:L.useCallback(e=>g(e),[g]),onItemShiftTab:L.useCallback(()=>v(!0),[]),onFocusableItemAdd:L.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:L.useCallback(()=>C(e=>e-1),[]),children:(0,R.jsx)(Gi.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:K(e.onMouseDown,()=>{x.current=!0}),onFocus:K(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Hd,Ud);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);of([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:K(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),ef=`RovingFocusGroupItem`,tf=L.forwardRef(Vd(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=ys(),l=a||c,u=Zd(ef,n),d=u.currentTabStopId===l,f=Kd(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=zd();return qi(()=>{if(!(!g||!r))return p(),()=>m()},[g,r,p,m]),L.useEffect(()=>{if(!(g||!r))return p(),()=>m()},[g,r,p,m]),(0,R.jsx)(Gd.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,R.jsx)(Gi.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:K(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:K(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:K(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=af(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?sf(n,r+1):n.slice(r+1)}setTimeout(()=>of(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),nf={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function rf(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Vd(rf,`getDirectionAwareKey`);function af(e,t,n){let r=rf(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return nf[r]}Vd(af,`getFocusIntent`);function of(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Vd(of,`focusFirst`);function sf(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Vd(sf,`wrapArray`);var cf=Qd,lf=tf,uf=Object.defineProperty,df=(e,t)=>uf(e,`name`,{value:t,configurable:!0}),ff=`Radio`,[pf,mf]=ra(ff),[hf,gf]=pf(ff);function _f(e){let{__scopeRadio:t,checked:n=!1,children:r,disabled:i,form:a,name:o,onCheck:s,required:c,value:l=`on`,internal_do_not_use_render:u}=e,[d,f]=L.useState(null),[p,m]=L.useState(null),h=L.useRef(!1),[g,_]=L.useReducer(e=>e+1,0),v={checked:n,disabled:i,required:c,name:o,form:a,value:l,control:d,setControl:f,hasConsumerStoppedPropagationRef:h,userInteractionCount:g,onUserInteraction:_,isFormControl:!d||!!a||!!d.closest(`form`),bubbleInput:p,setBubbleInput:m,onCheck:df(()=>s?.(),`onCheck`)};return(0,R.jsx)(hf,{scope:t,...v,children:wf(u)?u(v):r})}df(_f,`RadioProvider`);var vf=`RadioTrigger`,yf=L.forwardRef(df(function({__scopeRadio:e,onClick:t,...n},r){let{checked:i,disabled:a,value:o,setControl:s,onCheck:c,hasConsumerStoppedPropagationRef:l,onUserInteraction:u,isFormControl:d,bubbleInput:f}=gf(vf,e),p=Kn(r,s);return(0,R.jsx)(Gi.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Tf(i),"data-disabled":a?``:void 0,disabled:a,value:o,...n,ref:p,onClick:K(t,e=>{i||(u(),c()),f&&d&&(l.current=e.isPropagationStopped(),l.current||e.stopPropagation())})})},`RadioTrigger`)),bf=`RadioIndicator`,xf=L.forwardRef(df(function(e,t){let{__scopeRadio:n,forceMount:r,...i}=e,a=gf(bf,n);return(0,R.jsx)(Zi,{present:r||a.checked,children:(0,R.jsx)(Gi.span,{"data-state":Tf(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})},`RadioIndicator`)),Sf=`RadioBubbleInput`,Cf=L.forwardRef(df(function({__scopeRadio:e,onClick:t,...n},r){let{control:i,checked:a,required:o,disabled:s,name:c,value:l,form:u,bubbleInput:d,setBubbleInput:f,hasConsumerStoppedPropagationRef:p,userInteractionCount:m}=gf(Sf,e),h=Kn(r,f),g=Ml(i),_=L.useRef(!1),v=L.useRef(a),y=L.useRef(m);L.useEffect(()=>{let e=d;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=m!==y.current;y.current=m;let i=v.current!==a;v.current=a;let o=!(r&&p.current);if(i&&n){_.current=!r;let t=new Event(`click`,{bubbles:o});n.call(e,a),e.dispatchEvent(t),_.current=!1}},[d,a,p,m]);let b=L.useRef(a);return(0,R.jsx)(Gi.input,{type:`radio`,"aria-hidden":!0,defaultChecked:b.current,required:o,disabled:s,name:c,value:l,form:u,...n,tabIndex:-1,ref:h,onClick:K(t,e=>{_.current&&e.stopPropagation()}),style:{...n.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`RadioBubbleInput`));function wf(e){return typeof e==`function`}df(wf,`isFunction`);function Tf(e){return e?`checked`:`unchecked`}df(Tf,`getState`);var Ef=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Df=`RadioGroup`,[Of,kf]=ra(Df,[Yd,mf]),Af=Yd(),jf=mf(),[Mf,Nf]=Of(Df),Pf=L.forwardRef(df(function(e,t){let{__scopeRadioGroup:n,name:r,form:i,defaultValue:a,value:o,required:s=!1,disabled:c=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...p}=e,m=Af(n),h=sa(u),[g,_]=su({prop:o,defaultProp:a??null,onChange:f,caller:Df}),[v,y]=L.useState(null),b=Kn(t,y),x=L.useRef(g);return L.useEffect(()=>{let e=i?v?.ownerDocument.getElementById(i):v?.closest(`form`);if(e instanceof HTMLFormElement){let t=df(()=>_(x.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[v,i,_]),(0,R.jsx)(Mf,{scope:n,name:r,form:i,required:s,disabled:c,value:g,onValueChange:_,children:(0,R.jsx)(cf,{asChild:!0,...m,orientation:l,dir:h,loop:d,children:(0,R.jsx)(Gi.div,{role:`radiogroup`,"aria-required":s,"aria-orientation":l,"data-disabled":c?``:void 0,dir:h,...p,ref:b})})})},`RadioGroup`)),Ff=`RadioGroupItemProvider`,If=`RadioGroupItemTrigger`;function Lf(e){let{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:a}=e,o=Nf(Ff,t),s=jf(t),c=o.disabled||r;return(0,R.jsx)(_f,{...s,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:a,children:i})}df(Lf,`RadioGroupItemProvider`);var Rf=L.forwardRef(df(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=Af(n),a=jf(n),{checked:o,disabled:s}=gf(If,a.__scopeRadio),c=L.useRef(null),l=Kn(t,c),u=L.useRef(!1);return L.useEffect(()=>{let e=df(e=>{Ef.includes(e.key)&&(u.current=!0)},`handleKeyDown`),t=df(()=>u.current=!1,`handleKeyUp`);return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,R.jsx)(lf,{asChild:!0,...i,focusable:!s,active:o,children:(0,R.jsx)(yf,{...a,...r,ref:l,onKeyDown:K(r.onKeyDown,e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:K(r.onFocus,()=>{u.current&&c.current?.click()})})})},`RadioGroupItemTrigger`)),zf=L.forwardRef(df(function(e,t){let{__scopeRadioGroup:n,value:r,disabled:i,...a}=e;return(0,R.jsx)(Lf,{__scopeRadioGroup:n,value:r,disabled:i,internal_do_not_use_render:({isFormControl:e})=>(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Rf,{...a,ref:t,__scopeRadioGroup:n}),e&&(0,R.jsx)(Bf,{__scopeRadioGroup:n})]})})},`RadioGroupItem`)),Bf=L.forwardRef(df(function(e,t){let{__scopeRadioGroup:n,...r}=e;return(0,R.jsx)(Cf,{...jf(n),...r,ref:t})},`RadioGroupItemBubbleInput`)),Vf=L.forwardRef(df(function(e,t){let{__scopeRadioGroup:n,...r}=e;return(0,R.jsx)(xf,{...jf(n),...r,ref:t})},`RadioGroupIndicator`)),Hf=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Pf,{className:U(`grid gap-2`,e),...t,ref:n}));Hf.displayName=Pf.displayName;var Uf=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(zf,{ref:n,className:U(`aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,R.jsx)(Vf,{className:`flex items-center justify-center`,children:(0,R.jsx)(En,{className:`h-2.5 w-2.5 fill-current text-current`})})}));Uf.displayName=zf.displayName;var Wf=Object.defineProperty,Gf=L.forwardRef(((e,t)=>Wf(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,R.jsx)(Gi.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),Kf=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Gf,{ref:n,className:U(`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)] peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,e),...t}));Kf.displayName=Gf.displayName;function qf({protocol:e,node:t,machine:n}){return(0,R.jsx)(`span`,{"data-testid":`tier-dots`,className:`inline-flex items-center gap-1`,"aria-hidden":!0,children:[{id:`protocol`,active:e},{id:`node`,active:t},{id:`machine`,active:n}].map(e=>(0,R.jsx)(`span`,{"data-tier":e.id,"data-active":e.active?`true`:`false`,className:U(`size-1.5 rounded-full border border-current transition-colors`,e.active?`bg-current text-[var(--accent-sky)]`:`bg-transparent text-[var(--fg-dim)]`)},e.id))})}var Jf=[gd,hd,_d],Yf=new Set([`harness_not_found`,`subsystem_not_ready`]);function Xf({onSelectionChange:e}){let[t,n]=(0,L.useState)(gd),[r,i]=(0,L.useState)(Ad(gd)),a=ut({queryKey:[`onboarding-harness-readiness`,t],refetchInterval:5e3,queryFn:async()=>{try{return await B.harnessReadiness(t)}catch(e){let t=e.code;if(t&&Yf.has(t))return null;throw e}}}),o=a.data,s=o?.ready===!0,c=o?.ready===!1;(0,L.useEffect)(()=>{e({harness:t,model:r,ready:s})},[t,r,s,e]);function l(e){n(e),i(Ad(e))}let u=kd(t);return(0,R.jsxs)(G,{"data-testid":`onboarding-harness-card`,children:[(0,R.jsxs)(zi,{children:[(0,R.jsx)(Bi,{className:`font-mono text-[15px]`,children:`Harness & model`}),(0,R.jsx)(`p`,{className:`text-sm text-[var(--fg-muted)]`,children:`The harness and model your node uses for its work.`})]}),(0,R.jsxs)(Hi,{className:`flex flex-col gap-5`,children:[(0,R.jsx)(Hf,{value:t,onValueChange:l,className:`gap-2`,children:Jf.map(e=>{let n=e===t,r=n?s?`Ready`:c?`Setup required`:`Checking…`:`Select to check`;return(0,R.jsxs)(`label`,{htmlFor:`onboarding-harness-${e}`,className:`flex cursor-pointer items-center gap-3 rounded-[var(--radius-2)] border border-border px-3 py-2.5`,"data-testid":`onboarding-harness-row-${e}`,children:[(0,R.jsx)(Uf,{value:e,id:`onboarding-harness-${e}`}),(0,R.jsx)(`span`,{className:`flex-1 font-mono text-[13px]`,children:xd(e)}),(0,R.jsx)(qf,{protocol:!0,node:!0,machine:n?s:!1}),(0,R.jsx)(q,{variant:r===`Ready`?`default`:`secondary`,children:r})]},e)})}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(Kf,{htmlFor:`onboarding-model-select`,className:`text-[var(--fg-muted)]`,children:`Model`}),(0,R.jsx)(`select`,{id:`onboarding-model-select`,"data-testid":`onboarding-model-select`,value:r,onChange:e=>i(e.target.value),className:`rounded-[var(--radius-1)] border border-border bg-transparent px-2 py-1.5 font-mono text-[13px]`,children:u.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),c&&(0,R.jsxs)(`div`,{"data-testid":`onboarding-harness-not-ready`,className:`flex flex-col gap-2 rounded-[var(--radius-2)] border border-[var(--break-red)] px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[12px] text-[var(--break-red)]`,children:o?.reason??`This harness needs setup before your node can use it.`}),o?.nextStep?.description&&(0,R.jsx)(`span`,{className:`text-sm text-[var(--fg-muted)]`,children:o.nextStep.description}),o?.nextStep?.cli&&(0,R.jsx)(`code`,{className:`rounded-[var(--radius-1)] bg-[var(--bg-sunken)] px-2 py-1 font-mono text-[12px]`,children:o.nextStep.cli}),(0,R.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-testid":`onboarding-harness-recheck`,onClick:()=>void a.refetch(),className:`self-start`,children:`Recheck`})]})]})]})}var Zf=new Set([`complete`,`safe_binding_pending`]);function Qf(e){return e.mode===`running`||Zf.has(e.currentStep)}var $f={wallet:{phase:1,subState:null},safe_predicted:{phase:1,subState:null},awaiting_funding:{phase:2,subState:null},safe_deployed:{phase:3,subState:`Deploying`},service_created:{phase:3,subState:`Deploying`},service_activated:{phase:3,subState:`Deploying`},agents_registered:{phase:3,subState:`Deploying`},service_deployed:{phase:3,subState:`Deploying`},service_staked:{phase:3,subState:`Deploying`},staked:{phase:3,subState:`Deploying`},mech_deployed:{phase:3,subState:`Joining the network`},agent_registered:{phase:3,subState:`Joining the network`},safe_binding_pending:{phase:3,subState:`Binding identity`}};function ep(e){return $f[e]??{phase:1,subState:null}}function tp(e,t,n){return e<t?e===2&&n===!1?`active`:`done`:e===t?`active`:`queued`}var np=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--accent-gold)]`;function rp(){let e=Ye(),{data:t,isLoading:n}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap(),refetchInterval:2e3}),[r,i]=(0,L.useState)(null),a=(0,L.useCallback)(e=>i(e),[]),o=Object.keys(t?.joinedSolverNets??{}),s=o[0],c=dt({mutationFn:async()=>{if(s&&r){let e=jd(r.model,r.harness);await B.operator.join(s,{roles:[`solver`],harness:r.harness,model:r.model,...e===void 0?{}:{provider:e}})}await B.operator.completeOnboarding()},onSuccess:()=>{e.invalidateQueries({queryKey:[`bootstrap`]})}}),l=(0,L.useCallback)(()=>{e.invalidateQueries({queryKey:[`bootstrap`]})},[e]),u=o.length>0&&r?.ready===!0&&!!r?.model;if(n||!t)return(0,R.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background`,children:(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Connecting…`})});let d=t.chain===`base`?`https://basescan.org`:`https://sepolia.basescan.org`,f=t.master_address??``,{phase:p,subState:m}=ep(t.currentStep),h=Qf(t)?o.length>0?5:4:p,g=t.error,_=t.services??[],v=_.find(e=>e.step===t.currentStep)??_[0],y=t.funding?.targetMet,b=Zo().embeddedAgent;return(0,R.jsx)(`div`,{className:`min-h-screen w-full bg-background text-foreground`,children:(0,R.jsxs)(`div`,{className:`mx-auto grid max-w-[1280px] grid-cols-12 gap-10 px-10 py-10`,children:[(0,R.jsxs)(`section`,{className:U(`col-span-12 flex flex-col gap-8`,b&&`lg:col-span-7`),children:[(0,R.jsxs)(`header`,{className:`flex items-baseline justify-between`,children:[(0,R.jsx)(`span`,{className:np,children:`Jinn · Onboarding`}),(0,R.jsx)(rd,{chain:t.chain})]}),(0,R.jsx)(`h1`,{className:`font-serif text-[76px] leading-[1.05] text-foreground`,children:`Welcome to Jinn.`}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-testid":`onboarding-progress`,"aria-label":`Onboarding progress`,children:[(0,R.jsx)(Fo,{value:Math.min(100,(h-1)/4*100)}),(0,R.jsxs)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:[`Phase `,h,` of 5`]})]}),(0,R.jsx)(`ol`,{className:`flex flex-col`,children:[1,2,3,4,5].map(e=>{let n=tp(e,h,y),r=g&&e===h&&e<=3;return(0,R.jsxs)(od,{phase:e,status:r?`error`:n,children:[r&&(0,R.jsx)(Qo,{envelope:g,chainExplorerBase:d}),!r&&e===2&&n===`active`&&f&&(0,R.jsx)(zo,{address:f,minimumWei:t.funding?.targetWei??`10000000000000000`,currentBalanceWei:t.funding?.eth_balance,chainExplorerBase:d,chain:t.chain,onSharedDefaultRpc:t.rpcUrl===t.defaultRpcUrl}),!r&&e===3&&n===`active`&&(0,R.jsx)(sd,{label:m??`Working`,step:t.currentStep,serviceIndex:v?.index,serviceId:v?.service_id,safeAddress:v?.safe_address,explorer:d,contractRevertReason:v?.error_revert_reason??null}),e===4&&n===`active`&&(0,R.jsx)(md,{onJoined:l,joinedCids:o}),e===5&&n===`active`&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,R.jsx)(Xf,{onSelectionChange:a}),c.isError&&(0,R.jsxs)(fo,{variant:`blocking`,"data-testid":`onboarding-enter-error`,children:[(0,R.jsx)(po,{children:`Could not enter the dashboard.`}),(0,R.jsx)(mo,{children:`Saving your harness selection or completing onboarding failed. Try again; check daemon logs if it keeps failing.`})]}),(0,R.jsx)(W,{"data-testid":`onboarding-enter-dashboard`,disabled:!u||c.isPending,onClick:()=>c.mutate(),className:`self-start`,children:c.isPending?`Starting…`:`Enter dashboard`})]})]},e)})})]}),b&&(0,R.jsxs)(`aside`,{className:`col-span-12 flex flex-col gap-3 lg:col-span-5`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Ask Claude`}),(0,R.jsx)(G,{className:`h-[calc(100vh-220px)] min-h-[520px] overflow-hidden p-0`,children:(0,R.jsx)(Jo,{agentGated:!1})})]})]})})}var ip=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--accent-gold)]`,ap=`font-serif font-normal leading-[1.05] text-foreground text-[64px]`;function op({connection:e}){let[t,n]=(0,L.useState)(!1);return(0,R.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background px-10 py-16 text-foreground`,"data-testid":`daemon-offline-screen`,children:(0,R.jsxs)(`div`,{className:`flex w-full max-w-xl flex-col gap-6`,children:[(0,R.jsx)(`span`,{className:ip,children:`Jinn · offline`}),(0,R.jsx)(`h1`,{className:ap,children:`Daemon not running.`}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`p`,{className:`font-mono text-sm text-[var(--fg-muted)]`,children:`Open a terminal and run:`}),(0,R.jsx)(`code`,{className:`self-start rounded bg-[var(--bg-elevated)] px-2 py-1 font-mono text-sm text-foreground`,children:`jinn run`}),(0,R.jsx)(`p`,{className:`font-mono text-xs text-[var(--fg-dim)]`,children:`(or the command you originally used to start it)`})]}),(0,R.jsxs)(`p`,{className:`font-mono text-sm text-[var(--fg-muted)]`,children:[`Reconnecting…`,e.attempts>0&&(0,R.jsxs)(`span`,{className:`ml-1 text-[var(--fg-dim)]`,children:[`(attempt `,e.attempts,`)`]})]}),(0,R.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start text-[var(--fg-dim)] hover:text-foreground`,onClick:()=>n(e=>!e),"aria-expanded":t,children:[t?(0,R.jsx)(Cn,{}):(0,R.jsx)(xn,{}),t?`Hide details`:`Show details`]}),t&&e.lastError&&(0,R.jsx)(G,{className:`bg-[var(--bg-elevated)]`,children:(0,R.jsx)(Hi,{className:`px-3 py-2`,children:(0,R.jsx)(`p`,{className:`font-mono text-xs text-[var(--fg-muted)]`,children:e.lastError})})})]})})}var sp={blocking:`border-l-[var(--severity-blocking-fg)] bg-[var(--severity-blocking-bg)]`,warning:`border-l-[var(--severity-warning-fg)] bg-[var(--severity-warning-bg)]`,info:`border-l-[var(--severity-info-fg)]`},cp={blocking:`text-[var(--severity-blocking-fg)]`,warning:`text-[var(--severity-warning-fg)]`,info:`text-[var(--severity-info-fg)]`};function lp({notice:e}){return(0,R.jsxs)(`li`,{"data-kind":e.kind,"data-severity":e.severity,"aria-label":`${e.severity} notice: ${e.message}`,className:U(`flex items-baseline gap-3 border-l-2 px-4 py-2 font-mono text-[12px] text-foreground`,sp[e.severity]),children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:U(`min-w-[64px] font-mono text-[11px] font-medium uppercase tracking-[0.14em]`,cp[e.severity]),children:e.severity}),(0,R.jsx)(`span`,{className:`flex-1`,children:e.message}),e.jumpTo?(0,R.jsx)($t,{href:e.jumpTo,className:`font-mono text-[var(--accent-sky)] no-underline hover:text-[var(--accent-sky-hover)]`,children:`resolve →`}):null]})}function up({notices:e}){return e.length===0?null:(0,R.jsx)(`section`,{"aria-label":`Notifications`,role:`region`,children:(0,R.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.map((e,t)=>(0,R.jsx)(lp,{notice:e},`${e.kind}-${t}`))})})}var dp=(0,L.createContext)({restartPending:!1,setRestartPending:()=>{}});function fp(){return(0,L.useContext)(dp)}var pp=3,mp=1e3*60*60*24*90;function hp(e){if(!e||e.balanceWei===void 0)return null;try{if(e.minEthWei!==void 0&&BigInt(e.balanceWei)<BigInt(e.minEthWei))return`blocking`}catch{}let t=Number(e.runwayDaysExcess);return Number.isFinite(t)&&t<pp?`warning`:null}function gp(e){let t=[],n=e.status;e.bootstrap.mode!==`running`&&t.push({kind:`bootstrap_blocked`,severity:`blocking`,message:e.bootstrap.blockingReason??`Bootstrap incomplete`,jumpTo:`/`});for(let e of n.funds.chains){let n=e.wallet??`wallet`;if(e.empty){t.push({kind:`funding_empty`,severity:`blocking`,message:`Gas exhausted — ${n} on ${e.chain} can't cover the next transaction.`,jumpTo:`/overview`});continue}e.runwayDays<pp&&t.push({kind:`funding_low`,severity:`warning`,message:`Gas runway low — ${n} on ${e.chain} below threshold; top up soon.`,jumpTo:`/overview`})}if(!n.harness.ready){let e=n.harness.name===null?`A harness`:`Harness ${n.harness.name}`,r=n.harness.reason?`: ${n.harness.reason}`:``;t.push({kind:`harness_not_ready`,severity:`blocking`,message:`${e} is not ready${r}.`,jumpTo:`/operator/memberships`})}return n.rpc.reachable||t.push({kind:`rpc_unreachable`,severity:`blocking`,message:`RPC endpoint is unreachable.`,jumpTo:`/operator/network`}),Object.keys(n.joinedSolverNets).length===0&&e.bootstrap.mode===`running`&&t.push({kind:`no_solvernets_joined`,severity:`info`,message:`No SolverNets joined. Browse the registry to start earning.`,jumpTo:`/operator/registry`}),n.services.some(e=>!e.safeBound)&&t.push({kind:`safe_binding_pending`,severity:`warning`,message:`Safe wallet binding is pending.`,jumpTo:`/overview`}),n.restartPending&&t.push({kind:`restart_required`,severity:`warning`,message:`A configuration change is pending — restart to apply.`,jumpTo:`/overview`}),n.latestVersion&&n.latestVersion!==n.daemonVersion&&t.push({kind:`update_available`,severity:`info`,message:`Daemon ${n.latestVersion} available (running ${n.daemonVersion}).`}),n.passwordRotatedAt&&(e.now??Date.now())-new Date(n.passwordRotatedAt).getTime()>mp&&t.push({kind:`password_rotation_due`,severity:`info`,message:`Keystore password is over 90 days old.`,jumpTo:`/operator/security`}),t}var _p={blocking:0,warning:1,info:2},vp=1800*1e3,yp=60*1e3,bp=[`intent`];function xp(e,t){if(!t||t.balanceWei===void 0)return null;let n=1/0;if(t.runwayDaysExcess!==void 0&&t.runwayDaysExcess!==null){let e=Number(t.runwayDaysExcess);Number.isFinite(e)&&(n=e)}let r=hp(t)===`blocking`;return{chain:e,wallet:t.address??null,runwayDays:n,empty:r}}function Sp(e,t,n){let r=e??{},i=t??{},a=[],o=xp(`Base Sepolia`,r.masterGas);o&&a.push(o);let s=xp(`Ethereum Sepolia`,r.l1MasterGas);s&&a.push(s);let c=Array.isArray(r.fleet?.services)?r.fleet.services:[],l=i.joinedSolverNets&&typeof i.joinedSolverNets==`object`?i.joinedSolverNets:{};return{funds:{eth:String(r.masterGas?.balanceWei??`0`),chains:a},harness:{ready:r.harness?.ready!==!1,name:typeof r.harness?.name==`string`?r.harness.name:null,reason:typeof r.harness?.reason==`string`?r.harness.reason:null},rpc:{reachable:!0},restartPending:n,daemonVersion:String(r.version??`0.0.0`),latestVersion:typeof r.latestVersion==`string`?r.latestVersion:void 0,services:c.map(e=>({safeBound:e?.safeBoundToAgent!==!1})),joinedSolverNets:l,passwordRotatedAt:typeof r.security?.lastPasswordRotationAt==`string`?r.security.lastPasswordRotationAt:void 0}}function Cp(){let e=sn(),{restartPending:t}=fp(),n=ut({queryKey:[`status`],queryFn:()=>B.getStatus()}),r=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap()}),{events:i}=Un(bp),[a,o]=(0,L.useState)(()=>Date.now());(0,L.useEffect)(()=>{let e=setInterval(()=>o(Date.now()),yp);return()=>clearInterval(e)},[]);let s=(0,L.useMemo)(()=>{let e=a-vp,t=new Set,n=i.filter(n=>{if(n.kind!==`intent`||n.errorCode!==`claim_failed`)return!1;let r=Date.parse(n.ts);return Number.isNaN(r)||r<e||t.has(n.id)?!1:(t.add(n.id),!0)});if(n.length===0)return null;let r=n.length;return{kind:`claim_failed`,severity:`warning`,message:`${r} claim attempt${r===1?``:`s`} failed in the last 30 minutes. Check Tasks for details.`,jumpTo:`/overview`,details:{count:r,sinceMs:e}}},[i,a]);return(0,L.useMemo)(()=>{if(e.status===`disconnected`)return[{kind:`rpc_unreachable`,severity:`blocking`,message:`Daemon offline. What you see may be stale. Reconnecting automatically…`}];if(!n.data||!r.data)return[];let i=gp({bootstrap:r.data,status:Sp(n.data,r.data,t)});return(s?[...i,s]:[...i]).sort((e,t)=>_p[e.severity]-_p[t.severity])},[e.status,t,n.data,r.data,s])}function wp({header:e,tabs:t,rail:n,children:r}){let i=n!=null,a=Cp(),o=a.length>0?`grid-rows-[auto_auto_auto_minmax(0,1fr)]`:`grid-rows-[auto_auto_minmax(0,1fr)]`;return(0,R.jsxs)(`div`,{className:U(`grid h-screen w-full overflow-hidden bg-background text-foreground`,i?`grid-cols-[1fr_320px]`:`grid-cols-1`,o),children:[(0,R.jsx)(`div`,{className:`col-span-full border-b border-border`,children:e}),(0,R.jsx)(`div`,{className:`col-span-full border-b border-border`,children:t}),a.length>0&&(0,R.jsx)(`div`,{className:`col-span-full border-b border-border`,children:(0,R.jsx)(up,{notices:a})}),(0,R.jsx)(`main`,{className:`min-h-0 overflow-y-auto`,children:r}),i&&(0,R.jsx)(`aside`,{className:`h-full min-h-0 overflow-y-auto border-l border-border`,children:n})]})}function Tp(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;let n=document.implementation.createHTMLDocument(),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}var Ep=(()=>{let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function Dp(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}var Op=null;function kp(e={}){return Op||(e.includeStyleProperties?(Op=e.includeStyleProperties,Op):(Op=Dp(window.getComputedStyle(document.documentElement)),Op))}function Ap(e,t){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace(`px`,``)):0}function jp(e){let t=Ap(e,`border-left-width`),n=Ap(e,`border-right-width`);return e.clientWidth+t+n}function Mp(e){let t=Ap(e,`border-top-width`),n=Ap(e,`border-bottom-width`);return e.clientHeight+t+n}function Np(e,t={}){return{width:t.width||jp(e),height:t.height||Mp(e)}}function Pp(){let e,t;try{t=process}catch{}let n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}var Fp=16384;function Ip(e){(e.width>Fp||e.height>Fp)&&(e.width>Fp&&e.height>Fp?e.width>e.height?(e.height*=Fp/e.width,e.width=Fp):(e.width*=Fp/e.height,e.height=Fp):e.width>Fp?(e.height*=Fp/e.width,e.width=Fp):(e.width*=Fp/e.height,e.height=Fp))}function Lp(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=n,r.crossOrigin=`anonymous`,r.decoding=`async`,r.src=e})}async function Rp(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function zp(e,t,n){let r=`http://www.w3.org/2000/svg`,i=document.createElementNS(r,`svg`),a=document.createElementNS(r,`foreignObject`);return i.setAttribute(`width`,`${t}`),i.setAttribute(`height`,`${n}`),i.setAttribute(`viewBox`,`0 0 ${t} ${n}`),a.setAttribute(`width`,`100%`),a.setAttribute(`height`,`100%`),a.setAttribute(`x`,`0`),a.setAttribute(`y`,`0`),a.setAttribute(`externalResourcesRequired`,`true`),i.appendChild(a),a.appendChild(e),Rp(i)}var Bp=(e,t)=>{if(e instanceof t)return!0;let n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||Bp(n,t)};function Vp(e){let t=e.getPropertyValue(`content`);return`${e.cssText} content: '${t.replace(/'|"/g,``)}';`}function Hp(e,t){return kp(t).map(t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?` !important`:``};`).join(` `)}function Up(e,t,n,r){let i=`.${e}:${t}`,a=n.cssText?Vp(n):Hp(n,r);return document.createTextNode(`${i}{${a}}`)}function Wp(e,t,n,r){let i=window.getComputedStyle(e,n),a=i.getPropertyValue(`content`);if(a===``||a===`none`)return;let o=Ep();try{t.className=`${t.className} ${o}`}catch{return}let s=document.createElement(`style`);s.appendChild(Up(o,n,i,r)),t.appendChild(s)}function Gp(e,t,n){Wp(e,t,`:before`,n),Wp(e,t,`:after`,n)}var Kp=`application/font-woff`,qp=`image/jpeg`,Jp={woff:Kp,woff2:Kp,ttf:`application/font-truetype`,eot:`application/vnd.ms-fontobject`,png:`image/png`,jpg:qp,jpeg:qp,gif:`image/gif`,tiff:`image/tiff`,svg:`image/svg+xml`,webp:`image/webp`};function Yp(e){let t=/\.([^./]*?)$/g.exec(e);return t?t[1]:``}function Xp(e){return Jp[Yp(e).toLowerCase()]||``}function Zp(e){return e.split(/,/)[1]}function Qp(e){return e.search(/^(data:)/)!==-1}function $p(e,t){return`data:${t};base64,${e}`}async function em(e,t,n){let r=await fetch(e,t);if(r.status===404)throw Error(`Resource "${r.url}" not found`);let i=await r.blob();return new Promise((e,t)=>{let a=new FileReader;a.onerror=t,a.onloadend=()=>{try{e(n({res:r,result:a.result}))}catch(e){t(e)}},a.readAsDataURL(i)})}var tm={};function nm(e,t,n){let r=e.replace(/\?.*/,``);return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,``)),t?`[${t}]${r}`:r}async function rm(e,t,n){let r=nm(e,t,n.includeQueryParams);if(tm[r]!=null)return tm[r];n.cacheBust&&(e+=(/\?/.test(e)?`&`:`?`)+new Date().getTime());let i;try{i=$p(await em(e,n.fetchRequestInit,({res:e,result:n})=>(t||=e.headers.get(`Content-Type`)||``,Zp(n))),t)}catch(t){i=n.imagePlaceholder||``;let r=`Failed to fetch resource: ${e}`;t&&(r=typeof t==`string`?t:t.message),r&&console.warn(r)}return tm[r]=i,i}async function im(e){let t=e.toDataURL();return t===`data:,`?e.cloneNode(!1):Lp(t)}async function am(e,t){if(e.currentSrc){let t=document.createElement(`canvas`),n=t.getContext(`2d`);return t.width=e.clientWidth,t.height=e.clientHeight,n?.drawImage(e,0,0,t.width,t.height),Lp(t.toDataURL())}let n=e.poster;return Lp(await rm(n,Xp(n),t))}async function om(e,t){try{if(e?.contentDocument?.body)return await gm(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function sm(e,t){return Bp(e,HTMLCanvasElement)?im(e):Bp(e,HTMLVideoElement)?am(e,t):Bp(e,HTMLIFrameElement)?om(e,t):e.cloneNode(lm(e))}var cm=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SLOT`,lm=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SVG`;async function um(e,t,n){if(lm(t))return t;let r=[];return r=cm(e)&&e.assignedNodes?Dp(e.assignedNodes()):Bp(e,HTMLIFrameElement)&&e.contentDocument?.body?Dp(e.contentDocument.body.childNodes):Dp((e.shadowRoot??e).childNodes),r.length===0||Bp(e,HTMLVideoElement)||await r.reduce((e,r)=>e.then(()=>gm(r,n)).then(e=>{e&&t.appendChild(e)}),Promise.resolve()),t}function dm(e,t,n){let r=t.style;if(!r)return;let i=window.getComputedStyle(e);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):kp(n).forEach(n=>{let a=i.getPropertyValue(n);n===`font-size`&&a.endsWith(`px`)&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),Bp(e,HTMLIFrameElement)&&n===`display`&&a===`inline`&&(a=`block`),n===`d`&&t.getAttribute(`d`)&&(a=`path(${t.getAttribute(`d`)})`),r.setProperty(n,a,i.getPropertyPriority(n))})}function fm(e,t){Bp(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),Bp(e,HTMLInputElement)&&t.setAttribute(`value`,e.value)}function pm(e,t){if(Bp(e,HTMLSelectElement)){let n=t,r=Array.from(n.children).find(t=>e.value===t.getAttribute(`value`));r&&r.setAttribute(`selected`,``)}}function mm(e,t,n){return Bp(t,Element)&&(dm(e,t,n),Gp(e,t,n),fm(e,t),pm(e,t)),t}async function hm(e,t){let n=e.querySelectorAll?e.querySelectorAll(`use`):[];if(n.length===0)return e;let r={};for(let i=0;i<n.length;i++){let a=n[i].getAttribute(`xlink:href`);if(a){let n=e.querySelector(a),i=document.querySelector(a);!n&&i&&!r[a]&&(r[a]=await gm(i,t,!0))}}let i=Object.values(r);if(i.length){let t=`http://www.w3.org/1999/xhtml`,n=document.createElementNS(t,`svg`);n.setAttribute(`xmlns`,t),n.style.position=`absolute`,n.style.width=`0`,n.style.height=`0`,n.style.overflow=`hidden`,n.style.display=`none`;let r=document.createElementNS(t,`defs`);n.appendChild(r);for(let e=0;e<i.length;e++)r.appendChild(i[e]);e.appendChild(n)}return e}async function gm(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(e=>sm(e,t)).then(n=>um(e,n,t)).then(n=>mm(e,n,t)).then(e=>hm(e,t))}var _m=/url\((['"]?)([^'"]+?)\1\)/g,vm=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,ym=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function bm(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}function xm(e){let t=[];return e.replace(_m,(e,n,r)=>(t.push(r),e)),t.filter(e=>!Qp(e))}async function Sm(e,t,n,r,i){try{let a=n?Tp(t,n):t,o=Xp(t),s;return s=i?$p(await i(a),o):await rm(a,o,r),e.replace(bm(t),`$1${s}$3`)}catch{}return e}function Cm(e,{preferredFontFormat:t}){return t?e.replace(ym,e=>{for(;;){let[n,,r]=vm.exec(e)||[];if(!r)return``;if(r===t)return`src: ${n};`}}):e}function wm(e){return e.search(_m)!==-1}async function Tm(e,t,n){if(!wm(e))return e;let r=Cm(e,n);return xm(r).reduce((e,r)=>e.then(e=>Sm(e,r,t,n)),Promise.resolve(r))}async function Em(e,t,n){let r=t.style?.getPropertyValue(e);if(r){let i=await Tm(r,null,n);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function Dm(e,t){await Em(`background`,e,t)||await Em(`background-image`,e,t),await Em(`mask`,e,t)||await Em(`-webkit-mask`,e,t)||await Em(`mask-image`,e,t)||await Em(`-webkit-mask-image`,e,t)}async function Om(e,t){let n=Bp(e,HTMLImageElement);if(!(n&&!Qp(e.src))&&!(Bp(e,SVGImageElement)&&!Qp(e.href.baseVal)))return;let r=n?e.src:e.href.baseVal,i=await rm(r,Xp(r),t);await new Promise((r,a)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){a(e)}}:a;let o=e;o.decode&&=r,o.loading===`lazy`&&(o.loading=`eager`),n?(e.srcset=``,e.src=i):e.href.baseVal=i})}async function km(e,t){let n=Dp(e.childNodes).map(e=>Am(e,t));await Promise.all(n).then(()=>e)}async function Am(e,t){Bp(e,Element)&&(await Dm(e,t),await Om(e,t),await km(e,t))}function jm(e,t){let{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);let r=t.style;return r!=null&&Object.keys(r).forEach(e=>{n[e]=r[e]}),e}var Mm={};async function Nm(e){let t=Mm[e];return t??(t={url:e,cssText:await(await fetch(e)).text()},Mm[e]=t,t)}async function Pm(e,t){let n=e.cssText,r=/url\(["']?([^"')]+)["']?\)/g,i=(n.match(/url\([^)]+\)/g)||[]).map(async i=>{let a=i.replace(r,`$1`);return a.startsWith(`https://`)||(a=new URL(a,e.url).href),em(a,t.fetchRequestInit,({result:e})=>(n=n.replace(i,`url(${e})`),[i,e]))});return Promise.all(i).then(()=>n)}function Fm(e){if(e==null)return[];let t=[],n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,``),r=RegExp(`((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})`,`gi`);for(;;){let e=r.exec(n);if(e===null)break;t.push(e[0])}n=n.replace(r,``);let i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a=RegExp(`((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})`,`gi`);for(;;){let e=i.exec(n);if(e===null){if(e=a.exec(n),e===null)break;i.lastIndex=a.lastIndex}else a.lastIndex=i.lastIndex;t.push(e[0])}return t}async function Im(e,t){let n=[],r=[];return e.forEach(n=>{if(`cssRules`in n)try{Dp(n.cssRules||[]).forEach((e,i)=>{if(e.type===CSSRule.IMPORT_RULE){let a=i+1,o=e.href,s=Nm(o).then(e=>Pm(e,t)).then(e=>Fm(e).forEach(e=>{try{n.insertRule(e,e.startsWith(`@import`)?a+=1:n.cssRules.length)}catch(t){console.error(`Error inserting rule from remote css`,{rule:e,error:t})}})).catch(e=>{console.error(`Error loading remote css`,e.toString())});r.push(s)}})}catch(i){let a=e.find(e=>e.href==null)||document.styleSheets[0];n.href!=null&&r.push(Nm(n.href).then(e=>Pm(e,t)).then(e=>Fm(e).forEach(e=>{a.insertRule(e,a.cssRules.length)})).catch(e=>{console.error(`Error loading remote stylesheet`,e)})),console.error(`Error inlining remote css file`,i)}}),Promise.all(r).then(()=>(e.forEach(e=>{if(`cssRules`in e)try{Dp(e.cssRules||[]).forEach(e=>{n.push(e)})}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}}),n))}function Lm(e){return e.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>wm(e.style.getPropertyValue(`src`)))}async function Rm(e,t){if(e.ownerDocument==null)throw Error(`Provided element is not within a Document`);return Lm(await Im(Dp(e.ownerDocument.styleSheets),t))}function zm(e){return e.trim().replace(/["']/g,``)}function Bm(e){let t=new Set;function n(e){(e.style.fontFamily||getComputedStyle(e).fontFamily).split(`,`).forEach(e=>{t.add(zm(e))}),Array.from(e.children).forEach(e=>{e instanceof HTMLElement&&n(e)})}return n(e),t}async function Vm(e,t){let n=await Rm(e,t),r=Bm(e);return(await Promise.all(n.filter(e=>r.has(zm(e.style.fontFamily))).map(e=>{let n=e.parentStyleSheet?e.parentStyleSheet.href:null;return Tm(e.cssText,n,t)}))).join(`
23
+ `)}async function Hm(e,t){let n=t.fontEmbedCSS==null?t.skipFonts?null:await Vm(e,t):t.fontEmbedCSS;if(n){let t=document.createElement(`style`),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}async function Um(e,t={}){let{width:n,height:r}=Np(e,t),i=await gm(e,t,!0);return await Hm(i,t),await Am(i,t),jm(i,t),await zp(i,n,r)}async function Wm(e,t={}){let{width:n,height:r}=Np(e,t),i=await Lp(await Um(e,t)),a=document.createElement(`canvas`),o=a.getContext(`2d`),s=t.pixelRatio||Pp(),c=t.canvasWidth||n,l=t.canvasHeight||r;return a.width=c*s,a.height=l*s,t.skipAutoScale||Ip(a),a.style.width=`${c}`,a.style.height=`${l}`,t.backgroundColor&&(o.fillStyle=t.backgroundColor,o.fillRect(0,0,a.width,a.height)),o.drawImage(i,0,0,a.width,a.height),a}async function Gm(e,t={}){return(await Wm(e,t)).toDataURL()}async function Km(){try{return(await Gm(document.body,{canvasWidth:1600,cacheBust:!0})).replace(/^data:image\/png;base64,/,``)}catch{return}}function qm(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}var Jm={background:`var(--bg-raised, var(--bg))`,border:`1px solid var(--border)`,borderRadius:`10px`,padding:`20px`,maxWidth:`420px`,fontFamily:`'JetBrains Mono', monospace`,fontSize:`12px`,color:`var(--fg)`};function Ym(){let[e,t]=(0,L.useState)(`idle`),[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(null);async function o(){t(`loading-manifest`),a(null);try{let e=await B.debugReport.manifest();r(e),t(`reviewing`)}catch(e){a(e instanceof Error?e.message:String(e)),t(`error`)}}function s(){t(`idle`),r(null),a(null)}async function c(){t(`building`),a(null);try{let e=await Km();qm(await B.debugReport.download(e),`jinn-debug-report-${new Date().toISOString().slice(0,10)}.tar.gz`),s()}catch(e){a(e instanceof Error?e.message:String(e)),t(`error`)}}return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void o(),disabled:e===`loading-manifest`||e===`building`,style:{background:`transparent`,border:`1px solid var(--border)`,borderRadius:`6px`,padding:`4px 10px`,fontFamily:`'JetBrains Mono', monospace`,fontSize:`11px`,letterSpacing:`0.08em`,textTransform:`uppercase`,color:`var(--fg-muted)`,cursor:e===`building`?`wait`:`pointer`},children:e===`building`?`building report…`:`debug report`}),(e===`reviewing`||e===`building`||e===`error`)&&(0,R.jsx)(`div`,{role:`dialog`,"aria-label":`Download debug report`,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.45)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e3},onClick:s,children:(0,R.jsxs)(`div`,{style:Jm,onClick:e=>e.stopPropagation(),children:[(0,R.jsx)(`h2`,{style:{fontFamily:`'Instrument Serif', 'Times New Roman', serif`,fontSize:`22px`,margin:`0 0 8px`,color:`var(--fg)`},children:`Download debug report`}),(0,R.jsx)(`p`,{style:{color:`var(--fg-muted)`,margin:`0 0 14px`,lineHeight:1.5},children:`A support bundle for debugging this daemon. Secret values in the config, logs, and events are redacted — but the screenshot is not (see below). Review what it contains:`}),n&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,R.jsx)(`div`,{style:{color:`var(--fg-dim)`,marginBottom:`4px`},children:`Bundle contents`}),(0,R.jsx)(`ul`,{style:{margin:0,paddingLeft:`18px`,color:`var(--fg)`},children:n.files.map(e=>(0,R.jsx)(`li`,{children:e},e))})]}),(0,R.jsxs)(`div`,{style:{marginBottom:`14px`},children:[(0,R.jsx)(`div`,{style:{color:`var(--fg-dim)`,marginBottom:`4px`},children:`Redacted`}),(0,R.jsx)(`ul`,{style:{margin:0,paddingLeft:`18px`,color:`var(--fg-muted)`},children:n.redaction.redacted.map(e=>(0,R.jsx)(`li`,{children:e},e))})]}),n.redaction.notRedacted&&n.redaction.notRedacted.length>0&&(0,R.jsxs)(`div`,{style:{marginBottom:`14px`},children:[(0,R.jsx)(`div`,{style:{color:`var(--break-red)`,marginBottom:`4px`},children:`Not redacted — review before sharing`}),(0,R.jsx)(`ul`,{style:{margin:0,paddingLeft:`18px`,color:`var(--fg-muted)`},children:n.redaction.notRedacted.map(e=>(0,R.jsx)(`li`,{children:e},e))})]})]}),i&&(0,R.jsx)(`p`,{style:{color:`var(--break-red)`,margin:`0 0 12px`},children:i}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`10px`,justifyContent:`flex-end`},children:[(0,R.jsx)(`button`,{type:`button`,onClick:s,style:{background:`transparent`,border:`1px solid var(--border)`,borderRadius:`6px`,padding:`6px 12px`,fontFamily:`'JetBrains Mono', monospace`,fontSize:`11px`,color:`var(--fg-muted)`,cursor:`pointer`},children:`Cancel`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void c(),disabled:e===`building`,style:{background:`var(--fg)`,border:`1px solid var(--fg)`,borderRadius:`6px`,padding:`6px 12px`,fontFamily:`'JetBrains Mono', monospace`,fontSize:`11px`,color:`var(--bg)`,cursor:e===`building`?`wait`:`pointer`},children:e===`building`?`Building…`:`Download`})]})]})})]})}function Xm({network:e}){return(0,R.jsxs)(`header`,{className:`flex items-center justify-between px-6 py-3.5`,children:[(0,R.jsx)($t,{href:`/overview`,className:`font-serif text-[26px] text-foreground no-underline`,children:`jinn operator`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(q,{variant:`outline`,children:e}),(0,R.jsx)(Ym,{})]})]})}var Zm=[{path:`/overview`,label:`Dashboard`},{path:`/events`,label:`Events`},{path:`/operator`,label:`Settings`}];function Qm(){let[e]=Kt(),t=e.split(/[?#]/)[0]||`/`,n=t===`/launcher`||t.startsWith(`/launcher/`),{data:r}=ut({queryKey:[`solvernets`,`launched`,`top-tabs`],queryFn:()=>B.solvernets.listLaunched(),refetchInterval:3e4,enabled:!n}),i=Zo().pluginBuilderUi?[...Zm,{path:`/build`,label:`Build`}]:Zm;return(0,R.jsx)(`nav`,{className:`-mb-px flex px-6`,children:(n||(r?.records.length??0)>0?[...i,{path:`/launcher`,label:`Launcher`}]:i).map(e=>{let n=t===e.path||t.startsWith(`${e.path}/`);return(0,R.jsx)($t,{href:e.path,"data-active":n?`true`:`false`,className:U(`border-b px-4 py-3.5 font-mono text-[11px] font-medium uppercase tracking-[0.14em] no-underline transition-colors`,n?`border-primary text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:e.label},e.path)})})}function $m({agentGated:e}){return(0,R.jsxs)(`div`,{className:`agent-rail flex h-full min-w-0 flex-col gap-3 overflow-hidden p-4`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground [overflow-wrap:anywhere]`,children:`Claude`}),(0,R.jsx)(Jo,{agentGated:e})]})}function eh(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var th=e=>{switch(e){case`success`:return ih;case`info`:return oh;case`warning`:return ah;case`error`:return sh;default:return null}},nh=Array(12).fill(0),rh=({visible:e,className:t})=>L.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},L.createElement(`div`,{className:`sonner-spinner`},nh.map((e,t)=>L.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),ih=L.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},L.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),ah=L.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},L.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),oh=L.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},L.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),sh=L.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},L.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),ch=L.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},L.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),L.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),lh=()=>{let[e,t]=L.useState(document.hidden);return L.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},uh=1,dh=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:uh++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0||e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],L.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(ph(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!L.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!L.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!L.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!L.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||uh++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},fh=(e,t)=>{let n=t?.id||uh++;return dh.addToast({title:e,...t,id:n}),n},ph=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,mh=Object.assign(fh,{success:dh.success,info:dh.info,warning:dh.warning,error:dh.error,custom:dh.custom,message:dh.message,promise:dh.promise,dismiss:dh.dismiss,loading:dh.loading},{getHistory:()=>dh.toasts,getToasts:()=>dh.getActiveToasts()});eh(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function hh(e){return e.label!==void 0}var gh=3,_h=`24px`,vh=`16px`,yh=4e3,bh=356,xh=14,Sh=45,Ch=200;function wh(...e){return e.filter(Boolean).join(` `)}function Th(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Eh=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,D]=L.useState(null),[O,ee]=L.useState(null),[k,A]=L.useState(!1),[j,M]=L.useState(!1),[N,te]=L.useState(!1),[P,F]=L.useState(!1),[ne,re]=L.useState(!1),[ie,ae]=L.useState(0),[I,oe]=L.useState(0),se=L.useRef(n.duration||y||yh),ce=L.useRef(null),le=L.useRef(null),ue=c===0,de=c+1<=o,fe=n.type,pe=n.dismissible!==!1,me=n.className||``,he=n.descriptionClassName||``,ge=L.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),_e=L.useMemo(()=>n.closeButton??p,[n.closeButton,p]),ve=L.useMemo(()=>n.duration||y||yh,[n.duration,y]),ye=L.useRef(0),be=L.useRef(0),xe=L.useRef(0),Se=L.useRef(null),[Ce,we]=b.split(`-`),Te=L.useMemo(()=>s.reduce((e,t,n)=>n>=ge?e:e+t.height,0),[s,ge]),Ee=lh(),De=n.invert||t,Oe=fe===`loading`;be.current=L.useMemo(()=>ge*x+Te,[ge,Te]),L.useEffect(()=>{se.current=ve},[ve]),L.useEffect(()=>{A(!0)},[]),L.useEffect(()=>{let e=le.current;if(e){let t=e.getBoundingClientRect().height;return oe(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),L.useLayoutEffect(()=>{if(!k)return;let e=le.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,oe(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[k,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let ke=L.useCallback(()=>{M(!0),ae(be.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Ch)},[n,d,a,be]);L.useEffect(()=>{if(n.promise&&fe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||Ee?(()=>{if(xe.current<ye.current){let e=new Date().getTime()-ye.current;se.current-=e}xe.current=new Date().getTime()})():se.current!==1/0&&(ye.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),ke()},se.current)),()=>clearTimeout(e)},[u,i,n,fe,Ee,ke]),L.useEffect(()=>{n.delete&&(ke(),n.onDismiss==null||n.onDismiss.call(n,n))},[ke,n.delete]);function Ae(){return w?.loading?L.createElement(`div`,{className:wh(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":fe===`loading`},w.loading):L.createElement(rh,{className:wh(C?.loader,n?.classNames?.loader),visible:fe===`loading`})}let je=n.icon||w?.[fe]||th(fe);return L.createElement(`li`,{tabIndex:0,ref:le,className:wh(_,me,C?.toast,n?.classNames?.toast,C?.default,C?.[fe],n?.classNames?.[fe]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":k,"data-promise":!!n.promise,"data-swiped":ne,"data-removed":j,"data-visible":de,"data-y-position":Ce,"data-x-position":we,"data-index":c,"data-front":ue,"data-swiping":N,"data-dismissible":pe,"data-type":fe,"data-invert":De,"data-swipe-out":P,"data-swipe-direction":O,"data-expanded":!!(u||S&&k),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${j?ie:be.current}px`,"--initial-height":S?`auto`:`${I}px`,...m,...n.style},onDragEnd:()=>{te(!1),D(null),Se.current=null},onPointerDown:e=>{e.button!==2&&(Oe||!pe||(ce.current=new Date,ae(be.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(te(!0),Se.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(P||!pe)return;Se.current=null;let e=Number(le.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(le.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ce.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=Sh||a>.11){ae(be.current),n.onDismiss==null||n.onDismiss.call(n,n),ee(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),ke(),F(!0);return}else{var o,s;(o=le.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=le.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}re(!1),te(!1),D(null)},onPointerMove:t=>{var n,r;if(!Se.current||!pe||window.getSelection()?.toString().length>0)return;let i=t.clientY-Se.current.y,a=t.clientX-Se.current.x,o=e.swipeDirections??Th(b);!E&&(Math.abs(a)>1||Math.abs(i)>1)&&D(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(E===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&re(!0),(n=le.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=le.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},_e&&!n.jsx&&fe!==`loading`?L.createElement(`button`,{"aria-label":T,"data-disabled":Oe,"data-close-button":!0,onClick:Oe||!pe?()=>{}:()=>{ke(),n.onDismiss==null||n.onDismiss.call(n,n)},className:wh(C?.closeButton,n?.classNames?.closeButton)},w?.close??ch):null,(fe||n.icon||n.promise)&&n.icon!==null&&(w?.[fe]!==null||n.icon)?L.createElement(`div`,{"data-icon":``,className:wh(C?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ae():null,n.type===`loading`?null:je):null,L.createElement(`div`,{"data-content":``,className:wh(C?.content,n?.classNames?.content)},L.createElement(`div`,{"data-title":``,className:wh(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?L.createElement(`div`,{"data-description":``,className:wh(v,he,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),L.isValidElement(n.cancel)?n.cancel:n.cancel&&hh(n.cancel)?L.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{hh(n.cancel)&&pe&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),ke())},className:wh(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,L.isValidElement(n.action)?n.action:n.action&&hh(n.action)?L.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{hh(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&ke())},className:wh(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Dh(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function Oh(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?vh:_h;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var kh=L.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=gh,toastOptions:g,dir:_=Dh(),gap:v=xh,icons:y,containerAriaLabel:b=`Notifications`}=e,[x,S]=L.useState([]),C=L.useMemo(()=>n?x.filter(e=>e.toasterId===n):x.filter(e=>!e.toasterId),[x,n]),w=L.useMemo(()=>Array.from(new Set([i].concat(C.filter(e=>e.position).map(e=>e.position)))),[C,i]),[T,E]=L.useState([]),[D,O]=L.useState(!1),[ee,k]=L.useState(!1),[A,j]=L.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),M=L.useRef(null),N=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),te=L.useRef(null),P=L.useRef(!1),F=L.useCallback(e=>{S(t=>(t.find(t=>t.id===e.id)?.delete||dh.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return L.useEffect(()=>dh.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{S(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{Wi.flushSync(()=>{S(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[x]),L.useEffect(()=>{if(d!==`system`){j(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?j(`dark`):j(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{j(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{j(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),L.useEffect(()=>{x.length<=1&&O(!1)},[x]),L.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;O(!0),(t=M.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===M.current||M.current?.contains(document.activeElement))&&O(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),L.useEffect(()=>{if(M.current)return()=>{te.current&&(te.current.focus({preventScroll:!0}),te.current=null,P.current=!1)}},[M.current]),L.createElement(`section`,{ref:t,"aria-label":`${b} ${N}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},w.map((t,n)=>{let[i,a]=t.split(`-`);return C.length?L.createElement(`ol`,{key:t,dir:_===`auto`?Dh():_,tabIndex:-1,ref:M,className:c,"data-sonner-toaster":!0,"data-sonner-theme":A,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${T[0]?.height||0}px`,"--width":`${bh}px`,"--gap":`${v}px`,...m,...Oh(l,u)},onBlur:e=>{P.current&&!e.currentTarget.contains(e.relatedTarget)&&(P.current=!1,te.current&&=(te.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||P.current||(P.current=!0,te.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{ee||O(!1)},onDragEnd:()=>O(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||k(!0)},onPointerUp:()=>k(!1)},C.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>L.createElement(Eh,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:ee,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:F,toasts:C.filter(e=>e.position==n.position),heights:T.filter(e=>e.position==n.position),setHeights:E,expandByDefault:o,gap:v,expanded:D,swipeDirections:e.swipeDirections}))):null}))}),Ah=L.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,R.jsx)(`div`,{ref:i,role:n?`none`:`separator`,"aria-orientation":t,className:U(`shrink-0 bg-border`,t===`horizontal`?`h-px w-full`:`h-full w-px`,e),...r}));Ah.displayName=`Separator`;function jh(e){if(e==null)return null;let t=e-Date.now();if(t<=0)return null;let n=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`}),r=Math.round(t/6e4);if(r<60)return n.format(r,`minute`);let i=Math.round(t/36e5);return i<24?n.format(i,`hour`):n.format(Math.round(t/864e5),`day`)}var Mh=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,Nh=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,Ph=`font-mono text-[24px] font-medium tracking-[-0.01em] text-foreground`,Fh=`font-mono text-[12px] font-medium text-[var(--fg-muted)]`,Ih=`font-mono text-[12px] text-[var(--fg-dim)]`;function Lh(e,t,n){switch(e){case`ready`:return{value:t,copy:null};case`error`:return{value:`unavailable`,copy:n??`Your OLAS rewards are temporarily unavailable.`};case`pending`:return{value:`pending`,copy:`No rewards yet — they show up here as your node earns them.`}}}function Rh({totalEth:e,runwayDays:t,runwaySeverity:n=null,olasPending:r,olasClaimed:i,olasClaimedLast24h:a,olasState:o,olasError:s,lastClaimAt:c,lastPasswordRotationAt:l,onTopUp:u,onClaim:d,claimPending:f=!1,actionsDisabled:p=!1,topupDailyCap:m,topupCallsRemaining:h,topupCooldownExpiresAt:g}){let[,_]=Kt(),{value:v,copy:y}=Lh(o,r,s),b=Number.parseFloat(r),x=p||f||o!==`ready`||!(Number.isFinite(b)&&b>0),S=h!==void 0&&m!==void 0,C=S&&h===0,w=jh(g),T=S?C?w?`Daily faucet cap reached · resets ${w}`:`Daily faucet cap reached`:`${h} of ${m} top-ups left today`:null;return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{role:`region`,"aria-label":`Wallet`,"data-testid":`wallet-card`,className:`flex flex-col gap-6 p-6`,children:[(0,R.jsx)(`span`,{className:Mh,children:`Wallet`}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,"data-testid":`wallet-section-rewards`,children:[(0,R.jsx)(`span`,{className:Nh,children:`Rewards`}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,"data-testid":`olas-pending-region`,"aria-live":`polite`,"aria-atomic":`true`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Pending OLAS`}),(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`text-2xl font-bold tracking-tight`,"data-testid":`olas-pending-value`,style:o===`error`?{color:`var(--break-red)`}:void 0,children:v}),o===`ready`&&(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`OLAS`})]}),y&&(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`olas-pending-state`,children:y})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,"data-testid":`olas-claimed-24h-region`,"aria-live":`polite`,"aria-atomic":`true`,children:[(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Claimed last 24hrs`}),(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`text-base font-medium`,"data-testid":`olas-claimed-24h-value`,style:o===`error`?{color:`var(--break-red)`}:void 0,children:a??(o===`error`?`unavailable`:`pending`)}),a!==null&&(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`OLAS`})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Lifetime claimed`}),(0,R.jsx)(`span`,{className:`text-base font-medium`,"data-testid":`olas-claimed-value`,children:o===`error`?`unavailable`:i}),o!==`error`&&(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`OLAS`})]}),c&&(0,R.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`last claim `,(0,R.jsx)(`time`,{dateTime:c,children:c})]})]}),(0,R.jsx)(W,{variant:`secondary`,size:`sm`,"aria-label":`Claim OLAS`,onClick:d,disabled:x,"data-testid":`wallet-claim`,className:`self-start`,children:f?`Claiming OLAS`:`Claim OLAS`})]}),(0,R.jsx)(Ah,{}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,"data-testid":`wallet-section-gas`,children:[(0,R.jsx)(`span`,{className:Nh,children:`Gas`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:Ph,children:e}),(0,R.jsx)(`span`,{className:Fh,children:`ETH`}),(0,R.jsx)(`span`,{className:Ih,children:`·`}),(0,R.jsxs)(`span`,{"data-testid":`wallet-runway`,"data-runway-severity":n??`none`,className:Ih,style:n===`blocking`?{color:`var(--severity-blocking-fg)`}:n===`warning`?{color:`var(--severity-warning-fg)`}:void 0,children:[t,`d runway`]})]}),(0,R.jsx)(W,{variant:`outline`,size:`sm`,"aria-label":`Top up from faucet`,onClick:u,disabled:p||C,"data-testid":`wallet-topup`,className:`self-start`,children:`Top up from faucet (free)`}),T&&(0,R.jsx)(`span`,{className:Ih,"data-testid":`wallet-topup-quota`,children:T})]}),(0,R.jsx)(Ah,{}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,"data-testid":`wallet-section-password`,children:[(0,R.jsx)(`span`,{className:Nh,children:`Password`}),(0,R.jsxs)(`span`,{className:`font-mono text-[12px] text-[var(--fg-dim)]`,children:[`last rotated:`,` `,l?(0,R.jsx)(`time`,{dateTime:l,className:`text-[var(--fg-muted)]`,children:l}):(0,R.jsx)(`span`,{className:`text-[var(--fg-muted)]`,children:`never`})]}),(0,R.jsx)(W,{variant:`secondary`,size:`sm`,"aria-label":`Change password`,onClick:()=>_(`/operator/security`),"data-testid":`wallet-change-password`,className:`self-start`,children:`Change password`})]})]})})}var zh=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,Bh=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,Vh=`font-mono text-[14px] text-foreground`,Hh=`font-mono text-[14px] text-[var(--fg-muted)]`;function Uh(e){return e.length<10?e:`${e.slice(0,6)}…${e.slice(-4)}`}function Wh(){return(0,R.jsx)(`span`,{"data-testid":`identity-stat-empty`,className:Hh,children:`—`})}async function Gh(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select(),t.setSelectionRange(0,e.length);try{if(document.execCommand(`copy`)!==!0)throw Error(`Copy command failed`)}finally{t.remove()}}function Kh({label:e,children:t}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(`span`,{className:Bh,children:e}),t]})}function qh({label:e,address:t,testId:n}){return(0,R.jsx)(Kh,{label:e,children:t?(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,"data-testid":n,"aria-label":`Copy full ${e} address`,onClick:()=>{t&&Gh(t).catch(()=>{})},className:`cursor-copy border-0 bg-transparent p-0 text-left ${Vh}`,children:Uh(t)})}),(0,R.jsx)(nd,{children:t})]}):(0,R.jsx)(Wh,{})})}function Jh({masterAddress:e,safeAddress:t,serviceId:n,agentId:r,services:i=[],bindingError:a}){let o=i.find(e=>e.agentId!==null&&!e.safeBoundToAgent),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(a??null),h=async()=>{if(o){u(!0),f(null),m(null);try{let e=(await B.retryAgentBinding({serviceIndex:o.index})).attempts[0];e?.status===`success`?(f(`success`),c(!1)):(f(`reverted`),m(e?.detail??`Bind reverted on chain.`))}catch(e){f(`reverted`),m(e instanceof Error?e.message:String(e))}finally{u(!1)}}};return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{role:`region`,"aria-label":`Identity`,"data-testid":`identity-card`,className:`flex flex-col gap-6 p-6`,children:[(0,R.jsx)(`span`,{className:zh,children:`Identity`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-8`,children:[(0,R.jsx)(Kh,{label:`Service`,children:n===null?(0,R.jsx)(Wh,{}):(0,R.jsxs)(`span`,{"data-testid":`identity-service-id`,className:Vh,children:[`#`,n]})}),(0,R.jsx)(Kh,{label:`Agent`,children:(0,R.jsxs)(`span`,{className:`flex items-center gap-2 ${Vh}`,children:[r===null?(0,R.jsx)(Wh,{}):`#${r}`,o&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>c(e=>!e),className:`cursor-pointer rounded-full border border-[var(--wane)] bg-transparent px-1.5 py-px font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--wane)]`,children:`binding pending`}),d===`success`&&(0,R.jsx)(q,{variant:`success`,className:`rounded-full normal-case tracking-[0.12em]`,children:`bound`})]})}),(0,R.jsx)(qh,{label:`Master`,address:e,testId:`identity-master-address`}),(0,R.jsx)(qh,{label:`Safe`,address:t,testId:`identity-safe-address`})]}),o&&(0,R.jsxs)(fo,{variant:`warning`,"data-testid":`identity-state-message-safe-not-bound`,className:`flex flex-col gap-2`,children:[(0,R.jsxs)(mo,{children:[`Service #`,o.index,` Safe is not yet bound to agent #`,o.agentId,`. The bootstrap left it unbound; retry to attempt the ERC-1271 bind again.`]}),s&&p&&(0,R.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--break-red)]`,children:p}),(0,R.jsx)(W,{variant:`default`,size:`sm`,onClick:()=>{s||c(!0),h()},disabled:l,className:`self-start`,children:l?`Retrying…`:`Retry binding`})]}),r===null&&(0,R.jsx)(fo,{variant:`warning`,"data-testid":`identity-state-message-agent-id-not-minted`,children:(0,R.jsx)(mo,{children:`Agent ID has not yet been minted. The daemon mints it during bootstrap; if this persists, check the bootstrap logs.`})})]})})}var Yh=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,Xh=`flex items-center gap-2 font-mono text-[17px] font-medium text-foreground`;function Zh({tone:e}){return(0,R.jsx)(`span`,{"aria-hidden":`true`,className:U(`inline-block h-2 w-2 rounded-full`,e===`good`?`bg-[var(--vow-green)]`:e===`bad`?`bg-[var(--break-red)]`:`bg-[var(--fg-muted)]`)})}function Qh({daemonStatus:e,daemonStateMessage:t,rpcStatus:n,onRestart:r}){let[,i]=Kt(),[a,o]=(0,L.useState)(null),s=e===`running`,c=n===`healthy`;function l(){a||!r||(o(`restart`),Promise.resolve().then(r).catch(e=>console.error(`[node-health] restart failed:`,e)).finally(()=>o(null)))}return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{"data-testid":`node-health-card`,"aria-labelledby":`node-health-heading`,className:`flex flex-col gap-4 p-6`,children:[(0,R.jsx)(`h2`,{id:`node-health-heading`,className:U(Yh,`m-0 text-[var(--fg-dim)]`),children:`Node health`}),(0,R.jsxs)(`div`,{"data-testid":`node-health-daemon-row`,"data-status":e,className:`flex flex-col gap-2`,children:[(0,R.jsx)(`span`,{className:Yh,children:`Daemon`}),(0,R.jsxs)(`span`,{className:Xh,children:[(0,R.jsx)(Zh,{tone:s?`good`:`bad`}),s?`Running`:`Stopped`]}),t&&(0,R.jsx)(`span`,{"data-testid":`node-health-daemon-state`,className:`font-mono text-[12px] leading-snug text-[var(--fg-muted)]`,children:t}),(0,R.jsx)(`div`,{className:`mt-2 flex gap-2`,children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`span`,{tabIndex:s?-1:0,children:(0,R.jsx)(W,{variant:`outline`,size:`sm`,disabled:!s||a!==null,"data-testid":`node-health-restart`,onClick:l,children:a===`restart`?`Restarting...`:`Restart`})})}),(0,R.jsx)(nd,{children:s?`Restart the daemon. The dashboard reconnects when it comes back.`:`Daemon is stopped — re-run jinn from your terminal to start it.`})]})})]}),(0,R.jsxs)(`div`,{"data-testid":`node-health-rpc-row`,"data-status":n,className:`flex flex-col gap-2`,children:[(0,R.jsx)(`span`,{className:Yh,children:`RPC`}),(0,R.jsxs)(`span`,{className:Xh,children:[(0,R.jsx)(Zh,{tone:c?`good`:`bad`}),c?`Healthy`:`Unreachable`]}),(0,R.jsx)(`div`,{className:`mt-2 flex gap-2`,children:(0,R.jsx)(W,{variant:`outline`,size:`sm`,"data-testid":`node-health-rpc-settings`,onClick:()=>i(`/operator/network`),children:`Manage RPC`})})]})]})})}var $h=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,R.jsx)(`table`,{ref:n,className:U(`w-full caption-bottom font-mono text-[12px]`,e),...t})}));$h.displayName=`Table`;var eg=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`thead`,{ref:n,className:U(`[&_tr]:border-b [&_tr]:border-border`,e),...t}));eg.displayName=`TableHeader`;var tg=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`tbody`,{ref:n,className:U(`[&_tr:last-child]:border-0`,e),...t}));tg.displayName=`TableBody`;var ng=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`tfoot`,{ref:n,className:U(`border-t border-border bg-muted/50 font-medium [&>tr]:last:border-b-0`,e),...t}));ng.displayName=`TableFooter`;var rg=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`tr`,{ref:n,className:U(`border-b border-border transition-colors hover:bg-[var(--bg-sunken)]/50 data-[state=selected]:bg-[var(--bg-sunken)]`,e),...t}));rg.displayName=`TableRow`;var ig=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`th`,{ref:n,className:U(`h-8 px-2 text-left align-middle font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,e),...t}));ig.displayName=`TableHead`;var ag=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`td`,{ref:n,className:U(`px-2 py-2 align-middle`,e),...t}));ag.displayName=`TableCell`;var og=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(`caption`,{ref:n,className:U(`mt-4 text-[12px] text-[var(--fg-muted)]`,e),...t}));og.displayName=`TableCaption`;var sg=new Set([`DISCOVERED`,`CLAIMED`,`WAITING`,`PRE_SNAPSHOT`,`RUNNING`,`POST_SNAPSHOT`,`PACKAGING`,`DELIVERING`]);function cg(e,t=6,n=4){return e.length<=t+n+1?e:`${e.slice(0,t)}…${e.slice(-n)}`}function lg(e){return e===`restoration`?`solve`:e===`evaluation`?`evaluate`:`—`}function ug(e){return e===`COMPLETE`?{label:`succeeded`,detail:`COMPLETE`,tone:`good`}:e===`FAILED`?{label:`failed`,detail:`FAILED`,tone:`bad`}:e===`RACE_LOST`?{label:`race-lost`,detail:`RACE_LOST`,tone:`neutral`}:sg.has(e)?{label:`active`,detail:e.toLowerCase().replace(/_/g,` `),tone:`active`}:{label:e.toLowerCase().replace(/_/g,` `),detail:e,tone:`neutral`}}function dg(e){return e===`bad`?`destructive`:e===`good`?`success`:e===`active`?`default`:`outline`}function fg(e,t){switch(e){case`pass`:return{label:`pass`,tone:`good`};case`fail`:return{label:`fail`,tone:`bad`};case`awaiting`:return{label:t===`evaluation`?`awaiting`:`awaiting eval`,tone:`neutral`};case`accepted`:return{label:`accepted`,tone:`good`};case`rejected`:return{label:`rejected`,tone:`bad`};default:return null}}function pg(e){if(!e)return`—`;let t=Math.floor((Date.now()-e)/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function mg(e){return e===`solving`||e===`solver`?`solver`:e===`evaluating`||e===`evaluator`?`evaluator`:e}var hg=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground m-0`;function gg({children:e,className:t}){return(0,R.jsx)(`h3`,{className:U(hg,t),children:e})}function _g({label:e,children:t}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(gg,{children:e}),(0,R.jsx)(`div`,{className:`font-mono text-[12px] text-foreground`,children:t})]})}function vg({joined:e,tasks:t}){let[,n]=Kt(),[r,i]=(0,L.useState)(e[0]?.manifestCid??e[0]?.name??null),a=(0,L.useMemo)(()=>e.find(e=>(e.manifestCid??e.name)===r)??e[0]??null,[e,r]),o=(0,L.useMemo)(()=>a?t.filter(t=>{if(t.state===`FAILED`){if(t.runStartedAt===null)return!1;let e=(t.failureReason??``).toLowerCase();if(e.includes(`not ready`)||e.includes(`not enabled`))return!1}return e.length<=1?!0:t.solverType&&a.solverType?t.solverType===a.solverType:t.manifestCid&&a.manifestCid?t.manifestCid===a.manifestCid:!0}):[],[t,a,e.length,r]);return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{role:`region`,"aria-label":`Activity`,"data-testid":`activity-card`,children:[(0,R.jsxs)(zi,{className:`flex flex-row items-center justify-between gap-3 pb-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(vn,{className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),(0,R.jsx)(Bi,{children:`Activity`})]}),(0,R.jsxs)(W,{variant:`secondary`,size:`sm`,"data-testid":`activity-view-event-log`,onClick:()=>n(`/events`),children:[(0,R.jsx)(Mn,{className:`h-3 w-3`,"aria-hidden":`true`}),`View event log`]})]}),(0,R.jsx)(Hi,{children:(0,R.jsxs)(`div`,{className:`grid items-start gap-6 [grid-template-columns:minmax(160px,200px)_minmax(0,1fr)_minmax(180px,220px)]`,children:[(0,R.jsxs)(`div`,{"data-testid":`activity-joined`,className:`flex min-w-0 flex-col gap-3`,children:[(0,R.jsx)(gg,{children:`Joined`}),e.length===0?(0,R.jsx)(`p`,{className:`m-0 font-mono text-[12px] text-muted-foreground`,children:`No SolverNets joined.`}):(0,R.jsx)(io,{className:`max-h-[280px]`,children:(0,R.jsx)(`div`,{className:`flex flex-col gap-1 pr-2`,children:e.map(e=>{let t=e.manifestCid??e.name,n=t===(a?.manifestCid??a?.name);return(0,R.jsx)(W,{variant:`ghost`,size:`sm`,"data-testid":`activity-joined-row-${t}`,"data-state":n?`active`:void 0,"aria-current":n?`true`:void 0,onClick:()=>i(t),className:U(`h-auto w-full justify-start gap-0 rounded-sm border-l-2 px-2.5 py-1.5 font-mono text-[12px] normal-case tracking-normal`,n?`border-l-primary bg-accent text-foreground`:`border-l-transparent text-muted-foreground hover:bg-accent hover:text-foreground`),children:(0,R.jsx)(`span`,{className:`truncate`,children:e.name})},t)})})}),(0,R.jsxs)(W,{variant:`outline`,size:`sm`,"data-testid":`activity-join-more`,onClick:()=>n(`/operator/registry`),className:`self-start`,children:[(0,R.jsx)(Ln,{className:`h-3 w-3`,"aria-hidden":`true`}),`Join more SolverNets`]})]}),(0,R.jsxs)(`div`,{"data-testid":`activity-tasks`,className:`flex min-w-0 flex-col gap-3`,children:[a&&(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[20px] font-normal leading-tight text-foreground`,children:a.name}),o.length===0?(0,R.jsx)(`p`,{className:`m-0 font-mono text-[12px] text-muted-foreground`,children:`No task runs recorded yet.`}):(0,R.jsx)(`div`,{"data-testid":`activity-tasks-table`,children:(0,R.jsxs)($h,{children:[(0,R.jsx)(eg,{children:(0,R.jsxs)(rg,{className:`hover:bg-transparent`,children:[(0,R.jsx)(ig,{children:`Run`}),(0,R.jsx)(ig,{children:`Task`}),(0,R.jsx)(ig,{children:`State`}),(0,R.jsx)(ig,{children:`Outcome`}),(0,R.jsx)(ig,{children:`Started`})]})}),(0,R.jsx)(tg,{children:o.map(e=>{let t=ug(e.state),r=fg(e.outcome,e.taskRole),i=t.tone===`active`;return(0,R.jsxs)(rg,{"data-active":i?`true`:void 0,"data-testid":`activity-task-row-${e.requestId}`,className:U(`border-l-2`,i?`border-l-primary bg-primary/[0.06]`:`border-l-transparent`),children:[(0,R.jsx)(ag,{className:`text-muted-foreground`,children:lg(e.taskRole)}),(0,R.jsx)(ag,{children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,className:`bg-transparent p-0 font-mono text-[12px] text-[var(--accent-sky)] underline-offset-4 hover:underline`,onClick:()=>n(`/events?requestId=${encodeURIComponent(e.requestId)}`),children:cg(e.requestId)})}),(0,R.jsx)(nd,{children:e.requestId})]})}),(0,R.jsx)(ag,{children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,className:`cursor-help bg-transparent p-0`,children:(0,R.jsx)(q,{variant:dg(t.tone),children:t.label})})}),(0,R.jsx)(nd,{children:t.detail})]})}),(0,R.jsx)(ag,{children:r?(0,R.jsx)(q,{variant:dg(r.tone),children:r.label}):(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,R.jsx)(ag,{className:`text-muted-foreground`,children:pg(e.runStartedAt??e.stateUpdatedAt)})]},e.requestId)})})]})})]}),(0,R.jsxs)(`div`,{"data-testid":`activity-settings`,className:`flex min-w-0 flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,R.jsx)(gg,{children:`Settings`}),(0,R.jsxs)(W,{variant:`link`,size:`sm`,"data-testid":`activity-settings-edit`,onClick:()=>n(`/operator/memberships`),className:`h-auto gap-1 p-0 text-[11px] uppercase tracking-[0.14em]`,children:[(0,R.jsx)(In,{className:`h-3 w-3`,"aria-hidden":`true`}),`Edit`]})]}),a?(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsx)(_g,{label:`Roles`,children:a.roles.length===0?(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:a.roles.map(e=>(0,R.jsx)(q,{variant:`outline`,children:mg(e)},e))})}),(0,R.jsx)(Ah,{}),(0,R.jsx)(_g,{label:`Harness`,children:a.harness??`—`}),(0,R.jsx)(Ah,{}),(0,R.jsx)(_g,{label:`Model`,children:(0,R.jsx)(`span`,{className:U(!a.model&&`text-muted-foreground`),children:a.model??`—`})}),(0,R.jsx)(Ah,{}),(0,R.jsx)(_g,{label:`Plugins`,children:!a.plugins||a.plugins.length===0?(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,R.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1.5 p-0`,children:a.plugins.map(e=>(0,R.jsxs)(`li`,{"data-testid":`activity-plugin-${e.name}`,className:`flex items-center gap-2 overflow-hidden`,children:[(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,className:`cursor-help truncate bg-transparent p-0 text-left font-mono text-[12px] text-foreground`,children:e.displayName})}),(0,R.jsx)(nd,{children:e.name})]}),e.defaultIncluded&&(0,R.jsx)(q,{variant:`secondary`,className:`shrink-0`,children:`default`})]},e.name))})})]}):(0,R.jsx)(`p`,{className:`m-0 font-mono text-[12px] text-muted-foreground`,children:`No SolverNet selected.`})]})]})})]})})}function yg(e){let t=new Date(e);return`${String(t.getUTCHours()).padStart(2,`0`)}:${String(t.getUTCMinutes()).padStart(2,`0`)} UTC`}function bg(e){return`$${(e/1e6).toFixed(4)}`}function xg({aiUnits:e}){if(!e)return null;let t=e.credentials.filter(e=>e.paused);return t.length===0?null:(0,R.jsx)(`div`,{className:`flex flex-col gap-2`,children:t.map(e=>{let t=typeof e.usdMicrosThisBlock==`number`&&typeof e.usdMicrosThisWeek==`number`&&typeof e.capPerBlockUsdMicros==`number`&&typeof e.capPerWeekUsdMicros==`number`,n=e.usdMicrosThisBlock??0,r=e.usdMicrosThisWeek??0,i=e.capPerBlockUsdMicros??0,a=e.capPerWeekUsdMicros??0,o=(t?n>=i:e.unitsThisBlock>=e.capPerBlock)?`block`:`week`,s=o===`block`?e.blockResetsAt:e.weekResetsAt,c=o===`block`?`6h`:`7d`,l=t?`${e.estimated?`estimated`:`metered`} ${o===`block`?`${bg(n)} / ${bg(i)}`:`${bg(r)} / ${bg(a)}`}`:o===`block`?`${e.unitsThisBlock} / ${e.capPerBlock} units`:`${e.unitsThisWeek} / ${e.capPerWeek} units`,u=o===`block`?`this block`:`this 7-day window`,d=e.active??!0;return(0,R.jsxs)(fo,{variant:`warning`,"data-testid":`ai-units-pause-alert-${e.credentialId}`,children:[(0,R.jsx)(Tn,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,R.jsxs)(po,{className:`font-mono text-[13px]`,children:[`Paused — `,c,` spend cap reached`,d?(0,R.jsx)(`span`,{className:`ml-2 text-foreground`,"data-testid":`ai-units-credential-state-${e.credentialId}`,children:`(Active)`}):null]}),(0,R.jsx)(mo,{className:`font-mono text-[12px] text-muted-foreground`,children:(0,R.jsxs)(`span`,{children:[`Credential `,(0,R.jsx)(`span`,{className:`text-foreground`,children:e.credentialId}),` used`,` `,l,` `,u,`. Claims resume at `,(0,R.jsx)(`span`,{className:`text-foreground`,children:yg(s)}),`.`]})})]},e.credentialId)})})}var Sg=[{name:`network-tools`,version:`0.1.0`,defaultIncluded:!0},{name:`claude-code-learner`,version:`0.2.0`,defaultIncluded:!0}],Cg=new Set([`swe-rebench-v2-runtime`]),wg={"network-tools":`Network Tools`,"claude-code-learner":`Learner`,"swe-rebench-v2-runtime":`SWE-rebench v2 Runtime`,"jinn-prediction-plugin":`Prediction Runtime`},Tg=`bundled:`;function Eg(e){return wg[e]??e}function Dg(e){return e.startsWith(Tg)?e.slice(8):e}function Og(e){let t=bd(e)===_d;return Sg.filter(e=>!(t&&e.name===`claude-code-learner`)).map(e=>({name:e.name,displayName:Eg(e.name),source:`bundled`,version:e.version,defaultIncluded:!0}))}function kg({harness:e,explicit:t,disabledDefaults:n,catalogCompatible:r=[]}){let i=new Set(n.map(Dg)),a=new Set(t.map(Dg));new Map(t.map(e=>[Dg(e),e]));let o=[],s=new Set;for(let t of Og(e))s.has(t.name)||(s.add(t.name),!i.has(t.name)&&o.push(t));for(let e of r){if(s.has(e.name))continue;s.add(e.name);let t=Cg.has(e.name),n=a.has(e.name);!t&&!n||t&&i.has(e.name)||o.push({name:e.name,displayName:Eg(e.name),source:`catalog`,version:e.version,defaultIncluded:t})}for(let e of t){let t=Dg(e);s.has(t)||(s.add(t),o.push({name:t,displayName:Eg(t),source:e.startsWith(Tg)?`bundled`:`custom`,version:`configured`,defaultIncluded:!1}))}return o}function Ag(e){if(!e||!/^\d+$/.test(e))return`—`;try{let t=BigInt(e);return(Number(t)/0xde0b6b3a7640000).toFixed(4)}catch{return`—`}}function jg(e){return!e||e.length<12?e??null:`${e.slice(0,6)}…${e.slice(-4)}`}function Mg(){let[e,t]=(0,L.useState)(null),n=Ye(),{data:r}=ut({queryKey:[`dripQuota`],queryFn:()=>B.getDripQuota(),refetchInterval:3e4}),{data:i,isError:a}=ut({queryKey:[`status`],queryFn:()=>B.getStatus(),refetchInterval:5e3}),{data:o,isError:s}=ut({queryKey:[`rewards`],queryFn:()=>B.getRewards(),refetchInterval:3e4}),{data:c}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap(),refetchInterval:3e4}),{data:l}=ut({queryKey:[`solvernets`,`catalog`],queryFn:()=>B.getSolverNets(),refetchInterval:5*6e4}),u=(i?.fleet?.services??[]).map(e=>({index:e.index,serviceId:e.serviceId??null,safeAddress:e.safeAddress??``,agentId:e.agentId??null,safeBoundToAgent:e.safeBoundToAgent??!1})),d=u.find(e=>e.serviceId!==null)?.serviceId??null,f=s||o?.readState===`error`?`error`:o?`ready`:`pending`,p=f===`ready`?Ag(o?.totalPending??`0`):`—`,m=f===`ready`?Ag(o?.totalClaimed??`0`):`—`,h=i?.rewards?.claimedStakingRewardsLast24hWei==null?i?`0.0000`:null:Ag(i.rewards.claimedStakingRewardsLast24hWei),g=o?.error??(s?`OLAS rewards temporarily unavailable.`:null),_=Ag(i?.masterGas?.balanceWei),v=i?.masterGas?.runwayDaysExcess??`—`,y=hp(i?.masterGas??{}),b=i?.balances?.eth,x=Ag(b?.master?.balanceWei??void 0),S=Ag(b?.agent?.balanceWei??void 0),C=Ag(b?.safe?.balanceWei??void 0),w=(0,L.useMemo)(()=>{let e=[],t=c?.joinedSolverNets;if(!t)return e;for(let[n,r]of Object.entries(t)){if(!r)continue;let t=r.contract?l?.nets.find(e=>e.contract.id===r.contract?.id&&e.contract.version===r.contract?.version):void 0,i=kg({harness:r.harness,explicit:Array.isArray(r.plugins)?r.plugins:[],disabledDefaults:Array.isArray(r.disabledDefaultPlugins)?r.disabledDefaultPlugins:[],catalogCompatible:t?.compatiblePlugins});e.push({name:r.name??r.manifestCid??n,manifestCid:r.manifestCid??n,solverType:r.contract?`${r.contract.id}.${r.contract.version}`:void 0,roles:Array.isArray(r.roles)?r.roles:[],harness:r.harness,model:r.model,plugins:i})}return e},[c,l]),T=(0,L.useMemo)(()=>{let e=new Map,t=t=>{if(t)for(let n of t)n.requestId&&(e.has(n.requestId)||e.set(n.requestId,{requestId:n.requestId,manifestCid:n.manifestCid??null,solverType:n.solverType??null,taskRole:n.taskRole,state:n.state,implName:n.implName??null,windowStartTs:n.windowStartTs??0,runStartedAt:n.runStartedAt??null,stateUpdatedAt:n.stateUpdatedAt,deliveryTxHash:n.deliveryTxHash??null,failureReason:n.failureReason??null,outcome:n.outcome??null}))};return t(i?.taskRuns?.recentTasks),t(i?.taskRuns?.inFlight),t(i?.predictionV1?.recentTasks),Array.from(e.values()).sort((e,t)=>t.stateUpdatedAt-e.stateUpdatedAt)},[i]),E=a&&i===void 0?`stopped`:`running`,D=(e,n,r)=>{t(e),Promise.resolve().then(n).then(t=>{mh.success(e,{description:t?.message,duration:r?.autoClearMs??5e3})}).catch(t=>{mh.error(`${e} failed`,{description:t instanceof Error?t.message:String(t),duration:1/0})}).finally(()=>t(null))};return(0,R.jsxs)(`div`,{"data-testid":`overview-page-grid`,className:`grid items-start gap-6 p-6 [grid-template-columns:minmax(0,1fr)_minmax(0,380px)]`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,R.jsx)(xg,{aiUnits:i?.aiUnits}),(0,R.jsx)(vg,{joined:w,tasks:T})]}),(0,R.jsxs)(`aside`,{className:`flex flex-col gap-6`,children:[(0,R.jsx)(Qh,{daemonStatus:E,daemonStateMessage:void 0,rpcStatus:`healthy`,onStop:async()=>{if(!(await B.stopDaemon()).ok)throw Error(`Stop request failed.`)},onRestart:async()=>{if(!(await B.restartDaemon({forceRespawn:!0})).ok)throw Error(`Restart request failed.`)}}),(0,R.jsx)(Jh,{masterAddress:c?.master_address??null,agentAddress:null,safeAddress:u[0]?.safeAddress??null,serviceId:d,agentId:u[0]?.agentId??null,services:u}),(0,R.jsx)(Rh,{totalEth:_,runwayDays:v,runwaySeverity:y,actionsDisabled:e!==null,perRole:{master:x,agent:S,safe:C},olasPending:p,olasClaimed:m,olasClaimedLast24h:h,olasState:f,olasError:g,lastClaimAt:o?.lastClaimAt??null,lastPasswordRotationAt:i?.security?.lastPasswordRotationAt??null,topupDailyCap:r?.dailyCap,topupCallsRemaining:r?.callsRemaining,topupCooldownExpiresAt:r?.cooldownExpiresAt??null,onTopUp:()=>D(`Top up gas`,async()=>{let e=await B.triggerDrip({batch:!0});if(n.invalidateQueries({queryKey:[`dripQuota`]}),!e.ok)throw e.reason===`topup_cooldown`?Error(`Daily faucet cap reached. Try again after the cooldown.`):Error(e.reason??`Gas top-up failed.`);let t=e.txHashes?.length??0;if(t===0)return{message:`Gas top-up checked; the faucet sent no funds.`};let r=jg(e.txHashes.at(-1));return{message:t===1?`Gas topped up · tx ${r}`:`Gas topped up: ${t} drips · last tx ${r}`}},{autoClearMs:5e3}),onClaim:()=>D(`Claim OLAS`,async()=>{let e=await B.claimRewards();if(!e.ok)throw Error(e.error??`Reward claim failed.`);await Promise.all([n.invalidateQueries({queryKey:[`rewards`]}),n.invalidateQueries({queryKey:[`status`]}),n.invalidateQueries({queryKey:[`activity-events`]})]);let t=e.result?.submitted??0;if(t===0)return{message:`No pending OLAS to claim.`};let r=e.result?.claims?.map(e=>e.txHash).filter(e=>!!e).at(-1),i=jg(r);return{message:i?`Claim submitted · tx ${i}`:`Claim submitted: ${t} claim${t===1?``:`s`}`}},{autoClearMs:5e3}),claimPending:e===`Claim OLAS`})]})]})}var Ng=[`task_posted`,`intent_registry_failed`,`request_claimed`,`delivery_submitted`,`evaluation_submitted`,`reward_claimed`,`balance_topup`,`engine_transition`,`tick_error`,`race_lost`,`startup`,`shutdown`],Pg={task_posted:{label:`Task posted`,description:`A new task intent was published on-chain.`,tone:`info`},intent_registry_failed:{label:`Intent registry failed`,description:`Posting a task intent to the registry did not succeed.`,tone:`error`},request_claimed:{label:`Request claimed`,description:`The solver claimed a task request to work on.`,tone:`info`},delivery_submitted:{label:`Delivery submitted`,description:`A completed solution was delivered on-chain.`,tone:`success`},evaluation_submitted:{label:`Evaluation submitted`,description:`An evaluation verdict was submitted for a delivery.`,tone:`success`},reward_claimed:{label:`Reward claimed`,description:`OLAS rewards were collected to your wallet.`,tone:`reward`},balance_topup:{label:`Balance top-up`,description:`Gas balance was topped up from the faucet.`,tone:`info`},engine_transition:{label:`Engine transition`,description:`A task run moved to a new lifecycle state.`,tone:`info`},tick_error:{label:`Tick error`,description:`An error occurred during a daemon polling tick.`,tone:`error`},race_lost:{label:`Race lost`,description:`A claim or evaluation lost the on-chain race (task already filled or evaluation deadline passed); no action needed.`,tone:`neutral`},startup:{label:`Daemon started`,description:`The jinn daemon process started.`,tone:`neutral`},shutdown:{label:`Daemon stopped`,description:`The jinn daemon process shut down.`,tone:`neutral`}};function Fg(e){let t=e.replace(/_/g,` `).trim();return t.length===0?`Event`:t.charAt(0).toUpperCase()+t.slice(1)}function Ig(e){return Pg[e]||{label:Fg(e),description:`A daemon lifecycle event.`,tone:`neutral`}}function Lg(e,t){if(t===`failed`)return`destructive`;if(t===`warn`)return`warning`;let n=Ig(e).tone;return n===`error`?`destructive`:n===`warning`?`warning`:n===`success`||n===`reward`?`success`:n===`neutral`?`secondary`:`default`}var Rg=50;function zg(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().replace(`T`,` `).slice(0,19)}function Bg(e,t=8,n=4){return e.length<=t+n+1?e:`${e.slice(0,t)}...${e.slice(-n)}`}function Vg(e){return e.requestId??e.solverType??`-`}function Hg(){let[e]=Kt();return(0,L.useMemo)(()=>{let t=e.includes(`?`)?e.split(`?`)[1]:``,n=typeof window>`u`?``:window.location.search.replace(/^\?/,``);return new URLSearchParams(t||n).get(`requestId`)?.trim()||void 0},[e])}function Ug({pageSize:e=Rg}={}){let t=Hg(),[n,r]=(0,L.useState)([]),[i,a]=(0,L.useState)(`all`),o=ft({queryKey:[`activity-events`,n,i,t,e],queryFn:({pageParam:r})=>B.getActivityEvents({kinds:n.length>0?n:void 0,outcome:i===`all`?void 0:i,requestId:t,beforeId:typeof r==`number`?r:void 0,limit:e}),initialPageParam:void 0,getNextPageParam:e=>e.nextCursor??void 0}),s=o.data?.pages??[],c=s.flatMap(e=>e.events),l=s[0]?.counts??{};function u(e){r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}return(0,R.jsxs)(`main`,{"data-testid":`events-page`,className:`mx-auto flex w-full max-w-6xl flex-col gap-5 p-6`,children:[(0,R.jsxs)(`header`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(`h1`,{className:`m-0 font-serif text-[32px] font-normal leading-tight text-foreground`,children:`Events`}),(0,R.jsx)(`p`,{className:`m-0 font-mono text-[12px] text-muted-foreground`,children:`Persistent lifecycle activity from this operator.`})]}),(0,R.jsx)(W,{asChild:!0,variant:`secondary`,size:`sm`,children:(0,R.jsx)($t,{href:`/overview`,"data-testid":`events-back`,children:`Overview`})})]}),t&&(0,R.jsxs)(fo,{variant:`info`,"data-testid":`events-request-scope`,children:[(0,R.jsx)(po,{children:`Request scoped`}),(0,R.jsxs)(mo,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)(`span`,{className:`break-all`,children:[`Showing events for `,t]}),(0,R.jsx)(W,{asChild:!0,variant:`link`,size:`sm`,className:`h-auto p-0`,children:(0,R.jsxs)($t,{href:`/events`,"data-testid":`events-clear-request`,children:[(0,R.jsx)(Hn,{"aria-hidden":`true`}),`Clear`]})})]})]}),(0,R.jsxs)(G,{children:[(0,R.jsxs)(zi,{children:[(0,R.jsx)(Bi,{children:`Filters`}),(0,R.jsx)(Vi,{children:`Kind and outcome filters page through the same durable log.`})]}),(0,R.jsxs)(Hi,{className:`flex flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Kind`}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ng.map(e=>{let t=n.includes(e),r=Ig(e);return(0,R.jsxs)(W,{type:`button`,size:`sm`,variant:t?`outline`:`secondary`,"aria-pressed":t?`true`:`false`,"data-testid":`events-kind-filter-${e}`,onClick:()=>u(e),className:`normal-case tracking-normal`,children:[r.label,l[e]!==void 0&&(0,R.jsx)(q,{variant:`secondary`,children:l[e]})]},e)})})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Outcome`}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`all`,`ok`,`failed`,`warn`].map(e=>(0,R.jsx)(W,{type:`button`,size:`sm`,variant:i===e?`outline`:`secondary`,"aria-pressed":i===e?`true`:`false`,"data-testid":`events-outcome-${e}`,onClick:()=>a(e),children:e},e))})]})]})]}),(0,R.jsxs)(G,{"data-testid":`events-list-section`,children:[(0,R.jsxs)(zi,{children:[(0,R.jsx)(Bi,{children:`Event Log`}),(0,R.jsxs)(Vi,{children:[c.length,` loaded`]})]}),(0,R.jsxs)(Hi,{className:`flex flex-col gap-4`,children:[o.isLoading&&(0,R.jsxs)(`div`,{"data-testid":`events-loading`,className:`flex items-center gap-2 font-mono text-[12px] text-muted-foreground`,children:[(0,R.jsx)(Nn,{className:`animate-spin`,"aria-hidden":`true`}),`Loading events`]}),o.isError&&(0,R.jsxs)(fo,{variant:`blocking`,"data-testid":`events-error`,children:[(0,R.jsx)(po,{children:`Events unavailable`}),(0,R.jsxs)(mo,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsx)(`span`,{children:o.error instanceof Error?o.error.message:`Failed to load events.`}),(0,R.jsx)(W,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{o.refetch()},children:`Retry`})]})]}),!o.isLoading&&!o.isError&&c.length===0&&(0,R.jsx)(`p`,{"data-testid":`events-empty`,className:`m-0 font-mono text-[12px] text-muted-foreground`,children:`No events match the current filters.`}),c.length>0&&(0,R.jsx)(`div`,{"data-testid":`events-list`,className:`overflow-x-auto`,children:(0,R.jsxs)($h,{children:[(0,R.jsx)(eg,{children:(0,R.jsxs)(rg,{className:`hover:bg-transparent`,children:[(0,R.jsx)(ig,{children:`Time`}),(0,R.jsx)(ig,{children:`Kind`}),(0,R.jsx)(ig,{children:`Subject`}),(0,R.jsx)(ig,{children:`Outcome`}),(0,R.jsx)(ig,{children:`Tx`}),(0,R.jsx)(ig,{className:`w-8`})]})}),(0,R.jsx)(tg,{children:c.map(e=>{let t=Ig(e.kind);return(0,R.jsxs)(rg,{"data-testid":`events-row`,children:[(0,R.jsx)(ag,{className:`whitespace-nowrap text-muted-foreground`,children:zg(e.ts)}),(0,R.jsx)(ag,{children:(0,R.jsx)(q,{variant:Lg(e.kind,e.outcome),children:t.label})}),(0,R.jsx)(ag,{className:`max-w-[280px] font-mono text-[12px]`,children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`span`,{className:U(e.requestId&&`cursor-help`),children:e.requestId?Bg(e.requestId):Vg(e)})}),e.requestId&&(0,R.jsx)(nd,{children:e.requestId})]})}),(0,R.jsx)(ag,{children:(0,R.jsx)(q,{variant:Lg(e.kind,e.outcome),children:e.outcome??`-`})}),(0,R.jsx)(ag,{className:`font-mono text-[12px] text-muted-foreground`,children:e.txHash?Bg(e.txHash,6,4):`-`}),(0,R.jsx)(ag,{className:`text-right`,children:(0,R.jsx)(W,{asChild:!0,variant:`ghost`,size:`icon`,"aria-label":`Inspect event ${e.id}`,children:(0,R.jsx)($t,{href:`/events/${e.id}`,"data-testid":`events-row-link`,children:(0,R.jsx)(Sn,{"aria-hidden":`true`})})})})]},e.id)})})]})}),o.hasNextPage&&(0,R.jsxs)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`events-load-more`,disabled:o.isFetchingNextPage,onClick:()=>{o.fetchNextPage()},className:`self-start`,children:[o.isFetchingNextPage&&(0,R.jsx)(Nn,{className:`animate-spin`,"aria-hidden":`true`}),o.isFetchingNextPage?`Loading`:`Load more`]})]})]})]})}function Wg(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toISOString().replace(`T`,` `).slice(0,19)} UTC`}function Gg(e){return e===`base`?`https://basescan.org`:`https://sepolia.basescan.org`}function Kg({label:e,children:t}){return(0,R.jsxs)(`div`,{className:`grid gap-1 py-2 sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-4`,children:[(0,R.jsx)(`dt`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:e}),(0,R.jsx)(`dd`,{className:`m-0 break-all font-mono text-[12px] text-foreground`,children:t})]})}function qg(){let e=Wt().id??``,{data:t}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap()}),{data:n,isLoading:r,isError:i,error:a,refetch:o}=ut({queryKey:[`activity-events`,`detail`,e],queryFn:()=>B.getActivityEvent(e),enabled:e.length>0}),s=n?Ig(n.kind):null,c=Gg(t?.chain);return(0,R.jsxs)(`main`,{"data-testid":`event-detail`,className:`mx-auto flex w-full max-w-4xl flex-col gap-5 p-6`,children:[(0,R.jsxs)(`header`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(`h1`,{className:`m-0 font-serif text-[32px] font-normal leading-tight text-foreground`,children:s?s.label:`Event`}),(0,R.jsxs)(`p`,{className:`m-0 font-mono text-[12px] text-muted-foreground`,children:[`Event `,e]})]}),(0,R.jsx)(W,{asChild:!0,variant:`secondary`,size:`sm`,children:(0,R.jsxs)($t,{href:`/events`,"data-testid":`event-detail-back`,children:[(0,R.jsx)(yn,{"aria-hidden":`true`}),`Events`]})})]}),r&&(0,R.jsxs)(`div`,{"data-testid":`event-detail-loading`,className:`flex items-center gap-2 font-mono text-[12px] text-muted-foreground`,children:[(0,R.jsx)(Nn,{className:`animate-spin`,"aria-hidden":`true`}),`Loading event`]}),i&&(0,R.jsxs)(fo,{variant:`blocking`,"data-testid":`event-detail-error`,children:[(0,R.jsx)(po,{children:`Event unavailable`}),(0,R.jsxs)(mo,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsx)(`span`,{children:a?.status===404?`This event could not be found.`:a instanceof Error?a.message:`Failed to load this event.`}),(0,R.jsx)(W,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{o()},children:`Retry`})]})]}),n&&s&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(G,{"data-testid":`event-detail-summary`,children:[(0,R.jsxs)(zi,{children:[(0,R.jsx)(Bi,{children:`Summary`}),(0,R.jsx)(Vi,{children:s.description})]}),(0,R.jsxs)(Hi,{className:`flex flex-wrap gap-2`,children:[(0,R.jsx)(q,{variant:Lg(n.kind,n.outcome),children:n.outcome??`-`}),(0,R.jsx)(q,{variant:`outline`,children:Wg(n.ts)})]})]}),(0,R.jsxs)(G,{"data-testid":`event-detail-payload`,children:[(0,R.jsxs)(zi,{children:[(0,R.jsx)(Bi,{children:`Details`}),(0,R.jsx)(Vi,{children:`Raw event fields from the persistent activity log.`})]}),(0,R.jsx)(Hi,{children:(0,R.jsxs)(`dl`,{className:`m-0`,children:[(0,R.jsx)(Kg,{label:`Event id`,children:n.id}),(0,R.jsx)(Ah,{}),(0,R.jsx)(Kg,{label:`Kind`,children:n.kind}),(0,R.jsx)(Ah,{}),(0,R.jsx)(Kg,{label:`Request id`,children:n.requestId??`-`}),(0,R.jsx)(Ah,{}),(0,R.jsx)(Kg,{label:`Service index`,children:n.serviceIndex===null?`-`:n.serviceIndex}),(0,R.jsx)(Ah,{}),(0,R.jsx)(Kg,{label:`Solver type`,children:n.solverType??`-`}),(0,R.jsx)(Ah,{}),(0,R.jsx)(Kg,{label:`Transaction`,children:n.txHash?(0,R.jsx)(W,{asChild:!0,variant:`link`,size:`sm`,className:`h-auto justify-start p-0 font-mono text-[12px] normal-case tracking-normal`,children:(0,R.jsxs)(`a`,{"data-testid":`event-detail-tx-link`,href:`${c}/tx/${n.txHash}`,target:`_blank`,rel:`noreferrer`,children:[n.txHash,(0,R.jsx)(kn,{"aria-hidden":`true`})]})}):`-`}),(0,R.jsx)(Ah,{}),(0,R.jsx)(Kg,{label:`Detail`,children:n.detail??`-`})]})})]})]})]})}function Jg(e,t){let n=e??[];return n.includes(t)?n:[...n,t]}function Yg(e){if(!e||!/^\d+$/.test(e))return`—`;try{let t=BigInt(e);return t===0n?`0 ETH`:t>=100000000000000n?`${Xg(t,18,t>=1000000000000000000n?4:6)} ETH`:t>=1000000000n?`${Xg(t,9,4)} gwei`:`${t.toLocaleString()} wei`}catch{return`—`}}function Xg(e,t,n){let r=10n**BigInt(t),i=e/r,a=e%r;if(a===0n||n===0)return i.toString();let o=a.toString().padStart(t,`0`).slice(0,n).replace(/0+$/,``);return o?`${i}.${o}`:i.toString()}function Zg(e){let t=e.trim();if(t.length===0)return null;if(!/^\d+$/.test(t))throw Error(`not a non-negative integer`);return BigInt(t)}var Qg={launching:{variant:`default`,label:`Launching`},launched:{variant:`success`,label:`Launched`},paused:{variant:`pill`,label:`Paused`},retired:{variant:`outline`,label:`Retired`},failed:{variant:`destructive`,label:`Failed`}};function $g(e){return e.length<=16?e:`${e.slice(0,8)}…${e.slice(-6)}`}function e_(e){try{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().replace(`T`,` `).slice(0,16)+` UTC`}catch{return e}}function t_({status:e}){let t=Qg[e]??Qg.launching;return(0,R.jsx)(q,{variant:t.variant,className:`whitespace-nowrap`,children:t.label})}function n_({postCounts:e,loading:t,error:n}){let r;return r=n?(0,R.jsx)(`span`,{className:`text-[var(--wane)]`,children:`posts unavailable`}):t&&!e?(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`…`}):!e||e.h24===0?(0,R.jsx)(`span`,{className:`text-[var(--fg-dim)]`,children:`No recent posts`}):(0,R.jsxs)(`span`,{className:`text-[var(--fg-muted)]`,children:[e.h1,` · `,e.h6,` · `,e.h24]}),(0,R.jsxs)(`div`,{"data-testid":`launcher-owned-row-postcounts`,className:`flex flex-col items-end gap-0.5 font-mono text-[12px]`,children:[(0,R.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:`recent posts (1h · 6h · 24h)`}),r]})}function r_({label:e}){return(0,R.jsx)(q,{"data-testid":`launcher-owned-row-role`,variant:`outline`,className:`normal-case tracking-[0.12em] text-[var(--fg-muted)]`,children:e})}function i_({record:e,postCounts:t,postCountsLoading:n,postCountsError:r}){let[,i]=Kt(),a=`/launcher/launched/${encodeURIComponent(e.solverNetId)}`,o=e.summary,s=o?.name??e.solverNetId,c=o===void 0?null:`${o.contractId}.${o.contractVersion}`;return(0,R.jsx)(`a`,{href:a,"data-testid":`launcher-owned-row`,"data-solvernet-id":e.solverNetId,"data-has-summary":o===void 0?`false`:`true`,onClick:e=>{e.preventDefault(),i(a)},className:`block text-inherit no-underline`,children:(0,R.jsxs)(G,{className:U(`grid grid-cols-[1fr_auto] items-center gap-4 p-4`,`transition-colors hover:bg-[var(--bg-sunken)]/40 cursor-pointer`),children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,R.jsx)(`div`,{"data-testid":`launcher-owned-row-primary`,className:U(`truncate text-foreground`,o===void 0?`font-mono text-[14px] font-medium`:`font-serif text-[18px] font-normal tracking-[-0.01em]`),children:s}),c!==null&&(0,R.jsx)(`div`,{"data-testid":`launcher-owned-row-contract`,className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:c}),o!==void 0&&(0,R.jsxs)(`div`,{"data-testid":`launcher-owned-row-prices`,className:`flex flex-wrap gap-x-3.5 font-mono text-[12px] text-[var(--fg-muted)]`,children:[(0,R.jsxs)(`span`,{children:[`solution `,Yg(o.solutionPriceWei)]}),(0,R.jsxs)(`span`,{children:[`verdict `,Yg(o.verdictPriceWei)]})]}),o!==void 0&&o.openRoles.length>0&&(0,R.jsx)(`div`,{"data-testid":`launcher-owned-row-roles`,className:`flex flex-wrap gap-1.5`,children:o.openRoles.map(e=>(0,R.jsx)(r_,{label:e},e))}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-x-3.5 font-mono text-[12px] text-[var(--fg-muted)]`,children:[(0,R.jsxs)(`span`,{children:[`cid `,$g(e.manifestCid)]}),(0,R.jsxs)(`span`,{children:[`launched `,e_(e.launchedAt)]})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-col items-end gap-2`,children:[(0,R.jsx)(t_,{status:e.status}),(0,R.jsx)(n_,{postCounts:t,loading:n,error:r})]})]})})}function a_(){return(0,R.jsxs)(G,{"data-testid":`launcher-empty-state`,className:`flex flex-col gap-3.5 p-8`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-mono text-[18px] font-medium tracking-[-0.01em] text-foreground`,children:`No SolverNets created yet.`}),(0,R.jsx)(`p`,{className:`m-0 text-[14px] leading-relaxed text-[var(--fg-muted)]`,children:`Create a SolverNet to direct operators toward a specific kind of knowledge work.`}),(0,R.jsx)(`div`,{children:(0,R.jsx)(W,{asChild:!0,variant:`default`,size:`lg`,children:(0,R.jsx)($t,{href:`/launcher/create`,children:`Create SolverNet`})})})]})}function o_(){let{data:e,isLoading:t,isError:n,error:r,refetch:i}=ut({queryKey:[`solvernets`,`launched`,`owned`],queryFn:()=>B.solvernets.listLaunched(),refetchInterval:3e4}),a=(e?.records??[]).map(e=>e.manifestCid),o=ut({queryKey:[`discovery`,`task-post-counts`,`launcher`,a],queryFn:()=>B.discovery.getTaskPostCounts(a),enabled:a.length>0,refetchInterval:3e4}),s=o.data?.byCid;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-4 p-6`,children:[(0,R.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,R.jsx)(`h1`,{className:`m-0 font-serif text-[32px] font-normal text-foreground`,children:`Your SolverNets`}),(e?.records.length??0)>0&&(0,R.jsx)(W,{asChild:!0,variant:`default`,"data-testid":`launcher-create-cta`,children:(0,R.jsx)($t,{href:`/launcher/create`,children:`Create SolverNet`})})]}),t&&(0,R.jsx)(`p`,{"data-testid":`launcher-loading`,className:`m-0 font-mono text-[13px] text-[var(--fg-muted)]`,children:`Loading…`}),n&&(0,R.jsxs)(fo,{"data-testid":`launcher-error`,variant:`blocking`,className:`flex items-center justify-between gap-4 border-l-0 border border-destructive p-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(po,{className:`font-mono text-[13px] font-medium text-destructive`,children:`Failed to load your SolverNets.`}),(0,R.jsx)(mo,{className:`text-[12px] text-[var(--fg-muted)]`,children:r instanceof Error?r.message:`Unknown error`})]}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>{i()},children:`Retry`})]}),!t&&!n&&e&&e.records.length===0&&(0,R.jsx)(a_,{}),!t&&!n&&e&&e.records.length>0&&(0,R.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.records.map(e=>(0,R.jsx)(i_,{record:e,postCounts:s?.[e.manifestCid],postCountsLoading:o.isLoading,postCountsError:o.isError},e.solverNetId))})]})}var s_=L.forwardRef(({className:e,type:t,...n},r)=>(0,R.jsx)(`input`,{type:t,ref:r,className:U(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 font-mono text-[13px] text-foreground transition-colors`,`placeholder:text-[var(--fg-dim)]`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,e),...n}));s_.displayName=`Input`;function c_({current:e,total:t=5}){return(0,R.jsxs)(`div`,{"data-testid":`launcher-create-progress`,className:`flex items-center gap-3 font-mono text-[11px] uppercase tracking-[0.14em] text-fg-muted`,children:[(0,R.jsxs)(`span`,{"data-testid":`launcher-create-step-counter`,children:[`Step `,e,` of `,t]}),(0,R.jsx)(`div`,{className:`flex max-w-[320px] flex-1 gap-1`,children:Array.from({length:t}).map((t,n)=>{let r=n+1,i=r<=e;return(0,R.jsx)(`span`,{"data-testid":`launcher-create-progress-pip-${r}`,"data-filled":i?`true`:`false`,className:U(`h-[3px] flex-1 rounded-sm`,i?`bg-accent-sky`:`bg-border`)},r)})})]})}function l_({step:e,total:t=5,title:n,blurb:r,children:i,footer:a,error:o}){return(0,R.jsxs)(`main`,{"data-testid":`launcher-create-step-${e}`,className:`mx-auto flex max-w-[720px] flex-col gap-5 p-6`,children:[(0,R.jsx)(c_,{current:e,total:t}),(0,R.jsxs)(`header`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(`h1`,{className:`m-0 font-serif text-[32px] font-normal leading-tight tracking-[-0.01em] text-foreground`,children:n}),r&&(0,R.jsx)(`p`,{className:`m-0 text-[14px] leading-relaxed text-fg-muted`,children:r})]}),o&&(0,R.jsx)(fo,{variant:`blocking`,"data-testid":`launcher-create-error`,className:`font-mono text-[13px]`,children:(0,R.jsx)(mo,{children:o})}),(0,R.jsx)(`div`,{className:`flex flex-col gap-4`,children:i}),(0,R.jsx)(Ah,{}),(0,R.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:a})]})}function u_({onBack:e,onNext:t,nextLabel:n=`Next`,nextDisabled:r=!1,busy:i=!1,right:a}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{children:e&&(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`lg`,"data-testid":`launcher-create-back`,onClick:e,disabled:i,children:`Back`})}),(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,t&&(0,R.jsx)(W,{type:`button`,size:`lg`,"data-testid":`launcher-create-next`,onClick:t,disabled:r||i,children:n})]})]})}function d_({label:e,helperText:t,error:n,children:r,asLabel:i=!0}){let a=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Kf,{children:e}),r,n?(0,R.jsx)(`span`,{className:`font-mono text-[12px] text-break-red`,children:n}):t&&(0,R.jsx)(`span`,{className:`font-mono text-[11px] text-fg-dim`,children:t})]});return i?(0,R.jsx)(`label`,{className:`flex flex-col gap-1.5`,children:a}):(0,R.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:a})}var f_=`flex w-full rounded-md border border-input bg-transparent px-3 py-2 font-mono text-[13px] text-foreground placeholder:text-fg-dim focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`;function p_({draft:e,onAdvance:t,busy:n,error:r}){let[i,a]=(0,L.useState)(e.name??``),[o,s]=(0,L.useState)(e.description??``),[c,l]=(0,L.useState)(!1),u=c&&i.trim().length===0?`Name is required.`:null,d=c&&o.trim().length===0?`Description is required.`:null,f=async n=>{n?.preventDefault(),l(!0),!(i.trim().length===0||o.trim().length===0)&&await t({name:i.trim(),description:o.trim(),completedSteps:Jg(e.completedSteps,`define`)})};return(0,R.jsx)(l_,{step:1,title:`Name your SolverNet`,blurb:`Pick a short, recognisable name and describe what kind of knowledge work this SolverNet directs operators toward.`,error:r,footer:(0,R.jsx)(u_,{onNext:()=>{f()},nextDisabled:i.trim().length===0||o.trim().length===0,busy:n}),children:(0,R.jsxs)(`form`,{onSubmit:e=>{f(e)},className:`flex flex-col gap-4`,children:[(0,R.jsx)(d_,{label:`Name`,error:u,helperText:`Shown in the registry catalog and the operator opt-in cards.`,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-name`,type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. Polymarket forecasts`,className:U(u&&`border-break-red`),disabled:n})}),(0,R.jsx)(d_,{label:`Description`,error:d,helperText:`One or two sentences. Operators read this when deciding whether to opt in.`,children:(0,R.jsx)(`textarea`,{"data-testid":`launcher-create-description`,value:o,onChange:e=>s(e.target.value),rows:4,placeholder:`Forecast resolved Polymarket outcomes; rewarded by Brier score on verified resolutions.`,className:U(f_,`min-h-[96px] resize-y`,d&&`border-break-red`),disabled:n})}),(0,R.jsx)(W,{type:`submit`,className:`hidden`,"aria-hidden":!0,tabIndex:-1})]})})}var m_={id:`prediction`,version:`v1`,name:`Prediction`,description:`Forecast resolved outcomes. Solvers submit a probability for a binary market; evaluators score against the on-chain resolution using Brier loss.`,schemas:{task:{name:`prediction.v1 Task`,description:`A binary Polymarket market with resolution time, condition id, and orderbook snapshot.`},solution:{name:`prediction.v1 Solution`,description:`A scalar probability in [0, 1] that the market resolves YES.`},verdict:{name:`prediction.v1 Verdict`,description:`Brier-loss score derived from the solver probability and the resolved outcome.`}},evaluationFunction:{id:`prediction.brier-loss.v1`,deterministic:!0,inputs:[`prediction.v1 Task`,`prediction.v1 Solution`,`Polymarket/UMA resolution`],output:`prediction.v1 Verdict`},aggregationFunction:{id:`prediction.trailing-mean-brier-spread.v1`,deterministic:!0,inputs:[`SCORED prediction.v1 Verdicts`],output:`trailing mean brierSpread`,windowDays:84},claimPolicyDefaults:{mode:`parallel`,maxClaims:25,maxClaimsPerOperator:1,claimLeaseTtlSeconds:1800},credentialRequirements:{creator:[{id:`polymarket.public.market-data.read`,kind:`public-api`,required:!0,description:`Read public Polymarket market metadata and orderbook snapshots for Task creation.`}],solver:[],evaluator:[{id:`polymarket.public.resolution.read`,kind:`public-api`,required:!0,description:`Read public Polymarket/UMA final market state for resolution mapping.`}]},generatorDefaults:{cadenceMs:360*60*1e3,submissionWindowMs:360*60*1e3,maxNewRoundsPerPoll:25,maxNewRoundsPerDay:100,maxOpenRounds:250,minTimeToResolutionHours:24,maxTimeToResolutionHours:168,minLiquidityUsd:`10000`,minVolume24hUsd:`2500`,maxYesSpread:`0.10`,maxOrderbookAgeSeconds:60}},h_={id:`swe-rebench-v2`,version:`v1`,name:`SWE-rebench v2`,description:`Code-issue benchmark sourced from the nebius/SWE-rebench-leaderboard HuggingFace dataset. Solvers submit a patch; evaluators run the upstream eval.py harness inside the per-instance Docker image and emit a 0/1 Verdict against the FAIL_TO_PASS / PASS_TO_PASS tests.`,schemas:{task:{name:`swe-rebench-v2.v1 Task`,description:`A reference to a HuggingFace dataset row by (hf_dataset, hf_split, instance_id), plus repo + base_commit + language + problem statement.`},solution:{name:`swe-rebench-v2.v1 Solution`,description:`A unified diff patch (git-format), with optional self-reported cost. The trajectory blob is pinned daemon-side and referenced via the envelope, not the payload.`},verdict:{name:`swe-rebench-v2.v1 Verdict`,description:`Score 0 or 1 based on whether the patch passes the per-instance Docker test suite, plus passed_match flag and evaluator cost. The test log is pinned daemon-side and surfaced via the verdict-artifact metadata.`}},evaluationFunction:{id:`swe-rebench-v2.docker-test-suite.v1`,deterministic:!0,inputs:[`swe-rebench-v2.v1 Task`,`swe-rebench-v2.v1 Solution`,`per-instance Docker image`],output:`swe-rebench-v2.v1 Verdict`},aggregationFunction:{id:`swe-rebench-v2.multi-winrate.v1`,deterministic:!0,inputs:[`SCORED swe-rebench-v2.v1 Verdicts`],output:`mean / complexityWeighted / byLanguage / frontierResolved / parityTripRate`,windowDays:30},claimPolicyDefaults:{mode:`parallel`,maxClaims:5,maxClaimsPerOperator:5,claimLeaseTtlSeconds:3600},credentialRequirements:{creator:[{id:`huggingface.public.datasets-server.read`,kind:`public-api`,required:!0,description:`Read public HuggingFace dataset rows from the nebius/SWE-rebench-leaderboard splits.`}],solver:[],evaluator:[{id:`docker.local.run`,kind:`local-runtime`,required:!0,description:`Run per-instance Docker images that ship with the upstream eval.py harness.`},{id:`huggingface.public.datasets-server.read`,kind:`public-api`,required:!0,description:`Read the HF dataset row referenced by the Task to recover test_patch + FAIL_TO_PASS / PASS_TO_PASS.`}]},generatorDefaults:{N_target_successes:5,posting_window_ms:1440*60*1e3,post_batch_size:25,claimLeaseTtlSeconds:3600}},g_={"prediction.v1":m_,"swe-rebench-v2.v1":h_},__=`font-mono text-[11px] uppercase tracking-[0.14em] text-fg-dim`;function v_({draft:e,template:t=m_,onAdvance:n,onBack:r,busy:i,error:a}){return(0,R.jsx)(l_,{step:2,title:`Review contract`,blurb:`The contract defines the schemas, evaluation, and aggregation that this SolverNet will pin to its manifest.`,error:a,footer:(0,R.jsx)(u_,{onBack:r,onNext:()=>{n({templateContractId:t.id,templateContractVersion:t.version,completedSteps:Jg(e.completedSteps,`reviewContract`)})},busy:i}),children:(0,R.jsx)(G,{"data-testid":`launcher-create-template`,"data-template-id":`${t.id}.${t.version}`,children:(0,R.jsxs)(Hi,{className:`flex flex-col gap-4 p-6`,children:[(0,R.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:__,children:[t.id,`.`,t.version]}),(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[24px] font-normal text-foreground`,children:t.name}),(0,R.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed text-fg-muted`,children:t.description})]}),(0,R.jsxs)(y_,{title:`Schemas`,children:[(0,R.jsx)(b_,{label:`Task`,value:t.schemas.task.name,hint:t.schemas.task.description}),(0,R.jsx)(b_,{label:`Solution`,value:t.schemas.solution.name,hint:t.schemas.solution.description}),(0,R.jsx)(b_,{label:`Verdict`,value:t.schemas.verdict.name,hint:t.schemas.verdict.description})]}),(0,R.jsxs)(y_,{title:`Evaluation function`,children:[(0,R.jsx)(b_,{label:`Id`,value:t.evaluationFunction.id,mono:!0}),(0,R.jsx)(b_,{label:`Deterministic`,value:t.evaluationFunction.deterministic?`yes`:`no`}),(0,R.jsx)(b_,{label:`Inputs`,value:t.evaluationFunction.inputs.join(`, `)}),(0,R.jsx)(b_,{label:`Output`,value:t.evaluationFunction.output})]}),(0,R.jsxs)(y_,{title:`Aggregation function`,children:[(0,R.jsx)(b_,{label:`Id`,value:t.aggregationFunction.id,mono:!0}),(0,R.jsx)(b_,{label:`Window`,value:t.aggregationFunction.windowDays===void 0?`—`:`${t.aggregationFunction.windowDays} days`}),(0,R.jsx)(b_,{label:`Output`,value:t.aggregationFunction.output})]}),(0,R.jsxs)(y_,{title:`Claim policy defaults`,children:[(0,R.jsx)(b_,{label:`Mode`,value:t.claimPolicyDefaults.mode}),(0,R.jsx)(b_,{label:`Max claims`,value:String(t.claimPolicyDefaults.maxClaims)}),(0,R.jsx)(b_,{label:`Per operator`,value:String(t.claimPolicyDefaults.maxClaimsPerOperator)}),(0,R.jsx)(b_,{label:`Lease TTL`,value:`${t.claimPolicyDefaults.claimLeaseTtlSeconds}s`})]}),(0,R.jsxs)(y_,{title:`Credential requirements`,children:[(0,R.jsx)(x_,{role:`creator`,creds:t.credentialRequirements.creator}),(0,R.jsx)(x_,{role:`solver`,creds:t.credentialRequirements.solver}),(0,R.jsx)(x_,{role:`evaluator`,creds:t.credentialRequirements.evaluator})]})]})})})}function y_({title:e,children:t}){return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(Ah,{}),(0,R.jsx)(`h3`,{className:U(`m-0 pt-2 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-fg-muted`),children:e}),(0,R.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t})]})}function b_({label:e,value:t,hint:n,mono:r}){return(0,R.jsxs)(`div`,{className:`grid grid-cols-[140px_1fr] items-baseline gap-3`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] tracking-[0.06em] text-fg-dim`,children:e}),(0,R.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,R.jsx)(`span`,{className:U(`text-[13px] text-foreground`,r?`font-mono`:`font-sans`),children:t}),n&&(0,R.jsx)(`span`,{className:`font-mono text-[12px] leading-relaxed text-fg-muted`,children:n})]})]})}function x_({role:e,creds:t}){return(0,R.jsxs)(`div`,{"data-testid":`launcher-create-credentials-${e}`,className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(`div`,{className:`font-mono text-[11px] capitalize tracking-[0.06em] text-fg-dim`,children:e}),t.length===0?(0,R.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`None.`}):t.map(e=>(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5 font-mono text-[12px] leading-relaxed`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-accent-sky`,children:e.id}),(0,R.jsx)(q,{variant:`secondary`,children:e.kind}),e.required&&(0,R.jsx)(q,{variant:`warning`,children:`required`})]}),(0,R.jsx)(`div`,{className:`text-fg-muted`,children:e.description})]},e.id))]})}var S_=`flex w-full rounded-md border border-input bg-transparent px-3 py-2 font-mono text-[13px] text-foreground placeholder:text-fg-dim focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 resize-y`;function C_(e){let t=e.template??m_;switch(t.id){case`prediction`:return(0,R.jsx)(j_,{...e,template:t});case`swe-rebench-v2`:return(0,R.jsx)(P_,{...e,template:t});default:return(0,R.jsx)(l_,{step:3,title:`Configure generator`,blurb:`No generator form is registered for this template.`,error:e.error??null,footer:(0,R.jsx)(u_,{onBack:e.onBack,onNext:()=>{},nextDisabled:!0,busy:e.busy}),children:(0,R.jsx)(`div`,{"data-testid":`launcher-create-generator-unsupported`})})}}var w_=6e4;function T_(e,t){return typeof e==`number`&&Number.isFinite(e)?String(e):typeof e==`string`&&e.trim().length>0?e.trim():String(t)}function E_(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).join(`, `):``}function D_(e){let t=m_.generatorDefaults;return{cadenceMs:T_(e?.cadenceMs,t.cadenceMs),windowMs:T_(e?.windowMs??e?.submissionWindowMs,t.submissionWindowMs),resolveGapMs:T_(e?.resolveGapMs,3600*1e3),maxNewRoundsPerPoll:T_(e?.maxNewRoundsPerPoll,t.maxNewRoundsPerPoll),maxNewRoundsPerDay:T_(e?.maxNewRoundsPerDay,t.maxNewRoundsPerDay),maxOpenRounds:T_(e?.maxOpenRounds,t.maxOpenRounds),allowlistConditionIds:E_(e?.allowlistConditionIds),blocklistConditionIds:E_(e?.blocklistConditionIds)}}function O_(e){let t={},n=k_(e.cadenceMs);n===null?t.cadenceMs=`Must be a positive integer (ms).`:n<w_&&(t.cadenceMs=`Cadence must be at least ${w_/1e3}s.`);let r=k_(e.windowMs);r===null&&(t.windowMs=`Must be a positive integer (ms).`);let i=k_(e.resolveGapMs);i===null&&(t.resolveGapMs=`Must be a positive integer (ms).`);let a=k_(e.maxNewRoundsPerPoll);a===null&&(t.maxNewRoundsPerPoll=`Must be a positive integer.`);let o=k_(e.maxNewRoundsPerDay);o===null&&(t.maxNewRoundsPerDay=`Must be a positive integer.`);let s=k_(e.maxOpenRounds);return s===null&&(t.maxOpenRounds=`Must be a positive integer.`),Object.keys(t).length>0?{ok:!1,errors:t}:{ok:!0,errors:{},generatorConfig:{cadenceMs:n,windowMs:r,resolveGapMs:i,submissionWindowMs:r,maxNewRoundsPerPoll:a,maxNewRoundsPerDay:o,maxOpenRounds:s,allowlistConditionIds:A_(e.allowlistConditionIds),blocklistConditionIds:A_(e.blocklistConditionIds)}}}function k_(e){let t=e.trim();if(t.length===0||!/^\d+$/.test(t))return null;let n=Number(t);return!Number.isFinite(n)||n<=0?null:n}function A_(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function j_({draft:e,onAdvance:t,onBack:n,busy:r,error:i}){let[a,o]=(0,L.useState)((0,L.useMemo)(()=>D_(e.generatorConfig),[e.generatorConfig])),[s,c]=(0,L.useState)(!1),l=s?O_(a):{ok:!0,errors:{}},u=s?l.errors:{},d=()=>{c(!0);let n=O_(a);!n.ok||!n.generatorConfig||t({generatorConfig:n.generatorConfig,completedSteps:Jg(e.completedSteps,`configureGenerator`)})},f=(e,t)=>{o(n=>({...n,[e]:t}))};return(0,R.jsxs)(l_,{step:3,title:`Configure generator`,blurb:`The auto-generator polls Polymarket and posts Tasks while the SolverNet is launched. Defaults are tuned for a healthy idle SolverNet — adjust to match your appetite.`,error:i,footer:(0,R.jsx)(u_,{onBack:n,onNext:d,busy:r,nextDisabled:s&&!l.ok}),children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-1 gap-3.5 sm:grid-cols-2`,children:[(0,R.jsx)(d_,{label:`Cadence (ms)`,helperText:`How often the generator polls Polymarket. Minimum 60s.`,error:u.cadenceMs??null,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-cadenceMs`,type:`text`,inputMode:`numeric`,value:a.cadenceMs,onChange:e=>f(`cadenceMs`,e.target.value),className:U(u.cadenceMs&&`border-break-red`),disabled:r})}),(0,R.jsx)(d_,{label:`Submission window (ms)`,helperText:`How long Tasks stay open for solving.`,error:u.windowMs??null,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-windowMs`,type:`text`,inputMode:`numeric`,value:a.windowMs,onChange:e=>f(`windowMs`,e.target.value),className:U(u.windowMs&&`border-break-red`),disabled:r})}),(0,R.jsx)(d_,{label:`Resolve gap (ms)`,helperText:`Cushion between window-close and resolution.`,error:u.resolveGapMs??null,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-resolveGapMs`,type:`text`,inputMode:`numeric`,value:a.resolveGapMs,onChange:e=>f(`resolveGapMs`,e.target.value),className:U(u.resolveGapMs&&`border-break-red`),disabled:r})}),(0,R.jsx)(d_,{label:`Max rounds / poll`,helperText:`Cap on new Tasks per generator tick.`,error:u.maxNewRoundsPerPoll??null,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-maxNewRoundsPerPoll`,type:`text`,inputMode:`numeric`,value:a.maxNewRoundsPerPoll,onChange:e=>f(`maxNewRoundsPerPoll`,e.target.value),className:U(u.maxNewRoundsPerPoll&&`border-break-red`),disabled:r})}),(0,R.jsx)(d_,{label:`Max rounds / day`,helperText:`Daily ceiling across all polls.`,error:u.maxNewRoundsPerDay??null,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-maxNewRoundsPerDay`,type:`text`,inputMode:`numeric`,value:a.maxNewRoundsPerDay,onChange:e=>f(`maxNewRoundsPerDay`,e.target.value),className:U(u.maxNewRoundsPerDay&&`border-break-red`),disabled:r})}),(0,R.jsx)(d_,{label:`Max open rounds`,helperText:`Concurrent open Tasks before back-off kicks in.`,error:u.maxOpenRounds??null,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-maxOpenRounds`,type:`text`,inputMode:`numeric`,value:a.maxOpenRounds,onChange:e=>f(`maxOpenRounds`,e.target.value),className:U(u.maxOpenRounds&&`border-break-red`),disabled:r})})]}),(0,R.jsx)(d_,{label:`Allowlist condition ids`,helperText:`Comma-separated. If non-empty, only these markets are considered.`,children:(0,R.jsx)(`textarea`,{"data-testid":`launcher-create-allowlistConditionIds`,value:a.allowlistConditionIds,onChange:e=>f(`allowlistConditionIds`,e.target.value),rows:2,placeholder:`0xabc…, 0xdef…`,className:S_,disabled:r})}),(0,R.jsx)(d_,{label:`Blocklist condition ids`,helperText:`Comma-separated. Markets here are skipped, even if they pass the eligibility filters.`,children:(0,R.jsx)(`textarea`,{"data-testid":`launcher-create-blocklistConditionIds`,value:a.blocklistConditionIds,onChange:e=>f(`blocklistConditionIds`,e.target.value),rows:2,placeholder:`0xabc…`,className:S_,disabled:r})})]})}function M_(e){let t=h_.generatorDefaults,n=typeof e?.claimPolicy==`object`&&e.claimPolicy!==null?e.claimPolicy:{};return{N_target_successes:T_(e?.N_target_successes,t.N_target_successes),posting_window_ms:T_(e?.posting_window_ms,t.posting_window_ms),post_batch_size:T_(e?.post_batch_size,t.post_batch_size),maxClaimsPerOperator:T_(e?.maxClaimsPerOperator??n.maxClaimsPerOperator,t.maxClaimsPerOperator??t.N_target_successes),claimLeaseTtlSeconds:T_(e?.claimLeaseTtlSeconds??n.claimLeaseTtlSeconds,t.claimLeaseTtlSeconds)}}function N_(e){let t={},n=k_(e.N_target_successes);n===null&&(t.N_target_successes=`Must be a positive integer.`);let r=k_(e.posting_window_ms);r===null&&(t.posting_window_ms=`Must be a positive integer (ms).`);let i=k_(e.post_batch_size);i===null&&(t.post_batch_size=`Must be a positive integer.`);let a=k_(e.maxClaimsPerOperator);a===null&&(t.maxClaimsPerOperator=`Must be a positive integer.`);let o=k_(e.claimLeaseTtlSeconds);return o===null&&(t.claimLeaseTtlSeconds=`Must be a positive integer (seconds).`),Object.keys(t).length>0?{ok:!1,errors:t}:{ok:!0,errors:{},generatorConfig:{N_target_successes:n,posting_window_ms:r,post_batch_size:i,maxClaimsPerOperator:a,claimLeaseTtlSeconds:o}}}function P_({draft:e,onAdvance:t,onBack:n,busy:r,error:i}){let[a,o]=(0,L.useState)((0,L.useMemo)(()=>M_(e.generatorConfig),[e.generatorConfig])),[s,c]=(0,L.useState)(!1),l=s?N_(a):{ok:!0,errors:{}},u=s?l.errors:{},d=()=>{c(!0);let n=N_(a);!n.ok||!n.generatorConfig||t({generatorConfig:n.generatorConfig,completedSteps:Jg(e.completedSteps,`configureGenerator`)})},f=(e,t)=>{o(n=>({...n,[e]:t}))};return(0,R.jsx)(l_,{step:3,title:`Configure generator`,blurb:`The generator pulls SWE-rebench v2 instances from the HuggingFace pool and posts Tasks until enough successful Verdicts accumulate or the posting cap is hit.`,error:i,footer:(0,R.jsx)(u_,{onBack:n,onNext:d,busy:r,nextDisabled:s&&!l.ok}),children:(0,R.jsxs)(`div`,{className:`grid grid-cols-1 gap-3.5 sm:grid-cols-2`,children:[(0,R.jsx)(d_,{label:`Target successful Verdicts per instance`,helperText:`How many score=1 Verdicts saturate a SWE instance and stop further Task posting.`,error:u.N_target_successes??null,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-N_target_successes`,type:`text`,inputMode:`numeric`,value:a.N_target_successes,onChange:e=>f(`N_target_successes`,e.target.value),className:U(u.N_target_successes&&`border-break-red`),disabled:r})}),(0,R.jsx)(d_,{label:`Posting window (ms)`,helperText:`On-chain claim-window deadline for each posting. Reposts trigger on claim-budget exhaustion observed via the indexer, not this window.`,error:u.posting_window_ms??null,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-posting_window_ms`,type:`text`,inputMode:`numeric`,value:a.posting_window_ms,onChange:e=>f(`posting_window_ms`,e.target.value),className:U(u.posting_window_ms&&`border-break-red`),disabled:r})}),(0,R.jsx)(d_,{label:`Post batch size`,helperText:`Maximum number of SWE instances to post in one creator tick.`,error:u.post_batch_size??null,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-post_batch_size`,type:`text`,inputMode:`numeric`,value:a.post_batch_size,onChange:e=>f(`post_batch_size`,e.target.value),className:U(u.post_batch_size&&`border-break-red`),disabled:r})}),(0,R.jsx)(d_,{label:`Max claims per operator`,helperText:`Optional cap; each posting is still limited by remaining target successes.`,error:u.maxClaimsPerOperator??null,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-maxClaimsPerOperator`,type:`text`,inputMode:`numeric`,value:a.maxClaimsPerOperator,onChange:e=>f(`maxClaimsPerOperator`,e.target.value),className:U(u.maxClaimsPerOperator&&`border-break-red`),disabled:r})}),(0,R.jsx)(d_,{label:`Claim lease (seconds)`,helperText:`How long a claimed SWE task slot stays leased.`,error:u.claimLeaseTtlSeconds??null,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-claimLeaseTtlSeconds`,type:`text`,inputMode:`numeric`,value:a.claimLeaseTtlSeconds,onChange:e=>f(`claimLeaseTtlSeconds`,e.target.value),className:U(u.claimLeaseTtlSeconds&&`border-break-red`),disabled:r})})]})})}function F_(e,t){let n={},r,i;try{r=Zg(e),r===null?n.solutionPriceWei=`Required.`:r<0n&&(n.solutionPriceWei=`Must be non-negative.`)}catch{n.solutionPriceWei=`Must be a non-negative integer (wei).`,r=null}try{i=Zg(t),i===null?n.verdictPriceWei=`Required.`:i<0n&&(n.verdictPriceWei=`Must be non-negative.`)}catch{n.verdictPriceWei=`Must be a non-negative integer (wei).`,i=null}return r!==null&&i!==null&&!n.solutionPriceWei&&!n.verdictPriceWei&&r===0n&&i===0n&&(n.combined=`At least one price must be positive.`),{ok:Object.keys(n).length===0,errors:n,solutionWei:r??void 0,verdictWei:i??void 0}}function I_(e,t,n,r){if(!e||!/^\d+$/.test(e)||t===void 0||n===void 0)return null;let i;try{i=BigInt(e)}catch{return null}let a=t+n*BigInt(r);return a<=0n?null:{tasks:Number(i/a),perTaskWei:a}}function L_({draft:e,template:t=m_,onAdvance:n,onBack:r,fundingSafeAddress:i,fundingSafeBalanceWei:a,busy:o,error:s}){let[c,l]=(0,L.useState)(e.solutionPriceWei??``),[u,d]=(0,L.useState)(e.verdictPriceWei??``),[f,p]=(0,L.useState)(!1),m=(0,L.useMemo)(()=>F_(c,u),[c,u]),h=t.claimPolicyDefaults.maxClaimsPerOperator,g=(0,L.useMemo)(()=>I_(a??null,m.solutionWei,m.verdictWei,h),[a,m.solutionWei,m.verdictWei,h]),_=()=>{p(!0),m.ok&&n({solutionPriceWei:c,verdictPriceWei:u,completedSteps:Jg(e.completedSteps,`configurePricing`)})},v=f?m.errors:{};return(0,R.jsxs)(l_,{step:4,title:`Configure pricing`,blurb:`Set what each Task pays out. The funding Safe is your launcher's master Safe; pricing applies per claim and per verdict.`,error:s,footer:(0,R.jsx)(u_,{onBack:r,onNext:_,busy:o,nextDisabled:f&&!m.ok}),children:[(0,R.jsx)(d_,{label:`Funding Safe`,helperText:`Tasks are funded from this Safe at launch. Defaults to your launcher master Safe.`,asLabel:!1,children:(0,R.jsx)(`div`,{"data-testid":`launcher-create-fundingSafe`,className:`rounded-md border border-border bg-surface-sunken px-3 py-2.5 font-mono text-[13px] text-fg-muted break-all`,children:i??`— (master Safe will be picked at launch)`})}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 gap-3.5 sm:grid-cols-2`,children:[(0,R.jsx)(d_,{label:`Solution price (wei)`,helperText:`≈ ${Yg(m.solutionWei?.toString())}`,error:v.solutionPriceWei??null,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-solutionPriceWei`,type:`text`,inputMode:`numeric`,value:c,onChange:e=>l(e.target.value),placeholder:`e.g. 100000000000000 (0.0001 ETH)`,className:U(v.solutionPriceWei&&`border-break-red`),disabled:o})}),(0,R.jsx)(d_,{label:`Verdict price (wei)`,helperText:`≈ ${Yg(m.verdictWei?.toString())}`,error:v.verdictPriceWei??null,children:(0,R.jsx)(s_,{"data-testid":`launcher-create-verdictPriceWei`,type:`text`,inputMode:`numeric`,value:u,onChange:e=>d(e.target.value),placeholder:`e.g. 50000000000000 (0.00005 ETH)`,className:U(v.verdictPriceWei&&`border-break-red`),disabled:o})})]}),v.combined&&(0,R.jsx)(`div`,{"data-testid":`launcher-create-pricing-combined-error`,className:`font-mono text-[12px] text-break-red`,children:v.combined}),(0,R.jsx)(G,{"data-testid":`launcher-create-projection`,children:(0,R.jsxs)(Hi,{className:`flex flex-col gap-2.5 p-5`,children:[(0,R.jsx)(`h3`,{className:`m-0 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-fg-muted`,children:`Runway projection`}),(0,R.jsx)(Ah,{}),(0,R.jsx)(R_,{label:`Safe balance`,value:a?`${Yg(a)} (${a} wei)`:`—`}),(0,R.jsx)(R_,{label:`Per-Task cost`,value:g?`${Yg(g.perTaskWei.toString())} (${g.perTaskWei} wei)`:`—`,hint:`solution + verdict × maxClaimsPerOperator (${h})`}),(0,R.jsx)(R_,{label:`Projected Tasks`,value:g?`~${g.tasks.toLocaleString(`en-US`)}`:`—`,hint:`Approximate; ignores gas and any in-flight reservations.`,testId:`launcher-create-projected-tasks`})]})})]})}function R_({label:e,value:t,hint:n,testId:r}){return(0,R.jsxs)(`div`,{"data-testid":r,className:`grid grid-cols-[160px_1fr] items-baseline gap-3`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] tracking-[0.06em] text-fg-dim`,children:e}),(0,R.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[13px] text-foreground`,children:t}),n&&(0,R.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:n})]})]})}var z_=1500,B_=[`pinning`,`recording`,`broadcasting`,`confirming`,`spawning`],V_={pinning:`Pinning manifest`,recording:`Recording draft`,broadcasting:`Broadcasting tx`,confirming:`Confirming on-chain`,spawning:`Spawning generator`};function H_({draft:e,template:t=m_,onUpdateDraft:n,onBack:r,onLaunchFailure:i,navigateTo:a,pollIntervalMs:o=z_}){let[,s]=Kt(),c=a??s,[l,u]=(0,L.useState)((0,L.useMemo)(()=>e.openRoles&&e.openRoles.length>0?e.openRoles:[`solver`,`evaluator`],[e.openRoles])),[d,f]=(0,L.useState)({kind:`idle`}),p=(0,L.useRef)(!1);(0,L.useEffect)(()=>()=>{p.current=!0},[]);let m=e=>{u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},h=async()=>{if(l.length!==0){f(e=>e.kind===`failed`?{kind:`idle`}:e),p.current=!1;try{await n({openRoles:l,completedSteps:Jg(e.completedSteps,`configurePricing`)});let t=await B.solvernets.launch(e.draftId);if(p.current)return;let r=`pinning`;for(f({kind:`launching`,phase:r,solverNetId:t.solverNetId});;){if(p.current)return;let e;try{e=await B.solvernets.get(t.solverNetId)}catch{if(p.current)return;await $_(o);continue}if(e.launchProgress?.phase&&(r=e.launchProgress.phase),e.status===`launched`){f({kind:`launching`,phase:`spawning`,solverNetId:t.solverNetId}),c(`/launcher/launched/${encodeURIComponent(t.solverNetId)}`);return}if(e.status===`failed`){let n=e.launchProgress?.txError?.message??`Launch failed during ${r}.`;f({kind:`failed`,message:n,solverNetId:t.solverNetId}),i?.();return}f({kind:`launching`,phase:r,solverNetId:t.solverNetId}),await $_(o)}}catch(e){if(p.current)return;f({kind:`failed`,message:e instanceof Error?e.message:String(e)}),i?.()}}},g=d.kind===`launching`,_=l.length===0||g;return(0,R.jsxs)(l_,{step:5,title:`Review & launch`,blurb:`One last check. The Launch button signs the manifest, pins it to IPFS, and broadcasts the registry transaction.`,footer:(0,R.jsx)(u_,{onBack:r,onNext:()=>{h()},nextLabel:g?`Launching…`:`Launch`,nextDisabled:_,busy:g,right:g&&(0,R.jsx)(U_,{current:d.kind===`launching`?d.phase:`pinning`})}),children:[(0,R.jsx)(W_,{draft:e,template:t}),(0,R.jsxs)(d_,{label:`Open roles`,helperText:`Operators can opt in to any role you open here. Most launchers want both.`,asLabel:!1,children:[(0,R.jsxs)(`div`,{"data-testid":`launcher-create-openRoles`,className:`flex flex-col gap-2.5`,children:[(0,R.jsx)(Q_,{role:`solver`,checked:l.includes(`solver`),onChange:()=>m(`solver`),disabled:g}),(0,R.jsx)(Q_,{role:`evaluator`,checked:l.includes(`evaluator`),onChange:()=>m(`evaluator`),disabled:g})]}),l.length===0&&(0,R.jsx)(`span`,{"data-testid":`launcher-create-openRoles-error`,className:`font-mono text-[12px] text-break-red`,children:`At least one role must be open.`})]}),d.kind===`failed`&&(0,R.jsxs)(fo,{variant:`blocking`,"data-testid":`launcher-create-launch-failure`,children:[(0,R.jsx)(po,{className:`font-mono text-[13px] font-medium text-break-red`,children:`Launch failed.`}),(0,R.jsx)(mo,{className:`font-mono text-[12px] text-fg-muted`,children:d.message}),(0,R.jsxs)(`div`,{className:`mt-2.5 flex gap-2`,children:[(0,R.jsx)(W,{type:`button`,size:`sm`,"data-testid":`launcher-create-launch-retry`,onClick:()=>{h()},children:`Retry`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-create-launch-abandon`,onClick:()=>{c(`/launcher`)},children:`Abandon`})]})]})]})}function U_({current:e}){let t=B_.indexOf(e);return(0,R.jsxs)(`div`,{"data-testid":`launcher-create-launch-progress`,"data-phase":e,className:`flex items-center gap-1.5 font-mono text-[11px] tracking-[0.06em] text-fg-muted`,children:[(0,R.jsx)(`span`,{"data-testid":`launcher-create-launch-phase`,children:V_[e]}),(0,R.jsx)(`div`,{className:`flex gap-[3px]`,children:B_.map((e,n)=>(0,R.jsx)(`span`,{"data-testid":`launcher-create-launch-phase-pip-${e}`,"data-active":n<=t?`true`:`false`,className:U(`h-[3px] w-2 rounded-sm`,n<=t?`bg-accent-sky`:`bg-border`)},e))})]})}function W_({draft:e,template:t}){let n=e.generatorConfig??{};return(0,R.jsx)(G,{"data-testid":`launcher-create-manifest-summary`,children:(0,R.jsxs)(Hi,{className:`flex flex-col gap-3 p-6`,children:[(0,R.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-[11px] uppercase tracking-[0.14em] text-fg-dim`,children:[e.templateContractId??t.id,`.`,e.templateContractVersion??t.version]}),(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[24px] font-normal text-foreground`,children:e.name??`— unnamed`}),e.description&&(0,R.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed text-fg-muted`,children:e.description})]}),(0,R.jsx)(Ah,{}),(0,R.jsxs)(X_,{children:[(0,R.jsx)(Z_,{label:`Solution price`,value:q_(e.solutionPriceWei)}),(0,R.jsx)(Z_,{label:`Verdict price`,value:q_(e.verdictPriceWei)}),t.id===`prediction`?(0,R.jsx)(G_,{generator:n}):(0,R.jsx)(K_,{generator:n})]})]})})}function G_({generator:e}){let t=J_(e.cadenceMs),n=J_(e.windowMs??e.submissionWindowMs),r=J_(e.maxOpenRounds);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Z_,{label:`Cadence`,value:t?`${t} ms`:`—`}),(0,R.jsx)(Z_,{label:`Window`,value:n?`${n} ms`:`—`}),(0,R.jsx)(Z_,{label:`Max open rounds`,value:r??`—`}),(0,R.jsx)(Z_,{label:`Allowlist`,value:Y_(e.allowlistConditionIds)}),(0,R.jsx)(Z_,{label:`Blocklist`,value:Y_(e.blocklistConditionIds)})]})}function K_({generator:e}){let t=J_(e.N_target_successes),n=J_(e.posting_window_ms),r=J_(e.post_batch_size);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Z_,{label:`Target successes`,value:t??`—`}),(0,R.jsx)(Z_,{label:`Posting window`,value:n?`${n} ms`:`—`}),(0,R.jsx)(Z_,{label:`Batch size`,value:r??`—`})]})}function q_(e){return e?`${e} wei (${Yg(e)})`:`—`}function J_(e){return typeof e==`number`&&Number.isFinite(e)?String(e):typeof e==`string`&&/^\d+$/.test(e.trim())?e.trim():null}function Y_(e){return Array.isArray(e)&&e.length>0?`${e.length} entries`:`none`}function X_({children:e}){return(0,R.jsx)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-2 sm:grid-cols-2`,children:e})}function Z_({label:e,value:t}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.12em] text-fg-dim`,children:e}),(0,R.jsx)(`span`,{className:`font-mono text-[13px] text-foreground`,children:t})]})}function Q_({role:e,checked:t,onChange:n,disabled:r}){return(0,R.jsxs)(`label`,{className:U(`flex items-center gap-2.5`,r?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,R.jsx)(`input`,{"data-testid":`launcher-create-openRoles-${e}`,type:`checkbox`,checked:t,onChange:n,disabled:r,className:`h-4 w-4 cursor-pointer accent-accent-sky`}),(0,R.jsx)(`span`,{className:`font-mono text-[13px] text-foreground`,children:e})]})}function $_(e){return new Promise(t=>setTimeout(t,e))}var ev=`jinn.launcher-create.draftId.v1`;function tv(){if(typeof window>`u`)return null;try{return window.localStorage.getItem(ev)}catch{return null}}function nv(e){if(!(typeof window>`u`))try{e===null?window.localStorage.removeItem(ev):window.localStorage.setItem(ev,e)}catch{}}function rv(){if(typeof window>`u`)return null;let e=new URLSearchParams(window.location.search).get(`template`);return e&&e.length>0?e:null}function iv({templateKey:e}={}){let t=e??rv()??`prediction.v1`,n=(0,L.useMemo)(()=>g_[t]??null,[t]),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(1),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null),p=(0,L.useRef)(!1),{data:m}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap(),refetchInterval:3e4}),{data:h}=ut({queryKey:[`status`],queryFn:()=>B.getStatus(),refetchInterval:3e4}),g=m?.master_address??h?.master_address??null,_=h?.masterGas?.balanceWei??null;(0,L.useEffect)(()=>{if(p.current)return;p.current=!0;let e=!1;return(async()=>{let t=tv();if(t)try{let n=await B.solvernets.getDraft(t);if(e)return;i(n);return}catch{nv(null)}try{let t=await B.solvernets.createDraft();if(e)return;nv(t.draftId),i(t)}catch(t){if(e)return;o(t instanceof Error?t.message:`Failed to create draft.`)}})(),()=>{e=!0}},[]);let v=async e=>{if(r){u(!0),f(null);try{let t=await B.solvernets.updateDraft(r.draftId,e);i(t),c(e=>e<5?e+1:e)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},y=async e=>{if(r){u(!0),f(null);try{let t=await B.solvernets.updateDraft(r.draftId,e);i(t)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},b=()=>{f(null),c(e=>e>1?e-1:e)},x=()=>{f(null)};if(n===null)return(0,R.jsxs)(`main`,{"data-testid":`launcher-create-unknown-template`,"data-template-key":t,className:`mx-auto flex max-w-[720px] flex-col gap-4 p-6`,children:[(0,R.jsx)(`h1`,{className:`m-0 font-serif text-[28px] font-normal text-foreground`,children:`Unknown SolverNet template`}),(0,R.jsx)(fo,{variant:`blocking`,children:(0,R.jsxs)(mo,{className:`font-mono text-[13px]`,children:[`No template registered for `,(0,R.jsx)(`code`,{children:t}),`. Available keys:`,` `,Object.keys(g_).map(e=>`?template=${e}`).join(`, `),`.`]})})]});if(a)return(0,R.jsxs)(`main`,{"data-testid":`launcher-create-bootstrap-error`,className:`mx-auto flex max-w-[720px] flex-col gap-4 p-6`,children:[(0,R.jsx)(`h1`,{className:`m-0 font-serif text-[28px] font-normal text-foreground`,children:`Couldn't start a new draft`}),(0,R.jsxs)(fo,{variant:`blocking`,children:[(0,R.jsx)(po,{className:`font-mono text-[12px]`,children:`Bootstrap error`}),(0,R.jsx)(mo,{className:`font-mono text-[13px]`,children:a})]})]});if(!r)return(0,R.jsx)(`main`,{"data-testid":`launcher-create-loading`,className:`p-6 font-mono text-[13px] text-fg-muted`,children:`Loading draft…`});switch(s){case 1:return(0,R.jsx)(p_,{draft:r,onAdvance:v,busy:l,error:d});case 2:return(0,R.jsx)(v_,{draft:r,template:n,onAdvance:v,onBack:b,busy:l,error:d});case 3:return(0,R.jsx)(C_,{draft:r,template:n,onAdvance:v,onBack:b,busy:l,error:d});case 4:return(0,R.jsx)(L_,{draft:r,template:n,onAdvance:v,onBack:b,fundingSafeAddress:g,fundingSafeBalanceWei:_??null,busy:l,error:d});case 5:return(0,R.jsx)(H_,{draft:r,template:n,onUpdateDraft:y,onBack:b,onLaunchFailure:x});default:return(0,R.jsx)(p_,{draft:r,onAdvance:v,busy:l,error:d})}}function av(e){return e?e.length<=16?e:`${e.slice(0,8)}…${e.slice(-6)}`:``}function ov(e){return e?e.length<=12?e:`${e.slice(0,6)}…${e.slice(-4)}`:``}function sv(e){if(!e)return`—`;try{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().replace(`T`,` `).slice(0,16)+` UTC`}catch{return e}}var cv={launched:[`paused`,`retired`],paused:[`launched`,`retired`]};function lv(e,t,n){let r=10n**BigInt(t),i=e/r,a=e%r;if(a===0n||n===0)return i.toString();let o=a.toString().padStart(t,`0`).slice(0,n).replace(/0+$/,``);return o?`${i}.${o}`:i.toString()}function uv(e){if(!e||!/^\d+$/.test(e))return`—`;try{let t=BigInt(e);return t===0n?`0 ETH`:t>=100000000000000n?`${lv(t,18,t>=1000000000000000000n?4:6)} ETH`:t>=1000000000n?`${lv(t,9,4)} gwei`:`${t.toLocaleString()} wei`}catch{return`—`}}var dv=175000n*11500000n;function fv(e,t,n,r=dv){if(!e||!/^\d+$/.test(e)||!t||!/^\d+$/.test(t)||!n||!/^\d+$/.test(n))return null;let i;try{i=BigInt(e)}catch{return null}let a=BigInt(t)+BigInt(n)+r;if(a<=0n)return null;let o=Number(i/a);return{tasks:o,perTaskWei:a,lowRunway:o<100}}var pv=6e4;function mv(e){let t=e??{};return{cadenceMs:_v(t.cadenceMs),windowMs:_v(t.windowMs??t.submissionWindowMs),resolveGapMs:_v(t.resolveGapMs),maxNewRoundsPerPoll:_v(t.maxNewRoundsPerPoll),maxNewRoundsPerDay:_v(t.maxNewRoundsPerDay),maxOpenRounds:_v(t.maxOpenRounds),allowlistConditionIds:vv(t.allowlistConditionIds),blocklistConditionIds:vv(t.blocklistConditionIds)}}function hv(e,t){let n=e??{},r=gv(n.claimPolicy),i=t?.contract.claimPolicyDefaults??{maxClaims:5,maxClaimsPerOperator:5,claimLeaseTtlSeconds:3600};return{N_target_successes:_v(n.N_target_successes),posting_window_ms:_v(n.posting_window_ms),post_batch_size:_v(n.post_batch_size),maxClaimsPerOperator:_v(n.maxClaimsPerOperator??r.maxClaimsPerOperator??i.maxClaimsPerOperator),claimLeaseTtlSeconds:_v(n.claimLeaseTtlSeconds??r.claimLeaseTtlSeconds??i.claimLeaseTtlSeconds)}}function gv(e){return typeof e==`object`&&e?e:{}}function _v(e){return typeof e==`number`&&Number.isFinite(e)?String(e):typeof e==`string`&&e.trim().length>0?e.trim():``}function vv(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).join(`, `):``}function yv(e){let t=e.trim();if(!t||!/^\d+$/.test(t))return null;let n=Number(t);return!Number.isFinite(n)||n<=0?null:n}function bv(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function xv(e,t){let n={},r={};for(let i of[`cadenceMs`,`windowMs`,`resolveGapMs`,`maxNewRoundsPerPoll`,`maxNewRoundsPerDay`,`maxOpenRounds`]){if(e[i]===t[i]||e[i].trim().length===0)continue;let a=yv(e[i]);if(a===null){n[i]=`Must be a positive integer.`;continue}if(i===`cadenceMs`&&a<pv){n[i]=`Cadence must be at least ${pv/1e3}s.`;continue}i===`windowMs`?r.submissionWindowMs=a:r[i]=a}for(let n of[`allowlistConditionIds`,`blocklistConditionIds`])e[n]!==t[n]&&(r[n]=bv(e[n]));return{ok:Object.keys(n).length===0,patch:r,errors:n}}function Sv(e,t){let n={},r={};for(let i of[`N_target_successes`,`posting_window_ms`,`post_batch_size`,`maxClaimsPerOperator`,`claimLeaseTtlSeconds`]){if(e[i]===t[i]||e[i].trim().length===0)continue;let a=yv(e[i]);if(a===null){n[i]=i===`posting_window_ms`?`Must be a positive integer (ms).`:i===`claimLeaseTtlSeconds`?`Must be a positive integer (seconds).`:`Must be a positive integer.`;continue}r[i]=a}return{ok:Object.keys(n).length===0,patch:r,errors:n}}function Cv(e,t){if(t)return t.id===`swe-rebench-v2`&&t.version===`v1`;if(e.summary?.contractId===`swe-rebench-v2`&&e.summary.contractVersion===`v1`)return!0;let n=e.generatorConfig??{};return Object.prototype.hasOwnProperty.call(n,`N_target_successes`)||Object.prototype.hasOwnProperty.call(n,`N_max_postings_per_task`)||Object.prototype.hasOwnProperty.call(n,`posting_window_ms`)||Object.prototype.hasOwnProperty.call(n,`cooldown_ms`)}function wv({record:e,manifest:t,template:n,onSave:r}){return Cv(e,n)?(0,R.jsx)(Dv,{record:e,manifest:t,onSave:r}):(0,R.jsx)(Ev,{record:e,onSave:r})}function Tv({record:e,configExpanded:t,setConfigExpanded:n,children:r}){return(0,R.jsxs)(G,{"data-testid":`launcher-launched-generator-panel`,role:`region`,"aria-label":`Generator`,className:`flex flex-col gap-4 p-6`,children:[(0,R.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[22px] font-normal text-foreground`,children:`Generator`}),(0,R.jsx)(Nv,{record:e})]}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-launched-generator-toggle`,"aria-expanded":t,"aria-controls":`launcher-launched-generator-config`,onClick:()=>n(e=>!e),children:t?`Hide config`:`Edit config`})]}),(0,R.jsxs)(`dl`,{className:`m-0 grid gap-y-2 gap-x-4 [grid-template-columns:repeat(auto-fit,minmax(180px,1fr))]`,children:[(0,R.jsx)(Lv,{label:`Last poll`,value:sv(e.generatorState?.lastPollAt),testid:`launcher-launched-generator-last-poll`}),(0,R.jsx)(Lv,{label:`Generator enabled`,value:e.generatorEnabled?`yes`:`no`,testid:`launcher-launched-generator-enabled`}),e.generatorState?.totalPosted!==void 0&&(0,R.jsx)(Lv,{label:`Total posted`,value:String(e.generatorState.totalPosted),testid:`launcher-launched-generator-total-posted`}),e.generatorState?.lastPostedInstanceId!==void 0&&(0,R.jsx)(Lv,{label:`Last posted`,value:e.generatorState.lastPostedInstanceId,testid:`launcher-launched-generator-last-posted`})]}),(0,R.jsx)(kv,{record:e}),(0,R.jsx)(Mv,{record:e}),e.generatorState?.lastError&&(0,R.jsx)(jv,{record:e}),r]})}function Ev({record:e,onSave:t}){let n=(0,L.useMemo)(()=>mv(e.generatorConfig),[e.generatorConfig]),[r,i]=(0,L.useState)(n),[a,o]=(0,L.useState)({kind:`idle`}),[s,c]=(0,L.useState)(!1);(0,L.useEffect)(()=>{i(t=>JSON.stringify(t)===JSON.stringify(e())?n:t);function e(){return n}},[JSON.stringify(e.generatorConfig)]);let l=(e,t)=>{i(n=>({...n,[e]:t}))},u=(0,L.useMemo)(()=>xv(r,n),[r,n]),d=Object.keys(u.patch).length>0,f=a.kind===`saving`;return(0,R.jsx)(Tv,{record:e,configExpanded:s,setConfigExpanded:c,children:s&&(0,R.jsxs)(`div`,{id:`launcher-launched-generator-config`,"data-testid":`launcher-launched-generator-config`,className:`flex flex-col gap-3.5 pt-3.5`,children:[(0,R.jsx)(Ah,{}),(0,R.jsx)(`h3`,{className:`m-0 font-mono text-[11px] uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Hot-apply config`}),(0,R.jsxs)(`div`,{className:`grid gap-3.5 [grid-template-columns:repeat(auto-fit,minmax(220px,1fr))]`,children:[(0,R.jsx)(Fv,{label:`Cadence (ms)`,testid:`launcher-launched-generator-cadenceMs`,value:r.cadenceMs,onChange:e=>l(`cadenceMs`,e),error:u.errors.cadenceMs,disabled:f}),(0,R.jsx)(Fv,{label:`Submission window (ms)`,testid:`launcher-launched-generator-windowMs`,value:r.windowMs,onChange:e=>l(`windowMs`,e),error:u.errors.windowMs,disabled:f}),(0,R.jsx)(Fv,{label:`Resolve gap (ms)`,testid:`launcher-launched-generator-resolveGapMs`,value:r.resolveGapMs,onChange:e=>l(`resolveGapMs`,e),error:u.errors.resolveGapMs,disabled:f}),(0,R.jsx)(Fv,{label:`Max rounds / poll`,testid:`launcher-launched-generator-maxNewRoundsPerPoll`,value:r.maxNewRoundsPerPoll,onChange:e=>l(`maxNewRoundsPerPoll`,e),error:u.errors.maxNewRoundsPerPoll,disabled:f}),(0,R.jsx)(Fv,{label:`Max rounds / day`,testid:`launcher-launched-generator-maxNewRoundsPerDay`,value:r.maxNewRoundsPerDay,onChange:e=>l(`maxNewRoundsPerDay`,e),error:u.errors.maxNewRoundsPerDay,disabled:f}),(0,R.jsx)(Fv,{label:`Max open rounds`,testid:`launcher-launched-generator-maxOpenRounds`,value:r.maxOpenRounds,onChange:e=>l(`maxOpenRounds`,e),error:u.errors.maxOpenRounds,disabled:f})]}),(0,R.jsx)(Iv,{label:`Allowlist condition ids`,testid:`launcher-launched-generator-allowlistConditionIds`,value:r.allowlistConditionIds,onChange:e=>l(`allowlistConditionIds`,e),disabled:f}),(0,R.jsx)(Iv,{label:`Blocklist condition ids`,testid:`launcher-launched-generator-blocklistConditionIds`,value:r.blocklistConditionIds,onChange:e=>l(`blocklistConditionIds`,e),disabled:f}),(0,R.jsx)(Ov,{dirty:d,saving:f,validationOk:u.ok,saveStatus:a,onSubmit:async()=>{if(!(!u.ok||!d||f)){o({kind:`saving`});try{await t(u.patch),o({kind:`saved`,at:new Date})}catch(e){o({kind:`error`,message:e instanceof Error?e.message:String(e)})}}}})]})})}function Dv({record:e,manifest:t,onSave:n}){let r=(0,L.useMemo)(()=>hv(e.generatorConfig,t),[e.generatorConfig,t]),[i,a]=(0,L.useState)(r),[o,s]=(0,L.useState)({kind:`idle`}),[c,l]=(0,L.useState)(!1);(0,L.useEffect)(()=>{a(e=>JSON.stringify(e)===JSON.stringify(r)?r:e)},[JSON.stringify(e.generatorConfig)]);let u=(e,t)=>{a(n=>({...n,[e]:t}))},d=(0,L.useMemo)(()=>Sv(i,r),[i,r]),f=Object.keys(d.patch).length>0,p=o.kind===`saving`;return(0,R.jsx)(Tv,{record:e,configExpanded:c,setConfigExpanded:l,children:c&&(0,R.jsxs)(`div`,{id:`launcher-launched-generator-config`,"data-testid":`launcher-launched-generator-config`,className:`flex flex-col gap-3.5 pt-3.5`,children:[(0,R.jsx)(Ah,{}),(0,R.jsx)(`h3`,{className:`m-0 font-mono text-[11px] uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Hot-apply config`}),(0,R.jsxs)(`div`,{className:`grid gap-3.5 [grid-template-columns:repeat(auto-fit,minmax(220px,1fr))]`,children:[(0,R.jsx)(Fv,{label:`Target successful Verdicts per instance`,testid:`launcher-launched-generator-N_target_successes`,value:i.N_target_successes,onChange:e=>u(`N_target_successes`,e),error:d.errors.N_target_successes,disabled:p}),(0,R.jsx)(Fv,{label:`Posting window (ms)`,testid:`launcher-launched-generator-posting_window_ms`,value:i.posting_window_ms,onChange:e=>u(`posting_window_ms`,e),error:d.errors.posting_window_ms,disabled:p}),(0,R.jsx)(Fv,{label:`Post batch size`,testid:`launcher-launched-generator-post_batch_size`,value:i.post_batch_size,onChange:e=>u(`post_batch_size`,e),error:d.errors.post_batch_size,disabled:p})]}),(0,R.jsx)(`h3`,{className:`m-0 font-mono text-[11px] uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Claim policy`}),(0,R.jsxs)(`div`,{className:`grid gap-3.5 [grid-template-columns:repeat(auto-fit,minmax(180px,1fr))]`,children:[(0,R.jsx)(Fv,{label:`Max claims per operator`,testid:`launcher-launched-generator-maxClaimsPerOperator`,value:i.maxClaimsPerOperator,onChange:e=>u(`maxClaimsPerOperator`,e),error:d.errors.maxClaimsPerOperator,disabled:p}),(0,R.jsx)(Fv,{label:`Claim lease (seconds)`,testid:`launcher-launched-generator-claimLeaseTtlSeconds`,value:i.claimLeaseTtlSeconds,onChange:e=>u(`claimLeaseTtlSeconds`,e),error:d.errors.claimLeaseTtlSeconds,disabled:p})]}),(0,R.jsx)(Ov,{dirty:f,saving:p,validationOk:d.ok,saveStatus:o,onSubmit:async()=>{if(!(!d.ok||!f||p)){s({kind:`saving`});try{await n(d.patch),s({kind:`saved`,at:new Date})}catch(e){s({kind:`error`,message:e instanceof Error?e.message:String(e)})}}}})]})})}function Ov({dirty:e,saving:t,validationOk:n,saveStatus:r,onSubmit:i}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2`,children:[(0,R.jsx)(Ah,{}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[(0,R.jsx)(Pv,{status:r}),(0,R.jsx)(W,{type:`button`,variant:`default`,"data-testid":`launcher-launched-generator-save`,onClick:()=>{i()},disabled:!(e&&n&&!t),children:t?`Saving…`:`Save`})]})]})}function kv({record:e}){let t=e.generatorState?.lastPollSummary;return Av(t)?(0,R.jsxs)(`dl`,{"data-testid":`launcher-launched-generator-pool-summary`,className:`m-0 grid gap-y-2 gap-x-4 [grid-template-columns:repeat(auto-fit,minmax(120px,1fr))]`,children:[(0,R.jsx)(Lv,{label:`Pool`,value:String(t.poolSize),testid:`launcher-launched-generator-poolSize`}),(0,R.jsx)(Lv,{label:`Posted`,value:String(t.posted),testid:`launcher-launched-generator-posted`}),(0,R.jsx)(Lv,{label:`Unposted`,value:String(t.unposted),testid:`launcher-launched-generator-unposted`}),(0,R.jsx)(Lv,{label:`Live`,value:String(t.live),testid:`launcher-launched-generator-live`}),(0,R.jsx)(Lv,{label:`Repostable`,value:String(t.repostable),testid:`launcher-launched-generator-repostable`}),(0,R.jsx)(Lv,{label:`Saturated`,value:String(t.saturated),testid:`launcher-launched-generator-saturated`})]}):null}function Av(e){if(typeof e!=`object`||!e)return!1;let t=e;return[`poolSize`,`posted`,`unposted`,`live`,`repostable`,`saturated`].every(e=>typeof t[e]==`number`)}function jv({record:e}){return(0,R.jsxs)(`div`,{"data-testid":`launcher-launched-generator-error`,className:`flex flex-col gap-1 rounded-md border border-destructive bg-card p-3`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-[12px] font-medium text-destructive`,children:[`Last error · `,sv(e.generatorState?.lastError?.at)]}),(0,R.jsx)(`span`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:e.generatorState?.lastError?.message})]})}function Mv({record:e}){let t=e.generatorState?.poolPublicationUpdatedAt;if(!t)return null;let n=e.generatorState?.poolPublicationPriorSize,r=e.generatorState?.poolPublicationCurrentSize,i=typeof n==`number`&&typeof r==`number`?`Pool grew from ${n} → ${r} scorable tasks`:`Pool re-published`;return(0,R.jsxs)(fo,{"data-testid":`launcher-launched-generator-pool-republished`,variant:`default`,children:[(0,R.jsx)(po,{children:`Vetted pool re-published`}),(0,R.jsxs)(mo,{children:[i,` · `,sv(t)]})]})}function Nv({record:e}){let t=e.generatorEnabled,n=e.generatorState?.lastError?{variant:`destructive`,label:`Errored`}:t?{variant:`success`,label:`Enabled`}:{variant:`outline`,label:`Disabled`};return(0,R.jsx)(q,{"data-testid":`launcher-launched-generator-state-badge`,variant:n.variant,children:n.label})}function Pv({status:e}){return e.kind===`saving`?(0,R.jsx)(`span`,{"data-testid":`launcher-launched-generator-save-status`,className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:`Saving…`}):e.kind===`saved`?(0,R.jsxs)(`span`,{"data-testid":`launcher-launched-generator-save-status`,className:`font-mono text-[12px] text-[var(--vow-green)]`,children:[`Saved at `,e.at.toISOString().slice(11,16),` UTC`]}):e.kind===`error`?(0,R.jsxs)(`span`,{"data-testid":`launcher-launched-generator-save-status`,className:`font-mono text-[12px] text-destructive`,children:[`Save failed: `,e.message]}):(0,R.jsx)(`span`,{"data-testid":`launcher-launched-generator-save-status`,className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:`Edits hot-apply without restart.`})}function Fv({label:e,testid:t,value:n,onChange:r,error:i,disabled:a}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(Kf,{htmlFor:t,className:`font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:e}),(0,R.jsx)(s_,{id:t,"data-testid":t,type:`text`,inputMode:`numeric`,value:n,onChange:e=>r(e.target.value),disabled:a,className:U(i&&`border-destructive`)}),i&&(0,R.jsx)(`span`,{"data-testid":`${t}-error`,className:`font-mono text-[11px] text-destructive`,children:i})]})}function Iv({label:e,testid:t,value:n,onChange:r,disabled:i}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(Kf,{htmlFor:t,className:`font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:e}),(0,R.jsx)(`textarea`,{id:t,"data-testid":t,value:n,onChange:e=>r(e.target.value),disabled:i,rows:2,placeholder:`0xabc…, 0xdef…`,className:`flex w-full resize-y rounded-md border border-input bg-transparent px-3 py-2 font-mono text-[13px] text-foreground transition-colors placeholder:text-[var(--fg-dim)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`})]})}function Lv({label:e,value:t,testid:n}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,R.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:e}),(0,R.jsx)(`dd`,{"data-testid":n,className:`m-0 font-mono text-[13px] text-foreground`,children:t})]})}var Rv=Object.defineProperty,zv=(e,t)=>Rv(e,`name`,{value:t,configurable:!0}),Bv=`focusScope.autoFocusOnMount`,Vv=`focusScope.autoFocusOnUnmount`,Hv={bubbles:!1,cancelable:!0},Uv=L.forwardRef(zv(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=L.useState(null),l=aa(i),u=aa(a),d=L.useRef(null),f=Kn(t,c),p=L.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;L.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Xv(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Xv(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Xv(s)};zv(e,`handleFocusIn`),zv(t,`handleFocusOut`),zv(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),L.useEffect(()=>{if(s){Zv.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Bv,Hv);s.addEventListener(Bv,l),s.dispatchEvent(t),t.defaultPrevented||(Wv(ey(Kv(s)),{select:!0}),document.activeElement===e&&Xv(s))}return()=>{s.removeEventListener(Bv,l),setTimeout(()=>{let t=new CustomEvent(Vv,Hv);s.addEventListener(Vv,u),s.dispatchEvent(t),t.defaultPrevented||Xv(e??document.body,{select:!0}),s.removeEventListener(Vv,u),Zv.remove(p)},0)}}},[s,l,u,p]);let m=L.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Gv(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Xv(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Xv(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,R.jsx)(Gi.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function Wv(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Xv(r,{select:t}),document.activeElement!==n)return}zv(Wv,`focusFirst`);function Gv(e){let t=Kv(e);return[qv(t,e),qv(t.reverse(),e)]}zv(Gv,`getTabbableEdges`);function Kv(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:zv(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}zv(Kv,`getTabbableCandidates`);function qv(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Jv(r,{upTo:t})))return r}zv(qv,`findVisible`);function Jv(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}zv(Jv,`isHidden`);function Yv(e){return e instanceof HTMLInputElement&&`select`in e}zv(Yv,`isSelectableInput`);function Xv(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Yv(e)&&t&&e.select()}}zv(Xv,`focus`);var Zv=Qv();function Qv(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=$v(e,t),e.unshift(t)},remove(t){e=$v(e,t),e[0]?.resume()}}}zv(Qv,`createFocusScopesStack`);function $v(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}zv($v,`arrayRemove`);function ey(e){return e.filter(e=>e.tagName!==`A`)}zv(ey,`removeLinks`);var ty=0,ny=null;function ry(){L.useEffect(()=>{ny||={start:iy(),end:iy()};let{start:e,end:t}=ny;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),ty++,()=>{ty===1&&(ny?.start.remove(),ny?.end.remove(),ny=null),ty=Math.max(0,ty-1)}},[])}function iy(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var ay=function(){return ay=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ay.apply(this,arguments)};function oy(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function sy(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var cy=`right-scroll-bar-position`,ly=`width-before-scroll-bar`,uy=`with-scroll-bars-hidden`,dy=`--removed-body-scroll-bar-size`;function fy(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function py(e,t){var n=(0,L.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var my=typeof window<`u`?L.useLayoutEffect:L.useEffect,hy=new WeakMap;function gy(e,t){var n=py(t||null,function(t){return e.forEach(function(e){return fy(e,t)})});return my(function(){var t=hy.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||fy(e,null)}),i.forEach(function(e){r.has(e)||fy(e,a)})}hy.set(n,e)},[e]),n}function _y(e){return e}function vy(e,t){t===void 0&&(t=_y);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function yy(e){e===void 0&&(e={});var t=vy(null);return t.options=ay({async:!0,ssr:!1},e),t}var by=function(e){var t=e.sideCar,n=oy(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return L.createElement(r,ay({},n))};by.isSideCarExport=!0;function xy(e,t){return e.useMedium(t),by}var Sy=yy(),Cy=function(){},wy=L.forwardRef(function(e,t){var n=L.useRef(null),r=L.useState({onScrollCapture:Cy,onWheelCapture:Cy,onTouchMoveCapture:Cy}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=oy(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=gy([n,t]),C=ay(ay({},b),i);return L.createElement(L.Fragment,null,u&&L.createElement(x,{sideCar:Sy,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?L.cloneElement(L.Children.only(s),ay(ay({},C),{ref:S})):L.createElement(v,ay({},C,{className:c,ref:S}),s))});wy.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},wy.classNames={fullWidth:ly,zeroRight:cy};var Ty,Ey=function(){if(Ty)return Ty;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Dy(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Ey();return t&&e.setAttribute(`nonce`,t),e}function Oy(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ky(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Ay=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Dy())&&(Oy(t,n),ky(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},jy=function(){var e=Ay();return function(t,n){L.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},My=function(){var e=jy();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Ny={left:0,top:0,right:0,gap:0},Py=function(e){return parseInt(e||``,10)||0},Fy=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Py(n),Py(r),Py(i)]},Iy=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Ny;var t=Fy(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Ly=My(),Ry=`data-scroll-locked`,zy=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
24
+ .${uy} {
25
25
  overflow: hidden ${r};
26
26
  padding-right: ${s}px ${r};
27
27
  }
28
- body[${Ly}] {
28
+ body[${Ry}] {
29
29
  overflow: hidden ${r};
30
30
  overscroll-behavior: contain;
31
31
  ${[t&&`position: relative ${r};`,n===`margin`&&`
@@ -38,58 +38,58 @@ Defaulting to \`null\`.`}go(Mo,`getInvalidValueError`);var No=Co,Po=To,Fo=L.forw
38
38
  `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
39
39
  }
40
40
 
41
- .${sy} {
41
+ .${cy} {
42
42
  right: ${s}px ${r};
43
43
  }
44
44
 
45
- .${cy} {
45
+ .${ly} {
46
46
  margin-right: ${s}px ${r};
47
47
  }
48
48
 
49
- .${sy} .${sy} {
49
+ .${cy} .${cy} {
50
50
  right: 0 ${r};
51
51
  }
52
52
 
53
- .${cy} .${cy} {
53
+ .${ly} .${ly} {
54
54
  margin-right: 0 ${r};
55
55
  }
56
56
 
57
- body[${Ly}] {
58
- ${uy}: ${s}px;
57
+ body[${Ry}] {
58
+ ${dy}: ${s}px;
59
59
  }
60
- `},zy=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},By=function(){L.useEffect(function(){return document.body.setAttribute(Ly,(zy()+1).toString()),function(){var e=zy()-1;e<=0?document.body.removeAttribute(Ly):document.body.setAttribute(Ly,e.toString())}},[])},Vy=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;By();var a=L.useMemo(function(){return Fy(i)},[i]);return L.createElement(Iy,{styles:Ry(a,!t,i,n?``:`!important`)})},Hy=!1;if(typeof window<`u`)try{var Uy=Object.defineProperty({},"passive",{get:function(){return Hy=!0,!0}});window.addEventListener(`test`,Uy,Uy),window.removeEventListener(`test`,Uy,Uy)}catch{Hy=!1}var Wy=Hy?{passive:!1}:!1,Gy=function(e){return e.tagName===`TEXTAREA`},Ky=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Gy(e)&&n[t]===`visible`)},qy=function(e){return Ky(e,`overflowY`)},Jy=function(e){return Ky(e,`overflowX`)},Yy=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Qy(e,r)){var i=$y(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Xy=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Zy=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Qy=function(e,t){return e===`v`?qy(t):Jy(t)},$y=function(e,t){return e===`v`?Xy(t):Zy(t)},eb=function(e,t){return e===`h`&&t===`rtl`?-1:1},tb=function(e,t,n,r,i){var a=eb(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=$y(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Qy(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},nb=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},rb=function(e){return[e.deltaX,e.deltaY]},ib=function(e){return e&&`current`in e?e.current:e},ab=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ob=function(e){return`
60
+ `},By=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Vy=function(){L.useEffect(function(){return document.body.setAttribute(Ry,(By()+1).toString()),function(){var e=By()-1;e<=0?document.body.removeAttribute(Ry):document.body.setAttribute(Ry,e.toString())}},[])},Hy=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Vy();var a=L.useMemo(function(){return Iy(i)},[i]);return L.createElement(Ly,{styles:zy(a,!t,i,n?``:`!important`)})},Uy=!1;if(typeof window<`u`)try{var Wy=Object.defineProperty({},"passive",{get:function(){return Uy=!0,!0}});window.addEventListener(`test`,Wy,Wy),window.removeEventListener(`test`,Wy,Wy)}catch{Uy=!1}var Gy=Uy?{passive:!1}:!1,Ky=function(e){return e.tagName===`TEXTAREA`},qy=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Ky(e)&&n[t]===`visible`)},Jy=function(e){return qy(e,`overflowY`)},Yy=function(e){return qy(e,`overflowX`)},Xy=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),$y(e,r)){var i=eb(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Zy=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Qy=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},$y=function(e,t){return e===`v`?Jy(t):Yy(t)},eb=function(e,t){return e===`v`?Zy(t):Qy(t)},tb=function(e,t){return e===`h`&&t===`rtl`?-1:1},nb=function(e,t,n,r,i){var a=tb(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=eb(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&$y(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},rb=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ib=function(e){return[e.deltaX,e.deltaY]},ab=function(e){return e&&`current`in e?e.current:e},ob=function(e,t){return e[0]===t[0]&&e[1]===t[1]},sb=function(e){return`
61
61
  .block-interactivity-${e} {pointer-events: none;}
62
62
  .allow-interactivity-${e} {pointer-events: all;}
63
- `},sb=0,cb=[];function lb(e){var t=L.useRef([]),n=L.useRef([0,0]),r=L.useRef(),i=L.useState(sb++)[0],a=L.useState(jy)[0],o=L.useRef(e);L.useEffect(function(){o.current=e},[e]),L.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=oy([e.lockRef.current],(e.shards||[]).map(ib),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=L.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=nb(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Yy(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Yy(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return tb(h,t,e,h===`h`?s:c,!0)},[]),c=L.useCallback(function(e){var n=e;if(!(!cb.length||cb[cb.length-1]!==a)){var r=`deltaY`in n?rb(n):nb(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ab(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(ib).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=L.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:ub(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=L.useCallback(function(e){n.current=nb(e),r.current=void 0},[]),d=L.useCallback(function(t){l(t.type,rb(t),t.target,s(t,e.lockRef.current))},[]),f=L.useCallback(function(t){l(t.type,nb(t),t.target,s(t,e.lockRef.current))},[]);L.useEffect(function(){return cb.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Wy),document.addEventListener(`touchmove`,c,Wy),document.addEventListener(`touchstart`,u,Wy),function(){cb=cb.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Wy),document.removeEventListener(`touchmove`,c,Wy),document.removeEventListener(`touchstart`,u,Wy)}},[]);var p=e.removeScrollBar,m=e.inert;return L.createElement(L.Fragment,null,m?L.createElement(a,{styles:ob(i)}):null,p?L.createElement(Vy,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ub(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var db=by(xy,lb),fb=L.forwardRef(function(e,t){return L.createElement(Cy,iy({},e,{ref:t,sideCar:db}))});fb.classNames=Cy.classNames;var pb=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},mb=new WeakMap,hb=new WeakMap,gb={},_b=0,vb=function(e){return e&&(e.host||vb(e.parentNode))},yb=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=vb(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},bb=function(e,t,n,r){var i=yb(t,Array.isArray(e)?e:[e]);gb[n]||(gb[n]=new WeakMap);var a=gb[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(mb.get(e)||0)+1,l=(a.get(e)||0)+1;mb.set(e,c),a.set(e,l),o.push(e),c===1&&i&&hb.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),_b++,function(){o.forEach(function(e){var t=mb.get(e)-1,i=a.get(e)-1;mb.set(e,t),a.set(e,i),t||(hb.has(e)||e.removeAttribute(r),hb.delete(e)),i||e.removeAttribute(n)}),_b--,_b||(mb=new WeakMap,mb=new WeakMap,hb=new WeakMap,gb={})}},xb=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||pb(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),bb(r,i,n,`aria-hidden`)):function(){return null}},Sb=Object.defineProperty,Cb=(e,t)=>Sb(e,`name`,{value:t,configurable:!0}),wb=`Dialog`,[Tb,Eb]=ra(wb),[Db,Ob]=Tb(wb),kb=Cb(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=L.useRef(null),c=L.useRef(null),[l,u]=su({prop:r,defaultProp:i??!1,onChange:a,caller:wb}),[d,f]=L.useState(0),[p,m]=L.useState(0);return(0,R.jsx)(Db,{scope:t,triggerRef:s,contentRef:c,contentId:ys(),titleId:ys(),descriptionId:ys(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:L.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Ab=`DialogTrigger`,jb=L.forwardRef(Cb(function(e,t){let{__scopeDialog:n,...r}=e,i=Ob(Ab,n),a=Kn(t,i.triggerRef);return(0,R.jsx)(Gi.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Zb(i.open),...r,ref:a,onClick:K(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),Mb=`DialogPortal`,[Nb,Pb]=Tb(Mb,{forceMount:void 0}),Fb=Cb(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Ob(Mb,t);return(0,R.jsx)(Nb,{scope:t,forceMount:n,children:L.Children.map(r,e=>(0,R.jsx)(Zi,{present:n||a.open,children:(0,R.jsx)(eu,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Ib=`DialogOverlay`,Lb=L.forwardRef(Cb(function(e,t){let n=Pb(Ib,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ob(Ib,e.__scopeDialog);return a.modal?(0,R.jsx)(Zi,{present:r||a.open,children:(0,R.jsx)(zb,{...i,ref:t})}):null},`DialogOverlay`)),Rb=qn(`DialogOverlay.RemoveScroll`),zb=L.forwardRef(Cb(function(e,t){let{__scopeDialog:n,...r}=e,i=Ob(Ib,n),a=Kn(t,ds());return(0,R.jsx)(fb,{as:Rb,allowPinchZoom:!0,shards:[i.contentRef],children:(0,R.jsx)(Gi.div,{"data-state":Zb(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Bb=`DialogContent`,Vb=L.forwardRef(Cb(function(e,t){let n=Pb(Bb,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ob(Bb,e.__scopeDialog);return(0,R.jsx)(Zi,{present:r||a.open,children:a.modal?(0,R.jsx)(Hb,{...i,ref:t}):(0,R.jsx)(Ub,{...i,ref:t})})},`DialogContent`)),Hb=L.forwardRef(Cb(function(e,t){let n=Ob(Bb,e.__scopeDialog),r=L.useRef(null),i=Kn(t,n.contentRef,r);return L.useEffect(()=>{let e=r.current;if(e)return xb(e)},[]),(0,R.jsx)(Wb,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:K(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:K(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:K(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Ub=L.forwardRef(Cb(function(e,t){let n=Ob(Bb,e.__scopeDialog),r=L.useRef(!1),i=L.useRef(!1);return(0,R.jsx)(Wb,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Wb=L.forwardRef(Cb(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Ob(Bb,n);return ny(),(0,R.jsx)(R.Fragment,{children:(0,R.jsx)(Hv,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,R.jsx)(us,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Zb(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),Gb=`DialogTitle`,Kb=L.forwardRef(Cb(function(e,t){let{__scopeDialog:n,...r}=e,i=Ob(Gb,n),{setTitleCount:a}=i;return qi(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,R.jsx)(Gi.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),qb=`DialogDescription`,Jb=L.forwardRef(Cb(function(e,t){let{__scopeDialog:n,...r}=e,i=Ob(qb,n),{setDescriptionCount:a}=i;return qi(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,R.jsx)(Gi.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),Yb=`DialogClose`,Xb=L.forwardRef(Cb(function(e,t){let{__scopeDialog:n,...r}=e,i=Ob(Yb,n);return(0,R.jsx)(Gi.button,{type:`button`,...r,ref:t,onClick:K(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Zb(e){return e?`open`:`closed`}Cb(Zb,`getState`);var Qb=Object.defineProperty,$b=(e,t)=>Qb(e,`name`,{value:t,configurable:!0}),[ex,tx]=ra(`AlertDialog`,[Eb]),nx=Eb(),rx=$b(e=>{let{__scopeAlertDialog:t,...n}=e,r=nx(t);return(0,R.jsx)(kb,{...r,...n,modal:!0})},`AlertDialog`);L.forwardRef($b(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=nx(n);return(0,R.jsx)(jb,{...i,...r,ref:t})},`AlertDialogTrigger`));var ix=$b(e=>{let{__scopeAlertDialog:t,...n}=e,r=nx(t);return(0,R.jsx)(Fb,{...r,...n})},`AlertDialogPortal`),ax=L.forwardRef($b(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=nx(n);return(0,R.jsx)(Lb,{...i,...r,ref:t})},`AlertDialogOverlay`)),[ox,sx]=ex(`AlertDialogContent`),cx=L.forwardRef($b(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=nx(n),o=Kn(t,L.useRef(null)),s=L.useRef(null);return(0,R.jsx)(ox,{scope:n,cancelRef:s,children:(0,R.jsx)(Vb,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:K(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),lx=L.forwardRef($b(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=nx(n);return(0,R.jsx)(Kb,{...i,...r,ref:t})},`AlertDialogTitle`)),ux=L.forwardRef($b(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=nx(n);return(0,R.jsx)(Jb,{...i,...r,ref:t})},`AlertDialogDescription`)),dx=L.forwardRef($b(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=nx(n);return(0,R.jsx)(Xb,{...i,...r,ref:t})},`AlertDialogAction`)),fx=`AlertDialogCancel`,px=L.forwardRef($b(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=sx(fx,n),a=nx(n),o=Kn(t,i);return(0,R.jsx)(Xb,{...a,...r,ref:o})},`AlertDialogCancel`)),mx=rx,hx=ix,gx=ax,_x=cx,vx=dx,yx=px,bx=lx,xx=ux,Sx=mx,Cx=hx,wx=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(gx,{className:U(`fixed inset-0 z-50 bg-black/70 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));wx.displayName=gx.displayName;var Tx=L.forwardRef(({className:e,...t},n)=>(0,R.jsxs)(Cx,{children:[(0,R.jsx)(wx,{}),(0,R.jsx)(_x,{ref:n,className:U(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-card p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));Tx.displayName=_x.displayName;var Ex=({className:e,...t})=>(0,R.jsx)(`div`,{className:U(`flex flex-col gap-2 text-left`,e),...t});Ex.displayName=`AlertDialogHeader`;var Dx=({className:e,...t})=>(0,R.jsx)(`div`,{className:U(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t});Dx.displayName=`AlertDialogFooter`;var Ox=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(bx,{ref:n,className:U(`font-serif text-[20px] leading-tight text-foreground`,e),...t}));Ox.displayName=bx.displayName;var kx=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(xx,{ref:n,className:U(`font-mono text-[12px] text-[var(--fg-muted)]`,e),...t}));kx.displayName=xx.displayName;var Ax=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(vx,{ref:n,className:U(Ri(),e),...t}));Ax.displayName=vx.displayName;var jx=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(yx,{ref:n,className:U(Ri({variant:`secondary`}),`mt-2 sm:mt-0`,e),...t}));jx.displayName=yx.displayName;var Mx={paused:{title:`Pause SolverNet`,body:`The generator will stop posting new Tasks. Existing Tasks continue through their normal lifecycle. You can resume any time.`,confirmLabel:`Pause`},launched:{title:`Resume SolverNet`,body:`The generator will resume polling and posting new Tasks at the configured cadence.`,confirmLabel:`Resume`},retired:{title:`Retire SolverNet`,body:`Retirement is permanent. The SolverNet stops accepting new work and disappears from the operator catalog. Historical Tasks, solutions, and verdicts remain discoverable. Type the SolverNet name to confirm.`,confirmLabel:`Retire permanently`,danger:!0}};function Nx({open:e,target:t,solverNetName:n,onConfirm:r,onCancel:i,pending:a=!1,errorMessage:o}){let[s,c]=(0,L.useState)(``);(0,L.useEffect)(()=>{e||c(``)},[e,t]);let l=Mx[t],u=t===`retired`,d=!u||s.trim().toLowerCase()===n.trim().toLowerCase(),f=a||!d;return(0,R.jsx)(Sx,{open:e,onOpenChange:e=>{!e&&!a&&i()},children:(0,R.jsxs)(Tx,{"data-testid":`launcher-launched-dialog`,"data-target":t,className:U(`gap-4`,l.danger&&`border-destructive`),children:[(0,R.jsxs)(Ex,{children:[(0,R.jsx)(Ox,{className:U(l.danger&&`text-destructive`),children:l.title}),(0,R.jsx)(kx,{children:l.body})]}),u&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(Gf,{htmlFor:`launcher-launched-dialog-typed`,className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,children:[`Type`,` `,(0,R.jsx)(`span`,{className:`text-foreground`,children:n}),` to confirm`]}),(0,R.jsx)(o_,{id:`launcher-launched-dialog-typed`,"data-testid":`launcher-launched-dialog-typed`,type:`text`,autoFocus:!0,value:s,onChange:e=>c(e.target.value),disabled:a,className:U(d&&`border-[var(--vow-green)]`)})]}),o&&(0,R.jsx)(`span`,{"data-testid":`launcher-launched-dialog-error`,className:`font-mono text-[12px] text-destructive`,children:o}),(0,R.jsxs)(Dx,{children:[(0,R.jsx)(jx,{"data-testid":`launcher-launched-dialog-cancel`,onClick:e=>{e.preventDefault(),i()},disabled:a,children:`Cancel`}),(0,R.jsx)(Ax,{"data-testid":`launcher-launched-dialog-confirm`,onClick:e=>{if(f){e.preventDefault();return}e.preventDefault(),r()},disabled:f,className:U(l.danger&&`border border-destructive bg-transparent text-destructive hover:bg-[var(--severity-blocking-bg)]`),children:a?`${l.confirmLabel}…`:l.confirmLabel})]})]})})}function Px({record:e,manifest:t,fetchLauncherStatus:n}){let r=n??(()=>B.fetchLauncherStatus()),{data:i,isLoading:a,isError:o}=ut({queryKey:[`launcher-status`,e.solverNetId],queryFn:()=>r(),refetchInterval:3e4}),s=t?`${t.contract.id}.${t.contract.version}`:e.summary?`${e.summary.contractId}.${e.summary.contractVersion}`:void 0,c=s?i?.nets.find(n=>n.solverType===s||n.name===(t?.name??e.summary?.name)):void 0,l=c?.budget.safeBalanceWei,u=c?.budget.safeAddress??e.launcherSafeAddress,d=t?.solutionPriceWei??e.summary?.solutionPriceWei,f=t?.verdictPriceWei??e.summary?.verdictPriceWei,p=dv(l,d,f);return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{"data-testid":`launcher-launched-spend-panel`,role:`region`,"aria-label":`Spend and runway`,className:`flex flex-col gap-3 p-6`,children:[(0,R.jsx)(`header`,{className:`flex items-center justify-between gap-3`,children:(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[22px] font-normal text-foreground`,children:`Spend & runway`})}),(0,R.jsxs)(`dl`,{className:`m-0 grid gap-y-2 gap-x-4 [grid-template-columns:repeat(auto-fit,minmax(220px,1fr))]`,children:[(0,R.jsx)(Fx,{label:`Safe address`,value:av(u),tooltip:u,testid:`launcher-launched-spend-safe-address`}),(0,R.jsx)(Fx,{label:`Safe balance`,value:a?`—`:l?lv(l):`unavailable`,tooltip:l?`${l} wei`:void 0,testid:`launcher-launched-spend-safe-balance`}),(0,R.jsx)(Fx,{label:`Solution price`,value:d?lv(d):`—`,tooltip:d?`${d} wei`:void 0,testid:`launcher-launched-spend-solution-price`}),(0,R.jsx)(Fx,{label:`Verdict price`,value:f?lv(f):`—`,tooltip:f?`${f} wei`:void 0,testid:`launcher-launched-spend-verdict-price`}),(0,R.jsx)(Fx,{label:`Per-Task cost`,value:p?lv(p.perTaskWei.toString()):`—`,tooltip:p?`${p.perTaskWei.toString()} wei`:void 0,testid:`launcher-launched-spend-per-task`}),(0,R.jsx)(Fx,{label:`Projected runway`,value:p?`${p.tasks.toLocaleString()} Tasks at current prices`:`manifest or balance unavailable`,testid:`launcher-launched-spend-runway`})]}),o&&(0,R.jsx)(`span`,{"data-testid":`launcher-launched-spend-error`,className:`font-mono text-[12px] text-destructive`,children:`Failed to load Safe balance.`}),p?.lowRunway&&(0,R.jsxs)(`span`,{"data-testid":`launcher-launched-spend-low-runway`,className:`font-mono text-[12px] text-[var(--wane)]`,children:[`Runway low — under `,100 .toLocaleString(),` Tasks remain at current prices. Top up your wallet from the Overview faucet — the daemon forwards ETH to the Safe automatically. This panel has no local top-up action.`]}),(0,R.jsx)(`p`,{className:`m-0 font-mono text-[11px] leading-relaxed text-[var(--fg-dim)]`,children:`Runway projects how many Tasks the Safe can fund at the current manifest prices, including the expected claim-tx gas per Task.`})]})})}function Fx({label:e,value:t,testid:n,tooltip:r}){let i=(0,R.jsx)(`dd`,{"data-testid":n,className:`m-0 truncate font-mono text-[13px] text-foreground`,tabIndex:r?0:void 0,children:t});return(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,R.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:e}),r?(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:i}),(0,R.jsx)(nd,{children:r})]}):i]})}var Ix={paused:`Pause`,launched:`Resume`,retired:`Retire`},Lx={launching:{variant:`default`,label:`Launching`},launched:{variant:`success`,label:`Launched`},paused:{variant:`pill`,label:`Paused`},retired:{variant:`outline`,label:`Retired`},failed:{variant:`destructive`,label:`Failed`}};function Rx({record:e,manifest:t,operatorCount:n,onAction:r,pending:i}){let a=Lx[e.status]??Lx.launching,o=sv[e.status]??[],s=t?.name??e.summary?.name??e.solverNetId;return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{"data-testid":`launcher-launched-status-header`,"data-status":e.status,role:`region`,"aria-label":`SolverNet status header`,className:`flex flex-col gap-4 p-6`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,R.jsx)(`h1`,{"data-testid":`launcher-launched-name`,className:`m-0 font-serif text-[32px] font-normal tracking-[-0.01em] text-foreground`,children:s}),(0,R.jsx)(q,{"data-testid":`launcher-launched-status-badge`,variant:a.variant,className:`whitespace-nowrap`,children:a.label})]}),t?.description&&(0,R.jsx)(`p`,{className:`m-0 max-w-[720px] text-[13px] leading-relaxed text-[var(--fg-muted)]`,children:t.description})]}),(0,R.jsx)(Bx,{allowed:o,onAction:r,pending:i??null,terminal:e.status===`retired`,launching:e.status===`launching`})]}),(0,R.jsx)(kh,{}),(0,R.jsxs)(`dl`,{className:`m-0 grid gap-y-2 gap-x-4 [grid-template-columns:repeat(auto-fit,minmax(220px,1fr))]`,children:[(0,R.jsx)(zx,{label:`SolverNet id`,value:e.solverNetId,testid:`launcher-launched-solvernet-id`}),(0,R.jsx)(zx,{label:`Manifest cid`,value:iv(e.manifestCid),testid:`launcher-launched-manifest-cid`,additionalTestIds:[`manifest-cid`],tooltip:e.manifestCid}),(0,R.jsx)(zx,{label:`Launcher Safe`,value:av(e.launcherSafeAddress),testid:`launcher-launched-safe`,tooltip:e.launcherSafeAddress}),(0,R.jsx)(zx,{label:`Launcher agent`,value:e.launcherAgentId,testid:`launcher-launched-agent`}),n!==void 0&&(0,R.jsx)(zx,{label:`Operators`,value:String(n),testid:`launcher-launched-operator-count`,additionalTestIds:[`operator-count`],tooltip:`Distinct operators that have ever claimed a task on this SolverNet, including on finalized or refunded tasks`})]})]})})}function zx({label:e,value:t,testid:n,additionalTestIds:r,tooltip:i}){let a=(0,R.jsxs)(`dd`,{"data-testid":n,className:`m-0 truncate font-mono text-[13px] text-foreground`,tabIndex:i?0:void 0,children:[t,r?.map(e=>(0,R.jsx)(`span`,{"data-testid":e,className:`hidden`,"aria-hidden":`true`,children:t},e))]});return(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,R.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:e}),i?(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:a}),(0,R.jsx)(nd,{children:i})]}):a]})}function Bx({allowed:e,onAction:t,pending:n,terminal:r,launching:i}){return r?(0,R.jsx)(q,{"data-testid":`launcher-launched-terminal-pill`,variant:`outline`,className:`self-start whitespace-nowrap`,children:`Retired — no further actions`}):i?(0,R.jsx)(q,{"data-testid":`launcher-launched-launching-pill`,variant:`outline`,className:`self-start whitespace-nowrap border-primary text-primary`,children:`Launching…`}):e.length===0?null:(0,R.jsx)(`div`,{"data-testid":`launcher-launched-actions`,className:`flex flex-wrap gap-2 self-start`,children:e.map(e=>{let r=Ix[e],i=n===e;return(0,R.jsx)(W,{type:`button`,variant:e===`retired`?`destructive`:`default`,"data-testid":`launcher-launched-action-${e}`,onClick:()=>t(e),disabled:n!==null,className:n!==null&&!i?`opacity-60`:void 0,children:i?`${r}…`:r},e)})})}var Vx=5,Hx={open:{variant:`default`,label:`Open`},"claims-in-flight":{variant:`default`,label:`In flight`},"fully-claimed":{variant:`success`,label:`Claimed`},settled:{variant:`success`,label:`Settled`},failed:{variant:`destructive`,label:`Failed`}},Ux={finalized:{variant:`success`,label:`Finalized`},open:{variant:`outline`,label:`Open`},expired:{variant:`warning`,label:`Expired`}};function Wx({record:e,fetchTasks:t}){let[n,r]=(0,L.useState)([void 0]),i=n[n.length-1],a=t??(e=>B.fetchLauncherTasks(e)),{data:o,isLoading:s,isError:c,error:l,refetch:u}=ut({queryKey:[`launcher-tasks`,e.solverNetId,e.manifestCid,i??null],queryFn:()=>a({cursor:i,limit:Vx,manifestCid:e.manifestCid}),refetchInterval:15e3});return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{"data-testid":`launcher-launched-tasks-panel`,role:`region`,"aria-label":`Recent posted Tasks`,className:`flex flex-col gap-3 p-6`,children:[(0,R.jsxs)(`header`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[22px] font-normal text-foreground`,children:`Recent posted Tasks`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-launched-tasks-refresh`,onClick:()=>{u()},children:`Refresh`})]}),s&&(0,R.jsx)(`p`,{"data-testid":`launcher-launched-tasks-loading`,className:`m-0 font-mono text-[12px] text-[var(--fg-muted)]`,children:`Loading…`}),c&&(0,R.jsxs)(`div`,{"data-testid":`launcher-launched-tasks-error`,className:`font-mono text-[12px] text-destructive`,children:[`Failed to load tasks: `,l instanceof Error?l.message:`unknown error`]}),!s&&!c&&o&&o.tasks.length===0&&(0,R.jsx)(Jx,{}),!s&&!c&&o&&o.tasks.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{"data-testid":`launcher-launched-tasks-list`,className:`overflow-hidden rounded-md border border-border`,children:(0,R.jsxs)(Qh,{className:`table-fixed`,children:[(0,R.jsx)($h,{children:(0,R.jsxs)(ng,{className:`bg-[var(--bg)] hover:bg-[var(--bg)]`,children:[(0,R.jsx)(rg,{className:`w-[30%]`,children:`Task`}),(0,R.jsx)(rg,{className:`w-[16%]`,children:`SolverType`}),(0,R.jsx)(rg,{className:`w-[20%]`,children:`Posted`}),(0,R.jsx)(rg,{className:`w-[14%]`,children:`Local State`}),(0,R.jsx)(rg,{className:`w-[20%] text-right`,children:`Claims / On-chain`})]})}),(0,R.jsx)(eg,{children:o.tasks.map(e=>(0,R.jsx)(Gx,{task:e},e.taskId))})]})}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-launched-tasks-prev`,onClick:()=>{r(e=>e.length>1?e.slice(0,-1):e)},disabled:n.length<=1,children:`← Newer`}),(0,R.jsxs)(`span`,{className:`m-0 font-mono text-[12px] text-[var(--fg-muted)]`,children:[`Page `,n.length,o.tasks.length<Vx&&o.cursor===void 0?` · end`:``]}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-launched-tasks-next`,onClick:()=>{o?.cursor?.before&&r(e=>[...e,o.cursor.before])},disabled:!o.cursor?.before,children:`Older →`})]})]})]})})}function Gx({task:e}){let t=Hx[e.state]??{variant:`secondary`,label:e.state},n=e.summary?.title??iv(e.taskCid),r=e.solverType??e.solverNet,i=Kx(e.onchainStatus);return(0,R.jsxs)(ng,{"data-testid":`launcher-launched-task-row`,"data-task-id":e.taskId,children:[(0,R.jsx)(ig,{className:`font-mono text-[13px] text-foreground`,children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`span`,{className:`block truncate`,tabIndex:0,children:n})}),(0,R.jsx)(nd,{children:e.taskCid})]})}),(0,R.jsx)(ig,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`span`,{className:`block truncate`,tabIndex:0,children:r})}),(0,R.jsx)(nd,{children:r})]})}),(0,R.jsx)(ig,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:ov(e.postedAt)}),(0,R.jsx)(ig,{children:(0,R.jsx)(q,{variant:t.variant,className:`normal-case tracking-[0.1em]`,children:t.label})}),(0,R.jsx)(ig,{className:`text-right font-mono text-[12px] text-[var(--fg-muted)]`,children:(0,R.jsxs)(`span`,{className:`inline-flex items-center justify-end gap-2`,children:[(0,R.jsxs)(`span`,{children:[e.claims.current,` / `,e.claims.max]}),(0,R.jsx)(qx,{status:i})]})})]})}function Kx(e){return e===`finalized`||e===`open`||e===`expired`?e:`unknown`}function qx({status:e}){if(e===`unknown`)return(0,R.jsx)(`span`,{"data-testid":`launcher-launched-task-onchain`,"aria-label":`On-chain status unknown`,className:`text-[var(--fg-muted)]`,children:`—`});let t=Ux[e];return(0,R.jsx)(q,{"data-testid":`launcher-launched-task-onchain`,"aria-label":`On-chain status: ${t.label}`,variant:t.variant,className:`rounded-sm normal-case tracking-[0.1em]`,children:t.label})}function Jx(){return(0,R.jsx)(`div`,{"data-testid":`launcher-launched-tasks-empty`,className:`rounded-md border border-dashed border-border p-6 text-center font-mono text-[13px] text-[var(--fg-muted)]`,children:`Tasks will appear here after the first generator poll posts a Task.`})}var Yx=2500,Xx=3e4,Zx=`mx-auto flex max-w-[960px] flex-col gap-4 p-6`;function Qx({pollIntervalMs:e=Yx,navigateTo:t,solverNetId:n}={}){let r=Wt(),[,i]=Kt(),a=t??i,o=Ye(),s=n??r.solverNetId,c=ut({queryKey:[`solvernets`,`launched`,s],queryFn:()=>B.solvernets.get(s),refetchInterval:e,enabled:!!s}),l=c.data?.manifestCid,u=ut({queryKey:[`solvernets`,`manifest`,l],queryFn:()=>B.solvernets.getManifest(l),enabled:!!l,staleTime:1/0}),d=ut({queryKey:[`solvernets`,`operator-count`,l],queryFn:async()=>(await B.discovery.getSolverNetOperatorCount(l)).operatorCount,enabled:!!l,refetchInterval:Xx}),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)(null),g=dt({mutationFn:({target:e})=>B.solvernets.transitionLifecycle(s,e),onSuccess:async e=>{await o.cancelQueries({queryKey:[`solvernets`,`launched`,s]}),o.setQueryData([`solvernets`,`launched`,s],e),p(null),h(null)},onError:e=>{h(e instanceof Error?e.message:String(e))}}),_=dt({mutationFn:e=>B.solvernets.updateGeneratorConfig(s,e),onSuccess:()=>{o.invalidateQueries({queryKey:[`solvernets`,`launched`,s]})}});if(!s)return(0,R.jsx)(`main`,{"data-testid":`launcher-launched-missing-id`,className:Zx,children:(0,R.jsx)(tS,{message:`No solverNetId supplied.`,onBack:()=>a(`/launcher`)})});if(c.isLoading)return(0,R.jsx)(`main`,{"data-testid":`launcher-launched-loading`,className:Zx,children:(0,R.jsx)(`p`,{className:`m-0 font-mono text-[13px] text-[var(--fg-muted)]`,children:`Loading…`})});if(c.isError||!c.data){let e=c.error instanceof Error?c.error.message:`Unknown error`;return(0,R.jsx)(`main`,{"data-testid":`launcher-launched-error`,className:Zx,children:(0,R.jsx)(tS,{message:`Failed to load SolverNet: ${e}`,onBack:()=>a(`/launcher`),onRetry:()=>{c.refetch()}})})}let v=c.data,y=u.data?.manifest,b=eS(v,y),x=y?.name??v.summary?.name??v.solverNetId;return(0,R.jsxs)(`main`,{"data-testid":`launcher-launched`,"data-solvernet-id":s,className:Zx,children:[(0,R.jsx)(Rx,{record:v,manifest:y,operatorCount:d.data,onAction:e=>{h(null),p(e)},pending:g.isPending?g.variables?.target??null:null}),(0,R.jsx)(Cv,{record:v,manifest:y,template:b,onSave:async e=>{await _.mutateAsync(e)}}),(0,R.jsx)(Px,{record:v,manifest:y}),(0,R.jsx)(Wx,{record:v}),u.isError&&(0,R.jsxs)(`p`,{"data-testid":`launcher-launched-manifest-error`,className:`m-0 font-mono text-[12px] text-destructive`,children:[`Failed to load manifest:`,` `,$x(u.error)]}),(0,R.jsx)(Nx,{open:f!==null,target:f??`paused`,solverNetName:x,pending:g.isPending,errorMessage:m??void 0,onCancel:()=>{g.isPending||(p(null),h(null))},onConfirm:()=>{f&&g.mutate({target:f})}})]})}function $x(e){let t=e instanceof Error?e.message:String(e??`unknown error`);return/404|manifest_not_found|registry_unavailable/i.test(t)?`Manifest unavailable from local cache or registry (${t})`:t}function eS(e,t){let n=t?.contract??(e.summary?{id:e.summary.contractId,version:e.summary.contractVersion}:void 0);if(n)return h_[`${n.id}.${n.version}`]}function tS({message:e,onBack:t,onRetry:n}){return(0,R.jsxs)(fo,{variant:`blocking`,className:`flex items-center justify-between gap-4 border-l-0 border border-destructive p-4`,children:[(0,R.jsx)(mo,{className:`font-mono text-[13px] text-destructive`,children:e}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[n&&(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-launched-error-retry`,onClick:n,children:`Retry`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-launched-error-back`,onClick:t,children:`Back to launcher`})]})]})}var nS=`curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash`,rS=`m-0 overflow-x-auto whitespace-pre-wrap break-all rounded-sm border border-border bg-[var(--bg-sunken)] p-2.5 font-mono text-[12px] text-foreground`;function iS({onSuccess:e,onCancel:t}){let[n,r]=(0,L.useState)(`checking`),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(``),c=()=>{r(`checking`),B.hermesDoctor().then(t=>{if(!t.installed){r(`not-installed`);return}if(t.exitCode!==0){r(`config-issue`),a(t.stderr);return}r(`ok`),e()}).catch(e=>{s(e instanceof Error?e.message:String(e)),r(`network-error`)})};return(0,L.useEffect)(()=>{c()},[]),n===`checking`?(0,R.jsxs)(G,{"data-testid":`hermes-precheck-checking`,className:`flex flex-col gap-3 p-4`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,children:`Hermes install check`}),(0,R.jsx)(`p`,{className:`m-0 font-mono text-[12px] text-[var(--fg-muted)]`,children:`Checking hermes install…`})]}):n===`not-installed`?(0,R.jsxs)(G,{"data-testid":`hermes-precheck-not-installed`,className:`flex flex-col gap-3 p-4`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,children:`Hermes Agent not installed`}),(0,R.jsx)(`p`,{className:`m-0 font-mono text-[13px] text-foreground`,children:`Hermes Agent is not installed on this machine. Run this command in your terminal, then click Retry:`}),(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(`pre`,{className:`${rS} flex-1`,children:nS}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`hermes-precheck-copy-install`,"aria-label":`Copy install command`,onClick:()=>{typeof navigator<`u`&&navigator.clipboard&&navigator.clipboard.writeText(nS).catch(()=>{})},children:`Copy`})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(W,{type:`button`,variant:`outline`,"data-testid":`hermes-precheck-retry`,onClick:c,children:`I've installed Hermes — retry precheck`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`hermes-precheck-cancel`,onClick:t,children:`Cancel`})]})]}):n===`network-error`?(0,R.jsxs)(fo,{"data-testid":`hermes-precheck-network-error`,variant:`blocking`,className:`flex flex-col gap-3 border-l-0 border border-destructive p-4`,children:[(0,R.jsx)(po,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,children:`Hermes precheck failed`}),(0,R.jsxs)(mo,{className:`font-mono text-[13px] text-foreground`,children:[`Could not reach the daemon API to run `,(0,R.jsx)(`code`,{children:`hermes doctor`}),`. Check that the daemon is running and the UI token is valid.`]}),o?(0,R.jsx)(`pre`,{className:rS,children:o}):null,(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(W,{type:`button`,variant:`outline`,"data-testid":`hermes-precheck-retry`,onClick:c,children:`Retry precheck`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`hermes-precheck-cancel`,onClick:t,children:`Cancel`})]})]}):n===`config-issue`?(0,R.jsxs)(fo,{"data-testid":`hermes-precheck-config-issue`,variant:`warning`,className:`flex flex-col gap-3 border-l-0 border border-[var(--severity-warning-fg)] p-4`,children:[(0,R.jsx)(po,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,children:`Hermes Agent configuration issue`}),(0,R.jsx)(mo,{className:`font-mono text-[13px] text-foreground`,children:`Hermes is installed but reports configuration issues:`}),(0,R.jsx)(`pre`,{className:rS,children:i||`(no diagnostic output)`}),(0,R.jsxs)(`p`,{className:`m-0 font-mono text-[12px] text-[var(--fg-muted)]`,children:[`Run `,(0,R.jsx)(`code`,{children:`hermes model`}),` or `,(0,R.jsx)(`code`,{children:`hermes setup`}),` to configure a provider, then retry.`]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(W,{type:`button`,variant:`outline`,"data-testid":`hermes-precheck-retry`,onClick:c,children:`Retry precheck`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`hermes-precheck-cancel`,onClick:t,children:`Cancel`})]})]}):(0,R.jsx)(R.Fragment,{})}var aS=Object.defineProperty,oS=(e,t)=>aS(e,`name`,{value:t,configurable:!0}),sS=`Popover`,[cS,lS]=ra(sS,[Ll]),uS=Ll(),[dS,fS]=cS(sS),pS=oS(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=uS(t),c=L.useRef(null),[l,u]=L.useState(!1),[d,f]=su({prop:r,defaultProp:i??!1,onChange:a,caller:sS});return(0,R.jsx)(Xl,{...s,children:(0,R.jsx)(dS,{scope:t,contentId:ys(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:L.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:L.useCallback(()=>u(!0),[]),onCustomAnchorRemove:L.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),mS=`PopoverTrigger`,hS=L.forwardRef(oS(function(e,t){let{__scopePopover:n,...r}=e,i=fS(mS,n),a=uS(n),o=Kn(t,i.triggerRef),s=(0,R.jsx)(Gi.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":ES(i.open),...r,ref:o,onClick:K(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,R.jsx)(Zl,{asChild:!0,...a,children:s})},`PopoverTrigger`)),gS=`PopoverPortal`,[_S,vS]=cS(gS,{forceMount:void 0}),yS=oS(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=fS(gS,t);return(0,R.jsx)(_S,{scope:t,forceMount:n,children:(0,R.jsx)(Zi,{present:n||a.open,children:(0,R.jsx)(eu,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),bS=`PopoverContent`,xS=L.forwardRef(oS(function(e,t){let n=vS(bS,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=fS(bS,e.__scopePopover);return(0,R.jsx)(Zi,{present:r||a.open,children:a.modal?(0,R.jsx)(CS,{...i,ref:t}):(0,R.jsx)(wS,{...i,ref:t})})},`PopoverContent`)),SS=qn(`PopoverContent.RemoveScroll`),CS=L.forwardRef(oS(function(e,t){let n=fS(bS,e.__scopePopover),r=L.useRef(null),i=Kn(t,r),a=L.useRef(!1);return L.useEffect(()=>{let e=r.current;if(e)return xb(e)},[]),(0,R.jsx)(fb,{as:SS,allowPinchZoom:!0,children:(0,R.jsx)(TS,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:K(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:K(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:K(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),wS=L.forwardRef(oS(function(e,t){let n=fS(bS,e.__scopePopover),r=L.useRef(!1),i=L.useRef(!1);return(0,R.jsx)(TS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),TS=L.forwardRef(oS(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=fS(bS,n),p=uS(n);return ny(),(0,R.jsx)(Hv,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,R.jsx)(us,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,R.jsx)(Ql,{"data-state":ES(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function ES(e){return e?`open`:`closed`}oS(ES,`getState`);var DS=pS,OS=hS,kS=yS,AS=xS,jS=DS,MS=OS,NS=L.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,R.jsx)(kS,{children:(0,R.jsx)(AS,{ref:i,align:t,sideOffset:n,className:U(`z-50 w-72 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,e),...r})}));NS.displayName=AS.displayName;var PS=[{name:`network-tools`,version:`0.1.0`,source:`bundled`,defaultIncluded:!0,description:`Jinn runtime tools`},{name:`claude-code-learner`,version:`0.2.0`,source:`bundled`,defaultIncluded:!0,description:`Learner loop`}];function FS(e){return bd(e)===`hermes-agent`?PS.filter(e=>e.name!==`claude-code-learner`):PS}var IS=new Set([`swe-rebench-v2-runtime`]),LS={"network-tools":`Network Tools`,"claude-code-learner":`Learner`,"swe-rebench-v2-runtime":`SWE-rebench v2 Runtime`,"jinn-prediction-plugin":`Prediction Runtime`},RS=`bundled:`;function zS(e){return LS[e]??e}function BS(e){return e.startsWith(RS)?e.slice(8):e}function VS(e){return e.source===`bundled`?`${RS}${e.name}`:e.name}function HS(e){let t=new Set,n=[];for(let r of e){let e=BS(r);t.has(e)||(t.add(e),n.push(r))}return n}function US(e,t,n){let r=new Set,i=[];for(let e of FS(n))r.add(e.name),i.push(e);for(let t of e){if(r.has(t.name))continue;r.add(t.name);let e=IS.has(t.name);i.push({...t,...e?{defaultIncluded:!0}:{recommended:!0},description:t.name===`swe-rebench-v2-runtime`?`SWE-rebench v2 runtime`:`Recommended for this SolverNet`})}for(let e of t){let t=BS(e);r.has(t)||(r.add(t),i.push({name:t,version:`configured`,source:e.startsWith(RS)?`bundled`:`custom`,description:`Already configured`}))}return i}function WS(e){let t=[e.source,e.version];return e.description&&t.push(e.description),t.join(` · `)}function GS({available:e,selected:t,disabledDefaultPlugins:n=[],onChange:r,rowTestId:i,searchTestId:a,harness:o}){let[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null),p=(0,L.useMemo)(()=>US(e,t,o),[e,t,o]),m=new Set(t.map(BS)),h=new Set(n.map(BS)),g=new Set(m);for(let e of p)e.defaultIncluded&&!h.has(e.name)&&g.add(e.name);let _=p.filter(e=>g.has(e.name)),v=_.filter(e=>e.defaultIncluded).length,y=_.length-v,b=p.filter(e=>!g.has(e.name)),x=s.trim().toLowerCase(),S=x?b.filter(e=>`${e.name} ${zS(e.name)} ${e.source} ${e.description??``}`.toLowerCase().includes(x)):b,C=e=>{let i=e.defaultIncluded?n.filter(t=>BS(t)!==e.name):n;r(e.defaultIncluded?t:HS([...t,VS(e)]),i),u(!1),c(``)},w=e=>{if(e.defaultIncluded){f(e),u(!1),c(``);return}r(t.filter(t=>BS(t)!==e.name),n)};return(0,R.jsxs)(`div`,{className:`relative flex flex-col gap-2`,children:[(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:_.map(e=>(0,R.jsxs)(`span`,{"data-testid":`${i}-chip`,"data-plugin":e.name,className:U(`inline-flex items-center gap-1.5 rounded-full border border-border px-2 py-[5px] pl-2.5 font-mono text-[11px] text-foreground`,e.defaultIncluded?`bg-sunken`:`bg-transparent`),children:[(0,R.jsxs)(`span`,{children:[zS(e.name),(0,R.jsx)(`span`,{className:`text-dim`,children:e.defaultIncluded?` · default`:` · selected`})]}),(0,R.jsx)(W,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Remove ${zS(e.name)}`,"data-testid":`${i}-remove`,"data-plugin":e.name,onClick:()=>w(e),className:`h-5 w-5 rounded-full p-0 text-muted-foreground hover:bg-transparent hover:text-foreground`,children:(0,R.jsx)(Hn,{"aria-hidden":`true`,className:`!size-3`})})]},e.name))}),d&&(0,R.jsxs)(`div`,{role:`alertdialog`,"data-testid":`${i}-default-warning`,className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-md border border-wane bg-card px-3 py-2.5 font-mono`,children:[(0,R.jsxs)(`span`,{className:`text-[12px] text-foreground`,children:[zS(d.name),` is part of the default operator baseline. Removing it may break standard SolverNet workflows.`]}),(0,R.jsxs)(`span`,{className:`flex gap-2`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`${i}-default-warning-cancel`,onClick:()=>f(null),children:`Keep`}),(0,R.jsx)(W,{type:`button`,variant:`destructive`,size:`sm`,"data-testid":`${i}-default-warning-confirm`,onClick:()=>{d&&(r(t,HS([...n,d.name])),f(null))},children:`Remove`})]})]}),(0,R.jsxs)(jS,{open:l,onOpenChange:e=>{u(e),e||c(``)},children:[(0,R.jsx)(MS,{asChild:!0,children:(0,R.jsxs)(W,{type:`button`,variant:`outline`,"data-testid":`${i}-trigger`,"aria-haspopup":`listbox`,className:`grid h-auto grid-cols-[minmax(0,1fr)_auto] items-center gap-3 border-border bg-background px-3 py-2.5 text-left font-mono text-[12px] normal-case tracking-normal text-foreground hover:bg-sunken hover:text-foreground`,children:[(0,R.jsxs)(`span`,{className:`min-w-0`,children:[`Add plugin`,(0,R.jsxs)(`span`,{className:`text-dim`,children:[` `,`· `,v,` default`,y>0?` · ${y} selected`:``]})]}),l?(0,R.jsx)(Cn,{"aria-hidden":`true`,className:`!size-3.5 text-muted-foreground`}):(0,R.jsx)(xn,{"aria-hidden":`true`,className:`!size-3.5 text-muted-foreground`})]})}),(0,R.jsxs)(NS,{align:`start`,sideOffset:6,className:`w-[min(28rem,90vw)] overflow-hidden p-0`,children:[(0,R.jsx)(o_,{type:`search`,autoFocus:!0,"aria-label":`Search plugins`,"data-testid":a,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(u(!1),c(``))},placeholder:`Search plugins`,className:`h-auto rounded-none border-0 border-b border-border bg-background px-3 py-2.5 text-[12px] focus-visible:ring-0`}),(0,R.jsx)(io,{className:`max-h-60`,children:(0,R.jsx)(`div`,{role:`listbox`,"aria-label":`Plugins`,className:`flex flex-col`,children:S.length===0?(0,R.jsx)(`span`,{className:`px-3.5 py-3 font-mono text-[12px] text-dim`,children:b.length===0?`No plugins available to add.`:`No matching plugins.`}):S.map((e,t)=>{let n=g.has(e.name),r=e.defaultIncluded?`text-dim`:e.recommended?`text-primary`:`text-muted-foreground`;return(0,R.jsxs)(W,{type:`button`,variant:`ghost`,role:`option`,"aria-selected":n,"data-testid":i,"data-plugin":e.name,"data-plugin-active":n?`true`:`false`,"data-plugin-default":e.defaultIncluded?`true`:`false`,onClick:()=>C(e),className:U(`grid h-auto w-full grid-cols-[minmax(0,1fr)_auto] gap-3 rounded-none px-3 py-2.5 text-left font-mono normal-case tracking-normal transition-colors`,t===0?``:`border-t border-border`,n?`bg-sunken text-foreground`:`bg-transparent text-foreground`,`hover:bg-sunken focus-visible:bg-sunken`),children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,R.jsx)(`span`,{className:`text-[13px] text-foreground`,children:zS(e.name)}),(0,R.jsx)(`span`,{className:`text-[11px] text-dim`,children:WS(e)})]}),(0,R.jsx)(`span`,{className:U(`self-center text-[11px] uppercase`,r),children:e.defaultIncluded?`Default`:e.recommended?`Recommended`:`Add`})]},e.name)})})})]})]})]})}var KS={"claude-opus-4-7":{provider:`anthropic`,inputPer1kTokens:.015,outputPer1kTokens:.075,typicalInputTokens:5e4,typicalOutputTokens:2e4},"claude-sonnet-4-6":{provider:`anthropic`,inputPer1kTokens:.003,outputPer1kTokens:.015,typicalInputTokens:5e4,typicalOutputTokens:2e4},"claude-haiku-4-5-20251001":{provider:`anthropic`,inputPer1kTokens:.001,outputPer1kTokens:.005,typicalInputTokens:5e4,typicalOutputTokens:2e4},"anthropic/claude-opus-4.7":{provider:`openrouter`,inputPer1kTokens:.015,outputPer1kTokens:.075,typicalInputTokens:5e4,typicalOutputTokens:2e4},"anthropic/claude-sonnet-4.6":{provider:`openrouter`,inputPer1kTokens:.003,outputPer1kTokens:.015,typicalInputTokens:5e4,typicalOutputTokens:2e4},"gpt-5.4":{provider:`openai`,inputPer1kTokens:.00125,outputPer1kTokens:.01,typicalInputTokens:5e4,typicalOutputTokens:2e4},"gpt-5.4-mini":{provider:`openai`,inputPer1kTokens:25e-5,outputPer1kTokens:.002,typicalInputTokens:5e4,typicalOutputTokens:2e4},"gpt-5.5":{provider:`openai`,inputPer1kTokens:.015,outputPer1kTokens:.06,typicalInputTokens:5e4,typicalOutputTokens:2e4},"gpt-5.3-codex":{provider:`openai`,inputPer1kTokens:.00125,outputPer1kTokens:.01,typicalInputTokens:5e4,typicalOutputTokens:2e4},"gpt-5.3-codex-spark":{provider:`openai`,inputPer1kTokens:.00125,outputPer1kTokens:.01,typicalInputTokens:5e4,typicalOutputTokens:2e4},"tencent/hy3-preview":{provider:`openrouter`,inputPer1kTokens:.003,outputPer1kTokens:.015,typicalInputTokens:5e4,typicalOutputTokens:2e4},"deepseek/deepseek-v4-pro":{provider:`openrouter`,inputPer1kTokens:.0014,outputPer1kTokens:.0028,typicalInputTokens:5e4,typicalOutputTokens:2e4},"deepseek/deepseek-v4-flash":{provider:`openrouter`,inputPer1kTokens:1e-4,outputPer1kTokens:4e-4,typicalInputTokens:5e4,typicalOutputTokens:2e4},"google/gemini-3.1-flash-lite":{provider:`openrouter`,inputPer1kTokens:1e-4,outputPer1kTokens:4e-4,typicalInputTokens:5e4,typicalOutputTokens:2e4},"moonshotai/kimi-k2.6":{provider:`openrouter`,inputPer1kTokens:6e-4,outputPer1kTokens:.0025,typicalInputTokens:5e4,typicalOutputTokens:2e4},"openrouter/owl-alpha":{provider:`openrouter`,inputPer1kTokens:.002,outputPer1kTokens:.008,typicalInputTokens:5e4,typicalOutputTokens:2e4},"minimax/minimax-m2.7":{provider:`openrouter`,inputPer1kTokens:8e-4,outputPer1kTokens:.0032,typicalInputTokens:5e4,typicalOutputTokens:2e4},"nousresearch/hermes-4-405b":{provider:`nous`,inputPer1kTokens:9e-4,outputPer1kTokens:9e-4,typicalInputTokens:5e4,typicalOutputTokens:2e4}};function qS(e){let t=KS[e];if(!t)return null;let n=t.typicalInputTokens/1e3*t.inputPer1kTokens,r=t.typicalOutputTokens/1e3*t.outputPer1kTokens;return{usd:n+r,inputUsd:n,outputUsd:r,typicalInputTokens:t.typicalInputTokens,typicalOutputTokens:t.typicalOutputTokens,entry:t}}function JS(e,t,n=1){if(!e)return{showEstimate:!1,estimate:null,requiresConfirmation:!1,suppressedReason:`Included in subscription, no per-task API cost.`};let r=t?qS(t):null;return r?.entry.subscriptionPath===!0?{showEstimate:!1,estimate:null,requiresConfirmation:!1,suppressedReason:`Included in subscription, no per-task API cost.`}:{showEstimate:!0,estimate:r,requiresConfirmation:r!==null&&r.usd>n,suppressedReason:null}}function YS(e){return Number.isFinite(e)?e===0?`$0`:e<.01?`<$0.01`:`$${e.toFixed(2)}`:`—`}function XS({modelId:e,usesPaidApiKey:t,thresholdUsd:n=1,variant:r=`card`,testIdPrefix:i=`cost-estimate`}){let a=JS(t,e,n);if(!a.showEstimate)return(0,R.jsxs)(`div`,{"data-testid":`${i}-subscription`,"data-cost-mode":`subscription`,className:U(`flex items-center gap-2.5 font-mono`,r===`card`?`rounded-md border border-border bg-card px-3.5 py-2.5`:`py-1.5`),children:[(0,R.jsx)(On,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}),(0,R.jsx)(`span`,{className:`text-[12px] text-muted-foreground`,children:a.suppressedReason??`Included in subscription, no per-task API cost.`})]});let o=a.estimate,s=o?.usd??null,c=a.requiresConfirmation;return(0,R.jsxs)(`div`,{"data-testid":`${i}-panel`,"data-cost-mode":`paid-api`,"data-cost-usd":s===null?`unknown`:s.toFixed(4),"data-cost-high-cost":c?`true`:`false`,className:U(`flex flex-col gap-2 rounded-md border bg-card`,c?`border-destructive`:`border-border`,r===`card`?`px-4 py-3.5`:`gap-1 px-2.5 py-2`),children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Estimated cost per task`}),(0,R.jsx)(`span`,{"data-testid":`${i}-amount`,className:U(`font-mono font-medium`,r===`card`?`text-[18px]`:`text-[14px]`,c?`text-destructive`:`text-foreground`),children:s===null?`unavailable`:`~${YS(s)}`})]}),o&&(0,R.jsx)(`span`,{"data-testid":`${i}-heuristic`,className:`font-mono text-[11px] text-muted-foreground`,children:`Rough estimate — actual cost varies.`}),s===null&&(0,R.jsx)(`span`,{"data-testid":`${i}-unknown`,className:`font-mono text-[11px] text-muted-foreground`,children:`No pricing entry for this model id — confirm rates with your provider before joining.`}),c&&(0,R.jsxs)(`span`,{"data-testid":`${i}-warning`,className:`font-mono text-[11px] text-destructive`,children:[`This model is above $`,n.toFixed(2),`/task. You will be asked to confirm before joining.`]})]})}var ZS={"claude-code-learner":`claude-code`,"codex-code-learner":`codex`};function QS(e){return ZS[e]??e}var $S=.5,eC={units_per_block:100,units_per_week:2800};tC(eC.units_per_block),tC(eC.units_per_week);function tC(e){return Math.round(e/100*$S*1e6)}function nC(e,t,n){if(!e)return null;let r=QS(e);if(!(r===`claude-code`||r===`codex`||r===`hermes-agent`))return 0;if(!t)return null;let i=qS(t);return i?i.usd/$S*100:null}function rC(e){return e<1?e.toFixed(2):e<10?e.toFixed(1):Math.round(e).toString()}function iC({harness:e,modelId:t,variant:n=`card`,testIdPrefix:r=`harness-footprint`}){let i=nC(e,t);if(i===0)return null;if(i===null)return(0,R.jsxs)(`div`,{"data-testid":`${r}-unknown`,className:U(`flex flex-col gap-1 rounded-md border border-border bg-card`,n===`card`?`px-4 py-3`:`gap-1 px-2.5 py-2`),children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`AI-units footprint`}),(0,R.jsx)(`span`,{className:`font-mono text-[12px] text-muted-foreground`,children:`No pricing entry for this model id — footprint unavailable.`})]});let a=i/100*$S,o=eC.units_per_block/i,s=a*o*4,c=i*o*4*7;return(0,R.jsxs)(`div`,{"data-testid":`${r}-panel`,className:U(`flex flex-col gap-2 rounded-md border border-border bg-card`,n===`card`?`px-4 py-3.5`:`gap-1 px-2.5 py-2`),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(On,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}),(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`AI-units footprint`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5 font-mono text-[12px] text-foreground`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`Per 6h block, at cap`}),(0,R.jsxs)(`span`,{"data-testid":`${r}-block`,className:`font-medium`,children:[rC(i),` / `,eC.units_per_block,` units / task`]})]}),(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`Per week, at cap`}),(0,R.jsxs)(`span`,{"data-testid":`${r}-week`,className:`font-medium`,children:[rC(c),` / `,eC.units_per_week,` units`]})]}),(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`~ Daily cost at cap`}),(0,R.jsxs)(`span`,{"data-testid":`${r}-daily-usd`,className:`font-medium`,children:[`~$`,s<1?s.toFixed(2):s.toFixed(1),`/day`]})]})]}),(0,R.jsx)(`span`,{className:`font-mono text-[11px] text-muted-foreground`,children:`Node pauses claims for this credential when the 6h or 7d cap is reached, then auto-resumes.`})]})}function aC(e){let{data:t,isPending:n}=ut({queryKey:[`status`],queryFn:()=>B.getStatus()});return e?n||!t?.costSurface?!0:t.costSurface.harnesses[QS(e)]?.usesPaidApiKey??!0:!1}function oC({label:e,children:t,docHref:n,docLabel:r=`Read more`}){let[i,a]=(0,L.useState)(!1);return(0,R.jsxs)(jS,{open:i,onOpenChange:a,children:[(0,R.jsx)(MS,{type:`button`,"data-testid":`inline-help-trigger`,"aria-label":e,className:`inline-flex h-4 w-4 cursor-pointer items-center justify-center rounded-md border border-muted-foreground bg-card p-0 text-muted-foreground transition-colors hover:border-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:(0,R.jsx)(An,{className:`h-2.5 w-2.5`,"aria-hidden":`true`})}),(0,R.jsxs)(NS,{"data-testid":`inline-help-panel`,role:`note`,align:`start`,className:`max-w-[420px] whitespace-pre-line font-mono text-[11px] font-normal leading-relaxed normal-case tracking-normal text-muted-foreground`,children:[t,n&&(0,R.jsxs)(R.Fragment,{children:[` `,(0,R.jsx)(`a`,{"data-testid":`inline-help-doc-link`,href:n,target:`_blank`,rel:`noreferrer`,className:`text-primary hover:underline`,children:r})]})]})]})}var sC=`Self-improving agent by Nous Research. Built-in learning loop.`,cC=`https://github.com/Jinn-Network/mono/blob/next/client/docs/operator/join-form-context.md`,lC=hd,uC=`mx-auto flex max-w-[880px] flex-col gap-4 p-6`,dC=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,fC=dC,pC=`flex items-start gap-2`,mC=`rounded-md border border-input bg-transparent px-3 py-2 font-mono text-[14px] text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`;function hC(e,t){return e?.nets.find(e=>e.contract.id===t.id&&e.contract.version===t.version)}function gC(e){return e?e.length<=13?e:`${e.slice(0,6)}…${e.slice(-4)}`:``}function _C(e){let t=e?.contract.evaluationFunction.implementation;if(t){if(t.includes(`swe-rebench-v2-evaluator`))return`swe-rebench-v2-evaluator`;if(t.includes(`prediction-v1-evaluator`))return`prediction-v1-evaluator`}}function vC(e){let t=[...new Set(e)].sort();return{readiness:ut({queryKey:[`harness-readiness`,t.join(`,`)],enabled:t.length>0,refetchInterval:5e3,queryFn:async()=>{let e=await Promise.all(t.map(async e=>{try{return[e,await B.harnessReadiness(e)]}catch(t){if(t.code===`harness_not_found`)return[e,void 0];throw t}}));return new Map(e)}}).data??new Map}}function yC({manifestCid:e,navigateTo:t}={}){let n=Wt(),[,r]=Kt(),i=t??r,a=Ye(),o=e??n.cid,s=ut({queryKey:[`solvernets`,`manifest`,o],queryFn:()=>B.solvernets.getManifest(o),enabled:!!o,retry:!1}),c=ut({queryKey:[`solvernets`,`catalog`],queryFn:()=>B.getSolverNets()}),l=s.data?.manifest,u=l?hC(c.data,l.contract):void 0,d=(u?.compatibleHarnesses??[]).filter(e=>e.supportsRoles.includes(`solving`)).map(e=>({...e,name:bd(e.name)})).filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t),f=d[0]?.name??lC,[p,m]=(0,L.useState)({roles:[],harness:f,plugins:[],disabledDefaultPlugins:[],model:Ad(f)}),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(!1),x=(0,L.useRef)(!1),[S,C]=(0,L.useState)(!1),w=d[0]?.name;(0,L.useEffect)(()=>{x.current||w&&w!==p.harness&&m(e=>({...e,harness:w,model:Ad(w)}))},[w]);let T=kd(p.harness),E=_C(l),D=p.roles.includes(`solver`),{readiness:O}=vC([...D?d.map(e=>e.name):[],...p.roles.includes(`evaluator`)&&E?[E]:[]]),ee=O.get(p.harness),k=E?O.get(E):void 0,A=aC(D?p.harness:void 0),j=JS(A,D?p.model:void 0),M=D&&j.requiresConfirmation,N=M&&!S,te=dt({mutationFn:()=>B.operator.join(o,{...l?.name===void 0?{}:{name:l.name},...l?.contract===void 0?{}:{contract:{id:l.contract.id,version:l.contract.version}},roles:p.roles,...p.roles.includes(`solver`)?{harness:p.harness,plugins:p.plugins,disabledDefaultPlugins:p.disabledDefaultPlugins,model:p.model}:{}}),onSuccess:e=>{a.invalidateQueries({queryKey:[`operator`,`joined`]}),a.invalidateQueries({queryKey:[`bootstrap`]}),v({manifestCid:e.manifestCid,name:e.config.name??l?.name??e.manifestCid,roles:e.config.roles,restartRequired:e.restartRequired})},onError:e=>{g(e instanceof Error?e.message:String(e))}});if(!o)return(0,R.jsx)(`main`,{"data-testid":`join-flow-missing-cid`,className:uC,children:(0,R.jsx)(bC,{message:`No manifest cid supplied.`,onBack:()=>i(`/operator#solvernets`)})});if(s.isLoading)return(0,R.jsx)(`main`,{"data-testid":`join-flow-loading`,className:uC,children:(0,R.jsx)(`p`,{className:`m-0 font-mono text-[13px] text-[var(--fg-muted)]`,children:`Loading manifest…`})});if(s.isError||!l){let e=s.error instanceof Error?s.error.message:`Unknown error`;return(0,R.jsx)(`main`,{"data-testid":`join-flow-error`,className:uC,children:(0,R.jsx)(bC,{message:`Failed to load manifest: ${e}`,onBack:()=>i(`/operator#solvernets`),onRetry:()=>{s.refetch()}})})}if(_)return(0,R.jsx)(`main`,{"data-testid":`join-flow-success`,className:uC,children:(0,R.jsx)(xC,{success:_,navigate:i})});let{openRoles:P}=l,F=e=>{P.includes(e)&&m(t=>{let n=t.roles.includes(e)?t.roles.filter(t=>t!==e):P.filter(n=>n===e||t.roles.includes(n));return{...t,roles:n}})},ne=p.roles.includes(`evaluator`),re=D&&ee?.ready===!1,ie=ne&&k?.ready===!1,ae=p.roles.length>0&&!te.isPending&&!N&&!re&&!ie,I=ie&&E?(0,R.jsxs)(`div`,{"data-testid":`join-evaluator-not-ready`,"data-harness":E,role:`status`,className:`flex flex-col gap-1 rounded-md border border-destructive bg-[var(--bg)] p-2.5 font-mono text-[11px] text-foreground`,children:[(0,R.jsxs)(`span`,{className:`text-destructive`,children:[xd(E),` is not ready`,k?.reason?`: ${k.reason}`:``]}),k?.nextStep&&(0,R.jsxs)(`span`,{"data-testid":`join-evaluator-not-ready-next-step`,className:`text-[var(--fg-muted)]`,children:[k.nextStep.description,k.nextStep.cli?` (${k.nextStep.cli})`:``]})]}):null;return(0,R.jsxs)(`main`,{"data-testid":`join-flow`,"data-manifest-cid":o,className:uC,children:[(0,R.jsxs)(`header`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(`span`,{"data-testid":`join-flow-title`,className:`font-mono text-[20px] font-medium text-foreground`,children:[`Join `,l.name]}),(0,R.jsx)(`span`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:l.description})]}),(0,R.jsxs)(G,{"data-testid":`join-flow-summary`,className:`flex flex-col gap-3 p-4`,children:[(0,R.jsx)(`span`,{className:dC,children:`Manifest`}),(0,R.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 font-mono text-[12px] text-[var(--fg-muted)]`,children:[(0,R.jsx)(`span`,{children:`Contract`}),(0,R.jsxs)(`span`,{className:`text-foreground`,children:[l.contract.id,` · `,l.contract.version]}),(0,R.jsx)(`span`,{children:`Solution price`}),(0,R.jsx)(`span`,{className:`text-foreground`,children:lv(l.solutionPriceWei)}),(0,R.jsx)(`span`,{children:`Verdict price`}),(0,R.jsx)(`span`,{className:`text-foreground`,children:lv(l.verdictPriceWei)}),(0,R.jsx)(`span`,{children:`Open roles`}),(0,R.jsx)(`span`,{"data-testid":`join-flow-open-roles`,className:`text-foreground`,children:P.join(`, `)||`none`}),(0,R.jsx)(`span`,{children:`Launcher`}),(0,R.jsxs)(`span`,{className:`text-foreground`,children:[gC(l.launcher.safeAddress),` · agentId`,` `,l.launcher.agentId]}),(0,R.jsx)(`span`,{children:`Manifest CID`}),(0,R.jsx)(`span`,{"data-testid":`join-flow-manifest-cid`,className:`truncate text-[var(--fg-dim)]`,children:o})]})]}),(0,R.jsxs)(G,{className:`flex flex-col gap-3 p-4`,children:[(0,R.jsxs)(`span`,{className:pC,children:[(0,R.jsx)(`span`,{className:dC,children:`Roles`}),(0,R.jsxs)(oC,{label:`Roles help`,docHref:`${cC}#solver-vs-evaluator`,children:[`Solver attempts tasks and submits solutions. It is the spending role: you pay for model inference and gas. It also has the most upside per task.`,`
63
+ `},cb=0,lb=[];function ub(e){var t=L.useRef([]),n=L.useRef([0,0]),r=L.useRef(),i=L.useState(cb++)[0],a=L.useState(My)[0],o=L.useRef(e);L.useEffect(function(){o.current=e},[e]),L.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=sy([e.lockRef.current],(e.shards||[]).map(ab),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=L.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=rb(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Xy(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Xy(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return nb(h,t,e,h===`h`?s:c,!0)},[]),c=L.useCallback(function(e){var n=e;if(!(!lb.length||lb[lb.length-1]!==a)){var r=`deltaY`in n?ib(n):rb(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ob(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(ab).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=L.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:db(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=L.useCallback(function(e){n.current=rb(e),r.current=void 0},[]),d=L.useCallback(function(t){l(t.type,ib(t),t.target,s(t,e.lockRef.current))},[]),f=L.useCallback(function(t){l(t.type,rb(t),t.target,s(t,e.lockRef.current))},[]);L.useEffect(function(){return lb.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Gy),document.addEventListener(`touchmove`,c,Gy),document.addEventListener(`touchstart`,u,Gy),function(){lb=lb.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Gy),document.removeEventListener(`touchmove`,c,Gy),document.removeEventListener(`touchstart`,u,Gy)}},[]);var p=e.removeScrollBar,m=e.inert;return L.createElement(L.Fragment,null,m?L.createElement(a,{styles:sb(i)}):null,p?L.createElement(Hy,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function db(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var fb=xy(Sy,ub),pb=L.forwardRef(function(e,t){return L.createElement(wy,ay({},e,{ref:t,sideCar:fb}))});pb.classNames=wy.classNames;var mb=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},hb=new WeakMap,gb=new WeakMap,_b={},vb=0,yb=function(e){return e&&(e.host||yb(e.parentNode))},bb=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=yb(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},xb=function(e,t,n,r){var i=bb(t,Array.isArray(e)?e:[e]);_b[n]||(_b[n]=new WeakMap);var a=_b[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(hb.get(e)||0)+1,l=(a.get(e)||0)+1;hb.set(e,c),a.set(e,l),o.push(e),c===1&&i&&gb.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),vb++,function(){o.forEach(function(e){var t=hb.get(e)-1,i=a.get(e)-1;hb.set(e,t),a.set(e,i),t||(gb.has(e)||e.removeAttribute(r),gb.delete(e)),i||e.removeAttribute(n)}),vb--,vb||(hb=new WeakMap,hb=new WeakMap,gb=new WeakMap,_b={})}},Sb=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||mb(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),xb(r,i,n,`aria-hidden`)):function(){return null}},Cb=Object.defineProperty,wb=(e,t)=>Cb(e,`name`,{value:t,configurable:!0}),Tb=`Dialog`,[Eb,Db]=ra(Tb),[Ob,kb]=Eb(Tb),Ab=wb(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=L.useRef(null),c=L.useRef(null),[l,u]=su({prop:r,defaultProp:i??!1,onChange:a,caller:Tb}),[d,f]=L.useState(0),[p,m]=L.useState(0);return(0,R.jsx)(Ob,{scope:t,triggerRef:s,contentRef:c,contentId:ys(),titleId:ys(),descriptionId:ys(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:L.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),jb=`DialogTrigger`,Mb=L.forwardRef(wb(function(e,t){let{__scopeDialog:n,...r}=e,i=kb(jb,n),a=Kn(t,i.triggerRef);return(0,R.jsx)(Gi.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Qb(i.open),...r,ref:a,onClick:K(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),Nb=`DialogPortal`,[Pb,Fb]=Eb(Nb,{forceMount:void 0}),Ib=wb(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=kb(Nb,t);return(0,R.jsx)(Pb,{scope:t,forceMount:n,children:L.Children.map(r,e=>(0,R.jsx)(Zi,{present:n||a.open,children:(0,R.jsx)(eu,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Lb=`DialogOverlay`,Rb=L.forwardRef(wb(function(e,t){let n=Fb(Lb,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=kb(Lb,e.__scopeDialog);return a.modal?(0,R.jsx)(Zi,{present:r||a.open,children:(0,R.jsx)(Bb,{...i,ref:t})}):null},`DialogOverlay`)),zb=qn(`DialogOverlay.RemoveScroll`),Bb=L.forwardRef(wb(function(e,t){let{__scopeDialog:n,...r}=e,i=kb(Lb,n),a=Kn(t,ds());return(0,R.jsx)(pb,{as:zb,allowPinchZoom:!0,shards:[i.contentRef],children:(0,R.jsx)(Gi.div,{"data-state":Qb(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Vb=`DialogContent`,Hb=L.forwardRef(wb(function(e,t){let n=Fb(Vb,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=kb(Vb,e.__scopeDialog);return(0,R.jsx)(Zi,{present:r||a.open,children:a.modal?(0,R.jsx)(Ub,{...i,ref:t}):(0,R.jsx)(Wb,{...i,ref:t})})},`DialogContent`)),Ub=L.forwardRef(wb(function(e,t){let n=kb(Vb,e.__scopeDialog),r=L.useRef(null),i=Kn(t,n.contentRef,r);return L.useEffect(()=>{let e=r.current;if(e)return Sb(e)},[]),(0,R.jsx)(Gb,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:K(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:K(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:K(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Wb=L.forwardRef(wb(function(e,t){let n=kb(Vb,e.__scopeDialog),r=L.useRef(!1),i=L.useRef(!1);return(0,R.jsx)(Gb,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Gb=L.forwardRef(wb(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=kb(Vb,n);return ry(),(0,R.jsx)(R.Fragment,{children:(0,R.jsx)(Uv,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,R.jsx)(us,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Qb(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),Kb=`DialogTitle`,qb=L.forwardRef(wb(function(e,t){let{__scopeDialog:n,...r}=e,i=kb(Kb,n),{setTitleCount:a}=i;return qi(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,R.jsx)(Gi.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Jb=`DialogDescription`,Yb=L.forwardRef(wb(function(e,t){let{__scopeDialog:n,...r}=e,i=kb(Jb,n),{setDescriptionCount:a}=i;return qi(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,R.jsx)(Gi.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),Xb=`DialogClose`,Zb=L.forwardRef(wb(function(e,t){let{__scopeDialog:n,...r}=e,i=kb(Xb,n);return(0,R.jsx)(Gi.button,{type:`button`,...r,ref:t,onClick:K(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Qb(e){return e?`open`:`closed`}wb(Qb,`getState`);var $b=Object.defineProperty,ex=(e,t)=>$b(e,`name`,{value:t,configurable:!0}),[tx,nx]=ra(`AlertDialog`,[Db]),rx=Db(),ix=ex(e=>{let{__scopeAlertDialog:t,...n}=e,r=rx(t);return(0,R.jsx)(Ab,{...r,...n,modal:!0})},`AlertDialog`);L.forwardRef(ex(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=rx(n);return(0,R.jsx)(Mb,{...i,...r,ref:t})},`AlertDialogTrigger`));var ax=ex(e=>{let{__scopeAlertDialog:t,...n}=e,r=rx(t);return(0,R.jsx)(Ib,{...r,...n})},`AlertDialogPortal`),ox=L.forwardRef(ex(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=rx(n);return(0,R.jsx)(Rb,{...i,...r,ref:t})},`AlertDialogOverlay`)),[sx,cx]=tx(`AlertDialogContent`),lx=L.forwardRef(ex(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=rx(n),o=Kn(t,L.useRef(null)),s=L.useRef(null);return(0,R.jsx)(sx,{scope:n,cancelRef:s,children:(0,R.jsx)(Hb,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:K(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),ux=L.forwardRef(ex(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=rx(n);return(0,R.jsx)(qb,{...i,...r,ref:t})},`AlertDialogTitle`)),dx=L.forwardRef(ex(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=rx(n);return(0,R.jsx)(Yb,{...i,...r,ref:t})},`AlertDialogDescription`)),fx=L.forwardRef(ex(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=rx(n);return(0,R.jsx)(Zb,{...i,...r,ref:t})},`AlertDialogAction`)),px=`AlertDialogCancel`,mx=L.forwardRef(ex(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=cx(px,n),a=rx(n),o=Kn(t,i);return(0,R.jsx)(Zb,{...a,...r,ref:o})},`AlertDialogCancel`)),hx=ix,gx=ax,_x=ox,vx=lx,yx=fx,bx=mx,xx=ux,Sx=dx,Cx=hx,wx=gx,Tx=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(_x,{className:U(`fixed inset-0 z-50 bg-black/70 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));Tx.displayName=_x.displayName;var Ex=L.forwardRef(({className:e,...t},n)=>(0,R.jsxs)(wx,{children:[(0,R.jsx)(Tx,{}),(0,R.jsx)(vx,{ref:n,className:U(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-card p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));Ex.displayName=vx.displayName;var Dx=({className:e,...t})=>(0,R.jsx)(`div`,{className:U(`flex flex-col gap-2 text-left`,e),...t});Dx.displayName=`AlertDialogHeader`;var Ox=({className:e,...t})=>(0,R.jsx)(`div`,{className:U(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t});Ox.displayName=`AlertDialogFooter`;var kx=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(xx,{ref:n,className:U(`font-serif text-[20px] leading-tight text-foreground`,e),...t}));kx.displayName=xx.displayName;var Ax=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Sx,{ref:n,className:U(`font-mono text-[12px] text-[var(--fg-muted)]`,e),...t}));Ax.displayName=Sx.displayName;var jx=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(yx,{ref:n,className:U(Ri(),e),...t}));jx.displayName=yx.displayName;var Mx=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(bx,{ref:n,className:U(Ri({variant:`secondary`}),`mt-2 sm:mt-0`,e),...t}));Mx.displayName=bx.displayName;var Nx={paused:{title:`Pause SolverNet`,body:`The generator will stop posting new Tasks. Existing Tasks continue through their normal lifecycle. You can resume any time.`,confirmLabel:`Pause`},launched:{title:`Resume SolverNet`,body:`The generator will resume polling and posting new Tasks at the configured cadence.`,confirmLabel:`Resume`},retired:{title:`Retire SolverNet`,body:`Retirement is permanent. The SolverNet stops accepting new work and disappears from the operator catalog. Historical Tasks, solutions, and verdicts remain discoverable. Type the SolverNet name to confirm.`,confirmLabel:`Retire permanently`,danger:!0}};function Px({open:e,target:t,solverNetName:n,onConfirm:r,onCancel:i,pending:a=!1,errorMessage:o}){let[s,c]=(0,L.useState)(``);(0,L.useEffect)(()=>{e||c(``)},[e,t]);let l=Nx[t],u=t===`retired`,d=!u||s.trim().toLowerCase()===n.trim().toLowerCase(),f=a||!d;return(0,R.jsx)(Cx,{open:e,onOpenChange:e=>{!e&&!a&&i()},children:(0,R.jsxs)(Ex,{"data-testid":`launcher-launched-dialog`,"data-target":t,className:U(`gap-4`,l.danger&&`border-destructive`),children:[(0,R.jsxs)(Dx,{children:[(0,R.jsx)(kx,{className:U(l.danger&&`text-destructive`),children:l.title}),(0,R.jsx)(Ax,{children:l.body})]}),u&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(Kf,{htmlFor:`launcher-launched-dialog-typed`,className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,children:[`Type`,` `,(0,R.jsx)(`span`,{className:`text-foreground`,children:n}),` to confirm`]}),(0,R.jsx)(s_,{id:`launcher-launched-dialog-typed`,"data-testid":`launcher-launched-dialog-typed`,type:`text`,autoFocus:!0,value:s,onChange:e=>c(e.target.value),disabled:a,className:U(d&&`border-[var(--vow-green)]`)})]}),o&&(0,R.jsx)(`span`,{"data-testid":`launcher-launched-dialog-error`,className:`font-mono text-[12px] text-destructive`,children:o}),(0,R.jsxs)(Ox,{children:[(0,R.jsx)(Mx,{"data-testid":`launcher-launched-dialog-cancel`,onClick:e=>{e.preventDefault(),i()},disabled:a,children:`Cancel`}),(0,R.jsx)(jx,{"data-testid":`launcher-launched-dialog-confirm`,onClick:e=>{if(f){e.preventDefault();return}e.preventDefault(),r()},disabled:f,className:U(l.danger&&`border border-destructive bg-transparent text-destructive hover:bg-[var(--severity-blocking-bg)]`),children:a?`${l.confirmLabel}…`:l.confirmLabel})]})]})})}function Fx({record:e,manifest:t,fetchLauncherStatus:n}){let r=n??(()=>B.fetchLauncherStatus()),{data:i,isLoading:a,isError:o}=ut({queryKey:[`launcher-status`,e.solverNetId],queryFn:()=>r(),refetchInterval:3e4}),s=t?`${t.contract.id}.${t.contract.version}`:e.summary?`${e.summary.contractId}.${e.summary.contractVersion}`:void 0,c=s?i?.nets.find(n=>n.solverType===s||n.name===(t?.name??e.summary?.name)):void 0,l=c?.budget.safeBalanceWei,u=c?.budget.safeAddress??e.launcherSafeAddress,d=t?.solutionPriceWei??e.summary?.solutionPriceWei,f=t?.verdictPriceWei??e.summary?.verdictPriceWei,p=fv(l,d,f);return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{"data-testid":`launcher-launched-spend-panel`,role:`region`,"aria-label":`Spend and runway`,className:`flex flex-col gap-3 p-6`,children:[(0,R.jsx)(`header`,{className:`flex items-center justify-between gap-3`,children:(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[22px] font-normal text-foreground`,children:`Spend & runway`})}),(0,R.jsxs)(`dl`,{className:`m-0 grid gap-y-2 gap-x-4 [grid-template-columns:repeat(auto-fit,minmax(220px,1fr))]`,children:[(0,R.jsx)(Ix,{label:`Safe address`,value:ov(u),tooltip:u,testid:`launcher-launched-spend-safe-address`}),(0,R.jsx)(Ix,{label:`Safe balance`,value:a?`—`:l?uv(l):`unavailable`,tooltip:l?`${l} wei`:void 0,testid:`launcher-launched-spend-safe-balance`}),(0,R.jsx)(Ix,{label:`Solution price`,value:d?uv(d):`—`,tooltip:d?`${d} wei`:void 0,testid:`launcher-launched-spend-solution-price`}),(0,R.jsx)(Ix,{label:`Verdict price`,value:f?uv(f):`—`,tooltip:f?`${f} wei`:void 0,testid:`launcher-launched-spend-verdict-price`}),(0,R.jsx)(Ix,{label:`Per-Task cost`,value:p?uv(p.perTaskWei.toString()):`—`,tooltip:p?`${p.perTaskWei.toString()} wei`:void 0,testid:`launcher-launched-spend-per-task`}),(0,R.jsx)(Ix,{label:`Projected runway`,value:p?`${p.tasks.toLocaleString()} Tasks at current prices`:`manifest or balance unavailable`,testid:`launcher-launched-spend-runway`})]}),o&&(0,R.jsx)(`span`,{"data-testid":`launcher-launched-spend-error`,className:`font-mono text-[12px] text-destructive`,children:`Failed to load Safe balance.`}),p?.lowRunway&&(0,R.jsxs)(`span`,{"data-testid":`launcher-launched-spend-low-runway`,className:`font-mono text-[12px] text-[var(--wane)]`,children:[`Runway low — under `,100 .toLocaleString(),` Tasks remain at current prices. Top up your wallet from the Overview faucet — the daemon forwards ETH to the Safe automatically. This panel has no local top-up action.`]}),(0,R.jsx)(`p`,{className:`m-0 font-mono text-[11px] leading-relaxed text-[var(--fg-dim)]`,children:`Runway projects how many Tasks the Safe can fund at the current manifest prices, including the expected claim-tx gas per Task.`})]})})}function Ix({label:e,value:t,testid:n,tooltip:r}){let i=(0,R.jsx)(`dd`,{"data-testid":n,className:`m-0 truncate font-mono text-[13px] text-foreground`,tabIndex:r?0:void 0,children:t});return(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,R.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:e}),r?(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:i}),(0,R.jsx)(nd,{children:r})]}):i]})}var Lx={paused:`Pause`,launched:`Resume`,retired:`Retire`},Rx={launching:{variant:`default`,label:`Launching`},launched:{variant:`success`,label:`Launched`},paused:{variant:`pill`,label:`Paused`},retired:{variant:`outline`,label:`Retired`},failed:{variant:`destructive`,label:`Failed`}};function zx({record:e,manifest:t,operatorCount:n,onAction:r,pending:i}){let a=Rx[e.status]??Rx.launching,o=cv[e.status]??[],s=t?.name??e.summary?.name??e.solverNetId;return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{"data-testid":`launcher-launched-status-header`,"data-status":e.status,role:`region`,"aria-label":`SolverNet status header`,className:`flex flex-col gap-4 p-6`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,R.jsx)(`h1`,{"data-testid":`launcher-launched-name`,className:`m-0 font-serif text-[32px] font-normal tracking-[-0.01em] text-foreground`,children:s}),(0,R.jsx)(q,{"data-testid":`launcher-launched-status-badge`,variant:a.variant,className:`whitespace-nowrap`,children:a.label})]}),t?.description&&(0,R.jsx)(`p`,{className:`m-0 max-w-[720px] text-[13px] leading-relaxed text-[var(--fg-muted)]`,children:t.description})]}),(0,R.jsx)(Vx,{allowed:o,onAction:r,pending:i??null,terminal:e.status===`retired`,launching:e.status===`launching`})]}),(0,R.jsx)(Ah,{}),(0,R.jsxs)(`dl`,{className:`m-0 grid gap-y-2 gap-x-4 [grid-template-columns:repeat(auto-fit,minmax(220px,1fr))]`,children:[(0,R.jsx)(Bx,{label:`SolverNet id`,value:e.solverNetId,testid:`launcher-launched-solvernet-id`}),(0,R.jsx)(Bx,{label:`Manifest cid`,value:av(e.manifestCid),testid:`launcher-launched-manifest-cid`,additionalTestIds:[`manifest-cid`],tooltip:e.manifestCid}),(0,R.jsx)(Bx,{label:`Launcher Safe`,value:ov(e.launcherSafeAddress),testid:`launcher-launched-safe`,tooltip:e.launcherSafeAddress}),(0,R.jsx)(Bx,{label:`Launcher agent`,value:e.launcherAgentId,testid:`launcher-launched-agent`}),n!==void 0&&(0,R.jsx)(Bx,{label:`Operators`,value:String(n),testid:`launcher-launched-operator-count`,additionalTestIds:[`operator-count`],tooltip:`Distinct operators that have ever claimed a task on this SolverNet, including on finalized or refunded tasks`})]})]})})}function Bx({label:e,value:t,testid:n,additionalTestIds:r,tooltip:i}){let a=(0,R.jsxs)(`dd`,{"data-testid":n,className:`m-0 truncate font-mono text-[13px] text-foreground`,tabIndex:i?0:void 0,children:[t,r?.map(e=>(0,R.jsx)(`span`,{"data-testid":e,className:`hidden`,"aria-hidden":`true`,children:t},e))]});return(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,R.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:e}),i?(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:a}),(0,R.jsx)(nd,{children:i})]}):a]})}function Vx({allowed:e,onAction:t,pending:n,terminal:r,launching:i}){return r?(0,R.jsx)(q,{"data-testid":`launcher-launched-terminal-pill`,variant:`outline`,className:`self-start whitespace-nowrap`,children:`Retired — no further actions`}):i?(0,R.jsx)(q,{"data-testid":`launcher-launched-launching-pill`,variant:`outline`,className:`self-start whitespace-nowrap border-primary text-primary`,children:`Launching…`}):e.length===0?null:(0,R.jsx)(`div`,{"data-testid":`launcher-launched-actions`,className:`flex flex-wrap gap-2 self-start`,children:e.map(e=>{let r=Lx[e],i=n===e;return(0,R.jsx)(W,{type:`button`,variant:e===`retired`?`destructive`:`default`,"data-testid":`launcher-launched-action-${e}`,onClick:()=>t(e),disabled:n!==null,className:n!==null&&!i?`opacity-60`:void 0,children:i?`${r}…`:r},e)})})}var Hx=5,Ux={open:{variant:`default`,label:`Open`},"claims-in-flight":{variant:`default`,label:`In flight`},"fully-claimed":{variant:`success`,label:`Claimed`},settled:{variant:`success`,label:`Settled`},failed:{variant:`destructive`,label:`Failed`}},Wx={finalized:{variant:`success`,label:`Finalized`},open:{variant:`outline`,label:`Open`},expired:{variant:`warning`,label:`Expired`}};function Gx({record:e,fetchTasks:t}){let[n,r]=(0,L.useState)([void 0]),i=n[n.length-1],a=t??(e=>B.fetchLauncherTasks(e)),{data:o,isLoading:s,isError:c,error:l,refetch:u}=ut({queryKey:[`launcher-tasks`,e.solverNetId,e.manifestCid,i??null],queryFn:()=>a({cursor:i,limit:Hx,manifestCid:e.manifestCid}),refetchInterval:15e3});return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(G,{"data-testid":`launcher-launched-tasks-panel`,role:`region`,"aria-label":`Recent posted Tasks`,className:`flex flex-col gap-3 p-6`,children:[(0,R.jsxs)(`header`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[22px] font-normal text-foreground`,children:`Recent posted Tasks`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-launched-tasks-refresh`,onClick:()=>{u()},children:`Refresh`})]}),s&&(0,R.jsx)(`p`,{"data-testid":`launcher-launched-tasks-loading`,className:`m-0 font-mono text-[12px] text-[var(--fg-muted)]`,children:`Loading…`}),c&&(0,R.jsxs)(`div`,{"data-testid":`launcher-launched-tasks-error`,className:`font-mono text-[12px] text-destructive`,children:[`Failed to load tasks: `,l instanceof Error?l.message:`unknown error`]}),!s&&!c&&o&&o.tasks.length===0&&(0,R.jsx)(Yx,{}),!s&&!c&&o&&o.tasks.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{"data-testid":`launcher-launched-tasks-list`,className:`overflow-hidden rounded-md border border-border`,children:(0,R.jsxs)($h,{className:`table-fixed`,children:[(0,R.jsx)(eg,{children:(0,R.jsxs)(rg,{className:`bg-[var(--bg)] hover:bg-[var(--bg)]`,children:[(0,R.jsx)(ig,{className:`w-[30%]`,children:`Task`}),(0,R.jsx)(ig,{className:`w-[16%]`,children:`SolverType`}),(0,R.jsx)(ig,{className:`w-[20%]`,children:`Posted`}),(0,R.jsx)(ig,{className:`w-[14%]`,children:`Local State`}),(0,R.jsx)(ig,{className:`w-[20%] text-right`,children:`Claims / On-chain`})]})}),(0,R.jsx)(tg,{children:o.tasks.map(e=>(0,R.jsx)(Kx,{task:e},e.taskId))})]})}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-launched-tasks-prev`,onClick:()=>{r(e=>e.length>1?e.slice(0,-1):e)},disabled:n.length<=1,children:`← Newer`}),(0,R.jsxs)(`span`,{className:`m-0 font-mono text-[12px] text-[var(--fg-muted)]`,children:[`Page `,n.length,o.tasks.length<Hx&&o.cursor===void 0?` · end`:``]}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-launched-tasks-next`,onClick:()=>{o?.cursor?.before&&r(e=>[...e,o.cursor.before])},disabled:!o.cursor?.before,children:`Older →`})]})]})]})})}function Kx({task:e}){let t=Ux[e.state]??{variant:`secondary`,label:e.state},n=e.summary?.title??av(e.taskCid),r=e.solverType??e.solverNet,i=qx(e.onchainStatus);return(0,R.jsxs)(rg,{"data-testid":`launcher-launched-task-row`,"data-task-id":e.taskId,children:[(0,R.jsx)(ag,{className:`font-mono text-[13px] text-foreground`,children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`span`,{className:`block truncate`,tabIndex:0,children:n})}),(0,R.jsx)(nd,{children:e.taskCid})]})}),(0,R.jsx)(ag,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:(0,R.jsxs)(ed,{children:[(0,R.jsx)(td,{asChild:!0,children:(0,R.jsx)(`span`,{className:`block truncate`,tabIndex:0,children:r})}),(0,R.jsx)(nd,{children:r})]})}),(0,R.jsx)(ag,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:sv(e.postedAt)}),(0,R.jsx)(ag,{children:(0,R.jsx)(q,{variant:t.variant,className:`normal-case tracking-[0.1em]`,children:t.label})}),(0,R.jsx)(ag,{className:`text-right font-mono text-[12px] text-[var(--fg-muted)]`,children:(0,R.jsxs)(`span`,{className:`inline-flex items-center justify-end gap-2`,children:[(0,R.jsxs)(`span`,{children:[e.claims.current,` / `,e.claims.max]}),(0,R.jsx)(Jx,{status:i})]})})]})}function qx(e){return e===`finalized`||e===`open`||e===`expired`?e:`unknown`}function Jx({status:e}){if(e===`unknown`)return(0,R.jsx)(`span`,{"data-testid":`launcher-launched-task-onchain`,"aria-label":`On-chain status unknown`,className:`text-[var(--fg-muted)]`,children:`—`});let t=Wx[e];return(0,R.jsx)(q,{"data-testid":`launcher-launched-task-onchain`,"aria-label":`On-chain status: ${t.label}`,variant:t.variant,className:`rounded-sm normal-case tracking-[0.1em]`,children:t.label})}function Yx(){return(0,R.jsx)(`div`,{"data-testid":`launcher-launched-tasks-empty`,className:`rounded-md border border-dashed border-border p-6 text-center font-mono text-[13px] text-[var(--fg-muted)]`,children:`Tasks will appear here after the first generator poll posts a Task.`})}var Xx=2500,Zx=3e4,Qx=`mx-auto flex max-w-[960px] flex-col gap-4 p-6`;function $x({pollIntervalMs:e=Xx,navigateTo:t,solverNetId:n}={}){let r=Wt(),[,i]=Kt(),a=t??i,o=Ye(),s=n??r.solverNetId,c=ut({queryKey:[`solvernets`,`launched`,s],queryFn:()=>B.solvernets.get(s),refetchInterval:e,enabled:!!s}),l=c.data?.manifestCid,u=ut({queryKey:[`solvernets`,`manifest`,l],queryFn:()=>B.solvernets.getManifest(l),enabled:!!l,staleTime:1/0}),d=ut({queryKey:[`solvernets`,`operator-count`,l],queryFn:async()=>(await B.discovery.getSolverNetOperatorCount(l)).operatorCount,enabled:!!l,refetchInterval:Zx}),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)(null),g=dt({mutationFn:({target:e})=>B.solvernets.transitionLifecycle(s,e),onSuccess:async e=>{await o.cancelQueries({queryKey:[`solvernets`,`launched`,s]}),o.setQueryData([`solvernets`,`launched`,s],e),p(null),h(null)},onError:e=>{h(e instanceof Error?e.message:String(e))}}),_=dt({mutationFn:e=>B.solvernets.updateGeneratorConfig(s,e),onSuccess:()=>{o.invalidateQueries({queryKey:[`solvernets`,`launched`,s]})}});if(!s)return(0,R.jsx)(`main`,{"data-testid":`launcher-launched-missing-id`,className:Qx,children:(0,R.jsx)(nS,{message:`No solverNetId supplied.`,onBack:()=>a(`/launcher`)})});if(c.isLoading)return(0,R.jsx)(`main`,{"data-testid":`launcher-launched-loading`,className:Qx,children:(0,R.jsx)(`p`,{className:`m-0 font-mono text-[13px] text-[var(--fg-muted)]`,children:`Loading…`})});if(c.isError||!c.data){let e=c.error instanceof Error?c.error.message:`Unknown error`;return(0,R.jsx)(`main`,{"data-testid":`launcher-launched-error`,className:Qx,children:(0,R.jsx)(nS,{message:`Failed to load SolverNet: ${e}`,onBack:()=>a(`/launcher`),onRetry:()=>{c.refetch()}})})}let v=c.data,y=u.data?.manifest,b=tS(v,y),x=y?.name??v.summary?.name??v.solverNetId;return(0,R.jsxs)(`main`,{"data-testid":`launcher-launched`,"data-solvernet-id":s,className:Qx,children:[(0,R.jsx)(zx,{record:v,manifest:y,operatorCount:d.data,onAction:e=>{h(null),p(e)},pending:g.isPending?g.variables?.target??null:null}),(0,R.jsx)(wv,{record:v,manifest:y,template:b,onSave:async e=>{await _.mutateAsync(e)}}),(0,R.jsx)(Fx,{record:v,manifest:y}),(0,R.jsx)(Gx,{record:v}),u.isError&&(0,R.jsxs)(`p`,{"data-testid":`launcher-launched-manifest-error`,className:`m-0 font-mono text-[12px] text-destructive`,children:[`Failed to load manifest:`,` `,eS(u.error)]}),(0,R.jsx)(Px,{open:f!==null,target:f??`paused`,solverNetName:x,pending:g.isPending,errorMessage:m??void 0,onCancel:()=>{g.isPending||(p(null),h(null))},onConfirm:()=>{f&&g.mutate({target:f})}})]})}function eS(e){let t=e instanceof Error?e.message:String(e??`unknown error`);return/404|manifest_not_found|registry_unavailable/i.test(t)?`Manifest unavailable from local cache or registry (${t})`:t}function tS(e,t){let n=t?.contract??(e.summary?{id:e.summary.contractId,version:e.summary.contractVersion}:void 0);if(n)return g_[`${n.id}.${n.version}`]}function nS({message:e,onBack:t,onRetry:n}){return(0,R.jsxs)(fo,{variant:`blocking`,className:`flex items-center justify-between gap-4 border-l-0 border border-destructive p-4`,children:[(0,R.jsx)(mo,{className:`font-mono text-[13px] text-destructive`,children:e}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[n&&(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-launched-error-retry`,onClick:n,children:`Retry`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`launcher-launched-error-back`,onClick:t,children:`Back to launcher`})]})]})}var rS=`curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash`,iS=`m-0 overflow-x-auto whitespace-pre-wrap break-all rounded-sm border border-border bg-[var(--bg-sunken)] p-2.5 font-mono text-[12px] text-foreground`;function aS({onSuccess:e,onCancel:t}){let[n,r]=(0,L.useState)(`checking`),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(``),c=()=>{r(`checking`),B.hermesDoctor().then(t=>{if(!t.installed){r(`not-installed`);return}if(t.exitCode!==0){r(`config-issue`),a(t.stderr);return}r(`ok`),e()}).catch(e=>{s(e instanceof Error?e.message:String(e)),r(`network-error`)})};return(0,L.useEffect)(()=>{c()},[]),n===`checking`?(0,R.jsxs)(G,{"data-testid":`hermes-precheck-checking`,className:`flex flex-col gap-3 p-4`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,children:`Hermes install check`}),(0,R.jsx)(`p`,{className:`m-0 font-mono text-[12px] text-[var(--fg-muted)]`,children:`Checking hermes install…`})]}):n===`not-installed`?(0,R.jsxs)(G,{"data-testid":`hermes-precheck-not-installed`,className:`flex flex-col gap-3 p-4`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,children:`Hermes Agent not installed`}),(0,R.jsx)(`p`,{className:`m-0 font-mono text-[13px] text-foreground`,children:`Hermes Agent is not installed on this machine. Run this command in your terminal, then click Retry:`}),(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(`pre`,{className:`${iS} flex-1`,children:rS}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`hermes-precheck-copy-install`,"aria-label":`Copy install command`,onClick:()=>{typeof navigator<`u`&&navigator.clipboard&&navigator.clipboard.writeText(rS).catch(()=>{})},children:`Copy`})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(W,{type:`button`,variant:`outline`,"data-testid":`hermes-precheck-retry`,onClick:c,children:`I've installed Hermes — retry precheck`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`hermes-precheck-cancel`,onClick:t,children:`Cancel`})]})]}):n===`network-error`?(0,R.jsxs)(fo,{"data-testid":`hermes-precheck-network-error`,variant:`blocking`,className:`flex flex-col gap-3 border-l-0 border border-destructive p-4`,children:[(0,R.jsx)(po,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,children:`Hermes precheck failed`}),(0,R.jsxs)(mo,{className:`font-mono text-[13px] text-foreground`,children:[`Could not reach the daemon API to run `,(0,R.jsx)(`code`,{children:`hermes doctor`}),`. Check that the daemon is running and the UI token is valid.`]}),o?(0,R.jsx)(`pre`,{className:iS,children:o}):null,(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(W,{type:`button`,variant:`outline`,"data-testid":`hermes-precheck-retry`,onClick:c,children:`Retry precheck`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`hermes-precheck-cancel`,onClick:t,children:`Cancel`})]})]}):n===`config-issue`?(0,R.jsxs)(fo,{"data-testid":`hermes-precheck-config-issue`,variant:`warning`,className:`flex flex-col gap-3 border-l-0 border border-[var(--severity-warning-fg)] p-4`,children:[(0,R.jsx)(po,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,children:`Hermes Agent configuration issue`}),(0,R.jsx)(mo,{className:`font-mono text-[13px] text-foreground`,children:`Hermes is installed but reports configuration issues:`}),(0,R.jsx)(`pre`,{className:iS,children:i||`(no diagnostic output)`}),(0,R.jsxs)(`p`,{className:`m-0 font-mono text-[12px] text-[var(--fg-muted)]`,children:[`Run `,(0,R.jsx)(`code`,{children:`hermes model`}),` or `,(0,R.jsx)(`code`,{children:`hermes setup`}),` to configure a provider, then retry.`]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(W,{type:`button`,variant:`outline`,"data-testid":`hermes-precheck-retry`,onClick:c,children:`Retry precheck`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`hermes-precheck-cancel`,onClick:t,children:`Cancel`})]})]}):(0,R.jsx)(R.Fragment,{})}var oS=Object.defineProperty,sS=(e,t)=>oS(e,`name`,{value:t,configurable:!0}),cS=`Popover`,[lS,uS]=ra(cS,[Ll]),dS=Ll(),[fS,pS]=lS(cS),mS=sS(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=dS(t),c=L.useRef(null),[l,u]=L.useState(!1),[d,f]=su({prop:r,defaultProp:i??!1,onChange:a,caller:cS});return(0,R.jsx)(Xl,{...s,children:(0,R.jsx)(fS,{scope:t,contentId:ys(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:L.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:L.useCallback(()=>u(!0),[]),onCustomAnchorRemove:L.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),hS=`PopoverTrigger`,gS=L.forwardRef(sS(function(e,t){let{__scopePopover:n,...r}=e,i=pS(hS,n),a=dS(n),o=Kn(t,i.triggerRef),s=(0,R.jsx)(Gi.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":DS(i.open),...r,ref:o,onClick:K(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,R.jsx)(Zl,{asChild:!0,...a,children:s})},`PopoverTrigger`)),_S=`PopoverPortal`,[vS,yS]=lS(_S,{forceMount:void 0}),bS=sS(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=pS(_S,t);return(0,R.jsx)(vS,{scope:t,forceMount:n,children:(0,R.jsx)(Zi,{present:n||a.open,children:(0,R.jsx)(eu,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),xS=`PopoverContent`,SS=L.forwardRef(sS(function(e,t){let n=yS(xS,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=pS(xS,e.__scopePopover);return(0,R.jsx)(Zi,{present:r||a.open,children:a.modal?(0,R.jsx)(wS,{...i,ref:t}):(0,R.jsx)(TS,{...i,ref:t})})},`PopoverContent`)),CS=qn(`PopoverContent.RemoveScroll`),wS=L.forwardRef(sS(function(e,t){let n=pS(xS,e.__scopePopover),r=L.useRef(null),i=Kn(t,r),a=L.useRef(!1);return L.useEffect(()=>{let e=r.current;if(e)return Sb(e)},[]),(0,R.jsx)(pb,{as:CS,allowPinchZoom:!0,children:(0,R.jsx)(ES,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:K(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:K(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:K(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),TS=L.forwardRef(sS(function(e,t){let n=pS(xS,e.__scopePopover),r=L.useRef(!1),i=L.useRef(!1);return(0,R.jsx)(ES,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),ES=L.forwardRef(sS(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=pS(xS,n),p=dS(n);return ry(),(0,R.jsx)(Uv,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,R.jsx)(us,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,R.jsx)(Ql,{"data-state":DS(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function DS(e){return e?`open`:`closed`}sS(DS,`getState`);var OS=mS,kS=gS,AS=bS,jS=SS,MS=OS,NS=kS,PS=L.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,R.jsx)(AS,{children:(0,R.jsx)(jS,{ref:i,align:t,sideOffset:n,className:U(`z-50 w-72 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,e),...r})}));PS.displayName=jS.displayName;var FS=[{name:`network-tools`,version:`0.1.0`,source:`bundled`,defaultIncluded:!0,description:`Jinn runtime tools`},{name:`claude-code-learner`,version:`0.2.0`,source:`bundled`,defaultIncluded:!0,description:`Learner loop`}];function IS(e){return bd(e)===`hermes-agent`?FS.filter(e=>e.name!==`claude-code-learner`):FS}var LS=new Set([`swe-rebench-v2-runtime`]),RS={"network-tools":`Network Tools`,"claude-code-learner":`Learner`,"swe-rebench-v2-runtime":`SWE-rebench v2 Runtime`,"jinn-prediction-plugin":`Prediction Runtime`},zS=`bundled:`;function BS(e){return RS[e]??e}function VS(e){return e.startsWith(zS)?e.slice(8):e}function HS(e){return e.source===`bundled`?`${zS}${e.name}`:e.name}function US(e){let t=new Set,n=[];for(let r of e){let e=VS(r);t.has(e)||(t.add(e),n.push(r))}return n}function WS(e,t,n){let r=new Set,i=[];for(let e of IS(n))r.add(e.name),i.push(e);for(let t of e){if(r.has(t.name))continue;r.add(t.name);let e=LS.has(t.name);i.push({...t,...e?{defaultIncluded:!0}:{recommended:!0},description:t.name===`swe-rebench-v2-runtime`?`SWE-rebench v2 runtime`:`Recommended for this SolverNet`})}for(let e of t){let t=VS(e);r.has(t)||(r.add(t),i.push({name:t,version:`configured`,source:e.startsWith(zS)?`bundled`:`custom`,description:`Already configured`}))}return i}function GS(e){let t=[e.source,e.version];return e.description&&t.push(e.description),t.join(` · `)}function KS({available:e,selected:t,disabledDefaultPlugins:n=[],onChange:r,rowTestId:i,searchTestId:a,harness:o}){let[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null),p=(0,L.useMemo)(()=>WS(e,t,o),[e,t,o]),m=new Set(t.map(VS)),h=new Set(n.map(VS)),g=new Set(m);for(let e of p)e.defaultIncluded&&!h.has(e.name)&&g.add(e.name);let _=p.filter(e=>g.has(e.name)),v=_.filter(e=>e.defaultIncluded).length,y=_.length-v,b=p.filter(e=>!g.has(e.name)),x=s.trim().toLowerCase(),S=x?b.filter(e=>`${e.name} ${BS(e.name)} ${e.source} ${e.description??``}`.toLowerCase().includes(x)):b,C=e=>{let i=e.defaultIncluded?n.filter(t=>VS(t)!==e.name):n;r(e.defaultIncluded?t:US([...t,HS(e)]),i),u(!1),c(``)},w=e=>{if(e.defaultIncluded){f(e),u(!1),c(``);return}r(t.filter(t=>VS(t)!==e.name),n)};return(0,R.jsxs)(`div`,{className:`relative flex flex-col gap-2`,children:[(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:_.map(e=>(0,R.jsxs)(`span`,{"data-testid":`${i}-chip`,"data-plugin":e.name,className:U(`inline-flex items-center gap-1.5 rounded-full border border-border px-2 py-[5px] pl-2.5 font-mono text-[11px] text-foreground`,e.defaultIncluded?`bg-sunken`:`bg-transparent`),children:[(0,R.jsxs)(`span`,{children:[BS(e.name),(0,R.jsx)(`span`,{className:`text-dim`,children:e.defaultIncluded?` · default`:` · selected`})]}),(0,R.jsx)(W,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Remove ${BS(e.name)}`,"data-testid":`${i}-remove`,"data-plugin":e.name,onClick:()=>w(e),className:`h-5 w-5 rounded-full p-0 text-muted-foreground hover:bg-transparent hover:text-foreground`,children:(0,R.jsx)(Hn,{"aria-hidden":`true`,className:`!size-3`})})]},e.name))}),d&&(0,R.jsxs)(`div`,{role:`alertdialog`,"data-testid":`${i}-default-warning`,className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-md border border-wane bg-card px-3 py-2.5 font-mono`,children:[(0,R.jsxs)(`span`,{className:`text-[12px] text-foreground`,children:[BS(d.name),` is part of the default operator baseline. Removing it may break standard SolverNet workflows.`]}),(0,R.jsxs)(`span`,{className:`flex gap-2`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`${i}-default-warning-cancel`,onClick:()=>f(null),children:`Keep`}),(0,R.jsx)(W,{type:`button`,variant:`destructive`,size:`sm`,"data-testid":`${i}-default-warning-confirm`,onClick:()=>{d&&(r(t,US([...n,d.name])),f(null))},children:`Remove`})]})]}),(0,R.jsxs)(MS,{open:l,onOpenChange:e=>{u(e),e||c(``)},children:[(0,R.jsx)(NS,{asChild:!0,children:(0,R.jsxs)(W,{type:`button`,variant:`outline`,"data-testid":`${i}-trigger`,"aria-haspopup":`listbox`,className:`grid h-auto grid-cols-[minmax(0,1fr)_auto] items-center gap-3 border-border bg-background px-3 py-2.5 text-left font-mono text-[12px] normal-case tracking-normal text-foreground hover:bg-sunken hover:text-foreground`,children:[(0,R.jsxs)(`span`,{className:`min-w-0`,children:[`Add plugin`,(0,R.jsxs)(`span`,{className:`text-dim`,children:[` `,`· `,v,` default`,y>0?` · ${y} selected`:``]})]}),l?(0,R.jsx)(Cn,{"aria-hidden":`true`,className:`!size-3.5 text-muted-foreground`}):(0,R.jsx)(xn,{"aria-hidden":`true`,className:`!size-3.5 text-muted-foreground`})]})}),(0,R.jsxs)(PS,{align:`start`,sideOffset:6,className:`w-[min(28rem,90vw)] overflow-hidden p-0`,children:[(0,R.jsx)(s_,{type:`search`,autoFocus:!0,"aria-label":`Search plugins`,"data-testid":a,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(u(!1),c(``))},placeholder:`Search plugins`,className:`h-auto rounded-none border-0 border-b border-border bg-background px-3 py-2.5 text-[12px] focus-visible:ring-0`}),(0,R.jsx)(io,{className:`max-h-60`,children:(0,R.jsx)(`div`,{role:`listbox`,"aria-label":`Plugins`,className:`flex flex-col`,children:S.length===0?(0,R.jsx)(`span`,{className:`px-3.5 py-3 font-mono text-[12px] text-dim`,children:b.length===0?`No plugins available to add.`:`No matching plugins.`}):S.map((e,t)=>{let n=g.has(e.name),r=e.defaultIncluded?`text-dim`:e.recommended?`text-primary`:`text-muted-foreground`;return(0,R.jsxs)(W,{type:`button`,variant:`ghost`,role:`option`,"aria-selected":n,"data-testid":i,"data-plugin":e.name,"data-plugin-active":n?`true`:`false`,"data-plugin-default":e.defaultIncluded?`true`:`false`,onClick:()=>C(e),className:U(`grid h-auto w-full grid-cols-[minmax(0,1fr)_auto] gap-3 rounded-none px-3 py-2.5 text-left font-mono normal-case tracking-normal transition-colors`,t===0?``:`border-t border-border`,n?`bg-sunken text-foreground`:`bg-transparent text-foreground`,`hover:bg-sunken focus-visible:bg-sunken`),children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,R.jsx)(`span`,{className:`text-[13px] text-foreground`,children:BS(e.name)}),(0,R.jsx)(`span`,{className:`text-[11px] text-dim`,children:GS(e)})]}),(0,R.jsx)(`span`,{className:U(`self-center text-[11px] uppercase`,r),children:e.defaultIncluded?`Default`:e.recommended?`Recommended`:`Add`})]},e.name)})})})]})]})]})}var qS={"claude-opus-4-7":{provider:`anthropic`,inputPer1kTokens:.015,outputPer1kTokens:.075,typicalInputTokens:5e4,typicalOutputTokens:2e4},"claude-sonnet-4-6":{provider:`anthropic`,inputPer1kTokens:.003,outputPer1kTokens:.015,typicalInputTokens:5e4,typicalOutputTokens:2e4},"claude-haiku-4-5-20251001":{provider:`anthropic`,inputPer1kTokens:.001,outputPer1kTokens:.005,typicalInputTokens:5e4,typicalOutputTokens:2e4},"anthropic/claude-opus-4.7":{provider:`openrouter`,inputPer1kTokens:.015,outputPer1kTokens:.075,typicalInputTokens:5e4,typicalOutputTokens:2e4},"anthropic/claude-sonnet-4.6":{provider:`openrouter`,inputPer1kTokens:.003,outputPer1kTokens:.015,typicalInputTokens:5e4,typicalOutputTokens:2e4},"gpt-5.4":{provider:`openai`,inputPer1kTokens:.00125,outputPer1kTokens:.01,typicalInputTokens:5e4,typicalOutputTokens:2e4},"gpt-5.4-mini":{provider:`openai`,inputPer1kTokens:25e-5,outputPer1kTokens:.002,typicalInputTokens:5e4,typicalOutputTokens:2e4},"gpt-5.5":{provider:`openai`,inputPer1kTokens:.015,outputPer1kTokens:.06,typicalInputTokens:5e4,typicalOutputTokens:2e4},"gpt-5.3-codex":{provider:`openai`,inputPer1kTokens:.00125,outputPer1kTokens:.01,typicalInputTokens:5e4,typicalOutputTokens:2e4},"gpt-5.3-codex-spark":{provider:`openai`,inputPer1kTokens:.00125,outputPer1kTokens:.01,typicalInputTokens:5e4,typicalOutputTokens:2e4},"tencent/hy3-preview":{provider:`openrouter`,inputPer1kTokens:.003,outputPer1kTokens:.015,typicalInputTokens:5e4,typicalOutputTokens:2e4},"deepseek/deepseek-v4-pro":{provider:`openrouter`,inputPer1kTokens:.0014,outputPer1kTokens:.0028,typicalInputTokens:5e4,typicalOutputTokens:2e4},"deepseek/deepseek-v4-flash":{provider:`openrouter`,inputPer1kTokens:1e-4,outputPer1kTokens:4e-4,typicalInputTokens:5e4,typicalOutputTokens:2e4},"google/gemini-3.1-flash-lite":{provider:`openrouter`,inputPer1kTokens:1e-4,outputPer1kTokens:4e-4,typicalInputTokens:5e4,typicalOutputTokens:2e4},"moonshotai/kimi-k2.6":{provider:`openrouter`,inputPer1kTokens:6e-4,outputPer1kTokens:.0025,typicalInputTokens:5e4,typicalOutputTokens:2e4},"openrouter/owl-alpha":{provider:`openrouter`,inputPer1kTokens:.002,outputPer1kTokens:.008,typicalInputTokens:5e4,typicalOutputTokens:2e4},"minimax/minimax-m2.7":{provider:`openrouter`,inputPer1kTokens:8e-4,outputPer1kTokens:.0032,typicalInputTokens:5e4,typicalOutputTokens:2e4},"nousresearch/hermes-4-405b":{provider:`nous`,inputPer1kTokens:9e-4,outputPer1kTokens:9e-4,typicalInputTokens:5e4,typicalOutputTokens:2e4}};function JS(e){let t=qS[e];if(!t)return null;let n=t.typicalInputTokens/1e3*t.inputPer1kTokens,r=t.typicalOutputTokens/1e3*t.outputPer1kTokens;return{usd:n+r,inputUsd:n,outputUsd:r,typicalInputTokens:t.typicalInputTokens,typicalOutputTokens:t.typicalOutputTokens,entry:t}}function YS(e,t,n=1){if(!e)return{showEstimate:!1,estimate:null,requiresConfirmation:!1,suppressedReason:`Included in subscription, no per-task API cost.`};let r=t?JS(t):null;return r?.entry.subscriptionPath===!0?{showEstimate:!1,estimate:null,requiresConfirmation:!1,suppressedReason:`Included in subscription, no per-task API cost.`}:{showEstimate:!0,estimate:r,requiresConfirmation:r!==null&&r.usd>n,suppressedReason:null}}function XS(e){return Number.isFinite(e)?e===0?`$0`:e<.01?`<$0.01`:`$${e.toFixed(2)}`:`—`}function ZS({modelId:e,usesPaidApiKey:t,thresholdUsd:n=1,variant:r=`card`,testIdPrefix:i=`cost-estimate`}){let a=YS(t,e,n);if(!a.showEstimate)return(0,R.jsxs)(`div`,{"data-testid":`${i}-subscription`,"data-cost-mode":`subscription`,className:U(`flex items-center gap-2.5 font-mono`,r===`card`?`rounded-md border border-border bg-card px-3.5 py-2.5`:`py-1.5`),children:[(0,R.jsx)(On,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}),(0,R.jsx)(`span`,{className:`text-[12px] text-muted-foreground`,children:a.suppressedReason??`Included in subscription, no per-task API cost.`})]});let o=a.estimate,s=o?.usd??null,c=a.requiresConfirmation;return(0,R.jsxs)(`div`,{"data-testid":`${i}-panel`,"data-cost-mode":`paid-api`,"data-cost-usd":s===null?`unknown`:s.toFixed(4),"data-cost-high-cost":c?`true`:`false`,className:U(`flex flex-col gap-2 rounded-md border bg-card`,c?`border-destructive`:`border-border`,r===`card`?`px-4 py-3.5`:`gap-1 px-2.5 py-2`),children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Estimated cost per task`}),(0,R.jsx)(`span`,{"data-testid":`${i}-amount`,className:U(`font-mono font-medium`,r===`card`?`text-[18px]`:`text-[14px]`,c?`text-destructive`:`text-foreground`),children:s===null?`unavailable`:`~${XS(s)}`})]}),o&&(0,R.jsx)(`span`,{"data-testid":`${i}-heuristic`,className:`font-mono text-[11px] text-muted-foreground`,children:`Rough estimate — actual cost varies.`}),s===null&&(0,R.jsx)(`span`,{"data-testid":`${i}-unknown`,className:`font-mono text-[11px] text-muted-foreground`,children:`No pricing entry for this model id — confirm rates with your provider before joining.`}),c&&(0,R.jsxs)(`span`,{"data-testid":`${i}-warning`,className:`font-mono text-[11px] text-destructive`,children:[`This model is above $`,n.toFixed(2),`/task. You will be asked to confirm before joining.`]})]})}var QS={"claude-code-learner":`claude-code`,"codex-code-learner":`codex`};function $S(e){return QS[e]??e}var eC=.5,tC={units_per_block:100,units_per_week:2800};nC(tC.units_per_block),nC(tC.units_per_week);function nC(e){return Math.round(e/100*eC*1e6)}function rC(e,t,n){if(!e)return null;let r=$S(e);if(!(r===`claude-code`||r===`codex`||r===`hermes-agent`))return 0;if(!t)return null;let i=JS(t);return i?i.usd/eC*100:null}function iC(e){return e<1?e.toFixed(2):e<10?e.toFixed(1):Math.round(e).toString()}function aC({harness:e,modelId:t,variant:n=`card`,testIdPrefix:r=`harness-footprint`}){let i=rC(e,t);if(i===0)return null;if(i===null)return(0,R.jsxs)(`div`,{"data-testid":`${r}-unknown`,className:U(`flex flex-col gap-1 rounded-md border border-border bg-card`,n===`card`?`px-4 py-3`:`gap-1 px-2.5 py-2`),children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`AI-units footprint`}),(0,R.jsx)(`span`,{className:`font-mono text-[12px] text-muted-foreground`,children:`No pricing entry for this model id — footprint unavailable.`})]});let a=i/100*eC,o=tC.units_per_block/i,s=a*o*4,c=i*o*4*7;return(0,R.jsxs)(`div`,{"data-testid":`${r}-panel`,className:U(`flex flex-col gap-2 rounded-md border border-border bg-card`,n===`card`?`px-4 py-3.5`:`gap-1 px-2.5 py-2`),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(On,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}),(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`AI-units footprint`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5 font-mono text-[12px] text-foreground`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`Per 6h block, at cap`}),(0,R.jsxs)(`span`,{"data-testid":`${r}-block`,className:`font-medium`,children:[iC(i),` / `,tC.units_per_block,` units / task`]})]}),(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`Per week, at cap`}),(0,R.jsxs)(`span`,{"data-testid":`${r}-week`,className:`font-medium`,children:[iC(c),` / `,tC.units_per_week,` units`]})]}),(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`~ Daily cost at cap`}),(0,R.jsxs)(`span`,{"data-testid":`${r}-daily-usd`,className:`font-medium`,children:[`~$`,s<1?s.toFixed(2):s.toFixed(1),`/day`]})]})]}),(0,R.jsx)(`span`,{className:`font-mono text-[11px] text-muted-foreground`,children:`Node pauses claims for this credential when the 6h or 7d cap is reached, then auto-resumes.`})]})}function oC(e){let{data:t,isPending:n}=ut({queryKey:[`status`],queryFn:()=>B.getStatus()});return e?n||!t?.costSurface?!0:t.costSurface.harnesses[$S(e)]?.usesPaidApiKey??!0:!1}function sC({label:e,children:t,docHref:n,docLabel:r=`Read more`}){let[i,a]=(0,L.useState)(!1);return(0,R.jsxs)(MS,{open:i,onOpenChange:a,children:[(0,R.jsx)(NS,{type:`button`,"data-testid":`inline-help-trigger`,"aria-label":e,className:`inline-flex h-4 w-4 cursor-pointer items-center justify-center rounded-md border border-muted-foreground bg-card p-0 text-muted-foreground transition-colors hover:border-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:(0,R.jsx)(An,{className:`h-2.5 w-2.5`,"aria-hidden":`true`})}),(0,R.jsxs)(PS,{"data-testid":`inline-help-panel`,role:`note`,align:`start`,className:`max-w-[420px] whitespace-pre-line font-mono text-[11px] font-normal leading-relaxed normal-case tracking-normal text-muted-foreground`,children:[t,n&&(0,R.jsxs)(R.Fragment,{children:[` `,(0,R.jsx)(`a`,{"data-testid":`inline-help-doc-link`,href:n,target:`_blank`,rel:`noreferrer`,className:`text-primary hover:underline`,children:r})]})]})]})}var cC=`Self-improving agent by Nous Research. Built-in learning loop.`,lC=`https://github.com/Jinn-Network/mono/blob/next/client/docs/operator/join-form-context.md`,uC=hd,dC=`mx-auto flex max-w-[880px] flex-col gap-4 p-6`,fC=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-muted)]`,pC=fC,mC=`flex items-start gap-2`,hC=`rounded-md border border-input bg-transparent px-3 py-2 font-mono text-[14px] text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`;function gC(e,t){return e?.nets.find(e=>e.contract.id===t.id&&e.contract.version===t.version)}function _C(e){return e?e.length<=13?e:`${e.slice(0,6)}…${e.slice(-4)}`:``}function vC(e){let t=e?.contract.evaluationFunction.implementation;if(t){if(t.includes(`swe-rebench-v2-evaluator`))return`swe-rebench-v2-evaluator`;if(t.includes(`prediction-v1-evaluator`))return`prediction-v1-evaluator`}}function yC(e){let t=[...new Set(e)].sort();return{readiness:ut({queryKey:[`harness-readiness`,t.join(`,`)],enabled:t.length>0,refetchInterval:5e3,queryFn:async()=>{let e=await Promise.all(t.map(async e=>{try{return[e,await B.harnessReadiness(e)]}catch(t){if(t.code===`harness_not_found`)return[e,void 0];throw t}}));return new Map(e)}}).data??new Map}}function bC({manifestCid:e,navigateTo:t}={}){let n=Wt(),[,r]=Kt(),i=t??r,a=Ye(),o=e??n.cid,s=ut({queryKey:[`solvernets`,`manifest`,o],queryFn:()=>B.solvernets.getManifest(o),enabled:!!o,retry:!1}),c=ut({queryKey:[`solvernets`,`catalog`],queryFn:()=>B.getSolverNets()}),l=s.data?.manifest,u=l?gC(c.data,l.contract):void 0,d=(u?.compatibleHarnesses??[]).filter(e=>e.supportsRoles.includes(`solving`)).map(e=>({...e,name:bd(e.name)})).filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t),f=d[0]?.name??uC,[p,m]=(0,L.useState)({roles:[],harness:f,plugins:[],disabledDefaultPlugins:[],model:Ad(f)}),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(!1),x=(0,L.useRef)(!1),[S,C]=(0,L.useState)(!1),w=d[0]?.name;(0,L.useEffect)(()=>{x.current||w&&w!==p.harness&&m(e=>({...e,harness:w,model:Ad(w)}))},[w]);let T=kd(p.harness),E=vC(l),D=p.roles.includes(`solver`),{readiness:O}=yC([...D?d.map(e=>e.name):[],...p.roles.includes(`evaluator`)&&E?[E]:[]]),ee=O.get(p.harness),k=E?O.get(E):void 0,A=oC(D?p.harness:void 0),j=YS(A,D?p.model:void 0),M=D&&j.requiresConfirmation,N=M&&!S,te=dt({mutationFn:()=>{let e=jd(p.model,p.harness);return B.operator.join(o,{...l?.name===void 0?{}:{name:l.name},...l?.contract===void 0?{}:{contract:{id:l.contract.id,version:l.contract.version}},roles:p.roles,...p.roles.includes(`solver`)?{harness:p.harness,plugins:p.plugins,disabledDefaultPlugins:p.disabledDefaultPlugins,model:p.model,...e===void 0?{}:{provider:e}}:{}})},onSuccess:e=>{a.invalidateQueries({queryKey:[`operator`,`joined`]}),a.invalidateQueries({queryKey:[`bootstrap`]}),v({manifestCid:e.manifestCid,name:e.config.name??l?.name??e.manifestCid,roles:e.config.roles,restartRequired:e.restartRequired})},onError:e=>{g(e instanceof Error?e.message:String(e))}});if(!o)return(0,R.jsx)(`main`,{"data-testid":`join-flow-missing-cid`,className:dC,children:(0,R.jsx)(xC,{message:`No manifest cid supplied.`,onBack:()=>i(`/operator#solvernets`)})});if(s.isLoading)return(0,R.jsx)(`main`,{"data-testid":`join-flow-loading`,className:dC,children:(0,R.jsx)(`p`,{className:`m-0 font-mono text-[13px] text-[var(--fg-muted)]`,children:`Loading manifest…`})});if(s.isError||!l){let e=s.error instanceof Error?s.error.message:`Unknown error`;return(0,R.jsx)(`main`,{"data-testid":`join-flow-error`,className:dC,children:(0,R.jsx)(xC,{message:`Failed to load manifest: ${e}`,onBack:()=>i(`/operator#solvernets`),onRetry:()=>{s.refetch()}})})}if(_)return(0,R.jsx)(`main`,{"data-testid":`join-flow-success`,className:dC,children:(0,R.jsx)(SC,{success:_,navigate:i})});let{openRoles:P}=l,F=e=>{P.includes(e)&&m(t=>{let n=t.roles.includes(e)?t.roles.filter(t=>t!==e):P.filter(n=>n===e||t.roles.includes(n));return{...t,roles:n}})},ne=p.roles.includes(`evaluator`),re=D&&ee?.ready===!1,ie=ne&&k?.ready===!1,ae=p.roles.length>0&&!te.isPending&&!N&&!re&&!ie,I=ie&&E?(0,R.jsxs)(`div`,{"data-testid":`join-evaluator-not-ready`,"data-harness":E,role:`status`,className:`flex flex-col gap-1 rounded-md border border-destructive bg-[var(--bg)] p-2.5 font-mono text-[11px] text-foreground`,children:[(0,R.jsxs)(`span`,{className:`text-destructive`,children:[xd(E),` is not ready`,k?.reason?`: ${k.reason}`:``]}),k?.nextStep&&(0,R.jsxs)(`span`,{"data-testid":`join-evaluator-not-ready-next-step`,className:`text-[var(--fg-muted)]`,children:[k.nextStep.description,k.nextStep.cli?` (${k.nextStep.cli})`:``]})]}):null;return(0,R.jsxs)(`main`,{"data-testid":`join-flow`,"data-manifest-cid":o,className:dC,children:[(0,R.jsxs)(`header`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(`span`,{"data-testid":`join-flow-title`,className:`font-mono text-[20px] font-medium text-foreground`,children:[`Join `,l.name]}),(0,R.jsx)(`span`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:l.description})]}),(0,R.jsxs)(G,{"data-testid":`join-flow-summary`,className:`flex flex-col gap-3 p-4`,children:[(0,R.jsx)(`span`,{className:fC,children:`Manifest`}),(0,R.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 font-mono text-[12px] text-[var(--fg-muted)]`,children:[(0,R.jsx)(`span`,{children:`Contract`}),(0,R.jsxs)(`span`,{className:`text-foreground`,children:[l.contract.id,` · `,l.contract.version]}),(0,R.jsx)(`span`,{children:`Solution price`}),(0,R.jsx)(`span`,{className:`text-foreground`,children:uv(l.solutionPriceWei)}),(0,R.jsx)(`span`,{children:`Verdict price`}),(0,R.jsx)(`span`,{className:`text-foreground`,children:uv(l.verdictPriceWei)}),(0,R.jsx)(`span`,{children:`Open roles`}),(0,R.jsx)(`span`,{"data-testid":`join-flow-open-roles`,className:`text-foreground`,children:P.join(`, `)||`none`}),(0,R.jsx)(`span`,{children:`Launcher`}),(0,R.jsxs)(`span`,{className:`text-foreground`,children:[_C(l.launcher.safeAddress),` · agentId`,` `,l.launcher.agentId]}),(0,R.jsx)(`span`,{children:`Manifest CID`}),(0,R.jsx)(`span`,{"data-testid":`join-flow-manifest-cid`,className:`truncate text-[var(--fg-dim)]`,children:o})]})]}),(0,R.jsxs)(G,{className:`flex flex-col gap-3 p-4`,children:[(0,R.jsxs)(`span`,{className:mC,children:[(0,R.jsx)(`span`,{className:fC,children:`Roles`}),(0,R.jsxs)(sC,{label:`Roles help`,docHref:`${lC}#solver-vs-evaluator`,children:[`Solver attempts tasks and submits solutions. It is the spending role: you pay for model inference and gas. It also has the most upside per task.`,`
64
64
 
65
65
  `,`Evaluator checks other operators' solutions. Lower spend, steadier returns, less variance.`,`
66
66
 
67
- `,`You can take either role, or both. New here? Start as a solver on one SolverNet, using a model you already pay for.`]})]}),(0,R.jsx)(`div`,{className:`flex overflow-hidden rounded-md border border-border`,children:P.map((e,t)=>{let n=p.roles.includes(e),r=`join-role-${e}`;return(0,R.jsxs)(`label`,{htmlFor:r,"data-testid":`join-role-option`,"data-role":e,"data-role-active":n?`true`:`false`,className:U(`flex flex-1 cursor-pointer flex-col gap-1.5 p-3 font-mono`,n?`bg-[var(--bg)] text-foreground`:`bg-transparent text-[var(--fg-muted)]`,t<P.length-1&&`border-r border-border`),children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`input`,{id:r,type:`checkbox`,checked:n,onChange:()=>F(e),"aria-label":e===`solver`?`Solver`:`Evaluator`,className:`size-3.5 accent-primary`}),(0,R.jsx)(`span`,{className:`text-[14px] font-medium`,children:e===`solver`?`Solver`:`Evaluator`})]}),(0,R.jsx)(`span`,{className:U(`pl-[22px] text-[11px]`,n?`text-[var(--fg-muted)]`:`text-[var(--fg-dim)]`),children:e===`solver`?`attempt tasks; submit solutions`:`verify solutions submitted by other operators`})]},e)})})]}),D&&(0,R.jsxs)(G,{"data-testid":`join-flow-solver-fields`,className:`flex flex-col gap-3 p-4`,children:[(0,R.jsx)(`span`,{className:dC,children:`Solver configuration`}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(`span`,{className:pC,children:[(0,R.jsx)(Gf,{htmlFor:`join-harness-select`,className:fC,children:`Harness`}),(0,R.jsxs)(oC,{label:`Harness help`,docHref:`${cC}#harness-and-model`,children:[`The harness is the runtime that runs a task.`,`
67
+ `,`You can take either role, or both. New here? Start as a solver on one SolverNet, using a model you already pay for.`]})]}),(0,R.jsx)(`div`,{className:`flex overflow-hidden rounded-md border border-border`,children:P.map((e,t)=>{let n=p.roles.includes(e),r=`join-role-${e}`;return(0,R.jsxs)(`label`,{htmlFor:r,"data-testid":`join-role-option`,"data-role":e,"data-role-active":n?`true`:`false`,className:U(`flex flex-1 cursor-pointer flex-col gap-1.5 p-3 font-mono`,n?`bg-[var(--bg)] text-foreground`:`bg-transparent text-[var(--fg-muted)]`,t<P.length-1&&`border-r border-border`),children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`input`,{id:r,type:`checkbox`,checked:n,onChange:()=>F(e),"aria-label":e===`solver`?`Solver`:`Evaluator`,className:`size-3.5 accent-primary`}),(0,R.jsx)(`span`,{className:`text-[14px] font-medium`,children:e===`solver`?`Solver`:`Evaluator`})]}),(0,R.jsx)(`span`,{className:U(`pl-[22px] text-[11px]`,n?`text-[var(--fg-muted)]`:`text-[var(--fg-dim)]`),children:e===`solver`?`attempt tasks; submit solutions`:`verify solutions submitted by other operators`})]},e)})})]}),D&&(0,R.jsxs)(G,{"data-testid":`join-flow-solver-fields`,className:`flex flex-col gap-3 p-4`,children:[(0,R.jsx)(`span`,{className:fC,children:`Solver configuration`}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(`span`,{className:mC,children:[(0,R.jsx)(Kf,{htmlFor:`join-harness-select`,className:pC,children:`Harness`}),(0,R.jsxs)(sC,{label:`Harness help`,docHref:`${lC}#harness-and-model`,children:[`The harness is the runtime that runs a task.`,`
68
68
 
69
69
  `,`You only need credentials for one harness — the harness, not the harness and the model separately.`,`
70
70
 
71
71
  `,"Claude Code uses whatever the `claude` CLI is signed in with: a Claude subscription or an Anthropic API key. Hermes Agent is a separate package; the join form checks it is installed.",`
72
72
 
73
- `,`The default is the SolverNet's first compatible harness. Pick one. You do not need to pay for two.`]})]}),(0,R.jsxs)(`select`,{id:`join-harness-select`,"aria-label":`Harness`,"data-testid":`join-harness-select`,value:p.harness,onChange:e=>{let t=e.target.value;x.current=!0,m({...p,harness:t,model:Ad(t)}),C(!1)},className:mC,children:[d.map(e=>{let t=O.get(e.name),n=t?.ready===!1;return(0,R.jsxs)(`option`,{value:e.name,disabled:n,"data-testid":`join-harness-option`,"data-harness":e.name,"data-harness-ready":t===void 0?`unknown`:t.ready?`true`:`false`,children:[Sd(e.name,e.version),n?` — setup required`:``]},e.name)}),(!u||d.length===0)&&(0,R.jsx)(`option`,{value:p.harness,children:xd(p.harness)})]}),p.harness===`hermes-agent`&&(0,R.jsx)(`span`,{"data-testid":`join-harness-hermes-description`,className:`font-mono text-[11px] text-[var(--fg-muted)]`,children:sC}),ee?.ready===!1&&(0,R.jsxs)(`div`,{"data-testid":`join-harness-not-ready`,"data-harness":p.harness,role:`status`,className:`flex flex-col gap-1 rounded-md border border-destructive bg-[var(--bg)] p-2.5 font-mono text-[11px] text-foreground`,children:[(0,R.jsxs)(`span`,{className:`text-destructive`,children:[xd(p.harness),` is not ready`,ee.reason?`: ${ee.reason}`:``]}),ee.nextStep&&(0,R.jsxs)(`span`,{"data-testid":`join-harness-not-ready-next-step`,className:`text-[var(--fg-muted)]`,children:[ee.nextStep.description,ee.nextStep.cli?` (${ee.nextStep.cli})`:``]})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(`span`,{className:pC,children:[(0,R.jsx)(Gf,{htmlFor:`join-model-select`,className:fC,children:`Model`}),(0,R.jsxs)(oC,{label:`Model help`,docHref:`${cC}#harness-and-model`,children:[`The model is the LLM the harness runs.`,`
73
+ `,`The default is the SolverNet's first compatible harness. Pick one. You do not need to pay for two.`]})]}),(0,R.jsxs)(`select`,{id:`join-harness-select`,"aria-label":`Harness`,"data-testid":`join-harness-select`,value:p.harness,onChange:e=>{let t=e.target.value;x.current=!0,m({...p,harness:t,model:Ad(t)}),C(!1)},className:hC,children:[d.map(e=>{let t=O.get(e.name),n=t?.ready===!1;return(0,R.jsxs)(`option`,{value:e.name,disabled:n,"data-testid":`join-harness-option`,"data-harness":e.name,"data-harness-ready":t===void 0?`unknown`:t.ready?`true`:`false`,children:[Sd(e.name,e.version),n?` — setup required`:``]},e.name)}),(!u||d.length===0)&&(0,R.jsx)(`option`,{value:p.harness,children:xd(p.harness)})]}),p.harness===`hermes-agent`&&(0,R.jsx)(`span`,{"data-testid":`join-harness-hermes-description`,className:`font-mono text-[11px] text-[var(--fg-muted)]`,children:cC}),ee?.ready===!1&&(0,R.jsxs)(`div`,{"data-testid":`join-harness-not-ready`,"data-harness":p.harness,role:`status`,className:`flex flex-col gap-1 rounded-md border border-destructive bg-[var(--bg)] p-2.5 font-mono text-[11px] text-foreground`,children:[(0,R.jsxs)(`span`,{className:`text-destructive`,children:[xd(p.harness),` is not ready`,ee.reason?`: ${ee.reason}`:``]}),ee.nextStep&&(0,R.jsxs)(`span`,{"data-testid":`join-harness-not-ready-next-step`,className:`text-[var(--fg-muted)]`,children:[ee.nextStep.description,ee.nextStep.cli?` (${ee.nextStep.cli})`:``]})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(`span`,{className:mC,children:[(0,R.jsx)(Kf,{htmlFor:`join-model-select`,className:pC,children:`Model`}),(0,R.jsxs)(sC,{label:`Model help`,docHref:`${lC}#harness-and-model`,children:[`The model is the LLM the harness runs.`,`
74
74
 
75
75
  `,`This list only shows models the selected harness supports. Change the harness and the model resets to that harness's default.`,`
76
76
 
77
77
  `,`You pay for the model through the harness's credentials. There is no extra model subscription on top.`,`
78
78
 
79
- `,`Check the cost estimate below before you join.`]})]}),(0,R.jsxs)(`select`,{id:`join-model-select`,"aria-label":`Model`,"data-testid":`join-model-select`,value:p.model,onChange:e=>{m({...p,model:e.target.value}),C(!1)},className:mC,children:[T.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.label},e.id)),(()=>{let e=jd(p.model,p.harness);return e.isCustom?(0,R.jsx)(`option`,{value:p.model,children:e.label},p.model):null})()]})]})]}),(0,R.jsx)(XS,{modelId:p.model,usesPaidApiKey:A,testIdPrefix:`join-flow-cost`}),(0,R.jsx)(iC,{harness:p.harness,modelId:p.model,testIdPrefix:`join-flow-footprint`}),M&&(0,R.jsxs)(`label`,{"data-testid":`join-flow-cost-confirmation`,"data-cost-confirmation-checked":S?`true`:`false`,className:`flex cursor-pointer items-start gap-2.5 rounded-md border border-destructive bg-[var(--bg)] p-3 font-mono text-[12px] text-foreground`,children:[(0,R.jsx)(`input`,{type:`checkbox`,"data-testid":`join-flow-cost-confirmation-checkbox`,checked:S,onChange:e=>C(e.target.checked),className:`mt-0.5 size-3.5 accent-destructive`,"aria-label":`I understand the per-task cost and have a budget for this`}),(0,R.jsx)(`span`,{children:`I understand — I have a budget for this. The selected model is estimated at more than $1 per task; I am responsible for the API spend on my own provider key.`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsxs)(`span`,{className:pC,children:[(0,R.jsx)(`span`,{className:fC,children:`Plugins`}),(0,R.jsxs)(oC,{label:`Plugins help`,docHref:`${cC}#plug-ins`,children:[`Plug-ins are optional. On your first run you do not need to touch this section.`,`
79
+ `,`Check the cost estimate below before you join.`]})]}),(0,R.jsxs)(`select`,{id:`join-model-select`,"aria-label":`Model`,"data-testid":`join-model-select`,value:p.model,onChange:e=>{m({...p,model:e.target.value}),C(!1)},className:hC,children:[T.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.label},e.id)),(()=>{let e=Md(p.model,p.harness);return e.isCustom?(0,R.jsx)(`option`,{value:p.model,children:e.label},p.model):null})()]})]})]}),(0,R.jsx)(ZS,{modelId:p.model,usesPaidApiKey:A,testIdPrefix:`join-flow-cost`}),(0,R.jsx)(aC,{harness:p.harness,modelId:p.model,testIdPrefix:`join-flow-footprint`}),M&&(0,R.jsxs)(`label`,{"data-testid":`join-flow-cost-confirmation`,"data-cost-confirmation-checked":S?`true`:`false`,className:`flex cursor-pointer items-start gap-2.5 rounded-md border border-destructive bg-[var(--bg)] p-3 font-mono text-[12px] text-foreground`,children:[(0,R.jsx)(`input`,{type:`checkbox`,"data-testid":`join-flow-cost-confirmation-checkbox`,checked:S,onChange:e=>C(e.target.checked),className:`mt-0.5 size-3.5 accent-destructive`,"aria-label":`I understand the per-task cost and have a budget for this`}),(0,R.jsx)(`span`,{children:`I understand — I have a budget for this. The selected model is estimated at more than $1 per task; I am responsible for the API spend on my own provider key.`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsxs)(`span`,{className:mC,children:[(0,R.jsx)(`span`,{className:pC,children:`Plugins`}),(0,R.jsxs)(sC,{label:`Plugins help`,docHref:`${lC}#plug-ins`,children:[`Plug-ins are optional. On your first run you do not need to touch this section.`,`
80
80
 
81
81
  `,`A plug-in is reusable AI tooling — MCP servers, skills, extensions — that the harness can load while it solves.`,`
82
82
 
83
83
  `,`This SolverNet already enables the plug-ins its tasks need. Add your own only if you have built one.`,`
84
84
 
85
- `,`You can re-join later with more plug-ins.`]})]}),(0,R.jsx)(GS,{available:u?.compatiblePlugins??[],selected:p.plugins,disabledDefaultPlugins:p.disabledDefaultPlugins,onChange:(e,t)=>m({...p,plugins:e,disabledDefaultPlugins:t}),rowTestId:`join-plugin-option`,searchTestId:`join-plugin-search`,harness:p.harness})]})]}),ne&&!D&&(0,R.jsxs)(G,{"data-testid":`join-flow-evaluator-info`,className:`flex flex-col gap-3 p-4`,children:[(0,R.jsxs)(`span`,{className:pC,children:[(0,R.jsx)(`span`,{className:dC,children:`Evaluator configuration`}),(0,R.jsxs)(oC,{label:`Evaluator configuration help`,docHref:`${cC}#why-the-evaluator-role-has-no-model-selector`,children:[`The evaluator role has no harness or model picker. That is by design.`,`
85
+ `,`You can re-join later with more plug-ins.`]})]}),(0,R.jsx)(KS,{available:u?.compatiblePlugins??[],selected:p.plugins,disabledDefaultPlugins:p.disabledDefaultPlugins,onChange:(e,t)=>m({...p,plugins:e,disabledDefaultPlugins:t}),rowTestId:`join-plugin-option`,searchTestId:`join-plugin-search`,harness:p.harness})]})]}),ne&&!D&&(0,R.jsxs)(G,{"data-testid":`join-flow-evaluator-info`,className:`flex flex-col gap-3 p-4`,children:[(0,R.jsxs)(`span`,{className:mC,children:[(0,R.jsx)(`span`,{className:fC,children:`Evaluator configuration`}),(0,R.jsxs)(sC,{label:`Evaluator configuration help`,docHref:`${lC}#why-the-evaluator-role-has-no-model-selector`,children:[`The evaluator role has no harness or model picker. That is by design.`,`
86
86
 
87
87
  `,`Every evaluator on a SolverNet must run the same evaluation function, so verdicts can be compared. The SolverNet's manifest sets it for you.`,`
88
88
 
89
- `,`For many SolverNets that function is deterministic and uses no model at all.`]})]}),(0,R.jsxs)(`p`,{className:`m-0 font-mono text-[12px] text-[var(--fg-muted)]`,children:[`The evaluator harness is bound to`,` `,(0,R.jsx)(`code`,{className:`text-foreground`,children:l.contract.evaluationFunction.implementation}),` `,`by the manifest's contract; no operator selection required.`]}),I]}),ne&&D&&(0,R.jsxs)(G,{"data-testid":`join-flow-evaluator-info`,className:`flex flex-col gap-3 p-4`,children:[(0,R.jsxs)(`span`,{className:pC,children:[(0,R.jsx)(`span`,{className:dC,children:`Evaluator binding`}),(0,R.jsxs)(oC,{label:`Evaluator binding help`,docHref:`${cC}#why-the-evaluator-role-has-no-model-selector`,children:[`The SolverNet's manifest sets the evaluator harness for you.`,`
89
+ `,`For many SolverNets that function is deterministic and uses no model at all.`]})]}),(0,R.jsxs)(`p`,{className:`m-0 font-mono text-[12px] text-[var(--fg-muted)]`,children:[`The evaluator harness is bound to`,` `,(0,R.jsx)(`code`,{className:`text-foreground`,children:l.contract.evaluationFunction.implementation}),` `,`by the manifest's contract; no operator selection required.`]}),I]}),ne&&D&&(0,R.jsxs)(G,{"data-testid":`join-flow-evaluator-info`,className:`flex flex-col gap-3 p-4`,children:[(0,R.jsxs)(`span`,{className:mC,children:[(0,R.jsx)(`span`,{className:fC,children:`Evaluator binding`}),(0,R.jsxs)(sC,{label:`Evaluator binding help`,docHref:`${lC}#why-the-evaluator-role-has-no-model-selector`,children:[`The SolverNet's manifest sets the evaluator harness for you.`,`
90
90
 
91
91
  `,`Every evaluator runs the same evaluation function, so verdicts can be compared and trusted.`,`
92
92
 
93
- `,`The harness and model fields above apply only to the solver role.`]})]}),(0,R.jsxs)(`p`,{className:`m-0 font-mono text-[12px] text-[var(--fg-muted)]`,children:[`Evaluator harness is bound to`,` `,(0,R.jsx)(`code`,{className:`text-foreground`,children:l.contract.evaluationFunction.implementation}),` `,`by the manifest. The fields above only configure the solver role.`]}),I]}),y&&(0,R.jsx)(iS,{onSuccess:()=>{b(!1),te.mutate()},onCancel:()=>{b(!1)}}),h&&(0,R.jsx)(`p`,{"data-testid":`join-flow-submit-error`,role:`alert`,className:`m-0 font-mono text-[13px] text-destructive`,children:h}),(0,R.jsxs)(`footer`,{className:`flex items-center justify-end gap-3`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`join-flow-cancel`,onClick:()=>i(`/operator#solvernets`),children:`Cancel`}),(0,R.jsx)(W,{type:`button`,variant:`default`,"data-testid":`join-flow-submit`,disabled:!ae,onClick:()=>{if(g(null),p.roles.includes(`solver`)&&p.harness===`hermes-agent`){b(!0);return}te.mutate()},children:te.isPending?`Joining…`:`Join SolverNet`})]})]})}function bC({message:e,onBack:t,onRetry:n}){return(0,R.jsxs)(fo,{variant:`blocking`,className:`flex items-center justify-between gap-4 border-l-0 border border-destructive p-4`,children:[(0,R.jsx)(mo,{className:`font-mono text-[13px] text-destructive`,children:e}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[n&&(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`join-flow-retry`,onClick:n,children:`Retry`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`join-flow-back`,onClick:t,children:`Back`})]})]})}function xC({success:e,navigate:t}){let n=e.roles.map(e=>e===`solver`?`Solver`:`Evaluator`).join(` + `),[r,i]=(0,L.useState)(!1),[a,o]=(0,L.useState)(null),s=async()=>{i(!0),o(null);try{if(!(await B.restartDaemon()).ok)throw Error(`Restart request failed.`);t(`/overview`)}catch(e){o(e instanceof Error?e.message:`Restart request failed.`),i(!1)}};return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(G,{"data-testid":`join-flow-success-card`,role:`status`,className:`flex flex-col gap-2.5 border-[var(--vow-green)] p-5`,children:[(0,R.jsx)(q,{variant:`success`,className:`self-start`,children:`Joined`}),(0,R.jsxs)(`span`,{"data-testid":`join-flow-success-name`,className:`font-mono text-[18px] font-medium text-foreground`,children:[`You joined `,e.name]}),(0,R.jsxs)(`span`,{className:`font-mono text-[12px] leading-relaxed text-[var(--fg-muted)]`,children:[`You're in as `,n||`an operator`,`. This SolverNet now shows in your joined list.`]}),e.restartRequired&&(0,R.jsx)(`span`,{"data-testid":`join-flow-success-restart`,className:`font-mono text-[12px] leading-relaxed text-[var(--accent-gold)]`,children:`Restart the node to start participating — the daemon picks up SolverNet config on restart.`})]}),a&&(0,R.jsx)(po,{role:`alert`,"data-testid":`join-flow-success-restart-error`,className:`font-mono text-[12px] leading-relaxed text-destructive`,children:a}),(0,R.jsxs)(`footer`,{className:`flex items-center justify-end gap-3`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`join-flow-success-browse`,onClick:()=>t(`/operator#solvernets`),children:`Browse SolverNets`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`join-flow-success-view`,onClick:()=>t(`/operator#solvernets/${e.manifestCid}`),children:`View joined SolverNet`}),(0,R.jsx)(W,{type:`button`,variant:`default`,"data-testid":`join-flow-success-restart-button`,onClick:()=>{s()},disabled:r,children:r?`Restarting…`:`Restart node now`})]})]})}function SC({capture:e}){return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Executor`}),(0,R.jsxs)(`dl`,{className:`m-0 grid gap-x-3 gap-y-1.5 [grid-template-columns:120px_minmax(0,1fr)]`,children:[(0,R.jsx)(`dt`,{className:`font-mono text-[12px] text-muted-foreground`,children:`Tool`}),(0,R.jsx)(`dd`,{className:`m-0 font-mono text-[12px] text-foreground`,children:e.originatingTool.name}),(0,R.jsx)(`dt`,{className:`font-mono text-[12px] text-muted-foreground`,children:`Version`}),(0,R.jsx)(`dd`,{className:`m-0 font-mono text-[12px] text-foreground`,children:e.originatingTool.version??`unknown`}),(0,R.jsx)(`dt`,{className:`font-mono text-[12px] text-muted-foreground`,children:`Repo`}),(0,R.jsx)(`dd`,{className:`m-0 break-words font-mono text-[12px] text-foreground`,children:e.repoRemoteUrl??`none`}),(0,R.jsx)(`dt`,{className:`font-mono text-[12px] text-muted-foreground`,children:`Commit`}),(0,R.jsx)(`dd`,{className:`m-0 font-mono text-[12px] text-foreground`,children:e.repoCommitHash?.slice(0,12)??`none`})]})]})}function CC({spans:e}){let t=e.flatMap(e=>e.redactedKeys.map(t=>({span:e.name,key:t})));return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Redactions`}),t.length===0?(0,R.jsx)(`div`,{className:`font-mono text-[12px] text-muted-foreground`,children:`No redacted attributes.`}):(0,R.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map((e,t)=>(0,R.jsxs)(`div`,{className:`grid gap-3 font-mono text-[12px] text-foreground [grid-template-columns:minmax(120px,180px)_minmax(0,1fr)]`,children:[(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:e.span}),(0,R.jsx)(`span`,{className:`break-words`,children:e.key})]},`${e.span}-${e.key}-${t}`))})]})}function wC({detail:e,approving:t=!1,skipping:n=!1,onApprove:r,onSkip:i,onTrustRepo:a}){let{capture:o,spans:s}=e;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsxs)(`header`,{className:`flex items-start justify-between gap-4`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h1`,{className:`m-0 break-all font-serif text-[22px] font-normal leading-tight text-foreground`,children:o.sessionId}),(0,R.jsxs)(`div`,{className:`mt-1.5 font-mono text-[12px] text-muted-foreground`,children:[new Date(o.capturedAt).toLocaleString(),` · `,s.length,` spans`]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[o.repoRemoteUrl?(0,R.jsx)(W,{variant:`secondary`,size:`sm`,onClick:()=>a(!0),children:`Trust repo`}):null,(0,R.jsx)(W,{variant:`secondary`,size:`sm`,disabled:n,onClick:i,children:n?`Skipping`:`Skip`}),(0,R.jsx)(W,{variant:`default`,size:`sm`,disabled:t,onClick:r,children:t?`Approving`:`Approve`})]})]}),(0,R.jsx)(SC,{capture:o}),(0,R.jsx)(CC,{spans:s}),(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Trajectory`}),s.length===0?(0,R.jsx)(`div`,{className:`font-mono text-[12px] text-muted-foreground`,children:`No spans recorded.`}):(0,R.jsx)(G,{children:(0,R.jsx)(Hi,{className:`flex flex-col p-0`,children:s.map((e,t)=>(0,R.jsxs)(`div`,{children:[t>0&&(0,R.jsx)(kh,{}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-2.5`,children:[(0,R.jsx)(`strong`,{className:`min-w-0 truncate font-mono text-[12px] font-medium text-foreground`,children:e.name}),(0,R.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:e.spanId})]})]},e.spanId))})})]})]})}var TC=Object.defineProperty,EC=(e,t)=>TC(e,`name`,{value:t,configurable:!0}),DC=`Switch`,[OC,kC]=ra(DC),[AC,jC]=OC(DC);function MC(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=su({prop:n,defaultProp:i??!1,onChange:c,caller:DC}),[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useRef(!1),[y,b]=L.useReducer(e=>e+1,0),x={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:y,onUserInteraction:b,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,R.jsx)(AC,{scope:t,...x,children:BC(d)?d(x):r})}EC(MC,`SwitchProvider`);var NC=`SwitchTrigger`,PC=L.forwardRef(EC(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=jC(NC,e),g=Kn(r,u),_=L.useRef(c);return L.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=EC(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,R.jsx)(Gi.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":VC(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:g,onClick:K(t,e=>{p(),d(e=>!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`SwitchTrigger`)),FC=L.forwardRef(EC(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,R.jsx)(MC,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(PC,{...d,ref:t,__scopeSwitch:n}),e&&(0,R.jsx)(zC,{__scopeSwitch:n})]})})},`Switch`)),IC=`SwitchThumb`,LC=L.forwardRef(EC(function(e,t){let{__scopeSwitch:n,...r}=e,i=jC(IC,n);return(0,R.jsx)(Gi.span,{"data-state":VC(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),RC=`SwitchBubbleInput`,zC=L.forwardRef(EC(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=jC(RC,e),g=Kn(r,h),_=Ml(i),v=L.useRef(!1),y=L.useRef(s),b=L.useRef(o);L.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==b.current;b.current=o;let i=y.current!==s;y.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});n.call(e,s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let x=L.useRef(s);return(0,R.jsx)(Gi.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??x.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:K(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function BC(e){return typeof e==`function`}EC(BC,`isFunction`);function VC(e){return e?`checked`:`unchecked`}EC(VC,`getState`);var HC=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(FC,{className:U(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-[var(--vow-green)] data-[state=unchecked]:bg-border`,e),...t,ref:n,children:(0,R.jsx)(LC,{className:U(`pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0.5`)})}));HC.displayName=FC.displayName;function UC(e){return Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)))}function WC(e,t){return e.publicEndpoint===t.publicEndpoint&&e.defaultPriceUsdc===t.defaultPriceUsdc&&JSON.stringify(UC(e.perArtifactTypePrice))===JSON.stringify(UC(t.perArtifactTypePrice))&&e.donation.enabled===t.donation.enabled}function GC({label:e,value:t,meta:n}){return(0,R.jsxs)(`div`,{"data-testid":`operator-donation-fact`,className:`flex min-w-0 flex-col gap-1.5 rounded-lg border border-border px-3.5 py-3`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:e}),(0,R.jsx)(`strong`,{className:`font-mono text-[18px] font-medium text-foreground`,children:t}),(0,R.jsx)(`span`,{className:`truncate font-mono text-[12px] text-[var(--fg-dim)]`,children:n})]})}function KC({pricing:e,eligibleRuns:t,peerDatasetsUsed:n,saving:r,onSave:i,registerRevert:a}){let[o,s]=(0,L.useState)(e.donation.enabled),[c,l]=(0,L.useState)(!1),u=(0,L.useMemo)(()=>({publicEndpoint:e.publicEndpoint,defaultPriceUsdc:e.defaultPriceUsdc,perArtifactTypePrice:e.perArtifactTypePrice,donation:{enabled:o}}),[e.defaultPriceUsdc,e.perArtifactTypePrice,e.publicEndpoint,o]),d=!WC(e,u);return(0,R.jsxs)(`div`,{"data-testid":`operator-donation-status`,className:`flex flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-[260px] flex-[1_1_360px] flex-col gap-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Donate execution data`}),(0,R.jsx)(`strong`,{"data-testid":`operator-donation-mode`,className:o?`font-mono text-[18px] font-medium text-[var(--vow-green)]`:`font-mono text-[18px] font-medium text-foreground`,children:o?`Donation is on`:`Donation is off`}),(0,R.jsx)(`p`,{className:`m-0 max-w-[64ch] font-mono text-[12px] leading-relaxed text-[var(--fg-dim)]`,children:`Share scrubbed and anonymized solver/evaluator data from future runs with other operators. This lets the network learn from real executions and improve itself. Public testnet donations are free and published to IPFS.`})]}),(0,R.jsxs)(`label`,{"data-testid":`operator-donation-toggle`,className:`inline-flex cursor-pointer items-center gap-3 rounded-full border border-border bg-[var(--bg-sunken)] px-3 py-2`,children:[(0,R.jsx)(`span`,{className:o?`font-mono text-[11px] uppercase tracking-[0.12em] text-[var(--vow-green)]`:`font-mono text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:o?`On`:`Off`}),(0,R.jsx)(HC,{"aria-label":`Donate produced data`,checked:o,onCheckedChange:t=>{if(t&&!o&&!e.donation.enabled){l(!0);return}s(t)}})]})]}),(0,R.jsxs)(`div`,{"data-testid":`operator-donation-facts`,className:`grid gap-2.5 [grid-template-columns:repeat(auto-fit,minmax(150px,1fr))]`,children:[(0,R.jsx)(GC,{label:`Eligible runs`,value:String(t),meta:`local history`}),(0,R.jsx)(GC,{label:`Peer datasets used`,value:String(n),meta:`from other operators`})]}),(0,R.jsx)(fo,{variant:`info`,"data-testid":`operator-donation-caveat`,children:(0,R.jsx)(mo,{children:`Turning donation off stops future publishing. Data already published to IPFS may remain available.`})}),(0,R.jsx)(kh,{}),(0,R.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-3`,children:(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`span`,{"data-testid":`operator-donation-settings-state`,className:d?`font-mono text-[12px] text-primary`:`font-mono text-[12px] text-[var(--fg-dim)]`,children:d?`Donation changed`:`Current`}),(0,R.jsx)(W,{variant:`default`,size:`sm`,type:`button`,disabled:!d||r,onClick:()=>{let t=e.donation.enabled;o!==t&&a(()=>s(t)),i(u)},children:r?`Saving…`:`Save`})]})}),(0,R.jsx)(Sx,{open:c,onOpenChange:l,children:(0,R.jsxs)(Tx,{"data-testid":`operator-donation-confirm`,children:[(0,R.jsxs)(Ex,{children:[(0,R.jsx)(Ox,{children:`Share future execution data`}),(0,R.jsx)(kx,{children:`Future solver/evaluator runs will be scrubbed, anonymized, and published to IPFS so other operators can use them. This helps the network learn from real executions and improve itself. Turning donation off later stops future publishing, but data already published to IPFS may remain available.`})]}),(0,R.jsxs)(Dx,{children:[(0,R.jsx)(jx,{children:`Cancel`}),(0,R.jsx)(Ax,{onClick:()=>{let e={...u,donation:{enabled:!0}};s(!0),l(!1),a(()=>s(!1)),i(e)},children:`Enable donation`})]})]})})]})}function qC({onRestartPending:e=()=>void 0}){let t=Ye(),{data:n,isLoading:r,isError:i,error:a,refetch:o}=ut({queryKey:[`operator-artifacts`,`served`],queryFn:()=>B.operator.listArtifacts({source:`served`,limit:100}),refetchInterval:1e4}),s=(0,L.useRef)(null),c=e=>{s.current=e},l=dt({mutationFn:e=>B.operator.updatePricing(e),onSuccess:async()=>{s.current=null,ph.success(`Donation setting saved`,{description:`Restart pending — applies on next daemon start.`}),e(),await t.invalidateQueries({queryKey:[`operator-artifacts`]})},onError:e=>{let t=s.current;s.current=null,t?.(),ph.error(`Failed to save donation setting`,{description:e instanceof Error?e.message:String(e)})}}),u=n?.summary,d=u?`${u.served.totalCount} eligible runs · donation ${n?.pricing.donation.enabled?`on`:`off`} · ${u.network.totalCount} peer datasets used`:`Donate scrubbed and anonymized run data to IPFS so other operators can use it.`;return(0,R.jsxs)(G,{children:[(0,R.jsxs)(zi,{className:`flex flex-row items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(Bi,{className:`flex items-center gap-2`,children:[(0,R.jsx)(zn,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),`Data donation`]}),(0,R.jsx)(Vi,{children:d})]}),(0,R.jsx)(q,{variant:n?.pricing.donation.enabled?`success`:`outline`,children:n?.pricing.donation.enabled?`IPFS donation on`:`Donation off`})]}),(0,R.jsxs)(Hi,{children:[r&&(0,R.jsxs)(`div`,{"data-testid":`operator-data-market-loading`,className:`flex flex-col gap-3`,"aria-label":`Loading execution data`,children:[(0,R.jsx)(ld,{className:`h-6 w-40`}),(0,R.jsx)(ld,{className:`h-4 w-72`}),(0,R.jsx)(ld,{className:`h-20 w-full`})]}),i&&(0,R.jsxs)(fo,{variant:`blocking`,role:`alert`,"data-testid":`operator-data-market-error`,className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(po,{className:`text-[var(--break-red)]`,children:a instanceof Error?a.message:`Failed to load execution data.`}),(0,R.jsxs)(W,{variant:`outline`,size:`sm`,type:`button`,onClick:()=>{o()},children:[(0,R.jsx)(Rn,{className:`h-3 w-3`,"aria-hidden":`true`}),`Retry`]})]}),n&&(0,R.jsx)(KC,{pricing:n.pricing,eligibleRuns:n.summary.served.totalCount,peerDatasetsUsed:n.summary.network.totalCount,saving:l.isPending,onSave:e=>l.mutate(e),registerRevert:c},`${n.pricing.publicEndpoint}|${n.pricing.defaultPriceUsdc}|${n.pricing.donation.enabled}|${JSON.stringify(UC(n.pricing.perArtifactTypePrice))}`)]})]})}var JC=kb,YC=Fb,XC=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Lb,{className:U(`fixed inset-0 z-50 bg-black/70 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));XC.displayName=Lb.displayName;var ZC=dr(`fixed z-50 gap-4 bg-card p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b border-border data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t border-border data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r border-border data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l border-border data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),QC=L.forwardRef(({side:e=`right`,className:t,children:n,...r},i)=>(0,R.jsxs)(YC,{children:[(0,R.jsx)(XC,{}),(0,R.jsxs)(Vb,{ref:i,className:U(ZC({side:e}),t),...r,children:[n,(0,R.jsxs)(Xb,{className:`absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none`,children:[(0,R.jsx)(Hn,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));QC.displayName=Vb.displayName;var $C=({className:e,...t})=>(0,R.jsx)(`div`,{className:U(`flex flex-col gap-2 text-left`,e),...t});$C.displayName=`SheetHeader`;var ew=({className:e,...t})=>(0,R.jsx)(`div`,{className:U(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t});ew.displayName=`SheetFooter`;var tw=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Kb,{ref:n,className:U(`font-serif text-[20px] text-foreground`,e),...t}));tw.displayName=Kb.displayName;var nw=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Jb,{ref:n,className:U(`font-mono text-[12px] text-[var(--fg-muted)]`,e),...t}));nw.displayName=Jb.displayName;function rw(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||r===0?Math.round(n):n.toFixed(1)} ${t[r]}`}function iw(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().replace(`T`,` `).slice(0,19)+` UTC`}function aw(e){return e.length>14?`${e.slice(0,10)}…${e.slice(-6)}`:e}function ow(e,t){switch(e){case 8453:return`https://basescan.org/tx/${t}`;case 84532:return`https://sepolia.basescan.org/tx/${t}`;case 11155111:return`https://sepolia.etherscan.io/tx/${t}`;default:return null}}function sw(e){return e==null||!Number.isFinite(e)?`—`:iw(new Date(e*1e3).toISOString())}function cw({title:e,children:t}){return(0,R.jsxs)(G,{children:[(0,R.jsx)(zi,{className:`pb-2`,children:(0,R.jsx)(Bi,{className:`font-mono text-[11px] uppercase tracking-wide text-muted-foreground`,children:e})}),(0,R.jsx)(Hi,{className:`p-4 pt-0`,children:t})]})}function lw({rows:e}){return(0,R.jsx)(`dl`,{className:`m-0 grid gap-x-3.5 gap-y-2.5 [grid-template-columns:140px_minmax(0,1fr)]`,children:e.map(({label:e,value:t})=>(0,R.jsxs)(L.Fragment,{children:[(0,R.jsx)(`dt`,{className:`font-mono text-[12px] text-muted-foreground`,children:e}),(0,R.jsx)(`dd`,{className:`m-0 break-all font-mono text-[12px] text-foreground`,children:t??`—`})]},e))})}function uw(e){return e.source===`served`?e.createdAt:e.fetchedAt}function dw(e){return e.source===`served`?`shared`:e.paidAmountUsdc===`0`?`peer donated`:`peer used`}function fw(e,t){return!e||e.kind!==t.kind?!1:e.kind===`capture`&&t.kind===`capture`?e.id===t.id:e.kind===`artifact`&&t.kind===`artifact`&&e.source===t.source&&e.sha256===t.sha256}function pw(e){return e?e instanceof Error?e.message:String(e):`Unknown error`}function mw(e){return/\b(401|403)\b|unauthorized|forbidden/i.test(pw(e))}function hw({kind:e,message:t}){let n=e===`permission`?`Permission required to view execution data. Open the dashboard from the daemon handshake URL or refresh an authenticated session.`:`Execution data could not be loaded${t?`: ${t}`:`.`}`;return(0,R.jsx)(fo,{variant:e===`permission`?`warning`:`blocking`,"data-testid":e===`permission`?`execution-data-permission`:`execution-data-error`,children:(0,R.jsx)(mo,{children:n})})}function gw(e){return{id:`capture:${e.sessionId}`,selection:{kind:`capture`,id:e.sessionId},title:`execution-capture.v1`,state:e.status,meta:`${e.originatingTool.name} · ${e.spanCount} spans · ${e.redactedSpanCount} redacted`,at:e.capturedAt}}function _w(e){let t=dw(e);return{id:`artifact:${e.source}:${e.sha256}`,selection:{kind:`artifact`,source:e.source,sha256:e.sha256},title:e.artifactType,state:t,meta:`${e.source===`served`?`produced`:`peer`} · ${rw(e.contentSize)} · ${aw(e.sha256)}`,at:uw(e)}}function vw({artifact:e}){let t=uw(e),n=e.projection,r=e.anchors??[],i=[{label:`state`,value:dw(e)},{label:`sha256`,value:e.sha256},{label:`recorded`,value:iw(t)}],a=[{label:`envelope`,value:e.envelopeCid??`—`}];n&&a.push({label:`signature`,value:n.signatureHash},{label:`generated`,value:sw(n.generatedAt)},{label:`role`,value:n.role},{label:`solver`,value:n.solverType},{label:`evidence tier`,value:n.evidenceTier});let o=n?[{label:`safe`,value:n.participantSafeAddress??`—`},{label:`agent EOA`,value:n.participantAgentEoa??`—`},{label:`impl`,value:n.executor.implName??`—`},{label:`impl version`,value:n.executor.implVersion??`—`},{label:`runtime digest`,value:n.executor.runtimeBundleDigest??`—`},{label:`plugins`,value:n.executor.plugins&&n.executor.plugins.length>0?(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.executor.plugins.map(e=>(0,R.jsx)(q,{variant:`outline`,children:e},e))}):`—`}]:null,s=n?[{label:`task CID`,value:n.taskCid??`—`},{label:`task ID`,value:n.taskId??`—`},{label:`request`,value:n.requestId??`—`},{label:`solution ref`,value:n.solutionRef?`${n.solutionRef.envelopeCid}${n.solutionRef.ref?` (${n.solutionRef.ref})`:``}`:`—`}]:null;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsx)(cw,{title:`Identity`,children:(0,R.jsx)(lw,{rows:i})}),(0,R.jsx)(cw,{title:`Envelope`,children:(0,R.jsx)(lw,{rows:a})}),o?(0,R.jsx)(cw,{title:`Participant`,children:(0,R.jsx)(lw,{rows:o})}):null,s?(0,R.jsx)(cw,{title:`Task`,children:(0,R.jsx)(lw,{rows:s})}):null,(0,R.jsx)(cw,{title:`On-chain anchors`,children:r.length===0?(0,R.jsx)(`div`,{className:`font-mono text-[12px] text-muted-foreground`,children:`no on-chain anchor recorded yet`}):(0,R.jsx)(`div`,{className:`flex flex-col gap-3`,children:r.map(e=>{let t=ow(e.chainId,e.txHash);return(0,R.jsxs)(`div`,{className:`rounded-md border border-border bg-card p-3`,children:[(0,R.jsx)(lw,{rows:[{label:`content kind`,value:e.contentKind},{label:`agent ID`,value:e.agentId},{label:`chain ID`,value:String(e.chainId)},{label:`tx`,value:t?(0,R.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`break-all underline underline-offset-2 hover:text-foreground`,children:e.txHash}):e.txHash},{label:`block`,value:e.blockNumber===null?`pending`:String(e.blockNumber)},{label:`anchored`,value:sw(e.anchoredAt)},{label:`registry`,value:e.identityRegistryAddress},{label:`metadata key`,value:e.metadataKey}]}),(0,R.jsxs)(`details`,{className:`mt-2`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer font-mono text-[11px] text-muted-foreground`,children:`payload (ABI-encoded)`}),(0,R.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px] text-foreground`,children:e.payloadHex})]})]},`${e.contentKind}:${e.txHash}`)})})}),e.source===`served`?(0,R.jsx)(cw,{title:`Access`,children:(0,R.jsx)(lw,{rows:[{label:`request`,value:e.requestId??`—`},{label:`accesses`,value:`${e.access.accessCount} total · ${e.access.failedPaymentCount} failed`},{label:`paid serves`,value:String(e.access.paidServeCount)},{label:`free serves`,value:String(e.access.freeServeCount)},{label:`revenue`,value:`${e.access.revenueUsdc} USDC`}]})}):(0,R.jsx)(cw,{title:`Source`,children:(0,R.jsx)(lw,{rows:[{label:`operator`,value:e.sourceOperator??`—`},{label:`endpoint`,value:e.sourceEndpoint??`—`},{label:`origin`,value:e.origin},{label:`paid`,value:`${e.paidAmountUsdc} USDC`},{label:`peer catalog`,value:e.peerCatalogId??`—`}]})})]})}function yw(){let e=Ye(),[t,n]=(0,L.useState)(),[r,i]=(0,L.useState)(!1),a=ut({queryKey:[`captures`,`pending`],queryFn:()=>B.captures.listPending(),refetchInterval:2500}),o=ut({queryKey:[`operator-artifacts`,`served`,`execution-data`],queryFn:()=>B.operator.listArtifacts({source:`served`,limit:100}),refetchInterval:1e4}),s=ut({queryKey:[`operator-artifacts`,`network`,`execution-data`],queryFn:()=>B.operator.listArtifacts({source:`network`,limit:100}),refetchInterval:1e4}),c=a.data?.captures??[],l=[...o.data?.artifacts??[],...s.data?.artifacts??[]].sort((e,t)=>uw(t).localeCompare(uw(e))),u=[...c.map(gw),...l.map(_w)].sort((e,t)=>t.at.localeCompare(e.at)),d=t?.kind===`capture`?t.id:void 0,f=t?.kind===`artifact`?l.find(e=>e.source===t.source&&e.sha256===t.sha256):void 0,p=a.isLoading||o.isLoading||s.isLoading,m=[a.isError?a.error:a.failureReason,o.isError?o.error:o.failureReason,s.isError?s.error:s.failureReason].filter(Boolean),h=m.find(mw),g=h??m[0];(0,L.useEffect)(()=>{if(u.length===0){t&&n(void 0),r&&i(!1);return}(!t||!u.some(e=>fw(t,e.selection)))&&n(u[0].selection)},[u,t,r]);let _=ut({queryKey:[`captures`,d],queryFn:()=>B.captures.get(d),enabled:!!d}),v=dt({mutationFn:e=>B.captures.approve(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:[`captures`]}),e.invalidateQueries({queryKey:[`operator-artifacts`]})])}}),y=dt({mutationFn:e=>B.captures.skip(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:[`captures`]})}}),b=dt({mutationFn:e=>B.captures.trustRepo(e,!0)}),x=e=>{n(e),i(!0)},S=t?.kind===`capture`?_.data?.capture.sessionId??`Capture`:f?.artifactType??`Artifact`,C=t?.kind===`capture`&&_.data?`${new Date(_.data.capture.capturedAt).toLocaleString()} · ${_.data.spans.length} spans`:t?.kind===`artifact`&&f?`${dw(f)} · ${rw(f.contentSize)} · ${iw(uw(f))}`:`Execution data detail.`;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-6 p-6`,children:[(0,R.jsx)(qC,{defaultExpanded:!0}),(0,R.jsxs)(G,{children:[(0,R.jsx)(zi,{children:(0,R.jsx)(Bi,{children:`Execution data`})}),(0,R.jsxs)(Hi,{children:[g?(0,R.jsx)(`div`,{className:`mb-3`,children:(0,R.jsx)(hw,{kind:h?`permission`:`error`,message:h?void 0:pw(g)})}):null,p&&u.length===0?(0,R.jsx)(`div`,{className:`p-6 font-mono text-[12px] text-muted-foreground`,children:`Loading execution data.`}):u.length===0?(0,R.jsx)(`div`,{className:`p-6 font-mono text-[12px] text-muted-foreground`,children:`No execution data yet.`}):(0,R.jsx)(io,{className:`max-h-[560px]`,children:(0,R.jsx)(`div`,{className:`flex flex-col gap-2 pr-2`,children:u.map(e=>{let n=fw(t,e.selection);return(0,R.jsxs)(W,{variant:`ghost`,"data-testid":`execution-data-row`,"data-state":n?`active`:void 0,"aria-current":n?`true`:void 0,onClick:()=>x(e.selection),className:U(`flex h-auto w-full flex-col items-stretch gap-1.5 rounded-md border border-border bg-card px-4 py-3 text-left font-mono text-[12px] normal-case tracking-normal hover:bg-accent`,n&&`border-primary bg-primary/[0.06]`),children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`strong`,{className:`min-w-0 truncate font-medium text-foreground`,children:e.title}),(0,R.jsx)(q,{variant:`outline`,className:`shrink-0`,children:e.state})]}),(0,R.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[e.meta,` · `,iw(e.at)]})]},e.id)})})})]})]}),(0,R.jsx)(JC,{open:r,onOpenChange:i,children:(0,R.jsxs)(QC,{side:`right`,className:`w-full overflow-y-auto sm:max-w-xl`,"data-testid":`execution-data-sheet`,children:[(0,R.jsxs)($C,{children:[(0,R.jsx)(tw,{className:`break-all`,children:S}),(0,R.jsx)(nw,{children:C})]}),(0,R.jsx)(`div`,{className:`mt-4`,children:_.error?(0,R.jsx)(hw,{kind:mw(_.error)?`permission`:`error`,message:mw(_.error)?void 0:pw(_.error)}):t?.kind===`capture`&&_.data?(0,R.jsx)(wC,{detail:_.data,approving:v.isPending,skipping:y.isPending,onApprove:()=>d&&v.mutate(d),onSkip:()=>d&&y.mutate(d),onTrustRepo:()=>{let e=_.data.capture.repoRemoteUrl;e&&b.mutate(e)}}):t?.kind===`artifact`&&f?(0,R.jsx)(vw,{artifact:f}):(0,R.jsx)(`div`,{className:`p-6 font-mono text-[12px] text-muted-foreground`,children:p?`Loading execution data.`:`Select execution data.`})})]})})]})}var bw=Object.defineProperty,xw=(e,t)=>bw(e,`name`,{value:t,configurable:!0}),Sw=[`Enter`,` `],Cw=[`ArrowDown`,`PageUp`,`Home`],ww=[`ArrowUp`,`PageDown`,`End`],Tw=[...Cw,...ww];[...Sw],[...Sw];var Ew=`Menu`,[Dw,Ow,kw]=Md(Ew),[Aw,jw]=ra(Ew,[kw,Ll,Jd]),Mw=Ll(),Nw=Jd(),[Pw,Fw]=Aw(Ew),[Iw,Lw]=Aw(Ew),Rw=xw(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Mw(t),[c,l]=L.useState(null),u=L.useRef(!1),d=aa(a),f=sa(i);return L.useEffect(()=>{let e=xw(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=xw(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),L.useEffect(()=>{if(!n)return;let e=xw(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,R.jsx)(Xl,{...s,children:(0,R.jsx)(Pw,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,R.jsx)(Iw,{scope:t,onClose:L.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),zw=L.forwardRef(xw(function(e,t){let{__scopeMenu:n,...r}=e,i=Mw(n);return(0,R.jsx)(Zl,{...i,...r,ref:t})},`MenuAnchor`)),Bw=`MenuPortal`,[Vw,Hw]=Aw(Bw,{forceMount:void 0}),Uw=xw(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Fw(Bw,t);return(0,R.jsx)(Vw,{scope:t,forceMount:n,children:(0,R.jsx)(Zi,{present:n||a.open,children:(0,R.jsx)(eu,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Ww=`MenuContent`,[Gw,Kw]=Aw(Ww),qw=L.forwardRef(xw(function(e,t){let n=Hw(Ww,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Fw(Ww,e.__scopeMenu),o=Lw(Ww,e.__scopeMenu);return(0,R.jsx)(Dw.Provider,{scope:e.__scopeMenu,children:(0,R.jsx)(Zi,{present:r||a.open,children:(0,R.jsx)(Dw.Slot,{scope:e.__scopeMenu,children:o.modal?(0,R.jsx)(Jw,{...i,ref:t}):(0,R.jsx)(Yw,{...i,ref:t})})})})},`MenuContent`)),Jw=L.forwardRef(xw(function(e,t){let n=Fw(Ww,e.__scopeMenu),r=L.useRef(null),i=Kn(t,r);return L.useEffect(()=>{let e=r.current;if(e)return xb(e)},[]),(0,R.jsx)(Zw,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:K(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Yw=L.forwardRef(xw(function(e,t){let n=Fw(Ww,e.__scopeMenu);return(0,R.jsx)(Zw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Xw=qn(`MenuContent.ScrollLock`),Zw=L.forwardRef(xw(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Fw(Ww,n),_=Lw(Ww,n),v=Mw(n),y=Nw(n),b=Ow(n),[x,S]=L.useState(null),C=L.useRef(null),w=Kn(t,C,g.onContentChange),T=L.useRef(0),E=L.useRef(``),D=L.useRef(0),O=L.useRef(null),ee=L.useRef(`right`),k=L.useRef(0),A=m?fb:L.Fragment,j=m?{as:Xw,allowPinchZoom:!0}:void 0,M=xw(e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=vT(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;xw((function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);L.useEffect(()=>()=>window.clearTimeout(T.current),[]),ny();let N=L.useCallback(e=>ee.current===O.current?.side&&bT(e,O.current?.area),[]);return(0,R.jsx)(Gw,{scope:n,searchRef:E,onItemEnter:L.useCallback(e=>{N(e)&&e.preventDefault()},[N]),onItemLeave:L.useCallback(e=>{N(e)||(C.current?.focus(),S(null))},[N]),onTriggerLeave:L.useCallback(e=>{N(e)&&e.preventDefault()},[N]),pointerGraceTimerRef:D,onPointerGraceIntentChange:L.useCallback(e=>{O.current=e},[]),children:(0,R.jsx)(A,{...j,children:(0,R.jsx)(Hv,{asChild:!0,trapped:i,onMountAutoFocus:K(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,R.jsx)(us,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,R.jsx)(sf,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:K(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,R.jsx)(Ql,{role:`menu`,"aria-orientation":`vertical`,"data-state":pT(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:K(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&M(e.key));let i=C.current;if(e.target!==i||!Tw.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);ww.includes(e.key)&&a.reverse(),gT(a)}),onBlur:K(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:K(e.onPointerMove,xT(e=>{let t=e.target,n=k.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>k.current?`right`:`left`;ee.current=t,k.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),Qw=L.forwardRef(xw(function(e,t){let{__scopeMenu:n,...r}=e;return(0,R.jsx)(Gi.div,{...r,ref:t})},`MenuLabel`)),$w=`MenuItem`,eT=`menu.itemSelect`,tT=L.forwardRef(xw(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=L.useRef(null),o=Lw($w,e.__scopeMenu),s=Kw($w,e.__scopeMenu),c=Kn(t,a),l=L.useRef(!1),u=xw(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(eT,{bubbles:!0,cancelable:!0});e.addEventListener(eT,e=>r?.(e),{once:!0}),Ki(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,R.jsx)(nT,{...i,ref:c,disabled:n,onClick:K(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:K(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:K(e.onKeyDown,e=>{n||e.target!==e.currentTarget||s.searchRef.current!==``&&e.key===` `||Sw.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),nT=L.forwardRef(xw(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Kw($w,n),s=Nw(n),c=L.useRef(null),l=Kn(t,c),[u,d]=L.useState(!1),[f,p]=L.useState(``);return L.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,R.jsx)(Dw.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,R.jsx)(cf,{asChild:!0,...s,focusable:!r,children:(0,R.jsx)(Gi.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:K(e.onPointerMove,xT(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:K(e.onPointerLeave,xT(e=>o.onItemLeave(e))),onFocus:K(e.onFocus,()=>d(!0)),onBlur:K(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),rT=L.forwardRef(xw(function(e,t){let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,R.jsx)(sT,{scope:e.__scopeMenu,checked:n,children:(0,R.jsx)(tT,{role:`menuitemcheckbox`,"aria-checked":mT(n)?`mixed`:n,...i,ref:t,"data-state":hT(n),onSelect:K(i.onSelect,()=>r?.(mT(n)?!0:!n),{checkForDefaultPrevented:!1})})})},`MenuCheckboxItem`)),[iT,aT]=Aw(`MenuRadioGroup`,{value:void 0,onValueChange:xw(()=>{},`onValueChange`)}),oT=`MenuItemIndicator`,[sT,cT]=Aw(oT,{checked:!1}),lT=L.forwardRef(xw(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=cT(oT,n);return(0,R.jsx)(Zi,{present:r||mT(a.checked)||a.checked===!0,children:(0,R.jsx)(Gi.span,{...i,ref:t,"data-state":hT(a.checked)})})},`MenuItemIndicator`)),uT=L.forwardRef(xw(function(e,t){let{__scopeMenu:n,...r}=e;return(0,R.jsx)(Gi.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[dT,fT]=Aw(`MenuSub`);function pT(e){return e?`open`:`closed`}xw(pT,`getOpenState`);function mT(e){return e===`indeterminate`}xw(mT,`isIndeterminate`);function hT(e){return mT(e)?`indeterminate`:e?`checked`:`unchecked`}xw(hT,`getCheckedState`);function gT(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}xw(gT,`focusFirst`);function _T(e,t){return e.map((n,r)=>e[(t+r)%e.length])}xw(_T,`wrapArray`);function vT(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=_T(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}xw(vT,`getNextMatch`);function yT(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}xw(yT,`isPointInPolygon`);function bT(e,t){return t?yT({x:e.clientX,y:e.clientY},t):!1}xw(bT,`isPointerInGraceArea`);function xT(e){return t=>t.pointerType===`mouse`?e(t):void 0}xw(xT,`whenMouse`);var ST=Rw,CT=zw,wT=Uw,TT=qw,ET=Qw,DT=tT,OT=rT,kT=lT,AT=uT,jT=Object.defineProperty,MT=(e,t)=>jT(e,`name`,{value:t,configurable:!0}),NT=`DropdownMenu`,[PT,FT]=ra(NT,[jw]),IT=jw(),[LT,RT]=PT(NT),zT=MT(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=IT(t),l=L.useRef(null),[u,d]=su({prop:i,defaultProp:a??!1,onChange:o,caller:NT});return(0,R.jsx)(LT,{scope:t,triggerId:ys(),triggerRef:l,contentId:ys(),open:u,onOpenChange:d,onOpenToggle:L.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,R.jsx)(ST,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),BT=`DropdownMenuTrigger`,VT=L.forwardRef(MT(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=RT(BT,n),o=IT(n),s=Kn(t,a.triggerRef);return(0,R.jsx)(CT,{asChild:!0,...o,children:(0,R.jsx)(Gi.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:K(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:K(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),HT=MT(e=>{let{__scopeDropdownMenu:t,...n}=e,r=IT(t);return(0,R.jsx)(wT,{...r,...n})},`DropdownMenuPortal`),UT=`DropdownMenuContent`,WT=L.forwardRef(MT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=RT(UT,n),a=IT(n),o=L.useRef(!1);return(0,R.jsx)(TT,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:K(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:K(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),GT=L.forwardRef(MT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=IT(n);return(0,R.jsx)(ET,{...i,...r,ref:t})},`DropdownMenuLabel`)),KT=L.forwardRef(MT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=IT(n);return(0,R.jsx)(DT,{...i,...r,ref:t})},`DropdownMenuItem`)),qT=L.forwardRef(MT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=IT(n);return(0,R.jsx)(OT,{...i,...r,ref:t})},`DropdownMenuCheckboxItem`)),JT=L.forwardRef(MT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=IT(n);return(0,R.jsx)(kT,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),YT=L.forwardRef(MT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=IT(n);return(0,R.jsx)(AT,{...i,...r,ref:t})},`DropdownMenuSeparator`)),XT=zT,ZT=VT,QT=HT,$T=WT,eE=GT,tE=KT,nE=qT,rE=JT,iE=YT,aE=XT,oE=ZT,sE=L.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,R.jsx)(QT,{children:(0,R.jsx)($T,{ref:r,sideOffset:t,className:U(`z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md`,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,e),...n})}));sE.displayName=$T.displayName;var cE=L.forwardRef(({className:e,inset:t,...n},r)=>(0,R.jsx)(tE,{ref:r,className:U(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 font-mono text-[12px] outline-none transition-colors focus:bg-[var(--bg-sunken)] focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t&&`pl-8`,e),...n}));cE.displayName=tE.displayName;var lE=L.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,R.jsxs)(nE,{ref:i,className:U(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 font-mono text-[12px] outline-none focus:bg-[var(--bg-sunken)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,R.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,R.jsx)(rE,{children:(0,R.jsx)(bn,{className:`h-3 w-3`})})}),t]}));lE.displayName=nE.displayName;var uE=L.forwardRef(({className:e,inset:t,...n},r)=>(0,R.jsx)(eE,{ref:r,className:U(`px-2 py-1.5 font-mono text-[10px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,t&&`pl-8`,e),...n}));uE.displayName=eE.displayName;var dE=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(iE,{ref:n,className:U(`-mx-1 my-1 h-px bg-border`,e),...t}));dE.displayName=iE.displayName;var fE=[{to:`/operator/memberships`,label:`Memberships`},{to:`/operator/registry`,label:`Registry`},{to:`/operator/execution-data`,label:`Execution data`},{to:`/operator/network`,label:`Network`},{to:`/operator/security`,label:`Security`}];function pE({to:e,label:t}){let[n]=Jt(e);return(0,R.jsx)(`li`,{children:(0,R.jsx)($t,{href:e,"aria-current":n?`page`:void 0,className:U(`block rounded-sm px-3 py-2 font-mono text-[12px] tracking-[0.08em] no-underline transition-colors`,n?`bg-[var(--bg-elevated)] font-medium text-foreground`:`bg-transparent font-normal text-[var(--fg-muted)] hover:text-foreground`),children:t})})}function mE(){let[,e]=Kt();return(0,R.jsxs)(`nav`,{"aria-label":`Operator sections`,"data-testid":`operator-sub-nav`,className:`flex min-w-[160px] flex-col pt-1`,children:[(0,R.jsx)(`div`,{className:`mb-2 sm:hidden`,children:(0,R.jsxs)(aE,{children:[(0,R.jsx)(oE,{asChild:!0,children:(0,R.jsxs)(W,{variant:`outline`,size:`sm`,"data-testid":`operator-sub-nav-trigger`,children:[(0,R.jsx)(Pn,{className:`h-3.5 w-3.5`}),` Sections`]})}),(0,R.jsx)(sE,{align:`start`,children:fE.map(t=>(0,R.jsx)(cE,{onSelect:()=>e(t.to),children:t.label},t.to))})]})}),(0,R.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:fE.map(e=>(0,R.jsx)(pE,{to:e.to,label:e.label},e.to))})]})}function hE({children:e}){return(0,R.jsxs)(`div`,{"data-testid":`operator-shell`,className:`flex items-start gap-6 p-6`,children:[(0,R.jsx)(mE,{}),(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:e})]})}function gE(e){let t=bd(e.harness);return{harness:t,plugins:e.plugins??[],disabledDefaultPlugins:e.disabledDefaultPlugins??[],model:e.model??Ad(t)}}function _E(e,t){let n=bd(t.harness);if(e.harness!==n||e.model!==(t.model??Ad(n)))return!0;let r=[...e.plugins].sort(),i=[...t.plugins??[]].sort();if(r.length!==i.length)return!0;for(let e=0;e<r.length;e+=1)if(r[e]!==i[e])return!0;let a=[...e.disabledDefaultPlugins].sort(),o=[...t.disabledDefaultPlugins??[]].sort();if(a.length!==o.length)return!0;for(let e=0;e<a.length;e+=1)if(a[e]!==o[e])return!0;return!1}var vE=`flex h-9 w-full rounded-sm border border-border bg-sunken px-2.5 py-1 font-mono text-[13px] text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`;function yE({joined:e,catalogEntry:t,defaultExpanded:n=!1,focusOn:r,onRestartPending:i}){let[a,o]=(0,L.useState)(n),[s,c]=(0,L.useState)(()=>gE(e)),l=(0,L.useRef)(null),u=(0,L.useRef)(null),d=Ye(),f=t!==void 0,p=ut({queryKey:[`solvernets`,`manifest`,e.manifestCid],queryFn:()=>B.solvernets.getManifest(e.manifestCid),enabled:!f&&!!e.manifestCid,staleTime:1/0,retry:!1}),m=ut({queryKey:[`solvernets`,`catalog`],queryFn:()=>B.getSolverNets(),enabled:!f}),h=(()=>{if(f)return t;let e=p.data?.manifest;if(!(!e||!m.data))return m.data.nets.find(t=>t.contract.id===e.contract.id&&t.contract.version===e.contract.version)})(),g=e.contract??h?.contract,_=!f&&(p.isLoading||m.isLoading),v=!f&&p.isError&&!p.isLoading;(0,L.useEffect)(()=>{_E(s,e)||c(gE(e))},[e.harness,e.model,JSON.stringify(e.plugins??[]),JSON.stringify(e.disabledDefaultPlugins??[])]),(0,L.useEffect)(()=>{n&&(o(!0),r===`harness`&&setTimeout(()=>{l.current?.scrollIntoView({block:`center`,behavior:`smooth`}),u.current?.focus()},50))},[n,r]);let y=(h?.compatibleHarnesses??[]).filter(e=>e.supportsRoles.includes(`solving`)).map(e=>({...e,name:bd(e.name)})).filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t),b=new Set(y.map(e=>e.name)),x=s.harness!==``&&y.length>0&&![...b].some(e=>Cd(e,s.harness)),S=h?`${h.contract.id}@${h.contract.version}`:``,C=kd(s.harness),w=dt({mutationFn:()=>B.operator.join(e.manifestCid,{...e.name===void 0?{}:{name:e.name},...g===void 0?{}:{contract:{id:g.id,version:g.version}},roles:e.roles,...s.harness?{harness:s.harness}:{},plugins:s.plugins,disabledDefaultPlugins:s.disabledDefaultPlugins,...s.model?{model:s.model}:{}}),onSuccess:e=>{d.invalidateQueries({queryKey:[`operator`,`joined`]}),e.restartRequired&&i?.()}}),[T,E]=(0,L.useState)(!1),D=e.roles.includes(`solver`),O=aC(D?s.harness:void 0),ee=JS(O,D?s.model:void 0),k=D&&ee.requiresConfirmation,A=k&&!T,[j,M]=(0,L.useState)(!1),N=dt({mutationFn:()=>B.operator.leave(e.manifestCid),onSuccess:e=>{d.invalidateQueries({queryKey:[`operator`,`joined`]}),e.restartRequired&&i?.(),M(!1)}}),te=_E(s,e),P=e.name??e.manifestCid,F=`${e.manifestCid.slice(0,8)}…${e.manifestCid.slice(-4)}`;return(0,R.jsxs)(`article`,{"data-testid":`joined-net-card`,"data-manifest-cid":e.manifestCid,"data-expanded":a?`true`:`false`,className:`flex flex-col gap-2.5 rounded-md border border-border bg-background px-4 py-3.5`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,R.jsx)(`span`,{"data-testid":`joined-net-card-name`,className:`truncate font-serif text-[20px] leading-tight text-foreground tracking-[-0.01em]`,children:P}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2 font-mono text-[11px] text-muted-foreground`,children:[e.roles.map(e=>(0,R.jsx)(xE,{label:e},e)),(0,R.jsxs)(`span`,{className:`text-dim`,children:[`cid `,F]})]})]}),v?(0,R.jsx)(`div`,{className:`flex flex-col items-end gap-1.5`,children:j?(0,R.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`joined-net-card-leave-cancel`,disabled:N.isPending,onClick:()=>M(!1),children:`Cancel`}),(0,R.jsx)(W,{type:`button`,variant:`destructive`,size:`sm`,"data-testid":`joined-net-card-leave-confirm`,disabled:N.isPending,onClick:()=>N.mutate(),children:N.isPending?`Leaving…`:`Confirm leave`})]}):(0,R.jsxs)(W,{type:`button`,variant:`destructive`,size:`sm`,"data-testid":`joined-net-card-leave`,onClick:()=>M(!0),children:[(0,R.jsx)(Hn,{"aria-hidden":`true`,className:`!size-3`}),`Leave`]})}):(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`joined-net-card-toggle`,onClick:()=>o(e=>!e),children:a?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(xn,{"aria-hidden":`true`,className:`!size-3.5`}),`Close`]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Sn,{"aria-hidden":`true`,className:`!size-3.5`}),`Edit`]})})]}),v&&(0,R.jsxs)(`div`,{"data-testid":`joined-net-card-orphaned`,className:`rounded-sm border border-wane bg-transparent px-3.5 py-2.5 font-mono text-[12px] leading-relaxed text-muted-foreground`,children:[(0,R.jsx)(q,{variant:`pill`,className:`mr-2 align-baseline`,children:`Retired`}),`Manifest no longer in the registry. This SolverNet is not claiming on-chain anymore — leaving it removes the entry from your config. Restart the daemon afterwards so it stops looking for this manifest at startup.`,N.isError&&(0,R.jsx)(`div`,{role:`alert`,className:`mt-1.5 text-[11px] text-destructive`,children:N.error instanceof Error?N.error.message:`Leave failed.`})]}),!a&&!v&&(0,R.jsx)(bE,{harness:e.harness,plugins:e.plugins,model:e.model,harnessWarning:x?`does not support ${S}`:null,warningTestId:`joined-net-card-warn-collapsed`}),v&&(0,R.jsx)(bE,{harness:e.harness,plugins:e.plugins,model:e.model,harnessWarning:null}),a&&!v&&(0,R.jsxs)(`div`,{"data-testid":`joined-net-card-form`,className:`flex flex-col gap-3.5 border-t border-border pt-3`,children:[(0,R.jsxs)(`div`,{ref:l,className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(Gf,{htmlFor:`joined-net-card-harness-select`,children:`Harness`}),(0,R.jsxs)(`select`,{ref:u,id:`joined-net-card-harness-select`,"aria-label":`Harness implementation`,"data-testid":`joined-net-card-harness-select`,value:s.harness,onChange:e=>{let t=e.target.value;c(e=>({...e,harness:t,model:Ad(t)})),E(!1)},className:U(vE,x&&`border-destructive`),children:[s.harness===``&&(0,R.jsx)(`option`,{value:``,children:`—`}),y.map(e=>(0,R.jsx)(`option`,{value:e.name,children:Sd(e.name,e.version)},e.name)),s.harness&&y.length>0&&!b.has(s.harness)&&(0,R.jsxs)(`option`,{value:s.harness,children:[xd(s.harness),` (incompatible)`]}),s.harness&&y.length===0&&(0,R.jsx)(`option`,{value:s.harness,children:xd(s.harness)})]}),x&&(0,R.jsxs)(`span`,{"data-testid":`joined-net-card-warn-expanded`,className:`font-mono text-[11px] leading-relaxed text-destructive`,children:[`⚠ This harness does not support `,(0,R.jsx)(`span`,{className:`text-foreground`,children:S}),`.`,y.length>0&&(0,R.jsxs)(R.Fragment,{children:[` Compatible: `,y.map((e,t)=>(0,R.jsxs)(`span`,{className:`text-primary`,children:[xd(e.name),t<y.length-1?` · `:``]},e.name))]})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(Gf,{children:`Plugins`}),_?(0,R.jsx)(`span`,{"data-testid":`joined-net-card-catalog-loading`,className:`font-mono text-[12px] text-dim`,children:`Loading registry catalog…`}):h?(h.compatiblePlugins??[]).length===0?(0,R.jsx)(GS,{available:[],selected:s.plugins,disabledDefaultPlugins:s.disabledDefaultPlugins,onChange:(e,t)=>c(n=>({...n,plugins:e,disabledDefaultPlugins:t})),rowTestId:`joined-net-card-plugin-row`,searchTestId:`joined-net-card-plugin-search`,harness:s.harness}):(0,R.jsx)(GS,{available:h?.compatiblePlugins??[],selected:s.plugins,disabledDefaultPlugins:s.disabledDefaultPlugins,onChange:(e,t)=>c(n=>({...n,plugins:e,disabledDefaultPlugins:t})),rowTestId:`joined-net-card-plugin-row`,searchTestId:`joined-net-card-plugin-search`,harness:s.harness}):(0,R.jsx)(`span`,{"data-testid":`joined-net-card-catalog-missing`,className:`font-mono text-[12px] italic text-dim`,children:`Registry catalog has no template for this SolverNet's contract — plugins can't be verified.`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(Gf,{htmlFor:`joined-net-card-model-select`,children:`Model`}),(0,R.jsxs)(`select`,{id:`joined-net-card-model-select`,"aria-label":`Model`,"data-testid":`joined-net-card-model-select`,value:s.model,onChange:e=>{c({...s,model:e.target.value}),E(!1)},className:vE,children:[C.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.label},e.id)),(()=>{let e=jd(s.model,s.harness);return e.isCustom?(0,R.jsx)(`option`,{value:s.model,children:e.label},s.model):null})()]})]}),D&&(0,R.jsx)(XS,{modelId:s.model,usesPaidApiKey:O,variant:`inline`,testIdPrefix:`joined-net-card-cost`}),D&&(0,R.jsx)(iC,{harness:s.harness,modelId:s.model,variant:`inline`,testIdPrefix:`joined-net-card-footprint`}),k&&(0,R.jsxs)(`label`,{"data-testid":`joined-net-card-cost-confirmation`,"data-cost-confirmation-checked":T?`true`:`false`,className:`flex cursor-pointer items-start gap-2 rounded-md border border-destructive bg-background px-3 py-2.5 font-mono text-[12px] text-foreground`,children:[(0,R.jsx)(`input`,{type:`checkbox`,"data-testid":`joined-net-card-cost-confirmation-checkbox`,checked:T,onChange:e=>E(e.target.checked),className:`mt-0.5 size-3.5 accent-destructive`,"aria-label":`I understand the per-task cost and have a budget for this`}),(0,R.jsx)(`span`,{children:`I understand — I have a budget for this. The selected model is estimated above $1/task on my own provider key.`})]}),w.isError&&(0,R.jsx)(`span`,{role:`alert`,"data-testid":`joined-net-card-error`,className:`font-mono text-[12px] text-destructive`,children:w.error instanceof Error?w.error.message:`Save failed.`}),(0,R.jsx)(kh,{}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between font-mono text-[11px] text-dim`,children:[(0,R.jsx)(`span`,{children:te?`Restart required to apply.`:`No unsaved changes.`}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`joined-net-card-cancel`,disabled:!te||w.isPending,onClick:()=>c(gE(e)),children:`Cancel`}),(0,R.jsx)(W,{type:`button`,size:`sm`,"data-testid":`joined-net-card-save`,disabled:!te||w.isPending||A,onClick:()=>w.mutate(),children:w.isPending?`Saving…`:`Save`})]})]}),(0,R.jsxs)(`div`,{"data-testid":`joined-net-card-leave-zone`,className:`mt-1 flex flex-wrap items-start justify-between gap-3 border-t border-dashed border-border pt-3`,children:[(0,R.jsx)(`span`,{"data-testid":`joined-net-card-leave-explainer`,className:`max-w-[440px] font-mono text-[11px] leading-relaxed text-dim`,children:`Leave removes this SolverNet from your config right away. The running daemon keeps its loaded copy in memory, so it will go on claiming and finishing tasks for this SolverNet until you restart it — restart to actually stop new claims. Tasks already in flight run to completion either way. You can re-join from the Discover catalog later.`}),j?(0,R.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`joined-net-card-leave-cancel`,disabled:N.isPending,onClick:()=>M(!1),children:`Cancel`}),(0,R.jsx)(W,{type:`button`,variant:`destructive`,size:`sm`,"data-testid":`joined-net-card-leave-confirm`,disabled:N.isPending,onClick:()=>N.mutate(),children:N.isPending?`Leaving…`:`Confirm leave`})]}):(0,R.jsxs)(W,{type:`button`,variant:`destructive`,size:`sm`,"data-testid":`joined-net-card-leave`,onClick:()=>M(!0),children:[(0,R.jsx)(Hn,{"aria-hidden":`true`,className:`!size-3`}),`Leave SolverNet`]})]})]})]})}function bE({harness:e,plugins:t,model:n,harnessWarning:r,warningTestId:i}){return(0,R.jsxs)(`div`,{className:`grid grid-cols-[90px_1fr] gap-x-3 gap-y-1.5 font-mono text-[12px] text-muted-foreground`,children:[(0,R.jsx)(`span`,{children:`harness`}),(0,R.jsxs)(`span`,{className:`text-foreground`,children:[e?xd(e):(0,R.jsx)(`span`,{className:`text-dim`,children:`—`}),r&&i&&(0,R.jsxs)(`span`,{"data-testid":i,className:`ml-2.5 text-destructive`,children:[`⚠ `,r]})]}),(0,R.jsx)(`span`,{children:`plugins`}),(0,R.jsx)(`span`,{className:`text-foreground`,children:(t??[]).length===0?(0,R.jsx)(`span`,{className:`text-dim`,children:`—`}):`${t.length} active`}),(0,R.jsx)(`span`,{children:`model`}),(0,R.jsx)(`span`,{className:`text-foreground`,children:n?jd(n,bd(e)).label:(0,R.jsx)(`span`,{className:`text-dim`,children:`—`})})]})}function xE({label:e}){return(0,R.jsx)(q,{variant:`outline`,"data-testid":`joined-net-card-role`,className:`px-1.5 py-px text-[10px]`,children:e})}function SE({onRestartPending:e}={}){let t=ut({queryKey:[`operator`,`joined`],queryFn:()=>B.operator.listJoined(),refetchInterval:3e4}),n=(0,L.useMemo)(()=>{let e=t.data?.joinedSolverNets??{};return Object.values(e)},[t.data]);return(0,R.jsxs)(`div`,{"data-testid":`memberships-tab`,className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:[`Joined · `,n.length]}),t.isError&&(0,R.jsx)(`span`,{role:`alert`,className:`font-mono text-[11px] text-[var(--break-red)]`,children:`Failed to load joined SolverNets.`})]}),t.isLoading&&(0,R.jsxs)(`div`,{"data-testid":`memberships-tab-loading`,className:`flex flex-col gap-3`,"aria-label":`Loading`,children:[(0,R.jsx)(ld,{className:`h-20 w-full`}),(0,R.jsx)(ld,{className:`h-20 w-full`})]}),!t.isLoading&&n.length===0&&(0,R.jsxs)(`p`,{"data-testid":`memberships-tab-empty`,className:`m-0 font-mono text-[12px] leading-relaxed text-muted-foreground`,children:[`You haven't joined any SolverNets yet. Browse the`,` `,(0,R.jsx)($t,{href:`/operator/registry`,className:`text-primary no-underline hover:underline`,children:`Registry`}),` `,`to participate.`]}),n.map(t=>(0,R.jsx)(yE,{joined:t,onRestartPending:e},t.manifestCid))]})}var CE={launched:{variant:`success`,label:`Launched`},paused:{variant:`pill`,label:`Paused`},retired:{variant:`outline`,label:`Retired`}};function wE(e){return e?e.length<=13?e:`${e.slice(0,6)}…${e.slice(-4)}`:``}function TE(e){if(!e)return null;try{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().replace(`T`,` `).slice(0,16)+` UTC`}catch{return e}}function EE(e){if(e instanceof Error){let t=e.code;if(typeof t==`string`)return t;if(e.message.includes(`subsystem_not_ready`))return`subsystem_not_ready`;if(e.message.includes(`registry_unavailable`))return`registry_unavailable`;if(e.message.includes(`rpc_rate_limited`))return`rpc_rate_limited`}return null}var DE={title:`Your RPC endpoint is rate-limited.`,detail:`Open the Network section and add your own free key.`,actionHref:`/operator#network`,actionLabel:`Open Network settings →`};function OE(e){switch(EE(e)){case`subsystem_not_ready`:return{title:`SolverNet subsystem is still starting.`,detail:`Wait a few seconds, then retry. If this persists, restart the daemon and check its startup logs.`};case`registry_unavailable`:return{title:`Registry cache is unavailable.`,detail:`The daemon could not read the SolverNet registry cache. Retry after startup finishes; check daemon logs if it keeps failing.`};case`rpc_rate_limited`:return DE;default:return{title:`Failed to load registry catalog.`,detail:e instanceof Error?e.message:`Unknown error`}}}function kE({code:e,message:t}){return e===`rpc_rate_limited`?(0,R.jsxs)(`span`,{"data-testid":`registry-catalog-warn`,"data-error-code":`rpc_rate_limited`,className:`inline-flex gap-2 normal-case tracking-normal text-[var(--wane)]`,children:[(0,R.jsx)(`span`,{children:`RPC rate-limited — add your own key`}),(0,R.jsx)($t,{href:`/operator#network`,"data-testid":`registry-catalog-warn-action`,className:`text-primary no-underline hover:underline`,children:`Network settings →`})]}):(0,R.jsxs)(`span`,{"data-testid":`registry-catalog-warn`,className:`normal-case tracking-normal text-[var(--wane)]`,children:[`stale (`,t,`)`]})}function AE({status:e}){let t=CE[e]??CE.launched;return(0,R.jsx)(q,{"data-testid":`registry-status-badge`,"data-status":e,variant:t.variant,className:`whitespace-nowrap`,children:t.label})}function jE({openRoles:e}){return e.length===0?(0,R.jsx)(`span`,{className:`text-[12px] text-[var(--fg-dim)]`,children:`no open roles`}):(0,R.jsx)(`span`,{className:`flex flex-wrap gap-1.5`,children:e.map(e=>(0,R.jsx)(q,{"data-testid":`registry-open-role`,"data-role":e,variant:`outline`,className:`rounded-full text-foreground`,children:e},e))})}function ME({summary:e,joinedRoles:t,recommended:n}){let r=`/operator/join/${encodeURIComponent(e.manifestCid)}`,i=(t??[]).length>0,a=e.status===`launched`,o=i?`Edit`:n?`Try the demo`:`Join`;return(0,R.jsx)(G,{"data-testid":`registry-card`,"data-manifest-cid":e.manifestCid,className:`flex flex-col gap-3 p-4`,children:(0,R.jsxs)(`article`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`header`,{className:`flex items-start justify-between gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,R.jsx)(`span`,{className:e.name?`truncate font-mono text-[15px] font-medium text-foreground`:`truncate font-mono text-[15px] font-medium italic text-[var(--fg-muted)]`,children:e.name||`Metadata pending`}),(0,R.jsxs)(`span`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:[`Launcher: `,wE(e.launcherSafeAddress),` · agentId`,` `,e.launcherAgentId]})]}),(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[n&&!i&&(0,R.jsx)(q,{"data-testid":`registry-card-recommended`,variant:`secondary`,className:`whitespace-nowrap`,children:`Recommended demo`}),(0,R.jsx)(AE,{status:e.status})]})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 font-mono text-[12px] text-[var(--fg-muted)]`,children:[(0,R.jsx)(`span`,{children:`Open roles`}),(0,R.jsx)(jE,{openRoles:e.openRoles}),(0,R.jsx)(`span`,{children:`Solution price`}),(0,R.jsx)(`span`,{className:`text-foreground`,children:lv(e.solutionPriceWei)}),(0,R.jsx)(`span`,{children:`Verdict price`}),(0,R.jsx)(`span`,{className:`text-foreground`,children:lv(e.verdictPriceWei)})]}),(0,R.jsxs)(`footer`,{className:`flex items-center justify-end gap-3`,children:[i&&(0,R.jsxs)(q,{"data-testid":`registry-card-joined`,"data-manifest-cid":e.manifestCid,variant:`success`,className:`rounded-full px-2.5 py-1`,children:[`JOINED · `,(t??[]).join(`, `)]}),a?(0,R.jsx)(W,{asChild:!0,variant:i?`secondary`:`default`,"data-testid":`registry-join-cta`,"data-manifest-cid":e.manifestCid,children:(0,R.jsx)($t,{href:r,children:o})}):(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`registry-join-cta`,"data-manifest-cid":e.manifestCid,disabled:!0,"aria-disabled":!0,className:`pointer-events-none`,children:i?`Edit`:`Join`})]})]})})}function NE({refetchIntervalMs:e=3e4}={}){let{data:t,isLoading:n,isError:r,error:i,refetch:a}=ut({queryKey:[`solvernets`,`registry`],queryFn:()=>B.solvernets.listRegistry(),refetchInterval:e}),o=ut({queryKey:[`operator`,`joined`],queryFn:()=>B.operator.listJoined(),refetchInterval:e}),s=o.data?.joinedSolverNets??{};if(n||o.isLoading)return(0,R.jsx)(`p`,{"data-testid":`registry-catalog-loading`,className:`m-0 font-mono text-[13px] text-[var(--fg-muted)]`,children:`Loading catalog…`});if(r||o.isError){let e=OE(r?i:o.error);return(0,R.jsxs)(fo,{"data-testid":`registry-catalog-error`,variant:`blocking`,className:`flex items-center justify-between gap-4 border-l-0 border border-destructive p-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(po,{className:`font-mono text-[13px] font-medium text-destructive`,children:e.title}),(0,R.jsx)(mo,{className:`text-[12px] text-[var(--fg-muted)]`,children:e.detail}),e.actionHref&&e.actionLabel&&(0,R.jsx)($t,{href:e.actionHref,"data-testid":`registry-catalog-error-action`,className:`mt-0.5 font-mono text-[12px] text-primary no-underline hover:underline`,children:e.actionLabel})]}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`registry-catalog-retry`,onClick:()=>{a()},children:`Retry`})]})}let c=t?.summaries??[],l=c.filter(e=>s[e.manifestCid]===void 0).filter(e=>!dd(e)).sort((e,t)=>Number(ud(t))-Number(ud(e))),u=TE(t?.lastRefreshedAt??null),d=t?.lastError??null;return(0,R.jsxs)(`div`,{"data-testid":`registry-catalog`,className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between font-mono text-[11px] uppercase tracking-[0.14em] text-[var(--fg-muted)]`,children:[(0,R.jsxs)(`span`,{"data-testid":`registry-catalog-meta`,children:[l.length,` discoverable · last refreshed`,` `,u??`never`]}),d&&(0,R.jsx)(kE,{code:d.code,message:d.message})]}),l.length===0?(0,R.jsx)(G,{"data-testid":`registry-catalog-empty`,className:`p-6 font-mono text-[13px] text-[var(--fg-muted)]`,children:c.length===0?`No launched SolverNets available.`:`No unjoined SolverNets available.`}):(0,R.jsx)(`div`,{className:`flex flex-col gap-2.5`,children:l.map(e=>(0,R.jsx)(ME,{summary:e,joinedRoles:s[e.manifestCid]?.roles,recommended:ud(e)},e.manifestCid))})]})}function PE(){return(0,R.jsxs)(`div`,{"data-testid":`registry-tab`,className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:[(0,R.jsx)(Dn,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),`Discover`]}),(0,R.jsx)(NE,{})]})}function FE({onRestartPending:e=()=>void 0}={}){let{data:t}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap(),refetchInterval:1500}),n=t?.chain??`base-sepolia`,r=t?.publicDefaults??[],i=t?.rpcUrls??r;return(0,R.jsxs)(`div`,{"data-testid":`network-tab`,className:`flex flex-col gap-4`,children:[(0,R.jsx)(VE,{chain:n,rpcUrls:i,publicDefaults:r,slotHealth:t?.rpcSlotHealth??[],onRestartPending:e},i.join(`,`)),(0,R.jsx)(LE,{})]})}function IE(e){if(e instanceof Error){let t=e.code;if(typeof t==`string`)return t;if(e.message.includes(`rpc_rate_limited`))return`rpc_rate_limited`;if(e.message.includes(`discovery_unavailable`))return`discovery_unavailable`;if(e.message.includes(`subsystem_not_ready`))return`subsystem_not_ready`}}function LE(){let{data:e,isLoading:t,isError:n,error:r}=ut({queryKey:[`discovery`,`task-post-counts`,`chain`],queryFn:()=>B.discovery.getTaskPostCounts(),refetchInterval:3e4}),i;return i=n?IE(r)===`rpc_rate_limited`?(0,R.jsxs)(fo,{variant:`warning`,"data-error-code":`rpc_rate_limited`,children:[(0,R.jsx)(Vn,{className:`h-4 w-4 text-[var(--wane)]`}),(0,R.jsx)(po,{className:`text-[var(--wane)]`,children:`RPC rate-limited`}),(0,R.jsx)(mo,{children:`Your RPC endpoint is rate-limited — add your own free key above to keep the task-post rate live.`})]}):(0,R.jsx)(`p`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:`Task-post rate is unavailable while the indexer catches up.`}):t||!e?(0,R.jsx)(`p`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:`Loading…`}):e.chain?e.chain.h24===0?(0,R.jsx)(`p`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:`No task posts in the last 24h.`}):(0,R.jsx)(`div`,{className:`grid grid-cols-3 gap-4`,children:[[`Last 1h`,e.chain.h1],[`Last 6h`,e.chain.h6],[`Last 24h`,e.chain.h24]].map(([e,t])=>(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:e}),(0,R.jsx)(`span`,{className:`font-mono text-[20px] text-foreground`,children:t})]},e))}):(0,R.jsx)(`p`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:`Task-post rate is unavailable while the indexer catches up.`}),(0,R.jsxs)(G,{"data-testid":`network-task-posts`,children:[(0,R.jsxs)(zi,{children:[(0,R.jsxs)(Bi,{className:`flex items-center gap-2`,children:[(0,R.jsx)(vn,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),`Task posts`]}),(0,R.jsx)(Vi,{children:`On-chain task posts on this network (approximate, block-windowed).`})]}),(0,R.jsx)(Hi,{children:i})]})}function RE(e){try{return new URL(e).hostname||e}catch{return e}}function zE(e,t){return e.length!==0&&e[0]!==t[0]}function BE({health:e}){return e?e.ok?(0,R.jsxs)(q,{variant:`success`,children:[e.localDev?`local dev`:`healthy`,e.latencyMs===void 0?``:` · ${e.latencyMs}ms`]}):e.reason===`chain_mismatch`?(0,R.jsxs)(q,{variant:`destructive`,children:[`wrong chain`,e.actualChainId!==void 0&&e.expectedChainId!==void 0?` · ${e.actualChainId}/${e.expectedChainId}`:``]}):(0,R.jsx)(q,{variant:e.code===429?`warning`:`destructive`,children:e.code===void 0?`unreachable`:`degraded · ${e.code}`}):(0,R.jsx)(q,{variant:`outline`,children:`unknown`})}function VE({chain:e,rpcUrls:t,publicDefaults:n,slotHealth:r,onRestartPending:i}){let a=zE(t,n),o=a?t[0]:``,[s,c]=(0,L.useState)(o),[l,u]=(0,L.useState)(!1),d=s.trim()!==o,f=e===`base`?`Base mainnet (chain id 8453)`:`Base Sepolia (chain id 84532)`,p=f.split(` (`)[0],m=async()=>{u(!0);try{let e=s.trim().length===0?null:s.trim(),t=await B.updateNetwork({rpcUrl:e});ph.success(e?`Primary RPC saved`:`Primary RPC cleared`,{description:t.restartRequired?`Restart pending — applies on next daemon start.`:`Applied to the running daemon.`}),t.restartRequired&&i()}catch(e){ph.error(`Failed to save Primary RPC`,{description:e instanceof Error?e.message:String(e)})}finally{u(!1)}};return(0,R.jsxs)(G,{children:[(0,R.jsxs)(zi,{className:`flex flex-row items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(Bi,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Fn,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),`Network`]}),(0,R.jsxs)(Vi,{children:[p,` · `,t.length,` RPC slot`,t.length===1?``:`s`]})]}),(0,R.jsx)(q,{variant:`outline`,children:`locked`})]}),(0,R.jsxs)(Hi,{className:`flex flex-col gap-6`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(Gf,{children:`Chain`}),(0,R.jsx)(`div`,{className:`rounded-md border border-border bg-[var(--bg-sunken)] px-3 py-2 font-mono text-[13px] text-muted-foreground`,children:f}),(0,R.jsx)(`p`,{className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:`Switching chains resets fleet state — that's a separate flow.`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Gf,{htmlFor:`primary-rpc`,children:`Primary RPC`}),d&&(0,R.jsx)(q,{variant:`warning`,children:`Restart`})]}),(0,R.jsx)(o_,{id:`primary-rpc`,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`https://your-key.example (optional)`,className:d?`border-primary`:void 0}),(0,R.jsx)(`p`,{className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:`Tried first — falls back to public chain on failure.`}),!a&&(0,R.jsxs)(`p`,{className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:[`You're on the shared public chain — fine for setup, not reliable under load. Get your own free key from`,` `,(0,R.jsxs)(`a`,{href:`https://dashboard.tenderly.co/`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-primary hover:underline`,children:[`Tenderly `,(0,R.jsx)(kn,{className:`h-2.5 w-2.5`})]}),`,`,` `,(0,R.jsxs)(`a`,{href:`https://www.alchemy.com/`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-primary hover:underline`,children:[`Alchemy `,(0,R.jsx)(kn,{className:`h-2.5 w-2.5`})]}),`, or`,` `,(0,R.jsxs)(`a`,{href:`https://www.quicknode.com/`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-primary hover:underline`,children:[`QuickNode `,(0,R.jsx)(kn,{className:`h-2.5 w-2.5`})]}),` `,`and paste it above.`]}),d&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(W,{variant:`secondary`,size:`sm`,type:`button`,onClick:()=>c(o),children:`Cancel`}),(0,R.jsx)(W,{variant:`default`,size:`sm`,type:`button`,disabled:l,onClick:()=>{m()},children:l?`Saving…`:o&&s.trim().length===0?`Clear`:`Save`})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(Gf,{children:`RPC fallback chain`}),(0,R.jsx)(`div`,{"data-testid":`network-rpc-slots`,className:`flex flex-col divide-y divide-border rounded-md border border-border`,children:t.map((e,t)=>(0,R.jsxs)(`div`,{"data-testid":`network-rpc-slot`,className:`flex items-center justify-between gap-3 px-3 py-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:[`slot `,t]}),(0,R.jsx)(`span`,{className:`truncate font-mono text-[12px] text-foreground`,children:RE(e)})]}),(0,R.jsx)(BE,{health:r[t]})]},`${t}-${e}`))}),(0,R.jsx)(`p`,{className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:`Primary → public backups, in order. Health from the last boot probe.`})]})]})]})}var HE=e=>e.type===`checkbox`,UE=e=>e instanceof Date,WE=e=>e==null,GE=e=>typeof e==`object`,KE=e=>!WE(e)&&!Array.isArray(e)&&GE(e)&&!UE(e),qE=e=>KE(e)&&e.target?HE(e.target)?e.target.checked:e.target.value:e,JE=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),YE=e=>{let t=e.constructor&&e.constructor.prototype;return KE(t)&&t.hasOwnProperty(`isPrototypeOf`)},XE=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function ZE(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(XE&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(KE(e)&&YE(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=ZE(e[t]));return r}var QE={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},$E={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},eD={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},tD=`root`,nD=[`__proto__`,`constructor`,`prototype`],rD=/^\w*$/,iD=e=>rD.test(e),aD=e=>e===void 0,oD=/[.[\]'"]/,sD=e=>e.split(oD).filter(Boolean),J=(e,t,n)=>{if(!t||!KE(e))return n;let r=iD(t)?[t]:sD(t);if(r.some(e=>nD.includes(e)))return n;let i=r.reduce((e,t)=>WE(e)?void 0:e[t],e);return aD(i)||i===e?aD(e[t])?n:e[t]:i},cD=e=>typeof e==`boolean`,lD=e=>typeof e==`function`,uD=(e,t,n)=>{let r=-1,i=iD(t)?[t]:sD(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=KE(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(nD.includes(t))return;e[t]=a,e=e[t]}},dD=L.createContext(null);dD.displayName=`HookFormControlContext`;var fD=()=>L.useContext(dD),pD=(e,t,n,r=!0)=>{let i={};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==$E.all&&(t._proxyFormState[i]=!r||$E.all),n&&(n[i]=!0),e[i]}});return i},mD=XE?L.useLayoutEffect:L.useEffect;function hD(e){let t=fD(),{control:n=t,disabled:r,name:i,exact:a}=e||{},[o,s]=L.useState(()=>({...n._formState,defaultValues:n._defaultValues})),c=L.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return mD(()=>n._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!r&&s({...n._formState,...e,defaultValues:n._defaultValues})}}),[i,r,a]),L.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),L.useMemo(()=>pD(o,n,c.current,!1),[o,n])}var gD=e=>typeof e==`string`,_D=(e,t,n,r,i)=>gD(e)?(r&&t.watch.add(e),J(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),J(n,e))):(r&&(t.watchAll=!0),n),vD=e=>WE(e)||!GE(e),yD=(e,t)=>t.length===0&&!Array.isArray(e)&&!YE(e);function bD(e,t,n=new WeakMap){if(e===t)return!0;if(vD(e)||vD(t))return Object.is(e,t);if(UE(e)&&UE(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(yD(e,r)||yD(t,i))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;let a=n.get(e);if(a&&a.has(t))return!0;if(a)a.add(t);else{let r=new WeakSet;r.add(t),n.set(e,r)}for(let i of r){let r=e[i];if(!(i in t))return!1;if(i!==`ref`){let e=t[i];if(UE(r)&&UE(e)||(KE(r)||Array.isArray(r))&&(KE(e)||Array.isArray(e))?!bD(r,e,n):!Object.is(r,e))return!1}}return!0}function xD(e){let t=fD(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=L.useRef(i),l=L.useRef(s),u=L.useRef(void 0),d=L.useRef(n),f=L.useRef(r);l.current=s;let[p,m]=L.useState(()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e}),h=L.useCallback(e=>{let t=_D(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),g=L.useCallback(e=>{if(!a){let t=_D(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);bD(e,u.current)||(m(e),u.current=e)}else m(t)}},[n._formValues,n._names,a,r]);mD(()=>((d.current!==n||!bD(f.current,r))&&(d.current=n,f.current=r,g()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:e=>{g(e.values)}})),[n,o,r,g]),L.useEffect(()=>n._removeUnmounted());let _=d.current!==n,v=f.current,y=L.useMemo(()=>{if(a)return null;let e=!_&&!bD(v,r);return _||e?h():null},[a,_,r,v,h]);return y===null?p:y}function SD(e){let t=fD(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=JE(i._names.array,n),l=xD({control:i,name:n,defaultValue:L.useMemo(()=>J(i._formValues,n,J(i._defaultValues,n,o)),[i,n,o]),exact:s}),u=hD({control:i,name:n,exact:s}),d=L.useRef(e),f=L.useRef(null),p=L.useRef(i.register(n,{...e.rules,value:l,...cD(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let m=L.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!J(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!J(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!J(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!J(u.validatingFields,n)},error:{enumerable:!0,get:()=>J(u.errors,n)}}),[u,n]),h=L.useCallback(e=>{let t=qE(e);return J(i._fields,n)||(p.current=i.register(n,{...d.current.rules,value:t})),p.current.onChange({target:{value:qE(e),name:n},type:QE.CHANGE})},[n,i]),g=L.useCallback(()=>p.current.onBlur({target:{value:J(i._formValues,n),name:n},type:QE.BLUR}),[n,i._formValues]),_=L.useCallback(e=>{e&&(f.current={focus:()=>lD(e.focus)&&e.focus(),select:()=>lD(e.select)&&e.select(),setCustomValidity:t=>lD(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>lD(e.reportValidity)&&e.reportValidity()});let t=J(i._fields,n);t&&t._f&&e&&(t._f.ref=f.current)},[i._fields,n]),v=L.useMemo(()=>({name:n,value:l,...cD(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:h,onBlur:g,ref:_}),[n,r,u.disabled,h,g,_,l]);return L.useEffect(()=>{let e=i._options.shouldUnregister||a;i.register(n,{...d.current.rules,...cD(d.current.disabled)?{disabled:d.current.disabled}:{}});let t=(e,t)=>{let n=J(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=ZE(J(a?i._defaultValues:i._options.values||i._defaultValues,n,J(i._options.defaultValues,n,d.current.defaultValue)));uD(i._defaultValues,n,e),aD(J(i._formValues,n))&&uD(i._formValues,n,e)}if(!c&&i.register(n),f.current){let e=J(i._fields,n);e&&e._f&&(e._f.ref=f.current)}return()=>{(c?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,c,a]),L.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),L.useMemo(()=>({field:v,formState:u,fieldState:m}),[v,u,m])}var CD=e=>e.render(SD(e)),wD=e=>({isOnSubmit:!e||e===$E.onSubmit,isOnBlur:e===$E.onBlur,isOnChange:e===$E.onChange,isOnAll:e===$E.all,isOnTouch:e===$E.onTouched}),TD=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(let n of t.watch)if(e.startsWith(n)&&e.charAt(n.length)===`.`)return!0;return!1},ED=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=J(e,i);if(n){let{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(ED(a,t))break}else if(KE(a)&&ED(a,t))break}}},DD=(e,t,n)=>{let r=J(e,n),i=Array.isArray(r)?r:[];return uD(i,tD,t[n]),uD(e,n,i),e},OD=e=>KE(e)&&!Object.keys(e).length,kD=e=>e.type===`file`,AD=e=>{if(!XE)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},jD=e=>e.type===`radio`,MD=e=>e instanceof RegExp,ND=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},PD={value:!1,isValid:!1},FD={value:!0,isValid:!0},ID=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!aD(e[0].attributes.value)?aD(e[0].value)||e[0].value===``?FD:{value:e[0].value,isValid:!0}:FD:PD}return PD},LD={isValid:!1,value:null},RD=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,LD):LD;function zD(e,t,n=`validate`){if(gD(e)||Array.isArray(e)&&e.every(gD)||cD(e)&&!e)return{type:n,message:gD(e)?e:``,ref:t}}var BD=e=>KE(e)&&!MD(e)?e:{value:e,message:``},VD=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_}=e._f,v=J(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{if(i&&y.reportValidity){let t=cD(e)?``:e||``;s?s.forEach(e=>e.setCustomValidity(t)):y.setCustomValidity(t),y.reportValidity()}},x={},S=jD(o),C=HE(o),w=S||C,T=(g||kD(o))&&aD(o.value)&&aD(v)||AD(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length,E=ND.bind(null,h,r,x),D=(e,t,n,r=eD.maxLength,i=eD.minLength)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...E(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!w&&(T||WE(v))||cD(v)&&!v||C&&!ID(s).isValid||S&&!RD(s).isValid)){let{value:e,message:t}=gD(c)?{value:!!c,message:c}:BD(c);if(e&&(x[h]={type:eD.required,message:t,ref:y,...E(eD.required,t)},!r))return b(t),x}if(!T&&(!WE(d)||!WE(f))){let e,t,n=BD(f),i=BD(d);if(!WE(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;WE(n.value)||(e=r>n.value),WE(i.value)||(t=r<i.value)}else{let r=o.valueAsDate||new Date(v),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;gD(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),gD(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}if((e||t)&&(D(!!e,n.message,i.message,eD.max,eD.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(gD(v)||a&&Array.isArray(v))){let e=BD(l),t=BD(u),n=!WE(e.value)&&v.length>+e.value,i=!WE(t.value)&&v.length<+t.value;if((n||i)&&(D(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!T&&gD(v)){let{value:e,message:t}=BD(p);if(MD(e)&&!v.match(e)&&(x[h]={type:eD.pattern,message:t,ref:o,...E(eD.pattern,t)},!r))return b(t),x}if(m){if(lD(m)){let e=zD(await m(v,n),y);if(e&&(x[h]={...e,...E(eD.validate,e.message)},!r))return b(e.message),x}else if(KE(m)){let e={};for(let t in m){if(!OD(e)&&!r)break;let i=zD(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!OD(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},HD=e=>Array.isArray(e)?e:[e],UD=e=>Array.isArray(e)?e.filter(Boolean):[];function WD(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;){if(WE(e)){e=void 0;break}e=e[t[r]],r++}return e}function GD(e){for(let t in e)if(e.hasOwnProperty(t)&&!aD(e[t]))return!1;return!0}function KD(e,t){if(gD(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:iD(t)?[t]:sD(t);if(n.some(e=>nD.includes(String(e))))return e;let r=n.length===1?e:WD(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(KE(r)&&OD(r)||Array.isArray(r)&&GD(r))&&KD(e,n.slice(0,-1)),e}var qD=e=>{let t={};for(let n of Object.keys(e))if(GE(e[n])&&e[n]!==null&&!UE(e[n])){let r=qD(e[n]);for(let e of Object.keys(r))t[`${n}.${e}`]=r[e]}else t[n]=e[n];return t},JD=L.createContext(null);JD.displayName=`HookFormContext`;var YD=()=>L.useContext(JD),XD=({children:e,watch:t,getValues:n,getFieldState:r,setError:i,clearErrors:a,setValue:o,setValues:s,trigger:c,formState:l,resetField:u,reset:d,resetDefaultValues:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:_,subscribe:v})=>{let y=L.useMemo(()=>({watch:t,getValues:n,getFieldState:r,setError:i,clearErrors:a,setValue:o,setValues:s,trigger:c,formState:l,resetField:u,reset:d,resetDefaultValues:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:_,subscribe:v}),[a,h,l,r,n,p,g,d,f,u,i,_,o,s,v,c,m,t]);return L.createElement(JD.Provider,{value:y},L.createElement(dD.Provider,{value:y.control},e))},ZD=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function QD(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&KE(i)&&a){let e=QD(i,a);KE(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var $D=e=>e.type===`select-multiple`,eO=e=>jD(e)||HE(e),tO=e=>AD(e)&&e.isConnected,nO=e=>{for(let t in e)if(lD(e[t]))return!0;return!1};function rO(e){return Array.isArray(e)||KE(e)&&!nO(e)}function iO(e){return!!(e&&`_f`in e)}function aO(e){return Array.isArray(e)?!e.some(e=>!aD(e)):!Object.keys(e).length}function oO(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function sO(e,t={},n){for(let r in e){let i=e[r],a=n&&n[r];rO(i)&&(!Array.isArray(i)||!iO(a))?(t[r]=Array.isArray(i)?[]:{},sO(i,t[r],a),aO(t[r])&&oO(t,r)):aD(i)||(t[r]=!0)}return t}function cO(e,t,n,r){n||=sO(t,{},r);for(let i in e){let a=e[i],o=r&&r[i];rO(a)&&(!Array.isArray(a)||!iO(o))?(aD(t)||vD(n[i])?n[i]=sO(a,Array.isArray(a)?[]:{},o):cO(a,WE(t)?{}:t[i],n[i],o),aO(n[i])&&oO(n,i)):bD(a,t[i])?oO(n,i):n[i]=!0}return n}var lO=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>aD(e)?e:t?e===``?NaN:e&&+e:n&&gD(e)?new Date(e):r?r(e):e;function uO(e){let t=e.ref;return kD(t)?t.files:jD(t)?RD(e.refs).value:$D(t)?[...t.selectedOptions].map(({value:e})=>e):HE(t)?ID(e.refs).value:lO(aD(t.value)?e.ref.value:t.value,e)}var dO=(e,t,n,r)=>{let i={};for(let n of e){let e=J(t,n);e&&uD(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},fO=e=>aD(e)?e:MD(e)?e.source:KE(e)?MD(e.value)?e.value.source:e.value:e,pO=`AsyncFunction`,mO=e=>{if(!e||!e.validate)return!1;if(lD(e.validate))return e.validate.constructor.name===pO;if(KE(e.validate)){for(let t in e.validate)if(e.validate[t].constructor.name===pO)return!0}return!1},hO=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function gO(e,t,n){let r=J(e,n);if(r||iD(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=J(t,r),o=J(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var _O=(e,t,n,r)=>{n(e);let{name:i,...a}=e,o=Object.keys(a);return!o.length||r&&o.length>=Object.keys(t).length||o.find(e=>t[e]===(!r||$E.all))},vO=(e,t,n)=>!e||!t||e===t||HD(e).some(e=>e&&(n?e===t||e.startsWith(t+`.`):e.startsWith(t)||t.startsWith(e))),yO=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,bO=(e,t)=>!UD(J(e,t)).length&&KD(e,t),xO={mode:$E.onSubmit,reValidateMode:$E.onChange,shouldFocusError:!0},SO=`form`,CO={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function wO(e={}){let t={...xO,...e},n={...ZE(CO),isLoading:lD(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},r={},i=(KE(t.defaultValues)||KE(t.values))&&ZE(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:ZE(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c={},l={},u=0,d=wD(t.mode),f=wD(t.reValidateMode),p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...p},h={...m},g={array:ZD(),state:ZD()},_=0,v=t.criteriaMode===$E.all,y=(e,t)=>n=>{clearTimeout(l[e]),l[e]=setTimeout(t,n)},b=async e=>{if(!o.keepIsValid&&!t.disabled&&(m.isValid||h.isValid||e)){let e=++_,i;t.resolver?(i=OD((await k()).errors),e===_&&x()):i=await M({fields:r,onlyCheckValid:!0,eventType:QE.VALID}),e===_&&i!==n.isValid&&g.state.next({isValid:i})}},x=(e,r)=>{!t.disabled&&(m.isValidating||m.validatingFields||h.isValidating||h.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?uD(n.validatingFields,e,r):KD(n.validatingFields,e))}),g.state.next({validatingFields:n.validatingFields,isValidating:!OD(n.validatingFields)}))},S=()=>{n.dirtyFields=cO(i,a,void 0,r)},C=(e,i=[],s,c,l=!0,u=!0)=>{if(c&&s&&!t.disabled){if(o.action=!0,u&&Array.isArray(J(r,e))){let t=s(J(r,e),c.argA,c.argB);l&&uD(r,e,t)}if(u&&Array.isArray(J(n.errors,e))){let t=s(J(n.errors,e),c.argA,c.argB);l&&uD(n.errors,e,t),bO(n.errors,e)}if((m.touchedFields||h.touchedFields)&&u&&Array.isArray(J(n.touchedFields,e))){let t=s(J(n.touchedFields,e),c.argA,c.argB);l&&uD(n.touchedFields,e,t)}(m.dirtyFields||h.dirtyFields)&&S(),g.state.next({name:e,isDirty:te(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else uD(a,e,i)},w=(e,t)=>{uD(n.errors,e,t),n.errors={...n.errors},g.state.next({errors:n.errors})},T=e=>{n.errors=e,g.state.next({errors:n.errors,isValid:!1})},E=e=>{let t=iD(e)?[e]:sD(e),n=a,r=i;for(let e=0;e<t.length-1;e++){let i=t[e];if(n=WE(n)?n:n[i],r=WE(r)?r:r[i],n===null&&r!==null)return!0}return!1},D=(t,c,l,u)=>{let d=J(r,t);if(d){if(E(t))return;let r=aD(J(a,t)),f=J(a,t,aD(l)?J(i,t):l);aD(f)||u&&u.defaultChecked||c?uD(a,t,c?f:uO(d._f)):ne(t,f),o.mount&&!o.action&&(b(),r&&n.isDirty&&(m.isDirty||h.isDirty)&&(te()||(n.isDirty=!1,g.state.next({...n}))),e.shouldUnregister&&r&&!aD(J(a,t))&&TD(t,s)&&(o.watch=!0))}},O=(e,o,s,c,l)=>{let u=!1,d=!1,f={name:e};if(!t.disabled||c===!0){if(!s||c){let t=bD(J(i,e),o);(m.isDirty||h.isDirty)&&(d=n.isDirty,n.isDirty=f.isDirty=!t||te(),u=d!==f.isDirty),d=!!J(n.dirtyFields,e),t===n.isDirty?t?KD(n.dirtyFields,e):uD(n.dirtyFields,e,!0):n.dirtyFields=cO(i,a,void 0,r),f.dirtyFields=n.dirtyFields,u||=(m.dirtyFields||h.dirtyFields)&&d!==!t}if(s){let t=J(n.touchedFields,e);t||(uD(n.touchedFields,e,s),f.touchedFields=n.touchedFields,u||=(m.touchedFields||h.touchedFields)&&t!==s)}u&&l&&g.state.next(f)}return u?f:{}},ee=(e,r,i,a)=>{let o=J(n.errors,e),s=(m.isValid||h.isValid)&&cD(r)&&n.isValid!==r;if(t.delayError&&i?(c[e]=y(e,()=>w(e,i)),c[e](t.delayError)):(clearTimeout(l[e]),delete c[e],i?uD(n.errors,e,i):KD(n.errors,e),n.errors={...n.errors}),(i?!bD(o,i):o)||!OD(a)||s){let t={...a,...s&&cD(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},g.state.next(t)}},k=async e=>(x(e,!0),await t.resolver(a,t.context,dO(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),A=async e=>{let{errors:t}=await k(e);if(x(e),e){for(let r of e){let e=J(t,r);e?s.array.has(r)&&KE(e)&&!Object.keys(e).some(e=>!Number.isNaN(Number(e)))?DD(n.errors,{[r]:e},r):uD(n.errors,r,e):KD(n.errors,r)}n.errors={...n.errors}}else n.errors=t;return t},j=async({name:t,eventType:r})=>{if(e.validate){let i=await e.validate({formValues:a,formState:n,name:t,eventType:r});if(KE(i))for(let e in i){let t=i[e];t&&fe(`${SO}.${e}`,{message:gD(t.message)?t.message:``,type:t.type||eD.validate})}else gD(i)||!i?fe(SO,{message:i||``,type:eD.validate}):de(SO);return i}return!0},M=async({fields:r,onlyCheckValid:i,name:o,eventType:c,context:l={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(l.runRootValidation=!0,!await j({name:o,eventType:c})&&(l.valid=!1,i)))return l.valid;for(let o in r){let u=r[o];if(u){let{_f:r,...d}=u;if(r){let o=s.array.has(r.name),c=u._f&&mO(u._f),d=m.validatingFields||m.isValidating||h.validatingFields||h.isValidating;c&&d&&x([r.name],!0);let f=await VD(u,s.disabled,a,v,t.shouldUseNativeValidation&&!i,o);if(c&&d&&x([r.name]),f[r.name]&&(l.valid=!1,i)||(!i&&(J(f,r.name)?o?DD(n.errors,f,r.name):uD(n.errors,r.name,f[r.name]):KD(n.errors,r.name)),e.shouldUseNativeValidation&&f[r.name]))break}!OD(d)&&await M({context:l,onlyCheckValid:i,fields:d,name:o,eventType:c})}}return l.valid},N=()=>{for(let e of s.unMount){let t=J(r,e);t&&(t._f.refs?t._f.refs.every(e=>!tO(e)):!tO(t._f.ref))&&ge(e)}s.unMount=new Set},te=(e,t)=>(e&&t&&uD(a,e,t),!bD(o.mount?a:i,i)),P=(e,t,n)=>_D(e,s,{...o.mount?a:aD(t)?i:gD(e)?{[e]:t}:t},n,t),F=e=>UD(J(o.mount?a:i,e,t.shouldUnregister?J(i,e,[]):[])),ne=(e,t,n={},i=!1,o=!1)=>{let s=J(r,e),c=t;if(s){let n=s._f;n&&(!n.disabled&&uD(a,e,lO(t,n)),c=AD(n.ref)&&WE(t)?``:t,$D(n.ref)?[...n.ref.options].forEach(e=>e.selected=c.includes(e.value)):n.refs?HE(n.ref)?n.refs.forEach(e=>{(!e.defaultChecked||!e.disabled)&&(Array.isArray(c)?e.checked=!!c.find(t=>t===e.value):e.checked=c===e.value||!!c)}):n.refs.forEach(e=>e.checked=e.value===c):kD(n.ref)?n.ref.value=``:(n.ref.value=c,!n.ref.type&&!o&&g.state.next({name:e,values:i?a:ZE(a)})))}(n.shouldDirty||n.shouldTouch)&&O(e,c,n.shouldTouch,n.shouldDirty,!o),n.shouldValidate&&ce(e,{delayError:n.delayError})},re=(e,t,n,i=!1,a=!1)=>{for(let o in t){if(!t.hasOwnProperty(o))return;let c=t[o],l=e+`.`+o,u=J(r,l);(s.array.has(e)||KE(c)||u&&!u._f)&&!UE(c)?re(l,c,n,i,a):ne(l,c,n,i,a)}},ie=(e,t,i,c,l=!1)=>{let u=J(r,e),d=s.array.has(e),f=c?t:ZE(t),p=bD(J(a,e),f);if(p||uD(a,e,f),d)g.array.next({name:e,values:c?a:ZE(a)}),(m.isDirty||m.dirtyFields||h.isDirty||h.dirtyFields)&&i.shouldDirty&&(S(),l||g.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:te(e,f)}));else{let t=Array.isArray(f)&&!f.length||OD(f);!u||u._f||WE(f)||t?ne(e,f,i,c,l):re(e,f,i,c,l)}if(!p&&!l){let t=TD(e,s),r=c?a:ZE(a);g.state.next({...t&&n,name:o.mount||t?e:void 0,values:r})}},ae=(e,t,n={})=>ie(e,t,n,!1),I=(e,t={})=>{let r=lD(e)?e(a):e;if(!bD(a,r)){a={...a,...r};let e=qD(r);for(let n of s.mount)n in e&&ie(n,e[n],t,!0,!0);g.state.next({...n,name:void 0,type:void 0,...u?{values:a}:{}}),t.shouldValidate&&b()}},oe=async i=>{o.mount=!0;let l=i.target,p=l.name,_=!0,y=J(r,p),S=e=>{_=Number.isNaN(e)||UE(e)&&isNaN(e.getTime())||bD(e,J(a,p,e))};if(y){let o,C,w=l.type?uO(y._f):qE(i),T=i.type===QE.BLUR||i.type===QE.FOCUS_OUT,E=!hO(y._f)&&!e.validate&&!t.resolver&&!J(n.errors,p)&&!y._f.deps,D=E||yO(T,J(n.touchedFields,p),n.isSubmitted,f,d),A=TD(p,s,T);if(uD(a,p,w),T){if(!l||!l.readOnly){y._f.onBlur&&y._f.onBlur(i);let e=c[p];e&&e(0)}}else y._f.onChange&&y._f.onChange(i);let N=O(p,w,T),te=!OD(N)||A;if(!T&&g.state.next({name:p,type:i.type,...u?{values:ZE(a)}:{}}),D)return(!E||!n.isValid)&&(m.isValid||h.isValid)&&(t.mode===`onBlur`?T&&b():T||b()),te&&g.state.next({name:p,...A?{}:N});if(!t.resolver&&e.validate&&await j({name:p,eventType:i.type}),!T&&A&&g.state.next({...n}),t.resolver){let{errors:e}=await k([p]);if(x([p]),S(w),!_){!OD(N)&&g.state.next(N);return}let t=gO(n.errors,r,p),i=gO(e,r,t.name||p);o=i.error,p=i.name,C=OD(e)}else x([p],!0),o=(await VD(y,s.disabled,a,v,t.shouldUseNativeValidation))[p],x([p]),S(w),_&&(o?C=!1:(m.isValid||h.isValid)&&(C=await M({fields:r,onlyCheckValid:!0,name:p,eventType:i.type})));_&&(y._f.deps&&(!Array.isArray(y._f.deps)||y._f.deps.length>0)&&ce(y._f.deps),ee(p,C,o,N))}},se=(e,t)=>{if(J(n.errors,t)&&e.focus)return e.focus(),1},ce=async(e,i={})=>{let a,o,u=HD(e);if(t.resolver){let t=await A(aD(e)?e:u);a=OD(t),o=e?!u.some(e=>J(t,e)):a}else e?(o=(await Promise.all(u.map(async e=>{let t=J(r,e);return await M({fields:t&&t._f?{[e]:t}:t,eventType:QE.TRIGGER})}))).every(Boolean),!(!o&&!n.isValid)&&b()):o=a=await M({fields:r,name:e,eventType:QE.TRIGGER});if(i.delayError&&t.delayError&&gD(e)){let r=J(n.errors,e);r?(KD(n.errors,e),c[e]=y(e,()=>w(e,r)),c[e](t.delayError)):(clearTimeout(l[e]),delete c[e])}return g.state.next({...!gD(e)||(m.isValid||h.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&ED(r,se,e?u:s.mount),o},le=(e,t)=>{let r={...o.mount?a:i};return t&&(r=QD(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),aD(e)?r:gD(e)?J(r,e):e.map(e=>J(r,e))},ue=(e,t)=>({invalid:!!J((t||n).errors,e),isDirty:!!J((t||n).dirtyFields,e),error:J((t||n).errors,e),isValidating:!!J(n.validatingFields,e),isTouched:!!J((t||n).touchedFields,e)}),de=e=>{let t=e?HD(e):void 0;t?.forEach(e=>KD(n.errors,e)),t?t.forEach(e=>{g.state.next({name:e,errors:n.errors})}):g.state.next({errors:{}})},fe=(e,t,i)=>{let a=(J(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=J(n.errors,e)||{};uD(n.errors,e,{...l,...t,ref:a}),g.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},pe=(e,t)=>{if(lD(e)){u++;let{unsubscribe:n}=g.state.subscribe({next:n=>`values`in n&&e(n.values||P(void 0,t),n)}),r=!1;return{unsubscribe:()=>{r||(r=!0,u--,n())}}}return P(e,t,!0)},me=e=>{let t=!!e.formState?.values;t&&u++;let{unsubscribe:r}=g.state.subscribe({next:t=>{if(vO(e.name,t.name,e.exact)&&_O(t,e.formState||m,Ee,e.reRenderRoot)){let r={...a};e.callback({values:r,...n,...t,defaultValues:i})}}});if(!t)return r;let o=!1;return()=>{o||(o=!0,u--,r())}},he=e=>(o.mount=!0,h={...h,...e.formState},me({...e,formState:{...p,...e.formState}})),ge=(e,o={})=>{for(let c of e?HD(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(KD(r,c),KD(a,c)),!o.keepError&&KD(n.errors,c),!o.keepDirty&&KD(n.dirtyFields,c),!o.keepTouched&&KD(n.touchedFields,c),!o.keepIsValidating&&KD(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&KD(i,c);g.state.next({values:ZE(a)}),g.state.next({...n,...o.keepDirty?{isDirty:te()}:{}}),!o.keepIsValid&&b()},_e=({disabled:e,name:t})=>{if(cD(e)&&o.mount||e||s.disabled.has(t)){let n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&b()}},ve=(e,n={})=>{let a=J(r,e),c=cD(n.disabled)||cD(t.disabled),l=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;return uD(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&!l?_e({disabled:cD(n.disabled)?n.disabled:t.disabled,name:e}):D(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:fO(n.min),max:fO(n.max),minLength:fO(n.minLength),maxLength:fO(n.maxLength),pattern:fO(n.pattern)}:{},name:e,onChange:oe,onBlur:oe,ref:c=>{if(c){s.registerName.add(e),ve(e,n),s.registerName.delete(e),a=J(r,e);let t=aD(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=eO(t),l=a._f.refs||[];if(o?l.find(e=>e===t):t===a._f.ref)return;uD(r,e,{_f:{...a._f,...o?{refs:[...l.filter(tO),t,...Array.isArray(J(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),D(e,!1,void 0,t)}else a=J(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(JE(s.array,e)&&o.action)&&s.unMount.add(e)}}},ye=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&ED(r,se,s.mount),be=e=>{cD(e)&&(g.state.next({disabled:e}),ED(r,(t,n)=>{let i=J(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},xe=(e,i)=>async o=>{let c;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=ZE(a);if(g.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await k();x(),n.errors=e,l=ZE(t)}else await M({fields:r,eventType:QE.SUBMIT});if(s.disabled.size)for(let e of s.disabled)KD(l,e);if(KD(n.errors,tD),OD(n.errors)){g.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),ye(),setTimeout(ye);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:OD(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},Se=(e,t={})=>{J(r,e)&&(aD(t.defaultValue)?ae(e,ZE(J(i,e))):(ae(e,t.defaultValue),uD(i,e,ZE(t.defaultValue))),t.keepTouched||KD(n.touchedFields,e),t.keepDirty||(KD(n.dirtyFields,e),n.isDirty=t.defaultValue?te(e,ZE(J(i,e))):te()),t.keepError||(KD(n.errors,e),m.isValid&&b()),g.state.next({...n}))},Ce=(e,c={})=>{let l=e?ZE(e):i,u=ZE(l),d=OD(e),f=u,p=r;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(cO(i,a,void 0,p))]);for(let t of Array.from(e)){let e=J(n.dirtyFields,t),r=J(a,t),i=J(f,t);e&&!aD(r)?uD(f,t,r):!e&&!aD(i)&&ae(t,i)}}else{if(XE&&aD(e))for(let e of s.mount){let t=J(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(AD(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)ae(e,J(f,e));else r={}}if(t.shouldUnregister){if(a=c.keepDefaultValues?ZE(i):{},c.keepFieldsRef)for(let e of s.mount)uD(a,e,J(f,e))}else a=ZE(f);g.array.next({values:{...f}}),g.state.next({name:void 0,type:void 0,values:{...f}})}s={mount:c.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!m.isValid||!!c.keepIsValid||!!c.keepDirtyValues||!t.shouldUnregister&&!OD(f),o.watch=!!t.shouldUnregister,o.keepIsValid=!!c.keepIsValid,o.action=!1,c.keepErrors||(n.errors={}),g.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:d?!1:c.keepDirty?n.isDirty:c.keepValues?te():!!(c.keepDefaultValues&&!bD(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:d?{}:c.keepDirtyValues?c.keepDefaultValues&&a?cO(i,a,void 0,p):n.dirtyFields:c.keepDefaultValues&&e?cO(i,e,void 0,p):c.keepDirty?n.dirtyFields:{},touchedFields:c.keepTouched?n.touchedFields:{},errors:c.keepErrors?n.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},we=(e,n)=>Ce(lD(e)?e(a):e,{...t.resetOptions,...n}),Te=(e,t={})=>{let n=J(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&lD(e.select)&&e.select()})}},Ee=e=>{let{name:t,type:r,values:i,...a}=e;n={...n,...a}},De={control:{register:ve,unregister:ge,getFieldState:ue,handleSubmit:xe,setError:fe,_subscribe:me,_runSchema:k,_updateIsValidating:x,_focusError:ye,_getWatch:P,_getDirty:te,_setValid:b,_setFieldArray:C,_setDisabledField:_e,_setErrors:T,_getFieldArray:F,_reset:Ce,_resetDefaultValues:()=>lD(t.defaultValues)&&t.defaultValues().then(e=>{we(e,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:N,_disableForm:be,_subjects:g,_proxyFormState:m,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e},d=wD(t.mode),f=wD(t.reValidateMode)}},subscribe:he,trigger:ce,register:ve,handleSubmit:xe,watch:pe,setValue:ae,setValues:I,getValues:le,reset:we,resetField:Se,resetDefaultValues:(e,t={})=>{if(i=ZE(e),!t.keepDirty){let e=cO(i,a,void 0,r);n.dirtyFields=e,n.isDirty=!OD(e)}t.keepIsValid||b(),g.state.next({...n,defaultValues:i})},clearErrors:de,unregister:ge,setError:fe,setFocus:Te,getFieldState:ue};return{...De,formControl:De}}function TO(e={}){let t=L.useRef(void 0),n=L.useRef(void 0),r=L.useRef(e.formControl),[i,a]=L.useState(()=>({...ZE(CO),isLoading:lD(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:lD(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&r.current!==e.formControl)if(r.current=e.formControl,e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!lD(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...r}=wO(e);t.current={...r,formState:i}}let o=t.current.control;return o._options=e,mD(()=>{let e=o._subscribe({formState:o._proxyFormState,callback:()=>a({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return a(e=>({...e,isReady:!0})),o._formState.isReady=!0,e},[o]),L.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),L.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),L.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),L.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),L.useEffect(()=>{if(o._proxyFormState.isDirty){let e=o._getDirty();e!==i.isDirty&&o._subjects.state.next({isDirty:e})}},[o,i.isDirty]),L.useEffect(()=>{e.values&&!bD(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),o._options.resetOptions?.keepIsValid||o._setValid(),n.current=e.values,a(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),L.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=L.useMemo(()=>pD(i,o),[o,i]),t.current}var EO=(e,t,n)=>{if(e&&`reportValidity`in e){let r=J(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},DO=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?EO(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>EO(t,n,e))}},OO=(e,t)=>{t.shouldUseNativeValidation&&DO(e,t);let n={};for(let r in e){let i=J(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(kO(t.names||Object.keys(e),r)){let e=Object.assign({},J(n,r));uD(e,`root`,a),uD(n,r,e)}else uD(n,r,a)}return n},kO=(e,t)=>{let n=AO(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>AO(e).match(`^${n}\\.\\d+`))};function AO(e){return e.replace(/[\[\]]/g,``)}var jO;function MO(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 NO=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};(jO=globalThis).__zod_globalConfig??(jO.__zod_globalConfig={});var PO=globalThis.__zod_globalConfig;function FO(e){return e&&Object.assign(PO,e),PO}function IO(e,t){return typeof t==`bigint`?t.toString():t}var LO=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};-Number.MAX_VALUE,Number.MAX_VALUE;function RO(e){return typeof e==`string`?e:e?.message}function zO(e,t,n){let r=e.message?e.message:RO(e.inst?._zod.def?.error?.(e))??RO(t?.error?.(e))??RO(n.customError?.(e))??RO(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}var BO=(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,IO,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},VO=MO(`$ZodError`,BO),HO=MO(`$ZodError`,BO,{Parent:Error}),UO=(e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new NO;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>zO(e,a,FO())));throw LO(t,i?.callee),t}return o.value})(HO),WO=(e=>async(t,n,r,i)=>{let a=r?{...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=>zO(e,a,FO())));throw LO(t,i?.callee),t}return o.value})(HO);function GO(){return GO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},GO.apply(null,arguments)}function KO(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function qO(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ND(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function JO(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(GO({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ND(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function YO(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve(KO(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&DO({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:OO(qO(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(KO(function(){return Promise.resolve((n.mode===`sync`?UO:WO)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&DO({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof VO}(e))return{values:{},errors:OO(JO(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var XO;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(XO||={});var ZO;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(ZO||={});var Y=XO.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),QO=e=>{switch(typeof e){case`undefined`:return Y.undefined;case`string`:return Y.string;case`number`:return Number.isNaN(e)?Y.nan:Y.number;case`boolean`:return Y.boolean;case`function`:return Y.function;case`bigint`:return Y.bigint;case`symbol`:return Y.symbol;case`object`:return Array.isArray(e)?Y.array:e===null?Y.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?Y.promise:typeof Map<`u`&&e instanceof Map?Y.map:typeof Set<`u`&&e instanceof Set?Y.set:typeof Date<`u`&&e instanceof Date?Y.date:Y.object;default:return Y.unknown}},X=XO.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),$O=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);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(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,XO.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t=Object.create(null),n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};$O.create=e=>new $O(e);var ek=(e,t)=>{let n;switch(e.code){case X.invalid_type:n=e.received===Y.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,XO.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:n=`Unrecognized key(s) in object: ${XO.joinValues(e.keys,`, `)}`;break;case X.invalid_union:n=`Invalid input`;break;case X.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${XO.joinValues(e.options)}`;break;case X.invalid_enum_value:n=`Invalid enum value. Expected ${XO.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:n=`Invalid function arguments`;break;case X.invalid_return_type:n=`Invalid function return type`;break;case X.invalid_date:n=`Invalid date`;break;case X.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:XO.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case X.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case X.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case X.custom:n=`Invalid input`;break;case X.invalid_intersection_types:n=`Intersection results could not be merged`;break;case X.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,XO.assertNever(e)}return{message:n}},tk=ek;function nk(){return tk}var rk=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function Z(e,t){let n=nk(),r=rk({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ek?void 0:ek].filter(e=>!!e)});e.common.issues.push(r)}var ik=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return Q;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return Q;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},Q=Object.freeze({status:`aborted`}),ak=e=>({status:`dirty`,value:e}),ok=e=>({status:`valid`,value:e}),sk=e=>e.status===`aborted`,ck=e=>e.status===`dirty`,lk=e=>e.status===`valid`,uk=e=>typeof Promise<`u`&&e instanceof Promise,$;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})($||={});var dk=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},fk=(e,t)=>{if(lk(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new $O(e.common.issues);return this._error=t,this._error}}};function pk(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var mk=class{get description(){return this._def.description}_getType(e){return QO(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:QO(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ik,ctx:{common:e.parent.common,data:e.data,parsedType:QO(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(uk(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:QO(e)};return fk(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:QO(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return lk(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>lk(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:QO(e)},r=this._parse({data:e,path:n.path,parent:n});return fk(n,await(uk(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:X.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new _A({schema:this,typeName:EA.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return vA.create(this,this._def)}nullable(){return yA.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Qk.create(this)}promise(){return gA.create(this,this._def)}or(e){return tA.create([this,e],this._def)}and(e){return aA.create(this,e,this._def)}transform(e){return new _A({...pk(this._def),schema:this,typeName:EA.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new bA({...pk(this._def),innerType:this,defaultValue:t,typeName:EA.ZodDefault})}brand(){return new CA({typeName:EA.ZodBranded,type:this,...pk(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new xA({...pk(this._def),innerType:this,catchValue:t,typeName:EA.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return wA.create(this,e)}readonly(){return TA.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},hk=/^c[^\s-]{8,}$/i,gk=/^[0-9a-z]+$/,_k=/^[0-9A-HJKMNP-TV-Z]{26}$/i,vk=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,yk=/^[a-z0-9_-]{21}$/i,bk=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,xk=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Sk=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ck=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,wk,Tk=/^(?:(?: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])$/,Ek=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Dk=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ok=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kk=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ak=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,jk=`((\\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])))`,Mk=RegExp(`^${jk}$`);function Nk(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Pk(e){return RegExp(`^${Nk(e)}$`)}function Fk(e){let t=`${jk}T${Nk(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function Ik(e,t){return!!((t===`v4`||!t)&&Tk.test(e)||(t===`v6`||!t)&&Dk.test(e))}function Lk(e,t){if(!bk.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Rk(e,t){return!!((t===`v4`||!t)&&Ek.test(e)||(t===`v6`||!t)&&Ok.test(e))}var zk=class e extends mk{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Y.string){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.string,received:t.parsedType}),Q}let t=new ik,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?Z(n,{code:X.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&Z(n,{code:X.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)Sk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`email`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)wk||=new RegExp(Ck,`u`),wk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`emoji`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)vk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`uuid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)yk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`nanoid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)hk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`cuid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)gk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`cuid2`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)_k.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`ulid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),Z(n,{validation:`url`,code:X.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`regex`,code:X.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?Fk(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?Mk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?Pk(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?xk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`duration`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?Ik(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`ip`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?Lk(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`jwt`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?Rk(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`cidr`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?kk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`base64`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?Ak.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`base64url`,code:X.invalid_string,message:r.message}),t.dirty()):XO.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:X.invalid_string,...$.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...$.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...$.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...$.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...$.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...$.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...$.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...$.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...$.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...$.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...$.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...$.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...$.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...$.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...$.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...$.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...$.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...$.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...$.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...$.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...$.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...$.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...$.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...$.errToObj(t)})}nonempty(e){return this.min(1,$.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};zk.create=e=>new zk({checks:[],typeName:EA.ZodString,coerce:e?.coerce??!1,...pk(e)});function Bk(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Vk=class e extends mk{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Y.number){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.number,received:t.parsedType}),Q}let t,n=new ik;for(let r of this._def.checks)r.kind===`int`?XO.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Z(t,{code:X.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Bk(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Z(t,{code:X.not_finite,message:r.message}),n.dirty()):XO.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,$.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,$.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,$.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,$.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:$.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:$.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:$.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:$.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:$.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:$.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:$.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:$.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:$.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:$.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&XO.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Vk.create=e=>new Vk({checks:[],typeName:EA.ZodNumber,coerce:e?.coerce||!1,...pk(e)});var Hk=class e extends mk{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Y.bigint)return this._getInvalidInput(e);let t,n=new ik;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):XO.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.bigint,received:t.parsedType}),Q}gte(e,t){return this.setLimit(`min`,e,!0,$.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,$.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,$.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,$.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:$.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:$.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:$.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:$.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:$.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:$.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Hk.create=e=>new Hk({checks:[],typeName:EA.ZodBigInt,coerce:e?.coerce??!1,...pk(e)});var Uk=class extends mk{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Y.boolean){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.boolean,received:t.parsedType}),Q}return ok(e.data)}};Uk.create=e=>new Uk({typeName:EA.ZodBoolean,coerce:e?.coerce||!1,...pk(e)});var Wk=class e extends mk{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Y.date){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.date,received:t.parsedType}),Q}if(Number.isNaN(e.data.getTime()))return Z(this._getOrReturnCtx(e),{code:X.invalid_date}),Q;let t=new ik,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):XO.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:$.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:$.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};Wk.create=e=>new Wk({checks:[],coerce:e?.coerce||!1,typeName:EA.ZodDate,...pk(e)});var Gk=class extends mk{_parse(e){if(this._getType(e)!==Y.symbol){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.symbol,received:t.parsedType}),Q}return ok(e.data)}};Gk.create=e=>new Gk({typeName:EA.ZodSymbol,...pk(e)});var Kk=class extends mk{_parse(e){if(this._getType(e)!==Y.undefined){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.undefined,received:t.parsedType}),Q}return ok(e.data)}};Kk.create=e=>new Kk({typeName:EA.ZodUndefined,...pk(e)});var qk=class extends mk{_parse(e){if(this._getType(e)!==Y.null){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.null,received:t.parsedType}),Q}return ok(e.data)}};qk.create=e=>new qk({typeName:EA.ZodNull,...pk(e)});var Jk=class extends mk{constructor(){super(...arguments),this._any=!0}_parse(e){return ok(e.data)}};Jk.create=e=>new Jk({typeName:EA.ZodAny,...pk(e)});var Yk=class extends mk{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ok(e.data)}};Yk.create=e=>new Yk({typeName:EA.ZodUnknown,...pk(e)});var Xk=class extends mk{_parse(e){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.never,received:t.parsedType}),Q}};Xk.create=e=>new Xk({typeName:EA.ZodNever,...pk(e)});var Zk=class extends mk{_parse(e){if(this._getType(e)!==Y.undefined){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.void,received:t.parsedType}),Q}return ok(e.data)}};Zk.create=e=>new Zk({typeName:EA.ZodVoid,...pk(e)});var Qk=class e extends mk{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Y.array)return Z(t,{code:X.invalid_type,expected:Y.array,received:t.parsedType}),Q;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(Z(t,{code:e?X.too_big:X.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(Z(t,{code:X.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(Z(t,{code:X.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new dk(t,e,t.path,n)))).then(e=>ik.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new dk(t,e,t.path,n)));return ik.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:$.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:$.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:$.toString(n)}})}nonempty(e){return this.min(1,e)}};Qk.create=(e,t)=>new Qk({type:e,minLength:null,maxLength:null,exactLength:null,typeName:EA.ZodArray,...pk(t)});function $k(e){if(e instanceof eA){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=vA.create($k(r))}return new eA({...e._def,shape:()=>t})}else if(e instanceof Qk)return new Qk({...e._def,type:$k(e.element)});else if(e instanceof vA)return vA.create($k(e.unwrap()));else if(e instanceof yA)return yA.create($k(e.unwrap()));else if(e instanceof oA)return oA.create(e.items.map(e=>$k(e)));else return e}var eA=class e extends mk{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=XO.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Y.object){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.object,received:t.parsedType}),Q}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Xk&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new dk(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Xk){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(Z(n,{code:X.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new dk(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>ik.mergeObjectSync(t,e)):ik.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return $.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:$.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:EA.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of XO.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of XO.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return $k(this)}partial(t){let n={};for(let e of XO.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of XO.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof vA;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return pA(XO.objectKeys(this.shape))}};eA.create=(e,t)=>new eA({shape:()=>e,unknownKeys:`strip`,catchall:Xk.create(),typeName:EA.ZodObject,...pk(t)}),eA.strictCreate=(e,t)=>new eA({shape:()=>e,unknownKeys:`strict`,catchall:Xk.create(),typeName:EA.ZodObject,...pk(t)}),eA.lazycreate=(e,t)=>new eA({shape:e,unknownKeys:`strip`,catchall:Xk.create(),typeName:EA.ZodObject,...pk(t)});var tA=class extends mk{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new $O(e.ctx.common.issues));return Z(t,{code:X.invalid_union,unionErrors:n}),Q}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new $O(e));return Z(t,{code:X.invalid_union,unionErrors:i}),Q}}get options(){return this._def.options}};tA.create=(e,t)=>new tA({options:e,typeName:EA.ZodUnion,...pk(t)});var nA=e=>e instanceof dA?nA(e.schema):e instanceof _A?nA(e.innerType()):e instanceof fA?[e.value]:e instanceof mA?e.options:e instanceof hA?XO.objectValues(e.enum):e instanceof bA?nA(e._def.innerType):e instanceof Kk?[void 0]:e instanceof qk?[null]:e instanceof vA?[void 0,...nA(e.unwrap())]:e instanceof yA?[null,...nA(e.unwrap())]:e instanceof CA||e instanceof TA?nA(e.unwrap()):e instanceof xA?nA(e._def.innerType):[],rA=class e extends mk{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Y.object)return Z(t,{code:X.invalid_type,expected:Y.object,received:t.parsedType}),Q;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Z(t,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=nA(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:EA.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...pk(r)})}};function iA(e,t){let n=QO(e),r=QO(t);if(e===t)return{valid:!0,data:e};if(n===Y.object&&r===Y.object){let n=XO.objectKeys(t),r=XO.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=iA(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===Y.array&&r===Y.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=iA(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===Y.date&&r===Y.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var aA=class extends mk{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(sk(e)||sk(r))return Q;let i=iA(e.value,r.value);return i.valid?((ck(e)||ck(r))&&t.dirty(),{status:t.value,value:i.data}):(Z(n,{code:X.invalid_intersection_types}),Q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};aA.create=(e,t,n)=>new aA({left:e,right:t,typeName:EA.ZodIntersection,...pk(n)});var oA=class e extends mk{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.array)return Z(n,{code:X.invalid_type,expected:Y.array,received:n.parsedType}),Q;if(n.data.length<this._def.items.length)return Z(n,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),Q;!this._def.rest&&n.data.length>this._def.items.length&&(Z(n,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new dk(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>ik.mergeArray(t,e)):ik.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};oA.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new oA({items:e,typeName:EA.ZodTuple,rest:null,...pk(t)})};var sA=class e extends mk{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.object)return Z(n,{code:X.invalid_type,expected:Y.object,received:n.parsedType}),Q;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new dk(n,e,n.path,e)),value:a._parse(new dk(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?ik.mergeObjectAsync(t,r):ik.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof mk?new e({keyType:t,valueType:n,typeName:EA.ZodRecord,...pk(r)}):new e({keyType:zk.create(),valueType:t,typeName:EA.ZodRecord,...pk(n)})}},cA=class extends mk{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.map)return Z(n,{code:X.invalid_type,expected:Y.map,received:n.parsedType}),Q;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new dk(n,e,n.path,[a,`key`])),value:i._parse(new dk(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return Q;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return Q;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};cA.create=(e,t,n)=>new cA({valueType:t,keyType:e,typeName:EA.ZodMap,...pk(n)});var lA=class e extends mk{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.set)return Z(n,{code:X.invalid_type,expected:Y.set,received:n.parsedType}),Q;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(Z(n,{code:X.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(Z(n,{code:X.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return Q;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new dk(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:$.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:$.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};lA.create=(e,t)=>new lA({valueType:e,minSize:null,maxSize:null,typeName:EA.ZodSet,...pk(t)});var uA=class e extends mk{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Y.function)return Z(t,{code:X.invalid_type,expected:Y.function,received:t.parsedType}),Q;function n(e,n){return rk({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,nk(),ek].filter(e=>!!e),issueData:{code:X.invalid_arguments,argumentsError:n}})}function r(e,n){return rk({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,nk(),ek].filter(e=>!!e),issueData:{code:X.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof gA){let e=this;return ok(async function(...t){let o=new $O([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return ok(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new $O([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new $O([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:oA.create(t).rest(Yk.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||oA.create([]).rest(Yk.create()),returns:n||Yk.create(),typeName:EA.ZodFunction,...pk(r)})}},dA=class extends mk{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};dA.create=(e,t)=>new dA({getter:e,typeName:EA.ZodLazy,...pk(t)});var fA=class extends mk{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Z(t,{received:t.data,code:X.invalid_literal,expected:this._def.value}),Q}return{status:`valid`,value:e.data}}get value(){return this._def.value}};fA.create=(e,t)=>new fA({value:e,typeName:EA.ZodLiteral,...pk(t)});function pA(e,t){return new mA({values:e,typeName:EA.ZodEnum,...pk(t)})}var mA=class e extends mk{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return Z(t,{expected:XO.joinValues(n),received:t.parsedType,code:X.invalid_type}),Q}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Z(t,{received:t.data,code:X.invalid_enum_value,options:n}),Q}return ok(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};mA.create=pA;var hA=class extends mk{_parse(e){let t=XO.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Y.string&&n.parsedType!==Y.number){let e=XO.objectValues(t);return Z(n,{expected:XO.joinValues(e),received:n.parsedType,code:X.invalid_type}),Q}if(this._cache||=new Set(XO.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=XO.objectValues(t);return Z(n,{received:n.data,code:X.invalid_enum_value,options:e}),Q}return ok(e.data)}get enum(){return this._def.values}};hA.create=(e,t)=>new hA({values:e,typeName:EA.ZodNativeEnum,...pk(t)});var gA=class extends mk{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==Y.promise&&t.common.async===!1?(Z(t,{code:X.invalid_type,expected:Y.promise,received:t.parsedType}),Q):ok((t.parsedType===Y.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};gA.create=(e,t)=>new gA({type:e,typeName:EA.ZodPromise,...pk(t)});var _A=class extends mk{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===EA.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{Z(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return Q;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?Q:r.status===`dirty`||t.value===`dirty`?ak(r.value):r});{if(t.value===`aborted`)return Q;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?Q:r.status===`dirty`||t.value===`dirty`?ak(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?Q:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?Q:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!lk(e))return Q;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>lk(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):Q);XO.assertNever(r)}};_A.create=(e,t,n)=>new _A({schema:e,typeName:EA.ZodEffects,effect:t,...pk(n)}),_A.createWithPreprocess=(e,t,n)=>new _A({schema:t,effect:{type:`preprocess`,transform:e},typeName:EA.ZodEffects,...pk(n)});var vA=class extends mk{_parse(e){return this._getType(e)===Y.undefined?ok(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};vA.create=(e,t)=>new vA({innerType:e,typeName:EA.ZodOptional,...pk(t)});var yA=class extends mk{_parse(e){return this._getType(e)===Y.null?ok(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yA.create=(e,t)=>new yA({innerType:e,typeName:EA.ZodNullable,...pk(t)});var bA=class extends mk{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===Y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};bA.create=(e,t)=>new bA({innerType:e,typeName:EA.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...pk(t)});var xA=class extends mk{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return uk(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new $O(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new $O(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};xA.create=(e,t)=>new xA({innerType:e,typeName:EA.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...pk(t)});var SA=class extends mk{_parse(e){if(this._getType(e)!==Y.nan){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.nan,received:t.parsedType}),Q}return{status:`valid`,value:e.data}}};SA.create=e=>new SA({typeName:EA.ZodNaN,...pk(e)});var CA=class extends mk{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},wA=class e extends mk{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Q:e.status===`dirty`?(t.dirty(),ak(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Q:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:EA.ZodPipeline})}},TA=class extends mk{_parse(e){let t=this._def.innerType._parse(e),n=e=>(lk(e)&&(e.value=Object.freeze(e.value)),e);return uk(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};TA.create=(e,t)=>new TA({innerType:e,typeName:EA.ZodReadonly,...pk(t)}),eA.lazycreate;var EA;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(EA||={});var DA=zk.create;Vk.create,SA.create,Hk.create,Uk.create,Wk.create,Gk.create,Kk.create,qk.create,Jk.create,Yk.create,Xk.create,Zk.create,Qk.create;var OA=eA.create;eA.strictCreate,tA.create,rA.create,aA.create,oA.create,sA.create,cA.create,lA.create,uA.create,dA.create,fA.create,mA.create,hA.create,gA.create,_A.create,vA.create,yA.create,_A.createWithPreprocess,wA.create;var kA=8e3,AA=`https://github.com/Jinn-Network/mono/blob/main/docs/runbooks/rotating-harness-keys.md`;function jA(e){return e===`loaded`?`default`:e===`missing`?`destructive`:`secondary`}function MA(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString()}function NA(e){return e.sourceKind===`file`?e.sourcePath??`—`:e.sourceKind===`env`?`env: ${e.envKey??``}`:e.sourceKind===`session`?`CLI session`:`no auth required`}function PA(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)(null);return(0,L.useEffect)(()=>{let e=!1,n=async()=>{try{let n=await B.harnessAuthStatus();e||(t(n.harnesses),r(null))}catch(t){e||r(t instanceof Error?t.message:String(t))}};n();let i=setInterval(()=>{n()},kA);return()=>{e=!0,clearInterval(i)}},[]),(0,R.jsxs)(G,{"data-testid":`harness-auth-status-card`,children:[(0,R.jsxs)(zi,{children:[(0,R.jsx)(Bi,{children:`Harness auth status`}),(0,R.jsx)(Vi,{children:`Where each harness reads its credential, the masked key suffix, and when it last changed. Read-only — rotate keys via the linked runbook. Full keys are never shown.`})]}),(0,R.jsx)(Hi,{children:n?(0,R.jsxs)(`p`,{className:`text-sm text-[var(--break-red)]`,children:[`Auth status unavailable: `,n]}):e===null?(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):e.length===0?(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No harnesses registered.`}):(0,R.jsxs)(Qh,{children:[(0,R.jsx)($h,{children:(0,R.jsxs)(ng,{children:[(0,R.jsx)(rg,{children:`Harness`}),(0,R.jsx)(rg,{children:`Auth source`}),(0,R.jsx)(rg,{children:`Key suffix`}),(0,R.jsx)(rg,{children:`Last modified`}),(0,R.jsx)(rg,{children:`State`})]})}),(0,R.jsx)(eg,{children:e.map(e=>(0,R.jsxs)(ng,{children:[(0,R.jsx)(ig,{children:e.docAnchor?(0,R.jsx)(`a`,{href:`${AA}#${e.docAnchor}`,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:e.harnessName}):(0,R.jsx)(`span`,{children:e.harnessName})}),(0,R.jsx)(ig,{className:`font-mono text-xs`,children:NA(e)}),(0,R.jsx)(ig,{className:`font-mono text-xs`,children:e.keySuffix?`…${e.keySuffix}`:`—`}),(0,R.jsx)(ig,{className:`font-mono text-xs`,children:MA(e.lastModified)}),(0,R.jsx)(ig,{children:(0,R.jsx)(q,{variant:jA(e.state),children:e.state})})]},e.harnessName))})]})})]})}var FA=XD,IA=L.createContext({}),LA=e=>(0,R.jsx)(IA.Provider,{value:{name:e.name},children:(0,R.jsx)(CD,{...e})}),RA=L.createContext({}),zA=()=>{let e=L.useContext(IA),t=L.useContext(RA),{getFieldState:n,formState:r}=YD(),i=n(e.name,r);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...i}},BA=L.forwardRef(({className:e,...t},n)=>{let r=L.useId();return(0,R.jsx)(RA.Provider,{value:{id:r},children:(0,R.jsx)(`div`,{ref:n,className:U(`flex flex-col gap-1.5`,e),...t})})});BA.displayName=`FormItem`;var VA=L.forwardRef(({className:e,...t},n)=>{let{error:r,formItemId:i}=zA();return(0,R.jsx)(Gf,{ref:n,className:U(r&&`text-[var(--break-red)]`,e),htmlFor:i,...t})});VA.displayName=`FormLabel`;var HA=L.forwardRef(({...e},t)=>{let{error:n,formItemId:r,formDescriptionId:i,formMessageId:a}=zA();return(0,R.jsx)(Jn,{ref:t,id:r,"aria-describedby":n?`${i} ${a}`:i,"aria-invalid":!!n,...e})});HA.displayName=`FormControl`;var UA=L.forwardRef(({className:e,...t},n)=>{let{formDescriptionId:r}=zA();return(0,R.jsx)(`p`,{ref:n,id:r,className:U(`font-mono text-[11px] text-[var(--fg-dim)]`,e),...t})});UA.displayName=`FormDescription`;var WA=L.forwardRef(({className:e,children:t,...n},r)=>{let{error:i,formMessageId:a}=zA(),o=i?String(i?.message??``):t;return o?(0,R.jsx)(`p`,{ref:r,id:a,className:U(`font-mono text-[11px] text-[var(--break-red)]`,e),...n,children:o}):null});WA.displayName=`FormMessage`;var GA=OA({current:DA().min(1,`Current password is required.`),next:DA().min(8,`New password must be at least 8 characters.`)});function KA(){let[e,t]=(0,L.useState)(`idle`),n=TO({resolver:YO(GA),defaultValues:{current:``,next:``}}),r=async e=>{t(`rotating`);try{await B.changeKeystorePassword(e.current,e.next),n.reset({current:``,next:``}),ph.success(`Password rotated`,{description:"Re-run `jinn run` with the new password."})}catch(e){ph.error(`Rotation failed`,{description:e instanceof Error?e.message:String(e)})}finally{t(`idle`)}};return(0,R.jsxs)(`div`,{"data-testid":`security-tab`,className:`flex flex-col gap-6`,children:[(0,R.jsxs)(G,{className:`border-[var(--severity-blocking-border)]`,children:[(0,R.jsxs)(zi,{className:`flex flex-row items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(Bi,{className:`flex items-center gap-2 text-[var(--break-red)]`,children:[(0,R.jsx)(Bn,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),`Security`]}),(0,R.jsx)(Vi,{children:`Rotate keystore password · last rotated never`})]}),(0,R.jsx)(q,{variant:`destructive`,children:`Danger zone`})]}),(0,R.jsx)(Hi,{children:(0,R.jsx)(FA,{...n,children:(0,R.jsxs)(`form`,{onSubmit:n.handleSubmit(r),className:`flex flex-col gap-4`,"data-testid":`security-password-form`,children:[(0,R.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,R.jsx)(LA,{control:n.control,name:`current`,render:({field:e})=>(0,R.jsxs)(BA,{children:[(0,R.jsx)(VA,{children:`Current password`}),(0,R.jsx)(HA,{children:(0,R.jsx)(o_,{type:`password`,autoComplete:`current-password`,...e})}),(0,R.jsx)(WA,{})]})}),(0,R.jsx)(LA,{control:n.control,name:`next`,render:({field:e})=>(0,R.jsxs)(BA,{children:[(0,R.jsx)(VA,{children:`New password`}),(0,R.jsx)(HA,{children:(0,R.jsx)(o_,{type:`password`,autoComplete:`new-password`,...e})}),(0,R.jsx)(UA,{children:`At least 8 characters.`}),(0,R.jsx)(WA,{})]})})]}),(0,R.jsxs)(W,{type:`submit`,variant:`destructive`,disabled:e===`rotating`||!n.formState.isValid,className:`self-start`,children:[(0,R.jsx)(jn,{className:`h-3 w-3`,"aria-hidden":`true`}),e===`rotating`?`Rotating…`:`Rotate password`]})]})})})]}),(0,R.jsx)(PA,{})]})}function qA(e){let t=[],n=e.split(`
93
+ `,`The harness and model fields above apply only to the solver role.`]})]}),(0,R.jsxs)(`p`,{className:`m-0 font-mono text-[12px] text-[var(--fg-muted)]`,children:[`Evaluator harness is bound to`,` `,(0,R.jsx)(`code`,{className:`text-foreground`,children:l.contract.evaluationFunction.implementation}),` `,`by the manifest. The fields above only configure the solver role.`]}),I]}),y&&(0,R.jsx)(aS,{onSuccess:()=>{b(!1),te.mutate()},onCancel:()=>{b(!1)}}),h&&(0,R.jsx)(`p`,{"data-testid":`join-flow-submit-error`,role:`alert`,className:`m-0 font-mono text-[13px] text-destructive`,children:h}),(0,R.jsxs)(`footer`,{className:`flex items-center justify-end gap-3`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`join-flow-cancel`,onClick:()=>i(`/operator#solvernets`),children:`Cancel`}),(0,R.jsx)(W,{type:`button`,variant:`default`,"data-testid":`join-flow-submit`,disabled:!ae,onClick:()=>{if(g(null),p.roles.includes(`solver`)&&p.harness===`hermes-agent`){b(!0);return}te.mutate()},children:te.isPending?`Joining…`:`Join SolverNet`})]})]})}function xC({message:e,onBack:t,onRetry:n}){return(0,R.jsxs)(fo,{variant:`blocking`,className:`flex items-center justify-between gap-4 border-l-0 border border-destructive p-4`,children:[(0,R.jsx)(mo,{className:`font-mono text-[13px] text-destructive`,children:e}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[n&&(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`join-flow-retry`,onClick:n,children:`Retry`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`join-flow-back`,onClick:t,children:`Back`})]})]})}function SC({success:e,navigate:t}){let n=e.roles.map(e=>e===`solver`?`Solver`:`Evaluator`).join(` + `),[r,i]=(0,L.useState)(!1),[a,o]=(0,L.useState)(null),s=async()=>{i(!0),o(null);try{if(!(await B.restartDaemon()).ok)throw Error(`Restart request failed.`);t(`/overview`)}catch(e){o(e instanceof Error?e.message:`Restart request failed.`),i(!1)}};return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(G,{"data-testid":`join-flow-success-card`,role:`status`,className:`flex flex-col gap-2.5 border-[var(--vow-green)] p-5`,children:[(0,R.jsx)(q,{variant:`success`,className:`self-start`,children:`Joined`}),(0,R.jsxs)(`span`,{"data-testid":`join-flow-success-name`,className:`font-mono text-[18px] font-medium text-foreground`,children:[`You joined `,e.name]}),(0,R.jsxs)(`span`,{className:`font-mono text-[12px] leading-relaxed text-[var(--fg-muted)]`,children:[`You're in as `,n||`an operator`,`. This SolverNet now shows in your joined list.`]}),e.restartRequired&&(0,R.jsx)(`span`,{"data-testid":`join-flow-success-restart`,className:`font-mono text-[12px] leading-relaxed text-[var(--accent-gold)]`,children:`Restart the node to start participating — the daemon picks up SolverNet config on restart.`})]}),a&&(0,R.jsx)(po,{role:`alert`,"data-testid":`join-flow-success-restart-error`,className:`font-mono text-[12px] leading-relaxed text-destructive`,children:a}),(0,R.jsxs)(`footer`,{className:`flex items-center justify-end gap-3`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`join-flow-success-browse`,onClick:()=>t(`/operator#solvernets`),children:`Browse SolverNets`}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`join-flow-success-view`,onClick:()=>t(`/operator#solvernets/${e.manifestCid}`),children:`View joined SolverNet`}),(0,R.jsx)(W,{type:`button`,variant:`default`,"data-testid":`join-flow-success-restart-button`,onClick:()=>{s()},disabled:r,children:r?`Restarting…`:`Restart node now`})]})]})}function CC({capture:e}){return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Executor`}),(0,R.jsxs)(`dl`,{className:`m-0 grid gap-x-3 gap-y-1.5 [grid-template-columns:120px_minmax(0,1fr)]`,children:[(0,R.jsx)(`dt`,{className:`font-mono text-[12px] text-muted-foreground`,children:`Tool`}),(0,R.jsx)(`dd`,{className:`m-0 font-mono text-[12px] text-foreground`,children:e.originatingTool.name}),(0,R.jsx)(`dt`,{className:`font-mono text-[12px] text-muted-foreground`,children:`Version`}),(0,R.jsx)(`dd`,{className:`m-0 font-mono text-[12px] text-foreground`,children:e.originatingTool.version??`unknown`}),(0,R.jsx)(`dt`,{className:`font-mono text-[12px] text-muted-foreground`,children:`Repo`}),(0,R.jsx)(`dd`,{className:`m-0 break-words font-mono text-[12px] text-foreground`,children:e.repoRemoteUrl??`none`}),(0,R.jsx)(`dt`,{className:`font-mono text-[12px] text-muted-foreground`,children:`Commit`}),(0,R.jsx)(`dd`,{className:`m-0 font-mono text-[12px] text-foreground`,children:e.repoCommitHash?.slice(0,12)??`none`})]})]})}function wC({spans:e}){let t=e.flatMap(e=>e.redactedKeys.map(t=>({span:e.name,key:t})));return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Redactions`}),t.length===0?(0,R.jsx)(`div`,{className:`font-mono text-[12px] text-muted-foreground`,children:`No redacted attributes.`}):(0,R.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map((e,t)=>(0,R.jsxs)(`div`,{className:`grid gap-3 font-mono text-[12px] text-foreground [grid-template-columns:minmax(120px,180px)_minmax(0,1fr)]`,children:[(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:e.span}),(0,R.jsx)(`span`,{className:`break-words`,children:e.key})]},`${e.span}-${e.key}-${t}`))})]})}function TC({detail:e,approving:t=!1,skipping:n=!1,onApprove:r,onSkip:i,onTrustRepo:a}){let{capture:o,spans:s}=e;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsxs)(`header`,{className:`flex items-start justify-between gap-4`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h1`,{className:`m-0 break-all font-serif text-[22px] font-normal leading-tight text-foreground`,children:o.sessionId}),(0,R.jsxs)(`div`,{className:`mt-1.5 font-mono text-[12px] text-muted-foreground`,children:[new Date(o.capturedAt).toLocaleString(),` · `,s.length,` spans`]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[o.repoRemoteUrl?(0,R.jsx)(W,{variant:`secondary`,size:`sm`,onClick:()=>a(!0),children:`Trust repo`}):null,(0,R.jsx)(W,{variant:`secondary`,size:`sm`,disabled:n,onClick:i,children:n?`Skipping`:`Skip`}),(0,R.jsx)(W,{variant:`default`,size:`sm`,disabled:t,onClick:r,children:t?`Approving`:`Approve`})]})]}),(0,R.jsx)(CC,{capture:o}),(0,R.jsx)(wC,{spans:s}),(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Trajectory`}),s.length===0?(0,R.jsx)(`div`,{className:`font-mono text-[12px] text-muted-foreground`,children:`No spans recorded.`}):(0,R.jsx)(G,{children:(0,R.jsx)(Hi,{className:`flex flex-col p-0`,children:s.map((e,t)=>(0,R.jsxs)(`div`,{children:[t>0&&(0,R.jsx)(Ah,{}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-2.5`,children:[(0,R.jsx)(`strong`,{className:`min-w-0 truncate font-mono text-[12px] font-medium text-foreground`,children:e.name}),(0,R.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:e.spanId})]})]},e.spanId))})})]})]})}var EC=Object.defineProperty,DC=(e,t)=>EC(e,`name`,{value:t,configurable:!0}),OC=`Switch`,[kC,AC]=ra(OC),[jC,MC]=kC(OC);function NC(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=su({prop:n,defaultProp:i??!1,onChange:c,caller:OC}),[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useRef(!1),[y,b]=L.useReducer(e=>e+1,0),x={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:y,onUserInteraction:b,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,R.jsx)(jC,{scope:t,...x,children:VC(d)?d(x):r})}DC(NC,`SwitchProvider`);var PC=`SwitchTrigger`,FC=L.forwardRef(DC(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=MC(PC,e),g=Kn(r,u),_=L.useRef(c);return L.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=DC(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,R.jsx)(Gi.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":HC(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:g,onClick:K(t,e=>{p(),d(e=>!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`SwitchTrigger`)),IC=L.forwardRef(DC(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,R.jsx)(NC,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(FC,{...d,ref:t,__scopeSwitch:n}),e&&(0,R.jsx)(BC,{__scopeSwitch:n})]})})},`Switch`)),LC=`SwitchThumb`,RC=L.forwardRef(DC(function(e,t){let{__scopeSwitch:n,...r}=e,i=MC(LC,n);return(0,R.jsx)(Gi.span,{"data-state":HC(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),zC=`SwitchBubbleInput`,BC=L.forwardRef(DC(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=MC(zC,e),g=Kn(r,h),_=Ml(i),v=L.useRef(!1),y=L.useRef(s),b=L.useRef(o);L.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==b.current;b.current=o;let i=y.current!==s;y.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});n.call(e,s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let x=L.useRef(s);return(0,R.jsx)(Gi.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??x.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:K(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function VC(e){return typeof e==`function`}DC(VC,`isFunction`);function HC(e){return e?`checked`:`unchecked`}DC(HC,`getState`);var UC=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(IC,{className:U(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-[var(--vow-green)] data-[state=unchecked]:bg-border`,e),...t,ref:n,children:(0,R.jsx)(RC,{className:U(`pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0.5`)})}));UC.displayName=IC.displayName;function WC(e){return Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)))}function GC(e,t){return e.publicEndpoint===t.publicEndpoint&&e.defaultPriceUsdc===t.defaultPriceUsdc&&JSON.stringify(WC(e.perArtifactTypePrice))===JSON.stringify(WC(t.perArtifactTypePrice))&&e.donation.enabled===t.donation.enabled}function KC({label:e,value:t,meta:n}){return(0,R.jsxs)(`div`,{"data-testid":`operator-donation-fact`,className:`flex min-w-0 flex-col gap-1.5 rounded-lg border border-border px-3.5 py-3`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:e}),(0,R.jsx)(`strong`,{className:`font-mono text-[18px] font-medium text-foreground`,children:t}),(0,R.jsx)(`span`,{className:`truncate font-mono text-[12px] text-[var(--fg-dim)]`,children:n})]})}function qC({pricing:e,eligibleRuns:t,peerDatasetsUsed:n,saving:r,onSave:i,registerRevert:a}){let[o,s]=(0,L.useState)(e.donation.enabled),[c,l]=(0,L.useState)(!1),u=(0,L.useMemo)(()=>({publicEndpoint:e.publicEndpoint,defaultPriceUsdc:e.defaultPriceUsdc,perArtifactTypePrice:e.perArtifactTypePrice,donation:{enabled:o}}),[e.defaultPriceUsdc,e.perArtifactTypePrice,e.publicEndpoint,o]),d=!GC(e,u);return(0,R.jsxs)(`div`,{"data-testid":`operator-donation-status`,className:`flex flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-[260px] flex-[1_1_360px] flex-col gap-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Donate execution data`}),(0,R.jsx)(`strong`,{"data-testid":`operator-donation-mode`,className:o?`font-mono text-[18px] font-medium text-[var(--vow-green)]`:`font-mono text-[18px] font-medium text-foreground`,children:o?`Donation is on`:`Donation is off`}),(0,R.jsx)(`p`,{className:`m-0 max-w-[64ch] font-mono text-[12px] leading-relaxed text-[var(--fg-dim)]`,children:`Share scrubbed and anonymized solver/evaluator data from future runs with other operators. This lets the network learn from real executions and improve itself. Public testnet donations are free and published to IPFS.`})]}),(0,R.jsxs)(`label`,{"data-testid":`operator-donation-toggle`,className:`inline-flex cursor-pointer items-center gap-3 rounded-full border border-border bg-[var(--bg-sunken)] px-3 py-2`,children:[(0,R.jsx)(`span`,{className:o?`font-mono text-[11px] uppercase tracking-[0.12em] text-[var(--vow-green)]`:`font-mono text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:o?`On`:`Off`}),(0,R.jsx)(UC,{"aria-label":`Donate produced data`,checked:o,onCheckedChange:t=>{if(t&&!o&&!e.donation.enabled){l(!0);return}s(t)}})]})]}),(0,R.jsxs)(`div`,{"data-testid":`operator-donation-facts`,className:`grid gap-2.5 [grid-template-columns:repeat(auto-fit,minmax(150px,1fr))]`,children:[(0,R.jsx)(KC,{label:`Eligible runs`,value:String(t),meta:`local history`}),(0,R.jsx)(KC,{label:`Peer datasets used`,value:String(n),meta:`from other operators`})]}),(0,R.jsx)(fo,{variant:`info`,"data-testid":`operator-donation-caveat`,children:(0,R.jsx)(mo,{children:`Turning donation off stops future publishing. Data already published to IPFS may remain available.`})}),(0,R.jsx)(Ah,{}),(0,R.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-3`,children:(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`span`,{"data-testid":`operator-donation-settings-state`,className:d?`font-mono text-[12px] text-primary`:`font-mono text-[12px] text-[var(--fg-dim)]`,children:d?`Donation changed`:`Current`}),(0,R.jsx)(W,{variant:`default`,size:`sm`,type:`button`,disabled:!d||r,onClick:()=>{let t=e.donation.enabled;o!==t&&a(()=>s(t)),i(u)},children:r?`Saving…`:`Save`})]})}),(0,R.jsx)(Cx,{open:c,onOpenChange:l,children:(0,R.jsxs)(Ex,{"data-testid":`operator-donation-confirm`,children:[(0,R.jsxs)(Dx,{children:[(0,R.jsx)(kx,{children:`Share future execution data`}),(0,R.jsx)(Ax,{children:`Future solver/evaluator runs will be scrubbed, anonymized, and published to IPFS so other operators can use them. This helps the network learn from real executions and improve itself. Turning donation off later stops future publishing, but data already published to IPFS may remain available.`})]}),(0,R.jsxs)(Ox,{children:[(0,R.jsx)(Mx,{children:`Cancel`}),(0,R.jsx)(jx,{onClick:()=>{let e={...u,donation:{enabled:!0}};s(!0),l(!1),a(()=>s(!1)),i(e)},children:`Enable donation`})]})]})})]})}function JC({onRestartPending:e=()=>void 0}){let t=Ye(),{data:n,isLoading:r,isError:i,error:a,refetch:o}=ut({queryKey:[`operator-artifacts`,`served`],queryFn:()=>B.operator.listArtifacts({source:`served`,limit:100}),refetchInterval:1e4}),s=(0,L.useRef)(null),c=e=>{s.current=e},l=dt({mutationFn:e=>B.operator.updatePricing(e),onSuccess:async()=>{s.current=null,mh.success(`Donation setting saved`,{description:`Restart pending — applies on next daemon start.`}),e(),await t.invalidateQueries({queryKey:[`operator-artifacts`]})},onError:e=>{let t=s.current;s.current=null,t?.(),mh.error(`Failed to save donation setting`,{description:e instanceof Error?e.message:String(e)})}}),u=n?.summary,d=u?`${u.served.totalCount} eligible runs · donation ${n?.pricing.donation.enabled?`on`:`off`} · ${u.network.totalCount} peer datasets used`:`Donate scrubbed and anonymized run data to IPFS so other operators can use it.`;return(0,R.jsxs)(G,{children:[(0,R.jsxs)(zi,{className:`flex flex-row items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(Bi,{className:`flex items-center gap-2`,children:[(0,R.jsx)(zn,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),`Data donation`]}),(0,R.jsx)(Vi,{children:d})]}),(0,R.jsx)(q,{variant:n?.pricing.donation.enabled?`success`:`outline`,children:n?.pricing.donation.enabled?`IPFS donation on`:`Donation off`})]}),(0,R.jsxs)(Hi,{children:[r&&(0,R.jsxs)(`div`,{"data-testid":`operator-data-market-loading`,className:`flex flex-col gap-3`,"aria-label":`Loading execution data`,children:[(0,R.jsx)(ld,{className:`h-6 w-40`}),(0,R.jsx)(ld,{className:`h-4 w-72`}),(0,R.jsx)(ld,{className:`h-20 w-full`})]}),i&&(0,R.jsxs)(fo,{variant:`blocking`,role:`alert`,"data-testid":`operator-data-market-error`,className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(po,{className:`text-[var(--break-red)]`,children:a instanceof Error?a.message:`Failed to load execution data.`}),(0,R.jsxs)(W,{variant:`outline`,size:`sm`,type:`button`,onClick:()=>{o()},children:[(0,R.jsx)(Rn,{className:`h-3 w-3`,"aria-hidden":`true`}),`Retry`]})]}),n&&(0,R.jsx)(qC,{pricing:n.pricing,eligibleRuns:n.summary.served.totalCount,peerDatasetsUsed:n.summary.network.totalCount,saving:l.isPending,onSave:e=>l.mutate(e),registerRevert:c},`${n.pricing.publicEndpoint}|${n.pricing.defaultPriceUsdc}|${n.pricing.donation.enabled}|${JSON.stringify(WC(n.pricing.perArtifactTypePrice))}`)]})]})}var YC=Ab,XC=Ib,ZC=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Rb,{className:U(`fixed inset-0 z-50 bg-black/70 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));ZC.displayName=Rb.displayName;var QC=dr(`fixed z-50 gap-4 bg-card p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b border-border data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t border-border data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r border-border data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l border-border data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),$C=L.forwardRef(({side:e=`right`,className:t,children:n,...r},i)=>(0,R.jsxs)(XC,{children:[(0,R.jsx)(ZC,{}),(0,R.jsxs)(Hb,{ref:i,className:U(QC({side:e}),t),...r,children:[n,(0,R.jsxs)(Zb,{className:`absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none`,children:[(0,R.jsx)(Hn,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));$C.displayName=Hb.displayName;var ew=({className:e,...t})=>(0,R.jsx)(`div`,{className:U(`flex flex-col gap-2 text-left`,e),...t});ew.displayName=`SheetHeader`;var tw=({className:e,...t})=>(0,R.jsx)(`div`,{className:U(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t});tw.displayName=`SheetFooter`;var nw=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(qb,{ref:n,className:U(`font-serif text-[20px] text-foreground`,e),...t}));nw.displayName=qb.displayName;var rw=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Yb,{ref:n,className:U(`font-mono text-[12px] text-[var(--fg-muted)]`,e),...t}));rw.displayName=Yb.displayName;function iw(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||r===0?Math.round(n):n.toFixed(1)} ${t[r]}`}function aw(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().replace(`T`,` `).slice(0,19)+` UTC`}function ow(e){return e.length>14?`${e.slice(0,10)}…${e.slice(-6)}`:e}function sw(e,t){switch(e){case 8453:return`https://basescan.org/tx/${t}`;case 84532:return`https://sepolia.basescan.org/tx/${t}`;case 11155111:return`https://sepolia.etherscan.io/tx/${t}`;default:return null}}function cw(e){return e==null||!Number.isFinite(e)?`—`:aw(new Date(e*1e3).toISOString())}function lw({title:e,children:t}){return(0,R.jsxs)(G,{children:[(0,R.jsx)(zi,{className:`pb-2`,children:(0,R.jsx)(Bi,{className:`font-mono text-[11px] uppercase tracking-wide text-muted-foreground`,children:e})}),(0,R.jsx)(Hi,{className:`p-4 pt-0`,children:t})]})}function uw({rows:e}){return(0,R.jsx)(`dl`,{className:`m-0 grid gap-x-3.5 gap-y-2.5 [grid-template-columns:140px_minmax(0,1fr)]`,children:e.map(({label:e,value:t})=>(0,R.jsxs)(L.Fragment,{children:[(0,R.jsx)(`dt`,{className:`font-mono text-[12px] text-muted-foreground`,children:e}),(0,R.jsx)(`dd`,{className:`m-0 break-all font-mono text-[12px] text-foreground`,children:t??`—`})]},e))})}function dw(e){return e.source===`served`?e.createdAt:e.fetchedAt}function fw(e){return e.source===`served`?`shared`:e.paidAmountUsdc===`0`?`peer donated`:`peer used`}function pw(e,t){return!e||e.kind!==t.kind?!1:e.kind===`capture`&&t.kind===`capture`?e.id===t.id:e.kind===`artifact`&&t.kind===`artifact`&&e.source===t.source&&e.sha256===t.sha256}function mw(e){return e?e instanceof Error?e.message:String(e):`Unknown error`}function hw(e){return/\b(401|403)\b|unauthorized|forbidden/i.test(mw(e))}function gw({kind:e,message:t}){let n=e===`permission`?`Permission required to view execution data. Open the dashboard from the daemon handshake URL or refresh an authenticated session.`:`Execution data could not be loaded${t?`: ${t}`:`.`}`;return(0,R.jsx)(fo,{variant:e===`permission`?`warning`:`blocking`,"data-testid":e===`permission`?`execution-data-permission`:`execution-data-error`,children:(0,R.jsx)(mo,{children:n})})}function _w(e){return{id:`capture:${e.sessionId}`,selection:{kind:`capture`,id:e.sessionId},title:`execution-capture.v1`,state:e.status,meta:`${e.originatingTool.name} · ${e.spanCount} spans · ${e.redactedSpanCount} redacted`,at:e.capturedAt}}function vw(e){let t=fw(e);return{id:`artifact:${e.source}:${e.sha256}`,selection:{kind:`artifact`,source:e.source,sha256:e.sha256},title:e.artifactType,state:t,meta:`${e.source===`served`?`produced`:`peer`} · ${iw(e.contentSize)} · ${ow(e.sha256)}`,at:dw(e)}}function yw({artifact:e}){let t=dw(e),n=e.projection,r=e.anchors??[],i=[{label:`state`,value:fw(e)},{label:`sha256`,value:e.sha256},{label:`recorded`,value:aw(t)}],a=[{label:`envelope`,value:e.envelopeCid??`—`}];n&&a.push({label:`signature`,value:n.signatureHash},{label:`generated`,value:cw(n.generatedAt)},{label:`role`,value:n.role},{label:`solver`,value:n.solverType},{label:`evidence tier`,value:n.evidenceTier});let o=n?[{label:`safe`,value:n.participantSafeAddress??`—`},{label:`agent EOA`,value:n.participantAgentEoa??`—`},{label:`impl`,value:n.executor.implName??`—`},{label:`impl version`,value:n.executor.implVersion??`—`},{label:`runtime digest`,value:n.executor.runtimeBundleDigest??`—`},{label:`plugins`,value:n.executor.plugins&&n.executor.plugins.length>0?(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.executor.plugins.map(e=>(0,R.jsx)(q,{variant:`outline`,children:e},e))}):`—`}]:null,s=n?[{label:`task CID`,value:n.taskCid??`—`},{label:`task ID`,value:n.taskId??`—`},{label:`request`,value:n.requestId??`—`},{label:`solution ref`,value:n.solutionRef?`${n.solutionRef.envelopeCid}${n.solutionRef.ref?` (${n.solutionRef.ref})`:``}`:`—`}]:null;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsx)(lw,{title:`Identity`,children:(0,R.jsx)(uw,{rows:i})}),(0,R.jsx)(lw,{title:`Envelope`,children:(0,R.jsx)(uw,{rows:a})}),o?(0,R.jsx)(lw,{title:`Participant`,children:(0,R.jsx)(uw,{rows:o})}):null,s?(0,R.jsx)(lw,{title:`Task`,children:(0,R.jsx)(uw,{rows:s})}):null,(0,R.jsx)(lw,{title:`On-chain anchors`,children:r.length===0?(0,R.jsx)(`div`,{className:`font-mono text-[12px] text-muted-foreground`,children:`no on-chain anchor recorded yet`}):(0,R.jsx)(`div`,{className:`flex flex-col gap-3`,children:r.map(e=>{let t=sw(e.chainId,e.txHash);return(0,R.jsxs)(`div`,{className:`rounded-md border border-border bg-card p-3`,children:[(0,R.jsx)(uw,{rows:[{label:`content kind`,value:e.contentKind},{label:`agent ID`,value:e.agentId},{label:`chain ID`,value:String(e.chainId)},{label:`tx`,value:t?(0,R.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`break-all underline underline-offset-2 hover:text-foreground`,children:e.txHash}):e.txHash},{label:`block`,value:e.blockNumber===null?`pending`:String(e.blockNumber)},{label:`anchored`,value:cw(e.anchoredAt)},{label:`registry`,value:e.identityRegistryAddress},{label:`metadata key`,value:e.metadataKey}]}),(0,R.jsxs)(`details`,{className:`mt-2`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer font-mono text-[11px] text-muted-foreground`,children:`payload (ABI-encoded)`}),(0,R.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px] text-foreground`,children:e.payloadHex})]})]},`${e.contentKind}:${e.txHash}`)})})}),e.source===`served`?(0,R.jsx)(lw,{title:`Access`,children:(0,R.jsx)(uw,{rows:[{label:`request`,value:e.requestId??`—`},{label:`accesses`,value:`${e.access.accessCount} total · ${e.access.failedPaymentCount} failed`},{label:`paid serves`,value:String(e.access.paidServeCount)},{label:`free serves`,value:String(e.access.freeServeCount)},{label:`revenue`,value:`${e.access.revenueUsdc} USDC`}]})}):(0,R.jsx)(lw,{title:`Source`,children:(0,R.jsx)(uw,{rows:[{label:`operator`,value:e.sourceOperator??`—`},{label:`endpoint`,value:e.sourceEndpoint??`—`},{label:`origin`,value:e.origin},{label:`paid`,value:`${e.paidAmountUsdc} USDC`},{label:`peer catalog`,value:e.peerCatalogId??`—`}]})})]})}function bw(){let e=Ye(),[t,n]=(0,L.useState)(),[r,i]=(0,L.useState)(!1),a=ut({queryKey:[`captures`,`pending`],queryFn:()=>B.captures.listPending(),refetchInterval:2500}),o=ut({queryKey:[`operator-artifacts`,`served`,`execution-data`],queryFn:()=>B.operator.listArtifacts({source:`served`,limit:100}),refetchInterval:1e4}),s=ut({queryKey:[`operator-artifacts`,`network`,`execution-data`],queryFn:()=>B.operator.listArtifacts({source:`network`,limit:100}),refetchInterval:1e4}),c=a.data?.captures??[],l=[...o.data?.artifacts??[],...s.data?.artifacts??[]].sort((e,t)=>dw(t).localeCompare(dw(e))),u=[...c.map(_w),...l.map(vw)].sort((e,t)=>t.at.localeCompare(e.at)),d=t?.kind===`capture`?t.id:void 0,f=t?.kind===`artifact`?l.find(e=>e.source===t.source&&e.sha256===t.sha256):void 0,p=a.isLoading||o.isLoading||s.isLoading,m=[a.isError?a.error:a.failureReason,o.isError?o.error:o.failureReason,s.isError?s.error:s.failureReason].filter(Boolean),h=m.find(hw),g=h??m[0];(0,L.useEffect)(()=>{if(u.length===0){t&&n(void 0),r&&i(!1);return}(!t||!u.some(e=>pw(t,e.selection)))&&n(u[0].selection)},[u,t,r]);let _=ut({queryKey:[`captures`,d],queryFn:()=>B.captures.get(d),enabled:!!d}),v=dt({mutationFn:e=>B.captures.approve(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:[`captures`]}),e.invalidateQueries({queryKey:[`operator-artifacts`]})])}}),y=dt({mutationFn:e=>B.captures.skip(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:[`captures`]})}}),b=dt({mutationFn:e=>B.captures.trustRepo(e,!0)}),x=e=>{n(e),i(!0)},S=t?.kind===`capture`?_.data?.capture.sessionId??`Capture`:f?.artifactType??`Artifact`,C=t?.kind===`capture`&&_.data?`${new Date(_.data.capture.capturedAt).toLocaleString()} · ${_.data.spans.length} spans`:t?.kind===`artifact`&&f?`${fw(f)} · ${iw(f.contentSize)} · ${aw(dw(f))}`:`Execution data detail.`;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-6 p-6`,children:[(0,R.jsx)(JC,{defaultExpanded:!0}),(0,R.jsxs)(G,{children:[(0,R.jsx)(zi,{children:(0,R.jsx)(Bi,{children:`Execution data`})}),(0,R.jsxs)(Hi,{children:[g?(0,R.jsx)(`div`,{className:`mb-3`,children:(0,R.jsx)(gw,{kind:h?`permission`:`error`,message:h?void 0:mw(g)})}):null,p&&u.length===0?(0,R.jsx)(`div`,{className:`p-6 font-mono text-[12px] text-muted-foreground`,children:`Loading execution data.`}):u.length===0?(0,R.jsx)(`div`,{className:`p-6 font-mono text-[12px] text-muted-foreground`,children:`No execution data yet.`}):(0,R.jsx)(io,{className:`max-h-[560px]`,children:(0,R.jsx)(`div`,{className:`flex flex-col gap-2 pr-2`,children:u.map(e=>{let n=pw(t,e.selection);return(0,R.jsxs)(W,{variant:`ghost`,"data-testid":`execution-data-row`,"data-state":n?`active`:void 0,"aria-current":n?`true`:void 0,onClick:()=>x(e.selection),className:U(`flex h-auto w-full flex-col items-stretch gap-1.5 rounded-md border border-border bg-card px-4 py-3 text-left font-mono text-[12px] normal-case tracking-normal hover:bg-accent`,n&&`border-primary bg-primary/[0.06]`),children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`strong`,{className:`min-w-0 truncate font-medium text-foreground`,children:e.title}),(0,R.jsx)(q,{variant:`outline`,className:`shrink-0`,children:e.state})]}),(0,R.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[e.meta,` · `,aw(e.at)]})]},e.id)})})})]})]}),(0,R.jsx)(YC,{open:r,onOpenChange:i,children:(0,R.jsxs)($C,{side:`right`,className:`w-full overflow-y-auto sm:max-w-xl`,"data-testid":`execution-data-sheet`,children:[(0,R.jsxs)(ew,{children:[(0,R.jsx)(nw,{className:`break-all`,children:S}),(0,R.jsx)(rw,{children:C})]}),(0,R.jsx)(`div`,{className:`mt-4`,children:_.error?(0,R.jsx)(gw,{kind:hw(_.error)?`permission`:`error`,message:hw(_.error)?void 0:mw(_.error)}):t?.kind===`capture`&&_.data?(0,R.jsx)(TC,{detail:_.data,approving:v.isPending,skipping:y.isPending,onApprove:()=>d&&v.mutate(d),onSkip:()=>d&&y.mutate(d),onTrustRepo:()=>{let e=_.data.capture.repoRemoteUrl;e&&b.mutate(e)}}):t?.kind===`artifact`&&f?(0,R.jsx)(yw,{artifact:f}):(0,R.jsx)(`div`,{className:`p-6 font-mono text-[12px] text-muted-foreground`,children:p?`Loading execution data.`:`Select execution data.`})})]})})]})}var xw=Object.defineProperty,Sw=(e,t)=>xw(e,`name`,{value:t,configurable:!0}),Cw=[`Enter`,` `],ww=[`ArrowDown`,`PageUp`,`Home`],Tw=[`ArrowUp`,`PageDown`,`End`],Ew=[...ww,...Tw];[...Cw],[...Cw];var Dw=`Menu`,[Ow,kw,Aw]=Nd(Dw),[jw,Mw]=ra(Dw,[Aw,Ll,Yd]),Nw=Ll(),Pw=Yd(),[Fw,Iw]=jw(Dw),[Lw,Rw]=jw(Dw),zw=Sw(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Nw(t),[c,l]=L.useState(null),u=L.useRef(!1),d=aa(a),f=sa(i);return L.useEffect(()=>{let e=Sw(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=Sw(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),L.useEffect(()=>{if(!n)return;let e=Sw(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,R.jsx)(Xl,{...s,children:(0,R.jsx)(Fw,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,R.jsx)(Lw,{scope:t,onClose:L.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Bw=L.forwardRef(Sw(function(e,t){let{__scopeMenu:n,...r}=e,i=Nw(n);return(0,R.jsx)(Zl,{...i,...r,ref:t})},`MenuAnchor`)),Vw=`MenuPortal`,[Hw,Uw]=jw(Vw,{forceMount:void 0}),Ww=Sw(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Iw(Vw,t);return(0,R.jsx)(Hw,{scope:t,forceMount:n,children:(0,R.jsx)(Zi,{present:n||a.open,children:(0,R.jsx)(eu,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Gw=`MenuContent`,[Kw,qw]=jw(Gw),Jw=L.forwardRef(Sw(function(e,t){let n=Uw(Gw,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Iw(Gw,e.__scopeMenu),o=Rw(Gw,e.__scopeMenu);return(0,R.jsx)(Ow.Provider,{scope:e.__scopeMenu,children:(0,R.jsx)(Zi,{present:r||a.open,children:(0,R.jsx)(Ow.Slot,{scope:e.__scopeMenu,children:o.modal?(0,R.jsx)(Yw,{...i,ref:t}):(0,R.jsx)(Xw,{...i,ref:t})})})})},`MenuContent`)),Yw=L.forwardRef(Sw(function(e,t){let n=Iw(Gw,e.__scopeMenu),r=L.useRef(null),i=Kn(t,r);return L.useEffect(()=>{let e=r.current;if(e)return Sb(e)},[]),(0,R.jsx)(Qw,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:K(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Xw=L.forwardRef(Sw(function(e,t){let n=Iw(Gw,e.__scopeMenu);return(0,R.jsx)(Qw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Zw=qn(`MenuContent.ScrollLock`),Qw=L.forwardRef(Sw(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Iw(Gw,n),_=Rw(Gw,n),v=Nw(n),y=Pw(n),b=kw(n),[x,S]=L.useState(null),C=L.useRef(null),w=Kn(t,C,g.onContentChange),T=L.useRef(0),E=L.useRef(``),D=L.useRef(0),O=L.useRef(null),ee=L.useRef(`right`),k=L.useRef(0),A=m?pb:L.Fragment,j=m?{as:Zw,allowPinchZoom:!0}:void 0,M=Sw(e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=yT(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;Sw((function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);L.useEffect(()=>()=>window.clearTimeout(T.current),[]),ry();let N=L.useCallback(e=>ee.current===O.current?.side&&xT(e,O.current?.area),[]);return(0,R.jsx)(Kw,{scope:n,searchRef:E,onItemEnter:L.useCallback(e=>{N(e)&&e.preventDefault()},[N]),onItemLeave:L.useCallback(e=>{N(e)||(C.current?.focus(),S(null))},[N]),onTriggerLeave:L.useCallback(e=>{N(e)&&e.preventDefault()},[N]),pointerGraceTimerRef:D,onPointerGraceIntentChange:L.useCallback(e=>{O.current=e},[]),children:(0,R.jsx)(A,{...j,children:(0,R.jsx)(Uv,{asChild:!0,trapped:i,onMountAutoFocus:K(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,R.jsx)(us,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,R.jsx)(cf,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:K(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,R.jsx)(Ql,{role:`menu`,"aria-orientation":`vertical`,"data-state":mT(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:K(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&M(e.key));let i=C.current;if(e.target!==i||!Ew.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Tw.includes(e.key)&&a.reverse(),_T(a)}),onBlur:K(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:K(e.onPointerMove,ST(e=>{let t=e.target,n=k.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>k.current?`right`:`left`;ee.current=t,k.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),$w=L.forwardRef(Sw(function(e,t){let{__scopeMenu:n,...r}=e;return(0,R.jsx)(Gi.div,{...r,ref:t})},`MenuLabel`)),eT=`MenuItem`,tT=`menu.itemSelect`,nT=L.forwardRef(Sw(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=L.useRef(null),o=Rw(eT,e.__scopeMenu),s=qw(eT,e.__scopeMenu),c=Kn(t,a),l=L.useRef(!1),u=Sw(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(tT,{bubbles:!0,cancelable:!0});e.addEventListener(tT,e=>r?.(e),{once:!0}),Ki(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,R.jsx)(rT,{...i,ref:c,disabled:n,onClick:K(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:K(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:K(e.onKeyDown,e=>{n||e.target!==e.currentTarget||s.searchRef.current!==``&&e.key===` `||Cw.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),rT=L.forwardRef(Sw(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=qw(eT,n),s=Pw(n),c=L.useRef(null),l=Kn(t,c),[u,d]=L.useState(!1),[f,p]=L.useState(``);return L.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,R.jsx)(Ow.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,R.jsx)(lf,{asChild:!0,...s,focusable:!r,children:(0,R.jsx)(Gi.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:K(e.onPointerMove,ST(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:K(e.onPointerLeave,ST(e=>o.onItemLeave(e))),onFocus:K(e.onFocus,()=>d(!0)),onBlur:K(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),iT=L.forwardRef(Sw(function(e,t){let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,R.jsx)(cT,{scope:e.__scopeMenu,checked:n,children:(0,R.jsx)(nT,{role:`menuitemcheckbox`,"aria-checked":hT(n)?`mixed`:n,...i,ref:t,"data-state":gT(n),onSelect:K(i.onSelect,()=>r?.(hT(n)?!0:!n),{checkForDefaultPrevented:!1})})})},`MenuCheckboxItem`)),[aT,oT]=jw(`MenuRadioGroup`,{value:void 0,onValueChange:Sw(()=>{},`onValueChange`)}),sT=`MenuItemIndicator`,[cT,lT]=jw(sT,{checked:!1}),uT=L.forwardRef(Sw(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=lT(sT,n);return(0,R.jsx)(Zi,{present:r||hT(a.checked)||a.checked===!0,children:(0,R.jsx)(Gi.span,{...i,ref:t,"data-state":gT(a.checked)})})},`MenuItemIndicator`)),dT=L.forwardRef(Sw(function(e,t){let{__scopeMenu:n,...r}=e;return(0,R.jsx)(Gi.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[fT,pT]=jw(`MenuSub`);function mT(e){return e?`open`:`closed`}Sw(mT,`getOpenState`);function hT(e){return e===`indeterminate`}Sw(hT,`isIndeterminate`);function gT(e){return hT(e)?`indeterminate`:e?`checked`:`unchecked`}Sw(gT,`getCheckedState`);function _T(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Sw(_T,`focusFirst`);function vT(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Sw(vT,`wrapArray`);function yT(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=vT(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Sw(yT,`getNextMatch`);function bT(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}Sw(bT,`isPointInPolygon`);function xT(e,t){return t?bT({x:e.clientX,y:e.clientY},t):!1}Sw(xT,`isPointerInGraceArea`);function ST(e){return t=>t.pointerType===`mouse`?e(t):void 0}Sw(ST,`whenMouse`);var CT=zw,wT=Bw,TT=Ww,ET=Jw,DT=$w,OT=nT,kT=iT,AT=uT,jT=dT,MT=Object.defineProperty,NT=(e,t)=>MT(e,`name`,{value:t,configurable:!0}),PT=`DropdownMenu`,[FT,IT]=ra(PT,[Mw]),LT=Mw(),[RT,zT]=FT(PT),BT=NT(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=LT(t),l=L.useRef(null),[u,d]=su({prop:i,defaultProp:a??!1,onChange:o,caller:PT});return(0,R.jsx)(RT,{scope:t,triggerId:ys(),triggerRef:l,contentId:ys(),open:u,onOpenChange:d,onOpenToggle:L.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,R.jsx)(CT,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),VT=`DropdownMenuTrigger`,HT=L.forwardRef(NT(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=zT(VT,n),o=LT(n),s=Kn(t,a.triggerRef);return(0,R.jsx)(wT,{asChild:!0,...o,children:(0,R.jsx)(Gi.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:K(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:K(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),UT=NT(e=>{let{__scopeDropdownMenu:t,...n}=e,r=LT(t);return(0,R.jsx)(TT,{...r,...n})},`DropdownMenuPortal`),WT=`DropdownMenuContent`,GT=L.forwardRef(NT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=zT(WT,n),a=LT(n),o=L.useRef(!1);return(0,R.jsx)(ET,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:K(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:K(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),KT=L.forwardRef(NT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=LT(n);return(0,R.jsx)(DT,{...i,...r,ref:t})},`DropdownMenuLabel`)),qT=L.forwardRef(NT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=LT(n);return(0,R.jsx)(OT,{...i,...r,ref:t})},`DropdownMenuItem`)),JT=L.forwardRef(NT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=LT(n);return(0,R.jsx)(kT,{...i,...r,ref:t})},`DropdownMenuCheckboxItem`)),YT=L.forwardRef(NT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=LT(n);return(0,R.jsx)(AT,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),XT=L.forwardRef(NT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=LT(n);return(0,R.jsx)(jT,{...i,...r,ref:t})},`DropdownMenuSeparator`)),ZT=BT,QT=HT,$T=UT,eE=GT,tE=KT,nE=qT,rE=JT,iE=YT,aE=XT,oE=ZT,sE=QT,cE=L.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,R.jsx)($T,{children:(0,R.jsx)(eE,{ref:r,sideOffset:t,className:U(`z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md`,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,e),...n})}));cE.displayName=eE.displayName;var lE=L.forwardRef(({className:e,inset:t,...n},r)=>(0,R.jsx)(nE,{ref:r,className:U(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 font-mono text-[12px] outline-none transition-colors focus:bg-[var(--bg-sunken)] focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t&&`pl-8`,e),...n}));lE.displayName=nE.displayName;var uE=L.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,R.jsxs)(rE,{ref:i,className:U(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 font-mono text-[12px] outline-none focus:bg-[var(--bg-sunken)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,R.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,R.jsx)(iE,{children:(0,R.jsx)(bn,{className:`h-3 w-3`})})}),t]}));uE.displayName=rE.displayName;var dE=L.forwardRef(({className:e,inset:t,...n},r)=>(0,R.jsx)(tE,{ref:r,className:U(`px-2 py-1.5 font-mono text-[10px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,t&&`pl-8`,e),...n}));dE.displayName=tE.displayName;var fE=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(aE,{ref:n,className:U(`-mx-1 my-1 h-px bg-border`,e),...t}));fE.displayName=aE.displayName;var pE=[{to:`/operator/memberships`,label:`Memberships`},{to:`/operator/registry`,label:`Registry`},{to:`/operator/execution-data`,label:`Execution data`},{to:`/operator/network`,label:`Network`},{to:`/operator/security`,label:`Security`}];function mE({to:e,label:t}){let[n]=Jt(e);return(0,R.jsx)(`li`,{children:(0,R.jsx)($t,{href:e,"aria-current":n?`page`:void 0,className:U(`block rounded-sm px-3 py-2 font-mono text-[12px] tracking-[0.08em] no-underline transition-colors`,n?`bg-[var(--bg-elevated)] font-medium text-foreground`:`bg-transparent font-normal text-[var(--fg-muted)] hover:text-foreground`),children:t})})}function hE(){let[,e]=Kt();return(0,R.jsxs)(`nav`,{"aria-label":`Operator sections`,"data-testid":`operator-sub-nav`,className:`flex min-w-[160px] flex-col pt-1`,children:[(0,R.jsx)(`div`,{className:`mb-2 sm:hidden`,children:(0,R.jsxs)(oE,{children:[(0,R.jsx)(sE,{asChild:!0,children:(0,R.jsxs)(W,{variant:`outline`,size:`sm`,"data-testid":`operator-sub-nav-trigger`,children:[(0,R.jsx)(Pn,{className:`h-3.5 w-3.5`}),` Sections`]})}),(0,R.jsx)(cE,{align:`start`,children:pE.map(t=>(0,R.jsx)(lE,{onSelect:()=>e(t.to),children:t.label},t.to))})]})}),(0,R.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:pE.map(e=>(0,R.jsx)(mE,{to:e.to,label:e.label},e.to))})]})}function gE({children:e}){return(0,R.jsxs)(`div`,{"data-testid":`operator-shell`,className:`flex items-start gap-6 p-6`,children:[(0,R.jsx)(hE,{}),(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:e})]})}function _E(e){let t=bd(e.harness);return{harness:t,plugins:e.plugins??[],disabledDefaultPlugins:e.disabledDefaultPlugins??[],model:e.model??Ad(t)}}function vE(e,t){let n=bd(t.harness);if(e.harness!==n||e.model!==(t.model??Ad(n)))return!0;let r=[...e.plugins].sort(),i=[...t.plugins??[]].sort();if(r.length!==i.length)return!0;for(let e=0;e<r.length;e+=1)if(r[e]!==i[e])return!0;let a=[...e.disabledDefaultPlugins].sort(),o=[...t.disabledDefaultPlugins??[]].sort();if(a.length!==o.length)return!0;for(let e=0;e<a.length;e+=1)if(a[e]!==o[e])return!0;return!1}var yE=`flex h-9 w-full rounded-sm border border-border bg-sunken px-2.5 py-1 font-mono text-[13px] text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`;function bE({joined:e,catalogEntry:t,defaultExpanded:n=!1,focusOn:r,onRestartPending:i}){let[a,o]=(0,L.useState)(n),[s,c]=(0,L.useState)(()=>_E(e)),l=(0,L.useRef)(null),u=(0,L.useRef)(null),d=Ye(),f=t!==void 0,p=ut({queryKey:[`solvernets`,`manifest`,e.manifestCid],queryFn:()=>B.solvernets.getManifest(e.manifestCid),enabled:!f&&!!e.manifestCid,staleTime:1/0,retry:!1}),m=ut({queryKey:[`solvernets`,`catalog`],queryFn:()=>B.getSolverNets(),enabled:!f}),h=(()=>{if(f)return t;let e=p.data?.manifest;if(!(!e||!m.data))return m.data.nets.find(t=>t.contract.id===e.contract.id&&t.contract.version===e.contract.version)})(),g=e.contract??h?.contract,_=!f&&(p.isLoading||m.isLoading),v=!f&&p.isError&&!p.isLoading;(0,L.useEffect)(()=>{vE(s,e)||c(_E(e))},[e.harness,e.model,JSON.stringify(e.plugins??[]),JSON.stringify(e.disabledDefaultPlugins??[])]),(0,L.useEffect)(()=>{n&&(o(!0),r===`harness`&&setTimeout(()=>{l.current?.scrollIntoView({block:`center`,behavior:`smooth`}),u.current?.focus()},50))},[n,r]);let y=(h?.compatibleHarnesses??[]).filter(e=>e.supportsRoles.includes(`solving`)).map(e=>({...e,name:bd(e.name)})).filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t),b=new Set(y.map(e=>e.name)),x=s.harness!==``&&y.length>0&&![...b].some(e=>Cd(e,s.harness)),S=h?`${h.contract.id}@${h.contract.version}`:``,C=kd(s.harness),w=dt({mutationFn:()=>{let t=bd(e.harness),n=e.model??Ad(t),r=s.harness===t&&s.model===n?e.provider:jd(s.model,s.harness);return B.operator.join(e.manifestCid,{...e.name===void 0?{}:{name:e.name},...g===void 0?{}:{contract:{id:g.id,version:g.version}},roles:e.roles,...s.harness?{harness:s.harness}:{},plugins:s.plugins,disabledDefaultPlugins:s.disabledDefaultPlugins,...s.model?{model:s.model}:{},...r===void 0?{}:{provider:r}})},onSuccess:e=>{d.invalidateQueries({queryKey:[`operator`,`joined`]}),e.restartRequired&&i?.()}}),[T,E]=(0,L.useState)(!1),D=e.roles.includes(`solver`),O=oC(D?s.harness:void 0),ee=YS(O,D?s.model:void 0),k=D&&ee.requiresConfirmation,A=k&&!T,[j,M]=(0,L.useState)(!1),N=dt({mutationFn:()=>B.operator.leave(e.manifestCid),onSuccess:e=>{d.invalidateQueries({queryKey:[`operator`,`joined`]}),e.restartRequired&&i?.(),M(!1)}}),te=vE(s,e),P=e.name??e.manifestCid,F=`${e.manifestCid.slice(0,8)}…${e.manifestCid.slice(-4)}`;return(0,R.jsxs)(`article`,{"data-testid":`joined-net-card`,"data-manifest-cid":e.manifestCid,"data-expanded":a?`true`:`false`,className:`flex flex-col gap-2.5 rounded-md border border-border bg-background px-4 py-3.5`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,R.jsx)(`span`,{"data-testid":`joined-net-card-name`,className:`truncate font-serif text-[20px] leading-tight text-foreground tracking-[-0.01em]`,children:P}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2 font-mono text-[11px] text-muted-foreground`,children:[e.roles.map(e=>(0,R.jsx)(SE,{label:e},e)),(0,R.jsxs)(`span`,{className:`text-dim`,children:[`cid `,F]})]})]}),v?(0,R.jsx)(`div`,{className:`flex flex-col items-end gap-1.5`,children:j?(0,R.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`joined-net-card-leave-cancel`,disabled:N.isPending,onClick:()=>M(!1),children:`Cancel`}),(0,R.jsx)(W,{type:`button`,variant:`destructive`,size:`sm`,"data-testid":`joined-net-card-leave-confirm`,disabled:N.isPending,onClick:()=>N.mutate(),children:N.isPending?`Leaving…`:`Confirm leave`})]}):(0,R.jsxs)(W,{type:`button`,variant:`destructive`,size:`sm`,"data-testid":`joined-net-card-leave`,onClick:()=>M(!0),children:[(0,R.jsx)(Hn,{"aria-hidden":`true`,className:`!size-3`}),`Leave`]})}):(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`joined-net-card-toggle`,onClick:()=>o(e=>!e),children:a?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(xn,{"aria-hidden":`true`,className:`!size-3.5`}),`Close`]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Sn,{"aria-hidden":`true`,className:`!size-3.5`}),`Edit`]})})]}),v&&(0,R.jsxs)(`div`,{"data-testid":`joined-net-card-orphaned`,className:`rounded-sm border border-wane bg-transparent px-3.5 py-2.5 font-mono text-[12px] leading-relaxed text-muted-foreground`,children:[(0,R.jsx)(q,{variant:`pill`,className:`mr-2 align-baseline`,children:`Retired`}),`Manifest no longer in the registry. This SolverNet is not claiming on-chain anymore — leaving it removes the entry from your config. Restart the daemon afterwards so it stops looking for this manifest at startup.`,N.isError&&(0,R.jsx)(`div`,{role:`alert`,className:`mt-1.5 text-[11px] text-destructive`,children:N.error instanceof Error?N.error.message:`Leave failed.`})]}),!a&&!v&&(0,R.jsx)(xE,{harness:e.harness,plugins:e.plugins,model:e.model,harnessWarning:x?`does not support ${S}`:null,warningTestId:`joined-net-card-warn-collapsed`}),v&&(0,R.jsx)(xE,{harness:e.harness,plugins:e.plugins,model:e.model,harnessWarning:null}),a&&!v&&(0,R.jsxs)(`div`,{"data-testid":`joined-net-card-form`,className:`flex flex-col gap-3.5 border-t border-border pt-3`,children:[(0,R.jsxs)(`div`,{ref:l,className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(Kf,{htmlFor:`joined-net-card-harness-select`,children:`Harness`}),(0,R.jsxs)(`select`,{ref:u,id:`joined-net-card-harness-select`,"aria-label":`Harness implementation`,"data-testid":`joined-net-card-harness-select`,value:s.harness,onChange:e=>{let t=e.target.value;c(e=>({...e,harness:t,model:Ad(t)})),E(!1)},className:U(yE,x&&`border-destructive`),children:[s.harness===``&&(0,R.jsx)(`option`,{value:``,children:`—`}),y.map(e=>(0,R.jsx)(`option`,{value:e.name,children:Sd(e.name,e.version)},e.name)),s.harness&&y.length>0&&!b.has(s.harness)&&(0,R.jsxs)(`option`,{value:s.harness,children:[xd(s.harness),` (incompatible)`]}),s.harness&&y.length===0&&(0,R.jsx)(`option`,{value:s.harness,children:xd(s.harness)})]}),x&&(0,R.jsxs)(`span`,{"data-testid":`joined-net-card-warn-expanded`,className:`font-mono text-[11px] leading-relaxed text-destructive`,children:[`⚠ This harness does not support `,(0,R.jsx)(`span`,{className:`text-foreground`,children:S}),`.`,y.length>0&&(0,R.jsxs)(R.Fragment,{children:[` Compatible: `,y.map((e,t)=>(0,R.jsxs)(`span`,{className:`text-primary`,children:[xd(e.name),t<y.length-1?` · `:``]},e.name))]})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(Kf,{children:`Plugins`}),_?(0,R.jsx)(`span`,{"data-testid":`joined-net-card-catalog-loading`,className:`font-mono text-[12px] text-dim`,children:`Loading registry catalog…`}):h?(h.compatiblePlugins??[]).length===0?(0,R.jsx)(KS,{available:[],selected:s.plugins,disabledDefaultPlugins:s.disabledDefaultPlugins,onChange:(e,t)=>c(n=>({...n,plugins:e,disabledDefaultPlugins:t})),rowTestId:`joined-net-card-plugin-row`,searchTestId:`joined-net-card-plugin-search`,harness:s.harness}):(0,R.jsx)(KS,{available:h?.compatiblePlugins??[],selected:s.plugins,disabledDefaultPlugins:s.disabledDefaultPlugins,onChange:(e,t)=>c(n=>({...n,plugins:e,disabledDefaultPlugins:t})),rowTestId:`joined-net-card-plugin-row`,searchTestId:`joined-net-card-plugin-search`,harness:s.harness}):(0,R.jsx)(`span`,{"data-testid":`joined-net-card-catalog-missing`,className:`font-mono text-[12px] italic text-dim`,children:`Registry catalog has no template for this SolverNet's contract — plugins can't be verified.`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(Kf,{htmlFor:`joined-net-card-model-select`,children:`Model`}),(0,R.jsxs)(`select`,{id:`joined-net-card-model-select`,"aria-label":`Model`,"data-testid":`joined-net-card-model-select`,value:s.model,onChange:e=>{c({...s,model:e.target.value}),E(!1)},className:yE,children:[C.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.label},e.id)),(()=>{let e=Md(s.model,s.harness);return e.isCustom?(0,R.jsx)(`option`,{value:s.model,children:e.label},s.model):null})()]})]}),D&&(0,R.jsx)(ZS,{modelId:s.model,usesPaidApiKey:O,variant:`inline`,testIdPrefix:`joined-net-card-cost`}),D&&(0,R.jsx)(aC,{harness:s.harness,modelId:s.model,variant:`inline`,testIdPrefix:`joined-net-card-footprint`}),k&&(0,R.jsxs)(`label`,{"data-testid":`joined-net-card-cost-confirmation`,"data-cost-confirmation-checked":T?`true`:`false`,className:`flex cursor-pointer items-start gap-2 rounded-md border border-destructive bg-background px-3 py-2.5 font-mono text-[12px] text-foreground`,children:[(0,R.jsx)(`input`,{type:`checkbox`,"data-testid":`joined-net-card-cost-confirmation-checkbox`,checked:T,onChange:e=>E(e.target.checked),className:`mt-0.5 size-3.5 accent-destructive`,"aria-label":`I understand the per-task cost and have a budget for this`}),(0,R.jsx)(`span`,{children:`I understand — I have a budget for this. The selected model is estimated above $1/task on my own provider key.`})]}),w.isError&&(0,R.jsx)(`span`,{role:`alert`,"data-testid":`joined-net-card-error`,className:`font-mono text-[12px] text-destructive`,children:w.error instanceof Error?w.error.message:`Save failed.`}),(0,R.jsx)(Ah,{}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between font-mono text-[11px] text-dim`,children:[(0,R.jsx)(`span`,{children:te?`Restart required to apply.`:`No unsaved changes.`}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`joined-net-card-cancel`,disabled:!te||w.isPending,onClick:()=>c(_E(e)),children:`Cancel`}),(0,R.jsx)(W,{type:`button`,size:`sm`,"data-testid":`joined-net-card-save`,disabled:!te||w.isPending||A,onClick:()=>w.mutate(),children:w.isPending?`Saving…`:`Save`})]})]}),(0,R.jsxs)(`div`,{"data-testid":`joined-net-card-leave-zone`,className:`mt-1 flex flex-wrap items-start justify-between gap-3 border-t border-dashed border-border pt-3`,children:[(0,R.jsx)(`span`,{"data-testid":`joined-net-card-leave-explainer`,className:`max-w-[440px] font-mono text-[11px] leading-relaxed text-dim`,children:`Leave removes this SolverNet from your config right away. The running daemon keeps its loaded copy in memory, so it will go on claiming and finishing tasks for this SolverNet until you restart it — restart to actually stop new claims. Tasks already in flight run to completion either way. You can re-join from the Discover catalog later.`}),j?(0,R.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`joined-net-card-leave-cancel`,disabled:N.isPending,onClick:()=>M(!1),children:`Cancel`}),(0,R.jsx)(W,{type:`button`,variant:`destructive`,size:`sm`,"data-testid":`joined-net-card-leave-confirm`,disabled:N.isPending,onClick:()=>N.mutate(),children:N.isPending?`Leaving…`:`Confirm leave`})]}):(0,R.jsxs)(W,{type:`button`,variant:`destructive`,size:`sm`,"data-testid":`joined-net-card-leave`,onClick:()=>M(!0),children:[(0,R.jsx)(Hn,{"aria-hidden":`true`,className:`!size-3`}),`Leave SolverNet`]})]})]})]})}function xE({harness:e,plugins:t,model:n,harnessWarning:r,warningTestId:i}){return(0,R.jsxs)(`div`,{className:`grid grid-cols-[90px_1fr] gap-x-3 gap-y-1.5 font-mono text-[12px] text-muted-foreground`,children:[(0,R.jsx)(`span`,{children:`harness`}),(0,R.jsxs)(`span`,{className:`text-foreground`,children:[e?xd(e):(0,R.jsx)(`span`,{className:`text-dim`,children:`—`}),r&&i&&(0,R.jsxs)(`span`,{"data-testid":i,className:`ml-2.5 text-destructive`,children:[`⚠ `,r]})]}),(0,R.jsx)(`span`,{children:`plugins`}),(0,R.jsx)(`span`,{className:`text-foreground`,children:(t??[]).length===0?(0,R.jsx)(`span`,{className:`text-dim`,children:`—`}):`${t.length} active`}),(0,R.jsx)(`span`,{children:`model`}),(0,R.jsx)(`span`,{className:`text-foreground`,children:n?Md(n,bd(e)).label:(0,R.jsx)(`span`,{className:`text-dim`,children:`—`})})]})}function SE({label:e}){return(0,R.jsx)(q,{variant:`outline`,"data-testid":`joined-net-card-role`,className:`px-1.5 py-px text-[10px]`,children:e})}function CE({onRestartPending:e}={}){let t=ut({queryKey:[`operator`,`joined`],queryFn:()=>B.operator.listJoined(),refetchInterval:3e4}),n=(0,L.useMemo)(()=>{let e=t.data?.joinedSolverNets??{};return Object.values(e)},[t.data]);return(0,R.jsxs)(`div`,{"data-testid":`memberships-tab`,className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:[`Joined · `,n.length]}),t.isError&&(0,R.jsx)(`span`,{role:`alert`,className:`font-mono text-[11px] text-[var(--break-red)]`,children:`Failed to load joined SolverNets.`})]}),t.isLoading&&(0,R.jsxs)(`div`,{"data-testid":`memberships-tab-loading`,className:`flex flex-col gap-3`,"aria-label":`Loading`,children:[(0,R.jsx)(ld,{className:`h-20 w-full`}),(0,R.jsx)(ld,{className:`h-20 w-full`})]}),!t.isLoading&&n.length===0&&(0,R.jsxs)(`p`,{"data-testid":`memberships-tab-empty`,className:`m-0 font-mono text-[12px] leading-relaxed text-muted-foreground`,children:[`You haven't joined any SolverNets yet. Browse the`,` `,(0,R.jsx)($t,{href:`/operator/registry`,className:`text-primary no-underline hover:underline`,children:`Registry`}),` `,`to participate.`]}),n.map(t=>(0,R.jsx)(bE,{joined:t,onRestartPending:e},t.manifestCid))]})}var wE={launched:{variant:`success`,label:`Launched`},paused:{variant:`pill`,label:`Paused`},retired:{variant:`outline`,label:`Retired`}};function TE(e){return e?e.length<=13?e:`${e.slice(0,6)}…${e.slice(-4)}`:``}function EE(e){if(!e)return null;try{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().replace(`T`,` `).slice(0,16)+` UTC`}catch{return e}}function DE(e){if(e instanceof Error){let t=e.code;if(typeof t==`string`)return t;if(e.message.includes(`subsystem_not_ready`))return`subsystem_not_ready`;if(e.message.includes(`registry_unavailable`))return`registry_unavailable`;if(e.message.includes(`rpc_rate_limited`))return`rpc_rate_limited`}return null}var OE={title:`Your RPC endpoint is rate-limited.`,detail:`Open the Network section and add your own free key.`,actionHref:`/operator#network`,actionLabel:`Open Network settings →`};function kE(e){switch(DE(e)){case`subsystem_not_ready`:return{title:`SolverNet subsystem is still starting.`,detail:`Wait a few seconds, then retry. If this persists, restart the daemon and check its startup logs.`};case`registry_unavailable`:return{title:`Registry cache is unavailable.`,detail:`The daemon could not read the SolverNet registry cache. Retry after startup finishes; check daemon logs if it keeps failing.`};case`rpc_rate_limited`:return OE;default:return{title:`Failed to load registry catalog.`,detail:e instanceof Error?e.message:`Unknown error`}}}function AE({code:e,message:t}){return e===`rpc_rate_limited`?(0,R.jsxs)(`span`,{"data-testid":`registry-catalog-warn`,"data-error-code":`rpc_rate_limited`,className:`inline-flex gap-2 normal-case tracking-normal text-[var(--wane)]`,children:[(0,R.jsx)(`span`,{children:`RPC rate-limited — add your own key`}),(0,R.jsx)($t,{href:`/operator#network`,"data-testid":`registry-catalog-warn-action`,className:`text-primary no-underline hover:underline`,children:`Network settings →`})]}):(0,R.jsxs)(`span`,{"data-testid":`registry-catalog-warn`,className:`normal-case tracking-normal text-[var(--wane)]`,children:[`stale (`,t,`)`]})}function jE({status:e}){let t=wE[e]??wE.launched;return(0,R.jsx)(q,{"data-testid":`registry-status-badge`,"data-status":e,variant:t.variant,className:`whitespace-nowrap`,children:t.label})}function ME({openRoles:e}){return e.length===0?(0,R.jsx)(`span`,{className:`text-[12px] text-[var(--fg-dim)]`,children:`no open roles`}):(0,R.jsx)(`span`,{className:`flex flex-wrap gap-1.5`,children:e.map(e=>(0,R.jsx)(q,{"data-testid":`registry-open-role`,"data-role":e,variant:`outline`,className:`rounded-full text-foreground`,children:e},e))})}function NE({summary:e,joinedRoles:t,recommended:n}){let r=`/operator/join/${encodeURIComponent(e.manifestCid)}`,i=(t??[]).length>0,a=e.status===`launched`,o=i?`Edit`:n?`Try the demo`:`Join`;return(0,R.jsx)(G,{"data-testid":`registry-card`,"data-manifest-cid":e.manifestCid,className:`flex flex-col gap-3 p-4`,children:(0,R.jsxs)(`article`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`header`,{className:`flex items-start justify-between gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,R.jsx)(`span`,{className:e.name?`truncate font-mono text-[15px] font-medium text-foreground`:`truncate font-mono text-[15px] font-medium italic text-[var(--fg-muted)]`,children:e.name||`Metadata pending`}),(0,R.jsxs)(`span`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:[`Launcher: `,TE(e.launcherSafeAddress),` · agentId`,` `,e.launcherAgentId]})]}),(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[n&&!i&&(0,R.jsx)(q,{"data-testid":`registry-card-recommended`,variant:`secondary`,className:`whitespace-nowrap`,children:`Recommended demo`}),(0,R.jsx)(jE,{status:e.status})]})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 font-mono text-[12px] text-[var(--fg-muted)]`,children:[(0,R.jsx)(`span`,{children:`Open roles`}),(0,R.jsx)(ME,{openRoles:e.openRoles}),(0,R.jsx)(`span`,{children:`Solution price`}),(0,R.jsx)(`span`,{className:`text-foreground`,children:uv(e.solutionPriceWei)}),(0,R.jsx)(`span`,{children:`Verdict price`}),(0,R.jsx)(`span`,{className:`text-foreground`,children:uv(e.verdictPriceWei)})]}),(0,R.jsxs)(`footer`,{className:`flex items-center justify-end gap-3`,children:[i&&(0,R.jsxs)(q,{"data-testid":`registry-card-joined`,"data-manifest-cid":e.manifestCid,variant:`success`,className:`rounded-full px-2.5 py-1`,children:[`JOINED · `,(t??[]).join(`, `)]}),a?(0,R.jsx)(W,{asChild:!0,variant:i?`secondary`:`default`,"data-testid":`registry-join-cta`,"data-manifest-cid":e.manifestCid,children:(0,R.jsx)($t,{href:r,children:o})}):(0,R.jsx)(W,{type:`button`,variant:`secondary`,"data-testid":`registry-join-cta`,"data-manifest-cid":e.manifestCid,disabled:!0,"aria-disabled":!0,className:`pointer-events-none`,children:i?`Edit`:`Join`})]})]})})}function PE({refetchIntervalMs:e=3e4}={}){let{data:t,isLoading:n,isError:r,error:i,refetch:a}=ut({queryKey:[`solvernets`,`registry`],queryFn:()=>B.solvernets.listRegistry(),refetchInterval:e}),o=ut({queryKey:[`operator`,`joined`],queryFn:()=>B.operator.listJoined(),refetchInterval:e}),s=o.data?.joinedSolverNets??{};if(n||o.isLoading)return(0,R.jsx)(`p`,{"data-testid":`registry-catalog-loading`,className:`m-0 font-mono text-[13px] text-[var(--fg-muted)]`,children:`Loading catalog…`});if(r||o.isError){let e=kE(r?i:o.error);return(0,R.jsxs)(fo,{"data-testid":`registry-catalog-error`,variant:`blocking`,className:`flex items-center justify-between gap-4 border-l-0 border border-destructive p-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(po,{className:`font-mono text-[13px] font-medium text-destructive`,children:e.title}),(0,R.jsx)(mo,{className:`text-[12px] text-[var(--fg-muted)]`,children:e.detail}),e.actionHref&&e.actionLabel&&(0,R.jsx)($t,{href:e.actionHref,"data-testid":`registry-catalog-error-action`,className:`mt-0.5 font-mono text-[12px] text-primary no-underline hover:underline`,children:e.actionLabel})]}),(0,R.jsx)(W,{type:`button`,variant:`secondary`,size:`sm`,"data-testid":`registry-catalog-retry`,onClick:()=>{a()},children:`Retry`})]})}let c=t?.summaries??[],l=c.filter(e=>s[e.manifestCid]===void 0).filter(e=>!dd(e)).sort((e,t)=>Number(ud(t))-Number(ud(e))),u=EE(t?.lastRefreshedAt??null),d=t?.lastError??null;return(0,R.jsxs)(`div`,{"data-testid":`registry-catalog`,className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between font-mono text-[11px] uppercase tracking-[0.14em] text-[var(--fg-muted)]`,children:[(0,R.jsxs)(`span`,{"data-testid":`registry-catalog-meta`,children:[l.length,` discoverable · last refreshed`,` `,u??`never`]}),d&&(0,R.jsx)(AE,{code:d.code,message:d.message})]}),l.length===0?(0,R.jsx)(G,{"data-testid":`registry-catalog-empty`,className:`p-6 font-mono text-[13px] text-[var(--fg-muted)]`,children:c.length===0?`No launched SolverNets available.`:`No unjoined SolverNets available.`}):(0,R.jsx)(`div`,{className:`flex flex-col gap-2.5`,children:l.map(e=>(0,R.jsx)(NE,{summary:e,joinedRoles:s[e.manifestCid]?.roles,recommended:ud(e)},e.manifestCid))})]})}function FE(){return(0,R.jsxs)(`div`,{"data-testid":`registry-tab`,className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:[(0,R.jsx)(Dn,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),`Discover`]}),(0,R.jsx)(PE,{})]})}function IE({onRestartPending:e=()=>void 0}={}){let{data:t}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap(),refetchInterval:1500}),n=t?.chain??`base-sepolia`,r=t?.publicDefaults??[],i=t?.rpcUrls??r;return(0,R.jsxs)(`div`,{"data-testid":`network-tab`,className:`flex flex-col gap-4`,children:[(0,R.jsx)(HE,{chain:n,rpcUrls:i,publicDefaults:r,slotHealth:t?.rpcSlotHealth??[],onRestartPending:e},i.join(`,`)),(0,R.jsx)(RE,{})]})}function LE(e){if(e instanceof Error){let t=e.code;if(typeof t==`string`)return t;if(e.message.includes(`rpc_rate_limited`))return`rpc_rate_limited`;if(e.message.includes(`discovery_unavailable`))return`discovery_unavailable`;if(e.message.includes(`subsystem_not_ready`))return`subsystem_not_ready`}}function RE(){let{data:e,isLoading:t,isError:n,error:r}=ut({queryKey:[`discovery`,`task-post-counts`,`chain`],queryFn:()=>B.discovery.getTaskPostCounts(),refetchInterval:3e4}),i;return i=n?LE(r)===`rpc_rate_limited`?(0,R.jsxs)(fo,{variant:`warning`,"data-error-code":`rpc_rate_limited`,children:[(0,R.jsx)(Vn,{className:`h-4 w-4 text-[var(--wane)]`}),(0,R.jsx)(po,{className:`text-[var(--wane)]`,children:`RPC rate-limited`}),(0,R.jsx)(mo,{children:`Your RPC endpoint is rate-limited — add your own free key above to keep the task-post rate live.`})]}):(0,R.jsx)(`p`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:`Task-post rate is unavailable while the indexer catches up.`}):t||!e?(0,R.jsx)(`p`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:`Loading…`}):e.chain?e.chain.h24===0?(0,R.jsx)(`p`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:`No task posts in the last 24h.`}):(0,R.jsx)(`div`,{className:`grid grid-cols-3 gap-4`,children:[[`Last 1h`,e.chain.h1],[`Last 6h`,e.chain.h6],[`Last 24h`,e.chain.h24]].map(([e,t])=>(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[0.12em] text-[var(--fg-dim)]`,children:e}),(0,R.jsx)(`span`,{className:`font-mono text-[20px] text-foreground`,children:t})]},e))}):(0,R.jsx)(`p`,{className:`font-mono text-[12px] text-[var(--fg-muted)]`,children:`Task-post rate is unavailable while the indexer catches up.`}),(0,R.jsxs)(G,{"data-testid":`network-task-posts`,children:[(0,R.jsxs)(zi,{children:[(0,R.jsxs)(Bi,{className:`flex items-center gap-2`,children:[(0,R.jsx)(vn,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),`Task posts`]}),(0,R.jsx)(Vi,{children:`On-chain task posts on this network (approximate, block-windowed).`})]}),(0,R.jsx)(Hi,{children:i})]})}function zE(e){try{return new URL(e).hostname||e}catch{return e}}function BE(e,t){return e.length!==0&&e[0]!==t[0]}function VE({health:e}){return e?e.ok?(0,R.jsxs)(q,{variant:`success`,children:[e.localDev?`local dev`:`healthy`,e.latencyMs===void 0?``:` · ${e.latencyMs}ms`]}):e.reason===`chain_mismatch`?(0,R.jsxs)(q,{variant:`destructive`,children:[`wrong chain`,e.actualChainId!==void 0&&e.expectedChainId!==void 0?` · ${e.actualChainId}/${e.expectedChainId}`:``]}):(0,R.jsx)(q,{variant:e.code===429?`warning`:`destructive`,children:e.code===void 0?`unreachable`:`degraded · ${e.code}`}):(0,R.jsx)(q,{variant:`outline`,children:`unknown`})}function HE({chain:e,rpcUrls:t,publicDefaults:n,slotHealth:r,onRestartPending:i}){let a=BE(t,n),o=a?t[0]:``,[s,c]=(0,L.useState)(o),[l,u]=(0,L.useState)(!1),d=s.trim()!==o,f=e===`base`?`Base mainnet (chain id 8453)`:`Base Sepolia (chain id 84532)`,p=f.split(` (`)[0],m=async()=>{u(!0);try{let e=s.trim().length===0?null:s.trim(),t=await B.updateNetwork({rpcUrl:e});mh.success(e?`Primary RPC saved`:`Primary RPC cleared`,{description:t.restartRequired?`Restart pending — applies on next daemon start.`:`Applied to the running daemon.`}),t.restartRequired&&i()}catch(e){mh.error(`Failed to save Primary RPC`,{description:e instanceof Error?e.message:String(e)})}finally{u(!1)}};return(0,R.jsxs)(G,{children:[(0,R.jsxs)(zi,{className:`flex flex-row items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(Bi,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Fn,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),`Network`]}),(0,R.jsxs)(Vi,{children:[p,` · `,t.length,` RPC slot`,t.length===1?``:`s`]})]}),(0,R.jsx)(q,{variant:`outline`,children:`locked`})]}),(0,R.jsxs)(Hi,{className:`flex flex-col gap-6`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(Kf,{children:`Chain`}),(0,R.jsx)(`div`,{className:`rounded-md border border-border bg-[var(--bg-sunken)] px-3 py-2 font-mono text-[13px] text-muted-foreground`,children:f}),(0,R.jsx)(`p`,{className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:`Switching chains resets fleet state — that's a separate flow.`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Kf,{htmlFor:`primary-rpc`,children:`Primary RPC`}),d&&(0,R.jsx)(q,{variant:`warning`,children:`Restart`})]}),(0,R.jsx)(s_,{id:`primary-rpc`,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`https://your-key.example (optional)`,className:d?`border-primary`:void 0}),(0,R.jsx)(`p`,{className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:`Tried first — falls back to public chain on failure.`}),!a&&(0,R.jsxs)(`p`,{className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:[`You're on the shared public chain — fine for setup, not reliable under load. Get your own free key from`,` `,(0,R.jsxs)(`a`,{href:`https://dashboard.tenderly.co/`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-primary hover:underline`,children:[`Tenderly `,(0,R.jsx)(kn,{className:`h-2.5 w-2.5`})]}),`,`,` `,(0,R.jsxs)(`a`,{href:`https://www.alchemy.com/`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-primary hover:underline`,children:[`Alchemy `,(0,R.jsx)(kn,{className:`h-2.5 w-2.5`})]}),`, or`,` `,(0,R.jsxs)(`a`,{href:`https://www.quicknode.com/`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-primary hover:underline`,children:[`QuickNode `,(0,R.jsx)(kn,{className:`h-2.5 w-2.5`})]}),` `,`and paste it above.`]}),d&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(W,{variant:`secondary`,size:`sm`,type:`button`,onClick:()=>c(o),children:`Cancel`}),(0,R.jsx)(W,{variant:`default`,size:`sm`,type:`button`,disabled:l,onClick:()=>{m()},children:l?`Saving…`:o&&s.trim().length===0?`Clear`:`Save`})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(Kf,{children:`RPC fallback chain`}),(0,R.jsx)(`div`,{"data-testid":`network-rpc-slots`,className:`flex flex-col divide-y divide-border rounded-md border border-border`,children:t.map((e,t)=>(0,R.jsxs)(`div`,{"data-testid":`network-rpc-slot`,className:`flex items-center justify-between gap-3 px-3 py-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:[`slot `,t]}),(0,R.jsx)(`span`,{className:`truncate font-mono text-[12px] text-foreground`,children:zE(e)})]}),(0,R.jsx)(VE,{health:r[t]})]},`${t}-${e}`))}),(0,R.jsx)(`p`,{className:`font-mono text-[11px] text-[var(--fg-dim)]`,children:`Primary → public backups, in order. Health from the last boot probe.`})]})]})]})}var UE=e=>e.type===`checkbox`,WE=e=>e instanceof Date,GE=e=>e==null,KE=e=>typeof e==`object`,qE=e=>!GE(e)&&!Array.isArray(e)&&KE(e)&&!WE(e),JE=e=>qE(e)&&e.target?UE(e.target)?e.target.checked:e.target.value:e,YE=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),XE=e=>{let t=e.constructor&&e.constructor.prototype;return qE(t)&&t.hasOwnProperty(`isPrototypeOf`)},ZE=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function QE(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(ZE&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(qE(e)&&XE(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=QE(e[t]));return r}var $E={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},eD={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},tD={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},nD=`root`,rD=[`__proto__`,`constructor`,`prototype`],iD=/^\w*$/,aD=e=>iD.test(e),oD=e=>e===void 0,sD=/[.[\]'"]/,cD=e=>e.split(sD).filter(Boolean),J=(e,t,n)=>{if(!t||!qE(e))return n;let r=aD(t)?[t]:cD(t);if(r.some(e=>rD.includes(e)))return n;let i=r.reduce((e,t)=>GE(e)?void 0:e[t],e);return oD(i)||i===e?oD(e[t])?n:e[t]:i},lD=e=>typeof e==`boolean`,uD=e=>typeof e==`function`,dD=(e,t,n)=>{let r=-1,i=aD(t)?[t]:cD(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=qE(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(rD.includes(t))return;e[t]=a,e=e[t]}},fD=L.createContext(null);fD.displayName=`HookFormControlContext`;var pD=()=>L.useContext(fD),mD=(e,t,n,r=!0)=>{let i={};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==eD.all&&(t._proxyFormState[i]=!r||eD.all),n&&(n[i]=!0),e[i]}});return i},hD=ZE?L.useLayoutEffect:L.useEffect;function gD(e){let t=pD(),{control:n=t,disabled:r,name:i,exact:a}=e||{},[o,s]=L.useState(()=>({...n._formState,defaultValues:n._defaultValues})),c=L.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return hD(()=>n._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!r&&s({...n._formState,...e,defaultValues:n._defaultValues})}}),[i,r,a]),L.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),L.useMemo(()=>mD(o,n,c.current,!1),[o,n])}var _D=e=>typeof e==`string`,vD=(e,t,n,r,i)=>_D(e)?(r&&t.watch.add(e),J(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),J(n,e))):(r&&(t.watchAll=!0),n),yD=e=>GE(e)||!KE(e),bD=(e,t)=>t.length===0&&!Array.isArray(e)&&!XE(e);function xD(e,t,n=new WeakMap){if(e===t)return!0;if(yD(e)||yD(t))return Object.is(e,t);if(WE(e)&&WE(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(bD(e,r)||bD(t,i))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;let a=n.get(e);if(a&&a.has(t))return!0;if(a)a.add(t);else{let r=new WeakSet;r.add(t),n.set(e,r)}for(let i of r){let r=e[i];if(!(i in t))return!1;if(i!==`ref`){let e=t[i];if(WE(r)&&WE(e)||(qE(r)||Array.isArray(r))&&(qE(e)||Array.isArray(e))?!xD(r,e,n):!Object.is(r,e))return!1}}return!0}function SD(e){let t=pD(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=L.useRef(i),l=L.useRef(s),u=L.useRef(void 0),d=L.useRef(n),f=L.useRef(r);l.current=s;let[p,m]=L.useState(()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e}),h=L.useCallback(e=>{let t=vD(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),g=L.useCallback(e=>{if(!a){let t=vD(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);xD(e,u.current)||(m(e),u.current=e)}else m(t)}},[n._formValues,n._names,a,r]);hD(()=>((d.current!==n||!xD(f.current,r))&&(d.current=n,f.current=r,g()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:e=>{g(e.values)}})),[n,o,r,g]),L.useEffect(()=>n._removeUnmounted());let _=d.current!==n,v=f.current,y=L.useMemo(()=>{if(a)return null;let e=!_&&!xD(v,r);return _||e?h():null},[a,_,r,v,h]);return y===null?p:y}function CD(e){let t=pD(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=YE(i._names.array,n),l=SD({control:i,name:n,defaultValue:L.useMemo(()=>J(i._formValues,n,J(i._defaultValues,n,o)),[i,n,o]),exact:s}),u=gD({control:i,name:n,exact:s}),d=L.useRef(e),f=L.useRef(null),p=L.useRef(i.register(n,{...e.rules,value:l,...lD(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let m=L.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!J(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!J(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!J(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!J(u.validatingFields,n)},error:{enumerable:!0,get:()=>J(u.errors,n)}}),[u,n]),h=L.useCallback(e=>{let t=JE(e);return J(i._fields,n)||(p.current=i.register(n,{...d.current.rules,value:t})),p.current.onChange({target:{value:JE(e),name:n},type:$E.CHANGE})},[n,i]),g=L.useCallback(()=>p.current.onBlur({target:{value:J(i._formValues,n),name:n},type:$E.BLUR}),[n,i._formValues]),_=L.useCallback(e=>{e&&(f.current={focus:()=>uD(e.focus)&&e.focus(),select:()=>uD(e.select)&&e.select(),setCustomValidity:t=>uD(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>uD(e.reportValidity)&&e.reportValidity()});let t=J(i._fields,n);t&&t._f&&e&&(t._f.ref=f.current)},[i._fields,n]),v=L.useMemo(()=>({name:n,value:l,...lD(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:h,onBlur:g,ref:_}),[n,r,u.disabled,h,g,_,l]);return L.useEffect(()=>{let e=i._options.shouldUnregister||a;i.register(n,{...d.current.rules,...lD(d.current.disabled)?{disabled:d.current.disabled}:{}});let t=(e,t)=>{let n=J(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=QE(J(a?i._defaultValues:i._options.values||i._defaultValues,n,J(i._options.defaultValues,n,d.current.defaultValue)));dD(i._defaultValues,n,e),oD(J(i._formValues,n))&&dD(i._formValues,n,e)}if(!c&&i.register(n),f.current){let e=J(i._fields,n);e&&e._f&&(e._f.ref=f.current)}return()=>{(c?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,c,a]),L.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),L.useMemo(()=>({field:v,formState:u,fieldState:m}),[v,u,m])}var wD=e=>e.render(CD(e)),TD=e=>({isOnSubmit:!e||e===eD.onSubmit,isOnBlur:e===eD.onBlur,isOnChange:e===eD.onChange,isOnAll:e===eD.all,isOnTouch:e===eD.onTouched}),ED=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(let n of t.watch)if(e.startsWith(n)&&e.charAt(n.length)===`.`)return!0;return!1},DD=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=J(e,i);if(n){let{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(DD(a,t))break}else if(qE(a)&&DD(a,t))break}}},OD=(e,t,n)=>{let r=J(e,n),i=Array.isArray(r)?r:[];return dD(i,nD,t[n]),dD(e,n,i),e},kD=e=>qE(e)&&!Object.keys(e).length,AD=e=>e.type===`file`,jD=e=>{if(!ZE)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},MD=e=>e.type===`radio`,ND=e=>e instanceof RegExp,PD=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},FD={value:!1,isValid:!1},ID={value:!0,isValid:!0},LD=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!oD(e[0].attributes.value)?oD(e[0].value)||e[0].value===``?ID:{value:e[0].value,isValid:!0}:ID:FD}return FD},RD={isValid:!1,value:null},zD=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,RD):RD;function BD(e,t,n=`validate`){if(_D(e)||Array.isArray(e)&&e.every(_D)||lD(e)&&!e)return{type:n,message:_D(e)?e:``,ref:t}}var VD=e=>qE(e)&&!ND(e)?e:{value:e,message:``},HD=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_}=e._f,v=J(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{if(i&&y.reportValidity){let t=lD(e)?``:e||``;s?s.forEach(e=>e.setCustomValidity(t)):y.setCustomValidity(t),y.reportValidity()}},x={},S=MD(o),C=UE(o),w=S||C,T=(g||AD(o))&&oD(o.value)&&oD(v)||jD(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length,E=PD.bind(null,h,r,x),D=(e,t,n,r=tD.maxLength,i=tD.minLength)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...E(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!w&&(T||GE(v))||lD(v)&&!v||C&&!LD(s).isValid||S&&!zD(s).isValid)){let{value:e,message:t}=_D(c)?{value:!!c,message:c}:VD(c);if(e&&(x[h]={type:tD.required,message:t,ref:y,...E(tD.required,t)},!r))return b(t),x}if(!T&&(!GE(d)||!GE(f))){let e,t,n=VD(f),i=VD(d);if(!GE(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;GE(n.value)||(e=r>n.value),GE(i.value)||(t=r<i.value)}else{let r=o.valueAsDate||new Date(v),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;_D(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),_D(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}if((e||t)&&(D(!!e,n.message,i.message,tD.max,tD.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(_D(v)||a&&Array.isArray(v))){let e=VD(l),t=VD(u),n=!GE(e.value)&&v.length>+e.value,i=!GE(t.value)&&v.length<+t.value;if((n||i)&&(D(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!T&&_D(v)){let{value:e,message:t}=VD(p);if(ND(e)&&!v.match(e)&&(x[h]={type:tD.pattern,message:t,ref:o,...E(tD.pattern,t)},!r))return b(t),x}if(m){if(uD(m)){let e=BD(await m(v,n),y);if(e&&(x[h]={...e,...E(tD.validate,e.message)},!r))return b(e.message),x}else if(qE(m)){let e={};for(let t in m){if(!kD(e)&&!r)break;let i=BD(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!kD(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},UD=e=>Array.isArray(e)?e:[e],WD=e=>Array.isArray(e)?e.filter(Boolean):[];function GD(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;){if(GE(e)){e=void 0;break}e=e[t[r]],r++}return e}function KD(e){for(let t in e)if(e.hasOwnProperty(t)&&!oD(e[t]))return!1;return!0}function qD(e,t){if(_D(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:aD(t)?[t]:cD(t);if(n.some(e=>rD.includes(String(e))))return e;let r=n.length===1?e:GD(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(qE(r)&&kD(r)||Array.isArray(r)&&KD(r))&&qD(e,n.slice(0,-1)),e}var JD=e=>{let t={};for(let n of Object.keys(e))if(KE(e[n])&&e[n]!==null&&!WE(e[n])){let r=JD(e[n]);for(let e of Object.keys(r))t[`${n}.${e}`]=r[e]}else t[n]=e[n];return t},YD=L.createContext(null);YD.displayName=`HookFormContext`;var XD=()=>L.useContext(YD),ZD=({children:e,watch:t,getValues:n,getFieldState:r,setError:i,clearErrors:a,setValue:o,setValues:s,trigger:c,formState:l,resetField:u,reset:d,resetDefaultValues:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:_,subscribe:v})=>{let y=L.useMemo(()=>({watch:t,getValues:n,getFieldState:r,setError:i,clearErrors:a,setValue:o,setValues:s,trigger:c,formState:l,resetField:u,reset:d,resetDefaultValues:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:_,subscribe:v}),[a,h,l,r,n,p,g,d,f,u,i,_,o,s,v,c,m,t]);return L.createElement(YD.Provider,{value:y},L.createElement(fD.Provider,{value:y.control},e))},QD=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function $D(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&qE(i)&&a){let e=$D(i,a);qE(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var eO=e=>e.type===`select-multiple`,tO=e=>MD(e)||UE(e),nO=e=>jD(e)&&e.isConnected,rO=e=>{for(let t in e)if(uD(e[t]))return!0;return!1};function iO(e){return Array.isArray(e)||qE(e)&&!rO(e)}function aO(e){return!!(e&&`_f`in e)}function oO(e){return Array.isArray(e)?!e.some(e=>!oD(e)):!Object.keys(e).length}function sO(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function cO(e,t={},n){for(let r in e){let i=e[r],a=n&&n[r];iO(i)&&(!Array.isArray(i)||!aO(a))?(t[r]=Array.isArray(i)?[]:{},cO(i,t[r],a),oO(t[r])&&sO(t,r)):oD(i)||(t[r]=!0)}return t}function lO(e,t,n,r){n||=cO(t,{},r);for(let i in e){let a=e[i],o=r&&r[i];iO(a)&&(!Array.isArray(a)||!aO(o))?(oD(t)||yD(n[i])?n[i]=cO(a,Array.isArray(a)?[]:{},o):lO(a,GE(t)?{}:t[i],n[i],o),oO(n[i])&&sO(n,i)):xD(a,t[i])?sO(n,i):n[i]=!0}return n}var uO=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>oD(e)?e:t?e===``?NaN:e&&+e:n&&_D(e)?new Date(e):r?r(e):e;function dO(e){let t=e.ref;return AD(t)?t.files:MD(t)?zD(e.refs).value:eO(t)?[...t.selectedOptions].map(({value:e})=>e):UE(t)?LD(e.refs).value:uO(oD(t.value)?e.ref.value:t.value,e)}var fO=(e,t,n,r)=>{let i={};for(let n of e){let e=J(t,n);e&&dD(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},pO=e=>oD(e)?e:ND(e)?e.source:qE(e)?ND(e.value)?e.value.source:e.value:e,mO=`AsyncFunction`,hO=e=>{if(!e||!e.validate)return!1;if(uD(e.validate))return e.validate.constructor.name===mO;if(qE(e.validate)){for(let t in e.validate)if(e.validate[t].constructor.name===mO)return!0}return!1},gO=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function _O(e,t,n){let r=J(e,n);if(r||aD(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=J(t,r),o=J(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var vO=(e,t,n,r)=>{n(e);let{name:i,...a}=e,o=Object.keys(a);return!o.length||r&&o.length>=Object.keys(t).length||o.find(e=>t[e]===(!r||eD.all))},yO=(e,t,n)=>!e||!t||e===t||UD(e).some(e=>e&&(n?e===t||e.startsWith(t+`.`):e.startsWith(t)||t.startsWith(e))),bO=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,xO=(e,t)=>!WD(J(e,t)).length&&qD(e,t),SO={mode:eD.onSubmit,reValidateMode:eD.onChange,shouldFocusError:!0},CO=`form`,wO={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function TO(e={}){let t={...SO,...e},n={...QE(wO),isLoading:uD(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},r={},i=(qE(t.defaultValues)||qE(t.values))&&QE(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:QE(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c={},l={},u=0,d=TD(t.mode),f=TD(t.reValidateMode),p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...p},h={...m},g={array:QD(),state:QD()},_=0,v=t.criteriaMode===eD.all,y=(e,t)=>n=>{clearTimeout(l[e]),l[e]=setTimeout(t,n)},b=async e=>{if(!o.keepIsValid&&!t.disabled&&(m.isValid||h.isValid||e)){let e=++_,i;t.resolver?(i=kD((await k()).errors),e===_&&x()):i=await M({fields:r,onlyCheckValid:!0,eventType:$E.VALID}),e===_&&i!==n.isValid&&g.state.next({isValid:i})}},x=(e,r)=>{!t.disabled&&(m.isValidating||m.validatingFields||h.isValidating||h.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?dD(n.validatingFields,e,r):qD(n.validatingFields,e))}),g.state.next({validatingFields:n.validatingFields,isValidating:!kD(n.validatingFields)}))},S=()=>{n.dirtyFields=lO(i,a,void 0,r)},C=(e,i=[],s,c,l=!0,u=!0)=>{if(c&&s&&!t.disabled){if(o.action=!0,u&&Array.isArray(J(r,e))){let t=s(J(r,e),c.argA,c.argB);l&&dD(r,e,t)}if(u&&Array.isArray(J(n.errors,e))){let t=s(J(n.errors,e),c.argA,c.argB);l&&dD(n.errors,e,t),xO(n.errors,e)}if((m.touchedFields||h.touchedFields)&&u&&Array.isArray(J(n.touchedFields,e))){let t=s(J(n.touchedFields,e),c.argA,c.argB);l&&dD(n.touchedFields,e,t)}(m.dirtyFields||h.dirtyFields)&&S(),g.state.next({name:e,isDirty:te(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else dD(a,e,i)},w=(e,t)=>{dD(n.errors,e,t),n.errors={...n.errors},g.state.next({errors:n.errors})},T=e=>{n.errors=e,g.state.next({errors:n.errors,isValid:!1})},E=e=>{let t=aD(e)?[e]:cD(e),n=a,r=i;for(let e=0;e<t.length-1;e++){let i=t[e];if(n=GE(n)?n:n[i],r=GE(r)?r:r[i],n===null&&r!==null)return!0}return!1},D=(t,c,l,u)=>{let d=J(r,t);if(d){if(E(t))return;let r=oD(J(a,t)),f=J(a,t,oD(l)?J(i,t):l);oD(f)||u&&u.defaultChecked||c?dD(a,t,c?f:dO(d._f)):ne(t,f),o.mount&&!o.action&&(b(),r&&n.isDirty&&(m.isDirty||h.isDirty)&&(te()||(n.isDirty=!1,g.state.next({...n}))),e.shouldUnregister&&r&&!oD(J(a,t))&&ED(t,s)&&(o.watch=!0))}},O=(e,o,s,c,l)=>{let u=!1,d=!1,f={name:e};if(!t.disabled||c===!0){if(!s||c){let t=xD(J(i,e),o);(m.isDirty||h.isDirty)&&(d=n.isDirty,n.isDirty=f.isDirty=!t||te(),u=d!==f.isDirty),d=!!J(n.dirtyFields,e),t===n.isDirty?t?qD(n.dirtyFields,e):dD(n.dirtyFields,e,!0):n.dirtyFields=lO(i,a,void 0,r),f.dirtyFields=n.dirtyFields,u||=(m.dirtyFields||h.dirtyFields)&&d!==!t}if(s){let t=J(n.touchedFields,e);t||(dD(n.touchedFields,e,s),f.touchedFields=n.touchedFields,u||=(m.touchedFields||h.touchedFields)&&t!==s)}u&&l&&g.state.next(f)}return u?f:{}},ee=(e,r,i,a)=>{let o=J(n.errors,e),s=(m.isValid||h.isValid)&&lD(r)&&n.isValid!==r;if(t.delayError&&i?(c[e]=y(e,()=>w(e,i)),c[e](t.delayError)):(clearTimeout(l[e]),delete c[e],i?dD(n.errors,e,i):qD(n.errors,e),n.errors={...n.errors}),(i?!xD(o,i):o)||!kD(a)||s){let t={...a,...s&&lD(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},g.state.next(t)}},k=async e=>(x(e,!0),await t.resolver(a,t.context,fO(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),A=async e=>{let{errors:t}=await k(e);if(x(e),e){for(let r of e){let e=J(t,r);e?s.array.has(r)&&qE(e)&&!Object.keys(e).some(e=>!Number.isNaN(Number(e)))?OD(n.errors,{[r]:e},r):dD(n.errors,r,e):qD(n.errors,r)}n.errors={...n.errors}}else n.errors=t;return t},j=async({name:t,eventType:r})=>{if(e.validate){let i=await e.validate({formValues:a,formState:n,name:t,eventType:r});if(qE(i))for(let e in i){let t=i[e];t&&fe(`${CO}.${e}`,{message:_D(t.message)?t.message:``,type:t.type||tD.validate})}else _D(i)||!i?fe(CO,{message:i||``,type:tD.validate}):de(CO);return i}return!0},M=async({fields:r,onlyCheckValid:i,name:o,eventType:c,context:l={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(l.runRootValidation=!0,!await j({name:o,eventType:c})&&(l.valid=!1,i)))return l.valid;for(let o in r){let u=r[o];if(u){let{_f:r,...d}=u;if(r){let o=s.array.has(r.name),c=u._f&&hO(u._f),d=m.validatingFields||m.isValidating||h.validatingFields||h.isValidating;c&&d&&x([r.name],!0);let f=await HD(u,s.disabled,a,v,t.shouldUseNativeValidation&&!i,o);if(c&&d&&x([r.name]),f[r.name]&&(l.valid=!1,i)||(!i&&(J(f,r.name)?o?OD(n.errors,f,r.name):dD(n.errors,r.name,f[r.name]):qD(n.errors,r.name)),e.shouldUseNativeValidation&&f[r.name]))break}!kD(d)&&await M({context:l,onlyCheckValid:i,fields:d,name:o,eventType:c})}}return l.valid},N=()=>{for(let e of s.unMount){let t=J(r,e);t&&(t._f.refs?t._f.refs.every(e=>!nO(e)):!nO(t._f.ref))&&ge(e)}s.unMount=new Set},te=(e,t)=>(e&&t&&dD(a,e,t),!xD(o.mount?a:i,i)),P=(e,t,n)=>vD(e,s,{...o.mount?a:oD(t)?i:_D(e)?{[e]:t}:t},n,t),F=e=>WD(J(o.mount?a:i,e,t.shouldUnregister?J(i,e,[]):[])),ne=(e,t,n={},i=!1,o=!1)=>{let s=J(r,e),c=t;if(s){let n=s._f;n&&(!n.disabled&&dD(a,e,uO(t,n)),c=jD(n.ref)&&GE(t)?``:t,eO(n.ref)?[...n.ref.options].forEach(e=>e.selected=c.includes(e.value)):n.refs?UE(n.ref)?n.refs.forEach(e=>{(!e.defaultChecked||!e.disabled)&&(Array.isArray(c)?e.checked=!!c.find(t=>t===e.value):e.checked=c===e.value||!!c)}):n.refs.forEach(e=>e.checked=e.value===c):AD(n.ref)?n.ref.value=``:(n.ref.value=c,!n.ref.type&&!o&&g.state.next({name:e,values:i?a:QE(a)})))}(n.shouldDirty||n.shouldTouch)&&O(e,c,n.shouldTouch,n.shouldDirty,!o),n.shouldValidate&&ce(e,{delayError:n.delayError})},re=(e,t,n,i=!1,a=!1)=>{for(let o in t){if(!t.hasOwnProperty(o))return;let c=t[o],l=e+`.`+o,u=J(r,l);(s.array.has(e)||qE(c)||u&&!u._f)&&!WE(c)?re(l,c,n,i,a):ne(l,c,n,i,a)}},ie=(e,t,i,c,l=!1)=>{let u=J(r,e),d=s.array.has(e),f=c?t:QE(t),p=xD(J(a,e),f);if(p||dD(a,e,f),d)g.array.next({name:e,values:c?a:QE(a)}),(m.isDirty||m.dirtyFields||h.isDirty||h.dirtyFields)&&i.shouldDirty&&(S(),l||g.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:te(e,f)}));else{let t=Array.isArray(f)&&!f.length||kD(f);!u||u._f||GE(f)||t?ne(e,f,i,c,l):re(e,f,i,c,l)}if(!p&&!l){let t=ED(e,s),r=c?a:QE(a);g.state.next({...t&&n,name:o.mount||t?e:void 0,values:r})}},ae=(e,t,n={})=>ie(e,t,n,!1),I=(e,t={})=>{let r=uD(e)?e(a):e;if(!xD(a,r)){a={...a,...r};let e=JD(r);for(let n of s.mount)n in e&&ie(n,e[n],t,!0,!0);g.state.next({...n,name:void 0,type:void 0,...u?{values:a}:{}}),t.shouldValidate&&b()}},oe=async i=>{o.mount=!0;let l=i.target,p=l.name,_=!0,y=J(r,p),S=e=>{_=Number.isNaN(e)||WE(e)&&isNaN(e.getTime())||xD(e,J(a,p,e))};if(y){let o,C,w=l.type?dO(y._f):JE(i),T=i.type===$E.BLUR||i.type===$E.FOCUS_OUT,E=!gO(y._f)&&!e.validate&&!t.resolver&&!J(n.errors,p)&&!y._f.deps,D=E||bO(T,J(n.touchedFields,p),n.isSubmitted,f,d),A=ED(p,s,T);if(dD(a,p,w),T){if(!l||!l.readOnly){y._f.onBlur&&y._f.onBlur(i);let e=c[p];e&&e(0)}}else y._f.onChange&&y._f.onChange(i);let N=O(p,w,T),te=!kD(N)||A;if(!T&&g.state.next({name:p,type:i.type,...u?{values:QE(a)}:{}}),D)return(!E||!n.isValid)&&(m.isValid||h.isValid)&&(t.mode===`onBlur`?T&&b():T||b()),te&&g.state.next({name:p,...A?{}:N});if(!t.resolver&&e.validate&&await j({name:p,eventType:i.type}),!T&&A&&g.state.next({...n}),t.resolver){let{errors:e}=await k([p]);if(x([p]),S(w),!_){!kD(N)&&g.state.next(N);return}let t=_O(n.errors,r,p),i=_O(e,r,t.name||p);o=i.error,p=i.name,C=kD(e)}else x([p],!0),o=(await HD(y,s.disabled,a,v,t.shouldUseNativeValidation))[p],x([p]),S(w),_&&(o?C=!1:(m.isValid||h.isValid)&&(C=await M({fields:r,onlyCheckValid:!0,name:p,eventType:i.type})));_&&(y._f.deps&&(!Array.isArray(y._f.deps)||y._f.deps.length>0)&&ce(y._f.deps),ee(p,C,o,N))}},se=(e,t)=>{if(J(n.errors,t)&&e.focus)return e.focus(),1},ce=async(e,i={})=>{let a,o,u=UD(e);if(t.resolver){let t=await A(oD(e)?e:u);a=kD(t),o=e?!u.some(e=>J(t,e)):a}else e?(o=(await Promise.all(u.map(async e=>{let t=J(r,e);return await M({fields:t&&t._f?{[e]:t}:t,eventType:$E.TRIGGER})}))).every(Boolean),!(!o&&!n.isValid)&&b()):o=a=await M({fields:r,name:e,eventType:$E.TRIGGER});if(i.delayError&&t.delayError&&_D(e)){let r=J(n.errors,e);r?(qD(n.errors,e),c[e]=y(e,()=>w(e,r)),c[e](t.delayError)):(clearTimeout(l[e]),delete c[e])}return g.state.next({...!_D(e)||(m.isValid||h.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&DD(r,se,e?u:s.mount),o},le=(e,t)=>{let r={...o.mount?a:i};return t&&(r=$D(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),oD(e)?r:_D(e)?J(r,e):e.map(e=>J(r,e))},ue=(e,t)=>({invalid:!!J((t||n).errors,e),isDirty:!!J((t||n).dirtyFields,e),error:J((t||n).errors,e),isValidating:!!J(n.validatingFields,e),isTouched:!!J((t||n).touchedFields,e)}),de=e=>{let t=e?UD(e):void 0;t?.forEach(e=>qD(n.errors,e)),t?t.forEach(e=>{g.state.next({name:e,errors:n.errors})}):g.state.next({errors:{}})},fe=(e,t,i)=>{let a=(J(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=J(n.errors,e)||{};dD(n.errors,e,{...l,...t,ref:a}),g.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},pe=(e,t)=>{if(uD(e)){u++;let{unsubscribe:n}=g.state.subscribe({next:n=>`values`in n&&e(n.values||P(void 0,t),n)}),r=!1;return{unsubscribe:()=>{r||(r=!0,u--,n())}}}return P(e,t,!0)},me=e=>{let t=!!e.formState?.values;t&&u++;let{unsubscribe:r}=g.state.subscribe({next:t=>{if(yO(e.name,t.name,e.exact)&&vO(t,e.formState||m,Ee,e.reRenderRoot)){let r={...a};e.callback({values:r,...n,...t,defaultValues:i})}}});if(!t)return r;let o=!1;return()=>{o||(o=!0,u--,r())}},he=e=>(o.mount=!0,h={...h,...e.formState},me({...e,formState:{...p,...e.formState}})),ge=(e,o={})=>{for(let c of e?UD(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(qD(r,c),qD(a,c)),!o.keepError&&qD(n.errors,c),!o.keepDirty&&qD(n.dirtyFields,c),!o.keepTouched&&qD(n.touchedFields,c),!o.keepIsValidating&&qD(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&qD(i,c);g.state.next({values:QE(a)}),g.state.next({...n,...o.keepDirty?{isDirty:te()}:{}}),!o.keepIsValid&&b()},_e=({disabled:e,name:t})=>{if(lD(e)&&o.mount||e||s.disabled.has(t)){let n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&b()}},ve=(e,n={})=>{let a=J(r,e),c=lD(n.disabled)||lD(t.disabled),l=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;return dD(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&!l?_e({disabled:lD(n.disabled)?n.disabled:t.disabled,name:e}):D(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:pO(n.min),max:pO(n.max),minLength:pO(n.minLength),maxLength:pO(n.maxLength),pattern:pO(n.pattern)}:{},name:e,onChange:oe,onBlur:oe,ref:c=>{if(c){s.registerName.add(e),ve(e,n),s.registerName.delete(e),a=J(r,e);let t=oD(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=tO(t),l=a._f.refs||[];if(o?l.find(e=>e===t):t===a._f.ref)return;dD(r,e,{_f:{...a._f,...o?{refs:[...l.filter(nO),t,...Array.isArray(J(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),D(e,!1,void 0,t)}else a=J(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(YE(s.array,e)&&o.action)&&s.unMount.add(e)}}},ye=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&DD(r,se,s.mount),be=e=>{lD(e)&&(g.state.next({disabled:e}),DD(r,(t,n)=>{let i=J(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},xe=(e,i)=>async o=>{let c;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=QE(a);if(g.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await k();x(),n.errors=e,l=QE(t)}else await M({fields:r,eventType:$E.SUBMIT});if(s.disabled.size)for(let e of s.disabled)qD(l,e);if(qD(n.errors,nD),kD(n.errors)){g.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),ye(),setTimeout(ye);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:kD(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},Se=(e,t={})=>{J(r,e)&&(oD(t.defaultValue)?ae(e,QE(J(i,e))):(ae(e,t.defaultValue),dD(i,e,QE(t.defaultValue))),t.keepTouched||qD(n.touchedFields,e),t.keepDirty||(qD(n.dirtyFields,e),n.isDirty=t.defaultValue?te(e,QE(J(i,e))):te()),t.keepError||(qD(n.errors,e),m.isValid&&b()),g.state.next({...n}))},Ce=(e,c={})=>{let l=e?QE(e):i,u=QE(l),d=kD(e),f=u,p=r;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(lO(i,a,void 0,p))]);for(let t of Array.from(e)){let e=J(n.dirtyFields,t),r=J(a,t),i=J(f,t);e&&!oD(r)?dD(f,t,r):!e&&!oD(i)&&ae(t,i)}}else{if(ZE&&oD(e))for(let e of s.mount){let t=J(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(jD(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)ae(e,J(f,e));else r={}}if(t.shouldUnregister){if(a=c.keepDefaultValues?QE(i):{},c.keepFieldsRef)for(let e of s.mount)dD(a,e,J(f,e))}else a=QE(f);g.array.next({values:{...f}}),g.state.next({name:void 0,type:void 0,values:{...f}})}s={mount:c.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!m.isValid||!!c.keepIsValid||!!c.keepDirtyValues||!t.shouldUnregister&&!kD(f),o.watch=!!t.shouldUnregister,o.keepIsValid=!!c.keepIsValid,o.action=!1,c.keepErrors||(n.errors={}),g.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:d?!1:c.keepDirty?n.isDirty:c.keepValues?te():!!(c.keepDefaultValues&&!xD(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:d?{}:c.keepDirtyValues?c.keepDefaultValues&&a?lO(i,a,void 0,p):n.dirtyFields:c.keepDefaultValues&&e?lO(i,e,void 0,p):c.keepDirty?n.dirtyFields:{},touchedFields:c.keepTouched?n.touchedFields:{},errors:c.keepErrors?n.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},we=(e,n)=>Ce(uD(e)?e(a):e,{...t.resetOptions,...n}),Te=(e,t={})=>{let n=J(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&uD(e.select)&&e.select()})}},Ee=e=>{let{name:t,type:r,values:i,...a}=e;n={...n,...a}},De={control:{register:ve,unregister:ge,getFieldState:ue,handleSubmit:xe,setError:fe,_subscribe:me,_runSchema:k,_updateIsValidating:x,_focusError:ye,_getWatch:P,_getDirty:te,_setValid:b,_setFieldArray:C,_setDisabledField:_e,_setErrors:T,_getFieldArray:F,_reset:Ce,_resetDefaultValues:()=>uD(t.defaultValues)&&t.defaultValues().then(e=>{we(e,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:N,_disableForm:be,_subjects:g,_proxyFormState:m,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e},d=TD(t.mode),f=TD(t.reValidateMode)}},subscribe:he,trigger:ce,register:ve,handleSubmit:xe,watch:pe,setValue:ae,setValues:I,getValues:le,reset:we,resetField:Se,resetDefaultValues:(e,t={})=>{if(i=QE(e),!t.keepDirty){let e=lO(i,a,void 0,r);n.dirtyFields=e,n.isDirty=!kD(e)}t.keepIsValid||b(),g.state.next({...n,defaultValues:i})},clearErrors:de,unregister:ge,setError:fe,setFocus:Te,getFieldState:ue};return{...De,formControl:De}}function EO(e={}){let t=L.useRef(void 0),n=L.useRef(void 0),r=L.useRef(e.formControl),[i,a]=L.useState(()=>({...QE(wO),isLoading:uD(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:uD(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&r.current!==e.formControl)if(r.current=e.formControl,e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!uD(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...r}=TO(e);t.current={...r,formState:i}}let o=t.current.control;return o._options=e,hD(()=>{let e=o._subscribe({formState:o._proxyFormState,callback:()=>a({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return a(e=>({...e,isReady:!0})),o._formState.isReady=!0,e},[o]),L.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),L.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),L.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),L.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),L.useEffect(()=>{if(o._proxyFormState.isDirty){let e=o._getDirty();e!==i.isDirty&&o._subjects.state.next({isDirty:e})}},[o,i.isDirty]),L.useEffect(()=>{e.values&&!xD(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),o._options.resetOptions?.keepIsValid||o._setValid(),n.current=e.values,a(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),L.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=L.useMemo(()=>mD(i,o),[o,i]),t.current}var DO=(e,t,n)=>{if(e&&`reportValidity`in e){let r=J(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},OO=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?DO(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>DO(t,n,e))}},kO=(e,t)=>{t.shouldUseNativeValidation&&OO(e,t);let n={};for(let r in e){let i=J(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(AO(t.names||Object.keys(e),r)){let e=Object.assign({},J(n,r));dD(e,`root`,a),dD(n,r,e)}else dD(n,r,a)}return n},AO=(e,t)=>{let n=jO(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>jO(e).match(`^${n}\\.\\d+`))};function jO(e){return e.replace(/[\[\]]/g,``)}var MO;function NO(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 PO=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};(MO=globalThis).__zod_globalConfig??(MO.__zod_globalConfig={});var FO=globalThis.__zod_globalConfig;function IO(e){return e&&Object.assign(FO,e),FO}function LO(e,t){return typeof t==`bigint`?t.toString():t}var RO=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};-Number.MAX_VALUE,Number.MAX_VALUE;function zO(e){return typeof e==`string`?e:e?.message}function BO(e,t,n){let r=e.message?e.message:zO(e.inst?._zod.def?.error?.(e))??zO(t?.error?.(e))??zO(n.customError?.(e))??zO(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}var VO=(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,LO,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},HO=NO(`$ZodError`,VO),UO=NO(`$ZodError`,VO,{Parent:Error}),WO=(e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new PO;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>BO(e,a,IO())));throw RO(t,i?.callee),t}return o.value})(UO),GO=(e=>async(t,n,r,i)=>{let a=r?{...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=>BO(e,a,IO())));throw RO(t,i?.callee),t}return o.value})(UO);function KO(){return KO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},KO.apply(null,arguments)}function qO(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function JO(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=PD(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function YO(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(KO({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=PD(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function XO(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve(qO(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&OO({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:kO(JO(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(qO(function(){return Promise.resolve((n.mode===`sync`?WO:GO)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&OO({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof HO}(e))return{values:{},errors:kO(YO(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var ZO;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(ZO||={});var QO;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(QO||={});var Y=ZO.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),$O=e=>{switch(typeof e){case`undefined`:return Y.undefined;case`string`:return Y.string;case`number`:return Number.isNaN(e)?Y.nan:Y.number;case`boolean`:return Y.boolean;case`function`:return Y.function;case`bigint`:return Y.bigint;case`symbol`:return Y.symbol;case`object`:return Array.isArray(e)?Y.array:e===null?Y.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?Y.promise:typeof Map<`u`&&e instanceof Map?Y.map:typeof Set<`u`&&e instanceof Set?Y.set:typeof Date<`u`&&e instanceof Date?Y.date:Y.object;default:return Y.unknown}},X=ZO.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),ek=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);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(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ZO.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t=Object.create(null),n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};ek.create=e=>new ek(e);var tk=(e,t)=>{let n;switch(e.code){case X.invalid_type:n=e.received===Y.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ZO.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:n=`Unrecognized key(s) in object: ${ZO.joinValues(e.keys,`, `)}`;break;case X.invalid_union:n=`Invalid input`;break;case X.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ZO.joinValues(e.options)}`;break;case X.invalid_enum_value:n=`Invalid enum value. Expected ${ZO.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:n=`Invalid function arguments`;break;case X.invalid_return_type:n=`Invalid function return type`;break;case X.invalid_date:n=`Invalid date`;break;case X.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:ZO.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case X.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case X.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case X.custom:n=`Invalid input`;break;case X.invalid_intersection_types:n=`Intersection results could not be merged`;break;case X.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,ZO.assertNever(e)}return{message:n}},nk=tk;function rk(){return nk}var ik=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function Z(e,t){let n=rk(),r=ik({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===tk?void 0:tk].filter(e=>!!e)});e.common.issues.push(r)}var ak=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return Q;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return Q;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},Q=Object.freeze({status:`aborted`}),ok=e=>({status:`dirty`,value:e}),sk=e=>({status:`valid`,value:e}),ck=e=>e.status===`aborted`,lk=e=>e.status===`dirty`,uk=e=>e.status===`valid`,dk=e=>typeof Promise<`u`&&e instanceof Promise,$;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})($||={});var fk=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},pk=(e,t)=>{if(uk(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new ek(e.common.issues);return this._error=t,this._error}}};function mk(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var hk=class{get description(){return this._def.description}_getType(e){return $O(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$O(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ak,ctx:{common:e.parent.common,data:e.data,parsedType:$O(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(dk(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$O(e)};return pk(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$O(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return uk(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>uk(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$O(e)},r=this._parse({data:e,path:n.path,parent:n});return pk(n,await(dk(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:X.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new vA({schema:this,typeName:DA.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return yA.create(this,this._def)}nullable(){return bA.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $k.create(this)}promise(){return _A.create(this,this._def)}or(e){return nA.create([this,e],this._def)}and(e){return oA.create(this,e,this._def)}transform(e){return new vA({...mk(this._def),schema:this,typeName:DA.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new xA({...mk(this._def),innerType:this,defaultValue:t,typeName:DA.ZodDefault})}brand(){return new wA({typeName:DA.ZodBranded,type:this,...mk(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new SA({...mk(this._def),innerType:this,catchValue:t,typeName:DA.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return TA.create(this,e)}readonly(){return EA.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},gk=/^c[^\s-]{8,}$/i,_k=/^[0-9a-z]+$/,vk=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yk=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,bk=/^[a-z0-9_-]{21}$/i,xk=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Sk=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ck=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wk=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Tk,Ek=/^(?:(?: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])$/,Dk=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Ok=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,kk=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ak=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,jk=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Mk=`((\\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])))`,Nk=RegExp(`^${Mk}$`);function Pk(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Fk(e){return RegExp(`^${Pk(e)}$`)}function Ik(e){let t=`${Mk}T${Pk(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function Lk(e,t){return!!((t===`v4`||!t)&&Ek.test(e)||(t===`v6`||!t)&&Ok.test(e))}function Rk(e,t){if(!xk.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function zk(e,t){return!!((t===`v4`||!t)&&Dk.test(e)||(t===`v6`||!t)&&kk.test(e))}var Bk=class e extends hk{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Y.string){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.string,received:t.parsedType}),Q}let t=new ak,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?Z(n,{code:X.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&Z(n,{code:X.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)Ck.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`email`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)Tk||=new RegExp(wk,`u`),Tk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`emoji`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)yk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`uuid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)bk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`nanoid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)gk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`cuid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)_k.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`cuid2`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)vk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`ulid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),Z(n,{validation:`url`,code:X.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`regex`,code:X.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?Ik(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?Nk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?Fk(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?Sk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`duration`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?Lk(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`ip`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?Rk(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`jwt`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?zk(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`cidr`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?Ak.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`base64`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?jk.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`base64url`,code:X.invalid_string,message:r.message}),t.dirty()):ZO.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:X.invalid_string,...$.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...$.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...$.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...$.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...$.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...$.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...$.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...$.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...$.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...$.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...$.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...$.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...$.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...$.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...$.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...$.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...$.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...$.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...$.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...$.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...$.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...$.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...$.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...$.errToObj(t)})}nonempty(e){return this.min(1,$.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Bk.create=e=>new Bk({checks:[],typeName:DA.ZodString,coerce:e?.coerce??!1,...mk(e)});function Vk(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Hk=class e extends hk{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Y.number){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.number,received:t.parsedType}),Q}let t,n=new ak;for(let r of this._def.checks)r.kind===`int`?ZO.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Z(t,{code:X.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Vk(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Z(t,{code:X.not_finite,message:r.message}),n.dirty()):ZO.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,$.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,$.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,$.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,$.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:$.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:$.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:$.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:$.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:$.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:$.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:$.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:$.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:$.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:$.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&ZO.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Hk.create=e=>new Hk({checks:[],typeName:DA.ZodNumber,coerce:e?.coerce||!1,...mk(e)});var Uk=class e extends hk{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Y.bigint)return this._getInvalidInput(e);let t,n=new ak;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):ZO.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.bigint,received:t.parsedType}),Q}gte(e,t){return this.setLimit(`min`,e,!0,$.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,$.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,$.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,$.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:$.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:$.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:$.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:$.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:$.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:$.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Uk.create=e=>new Uk({checks:[],typeName:DA.ZodBigInt,coerce:e?.coerce??!1,...mk(e)});var Wk=class extends hk{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Y.boolean){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.boolean,received:t.parsedType}),Q}return sk(e.data)}};Wk.create=e=>new Wk({typeName:DA.ZodBoolean,coerce:e?.coerce||!1,...mk(e)});var Gk=class e extends hk{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Y.date){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.date,received:t.parsedType}),Q}if(Number.isNaN(e.data.getTime()))return Z(this._getOrReturnCtx(e),{code:X.invalid_date}),Q;let t=new ak,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):ZO.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:$.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:$.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};Gk.create=e=>new Gk({checks:[],coerce:e?.coerce||!1,typeName:DA.ZodDate,...mk(e)});var Kk=class extends hk{_parse(e){if(this._getType(e)!==Y.symbol){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.symbol,received:t.parsedType}),Q}return sk(e.data)}};Kk.create=e=>new Kk({typeName:DA.ZodSymbol,...mk(e)});var qk=class extends hk{_parse(e){if(this._getType(e)!==Y.undefined){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.undefined,received:t.parsedType}),Q}return sk(e.data)}};qk.create=e=>new qk({typeName:DA.ZodUndefined,...mk(e)});var Jk=class extends hk{_parse(e){if(this._getType(e)!==Y.null){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.null,received:t.parsedType}),Q}return sk(e.data)}};Jk.create=e=>new Jk({typeName:DA.ZodNull,...mk(e)});var Yk=class extends hk{constructor(){super(...arguments),this._any=!0}_parse(e){return sk(e.data)}};Yk.create=e=>new Yk({typeName:DA.ZodAny,...mk(e)});var Xk=class extends hk{constructor(){super(...arguments),this._unknown=!0}_parse(e){return sk(e.data)}};Xk.create=e=>new Xk({typeName:DA.ZodUnknown,...mk(e)});var Zk=class extends hk{_parse(e){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.never,received:t.parsedType}),Q}};Zk.create=e=>new Zk({typeName:DA.ZodNever,...mk(e)});var Qk=class extends hk{_parse(e){if(this._getType(e)!==Y.undefined){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.void,received:t.parsedType}),Q}return sk(e.data)}};Qk.create=e=>new Qk({typeName:DA.ZodVoid,...mk(e)});var $k=class e extends hk{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Y.array)return Z(t,{code:X.invalid_type,expected:Y.array,received:t.parsedType}),Q;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(Z(t,{code:e?X.too_big:X.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(Z(t,{code:X.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(Z(t,{code:X.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new fk(t,e,t.path,n)))).then(e=>ak.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new fk(t,e,t.path,n)));return ak.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:$.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:$.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:$.toString(n)}})}nonempty(e){return this.min(1,e)}};$k.create=(e,t)=>new $k({type:e,minLength:null,maxLength:null,exactLength:null,typeName:DA.ZodArray,...mk(t)});function eA(e){if(e instanceof tA){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=yA.create(eA(r))}return new tA({...e._def,shape:()=>t})}else if(e instanceof $k)return new $k({...e._def,type:eA(e.element)});else if(e instanceof yA)return yA.create(eA(e.unwrap()));else if(e instanceof bA)return bA.create(eA(e.unwrap()));else if(e instanceof sA)return sA.create(e.items.map(e=>eA(e)));else return e}var tA=class e extends hk{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=ZO.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Y.object){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.object,received:t.parsedType}),Q}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Zk&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new fk(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Zk){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(Z(n,{code:X.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new fk(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>ak.mergeObjectSync(t,e)):ak.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return $.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:$.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:DA.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of ZO.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of ZO.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return eA(this)}partial(t){let n={};for(let e of ZO.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of ZO.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof yA;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return mA(ZO.objectKeys(this.shape))}};tA.create=(e,t)=>new tA({shape:()=>e,unknownKeys:`strip`,catchall:Zk.create(),typeName:DA.ZodObject,...mk(t)}),tA.strictCreate=(e,t)=>new tA({shape:()=>e,unknownKeys:`strict`,catchall:Zk.create(),typeName:DA.ZodObject,...mk(t)}),tA.lazycreate=(e,t)=>new tA({shape:e,unknownKeys:`strip`,catchall:Zk.create(),typeName:DA.ZodObject,...mk(t)});var nA=class extends hk{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new ek(e.ctx.common.issues));return Z(t,{code:X.invalid_union,unionErrors:n}),Q}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new ek(e));return Z(t,{code:X.invalid_union,unionErrors:i}),Q}}get options(){return this._def.options}};nA.create=(e,t)=>new nA({options:e,typeName:DA.ZodUnion,...mk(t)});var rA=e=>e instanceof fA?rA(e.schema):e instanceof vA?rA(e.innerType()):e instanceof pA?[e.value]:e instanceof hA?e.options:e instanceof gA?ZO.objectValues(e.enum):e instanceof xA?rA(e._def.innerType):e instanceof qk?[void 0]:e instanceof Jk?[null]:e instanceof yA?[void 0,...rA(e.unwrap())]:e instanceof bA?[null,...rA(e.unwrap())]:e instanceof wA||e instanceof EA?rA(e.unwrap()):e instanceof SA?rA(e._def.innerType):[],iA=class e extends hk{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Y.object)return Z(t,{code:X.invalid_type,expected:Y.object,received:t.parsedType}),Q;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Z(t,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=rA(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:DA.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...mk(r)})}};function aA(e,t){let n=$O(e),r=$O(t);if(e===t)return{valid:!0,data:e};if(n===Y.object&&r===Y.object){let n=ZO.objectKeys(t),r=ZO.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=aA(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===Y.array&&r===Y.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=aA(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===Y.date&&r===Y.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var oA=class extends hk{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(ck(e)||ck(r))return Q;let i=aA(e.value,r.value);return i.valid?((lk(e)||lk(r))&&t.dirty(),{status:t.value,value:i.data}):(Z(n,{code:X.invalid_intersection_types}),Q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};oA.create=(e,t,n)=>new oA({left:e,right:t,typeName:DA.ZodIntersection,...mk(n)});var sA=class e extends hk{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.array)return Z(n,{code:X.invalid_type,expected:Y.array,received:n.parsedType}),Q;if(n.data.length<this._def.items.length)return Z(n,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),Q;!this._def.rest&&n.data.length>this._def.items.length&&(Z(n,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new fk(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>ak.mergeArray(t,e)):ak.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};sA.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new sA({items:e,typeName:DA.ZodTuple,rest:null,...mk(t)})};var cA=class e extends hk{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.object)return Z(n,{code:X.invalid_type,expected:Y.object,received:n.parsedType}),Q;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new fk(n,e,n.path,e)),value:a._parse(new fk(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?ak.mergeObjectAsync(t,r):ak.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof hk?new e({keyType:t,valueType:n,typeName:DA.ZodRecord,...mk(r)}):new e({keyType:Bk.create(),valueType:t,typeName:DA.ZodRecord,...mk(n)})}},lA=class extends hk{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.map)return Z(n,{code:X.invalid_type,expected:Y.map,received:n.parsedType}),Q;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new fk(n,e,n.path,[a,`key`])),value:i._parse(new fk(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return Q;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return Q;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};lA.create=(e,t,n)=>new lA({valueType:t,keyType:e,typeName:DA.ZodMap,...mk(n)});var uA=class e extends hk{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.set)return Z(n,{code:X.invalid_type,expected:Y.set,received:n.parsedType}),Q;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(Z(n,{code:X.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(Z(n,{code:X.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return Q;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new fk(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:$.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:$.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};uA.create=(e,t)=>new uA({valueType:e,minSize:null,maxSize:null,typeName:DA.ZodSet,...mk(t)});var dA=class e extends hk{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Y.function)return Z(t,{code:X.invalid_type,expected:Y.function,received:t.parsedType}),Q;function n(e,n){return ik({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,rk(),tk].filter(e=>!!e),issueData:{code:X.invalid_arguments,argumentsError:n}})}function r(e,n){return ik({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,rk(),tk].filter(e=>!!e),issueData:{code:X.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof _A){let e=this;return sk(async function(...t){let o=new ek([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return sk(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new ek([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new ek([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:sA.create(t).rest(Xk.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||sA.create([]).rest(Xk.create()),returns:n||Xk.create(),typeName:DA.ZodFunction,...mk(r)})}},fA=class extends hk{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};fA.create=(e,t)=>new fA({getter:e,typeName:DA.ZodLazy,...mk(t)});var pA=class extends hk{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Z(t,{received:t.data,code:X.invalid_literal,expected:this._def.value}),Q}return{status:`valid`,value:e.data}}get value(){return this._def.value}};pA.create=(e,t)=>new pA({value:e,typeName:DA.ZodLiteral,...mk(t)});function mA(e,t){return new hA({values:e,typeName:DA.ZodEnum,...mk(t)})}var hA=class e extends hk{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return Z(t,{expected:ZO.joinValues(n),received:t.parsedType,code:X.invalid_type}),Q}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Z(t,{received:t.data,code:X.invalid_enum_value,options:n}),Q}return sk(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};hA.create=mA;var gA=class extends hk{_parse(e){let t=ZO.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Y.string&&n.parsedType!==Y.number){let e=ZO.objectValues(t);return Z(n,{expected:ZO.joinValues(e),received:n.parsedType,code:X.invalid_type}),Q}if(this._cache||=new Set(ZO.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=ZO.objectValues(t);return Z(n,{received:n.data,code:X.invalid_enum_value,options:e}),Q}return sk(e.data)}get enum(){return this._def.values}};gA.create=(e,t)=>new gA({values:e,typeName:DA.ZodNativeEnum,...mk(t)});var _A=class extends hk{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==Y.promise&&t.common.async===!1?(Z(t,{code:X.invalid_type,expected:Y.promise,received:t.parsedType}),Q):sk((t.parsedType===Y.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};_A.create=(e,t)=>new _A({type:e,typeName:DA.ZodPromise,...mk(t)});var vA=class extends hk{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===DA.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{Z(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return Q;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?Q:r.status===`dirty`||t.value===`dirty`?ok(r.value):r});{if(t.value===`aborted`)return Q;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?Q:r.status===`dirty`||t.value===`dirty`?ok(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?Q:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?Q:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!uk(e))return Q;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>uk(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):Q);ZO.assertNever(r)}};vA.create=(e,t,n)=>new vA({schema:e,typeName:DA.ZodEffects,effect:t,...mk(n)}),vA.createWithPreprocess=(e,t,n)=>new vA({schema:t,effect:{type:`preprocess`,transform:e},typeName:DA.ZodEffects,...mk(n)});var yA=class extends hk{_parse(e){return this._getType(e)===Y.undefined?sk(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yA.create=(e,t)=>new yA({innerType:e,typeName:DA.ZodOptional,...mk(t)});var bA=class extends hk{_parse(e){return this._getType(e)===Y.null?sk(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};bA.create=(e,t)=>new bA({innerType:e,typeName:DA.ZodNullable,...mk(t)});var xA=class extends hk{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===Y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};xA.create=(e,t)=>new xA({innerType:e,typeName:DA.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...mk(t)});var SA=class extends hk{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return dk(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new ek(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new ek(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};SA.create=(e,t)=>new SA({innerType:e,typeName:DA.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...mk(t)});var CA=class extends hk{_parse(e){if(this._getType(e)!==Y.nan){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.nan,received:t.parsedType}),Q}return{status:`valid`,value:e.data}}};CA.create=e=>new CA({typeName:DA.ZodNaN,...mk(e)});var wA=class extends hk{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},TA=class e extends hk{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Q:e.status===`dirty`?(t.dirty(),ok(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Q:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:DA.ZodPipeline})}},EA=class extends hk{_parse(e){let t=this._def.innerType._parse(e),n=e=>(uk(e)&&(e.value=Object.freeze(e.value)),e);return dk(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};EA.create=(e,t)=>new EA({innerType:e,typeName:DA.ZodReadonly,...mk(t)}),tA.lazycreate;var DA;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(DA||={});var OA=Bk.create;Hk.create,CA.create,Uk.create,Wk.create,Gk.create,Kk.create,qk.create,Jk.create,Yk.create,Xk.create,Zk.create,Qk.create,$k.create;var kA=tA.create;tA.strictCreate,nA.create,iA.create,oA.create,sA.create,cA.create,lA.create,uA.create,dA.create,fA.create,pA.create,hA.create,gA.create,_A.create,vA.create,yA.create,bA.create,vA.createWithPreprocess,TA.create;var AA=8e3,jA=`https://github.com/Jinn-Network/mono/blob/main/docs/runbooks/rotating-harness-keys.md`;function MA(e){return e===`loaded`?`default`:e===`missing`?`destructive`:`secondary`}function NA(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString()}function PA(e){return e.sourceKind===`file`?e.sourcePath??`—`:e.sourceKind===`env`?`env: ${e.envKey??``}`:e.sourceKind===`session`?`CLI session`:`no auth required`}function FA(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)(null);return(0,L.useEffect)(()=>{let e=!1,n=async()=>{try{let n=await B.harnessAuthStatus();e||(t(n.harnesses),r(null))}catch(t){e||r(t instanceof Error?t.message:String(t))}};n();let i=setInterval(()=>{n()},AA);return()=>{e=!0,clearInterval(i)}},[]),(0,R.jsxs)(G,{"data-testid":`harness-auth-status-card`,children:[(0,R.jsxs)(zi,{children:[(0,R.jsx)(Bi,{children:`Harness auth status`}),(0,R.jsx)(Vi,{children:`Where each harness reads its credential, the masked key suffix, and when it last changed. Read-only — rotate keys via the linked runbook. Full keys are never shown.`})]}),(0,R.jsx)(Hi,{children:n?(0,R.jsxs)(`p`,{className:`text-sm text-[var(--break-red)]`,children:[`Auth status unavailable: `,n]}):e===null?(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):e.length===0?(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No harnesses registered.`}):(0,R.jsxs)($h,{children:[(0,R.jsx)(eg,{children:(0,R.jsxs)(rg,{children:[(0,R.jsx)(ig,{children:`Harness`}),(0,R.jsx)(ig,{children:`Auth source`}),(0,R.jsx)(ig,{children:`Key suffix`}),(0,R.jsx)(ig,{children:`Last modified`}),(0,R.jsx)(ig,{children:`State`})]})}),(0,R.jsx)(tg,{children:e.map(e=>(0,R.jsxs)(rg,{children:[(0,R.jsx)(ag,{children:e.docAnchor?(0,R.jsx)(`a`,{href:`${jA}#${e.docAnchor}`,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:e.harnessName}):(0,R.jsx)(`span`,{children:e.harnessName})}),(0,R.jsx)(ag,{className:`font-mono text-xs`,children:PA(e)}),(0,R.jsx)(ag,{className:`font-mono text-xs`,children:e.keySuffix?`…${e.keySuffix}`:`—`}),(0,R.jsx)(ag,{className:`font-mono text-xs`,children:NA(e.lastModified)}),(0,R.jsx)(ag,{children:(0,R.jsx)(q,{variant:MA(e.state),children:e.state})})]},e.harnessName))})]})})]})}var IA=ZD,LA=L.createContext({}),RA=e=>(0,R.jsx)(LA.Provider,{value:{name:e.name},children:(0,R.jsx)(wD,{...e})}),zA=L.createContext({}),BA=()=>{let e=L.useContext(LA),t=L.useContext(zA),{getFieldState:n,formState:r}=XD(),i=n(e.name,r);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...i}},VA=L.forwardRef(({className:e,...t},n)=>{let r=L.useId();return(0,R.jsx)(zA.Provider,{value:{id:r},children:(0,R.jsx)(`div`,{ref:n,className:U(`flex flex-col gap-1.5`,e),...t})})});VA.displayName=`FormItem`;var HA=L.forwardRef(({className:e,...t},n)=>{let{error:r,formItemId:i}=BA();return(0,R.jsx)(Kf,{ref:n,className:U(r&&`text-[var(--break-red)]`,e),htmlFor:i,...t})});HA.displayName=`FormLabel`;var UA=L.forwardRef(({...e},t)=>{let{error:n,formItemId:r,formDescriptionId:i,formMessageId:a}=BA();return(0,R.jsx)(Jn,{ref:t,id:r,"aria-describedby":n?`${i} ${a}`:i,"aria-invalid":!!n,...e})});UA.displayName=`FormControl`;var WA=L.forwardRef(({className:e,...t},n)=>{let{formDescriptionId:r}=BA();return(0,R.jsx)(`p`,{ref:n,id:r,className:U(`font-mono text-[11px] text-[var(--fg-dim)]`,e),...t})});WA.displayName=`FormDescription`;var GA=L.forwardRef(({className:e,children:t,...n},r)=>{let{error:i,formMessageId:a}=BA(),o=i?String(i?.message??``):t;return o?(0,R.jsx)(`p`,{ref:r,id:a,className:U(`font-mono text-[11px] text-[var(--break-red)]`,e),...n,children:o}):null});GA.displayName=`FormMessage`;var KA=kA({current:OA().min(1,`Current password is required.`),next:OA().min(8,`New password must be at least 8 characters.`)});function qA(){let[e,t]=(0,L.useState)(`idle`),n=EO({resolver:XO(KA),defaultValues:{current:``,next:``}}),r=async e=>{t(`rotating`);try{await B.changeKeystorePassword(e.current,e.next),n.reset({current:``,next:``}),mh.success(`Password rotated`,{description:"Re-run `jinn run` with the new password."})}catch(e){mh.error(`Rotation failed`,{description:e instanceof Error?e.message:String(e)})}finally{t(`idle`)}};return(0,R.jsxs)(`div`,{"data-testid":`security-tab`,className:`flex flex-col gap-6`,children:[(0,R.jsxs)(G,{className:`border-[var(--severity-blocking-border)]`,children:[(0,R.jsxs)(zi,{className:`flex flex-row items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsxs)(Bi,{className:`flex items-center gap-2 text-[var(--break-red)]`,children:[(0,R.jsx)(Bn,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),`Security`]}),(0,R.jsx)(Vi,{children:`Rotate keystore password · last rotated never`})]}),(0,R.jsx)(q,{variant:`destructive`,children:`Danger zone`})]}),(0,R.jsx)(Hi,{children:(0,R.jsx)(IA,{...n,children:(0,R.jsxs)(`form`,{onSubmit:n.handleSubmit(r),className:`flex flex-col gap-4`,"data-testid":`security-password-form`,children:[(0,R.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,R.jsx)(RA,{control:n.control,name:`current`,render:({field:e})=>(0,R.jsxs)(VA,{children:[(0,R.jsx)(HA,{children:`Current password`}),(0,R.jsx)(UA,{children:(0,R.jsx)(s_,{type:`password`,autoComplete:`current-password`,...e})}),(0,R.jsx)(GA,{})]})}),(0,R.jsx)(RA,{control:n.control,name:`next`,render:({field:e})=>(0,R.jsxs)(VA,{children:[(0,R.jsx)(HA,{children:`New password`}),(0,R.jsx)(UA,{children:(0,R.jsx)(s_,{type:`password`,autoComplete:`new-password`,...e})}),(0,R.jsx)(WA,{children:`At least 8 characters.`}),(0,R.jsx)(GA,{})]})})]}),(0,R.jsxs)(W,{type:`submit`,variant:`destructive`,disabled:e===`rotating`||!n.formState.isValid,className:`self-start`,children:[(0,R.jsx)(jn,{className:`h-3 w-3`,"aria-hidden":`true`}),e===`rotating`?`Rotating…`:`Rotate password`]})]})})})]}),(0,R.jsx)(FA,{})]})}function JA(e){let t=[],n=e.split(`
94
94
  `),r=0;for(;r<n.length;){let e=n[r]??``;if(/^```/.test(e)){let i=e.slice(3).trim(),a=[];for(r++;r<n.length&&!/^```/.test(n[r]??``);)a.push(n[r]??``),r++;r++,t.push({kind:`code`,lang:i,text:a.join(`
95
- `)});continue}let i=/^(#{1,3})\s+(.*)$/.exec(e);if(i){t.push({kind:`heading`,level:i[1].length,text:i[2]}),r++;continue}if(/^-\s+/.test(e)){let e=[];for(;r<n.length&&/^-\s+/.test(n[r]??``);)e.push((n[r]??``).replace(/^-\s+/,``)),r++;t.push({kind:`list`,items:e});continue}if(e.trim()===``){r++;continue}let a=[e];for(r++;r<n.length&&(n[r]??``).trim()!==``&&!/^(#{1,3}\s|```|-\s)/.test(n[r]??``);)a.push(n[r]??``),r++;t.push({kind:`paragraph`,text:a.join(` `)})}return t}function JA(e){let t=[],n=/`([^`]+)`/g,r=0,i,a=0;for(;(i=n.exec(e))!==null;)i.index>r&&t.push(e.slice(r,i.index)),t.push((0,L.createElement)(`code`,{key:`c-${a++}`},i[1])),r=i.index+i[0].length;return r<e.length&&t.push(e.slice(r)),t}function YA(e){return(0,L.createElement)(L.Fragment,null,...qA(e).map((e,t)=>e.kind===`heading`?e.level===1?(0,L.createElement)(`h1`,{key:t},e.text):e.level===2?(0,L.createElement)(`h2`,{key:t},e.text):(0,L.createElement)(`h3`,{key:t},e.text):e.kind===`code`?(0,L.createElement)(`pre`,{key:t},(0,L.createElement)(`code`,null,e.text??``)):e.kind===`list`?(0,L.createElement)(`ul`,{key:t},...(e.items??[]).map((e,t)=>(0,L.createElement)(`li`,{key:t},...JA(e)))):(0,L.createElement)(`p`,{key:t},...JA(e.text??``))))}var XA='# Build a plug-in\n\nShip a Jinn SolverPlugin in 60 seconds. Targets the SWE-rebench v2 SolverNet running against the Hermes harness on testnet.\n\n## 1. Scaffold\n\n```bash\njinn create plugin @you/my-swe-skill --pattern solver-type-plugin --solver-type swe-rebench-v2.v1\ncd @you/my-swe-skill\nyarn install\nyarn test\n```\n\nThe scaffolder emits a working package modeled on `swe-rebench-v2-runtime`:\n\n```\n@you/my-swe-skill/\n├── jinn.plugin.json # the canonical manifest\n├── skills/example/SKILL.md\n├── test/plugin.test.ts # passes immediately\n├── package.json\n├── tsconfig.json\n└── README.md\n```\n\n## 2. Edit your skill\n\nOpen `skills/example/SKILL.md` and replace it with the skill your plug-in offers. A SolverType plug-in can ship one or more skills; a runtime plug-in usually ships an MCP server in `.mcp.json` instead. See `shape-reference.md`.\n\n## 3. Publish to IPFS + chain\n\nPoint `publish` straight at your local plugin directory:\n\n```bash\njinn solver-plugins publish .\n```\n\nA bare path resolves as a `local` source. The verb packs that directory, pins the tarball to IPFS itself, and writes the on-chain record — no npm round-trip. A public `npm publish --access public` is **optional**, not required: Jinn anchors its own tarball to IPFS and chain regardless of source.\n\nAlready on npm? Point at it instead:\n\n```bash\njinn solver-plugins publish npm:@you/my-swe-skill\n```\n\n`jinn solver-plugins publish` lazily completes your identity bootstrap (Stage 1) the first time you call it. If you have not yet funded your agent EOA with ETH on testnet, the verb pauses and tells you what to send where. Re-run when the wallet is funded.\n\nThe verb packs the plug-in, uploads the tarball to IPFS, and writes a `plugin:<cid>` record on the on-chain IdentityRegistry under your builder agentId.\n\n> `publish .` expects a plugin **directory** (the resolver has no `.tgz`-extraction path). Add npm support by publishing there and pointing at `npm:<name>`; true `.tgz` publish would need resolver extraction and is out of scope.\n\n## 4. Confirm it published\n\nOpen the operator app\'s `/build` route. Under "Published plug-ins for SWE-rebench v2" you should see your plug-in. Under "Your published plug-ins" you should see the same record.\n\n## 5. Run it\n\nAn operator who has joined the SWE-rebench v2 SolverNet can install your plug-in:\n\n```bash\njinn solver-plugins show npm:@you/my-swe-skill\njinn solver-nets add-plugin swe-rebench-v2 npm:@you/my-swe-skill\n```\n\nThe next task they claim runs against your plug-in. The signed envelope\'s `executor.plugins[]` carries your CID; the network explorer attributes the score to your builder agentId.\n\n## Next\n\n- `shape-reference.md` — the full `jinn.plugin.json` shape, the two modes, skills + MCP conventions.\n- `examples.md` — annotated reference plug-ins.\n- `publishing-flow.md` — what `jinn solver-plugins publish` does, step by step.\n- `identity.md` — staged identity bootstrap; why publishing does not require operator-grade funding.\n- `compatibility.md` — `jinn.supports` semantics, harness compatibility.\n',ZA=`https://github.com/Jinn-Network/mono/blob/next/client/docs/build/quickstart.md`,QA=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`;function $A(){return(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(zi,{className:`mb-2 p-0`,children:(0,R.jsx)(`span`,{className:QA,children:`Quickstart · 60 seconds`})}),(0,R.jsxs)(Hi,{className:`p-0`,children:[(0,R.jsx)(`div`,{className:`hfmf-intro-markdown`,children:YA(XA)}),(0,R.jsx)(kh,{className:`my-5`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsx)(`span`,{className:QA,children:`Next`}),(0,R.jsx)(`a`,{href:ZA,target:`_blank`,rel:`noreferrer`,className:`border-b border-border pb-px font-mono text-[12px] text-primary no-underline hover:text-[var(--accent-sky-hover)]`,children:`Read the full quickstart on GitHub →`})]})]})]})}var ej=[{name:`name`,type:`string`,required:!0,description:`npm package name. Used as the canonical identifier across the registry.`},{name:`version`,type:`string`,required:!0,description:`Semantic version. New versions publish under a new IPFS CID.`},{name:`description`,type:`string`,required:!1,description:`Short prose description of what the plug-in offers.`},{name:`jinn.supports`,type:`string[]`,required:!0,description:`Either ["jinn.runtime"] (runtime plug-in) OR one or more SolverType identifiers (solver-type plug-in). Mixing is rejected.`},{name:`jinn.capabilities`,type:`object`,required:!1,description:`Optional capabilities map. Reserved for future use; not consumed by Hermes today.`},{name:`jinn.mcpServers`,type:`object`,required:!1,description:`Optional inline MCP server map. The Hermes harness reads .mcp.json instead; declare MCP there for harness-agnostic portability.`},{name:`jinn.skills`,type:`string[]`,required:!1,description:`Relative paths to SKILL.md files. Each declared skill becomes available to the harness as an external skill directory.`}],tj=[{id:`runtime`,label:`Runtime plug-in`,requires:`singleton — supports must be exactly ["jinn.runtime"]`,example:`{ "jinn": { "supports": ["jinn.runtime"] } }`},{id:`solver-type`,label:`SolverType plug-in`,requires:`one or more SolverType ids; cannot include "jinn.runtime"`,example:`{ "jinn": { "supports": ["swe-rebench-v2.v1"] } }`}],nj=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`;function rj(){return(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsxs)(zi,{className:`mb-5 flex flex-col gap-1 p-0`,children:[(0,R.jsx)(`span`,{className:nj,children:`Reference`}),(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[28px] leading-[1.2] text-foreground`,children:`Plug-in shape`})]}),(0,R.jsxs)(Hi,{className:`p-0`,children:[(0,R.jsxs)(Qh,{children:[(0,R.jsx)($h,{children:(0,R.jsxs)(ng,{children:[(0,R.jsx)(rg,{children:`Field`}),(0,R.jsx)(rg,{children:`Type`}),(0,R.jsx)(rg,{children:`Required`}),(0,R.jsx)(rg,{children:`Description`})]})}),(0,R.jsx)(eg,{children:ej.map(e=>(0,R.jsxs)(ng,{"data-field-required":e.required?`true`:`false`,children:[(0,R.jsx)(ig,{className:`font-mono text-[13px] text-primary`,children:e.name}),(0,R.jsx)(ig,{className:`font-mono text-[13px] text-muted-foreground`,children:e.type}),(0,R.jsx)(ig,{children:(0,R.jsx)(q,{variant:e.required?`default`:`outline`,children:e.required?`yes`:`no`})}),(0,R.jsx)(ig,{className:`font-mono text-[13px] text-muted-foreground`,children:e.description})]},e.name))})]}),(0,R.jsx)(kh,{className:`my-8`}),(0,R.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1`,children:[(0,R.jsx)(`span`,{className:nj,children:`Modes`}),(0,R.jsx)(`h3`,{className:`m-0 font-serif text-[22px] leading-[1.25] text-foreground`,children:`Two modes`}),(0,R.jsx)(`p`,{className:`m-0 mt-1 max-w-[72ch] font-mono text-[13px] leading-[1.7] text-muted-foreground`,children:`The validator enforces exactly two exclusive modes. Mixing is rejected.`})]}),(0,R.jsx)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2`,children:tj.map((e,t)=>(0,R.jsxs)(G,{className:`flex flex-col gap-2.5 bg-[var(--bg-sunken)] p-4`,children:[(0,R.jsx)(`span`,{className:nj,children:t===0?`Mode · 01`:`Mode · 02`}),(0,R.jsx)(`h4`,{className:`m-0 font-mono text-[15px] font-medium tracking-[-0.01em] text-foreground`,children:e.label}),(0,R.jsx)(`p`,{className:`m-0 font-mono text-[12px] leading-[1.6] text-muted-foreground`,children:e.requires}),(0,R.jsx)(`pre`,{className:`m-0 overflow-x-auto rounded-sm border border-border bg-background px-3 py-2.5 font-mono text-[12px] leading-[1.5] text-primary`,children:(0,R.jsx)(`code`,{children:e.example})})]},e.id))})]})]})}var ij=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`;function aj(e){return e.length>14?`${e.slice(0,8)}…${e.slice(-4)}`:e}function oj({solverType:e}){return(0,R.jsxs)(zi,{className:`mb-5 flex flex-col gap-1 p-0`,children:[(0,R.jsx)(`span`,{className:ij,children:`Registry`}),(0,R.jsxs)(`h3`,{className:`m-0 font-serif text-[22px] leading-[1.25] text-foreground`,children:[`Published plug-ins for `,e]})]})}function sj({solverType:e}){let{data:t,isLoading:n,error:r}=ut({queryKey:[`discovery`,`plugin-publications`,e],queryFn:()=>B.discovery.listPluginPublications({solverType:e}),refetchInterval:3e4});if(n)return(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(oj,{solverType:e}),(0,R.jsxs)(Hi,{className:`flex flex-col gap-2 p-0`,children:[(0,R.jsx)(ld,{className:`h-4 w-full`}),(0,R.jsx)(ld,{className:`h-4 w-5/6`}),(0,R.jsx)(ld,{className:`h-4 w-4/6`})]})]});if(r)return(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(oj,{solverType:e}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsx)(fo,{variant:`blocking`,children:(0,R.jsxs)(mo,{children:[`Discovery unavailable. `,r.message]})})})]});let i=t?.publications??[];return i.length===0?(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(oj,{solverType:e}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-dashed border-border bg-[var(--bg-sunken)] p-6`,children:[(0,R.jsx)(`span`,{className:ij,children:`Empty registry`}),(0,R.jsx)(`p`,{className:`m-0 max-w-[64ch] font-mono text-[13px] leading-[1.7] text-foreground`,children:`No plug-ins published yet. Be the first.`}),(0,R.jsxs)(`p`,{className:`m-0 max-w-[64ch] font-mono text-[13px] leading-[1.7] text-muted-foreground`,children:[`Run`,` `,(0,R.jsx)(`code`,{className:`rounded-sm border border-border bg-background px-1.5 py-px font-mono text-[12px] text-primary`,children:`jinn solver-plugins publish`}),` `,`and your plug-in appears here under your builder agentId.`]})]})})]}):(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(oj,{solverType:e}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsxs)(Qh,{children:[(0,R.jsx)($h,{children:(0,R.jsxs)(ng,{children:[(0,R.jsx)(rg,{children:`Plug-in`}),(0,R.jsx)(rg,{children:`Version`}),(0,R.jsx)(rg,{children:`Builder agentId`}),(0,R.jsx)(rg,{children:`CID`}),(0,R.jsx)(rg,{children:`Status`})]})}),(0,R.jsx)(eg,{children:i.map(e=>(0,R.jsxs)(ng,{children:[(0,R.jsx)(ig,{className:`font-mono text-[12px] text-foreground`,children:e.name}),(0,R.jsx)(ig,{className:`font-mono text-[12px] text-muted-foreground`,children:e.version}),(0,R.jsx)(ig,{className:`font-mono text-[12px] text-muted-foreground`,children:e.builderAgentId}),(0,R.jsx)(ig,{className:`font-mono text-[12px] text-muted-foreground`,children:aj(e.cid)}),(0,R.jsx)(ig,{children:e.revoked?(0,R.jsxs)(q,{variant:`outline`,className:`rounded-full border-[var(--wane)] text-[var(--wane)]`,children:[`Revoked`,e.revokedReason?` · ${e.revokedReason}`:``]}):(0,R.jsx)(q,{variant:`success`,className:`rounded-full`,children:`Active`})})]},`${e.builderAgentId}:${e.cid}`))})]})})]})}var cj=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,lj=`rounded-sm border border-border bg-background px-1.5 py-px font-mono text-[12px] text-primary`;function uj(){return(0,R.jsxs)(zi,{className:`mb-5 flex flex-col gap-1 p-0`,children:[(0,R.jsx)(`span`,{className:cj,children:`Builder`}),(0,R.jsx)(`h3`,{className:`m-0 font-serif text-[22px] leading-[1.25] text-foreground`,children:`Your published plug-ins`})]})}function dj({fleetAgentId:e}){let t=!!e,{data:n,isLoading:r,error:i}=ut({queryKey:[`discovery`,`builder-artifacts`,e],queryFn:()=>B.discovery.listBuilderArtifacts(e),enabled:t,refetchInterval:3e4});if(!t)return(0,R.jsxs)(G,{className:`bg-[var(--bg-sunken)] p-6`,children:[(0,R.jsx)(uj,{}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-dashed border-border p-6`,children:[(0,R.jsx)(`span`,{className:cj,children:`Identity pending`}),(0,R.jsxs)(`p`,{className:`m-0 max-w-[64ch] font-mono text-[13px] leading-[1.7] text-muted-foreground`,children:[`Complete identity bootstrap to see your published plug-ins. Run`,` `,(0,R.jsx)(`code`,{className:lj,children:`jinn solver-plugins publish`}),` on a plug-in and the lazy stage-ensure will provision your builder identity (Stage 1).`]})]})})]});if(r)return(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(uj,{}),(0,R.jsxs)(Hi,{className:`flex flex-col gap-2 p-0`,children:[(0,R.jsx)(ld,{className:`h-4 w-full`}),(0,R.jsx)(ld,{className:`h-4 w-5/6`}),(0,R.jsx)(ld,{className:`h-4 w-4/6`})]})]});if(i)return(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(uj,{}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsx)(fo,{variant:`blocking`,children:(0,R.jsx)(mo,{children:`Discovery unavailable.`})})})]});let a=(n?.artifacts??[]).filter(e=>e.artifactType===`plugin`);return a.length===0?(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(uj,{}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-dashed border-border bg-[var(--bg-sunken)] p-6`,children:[(0,R.jsx)(`span`,{className:cj,children:`Nothing yet`}),(0,R.jsxs)(`p`,{className:`m-0 max-w-[64ch] font-mono text-[13px] leading-[1.7] text-muted-foreground`,children:[`You have not published any plug-ins yet. Scaffold one with`,` `,(0,R.jsx)(`code`,{className:lj,children:`jinn create plugin`}),`, then publish with `,(0,R.jsx)(`code`,{className:lj,children:`jinn solver-plugins publish`}),`. It will appear here under your builder agentId.`]})]})})]}):(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(uj,{}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsxs)(Qh,{children:[(0,R.jsx)($h,{children:(0,R.jsxs)(ng,{children:[(0,R.jsx)(rg,{children:`Plug-in`}),(0,R.jsx)(rg,{children:`Version`}),(0,R.jsx)(rg,{children:`Supports`}),(0,R.jsx)(rg,{children:`Status`})]})}),(0,R.jsx)(eg,{children:a.map(e=>(0,R.jsxs)(ng,{children:[(0,R.jsx)(ig,{className:`font-mono text-[12px] text-foreground`,children:e.name}),(0,R.jsx)(ig,{className:`font-mono text-[12px] text-muted-foreground`,children:e.version}),(0,R.jsx)(ig,{className:`font-mono text-[12px] text-muted-foreground`,children:e.supports.join(`, `)}),(0,R.jsx)(ig,{children:e.revoked?(0,R.jsx)(q,{variant:`outline`,className:`rounded-full border-[var(--wane)] text-[var(--wane)]`,children:`Revoked`}):(0,R.jsx)(q,{variant:`success`,className:`rounded-full`,children:`Active`})})]},`${e.builderAgentId}:${e.cid}`))})]})})]})}function fj({value:e,onChange:t}){let n=e===`plugin`;return(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(W,{type:`button`,variant:n?`outline`:`ghost`,size:`sm`,"aria-pressed":n?`true`:`false`,className:`rounded-full`,onClick:()=>{n||t(`plugin`)},children:`Plug-ins`}),(0,R.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,disabled:!0,"aria-pressed":`false`,className:`rounded-full opacity-60`,children:[`Harnesses`,(0,R.jsx)(`span`,{className:`ml-1 border-l border-border pl-2 text-[9px] tracking-[0.14em] text-[var(--fg-dim)]`,children:`Coming soon`})]})]})}var pj=`swe-rebench-v2.v1`;function mj(){let{data:e}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap(),refetchInterval:5e3}),[t,n]=(0,L.useState)(`plugin`);return(0,R.jsxs)(`div`,{className:`mx-auto flex max-w-[1100px] flex-col gap-6 px-6 pb-12 pt-8`,children:[(0,R.jsxs)(`header`,{className:`flex flex-col gap-2 pb-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--accent-gold)]`,children:`Build · Plug-ins`}),(0,R.jsx)(`p`,{className:`m-0 max-w-[64ch] font-mono text-[14px] leading-[1.7] text-muted-foreground`,children:`Scaffold a SolverPlugin, publish it to npm and IPFS, watch it appear in the registry under your builder identity. Anchored on the SWE-rebench v2 SolverNet for v0.`})]}),(0,R.jsx)($A,{}),(0,R.jsx)(rj,{}),(0,R.jsx)(kh,{}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Registry`}),(0,R.jsx)(fj,{value:t,onChange:n})]}),t===`plugin`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(sj,{solverType:pj}),(0,R.jsx)(dj,{fleetAgentId:e?.fleet_agent_id})]}):null]})}function hj(){return(0,R.jsx)(lp,{notices:Sp().filter(e=>e.kind===`rpc_unreachable`)})}var gj=({...e})=>(0,R.jsx)(Oh,{theme:`dark`,className:`toaster group`,toastOptions:{classNames:{toast:`group toast group-[.toaster]:bg-card group-[.toaster]:text-card-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg font-mono text-[12px]`,description:`group-[.toast]:text-[var(--fg-muted)]`,actionButton:`group-[.toast]:bg-[var(--accent-sky)] group-[.toast]:text-[var(--bg-sunken)] font-mono text-[10px] uppercase tracking-[0.14em]`,cancelButton:`group-[.toast]:bg-transparent group-[.toast]:text-[var(--fg-muted)] font-mono text-[10px] uppercase tracking-[0.14em]`}},...e});function _j(){let{data:e,isLoading:t}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap(),refetchInterval:1500}),n=sn(),[r,i]=(0,L.useState)(!1),a={restartPending:r,setRestartPending:i};if(n.status===`disconnected`&&!e)return(0,R.jsxs)($u,{delayDuration:150,children:[(0,R.jsx)(ap,{connection:n}),(0,R.jsx)(gj,{})]});let o=e?.onboardingComplete===!0;if(e&&(e.mode!==`running`||!o))return(0,R.jsxs)($u,{delayDuration:150,children:[(0,R.jsx)(hj,{}),(0,R.jsx)(np,{}),(0,R.jsx)(gj,{})]});if(t||!e)return(0,R.jsxs)($u,{delayDuration:150,children:[(0,R.jsx)(co,{headline:`Starting jinn`}),(0,R.jsx)(gj,{})]});let s=e.chain===`base`?`mainnet`:`testnet`,{pluginBuilderUi:c,embeddedAgent:l}=Zo();return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(up.Provider,{value:a,children:[(0,R.jsx)(Yt,{children:(0,R.jsx)(Cp,{header:(0,R.jsx)(Ym,{network:s}),tabs:(0,R.jsx)(Zm,{}),rail:l?(0,R.jsx)(Qm,{}):void 0,children:(0,R.jsxs)(tn,{children:[(0,R.jsx)(Qt,{path:`/events/:id`,children:(0,R.jsx)(Kg,{})}),(0,R.jsx)(Qt,{path:`/events`,children:(0,R.jsx)(Hg,{})}),(0,R.jsx)(Qt,{path:`/overview`,component:jg}),(0,R.jsx)(Qt,{path:`/operator/join/:cid`,children:(0,R.jsx)(yC,{})}),(0,R.jsx)(Qt,{path:`/operator/execution-data`,children:(0,R.jsx)(hE,{children:(0,R.jsx)(yw,{})})}),(0,R.jsx)(Qt,{path:`/operator/memberships`,children:(0,R.jsx)(hE,{children:(0,R.jsx)(SE,{onRestartPending:()=>i(!0)})})}),(0,R.jsx)(Qt,{path:`/operator/registry`,children:(0,R.jsx)(hE,{children:(0,R.jsx)(PE,{})})}),(0,R.jsx)(Qt,{path:`/operator/network`,children:(0,R.jsx)(hE,{children:(0,R.jsx)(FE,{onRestartPending:()=>i(!0)})})}),(0,R.jsx)(Qt,{path:`/operator/security`,children:(0,R.jsx)(hE,{children:(0,R.jsx)(KA,{})})}),(0,R.jsx)(Qt,{path:`/operator`,children:(0,R.jsx)(nn,{to:`/operator/memberships`})}),(0,R.jsx)(Qt,{path:`/captures`,children:(0,R.jsx)(nn,{to:`/operator/execution-data`})}),(0,R.jsx)(Qt,{path:`/configuration`,children:(0,R.jsx)(vj,{})}),(0,R.jsx)(Qt,{path:`/launcher/create`,children:(0,R.jsx)(rv,{})}),(0,R.jsx)(Qt,{path:`/launcher/launched/:solverNetId`,children:(0,R.jsx)(Qx,{})}),(0,R.jsx)(Qt,{path:`/launcher`,children:(0,R.jsx)(a_,{})}),(0,R.jsx)(Qt,{path:`/build`,children:c?(0,R.jsx)(mj,{}):(0,R.jsx)(nn,{to:`/overview`})}),(0,R.jsx)(Qt,{children:(0,R.jsx)(nn,{to:`/overview`})})]})})}),(0,R.jsx)(gj,{})]})})}function vj(){return(0,R.jsx)(nn,{to:`/operator${typeof window>`u`?``:window.location.hash}`})}var yj=new Ge({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:1e3}}});an().finally(()=>{pt.createRoot(document.getElementById(`root`)).render((0,R.jsx)(L.StrictMode,{children:(0,R.jsx)(Xe,{client:yj,children:(0,R.jsx)(_j,{})})}))});
95
+ `)});continue}let i=/^(#{1,3})\s+(.*)$/.exec(e);if(i){t.push({kind:`heading`,level:i[1].length,text:i[2]}),r++;continue}if(/^-\s+/.test(e)){let e=[];for(;r<n.length&&/^-\s+/.test(n[r]??``);)e.push((n[r]??``).replace(/^-\s+/,``)),r++;t.push({kind:`list`,items:e});continue}if(e.trim()===``){r++;continue}let a=[e];for(r++;r<n.length&&(n[r]??``).trim()!==``&&!/^(#{1,3}\s|```|-\s)/.test(n[r]??``);)a.push(n[r]??``),r++;t.push({kind:`paragraph`,text:a.join(` `)})}return t}function YA(e){let t=[],n=/`([^`]+)`/g,r=0,i,a=0;for(;(i=n.exec(e))!==null;)i.index>r&&t.push(e.slice(r,i.index)),t.push((0,L.createElement)(`code`,{key:`c-${a++}`},i[1])),r=i.index+i[0].length;return r<e.length&&t.push(e.slice(r)),t}function XA(e){return(0,L.createElement)(L.Fragment,null,...JA(e).map((e,t)=>e.kind===`heading`?e.level===1?(0,L.createElement)(`h1`,{key:t},e.text):e.level===2?(0,L.createElement)(`h2`,{key:t},e.text):(0,L.createElement)(`h3`,{key:t},e.text):e.kind===`code`?(0,L.createElement)(`pre`,{key:t},(0,L.createElement)(`code`,null,e.text??``)):e.kind===`list`?(0,L.createElement)(`ul`,{key:t},...(e.items??[]).map((e,t)=>(0,L.createElement)(`li`,{key:t},...YA(e)))):(0,L.createElement)(`p`,{key:t},...YA(e.text??``))))}var ZA='# Build a plug-in\n\nShip a Jinn SolverPlugin in 60 seconds. Targets the SWE-rebench v2 SolverNet running against the Hermes harness on testnet.\n\n## 1. Scaffold\n\n```bash\njinn create plugin @you/my-swe-skill --pattern solver-type-plugin --solver-type swe-rebench-v2.v1\ncd @you/my-swe-skill\nyarn install\nyarn test\n```\n\nThe scaffolder emits a working package modeled on `swe-rebench-v2-runtime`:\n\n```\n@you/my-swe-skill/\n├── jinn.plugin.json # the canonical manifest\n├── skills/example/SKILL.md\n├── test/plugin.test.ts # passes immediately\n├── package.json\n├── tsconfig.json\n└── README.md\n```\n\n## 2. Edit your skill\n\nOpen `skills/example/SKILL.md` and replace it with the skill your plug-in offers. A SolverType plug-in can ship one or more skills; a runtime plug-in usually ships an MCP server in `.mcp.json` instead. See `shape-reference.md`.\n\n## 3. Publish to IPFS + chain\n\nPoint `publish` straight at your local plugin directory:\n\n```bash\njinn solver-plugins publish .\n```\n\nA bare path resolves as a `local` source. The verb packs that directory, pins the tarball to IPFS itself, and writes the on-chain record — no npm round-trip. A public `npm publish --access public` is **optional**, not required: Jinn anchors its own tarball to IPFS and chain regardless of source.\n\nAlready on npm? Point at it instead:\n\n```bash\njinn solver-plugins publish npm:@you/my-swe-skill\n```\n\n`jinn solver-plugins publish` lazily completes your identity bootstrap (Stage 1) the first time you call it. If you have not yet funded your agent EOA with ETH on testnet, the verb pauses and tells you what to send where. Re-run when the wallet is funded.\n\nThe verb packs the plug-in, uploads the tarball to IPFS, and writes a `plugin:<cid>` record on the on-chain IdentityRegistry under your builder agentId.\n\n> `publish .` expects a plugin **directory** (the resolver has no `.tgz`-extraction path). Add npm support by publishing there and pointing at `npm:<name>`; true `.tgz` publish would need resolver extraction and is out of scope.\n\n## 4. Confirm it published\n\nOpen the operator app\'s `/build` route. Under "Published plug-ins for SWE-rebench v2" you should see your plug-in. Under "Your published plug-ins" you should see the same record.\n\n## 5. Run it\n\nAn operator who has joined the SWE-rebench v2 SolverNet can install your plug-in:\n\n```bash\njinn solver-plugins show npm:@you/my-swe-skill\njinn solver-nets add-plugin swe-rebench-v2 npm:@you/my-swe-skill\n```\n\nThe next task they claim runs against your plug-in. The signed envelope\'s `executor.plugins[]` carries your CID; the network explorer attributes the score to your builder agentId.\n\n## Next\n\n- `shape-reference.md` — the full `jinn.plugin.json` shape, the two modes, skills + MCP conventions.\n- `examples.md` — annotated reference plug-ins.\n- `publishing-flow.md` — what `jinn solver-plugins publish` does, step by step.\n- `identity.md` — staged identity bootstrap; why publishing does not require operator-grade funding.\n- `compatibility.md` — `jinn.supports` semantics, harness compatibility.\n',QA=`https://github.com/Jinn-Network/mono/blob/next/client/docs/build/quickstart.md`,$A=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`;function ej(){return(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(zi,{className:`mb-2 p-0`,children:(0,R.jsx)(`span`,{className:$A,children:`Quickstart · 60 seconds`})}),(0,R.jsxs)(Hi,{className:`p-0`,children:[(0,R.jsx)(`div`,{className:`hfmf-intro-markdown`,children:XA(ZA)}),(0,R.jsx)(Ah,{className:`my-5`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsx)(`span`,{className:$A,children:`Next`}),(0,R.jsx)(`a`,{href:QA,target:`_blank`,rel:`noreferrer`,className:`border-b border-border pb-px font-mono text-[12px] text-primary no-underline hover:text-[var(--accent-sky-hover)]`,children:`Read the full quickstart on GitHub →`})]})]})]})}var tj=[{name:`name`,type:`string`,required:!0,description:`npm package name. Used as the canonical identifier across the registry.`},{name:`version`,type:`string`,required:!0,description:`Semantic version. New versions publish under a new IPFS CID.`},{name:`description`,type:`string`,required:!1,description:`Short prose description of what the plug-in offers.`},{name:`jinn.supports`,type:`string[]`,required:!0,description:`Either ["jinn.runtime"] (runtime plug-in) OR one or more SolverType identifiers (solver-type plug-in). Mixing is rejected.`},{name:`jinn.capabilities`,type:`object`,required:!1,description:`Optional capabilities map. Reserved for future use; not consumed by Hermes today.`},{name:`jinn.mcpServers`,type:`object`,required:!1,description:`Optional inline MCP server map. The Hermes harness reads .mcp.json instead; declare MCP there for harness-agnostic portability.`},{name:`jinn.skills`,type:`string[]`,required:!1,description:`Relative paths to SKILL.md files. Each declared skill becomes available to the harness as an external skill directory.`}],nj=[{id:`runtime`,label:`Runtime plug-in`,requires:`singleton — supports must be exactly ["jinn.runtime"]`,example:`{ "jinn": { "supports": ["jinn.runtime"] } }`},{id:`solver-type`,label:`SolverType plug-in`,requires:`one or more SolverType ids; cannot include "jinn.runtime"`,example:`{ "jinn": { "supports": ["swe-rebench-v2.v1"] } }`}],rj=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`;function ij(){return(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsxs)(zi,{className:`mb-5 flex flex-col gap-1 p-0`,children:[(0,R.jsx)(`span`,{className:rj,children:`Reference`}),(0,R.jsx)(`h2`,{className:`m-0 font-serif text-[28px] leading-[1.2] text-foreground`,children:`Plug-in shape`})]}),(0,R.jsxs)(Hi,{className:`p-0`,children:[(0,R.jsxs)($h,{children:[(0,R.jsx)(eg,{children:(0,R.jsxs)(rg,{children:[(0,R.jsx)(ig,{children:`Field`}),(0,R.jsx)(ig,{children:`Type`}),(0,R.jsx)(ig,{children:`Required`}),(0,R.jsx)(ig,{children:`Description`})]})}),(0,R.jsx)(tg,{children:tj.map(e=>(0,R.jsxs)(rg,{"data-field-required":e.required?`true`:`false`,children:[(0,R.jsx)(ag,{className:`font-mono text-[13px] text-primary`,children:e.name}),(0,R.jsx)(ag,{className:`font-mono text-[13px] text-muted-foreground`,children:e.type}),(0,R.jsx)(ag,{children:(0,R.jsx)(q,{variant:e.required?`default`:`outline`,children:e.required?`yes`:`no`})}),(0,R.jsx)(ag,{className:`font-mono text-[13px] text-muted-foreground`,children:e.description})]},e.name))})]}),(0,R.jsx)(Ah,{className:`my-8`}),(0,R.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1`,children:[(0,R.jsx)(`span`,{className:rj,children:`Modes`}),(0,R.jsx)(`h3`,{className:`m-0 font-serif text-[22px] leading-[1.25] text-foreground`,children:`Two modes`}),(0,R.jsx)(`p`,{className:`m-0 mt-1 max-w-[72ch] font-mono text-[13px] leading-[1.7] text-muted-foreground`,children:`The validator enforces exactly two exclusive modes. Mixing is rejected.`})]}),(0,R.jsx)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2`,children:nj.map((e,t)=>(0,R.jsxs)(G,{className:`flex flex-col gap-2.5 bg-[var(--bg-sunken)] p-4`,children:[(0,R.jsx)(`span`,{className:rj,children:t===0?`Mode · 01`:`Mode · 02`}),(0,R.jsx)(`h4`,{className:`m-0 font-mono text-[15px] font-medium tracking-[-0.01em] text-foreground`,children:e.label}),(0,R.jsx)(`p`,{className:`m-0 font-mono text-[12px] leading-[1.6] text-muted-foreground`,children:e.requires}),(0,R.jsx)(`pre`,{className:`m-0 overflow-x-auto rounded-sm border border-border bg-background px-3 py-2.5 font-mono text-[12px] leading-[1.5] text-primary`,children:(0,R.jsx)(`code`,{children:e.example})})]},e.id))})]})]})}var aj=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`;function oj(e){return e.length>14?`${e.slice(0,8)}…${e.slice(-4)}`:e}function sj({solverType:e}){return(0,R.jsxs)(zi,{className:`mb-5 flex flex-col gap-1 p-0`,children:[(0,R.jsx)(`span`,{className:aj,children:`Registry`}),(0,R.jsxs)(`h3`,{className:`m-0 font-serif text-[22px] leading-[1.25] text-foreground`,children:[`Published plug-ins for `,e]})]})}function cj({solverType:e}){let{data:t,isLoading:n,error:r}=ut({queryKey:[`discovery`,`plugin-publications`,e],queryFn:()=>B.discovery.listPluginPublications({solverType:e}),refetchInterval:3e4});if(n)return(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(sj,{solverType:e}),(0,R.jsxs)(Hi,{className:`flex flex-col gap-2 p-0`,children:[(0,R.jsx)(ld,{className:`h-4 w-full`}),(0,R.jsx)(ld,{className:`h-4 w-5/6`}),(0,R.jsx)(ld,{className:`h-4 w-4/6`})]})]});if(r)return(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(sj,{solverType:e}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsx)(fo,{variant:`blocking`,children:(0,R.jsxs)(mo,{children:[`Discovery unavailable. `,r.message]})})})]});let i=t?.publications??[];return i.length===0?(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(sj,{solverType:e}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-dashed border-border bg-[var(--bg-sunken)] p-6`,children:[(0,R.jsx)(`span`,{className:aj,children:`Empty registry`}),(0,R.jsx)(`p`,{className:`m-0 max-w-[64ch] font-mono text-[13px] leading-[1.7] text-foreground`,children:`No plug-ins published yet. Be the first.`}),(0,R.jsxs)(`p`,{className:`m-0 max-w-[64ch] font-mono text-[13px] leading-[1.7] text-muted-foreground`,children:[`Run`,` `,(0,R.jsx)(`code`,{className:`rounded-sm border border-border bg-background px-1.5 py-px font-mono text-[12px] text-primary`,children:`jinn solver-plugins publish`}),` `,`and your plug-in appears here under your builder agentId.`]})]})})]}):(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(sj,{solverType:e}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsxs)($h,{children:[(0,R.jsx)(eg,{children:(0,R.jsxs)(rg,{children:[(0,R.jsx)(ig,{children:`Plug-in`}),(0,R.jsx)(ig,{children:`Version`}),(0,R.jsx)(ig,{children:`Builder agentId`}),(0,R.jsx)(ig,{children:`CID`}),(0,R.jsx)(ig,{children:`Status`})]})}),(0,R.jsx)(tg,{children:i.map(e=>(0,R.jsxs)(rg,{children:[(0,R.jsx)(ag,{className:`font-mono text-[12px] text-foreground`,children:e.name}),(0,R.jsx)(ag,{className:`font-mono text-[12px] text-muted-foreground`,children:e.version}),(0,R.jsx)(ag,{className:`font-mono text-[12px] text-muted-foreground`,children:e.builderAgentId}),(0,R.jsx)(ag,{className:`font-mono text-[12px] text-muted-foreground`,children:oj(e.cid)}),(0,R.jsx)(ag,{children:e.revoked?(0,R.jsxs)(q,{variant:`outline`,className:`rounded-full border-[var(--wane)] text-[var(--wane)]`,children:[`Revoked`,e.revokedReason?` · ${e.revokedReason}`:``]}):(0,R.jsx)(q,{variant:`success`,className:`rounded-full`,children:`Active`})})]},`${e.builderAgentId}:${e.cid}`))})]})})]})}var lj=`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,uj=`rounded-sm border border-border bg-background px-1.5 py-px font-mono text-[12px] text-primary`;function dj(){return(0,R.jsxs)(zi,{className:`mb-5 flex flex-col gap-1 p-0`,children:[(0,R.jsx)(`span`,{className:lj,children:`Builder`}),(0,R.jsx)(`h3`,{className:`m-0 font-serif text-[22px] leading-[1.25] text-foreground`,children:`Your published plug-ins`})]})}function fj({fleetAgentId:e}){let t=!!e,{data:n,isLoading:r,error:i}=ut({queryKey:[`discovery`,`builder-artifacts`,e],queryFn:()=>B.discovery.listBuilderArtifacts(e),enabled:t,refetchInterval:3e4});if(!t)return(0,R.jsxs)(G,{className:`bg-[var(--bg-sunken)] p-6`,children:[(0,R.jsx)(dj,{}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-dashed border-border p-6`,children:[(0,R.jsx)(`span`,{className:lj,children:`Identity pending`}),(0,R.jsxs)(`p`,{className:`m-0 max-w-[64ch] font-mono text-[13px] leading-[1.7] text-muted-foreground`,children:[`Complete identity bootstrap to see your published plug-ins. Run`,` `,(0,R.jsx)(`code`,{className:uj,children:`jinn solver-plugins publish`}),` on a plug-in and the lazy stage-ensure will provision your builder identity (Stage 1).`]})]})})]});if(r)return(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(dj,{}),(0,R.jsxs)(Hi,{className:`flex flex-col gap-2 p-0`,children:[(0,R.jsx)(ld,{className:`h-4 w-full`}),(0,R.jsx)(ld,{className:`h-4 w-5/6`}),(0,R.jsx)(ld,{className:`h-4 w-4/6`})]})]});if(i)return(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(dj,{}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsx)(fo,{variant:`blocking`,children:(0,R.jsx)(mo,{children:`Discovery unavailable.`})})})]});let a=(n?.artifacts??[]).filter(e=>e.artifactType===`plugin`);return a.length===0?(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(dj,{}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-dashed border-border bg-[var(--bg-sunken)] p-6`,children:[(0,R.jsx)(`span`,{className:lj,children:`Nothing yet`}),(0,R.jsxs)(`p`,{className:`m-0 max-w-[64ch] font-mono text-[13px] leading-[1.7] text-muted-foreground`,children:[`You have not published any plug-ins yet. Scaffold one with`,` `,(0,R.jsx)(`code`,{className:uj,children:`jinn create plugin`}),`, then publish with `,(0,R.jsx)(`code`,{className:uj,children:`jinn solver-plugins publish`}),`. It will appear here under your builder agentId.`]})]})})]}):(0,R.jsxs)(G,{className:`p-6`,children:[(0,R.jsx)(dj,{}),(0,R.jsx)(Hi,{className:`p-0`,children:(0,R.jsxs)($h,{children:[(0,R.jsx)(eg,{children:(0,R.jsxs)(rg,{children:[(0,R.jsx)(ig,{children:`Plug-in`}),(0,R.jsx)(ig,{children:`Version`}),(0,R.jsx)(ig,{children:`Supports`}),(0,R.jsx)(ig,{children:`Status`})]})}),(0,R.jsx)(tg,{children:a.map(e=>(0,R.jsxs)(rg,{children:[(0,R.jsx)(ag,{className:`font-mono text-[12px] text-foreground`,children:e.name}),(0,R.jsx)(ag,{className:`font-mono text-[12px] text-muted-foreground`,children:e.version}),(0,R.jsx)(ag,{className:`font-mono text-[12px] text-muted-foreground`,children:e.supports.join(`, `)}),(0,R.jsx)(ag,{children:e.revoked?(0,R.jsx)(q,{variant:`outline`,className:`rounded-full border-[var(--wane)] text-[var(--wane)]`,children:`Revoked`}):(0,R.jsx)(q,{variant:`success`,className:`rounded-full`,children:`Active`})})]},`${e.builderAgentId}:${e.cid}`))})]})})]})}function pj({value:e,onChange:t}){let n=e===`plugin`;return(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(W,{type:`button`,variant:n?`outline`:`ghost`,size:`sm`,"aria-pressed":n?`true`:`false`,className:`rounded-full`,onClick:()=>{n||t(`plugin`)},children:`Plug-ins`}),(0,R.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,disabled:!0,"aria-pressed":`false`,className:`rounded-full opacity-60`,children:[`Harnesses`,(0,R.jsx)(`span`,{className:`ml-1 border-l border-border pl-2 text-[9px] tracking-[0.14em] text-[var(--fg-dim)]`,children:`Coming soon`})]})]})}var mj=`swe-rebench-v2.v1`;function hj(){let{data:e}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap(),refetchInterval:5e3}),[t,n]=(0,L.useState)(`plugin`);return(0,R.jsxs)(`div`,{className:`mx-auto flex max-w-[1100px] flex-col gap-6 px-6 pb-12 pt-8`,children:[(0,R.jsxs)(`header`,{className:`flex flex-col gap-2 pb-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--accent-gold)]`,children:`Build · Plug-ins`}),(0,R.jsx)(`p`,{className:`m-0 max-w-[64ch] font-mono text-[14px] leading-[1.7] text-muted-foreground`,children:`Scaffold a SolverPlugin, publish it to npm and IPFS, watch it appear in the registry under your builder identity. Anchored on the SWE-rebench v2 SolverNet for v0.`})]}),(0,R.jsx)(ej,{}),(0,R.jsx)(ij,{}),(0,R.jsx)(Ah,{}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--fg-dim)]`,children:`Registry`}),(0,R.jsx)(pj,{value:t,onChange:n})]}),t===`plugin`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(cj,{solverType:mj}),(0,R.jsx)(fj,{fleetAgentId:e?.fleet_agent_id})]}):null]})}function gj(){return(0,R.jsx)(up,{notices:Cp().filter(e=>e.kind===`rpc_unreachable`)})}var _j=({...e})=>(0,R.jsx)(kh,{theme:`dark`,className:`toaster group`,toastOptions:{classNames:{toast:`group toast group-[.toaster]:bg-card group-[.toaster]:text-card-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg font-mono text-[12px]`,description:`group-[.toast]:text-[var(--fg-muted)]`,actionButton:`group-[.toast]:bg-[var(--accent-sky)] group-[.toast]:text-[var(--bg-sunken)] font-mono text-[10px] uppercase tracking-[0.14em]`,cancelButton:`group-[.toast]:bg-transparent group-[.toast]:text-[var(--fg-muted)] font-mono text-[10px] uppercase tracking-[0.14em]`}},...e});function vj(){let{data:e,isLoading:t}=ut({queryKey:[`bootstrap`],queryFn:()=>B.getBootstrap(),refetchInterval:1500}),n=sn(),[r,i]=(0,L.useState)(!1),a={restartPending:r,setRestartPending:i};if(n.status===`disconnected`&&!e)return(0,R.jsxs)($u,{delayDuration:150,children:[(0,R.jsx)(op,{connection:n}),(0,R.jsx)(_j,{})]});let o=e?.onboardingComplete===!0;if(e&&(e.mode!==`running`||!o))return(0,R.jsxs)($u,{delayDuration:150,children:[(0,R.jsx)(gj,{}),(0,R.jsx)(rp,{}),(0,R.jsx)(_j,{})]});if(t||!e)return(0,R.jsxs)($u,{delayDuration:150,children:[(0,R.jsx)(co,{headline:`Starting jinn`}),(0,R.jsx)(_j,{})]});let s=e.chain===`base`?`mainnet`:`testnet`,{pluginBuilderUi:c,embeddedAgent:l}=Zo();return(0,R.jsx)($u,{delayDuration:150,children:(0,R.jsxs)(dp.Provider,{value:a,children:[(0,R.jsx)(Yt,{children:(0,R.jsx)(wp,{header:(0,R.jsx)(Xm,{network:s}),tabs:(0,R.jsx)(Qm,{}),rail:l?(0,R.jsx)($m,{}):void 0,children:(0,R.jsxs)(tn,{children:[(0,R.jsx)(Qt,{path:`/events/:id`,children:(0,R.jsx)(qg,{})}),(0,R.jsx)(Qt,{path:`/events`,children:(0,R.jsx)(Ug,{})}),(0,R.jsx)(Qt,{path:`/overview`,component:Mg}),(0,R.jsx)(Qt,{path:`/operator/join/:cid`,children:(0,R.jsx)(bC,{})}),(0,R.jsx)(Qt,{path:`/operator/execution-data`,children:(0,R.jsx)(gE,{children:(0,R.jsx)(bw,{})})}),(0,R.jsx)(Qt,{path:`/operator/memberships`,children:(0,R.jsx)(gE,{children:(0,R.jsx)(CE,{onRestartPending:()=>i(!0)})})}),(0,R.jsx)(Qt,{path:`/operator/registry`,children:(0,R.jsx)(gE,{children:(0,R.jsx)(FE,{})})}),(0,R.jsx)(Qt,{path:`/operator/network`,children:(0,R.jsx)(gE,{children:(0,R.jsx)(IE,{onRestartPending:()=>i(!0)})})}),(0,R.jsx)(Qt,{path:`/operator/security`,children:(0,R.jsx)(gE,{children:(0,R.jsx)(qA,{})})}),(0,R.jsx)(Qt,{path:`/operator`,children:(0,R.jsx)(nn,{to:`/operator/memberships`})}),(0,R.jsx)(Qt,{path:`/captures`,children:(0,R.jsx)(nn,{to:`/operator/execution-data`})}),(0,R.jsx)(Qt,{path:`/configuration`,children:(0,R.jsx)(yj,{})}),(0,R.jsx)(Qt,{path:`/launcher/create`,children:(0,R.jsx)(iv,{})}),(0,R.jsx)(Qt,{path:`/launcher/launched/:solverNetId`,children:(0,R.jsx)($x,{})}),(0,R.jsx)(Qt,{path:`/launcher`,children:(0,R.jsx)(o_,{})}),(0,R.jsx)(Qt,{path:`/build`,children:c?(0,R.jsx)(hj,{}):(0,R.jsx)(nn,{to:`/overview`})}),(0,R.jsx)(Qt,{children:(0,R.jsx)(nn,{to:`/overview`})})]})})}),(0,R.jsx)(_j,{})]})})}function yj(){return(0,R.jsx)(nn,{to:`/operator${typeof window>`u`?``:window.location.hash}`})}var bj=new Ge({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:1e3}}});an().finally(()=>{pt.createRoot(document.getElementById(`root`)).render((0,R.jsx)(L.StrictMode,{children:(0,R.jsx)(Xe,{client:bj,children:(0,R.jsx)(vj,{})})}))});