@coro-ai/runner 0.1.27 → 0.1.30

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.
Files changed (79) hide show
  1. package/dashboard-dist/assets/{index-CbvmOLWN.js → index--JceWwKS.js} +10 -10
  2. package/dashboard-dist/assets/index-V3YMhXZt.css +2 -0
  3. package/dashboard-dist/index.html +2 -2
  4. package/dist/src/jobs/dispatcher.d.ts +10 -1
  5. package/dist/src/jobs/dispatcher.js +55 -12
  6. package/dist/src/jobs/dispatcher.js.map +1 -1
  7. package/dist/src/prompt/builder.js +21 -1
  8. package/dist/src/prompt/builder.js.map +1 -1
  9. package/dist/src/tools/campaign.js +15 -6
  10. package/dist/src/tools/campaign.js.map +1 -1
  11. package/node_modules/@coro-ai/cloud-protocol/package.json +1 -1
  12. package/node_modules/@coro-ai/intelligence-base/layer/agents/campaign-evaluator.md +16 -2
  13. package/node_modules/@coro-ai/intelligence-base/layer/agents/campaign-integrator.md +57 -16
  14. package/node_modules/@coro-ai/intelligence-base/layer/agents/campaign-planner.md +18 -0
  15. package/node_modules/@coro-ai/intelligence-base/layer/agents/pr-reviewer.md +2 -0
  16. package/node_modules/@coro-ai/intelligence-base/layer/workflows/campaign/workflow.md +38 -13
  17. package/node_modules/@coro-ai/intelligence-base/package.json +1 -1
  18. package/node_modules/@coro-ai/llm-anthropic/dist/executor.d.ts +11 -0
  19. package/node_modules/@coro-ai/llm-anthropic/dist/executor.d.ts.map +1 -1
  20. package/node_modules/@coro-ai/llm-anthropic/dist/executor.js +29 -3
  21. package/node_modules/@coro-ai/llm-anthropic/dist/executor.js.map +1 -1
  22. package/node_modules/@coro-ai/llm-anthropic/dist/steering-errors.d.ts.map +1 -1
  23. package/node_modules/@coro-ai/llm-anthropic/dist/steering-errors.js +10 -2
  24. package/node_modules/@coro-ai/llm-anthropic/dist/steering-errors.js.map +1 -1
  25. package/node_modules/@coro-ai/llm-anthropic/package.json +1 -1
  26. package/node_modules/@coro-ai/llm-openai/package.json +1 -1
  27. package/node_modules/@coro-ai/plugin-sdk/package.json +1 -1
  28. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/README.md +16 -1
  29. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/index.js +4 -20
  30. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/read.js +17 -17
  31. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/types/json.js +60 -32
  32. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/types/raw.js +3 -3
  33. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/types/text.js +3 -3
  34. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/types/urlencoded.js +16 -20
  35. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/utils.js +18 -16
  36. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/LICENSE +22 -0
  37. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/README.md +69 -0
  38. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +26 -0
  39. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/dist/index.js +170 -0
  40. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -0
  41. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/package.json +52 -0
  42. package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/package.json +23 -10
  43. package/node_modules/better-sqlite3/deps/download.sh +1 -1
  44. package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.c +692 -176
  45. package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.h +17 -5
  46. package/node_modules/better-sqlite3/package.json +1 -1
  47. package/node_modules/better-sqlite3/src/better_sqlite3.cpp +1 -1
  48. package/node_modules/better-sqlite3/src/util/helpers.cpp +1 -1
  49. package/node_modules/better-sqlite3/src/util/macros.cpp +8 -1
  50. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +5 -3
  51. package/node_modules/hono/dist/adapter/lambda-edge/handler.js +8 -2
  52. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +5 -3
  53. package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +8 -2
  54. package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +1 -1
  55. package/node_modules/hono/dist/cjs/middleware/cors/index.js +2 -5
  56. package/node_modules/hono/dist/cjs/middleware/language/language.js +10 -32
  57. package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +1 -1
  58. package/node_modules/hono/dist/cjs/middleware/timing/timing.js +3 -1
  59. package/node_modules/hono/dist/cjs/utils/ipaddr.js +6 -1
  60. package/node_modules/hono/dist/middleware/bearer-auth/index.js +1 -1
  61. package/node_modules/hono/dist/middleware/cors/index.js +2 -5
  62. package/node_modules/hono/dist/middleware/language/language.js +10 -32
  63. package/node_modules/hono/dist/middleware/serve-static/index.js +1 -1
  64. package/node_modules/hono/dist/middleware/timing/timing.js +3 -1
  65. package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +1 -1
  66. package/node_modules/hono/dist/types/adapter/aws-lambda/handler.d.ts +1 -1
  67. package/node_modules/hono/dist/utils/ipaddr.js +6 -1
  68. package/node_modules/hono/package.json +18 -10
  69. package/node_modules/semver/classes/range.js +11 -2
  70. package/node_modules/semver/package.json +2 -2
  71. package/node_modules/side-channel/CHANGELOG.md +10 -0
  72. package/node_modules/side-channel/README.md +1 -1
  73. package/node_modules/side-channel/index.js +5 -2
  74. package/node_modules/side-channel/package.json +10 -10
  75. package/node_modules/side-channel/test/index.js +16 -0
  76. package/package.json +7 -6
  77. package/scripts/install-platform-native-deps.mjs +16 -1
  78. package/scripts/preinstall-windows-native-env.mjs +31 -0
  79. package/dashboard-dist/assets/index-BJUGO8PI.css +0 -2
@@ -8,7 +8,7 @@ Error generating stack: `+e.message+`
8
8
  `+e.stack}}var be=Object.prototype.hasOwnProperty,xe=t.unstable_scheduleCallback,Se=t.unstable_cancelCallback,Ce=t.unstable_shouldYield,we=t.unstable_requestPaint,Te=t.unstable_now,Ee=t.unstable_getCurrentPriorityLevel,De=t.unstable_ImmediatePriority,Oe=t.unstable_UserBlockingPriority,ke=t.unstable_NormalPriority,Ae=t.unstable_LowPriority,je=t.unstable_IdlePriority,Me=t.log,Ne=t.unstable_setDisableYieldValue,Pe=null,Fe=null;function Ie(e){if(typeof Me==`function`&&Ne(e),Fe&&typeof Fe.setStrictMode==`function`)try{Fe.setStrictMode(Pe,e)}catch{}}var Le=Math.clz32?Math.clz32:Be,Re=Math.log,ze=Math.LN2;function Be(e){return e>>>=0,e===0?32:31-(Re(e)/ze|0)|0}var Ve=256,He=262144,Ue=4194304;function We(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ge(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=We(n))):i=We(o):i=We(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=We(n))):i=We(o)):i=We(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ke(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function qe(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Je(){var e=Ue;return Ue<<=1,!(Ue&62914560)&&(Ue=4194304),e}function Ye(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ze(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Le(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Qe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Qe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Le(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function $e(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Le(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function et(e,t){var n=t&-t;return n=n&42?1:tt(n),(n&(e.suspendedLanes|t))===0?n:0}function tt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function nt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function rt(){var e=F.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function it(e,t){var n=F.p;try{return F.p=e,t()}finally{F.p=n}}var at=Math.random().toString(36).slice(2),ot=`__reactFiber$`+at,st=`__reactProps$`+at,ct=`__reactContainer$`+at,lt=`__reactEvents$`+at,ut=`__reactListeners$`+at,dt=`__reactHandles$`+at,ft=`__reactResources$`+at,pt=`__reactMarker$`+at;function mt(e){delete e[ot],delete e[st],delete e[lt],delete e[ut],delete e[dt]}function ht(e){var t=e[ot];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ct]||n[ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[ot])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function gt(e){if(e=e[ot]||e[ct]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _t(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function vt(e){var t=e[ft];return t||=e[ft]={hoistableStyles:new Map,hoistableScripts:new Map},t}function yt(e){e[pt]=!0}var bt=new Set,xt={};function St(e,t){Ct(e,t),Ct(e+`Capture`,t)}function Ct(e,t){for(xt[e]=t,e=0;e<t.length;e++)bt.add(t[e])}var wt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Tt={},Et={};function Dt(e){return be.call(Et,e)?!0:be.call(Tt,e)?!1:wt.test(e)?Et[e]=!0:(Tt[e]=!0,!1)}function Ot(e,t,n){if(Dt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function kt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function At(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function jt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Mt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Nt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Pt(e){if(!e._valueTracker){var t=Mt(e)?`checked`:`value`;e._valueTracker=Nt(e,t,``+e[t])}}function Ft(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Mt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function It(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Lt=/[\n"\\]/g;function Rt(e){return e.replace(Lt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function zt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+jt(t)):e.value!==``+jt(t)&&(e.value=``+jt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Vt(e,o,jt(n)):Vt(e,o,jt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+jt(s):e.removeAttribute(`name`)}function Bt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Pt(e);return}n=n==null?``:``+jt(n),t=t==null?n:``+jt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Pt(e)}function Vt(e,t,n){t===`number`&&It(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Ht(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+jt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ut(e,t,n){if(t!=null&&(t=``+jt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+jt(n)}function Wt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(te(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=jt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Pt(e)}function Gt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Kt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function qt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Kt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Jt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&qt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&qt(e,o,t[o])}function Yt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Xt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Zt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Qt(e){return Zt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function $t(){}var en=null;function tn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var nn=null,rn=null;function an(e){var t=gt(e);if(t&&(e=t.stateNode)){var n=e[st]||null;a:switch(e=t.stateNode,t.type){case`input`:if(zt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Rt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[st]||null;if(!a)throw Error(i(90));zt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Ft(r)}break a;case`textarea`:Ut(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Ht(e,!!n.multiple,t,!1)}}}var on=!1;function sn(e,t,n){if(on)return e(t,n);on=!0;try{return e(t)}finally{if(on=!1,(nn!==null||rn!==null)&&(vu(),nn&&(t=nn,e=rn,rn=nn=null,an(t),e)))for(t=0;t<e.length;t++)an(e[t])}}function cn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[st]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var ln=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),un=!1;if(ln)try{var dn={};Object.defineProperty(dn,`passive`,{get:function(){un=!0}}),window.addEventListener(`test`,dn,dn),window.removeEventListener(`test`,dn,dn)}catch{un=!1}var fn=null,pn=null,mn=null;function hn(){if(mn)return mn;var e,t=pn,n=t.length,r,i=`value`in fn?fn.value:fn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return mn=i.slice(e,1<r?1-r:void 0)}function gn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function _n(){return!0}function vn(){return!1}function yn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?_n:vn,this.isPropagationStopped=vn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=_n)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=_n)},persist:function(){},isPersistent:_n}),t}var bn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xn=yn(bn),Sn=h({},bn,{view:0,detail:0}),Cn=yn(Sn),wn,Tn,En,Dn=h({},Sn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==En&&(En&&e.type===`mousemove`?(wn=e.screenX-En.screenX,Tn=e.screenY-En.screenY):Tn=wn=0,En=e),wn)},movementY:function(e){return`movementY`in e?e.movementY:Tn}}),On=yn(Dn),kn=yn(h({},Dn,{dataTransfer:0})),An=yn(h({},Sn,{relatedTarget:0})),jn=yn(h({},bn,{animationName:0,elapsedTime:0,pseudoElement:0})),Mn=yn(h({},bn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Nn=yn(h({},bn,{data:0})),Pn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Fn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},In={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Ln(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=In[e])?!!t[e]:!1}function Rn(){return Ln}var zn=yn(h({},Sn,{key:function(e){if(e.key){var t=Pn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=gn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Fn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rn,charCode:function(e){return e.type===`keypress`?gn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?gn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Bn=yn(h({},Dn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Vn=yn(h({},Sn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rn})),Hn=yn(h({},bn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Un=yn(h({},Dn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Wn=yn(h({},bn,{newState:0,oldState:0})),Gn=[9,13,27,32],Kn=ln&&`CompositionEvent`in window,qn=null;ln&&`documentMode`in document&&(qn=document.documentMode);var Jn=ln&&`TextEvent`in window&&!qn,Yn=ln&&(!Kn||qn&&8<qn&&11>=qn),Xn=` `,Zn=!1;function Qn(e,t){switch(e){case`keyup`:return Gn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function z(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var $n=!1;function er(e,t){switch(e){case`compositionend`:return z(t);case`keypress`:return t.which===32?(Zn=!0,Xn):null;case`textInput`:return e=t.data,e===Xn&&Zn?null:e;default:return null}}function tr(e,t){if($n)return e===`compositionend`||!Kn&&Qn(e,t)?(e=hn(),mn=pn=fn=null,$n=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Yn&&t.locale!==`ko`?null:t.data;default:return null}}var nr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function rr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!nr[e.type]:t===`textarea`}function ir(e,t,n,r){nn?rn?rn.push(r):rn=[r]:nn=r,t=Td(t,`onChange`),0<t.length&&(n=new xn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ar=null,or=null;function sr(e){vd(e,0)}function cr(e){if(Ft(_t(e)))return e}function lr(e,t){if(e===`change`)return t}var ur=!1;if(ln){var dr;if(ln){var fr=`oninput`in document;if(!fr){var pr=document.createElement(`div`);pr.setAttribute(`oninput`,`return;`),fr=typeof pr.oninput==`function`}dr=fr}else dr=!1;ur=dr&&(!document.documentMode||9<document.documentMode)}function mr(){ar&&(ar.detachEvent(`onpropertychange`,hr),or=ar=null)}function hr(e){if(e.propertyName===`value`&&cr(or)){var t=[];ir(t,or,e,tn(e)),sn(sr,t)}}function gr(e,t,n){e===`focusin`?(mr(),ar=t,or=n,ar.attachEvent(`onpropertychange`,hr)):e===`focusout`&&mr()}function _r(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return cr(or)}function vr(e,t){if(e===`click`)return cr(t)}function yr(e,t){if(e===`input`||e===`change`)return cr(t)}function br(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var xr=typeof Object.is==`function`?Object.is:br;function Sr(e,t){if(xr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!be.call(t,i)||!xr(e[i],t[i]))return!1}return!0}function Cr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function wr(e,t){var n=Cr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Cr(n)}}function Tr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Er(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=It(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=It(e.document)}return t}function Dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Or=ln&&`documentMode`in document&&11>=document.documentMode,kr=null,Ar=null,jr=null,Mr=!1;function Nr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mr||kr==null||kr!==It(r)||(r=kr,`selectionStart`in r&&Dr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),jr&&Sr(jr,r)||(jr=r,r=Td(Ar,`onSelect`),0<r.length&&(t=new xn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=kr)))}function Pr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Fr={animationend:Pr(`Animation`,`AnimationEnd`),animationiteration:Pr(`Animation`,`AnimationIteration`),animationstart:Pr(`Animation`,`AnimationStart`),transitionrun:Pr(`Transition`,`TransitionRun`),transitionstart:Pr(`Transition`,`TransitionStart`),transitioncancel:Pr(`Transition`,`TransitionCancel`),transitionend:Pr(`Transition`,`TransitionEnd`)},Ir={},Lr={};ln&&(Lr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Fr.animationend.animation,delete Fr.animationiteration.animation,delete Fr.animationstart.animation),`TransitionEvent`in window||delete Fr.transitionend.transition);function Rr(e){if(Ir[e])return Ir[e];if(!Fr[e])return e;var t=Fr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Lr)return Ir[e]=t[n];return e}var zr=Rr(`animationend`),Br=Rr(`animationiteration`),Vr=Rr(`animationstart`),Hr=Rr(`transitionrun`),Ur=Rr(`transitionstart`),Wr=Rr(`transitioncancel`),Gr=Rr(`transitionend`),Kr=new Map,qr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);qr.push(`scrollEnd`);function Jr(e,t){Kr.set(e,t),St(t,[e])}var Yr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Xr=[],Zr=0,Qr=0;function $r(){for(var e=Zr,t=Qr=Zr=0;t<e;){var n=Xr[t];Xr[t++]=null;var r=Xr[t];Xr[t++]=null;var i=Xr[t];Xr[t++]=null;var a=Xr[t];if(Xr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ri(n,i,a)}}function ei(e,t,n,r){Xr[Zr++]=e,Xr[Zr++]=t,Xr[Zr++]=n,Xr[Zr++]=r,Qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ti(e,t,n,r){return ei(e,t,n,r),ii(e)}function ni(e,t){return ei(e,null,null,t),ii(e)}function ri(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Le(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ii(e){if(50<lu)throw lu=0,uu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ai={};function oi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function si(e,t,n,r){return new oi(e,t,n,r)}function ci(e){return e=e.prototype,!(!e||!e.isReactComponent)}function li(e,t){var n=e.alternate;return n===null?(n=si(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ui(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function di(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ci(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,ae.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=si(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return fi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=si(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=si(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=si(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=si(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function fi(e,t,n,r){return e=si(7,e,r,t),e.lanes=n,e}function pi(e,t,n){return e=si(6,e,null,t),e.lanes=n,e}function mi(e){var t=si(18,null,null,0);return t.stateNode=e,t}function hi(e,t,n){return t=si(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var gi=new WeakMap;function _i(e,t){if(typeof e==`object`&&e){var n=gi.get(e);return n===void 0?(t={value:e,source:t,stack:ye(t)},gi.set(e,t),t):n}return{value:e,source:t,stack:ye(t)}}var vi=[],yi=0,bi=null,xi=0,Si=[],Ci=0,wi=null,Ti=1,Ei=``;function Di(e,t){vi[yi++]=xi,vi[yi++]=bi,bi=e,xi=t}function Oi(e,t,n){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,wi=e;var r=Ti;e=Ei;var i=32-Le(r)-1;r&=~(1<<i),n+=1;var a=32-Le(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ti=1<<32-Le(t)+i|n<<i|r,Ei=a+e}else Ti=1<<a|n<<i|r,Ei=e}function ki(e){e.return!==null&&(Di(e,1),Oi(e,1,0))}function Ai(e){for(;e===bi;)bi=vi[--yi],vi[yi]=null,xi=vi[--yi],vi[yi]=null;for(;e===wi;)wi=Si[--Ci],Si[Ci]=null,Ei=Si[--Ci],Si[Ci]=null,Ti=Si[--Ci],Si[Ci]=null}function ji(e,t){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,Ti=t.id,Ei=t.overflow,wi=e}var Mi=null,Ni=null,B=!1,Pi=null,Fi=!1,Ii=Error(i(519));function Li(e){throw Ui(_i(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ii}function Ri(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ot]=e,t[st]=r,n){case`dialog`:$(`cancel`,t),$(`close`,t);break;case`iframe`:case`object`:case`embed`:$(`load`,t);break;case`video`:case`audio`:for(n=0;n<gd.length;n++)$(gd[n],t);break;case`source`:$(`error`,t);break;case`img`:case`image`:case`link`:$(`error`,t),$(`load`,t);break;case`details`:$(`toggle`,t);break;case`input`:$(`invalid`,t),Bt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$(`invalid`,t);break;case`textarea`:$(`invalid`,t),Wt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&($(`beforetoggle`,t),$(`toggle`,t)),r.onScroll!=null&&$(`scroll`,t),r.onScrollEnd!=null&&$(`scrollend`,t),r.onClick!=null&&(t.onclick=$t),t=!0):t=!1,t||Li(e,!0)}function zi(e){for(Mi=e.return;Mi;)switch(Mi.tag){case 5:case 31:case 13:Fi=!1;return;case 27:case 3:Fi=!0;return;default:Mi=Mi.return}}function Bi(e){if(e!==Mi)return!1;if(!B)return zi(e),B=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Ud(e.type,e.memoizedProps)),n=!n),n&&Ni&&Li(e),zi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ni=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ni=uf(e)}else t===27?(t=Ni,Zd(e.type)?(e=lf,lf=null,Ni=e):Ni=t):Ni=Mi?cf(e.stateNode.nextSibling):null;return!0}function Vi(){Ni=Mi=null,B=!1}function Hi(){var e=Pi;return e!==null&&(Yl===null?Yl=e:Yl.push.apply(Yl,e),Pi=null),e}function Ui(e){Pi===null?Pi=[e]:Pi.push(e)}var Wi=ie(null),Gi=null,Ki=null;function qi(e,t,n){R(Wi,t._currentValue),t._currentValue=n}function Ji(e){e._currentValue=Wi.current,L(Wi)}function Yi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Xi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Yi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Yi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Zi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;xr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ce.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}a=a.return}e!==null&&Xi(t,e,n,r),t.flags|=262144}function Qi(e){for(e=e.firstContext;e!==null;){if(!xr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function $i(e){Gi=e,Ki=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ea(e){return na(Gi,e)}function ta(e,t){return Gi===null&&$i(e),na(e,t)}function na(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ki===null){if(e===null)throw Error(i(308));Ki=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ki=Ki.next=t;return n}var ra=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ia=t.unstable_scheduleCallback,aa=t.unstable_NormalPriority,oa={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function sa(){return{controller:new ra,data:new Map,refCount:0}}function ca(e){e.refCount--,e.refCount===0&&ia(aa,function(){e.controller.abort()})}var la=null,ua=0,da=0,fa=null;function pa(e,t){if(la===null){var n=la=[];ua=0,da=ud(),fa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ua++,t.then(ma,ma),t}function ma(){if(--ua===0&&la!==null){fa!==null&&(fa.status=`fulfilled`);var e=la;la=null,da=0,fa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ha(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ga=P.S;P.S=function(e,t){Ql=Te(),typeof t==`object`&&t&&typeof t.then==`function`&&pa(e,t),ga!==null&&ga(e,t)};var _a=ie(null);function va(){var e=_a.current;return e===null?Fl.pooledCache:e}function ya(e,t){t===null?R(_a,_a.current):R(_a,t.pool)}function ba(){var e=va();return e===null?null:{parent:oa._currentValue,pool:e}}var xa=Error(i(460)),Sa=Error(i(474)),Ca=Error(i(542)),wa={then:function(){}};function Ta(e){return e=e.status,e===`fulfilled`||e===`rejected`}function V(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then($t,$t),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ka(e),e;default:if(typeof t.status==`string`)t.then($t,$t);else{if(e=Fl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ka(e),e}throw Da=t,xa}}function Ea(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Da=e,xa):e}}var Da=null;function Oa(){if(Da===null)throw Error(i(459));var e=Da;return Da=null,e}function ka(e){if(e===xa||e===Ca)throw Error(i(483))}var Aa=null,ja=0;function Ma(e){var t=ja;return ja+=1,Aa===null&&(Aa=[]),V(Aa,e,t)}function Na(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Pa(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Fa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=li(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=pi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&Ea(i)===t.type)?(t=a(t,n.props),Na(t,n),t.return=e,t):(t=di(n.type,n.key,n.props,null,e.mode,r),Na(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=hi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=fi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=pi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=di(t.type,t.key,t.props,null,e.mode,n),Na(n,t),n.return=e,n;case v:return t=hi(t,e.mode,n),t.return=e,t;case O:return t=Ea(t),f(e,t,n)}if(te(t)||M(t))return t=fi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ma(t),n);if(t.$$typeof===C)return f(e,ta(e,t),n);Pa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=Ea(n),p(e,t,n,r)}if(te(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ma(n),r);if(n.$$typeof===C)return p(e,t,ta(e,n),r);Pa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Ea(r),m(e,t,n,r,i)}if(te(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Ma(r),i);if(r.$$typeof===C)return m(e,t,n,ta(t,r),i);Pa(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),B&&Di(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return B&&Di(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),B&&Di(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),B&&Di(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return B&&Di(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),B&&Di(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Ea(l)===r.type){n(e,r.sibling),c=a(r,o.props),Na(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=fi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=di(o.type,o.key,o.props,null,e.mode,c),Na(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=hi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Ea(o),b(e,r,o,c)}if(te(o))return h(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Ma(o),c);if(o.$$typeof===C)return b(e,r,ta(e,o),c);Pa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=pi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ja=0;var i=b(e,t,n,r);return Aa=null,i}catch(t){if(t===xa||t===Ca)throw t;var a=si(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var H=Fa(!0),Ia=Fa(!1),La=!1;function Ra(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function za(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ba(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Va(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Pl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ii(e),ri(e,null,n),t}return ei(e,r,t,n),ii(e)}function Ha(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}function U(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ua=!1;function Wa(){if(Ua){var e=fa;if(e!==null)throw e}}function Ga(e,t,n,r){Ua=!1;var i=e.updateQueue;La=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Q&f)===f:(r&f)===f){f!==0&&f===da&&(Ua=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:La=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ul|=o,e.lanes=o,e.memoizedState=d}}function Ka(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function qa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ka(n[e],t)}var Ja=ie(null),Ya=ie(0);function Xa(e,t){e=Vl,R(Ya,e),R(Ja,t),Vl=e|t.baseLanes}function Za(){R(Ya,Vl),R(Ja,Ja.current)}function Qa(){Vl=Ya.current,L(Ja),L(Ya)}var $a=ie(null),eo=null;function to(e){var t=e.alternate;R(oo,oo.current&1),R($a,e),eo===null&&(t===null||Ja.current!==null||t.memoizedState!==null)&&(eo=e)}function no(e){R(oo,oo.current),R($a,e),eo===null&&(eo=e)}function ro(e){e.tag===22?(R(oo,oo.current),R($a,e),eo===null&&(eo=e)):io(e)}function io(){R(oo,oo.current),R($a,$a.current)}function ao(e){L($a),eo===e&&(eo=null),L(oo)}var oo=ie(0);function W(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var so=0,G=null,co=null,K=null,lo=!1,q=!1,uo=!1,J=0,fo=0,po=null,mo=0;function ho(){throw Error(i(321))}function go(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!xr(e[n],t[n]))return!1;return!0}function _o(e,t,n,r,i,a){return so=a,G=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,P.H=e===null||e.memoizedState===null?Ms:Ns,uo=!1,a=n(r,i),uo=!1,q&&(a=yo(t,n,r,i)),vo(e),a}function vo(e){P.H=js;var t=co!==null&&co.next!==null;if(so=0,K=co=G=null,lo=!1,fo=0,po=null,t)throw Error(i(300));e===null||Xs||(e=e.dependencies,e!==null&&Qi(e)&&(Xs=!0))}function yo(e,t,n,r){G=e;var a=0;do{if(q&&(po=null),fo=0,q=!1,25<=a)throw Error(i(301));if(a+=1,K=co=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}P.H=Ps,o=t(n,r)}while(q);return o}function bo(){var e=P.H,t=e.useState()[0];return t=typeof t.then==`function`?Do(t):t,e=e.useState()[0],(co===null?null:co.memoizedState)!==e&&(G.flags|=1024),t}function xo(){var e=J!==0;return J=0,e}function So(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Co(e){if(lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}lo=!1}so=0,K=co=G=null,q=!1,fo=J=0,po=null}function wo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return K===null?G.memoizedState=K=e:K=K.next=e,K}function To(){if(co===null){var e=G.alternate;e=e===null?null:e.memoizedState}else e=co.next;var t=K===null?G.memoizedState:K.next;if(t!==null)K=t,co=e;else{if(e===null)throw G.alternate===null?Error(i(467)):Error(i(310));co=e,e={memoizedState:co.memoizedState,baseState:co.baseState,baseQueue:co.baseQueue,queue:co.queue,next:null},K===null?G.memoizedState=K=e:K=K.next=e}return K}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Do(e){var t=fo;return fo+=1,po===null&&(po=[]),e=V(po,e,t),t=G,(K===null?t.memoizedState:K.next)===null&&(t=t.alternate,P.H=t===null||t.memoizedState===null?Ms:Ns),e}function Oo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Do(e);if(e.$$typeof===C)return ea(e)}throw Error(i(438,String(e)))}function ko(e){var t=null,n=G.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=G.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Eo(),G.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function Ao(e,t){return typeof t==`function`?t(e):t}function jo(e){return Mo(To(),co,e)}function Mo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(so&f)===f:(Q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===da&&(d=!0);else if((so&p)===p){u=u.next,p===da&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,G.lanes|=p,Ul|=p;f=u.action,uo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,G.lanes|=f,Ul|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!xr(o,e.memoizedState)&&(Xs=!0,d&&(n=fa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function No(e){var t=To(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);xr(o,t.memoizedState)||(Xs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Po(e,t,n){var r=G,a=To(),o=B;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!xr((co||a).memoizedState,n);if(s&&(a.memoizedState=n,Xs=!0),a=a.queue,Y(Lo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||K!==null&&K.memoizedState.tag&1){if(r.flags|=2048,es(9,{destroy:void 0},Io.bind(null,r,a,n,t),null),Fl===null)throw Error(i(349));o||so&127||Fo(r,t,n)}return n}function Fo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=G.updateQueue,t===null?(t=Eo(),G.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Io(e,t,n,r){t.value=n,t.getSnapshot=r,Ro(t)&&zo(e)}function Lo(e,t,n){return n(function(){Ro(t)&&zo(e)})}function Ro(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xr(e,n)}catch{return!0}}function zo(e){var t=ni(e,2);t!==null&&pu(t,e,2)}function Bo(e){var t=wo();if(typeof e==`function`){var n=e;if(e=n(),uo){Ie(!0);try{n()}finally{Ie(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:e},t}function Vo(e,t,n,r){return e.baseState=n,Mo(e,co,typeof r==`function`?r:Ao)}function Ho(e,t,n,r,a){if(Os(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};P.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Uo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Uo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=P.T,o={};P.T=o;try{var s=n(i,r),c=P.S;c!==null&&c(o,s),Wo(e,t,s)}catch(n){Ko(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),P.T=a}}else try{a=n(i,r),Wo(e,t,a)}catch(n){Ko(e,t,n)}}function Wo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Go(e,t,n)},function(n){return Ko(e,t,n)}):Go(e,t,n)}function Go(e,t,n){t.status=`fulfilled`,t.value=n,qo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Uo(e,n)))}function Ko(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,qo(t),t=t.next;while(t!==r)}e.action=null}function qo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Jo(e,t){return t}function Yo(e,t){if(B){var n=Fl.formState;if(n!==null){a:{var r=G;if(B){if(Ni){b:{for(var i=Ni,a=Fi;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ni=cf(i.nextSibling),r=i.data===`F!`;break a}}Li(r)}r=!1}r&&(t=n[0])}}return n=wo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jo,lastRenderedState:t},n.queue=r,n=Es.bind(null,G,r),r.dispatch=n,r=Bo(!1),a=X.bind(null,G,!1,r.queue),r=wo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ho.bind(null,G,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Xo(e){return Zo(To(),co,e)}function Zo(e,t,n){if(t=Mo(e,t,Jo)[0],e=jo(Ao)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Do(t)}catch(e){throw e===xa?Ca:e}else r=t;t=To();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(G.flags|=2048,es(9,{destroy:void 0},Qo.bind(null,i,n),null)),[r,a,e]}function Qo(e,t){e.action=t}function $o(e){var t=To(),n=co;if(n!==null)return Zo(t,n,e);To(),t=t.memoizedState,n=To();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function es(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=G.updateQueue,t===null&&(t=Eo(),G.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ts(){return To().memoizedState}function ns(e,t,n,r){var i=wo();G.flags|=e,i.memoizedState=es(1|t,{destroy:void 0},n,r===void 0?null:r)}function rs(e,t,n,r){var i=To();r=r===void 0?null:r;var a=i.memoizedState.inst;co!==null&&r!==null&&go(r,co.memoizedState.deps)?i.memoizedState=es(t,a,n,r):(G.flags|=e,i.memoizedState=es(1|t,a,n,r))}function is(e,t){ns(8390656,8,e,t)}function Y(e,t){rs(2048,8,e,t)}function as(e){G.flags|=4;var t=G.updateQueue;if(t===null)t=Eo(),G.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function os(e){var t=To().memoizedState;return as({ref:t,nextImpl:e}),function(){if(Pl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ss(e,t){return rs(4,2,e,t)}function cs(e,t){return rs(4,4,e,t)}function ls(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function us(e,t,n){n=n==null?null:n.concat([e]),rs(4,4,ls.bind(null,t,e),n)}function ds(){}function fs(e,t){var n=To();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&go(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ps(e,t){var n=To();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&go(t,r[1]))return r[0];if(r=e(),uo){Ie(!0);try{e()}finally{Ie(!1)}}return n.memoizedState=[r,t],r}function ms(e,t,n){return n===void 0||so&1073741824&&!(Q&261930)?e.memoizedState=t:(e.memoizedState=n,e=fu(),G.lanes|=e,Ul|=e,n)}function hs(e,t,n,r){return xr(n,t)?n:Ja.current===null?!(so&42)||so&1073741824&&!(Q&261930)?(Xs=!0,e.memoizedState=n):(e=fu(),G.lanes|=e,Ul|=e,t):(e=ms(e,n,r),xr(e,t)||(Xs=!0),e)}function gs(e,t,n,r,i){var a=F.p;F.p=a!==0&&8>a?a:8;var o=P.T,s={};P.T=s,X(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ds(e,t,ha(c,r),du(e)):Ds(e,t,r,du(e))}catch(n){Ds(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{F.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.T=o}}function _s(){}function vs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ys(e).queue;gs(e,a,t,I,n===null?_s:function(){return bs(e),n(r)})}function ys(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:I},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function bs(e){var t=ys(e);t.next===null&&(t=e.alternate.memoizedState),Ds(e,t.next.queue,{},du())}function xs(){return ea(Qf)}function Ss(){return To().memoizedState}function Cs(){return To().memoizedState}function ws(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=du();e=Ba(n);var r=Va(t,e,n);r!==null&&(pu(r,t,n),Ha(r,t,n)),t={cache:sa()},e.payload=t;return}t=t.return}}function Ts(e,t,n){var r=du();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Os(e)?ks(t,n):(n=ti(e,t,n,r),n!==null&&(pu(n,e,r),As(n,t,r)))}function Es(e,t,n){Ds(e,t,n,du())}function Ds(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Os(e))ks(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,xr(s,o))return ei(e,t,i,0),Fl===null&&$r(),!1}catch{}if(n=ti(e,t,i,r),n!==null)return pu(n,e,r),As(n,t,r),!0}return!1}function X(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Os(e)){if(t)throw Error(i(479))}else t=ti(e,n,r,2),t!==null&&pu(t,e,2)}function Os(e){var t=e.alternate;return e===G||t!==null&&t===G}function ks(e,t){q=lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function As(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}var js={readContext:ea,use:Oo,useCallback:ho,useContext:ho,useEffect:ho,useImperativeHandle:ho,useLayoutEffect:ho,useInsertionEffect:ho,useMemo:ho,useReducer:ho,useRef:ho,useState:ho,useDebugValue:ho,useDeferredValue:ho,useTransition:ho,useSyncExternalStore:ho,useId:ho,useHostTransitionStatus:ho,useFormState:ho,useActionState:ho,useOptimistic:ho,useMemoCache:ho,useCacheRefresh:ho};js.useEffectEvent=ho;var Ms={readContext:ea,use:Oo,useCallback:function(e,t){return wo().memoizedState=[e,t===void 0?null:t],e},useContext:ea,useEffect:is,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ns(4194308,4,ls.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ns(4194308,4,e,t)},useInsertionEffect:function(e,t){ns(4,2,e,t)},useMemo:function(e,t){var n=wo();t=t===void 0?null:t;var r=e();if(uo){Ie(!0);try{e()}finally{Ie(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=wo();if(n!==void 0){var i=n(t);if(uo){Ie(!0);try{n(t)}finally{Ie(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ts.bind(null,G,e),[r.memoizedState,e]},useRef:function(e){var t=wo();return e={current:e},t.memoizedState=e},useState:function(e){e=Bo(e);var t=e.queue,n=Es.bind(null,G,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ds,useDeferredValue:function(e,t){return ms(wo(),e,t)},useTransition:function(){var e=Bo(!1);return e=gs.bind(null,G,e.queue,!0,!1),wo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=G,a=wo();if(B){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Fl===null)throw Error(i(349));Q&127||Fo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,is(Lo.bind(null,r,o,e),[e]),r.flags|=2048,es(9,{destroy:void 0},Io.bind(null,r,o,n,t),null),n},useId:function(){var e=wo(),t=Fl.identifierPrefix;if(B){var n=Ei,r=Ti;n=(r&~(1<<32-Le(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=J++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=mo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:xs,useFormState:Yo,useActionState:Yo,useOptimistic:function(e){var t=wo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=X.bind(null,G,!0,n),n.dispatch=t,[e,t]},useMemoCache:ko,useCacheRefresh:function(){return wo().memoizedState=ws.bind(null,G)},useEffectEvent:function(e){var t=wo(),n={impl:e};return t.memoizedState=n,function(){if(Pl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Ns={readContext:ea,use:Oo,useCallback:fs,useContext:ea,useEffect:Y,useImperativeHandle:us,useInsertionEffect:ss,useLayoutEffect:cs,useMemo:ps,useReducer:jo,useRef:ts,useState:function(){return jo(Ao)},useDebugValue:ds,useDeferredValue:function(e,t){return hs(To(),co.memoizedState,e,t)},useTransition:function(){var e=jo(Ao)[0],t=To().memoizedState;return[typeof e==`boolean`?e:Do(e),t]},useSyncExternalStore:Po,useId:Ss,useHostTransitionStatus:xs,useFormState:Xo,useActionState:Xo,useOptimistic:function(e,t){return Vo(To(),co,e,t)},useMemoCache:ko,useCacheRefresh:Cs};Ns.useEffectEvent=os;var Ps={readContext:ea,use:Oo,useCallback:fs,useContext:ea,useEffect:Y,useImperativeHandle:us,useInsertionEffect:ss,useLayoutEffect:cs,useMemo:ps,useReducer:No,useRef:ts,useState:function(){return No(Ao)},useDebugValue:ds,useDeferredValue:function(e,t){var n=To();return co===null?ms(n,e,t):hs(n,co.memoizedState,e,t)},useTransition:function(){var e=No(Ao)[0],t=To().memoizedState;return[typeof e==`boolean`?e:Do(e),t]},useSyncExternalStore:Po,useId:Ss,useHostTransitionStatus:xs,useFormState:$o,useActionState:$o,useOptimistic:function(e,t){var n=To();return co===null?(n.baseState=e,[e,n.queue.dispatch]):Vo(n,co,e,t)},useMemoCache:ko,useCacheRefresh:Cs};Ps.useEffectEvent=os;function Fs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Is={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=du(),i=Ba(r);i.payload=t,n!=null&&(i.callback=n),t=Va(e,i,r),t!==null&&(pu(t,e,r),Ha(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=du(),i=Ba(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Va(e,i,r),t!==null&&(pu(t,e,r),Ha(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=du(),r=Ba(n);r.tag=2,t!=null&&(r.callback=t),t=Va(e,r,n),t!==null&&(pu(t,e,n),Ha(t,e,n))}};function Ls(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Sr(n,r)||!Sr(i,a):!0}function Rs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Is.enqueueReplaceState(t,t.state,null)}function zs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Bs(e){Yr(e)}function Vs(e){console.error(e)}function Hs(e){Yr(e)}function Us(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ws(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Gs(e,t,n){return n=Ba(n),n.tag=3,n.payload={element:null},n.callback=function(){Us(e,t)},n}function Ks(e){return e=Ba(e),e.tag=3,e}function qs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ws(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ws(t,n,r),typeof i!=`function`&&(tu===null?tu=new Set([this]):tu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Js(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Zi(t,n,a,!0),n=$a.current,n!==null){switch(n.tag){case 31:case 13:return eo===null?Tu():n.alternate===null&&Hl===0&&(Hl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===wa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Wu(e,r,a)),!1;case 22:return n.flags|=65536,r===wa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Wu(e,r,a)),!1}throw Error(i(435,n.tag))}return Wu(e,r,a),Tu(),!1}if(B)return t=$a.current,t===null?(r!==Ii&&(t=Error(i(423),{cause:r}),Ui(_i(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=_i(r,n),a=Gs(e.stateNode,r,a),U(e,a),Hl!==4&&(Hl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ii&&(e=Error(i(422),{cause:r}),Ui(_i(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=_i(o,n),Jl===null?Jl=[o]:Jl.push(o),Hl!==4&&(Hl=2),t===null)return!0;r=_i(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Gs(n.stateNode,r,e),U(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(tu===null||!tu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ks(a),qs(a,e,n,r),U(n,a),!1}n=n.return}while(n!==null);return!1}var Ys=Error(i(461)),Xs=!1;function Zs(e,t,n,r){t.child=e===null?Ia(t,null,n,r):H(t,e.child,n,r)}function Qs(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return $i(t),r=_o(e,t,n,o,a,i),s=xo(),e!==null&&!Xs?(So(e,t,i),Sc(e,t,i)):(B&&s&&ki(t),t.flags|=1,Zs(e,t,r,i),t.child)}function $s(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ci(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ec(e,t,a,r,i)):(e=di(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Cc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Sr:n,n(o,r)&&e.ref===t.ref)return Sc(e,t,i)}return t.flags|=1,e=li(a,r),e.ref=t.ref,e.return=t,t.child=e}function ec(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Sr(a,r)&&e.ref===t.ref)if(Xs=!1,t.pendingProps=r=a,Cc(e,i))e.flags&131072&&(Xs=!0);else return t.lanes=e.lanes,Sc(e,t,i)}return cc(e,t,n,r,i)}function tc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return rc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ya(t,a===null?null:a.cachePool),a===null?Za():Xa(t,a),ro(t);else return r=t.lanes=536870912,rc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ya(t,null),Za(),io(t)):(ya(t,a.cachePool),Xa(t,a),io(t),t.memoizedState=null);return Zs(e,t,i,n),t.child}function nc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function rc(e,t,n,r,i){var a=va();return a=a===null?null:{parent:oa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ya(t,null),Za(),ro(t),e!==null&&Zi(e,t,r,!0),t.childLanes=i,null}function ic(e,t){return t=_c({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ac(e,t,n){return H(t,e.child,null,n),e=ic(t,t.pendingProps),e.flags|=2,ao(t),t.memoizedState=null,e}function oc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(B){if(r.mode===`hidden`)return e=ic(t,r),t.lanes=536870912,nc(null,e);if(no(t),(e=Ni)?(e=rf(e,Fi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=mi(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Li(t);return t.lanes=536870912,null}return ic(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(no(t),a)if(t.flags&256)t.flags&=-257,t=ac(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(Xs||Zi(e,t,n,!1),a=(n&e.childLanes)!==0,Xs||a){if(r=Fl,r!==null&&(s=et(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ni(e,s),pu(r,e,s),Ys;Tu(),t=ac(e,t,n)}else e=o.treeContext,Ni=cf(s.nextSibling),Mi=t,B=!0,Pi=null,Fi=!1,e!==null&&ji(t,e),t=ic(t,r),t.flags|=4096;return t}return e=li(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function sc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function cc(e,t,n,r,i){return $i(t),n=_o(e,t,n,r,void 0,i),r=xo(),e!==null&&!Xs?(So(e,t,i),Sc(e,t,i)):(B&&r&&ki(t),t.flags|=1,Zs(e,t,n,i),t.child)}function lc(e,t,n,r,i,a){return $i(t),t.updateQueue=null,n=yo(t,r,n,i),vo(e),r=xo(),e!==null&&!Xs?(So(e,t,a),Sc(e,t,a)):(B&&r&&ki(t),t.flags|=1,Zs(e,t,n,a),t.child)}function uc(e,t,n,r,i){if($i(t),t.stateNode===null){var a=ai,o=n.contextType;typeof o==`object`&&o&&(a=ea(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Is,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ra(t),o=n.contextType,a.context=typeof o==`object`&&o?ea(o):ai,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Fs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Is.enqueueReplaceState(a,a.state,null),Ga(t,r,a,i),Wa(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=zs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ai,typeof u==`object`&&u&&(o=ea(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Rs(t,a,r,o),La=!1;var f=t.memoizedState;a.state=f,Ga(t,r,a,i),Wa(),l=t.memoizedState,s||f!==l||La?(typeof d==`function`&&(Fs(t,n,d,r),l=t.memoizedState),(c=La||Ls(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,za(e,t),o=t.memoizedProps,u=zs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ai,typeof l==`object`&&l&&(c=ea(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Rs(t,a,r,c),La=!1,f=t.memoizedState,a.state=f,Ga(t,r,a,i),Wa();var p=t.memoizedState;o!==d||f!==p||La||e!==null&&e.dependencies!==null&&Qi(e.dependencies)?(typeof s==`function`&&(Fs(t,n,s,r),p=t.memoizedState),(u=La||Ls(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Qi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,sc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=H(t,e.child,null,i),t.child=H(t,null,n,i)):Zs(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Sc(e,t,i),e}function dc(e,t,n,r){return Vi(),t.flags|=256,Zs(e,t,n,r),t.child}var fc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function pc(e){return{baseLanes:e,cachePool:ba()}}function mc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Kl),e}function hc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(oo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(B){if(a?to(t):io(t),(e=Ni)?(e=rf(e,Fi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=mi(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Li(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(io(t),a=t.mode,c=_c({mode:`hidden`,children:c},a),r=fi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,s,n),t.memoizedState=fc,nc(null,r)):(to(t),gc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(to(t),t.flags&=-257,t=vc(e,t,n)):t.memoizedState===null?(io(t),c=r.fallback,a=t.mode,r=_c({mode:`visible`,children:r.children},a),c=fi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,H(t,e.child,null,n),r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,s,n),t.memoizedState=fc,t=nc(null,r)):(io(t),t.child=e.child,t.flags|=128,t=null);else if(to(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ui({value:r,source:null,stack:null}),t=vc(e,t,n)}else if(Xs||Zi(e,t,n,!1),s=(n&e.childLanes)!==0,Xs||s){if(s=Fl,s!==null&&(r=et(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ni(e,r),pu(s,e,r),Ys;af(c)||Tu(),t=vc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ni=cf(c.nextSibling),Mi=t,B=!0,Pi=null,Fi=!1,e!==null&&ji(t,e),t=gc(t,r.children),t.flags|=4096);return t}return a?(io(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=li(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=fi(c,a,n,null),c.flags|=2):c=li(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,nc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=pc(n):(a=c.cachePool,a===null?a=ba():(l=oa._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=mc(e,s,n),t.memoizedState=fc,nc(e.child,r)):(to(t),n=e.child,e=n.sibling,n=li(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function gc(e,t){return t=_c({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function _c(e,t){return e=si(22,e,null,t),e.lanes=0,e}function vc(e,t,n){return H(t,e.child,null,n),e=gc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Yi(e.return,t,n)}function bc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function xc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=oo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,R(oo,o),Zs(e,t,r,n),r=B?xi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yc(e,n,t);else if(e.tag===19)yc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&W(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),bc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&W(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}bc(t,!0,n,null,a,r);break;case`together`:bc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Sc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ul|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Zi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=li(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=li(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Cc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Qi(e))):!0}function wc(e,t,n){switch(t.tag){case 3:le(t,t.stateNode.containerInfo),qi(t,oa,e.memoizedState.cache),Vi();break;case 27:case 5:de(t);break;case 4:le(t,t.stateNode.containerInfo);break;case 10:qi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,no(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(to(t),e=Sc(e,t,n),e===null?null:e.sibling):hc(e,t,n):(to(t),t.flags|=128,null);to(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Zi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return xc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),R(oo,oo.current),r)break;return null;case 22:return t.lanes=0,tc(e,t,n,t.pendingProps);case 24:qi(t,oa,e.memoizedState.cache)}return Sc(e,t,n)}function Tc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Xs=!0;else{if(!Cc(e,n)&&!(t.flags&128))return Xs=!1,wc(e,t,n);Xs=!!(e.flags&131072)}else Xs=!1,B&&t.flags&1048576&&Oi(t,xi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ea(t.elementType),t.type=e,typeof e==`function`)ci(e)?(r=zs(e,r),t.tag=1,t=uc(null,t,e,r,n)):(t.tag=0,t=cc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=Qs(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=$s(null,t,e,r,n);break a}}throw t=ee(e)||e,Error(i(306,t,``))}}return t;case 0:return cc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=zs(r,t.pendingProps),uc(e,t,r,a,n);case 3:a:{if(le(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,za(e,t),Ga(t,r,null,n);var s=t.memoizedState;if(r=s.cache,qi(t,oa,r),r!==o.cache&&Xi(t,[oa],n,!0),Wa(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=dc(e,t,r,n);break a}else if(r!==a){a=_i(Error(i(424)),t),Ui(a),t=dc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ni=cf(e.firstChild),Mi=t,B=!0,Pi=null,Fi=!0,n=Ia(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Vi(),r===a){t=Sc(e,t,n);break a}Zs(e,t,r,n)}t=t.child}return t;case 26:return sc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:B||(n=t.type,e=t.pendingProps,r=Bd(se.current).createElement(n),r[ot]=t,r[st]=e,Pd(r,n,e),yt(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return de(t),e===null&&B&&(r=t.stateNode=ff(t.type,t.pendingProps,se.current),Mi=t,Fi=!0,a=Ni,Zd(t.type)?(lf=a,Ni=cf(r.firstChild)):Ni=a),Zs(e,t,t.pendingProps.children,n),sc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&B&&((a=r=Ni)&&(r=tf(r,t.type,t.pendingProps,Fi),r===null?a=!1:(t.stateNode=r,Mi=t,Ni=cf(r.firstChild),Fi=!1,a=!0)),a||Li(t)),de(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Ud(a,o)?r=null:s!==null&&Ud(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=_o(e,t,bo,null,null,n),Qf._currentValue=a),sc(e,t),Zs(e,t,r,n),t.child;case 6:return e===null&&B&&((e=n=Ni)&&(n=nf(n,t.pendingProps,Fi),n===null?e=!1:(t.stateNode=n,Mi=t,Ni=null,e=!0)),e||Li(t)),null;case 13:return hc(e,t,n);case 4:return le(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=H(t,null,r,n):Zs(e,t,r,n),t.child;case 11:return Qs(e,t,t.type,t.pendingProps,n);case 7:return Zs(e,t,t.pendingProps,n),t.child;case 8:return Zs(e,t,t.pendingProps.children,n),t.child;case 12:return Zs(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,qi(t,t.type,r.value),Zs(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,$i(t),a=ea(a),r=r(a),t.flags|=1,Zs(e,t,r,n),t.child;case 14:return $s(e,t,t.type,t.pendingProps,n);case 15:return ec(e,t,t.type,t.pendingProps,n);case 19:return xc(e,t,n);case 31:return oc(e,t,n);case 22:return tc(e,t,n,t.pendingProps);case 24:return $i(t),r=ea(oa),e===null?(a=va(),a===null&&(a=Fl,o=sa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ra(t),qi(t,oa,a)):((e.lanes&n)!==0&&(za(e,t),Ga(t,null,null,n),Wa()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,qi(t,oa,r),r!==a.cache&&Xi(t,[oa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),qi(t,oa,r))),Zs(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Ec(e){e.flags|=4}function Dc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Su())e.flags|=8192;else throw Da=wa,Sa}else e.flags&=-16777217}function Oc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t))if(Su())e.flags|=8192;else throw Da=wa,Sa}function kc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Je(),e.lanes|=t,ql|=t)}function Ac(e,t){if(!B)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function jc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Mc(e,t,n){var r=t.pendingProps;switch(Ai(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jc(t),null;case 1:return jc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ji(oa),ue(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Bi(t)?Ec(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Hi())),jc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Ec(t),o===null?(jc(t),Dc(t,a,null,r,n)):(jc(t),Oc(t,o))):o?o===e.memoizedState?(jc(t),t.flags&=-16777217):(Ec(t),jc(t),Oc(t,o)):(e=e.memoizedProps,e!==r&&Ec(t),jc(t),Dc(t,a,e,r,n)),null;case 27:if(fe(t),n=se.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return jc(t),null}e=ae.current,Bi(t)?Ri(t,e):(e=ff(a,r,n),t.stateNode=e,Ec(t))}return jc(t),null;case 5:if(fe(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return jc(t),null}if(o=ae.current,Bi(t))Ri(t,o);else{var s=Bd(se.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[ot]=t,o[st]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ec(t)}}return jc(t),Dc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=se.current,Bi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Mi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Li(t,!0)}else e=Bd(e).createTextNode(r),e[ot]=t,t.stateNode=e}return jc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Bi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[ot]=t}else Vi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),e=!1}else n=Hi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ao(t),t):(ao(t),null);if(t.flags&128)throw Error(i(558))}return jc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Bi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[ot]=t}else Vi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),a=!1}else a=Hi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ao(t),t):(ao(t),null)}return ao(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),kc(t,t.updateQueue),jc(t),null);case 4:return ue(),e===null&&xd(t.stateNode.containerInfo),jc(t),null;case 10:return Ji(t.type),jc(t),null;case 19:if(L(oo),r=t.memoizedState,r===null)return jc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Ac(r,!1);else{if(Hl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=W(e),o!==null){for(t.flags|=128,Ac(r,!1),e=o.updateQueue,t.updateQueue=e,kc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ui(n,e),n=n.sibling;return R(oo,oo.current&1|2),B&&Di(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Te()>$l&&(t.flags|=128,a=!0,Ac(r,!1),t.lanes=4194304)}else{if(!a)if(e=W(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,kc(t,e),Ac(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!B)return jc(t),null}else 2*Te()-r.renderingStartTime>$l&&n!==536870912&&(t.flags|=128,a=!0,Ac(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(jc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Te(),e.sibling=null,n=oo.current,R(oo,a?n&1|2:n&1),B&&Di(t,r.treeForkCount),e);case 22:case 23:return ao(t),Qa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(jc(t),t.subtreeFlags&6&&(t.flags|=8192)):jc(t),n=t.updateQueue,n!==null&&kc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&L(_a),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ji(oa),jc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Nc(e,t){switch(Ai(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ji(oa),ue(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return fe(t),null;case 31:if(t.memoizedState!==null){if(ao(t),t.alternate===null)throw Error(i(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ao(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return L(oo),null;case 4:return ue(),null;case 10:return Ji(t.type),null;case 22:case 23:return ao(t),Qa(),e!==null&&L(_a),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ji(oa),null;case 25:return null;default:return null}}function Pc(e,t){switch(Ai(t),t.tag){case 3:Ji(oa),ue();break;case 26:case 27:case 5:fe(t);break;case 4:ue();break;case 31:t.memoizedState!==null&&ao(t);break;case 13:ao(t);break;case 19:L(oo);break;case 10:Ji(t.type);break;case 22:case 23:ao(t),Qa(),e!==null&&L(_a);break;case 24:Ji(oa)}}function Fc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Uu(t,t.return,e)}}function Ic(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Uu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Uu(t,t.return,e)}}function Lc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{qa(t,n)}catch(t){Uu(e,e.return,t)}}}function Rc(e,t,n){n.props=zs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function zc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Uu(e,t,n)}}function Bc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Uu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Uu(e,t,n)}else n.current=null}function Vc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Uu(e,e.return,t)}}function Hc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[st]=t}catch(t){Uu(e,e.return,t)}}function Uc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Wc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Uc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Gc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$t));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function Kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Kc(e,t,n),e=e.sibling;e!==null;)Kc(e,t,n),e=e.sibling}function qc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[ot]=e,t[st]=n}catch(t){Uu(e,e.return,t)}}var Jc=!1,Yc=!1,Xc=!1,Zc=typeof WeakSet==`function`?WeakSet:Set,Qc=null;function $c(e,t){if(e=e.containerInfo,Rd=sp,e=Er(e),Dr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,Qc=t;Qc!==null;)if(t=Qc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Qc=e;else for(;Qc!==null;){switch(t=Qc,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=zs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Uu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,Qc=e;break}Qc=t.return}}function el(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:hl(e,n),r&4&&Fc(5,n);break;case 1:if(hl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Uu(n,n.return,e)}else{var i=zs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Uu(n,n.return,e)}}r&64&&Lc(n),r&512&&zc(n,n.return);break;case 3:if(hl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{qa(e,t)}catch(e){Uu(n,n.return,e)}}break;case 27:t===null&&r&4&&qc(n);case 26:case 5:hl(e,n),t===null&&r&4&&Vc(n),r&512&&zc(n,n.return);break;case 12:hl(e,n);break;case 31:hl(e,n),r&4&&ol(e,n);break;case 13:hl(e,n),r&4&&sl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qu.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Jc,!r){t=t!==null&&t.memoizedState!==null||Yc,i=Jc;var a=Yc;Jc=r,(Yc=t)&&!a?_l(e,n,(n.subtreeFlags&8772)!=0):hl(e,n),Jc=i,Yc=a}break;case 30:break;default:hl(e,n)}}function tl(e){var t=e.alternate;t!==null&&(e.alternate=null,tl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&mt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var nl=null,rl=!1;function il(e,t,n){for(n=n.child;n!==null;)al(e,t,n),n=n.sibling}function al(e,t,n){if(Fe&&typeof Fe.onCommitFiberUnmount==`function`)try{Fe.onCommitFiberUnmount(Pe,n)}catch{}switch(n.tag){case 26:Yc||Bc(n,t),il(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Yc||Bc(n,t);var r=nl,i=rl;Zd(n.type)&&(nl=n.stateNode,rl=!1),il(e,t,n),pf(n.stateNode),nl=r,rl=i;break;case 5:Yc||Bc(n,t);case 6:if(r=nl,i=rl,nl=null,il(e,t,n),nl=r,rl=i,nl!==null)if(rl)try{(nl.nodeType===9?nl.body:nl.nodeName===`HTML`?nl.ownerDocument.body:nl).removeChild(n.stateNode)}catch(e){Uu(n,t,e)}else try{nl.removeChild(n.stateNode)}catch(e){Uu(n,t,e)}break;case 18:nl!==null&&(rl?(e=nl,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(nl,n.stateNode));break;case 4:r=nl,i=rl,nl=n.stateNode.containerInfo,rl=!0,il(e,t,n),nl=r,rl=i;break;case 0:case 11:case 14:case 15:Ic(2,n,t),Yc||Ic(4,n,t),il(e,t,n);break;case 1:Yc||(Bc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Rc(n,t,r)),il(e,t,n);break;case 21:il(e,t,n);break;case 22:Yc=(r=Yc)||n.memoizedState!==null,il(e,t,n),Yc=r;break;default:il(e,t,n)}}function ol(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Uu(t,t.return,e)}}}function sl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Uu(t,t.return,e)}}function cl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zc),t;default:throw Error(i(435,e.tag))}}function ll(e,t){var n=cl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ju.bind(null,e,t);t.then(r,r)}})}function ul(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){nl=c.stateNode,rl=!1;break a}break;case 5:nl=c.stateNode,rl=!1;break a;case 3:case 4:nl=c.stateNode.containerInfo,rl=!0;break a}c=c.return}if(nl===null)throw Error(i(160));al(o,s,a),nl=null,rl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)fl(t,e),t=t.sibling}var dl=null;function fl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ul(t,e),pl(e),r&4&&(Ic(3,e,e.return),Fc(3,e),Ic(5,e,e.return));break;case 1:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),r&64&&Jc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=dl;if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[pt]||o[ot]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Pd(o,r,n),o[ot]=e,yt(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Vf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[ot]=e,yt(o),r=o}e.stateNode=r}else Hf(a,e.type,e.stateNode);else e.stateNode=If(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Hc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Hf(a,e.type,e.stateNode):If(a,r,e.memoizedProps))}break;case 27:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),n!==null&&r&4&&Hc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),e.flags&32){a=e.stateNode;try{Gt(a,``)}catch(t){Uu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Hc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Xc=!0);break;case 6:if(ul(t,e),pl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Uu(e,e.return,t)}}break;case 3:if(Bf=null,a=dl,dl=gf(t.containerInfo),ul(t,e),dl=a,pl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Uu(e,e.return,t)}Xc&&(Xc=!1,ml(e));break;case 4:r=dl,dl=gf(e.stateNode.containerInfo),ul(t,e),pl(e),dl=r;break;case 12:ul(t,e),pl(e);break;case 31:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 13:ul(t,e),pl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Zl=Te()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Jc,d=Yc;if(Jc=u||a,Yc=d||l,ul(t,e),Yc=d,Jc=u,pl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Jc||Yc||gl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Uu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Uu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?$d(m,!0):$d(l.stateNode,!1)}catch(e){Uu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ll(e,n))));break;case 19:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 30:break;case 21:break;default:ul(t,e),pl(e)}}function pl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Uc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Kc(e,Wc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Gt(o,``),n.flags&=-33),Kc(e,Wc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Gc(e,Wc(e),s);break;default:throw Error(i(161))}}catch(t){Uu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ml(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ml(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function hl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)el(e,t.alternate,t),t=t.sibling}function gl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ic(4,t,t.return),gl(t);break;case 1:Bc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Rc(t,t.return,n),gl(t);break;case 27:pf(t.stateNode);case 26:case 5:Bc(t,t.return),gl(t);break;case 22:t.memoizedState===null&&gl(t);break;case 30:gl(t);break;default:gl(t)}e=e.sibling}}function _l(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:_l(i,a,n),Fc(4,a);break;case 1:if(_l(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Uu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ka(c[i],s)}catch(e){Uu(r,r.return,e)}}n&&o&64&&Lc(a),zc(a,a.return);break;case 27:qc(a);case 26:case 5:_l(i,a,n),n&&r===null&&o&4&&Vc(a),zc(a,a.return);break;case 12:_l(i,a,n);break;case 31:_l(i,a,n),n&&o&4&&ol(i,a);break;case 13:_l(i,a,n),n&&o&4&&sl(i,a);break;case 22:a.memoizedState===null&&_l(i,a,n),zc(a,a.return);break;case 30:break;default:_l(i,a,n)}t=t.sibling}}function vl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ca(n))}function yl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ca(e))}function bl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xl(e,t,n,r),t=t.sibling}function xl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:bl(e,t,n,r),i&2048&&Fc(9,t);break;case 1:bl(e,t,n,r);break;case 3:bl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ca(e)));break;case 12:if(i&2048){bl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Uu(t,t.return,e)}}else bl(e,t,n,r);break;case 31:bl(e,t,n,r);break;case 13:bl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?bl(e,t,n,r):(a._visibility|=2,Sl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?bl(e,t,n,r):Cl(e,t),i&2048&&vl(o,t);break;case 24:bl(e,t,n,r),i&2048&&yl(t.alternate,t);break;default:bl(e,t,n,r)}}function Sl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Sl(a,o,s,c,i),Fc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Sl(a,o,s,c,i)):u._visibility&2?Sl(a,o,s,c,i):Cl(a,o),i&&l&2048&&vl(o.alternate,o);break;case 24:Sl(a,o,s,c,i),i&&l&2048&&yl(o.alternate,o);break;default:Sl(a,o,s,c,i)}t=t.sibling}}function Cl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Cl(n,r),i&2048&&vl(r.alternate,r);break;case 24:Cl(n,r),i&2048&&yl(r.alternate,r);break;default:Cl(n,r)}t=t.sibling}}var wl=8192;function Tl(e,t,n){if(e.subtreeFlags&wl)for(e=e.child;e!==null;)El(e,t,n),e=e.sibling}function El(e,t,n){switch(e.tag){case 26:Tl(e,t,n),e.flags&wl&&e.memoizedState!==null&&Gf(n,dl,e.memoizedState,e.memoizedProps);break;case 5:Tl(e,t,n);break;case 3:case 4:var r=dl;dl=gf(e.stateNode.containerInfo),Tl(e,t,n),dl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=wl,wl=16777216,Tl(e,t,n),wl=r):Tl(e,t,n));break;default:Tl(e,t,n)}}function Dl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ol(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,jl(r,e)}Dl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)kl(e),e=e.sibling}function kl(e){switch(e.tag){case 0:case 11:case 15:Ol(e),e.flags&2048&&Ic(9,e,e.return);break;case 3:Ol(e);break;case 12:Ol(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Al(e)):Ol(e);break;default:Ol(e)}}function Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,jl(r,e)}Dl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ic(8,t,t.return),Al(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Al(t));break;default:Al(t)}e=e.sibling}}function jl(e,t){for(;Qc!==null;){var n=Qc;switch(n.tag){case 0:case 11:case 15:Ic(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ca(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Qc=r;else a:for(n=e;Qc!==null;){r=Qc;var i=r.sibling,a=r.return;if(tl(r),r===n){Qc=null;break a}if(i!==null){i.return=a,Qc=i;break a}Qc=a}}}var Ml={getCacheForType:function(e){var t=ea(oa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ea(oa).controller.signal}},Nl=typeof WeakMap==`function`?WeakMap:Map,Pl=0,Fl=null,Z=null,Q=0,Il=0,Ll=null,Rl=!1,zl=!1,Bl=!1,Vl=0,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=null,Yl=null,Xl=!1,Zl=0,Ql=0,$l=1/0,eu=null,tu=null,nu=0,ru=null,iu=null,au=0,ou=0,su=null,cu=null,lu=0,uu=null;function du(){return Pl&2&&Q!==0?Q&-Q:P.T===null?rt():ud()}function fu(){if(Kl===0)if(!(Q&536870912)||B){var e=He;He<<=1,!(He&3932160)&&(He=262144),Kl=e}else Kl=536870912;return e=$a.current,e!==null&&(e.flags|=32),Kl}function pu(e,t,n){(e===Fl&&(Il===2||Il===9)||e.cancelPendingCommit!==null)&&(bu(e,0),_u(e,Q,Kl,!1)),Xe(e,n),(!(Pl&2)||e!==Fl)&&(e===Fl&&(!(Pl&2)&&(Wl|=n),Hl===4&&_u(e,Q,Kl,!1)),nd(e))}function mu(e,t,n){if(Pl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ke(e,t),a=r?Ou(e,t):Eu(e,t,!0),o=r;do{if(a===0){zl&&!r&&_u(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!gu(n)){a=Eu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Jl;var l=c.current.memoizedState.isDehydrated;if(l&&(bu(c,s).flags|=256),s=Eu(c,s,!1),s!==2){if(Bl&&!l){c.errorRecoveryDisabledLanes|=o,Wl|=o,a=4;break a}o=Yl,Yl=a,o!==null&&(Yl===null?Yl=o:Yl.push.apply(Yl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){bu(e,0),_u(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:_u(r,t,Kl,!Rl);break a;case 2:Yl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Zl+300-Te(),10<a)){if(_u(r,t,Kl,!Rl),Ge(r,0,!0)!==0)break a;au=t,r.timeoutHandle=Kd(hu.bind(null,r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,o,`Throttled`,-0,0),a);break a}hu(r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,o,null,-0,0)}}break}while(1);nd(e)}function hu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:$t},El(t,a,d);var m=(a&62914560)===a?Zl-Te():(a&4194048)===a?Ql-Te():0;if(m=qf(d,m),m!==null){au=a,e.cancelPendingCommit=m(Fu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),_u(e,a,o,!l);return}}Fu(e,t,a,n,r,i,o,s,c)}function gu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!xr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function _u(e,t,n,r){t&=~Gl,t&=~Wl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Le(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Qe(e,n,t)}function vu(){return Pl&6?!0:(rd(0,!1),!1)}function yu(){if(Z!==null){if(Il===0)var e=Z.return;else e=Z,Ki=Gi=null,Co(e),Aa=null,ja=0,e=Z;for(;e!==null;)Pc(e.alternate,e),e=e.return;Z=null}}function bu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),au=0,yu(),Fl=e,Z=n=li(e.current,null),Q=t,Il=0,Ll=null,Rl=!1,zl=Ke(e,t),Bl=!1,ql=Kl=Gl=Wl=Ul=Hl=0,Yl=Jl=null,Xl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Le(r),a=1<<i;t|=e[i],r&=~a}return Vl=t,$r(),n}function xu(e,t){G=null,P.H=js,t===xa||t===Ca?(t=Oa(),Il=3):t===Sa?(t=Oa(),Il=4):Il=t===Ys?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Ll=t,Z===null&&(Hl=1,Us(e,_i(t,e.current)))}function Su(){var e=$a.current;return e===null?!0:(Q&4194048)===Q?eo===null:(Q&62914560)===Q||Q&536870912?e===eo:!1}function Cu(){var e=P.H;return P.H=js,e===null?js:e}function wu(){var e=P.A;return P.A=Ml,e}function Tu(){Hl=4,Rl||(Q&4194048)!==Q&&$a.current!==null||(zl=!0),!(Ul&134217727)&&!(Wl&134217727)||Fl===null||_u(Fl,Q,Kl,!1)}function Eu(e,t,n){var r=Pl;Pl|=2;var i=Cu(),a=wu();(Fl!==e||Q!==t)&&(eu=null,bu(e,t)),t=!1;var o=Hl;a:do try{if(Il!==0&&Z!==null){var s=Z,c=Ll;switch(Il){case 8:yu(),o=6;break a;case 3:case 2:case 9:case 6:$a.current===null&&(t=!0);var l=Il;if(Il=0,Ll=null,Mu(e,s,c,l),n&&zl){o=0;break a}break;default:l=Il,Il=0,Ll=null,Mu(e,s,c,l)}}Du(),o=Hl;break}catch(t){xu(e,t)}while(1);return t&&e.shellSuspendCounter++,Ki=Gi=null,Pl=r,P.H=i,P.A=a,Z===null&&(Fl=null,Q=0,$r()),o}function Du(){for(;Z!==null;)Au(Z)}function Ou(e,t){var n=Pl;Pl|=2;var r=Cu(),a=wu();Fl!==e||Q!==t?(eu=null,$l=Te()+500,bu(e,t)):zl=Ke(e,t);a:do try{if(Il!==0&&Z!==null){t=Z;var o=Ll;b:switch(Il){case 1:Il=0,Ll=null,Mu(e,t,o,1);break;case 2:case 9:if(Ta(o)){Il=0,Ll=null,ju(t);break}t=function(){Il!==2&&Il!==9||Fl!==e||(Il=7),nd(e)},o.then(t,t);break a;case 3:Il=7;break a;case 4:Il=5;break a;case 7:Ta(o)?(Il=0,Ll=null,ju(t)):(Il=0,Ll=null,Mu(e,t,o,7));break;case 5:var s=null;switch(Z.tag){case 26:s=Z.memoizedState;case 5:case 27:var c=Z;if(s?Wf(s):c.stateNode.complete){Il=0,Ll=null;var l=c.sibling;if(l!==null)Z=l;else{var u=c.return;u===null?Z=null:(Z=u,Nu(u))}break b}}Il=0,Ll=null,Mu(e,t,o,5);break;case 6:Il=0,Ll=null,Mu(e,t,o,6);break;case 8:yu(),Hl=6;break a;default:throw Error(i(462))}}ku();break}catch(t){xu(e,t)}while(1);return Ki=Gi=null,P.H=r,P.A=a,Pl=n,Z===null?(Fl=null,Q=0,$r(),Hl):0}function ku(){for(;Z!==null&&!Ce();)Au(Z)}function Au(e){var t=Tc(e.alternate,e,Vl);e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function ju(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=lc(n,t,t.pendingProps,t.type,void 0,Q);break;case 11:t=lc(n,t,t.pendingProps,t.type.render,t.ref,Q);break;case 5:Co(t);default:Pc(n,t),t=Z=ui(t,Vl),t=Tc(n,t,Vl)}e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function Mu(e,t,n,r){Ki=Gi=null,Co(t),Aa=null,ja=0;var i=t.return;try{if(Js(e,i,t,n,Q)){Hl=1,Us(e,_i(n,e.current)),Z=null;return}}catch(t){if(i!==null)throw Z=i,t;Hl=1,Us(e,_i(n,e.current)),Z=null;return}t.flags&32768?(B||r===1?e=!0:zl||Q&536870912?e=!1:(Rl=e=!0,(r===2||r===9||r===3||r===6)&&(r=$a.current,r!==null&&r.tag===13&&(r.flags|=16384))),Pu(t,e)):Nu(t)}function Nu(e){var t=e;do{if(t.flags&32768){Pu(t,Rl);return}e=t.return;var n=Mc(t.alternate,t,Vl);if(n!==null){Z=n;return}if(t=t.sibling,t!==null){Z=t;return}Z=t=e}while(t!==null);Hl===0&&(Hl=5)}function Pu(e,t){do{var n=Nc(e.alternate,e);if(n!==null){n.flags&=32767,Z=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Z=e;return}Z=e=n}while(e!==null);Hl=6,Z=null}function Fu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Bu();while(nu!==0);if(Pl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Qr,Ze(e,n,o,s,c,l),e===Fl&&(Z=Fl=null,Q=0),iu=t,ru=e,au=n,ou=o,su=a,cu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yu(ke,function(){return Vu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=P.T,P.T=null,a=F.p,F.p=2,s=Pl,Pl|=4;try{$c(e,t,n)}finally{Pl=s,F.p=a,P.T=r}}nu=1,Iu(),Lu(),Ru()}}function Iu(){if(nu===1){nu=0;var e=ru,t=iu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=Pl;Pl|=4;try{fl(t,e);var a=zd,o=Er(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Tr(s.ownerDocument.documentElement,s)){if(c!==null&&Dr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=wr(s,h),v=wr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{Pl=i,F.p=r,P.T=n}}e.current=t,nu=2}}function Lu(){if(nu===2){nu=0;var e=ru,t=iu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=Pl;Pl|=4;try{el(e,t.alternate,t)}finally{Pl=i,F.p=r,P.T=n}}nu=3}}function Ru(){if(nu===4||nu===3){nu=0,we();var e=ru,t=iu,n=au,r=cu;t.subtreeFlags&10256||t.flags&10256?nu=5:(nu=0,iu=ru=null,zu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(tu=null),nt(n),t=t.stateNode,Fe&&typeof Fe.onCommitFiberRoot==`function`)try{Fe.onCommitFiberRoot(Pe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=P.T,i=F.p,F.p=2,P.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{P.T=t,F.p=i}}au&3&&Bu(),nd(e),i=e.pendingLanes,n&261930&&i&42?e===uu?lu++:(lu=0,uu=e):lu=0,rd(0,!1)}}function zu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ca(t)))}function Bu(){return Iu(),Lu(),Ru(),Vu()}function Vu(){if(nu!==5)return!1;var e=ru,t=ou;ou=0;var n=nt(au),r=P.T,a=F.p;try{F.p=32>n?32:n,P.T=null,n=su,su=null;var o=ru,s=au;if(nu=0,iu=ru=null,au=0,Pl&6)throw Error(i(331));var c=Pl;if(Pl|=4,kl(o.current),xl(o,o.current,s,n),Pl=c,rd(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot==`function`)try{Fe.onPostCommitFiberRoot(Pe,o)}catch{}return!0}finally{F.p=a,P.T=r,zu(e,t)}}function Hu(e,t,n){t=_i(n,t),t=Gs(e.stateNode,t,2),e=Va(e,t,2),e!==null&&(Xe(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(tu===null||!tu.has(r))){e=_i(n,e),n=Ks(2),r=Va(t,n,2),r!==null&&(qs(n,r,t,e),Xe(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Nl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Bl=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Fl===e&&(Q&n)===n&&(Hl===4||Hl===3&&(Q&62914560)===Q&&300>Te()-Zl?!(Pl&2)&&bu(e,0):Gl|=n,ql===Q&&(ql=0)),nd(e)}function Ku(e,t){t===0&&(t=Je()),e=ni(e,t),e!==null&&(Xe(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Ku(e,n)}function Yu(e,t){return xe(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Le(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=Q,a=Ge(r,r===Fl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ke(r,a)||(n=!0,cd(r,a));r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=Te(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}nu!==0&&nu!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Le(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=qe(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Fl,n=Q,n=Ge(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Il===2||Il===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Se(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ke(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Se(r),nt(n)){case 2:case 8:n=Oe;break;case 32:n=ke;break;case 268435456:n=je;break;default:n=ke}return r=sd.bind(null,e),n=xe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Se(r),e.callbackPriority=2,e.callbackNode=null,2}function sd(e,t){if(nu!==0&&nu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Bu()&&e.callbackNode!==n)return null;var r=Q;return r=Ge(e,e===Fl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(mu(e,r,t),od(e,Te()),e.callbackNode!=null&&e.callbackNode===n?sd.bind(null,e):null)}function cd(e,t){if(Bu())return null;mu(e,t,!0)}function ld(){Yd(function(){Pl&6?xe(De,id):ad()})}function ud(){if(td===0){var e=da;e===0&&(e=Ve,Ve<<=1,!(Ve&261888)&&(Ve=256)),td=e}return td}function dd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Qt(``+e)}function fd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function pd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=dd((i[st]||null).action),o=r.submitter;o&&(t=(t=o[st]||null)?dd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new xn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(td!==0){var e=o?fd(i,o):new FormData(i);vs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?fd(i,o):new FormData(i),vs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var md=0;md<qr.length;md++){var hd=qr[md];Jr(hd.toLowerCase(),`on`+(hd[0].toUpperCase()+hd.slice(1)))}Jr(zr,`onAnimationEnd`),Jr(Br,`onAnimationIteration`),Jr(Vr,`onAnimationStart`),Jr(`dblclick`,`onDoubleClick`),Jr(`focusin`,`onFocus`),Jr(`focusout`,`onBlur`),Jr(Hr,`onTransitionRun`),Jr(Ur,`onTransitionStart`),Jr(Wr,`onTransitionCancel`),Jr(Gr,`onTransitionEnd`),Ct(`onMouseEnter`,[`mouseout`,`mouseover`]),Ct(`onMouseLeave`,[`mouseout`,`mouseover`]),Ct(`onPointerEnter`,[`pointerout`,`pointerover`]),Ct(`onPointerLeave`,[`pointerout`,`pointerover`]),St(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),St(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),St(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),St(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),St(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),St(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var gd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),_d=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(gd));function vd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[lt];n===void 0&&(n=t[lt]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,bt.forEach(function(t){t!==`selectionchange`&&(_d.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!un||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Cd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=ht(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}sn(function(){var r=a,i=tn(n),s=[];a:{var c=Kr.get(e);if(c!==void 0){var l=xn,u=e;switch(e){case`keypress`:if(gn(n)===0)break a;case`keydown`:case`keyup`:l=zn;break;case`focusin`:u=`focus`,l=An;break;case`focusout`:u=`blur`,l=An;break;case`beforeblur`:case`afterblur`:l=An;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=On;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=kn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Vn;break;case zr:case Br:case Vr:l=jn;break;case Gr:l=Hn;break;case`scroll`:case`scrollend`:l=Cn;break;case`wheel`:l=Un;break;case`copy`:case`cut`:case`paste`:l=Mn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Bn;break;case`toggle`:case`beforetoggle`:l=Wn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=cn(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==en&&(u=n.relatedTarget||n.fromElement)&&(ht(u)||u[ct]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?ht(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=On,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Bn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:_t(l),h=u==null?c:_t(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ht(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Ed,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Dd(s,c,l,d,!1),u!==null&&f!==null&&Dd(s,f,u,d,!0)}}a:{if(c=r?_t(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=lr;else if(rr(c))if(ur)v=yr;else{v=_r;var y=gr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Yt(r.elementType)&&(v=lr):v=vr;if(v&&=v(e,r)){ir(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Vt(c,`number`,c.value)}switch(y=r?_t(r):window,e){case`focusin`:(rr(y)||y.contentEditable===`true`)&&(kr=y,Ar=r,jr=null);break;case`focusout`:jr=Ar=kr=null;break;case`mousedown`:Mr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Mr=!1,Nr(s,n,i);break;case`selectionchange`:if(Or)break;case`keydown`:case`keyup`:Nr(s,n,i)}var b;if(Kn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else $n?Qn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Yn&&n.locale!==`ko`&&($n||x!==`onCompositionStart`?x===`onCompositionEnd`&&$n&&(b=hn()):(fn=i,pn=`value`in fn?fn.value:fn.textContent,$n=!0)),y=Td(r,x),0<y.length&&(x=new Nn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=z(n),b!==null&&(x.data=b)))),(b=Jn?er(e,n):tr(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new Nn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),pd(s,e,r,n,i)}vd(s,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=cn(e,n),i!=null&&r.unshift(wd(e,i,a)),i=cn(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=cn(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=cn(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
9
9
  `).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Gt(e,``+r);break;case`className`:kt(e,`class`,r);break;case`tabIndex`:kt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:kt(e,n,r);break;case`style`:Jt(e,r,o);break;case`data`:if(t!==`object`){kt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,a.name,a,null),Md(e,t,`formEncType`,a.formEncType,a,null),Md(e,t,`formMethod`,a.formMethod,a,null),Md(e,t,`formTarget`,a.formTarget,a,null)):(Md(e,t,`encType`,a.encType,a,null),Md(e,t,`method`,a.method,a,null),Md(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Qt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),Ot(e,`popover`,r);break;case`xlinkActuate`:At(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:At(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:At(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:At(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ot(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Xt.get(n)||n,Ot(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:Jt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Gt(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!xt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[st]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ot(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,o,s,n,null)}}a&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:$(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Md(e,t,r,d,n,null)}}Bt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in $(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Md(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Ht(e,!!r,n,!0):Ht(e,!!r,t,!1);return;case`textarea`:for(s in $(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Md(e,t,s,c,n,null)}Wt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<gd.length;r++)$(gd[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Yt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}zt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Md(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Md(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ht(e,!!n,n?[]:``,!1):Ht(e,!!n,t,!0)):Ht(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Md(e,t,s,a,r,o)}Ut(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Yt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e===Wd?!1:(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[pt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),mt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[pt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);mt(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=F.d;F.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=vu();return e||t}function yf(e){var t=gt(e);t!==null&&t.tag===5&&t.type===`form`?bs(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Rt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Rt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Rt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Rt(n.imageSizes)+`"]`)):i+=`[href="`+Rt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Rt(r)+`"][href="`+Rt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),yt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=vt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);yt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=vt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),yt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=vt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),yt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=se.current)?gf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=vt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=vt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=vt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Af(e){return`href="`+Rt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),yt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Rt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Rt(n.href)+`"]`);if(r)return t.instance=r,yt(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),yt(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,yt(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),yt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,yt(a),a):(r=n,(a=mf.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),yt(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[pt]||a[ot]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,yt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),yt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ye(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ye(0),this.hiddenUpdates=Ye(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=si(3,null,null,t),e.current=a,a.stateNode=e,t=sa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ra(a),e}function tp(e){return e?(e=ai,e):ai}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ba(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Va(e,r,t),n!==null&&(pu(n,e,t),Ha(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=ni(e,67108864);t!==null&&pu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=du();t=tt(t);var n=ni(e,t);n!==null&&pu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=2,up(e,t,n,r)}finally{F.p=a,P.T=i}}function lp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=8,up(e,t,n,r)}finally{F.p=a,P.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=gt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=We(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Le(o);s.entanglements[1]|=c,o&=~c}nd(a),!(Pl&6)&&($l=Te()+500,rd(0,!1))}}break;case 31:case 13:s=ni(a,2),s!==null&&pu(s,a,2),vu(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=tn(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=ht(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ee()){case De:return 2;case Oe:return 8;case ke:case Ae:return 32;case je:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=gt(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=ht(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,it(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,it(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);en=r,n.target.dispatchEvent(r),en=null}else return t=gt(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=gt(n);a!==null&&(e.splice(t,3),t-=3,vs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[st]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[st]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,du(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),vu(),t[ct]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=rt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.5`)throw Error(i(527,Lp,`19.2.5`));F.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:P,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Pe=zp.inject(Rp),Fe=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Bs,s=Vs,c=Hs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[ct]=t.current,xd(e),new Fp(t)}})),g=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=`modulepreload`,v=function(e){return`/dashboard/`+e},y={},b=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=v(t,n),t in y)return;y[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:_,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},x=c(u(),1),S=`popstate`;function C(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function w(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return k(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:A(t)}return M(t,n,null,e)}function T(e,t){if(e===!1||e==null)throw Error(t)}function E(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function D(){return Math.random().toString(36).substring(2,10)}function O(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function k(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?j(t):t,state:n,key:t&&t.key||r||D(),unstable_mask:i}}function A({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function j(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function M(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=C(e)?e:k(h.location,e,t);n&&n(r,e),l=u()+1;let d=O(r,l),f=h.createHref(r.unstable_mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=C(e)?e:k(h.location,e,t);n&&n(r,e),l=u();let i=O(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return N(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(S,d),c=e,()=>{i.removeEventListener(S,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function N(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),T(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:A(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function ee(e,t,n=`/`){return te(e,t,n,!1)}function te(e,t,n,r){let i=me((typeof t==`string`?j(t):t).pathname||`/`,n);if(i==null)return null;let a=F(e);ne(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=pe(i);o=ue(a[e],t,r)}return o}function P(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function F(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;T(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=Ce([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(T(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),F(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:ce(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of I(e.path))a(e,t,!0,n)}),t}function I(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=I(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ne(e){e.sort((e,t)=>e.score===t.score?le(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var re=/^:[\w-]+$/,ie=3,L=2,R=1,ae=10,oe=-2,se=e=>e===`*`;function ce(e,t){let n=e.split(`/`),r=n.length;return n.some(se)&&(r+=oe),t&&(r+=L),n.filter(e=>!se(e)).reduce((e,t)=>e+(re.test(t)?ie:t===``?R:ae),r)}function le(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function ue(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=de({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=de({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:Ce([a,u.pathname]),pathnameBase:Te(Ce([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=Ce([a,u.pathnameBase]))}return o}function de(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=fe(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function fe(e,t=!1,n=!0){E(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function pe(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return E(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function me(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var he=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function ge(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?j(e):e,a;return n?(n=Se(n),a=n.startsWith(`/`)?_e(n.substring(1),`/`):_e(n,t)):a=t,{pathname:a,search:Ee(r),hash:De(i)}}function _e(e,t){let n=we(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ve(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ye(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function be(e){let t=ye(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function xe(e,t,n,r=!1){let i;typeof e==`string`?i=j(e):(i={...e},T(!i.pathname||!i.pathname.includes(`?`),ve(`?`,`pathname`,`search`,i)),T(!i.pathname||!i.pathname.includes(`#`),ve(`#`,`pathname`,`hash`,i)),T(!i.search||!i.search.includes(`#`),ve(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=ge(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Se=e=>e.replace(/\/\/+/g,`/`),Ce=e=>Se(e.join(`/`)),we=e=>e.replace(/\/+$/,``),Te=e=>we(e).replace(/^\/*/,`/`),Ee=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,De=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Oe=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function ke(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Ae(e){return Ce(e.map(e=>e.route.path).filter(Boolean))||`/`}var je=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Me(e,t){let n=e;if(typeof n!=`string`||!he.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(je)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=me(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{E(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Ne=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Ne);var Pe=[`GET`,...Ne];new Set(Pe);var Fe=x.createContext(null);Fe.displayName=`DataRouter`;var Ie=x.createContext(null);Ie.displayName=`DataRouterState`;var Le=x.createContext(!1);function Re(){return x.useContext(Le)}var ze=x.createContext({isTransitioning:!1});ze.displayName=`ViewTransition`;var Be=x.createContext(new Map);Be.displayName=`Fetchers`;var Ve=x.createContext(null);Ve.displayName=`Await`;var He=x.createContext(null);He.displayName=`Navigation`;var Ue=x.createContext(null);Ue.displayName=`Location`;var We=x.createContext({outlet:null,matches:[],isDataRoute:!1});We.displayName=`Route`;var Ge=x.createContext(null);Ge.displayName=`RouteError`;var Ke=`REACT_ROUTER_ERROR`,qe=`REDIRECT`,Je=`ROUTE_ERROR_RESPONSE`;function Ye(e){if(e.startsWith(`${Ke}:${qe}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Xe(e){if(e.startsWith(`${Ke}:${Je}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Oe(t.status,t.statusText,t.data)}catch{}}function Ze(e,{relative:t}={}){T(Qe(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=x.useContext(He),{hash:i,pathname:a,search:o}=st(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Ce([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Qe(){return x.useContext(Ue)!=null}function $e(){return T(Qe(),`useLocation() may be used only in the context of a <Router> component.`),x.useContext(Ue).location}var et=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function tt(e){x.useContext(He).static||x.useLayoutEffect(e)}function nt(){let{isDataRoute:e}=x.useContext(We);return e?Et():rt()}function rt(){T(Qe(),`useNavigate() may be used only in the context of a <Router> component.`);let e=x.useContext(Fe),{basename:t,navigator:n}=x.useContext(He),{matches:r}=x.useContext(We),{pathname:i}=$e(),a=JSON.stringify(be(r)),o=x.useRef(!1);return tt(()=>{o.current=!0}),x.useCallback((r,s={})=>{if(E(o.current,et),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=xe(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Ce([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var it=x.createContext(null);function at(e){let t=x.useContext(We).outlet;return x.useMemo(()=>t&&x.createElement(it.Provider,{value:e},t),[t,e])}function ot(){let{matches:e}=x.useContext(We);return e[e.length-1]?.params??{}}function st(e,{relative:t}={}){let{matches:n}=x.useContext(We),{pathname:r}=$e(),i=JSON.stringify(be(n));return x.useMemo(()=>xe(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function ct(e,t){return lt(e,t)}function lt(e,t,n){T(Qe(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=x.useContext(He),{matches:i}=x.useContext(We),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Ot(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
10
10
 
11
- Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=$e(),d;if(t){let e=typeof t==`string`?j(t):t;T(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=ee(e,{pathname:p});E(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),E(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=gt(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Ce([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Ce([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?x.createElement(Ue.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function ut(){let e=Tt(),t=ke(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=x.createElement(x.Fragment,null,x.createElement(`p`,null,`💿 Hey developer 👋`),x.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,x.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,x.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),x.createElement(x.Fragment,null,x.createElement(`h2`,null,`Unexpected Application Error!`),x.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?x.createElement(`pre`,{style:i},n):null,o)}var dt=x.createElement(ut,null),ft=class extends x.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Xe(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:x.createElement(We.Provider,{value:this.props.routeContext},x.createElement(Ge.Provider,{value:e,children:this.props.component}));return this.context?x.createElement(mt,{error:e},t):t}};ft.contextType=Le;var pt=new WeakMap;function mt({children:e,error:t}){let{basename:n}=x.useContext(He);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Ye(t.digest);if(e){let r=pt.get(t);if(r)throw r;let i=Me(e.location,n);if(je&&!pt.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw pt.set(t,n),n}return x.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function ht({routeContext:e,match:t,children:n}){let r=x.useContext(Fe);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(We.Provider,{value:e},n)}function gt(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);T(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:Ae(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||dt,o&&(s<0&&c===0?(Ot(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?x.createElement(n.route.Component,null):n.route.element?n.route.element:e,x.createElement(ht,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?x.createElement(ft,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function _t(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vt(e){let t=x.useContext(Fe);return T(t,_t(e)),t}function yt(e){let t=x.useContext(Ie);return T(t,_t(e)),t}function bt(e){let t=x.useContext(We);return T(t,_t(e)),t}function xt(e){let t=bt(e),n=t.matches[t.matches.length-1];return T(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function St(){return xt(`useRouteId`)}function Ct(){return yt(`useNavigation`).navigation}function wt(){let{matches:e,loaderData:t}=yt(`useMatches`);return x.useMemo(()=>e.map(e=>P(e,t)),[e,t])}function Tt(){let e=x.useContext(Ge),t=yt(`useRouteError`),n=xt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Et(){let{router:e}=vt(`useNavigate`),t=xt(`useNavigate`),n=x.useRef(!1);return tt(()=>{n.current=!0}),x.useCallback(async(r,i={})=>{E(n.current,et),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Dt={};function Ot(e,t,n){!t&&!Dt[e]&&(Dt[e]=!0,E(!1,n))}x.memo(kt);function kt({routes:e,future:t,state:n,isStatic:r,onError:i}){return lt(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function At({to:e,replace:t,state:n,relative:r}){T(Qe(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=x.useContext(He);E(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=x.useContext(We),{pathname:o}=$e(),s=nt(),c=xe(e,be(a),o,r===`path`),l=JSON.stringify(c);return x.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function jt(e){return at(e.context)}function Mt(e){T(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Nt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){T(!Qe(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=x.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=j(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=x.useMemo(()=>{let e=me(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return E(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:x.createElement(He.Provider,{value:c},x.createElement(Ue.Provider,{children:t,value:h}))}function Pt({children:e,location:t}){return ct(Ft(e),t)}x.Component;function Ft(e,t=[]){let n=[];return x.Children.forEach(e,(e,r)=>{if(!x.isValidElement(e))return;let i=[...t,r];if(e.type===x.Fragment){n.push.apply(n,Ft(e.props.children,i));return}T(e.type===Mt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),T(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Ft(e.props.children,i)),n.push(a)}),n}var It=`get`,Lt=`application/x-www-form-urlencoded`;function Rt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function zt(e){return Rt(e)&&e.tagName.toLowerCase()===`button`}function Bt(e){return Rt(e)&&e.tagName.toLowerCase()===`form`}function Vt(e){return Rt(e)&&e.tagName.toLowerCase()===`input`}function Ht(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ut(e,t){return e.button===0&&(!t||t===`_self`)&&!Ht(e)}function Wt(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Gt(e,t){let n=Wt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Kt=null;function qt(){if(Kt===null)try{new FormData(document.createElement(`form`),0),Kt=!1}catch{Kt=!0}return Kt}var Jt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Yt(e){return e!=null&&!Jt.has(e)?(E(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Lt}"`),null):e}function Xt(e,t){let n,r,i,a,o;if(Bt(e)){let o=e.getAttribute(`action`);r=o?me(o,t):null,n=e.getAttribute(`method`)||It,i=Yt(e.getAttribute(`enctype`))||Lt,a=new FormData(e)}else if(zt(e)||Vt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?me(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||It,i=Yt(e.getAttribute(`formenctype`))||Yt(o.getAttribute(`enctype`))||Lt,a=new FormData(o,e),!qt()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Rt(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=It,r=null,i=Lt,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Zt={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Qt=/[&><\u2028\u2029]/g;function $t(e){return e.replace(Qt,e=>Zt[e])}function en(e,t){if(e===!1||e==null)throw Error(t)}function tn(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&me(i.pathname,t)===`/`?i.pathname=`${we(t)}/_root.${r}`:i.pathname=`${we(i.pathname)}.${r}`,i}async function nn(e,t){if(e.id in t)return t[e.id];try{let n=await b(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function rn(e){return e!=null&&typeof e.page==`string`}function an(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function on(e,t,n){return dn((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await nn(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(an).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function sn(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function cn(e,t,{includeHydrateFallback:n}={}){return ln(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function ln(e){return[...new Set(e)]}function un(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function dn(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!rn(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(un(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function fn(){let e=x.useContext(Fe);return en(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function pn(){let e=x.useContext(Ie);return en(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var mn=x.createContext(void 0);mn.displayName=`FrameworkContext`;function hn(){let e=x.useContext(mn);return en(e,`You must render this element inside a <HydratedRouter> element`),e}function gn(e,t){let n=x.useContext(mn),[r,i]=x.useState(!1),[a,o]=x.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=x.useRef(null);x.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),x.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:_n(s,p),onBlur:_n(c,m),onMouseEnter:_n(l,p),onMouseLeave:_n(u,m),onTouchStart:_n(d,p)}]:[a,f,{}]:[!1,f,{}]}function _n(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function vn({page:e,...t}){let n=Re(),{router:r}=fn(),i=x.useMemo(()=>ee(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?x.createElement(bn,{page:e,matches:i,...t}):x.createElement(xn,{page:e,matches:i,...t}):null}function yn(e){let{manifest:t,routeModules:n}=hn(),[r,i]=x.useState([]);return x.useEffect(()=>{let r=!1;return on(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function bn({page:e,matches:t,...n}){let r=$e(),{future:i}=hn(),{basename:a}=fn(),o=x.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=tn(e,a,i.unstable_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.unstable_trailingSlashAwareDataRequests,e,r,t]);return x.createElement(x.Fragment,null,o.map(e=>x.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function xn({page:e,matches:t,...n}){let r=$e(),{future:i,manifest:a,routeModules:o}=hn(),{basename:s}=fn(),{loaderData:c,matches:l}=pn(),u=x.useMemo(()=>sn(e,t,l,a,r,`data`),[e,t,l,a,r]),d=x.useMemo(()=>sn(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=x.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=tn(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=x.useMemo(()=>cn(d,a),[d,a]),m=yn(d);return x.createElement(x.Fragment,null,f.map(e=>x.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>x.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>x.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Sn(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}x.Component;var Cn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Cn&&(window.__reactRouterVersion=`7.14.2`)}catch{}function wn({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=x.useRef();i.current??=w({window:r,v5Compat:!0});let a=i.current,[o,s]=x.useState({action:a.action,location:a.location}),c=x.useCallback(e=>{n===!1?s(e):x.startTransition(()=>s(e))},[n]);return x.useLayoutEffect(()=>a.listen(c),[a,c]),x.createElement(Nt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function Tn({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=x.useState({action:n.action,location:n.location}),o=x.useCallback(e=>{r===!1?a(e):x.startTransition(()=>a(e))},[r]);return x.useLayoutEffect(()=>n.listen(o),[n,o]),x.createElement(Nt,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Tn.displayName=`unstable_HistoryRouter`;var En=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Dn=x.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,unstable_mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,unstable_useTransitions:_}=x.useContext(He),v=typeof l==`string`&&En.test(l),y=Me(l,h);l=y.to;let b=Ze(l,{relative:r}),S=$e(),C=null;if(o){let e=xe(o,[],S.unstable_mask?S.unstable_mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Ce([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=gn(n,p),D=Pn(l,{replace:a,unstable_mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:_});function O(t){e&&e(t),t.defaultPrevented||D(t)}let k=!(y.isExternal||i),A=x.createElement(`a`,{...p,...E,href:(k?C:void 0)||y.absoluteURL||b,onClick:k?O:e,ref:Sn(m,T),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return w&&!v?x.createElement(x.Fragment,null,A,x.createElement(vn,{page:b})):A});Dn.displayName=`Link`;var On=x.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=st(a,{relative:c.relative}),d=$e(),f=x.useContext(Ie),{navigator:p,basename:m}=x.useContext(He),h=f!=null&&Gn(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=me(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,S=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),C={isActive:b,isPending:S,isTransitioning:h},w=b?e:void 0,T;T=typeof n==`function`?n(C):[n,b?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return x.createElement(Dn,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});On.displayName=`NavLink`;var kn=x.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=It,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=x.useContext(He),g=Rn(),_=zn(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&En.test(s);return x.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?x.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});kn.displayName=`Form`;function An({getKey:e,storageKey:t,...n}){let r=x.useContext(mn),{basename:i}=x.useContext(He),a=$e(),o=wt();Un({getKey:e,storageKey:t});let s=x.useMemo(()=>{if(!r||!e)return null;let t=Hn(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return x.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${$t(JSON.stringify(t||Bn))}, ${$t(JSON.stringify(s))})`}})}An.displayName=`ScrollRestoration`;function jn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mn(e){let t=x.useContext(Fe);return T(t,jn(e)),t}function Nn(e){let t=x.useContext(Ie);return T(t,jn(e)),t}function Pn(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=nt(),d=$e(),f=st(e,{relative:o});return x.useCallback(p=>{if(Ut(p,t)){p.preventDefault();let t=n===void 0?A(d)===A(f):n,m=()=>u(e,{replace:t,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?x.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Fn(e){E(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=x.useRef(Wt(e)),n=x.useRef(!1),r=$e(),i=x.useMemo(()=>Gt(r.search,n.current?null:t.current),[r.search]),a=nt();return[i,x.useCallback((e,t)=>{let r=Wt(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var In=0,Ln=()=>`__${String(++In)}__`;function Rn(){let{router:e}=Mn(`useSubmit`),{basename:t}=x.useContext(He),n=St(),r=e.fetch,i=e.navigate;return x.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Xt(e,t);a.navigate===!1?await r(a.fetcherKey||Ln(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function zn(e,{relative:t}={}){let{basename:n}=x.useContext(He),r=x.useContext(We);T(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...st(e||`.`,{relative:t})},o=$e();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Ce([n,a.pathname])),A(a)}var Bn=`react-router-scroll-positions`,Vn={};function Hn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:me(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Un({getKey:e,storageKey:t}={}){let{router:n}=Mn(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Nn(`useScrollRestoration`),{basename:a}=x.useContext(He),o=$e(),s=wt(),c=Ct();x.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Wn(x.useCallback(()=>{if(c.state===`idle`){let t=Hn(o,s,a,e);Vn[t]=window.scrollY}try{sessionStorage.setItem(t||Bn,JSON.stringify(Vn))}catch(e){E(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(x.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Bn);e&&(Vn=JSON.parse(e))}catch{}},[t]),x.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Vn,()=>window.scrollY,e?(t,n)=>Hn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),x.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{E(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Wn(e,t){let{capture:n}=t||{};x.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Gn(e,{relative:t}={}){let n=x.useContext(ze);T(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Mn(`useViewTransitionState`),i=st(e,{relative:t});if(!n.isTransitioning)return!1;let a=me(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=me(n.nextLocation.pathname,r)||n.nextLocation.pathname;return de(i.pathname,o)!=null||de(i.pathname,a)!=null}var Kn=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),qn=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Jn=e=>{let t=qn(e);return t.charAt(0).toUpperCase()+t.slice(1)},Yn=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Xn=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},Zn={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Qn=(0,x.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,x.createElement)(`svg`,{ref:c,...Zn,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Yn(`lucide`,i),...!a&&!Xn(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,x.createElement)(e,t)),...Array.isArray(a)?a:[a]])),z=(e,t)=>{let n=(0,x.forwardRef)(({className:n,...r},i)=>(0,x.createElement)(Qn,{ref:i,iconNode:t,className:Yn(`lucide-${Kn(Jn(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Jn(e),n},$n=z(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),er=z(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),tr=z(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),nr=z(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),rr=z(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ir=z(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.9 4.9 14.2 14.2`,key:`1m5liu`}]]),ar=z(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),or=z(`brain`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`,key:`ep3f8r`}],[`path`,{d:`M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4`,key:`1p4c4q`}],[`path`,{d:`M17.599 6.5a3 3 0 0 0 .399-1.375`,key:`tmeiqw`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M19.938 10.5a4 4 0 0 1 .585.396`,key:`1qfode`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M19.967 17.484A4 4 0 0 1 18 18`,key:`159ez6`}]]),sr=z(`bug`,[[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M9 7.13v-1a3.003 3.003 0 1 1 6 0v1`,key:`d7y7pr`}],[`path`,{d:`M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6`,key:`xs1cw7`}],[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M6.53 9C4.6 8.8 3 7.1 3 5`,key:`32zzws`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`M3 21c0-2.1 1.7-3.9 3.8-4`,key:`4p0ekp`}],[`path`,{d:`M20.97 5c0 2.1-1.6 3.8-3.5 4`,key:`18gb23`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M17.2 17c2.1.1 3.8 1.9 3.8 4`,key:`k3fwyw`}]]),cr=z(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),lr=z(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ur=z(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),dr=z(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),fr=z(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),pr=z(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),mr=z(`circle-help`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),hr=z(`circle-pause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),gr=z(`circle-play`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polygon`,{points:`10 8 16 12 10 16 10 8`,key:`1cimsy`}]]),_r=z(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),vr=z(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),yr=z(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),br=z(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),xr=z(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Sr=z(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Cr=z(`corner-down-right`,[[`path`,{d:`m15 10 5 5-5 5`,key:`qqa56n`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),wr=z(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Tr=z(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Er=z(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Dr=z(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Or=z(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),kr=z(`file-code`,[[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z`,key:`1mlx9k`}]]),Ar=z(`file-diff`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),jr=z(`file-json-2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`fq0c9t`}],[`path`,{d:`M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`4gibmv`}]]),Mr=z(`file-minus-2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M3 15h6`,key:`4e2qda`}]]),Nr=z(`file-plus-2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M3 15h6`,key:`4e2qda`}],[`path`,{d:`M6 12v6`,key:`1u72j0`}]]),Pr=z(`file-stack`,[[`path`,{d:`M21 7h-3a2 2 0 0 1-2-2V2`,key:`9rb54x`}],[`path`,{d:`M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z`,key:`1059l0`}],[`path`,{d:`M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15`,key:`16874u`}],[`path`,{d:`M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11`,key:`k2ox98`}]]),Fr=z(`file-symlink`,[[`path`,{d:`m10 18 3-3-3-3`,key:`18f6ys`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 11V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7`,key:`50q2rw`}]]),Ir=z(`file-text`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Lr=z(`folder-kanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),Rr=z(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),zr=z(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Br=z(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Vr=z(`git-branch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),Hr=z(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),Ur=z(`hand`,[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]),Wr=z(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Gr=z(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),Kr=z(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),qr=z(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Jr=z(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Yr=z(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Xr=z(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Zr=z(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Qr=z(`list-tree`,[[`path`,{d:`M21 12h-8`,key:`1bmf0i`}],[`path`,{d:`M21 6H8`,key:`1pqkrb`}],[`path`,{d:`M21 18h-8`,key:`1tm79t`}],[`path`,{d:`M3 6v4c0 1.1.9 2 2 2h3`,key:`1ywdgy`}],[`path`,{d:`M3 10v6c0 1.1.9 2 2 2h3`,key:`2wc746`}]]),$r=z(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ei=z(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),ti=z(`message-square-reply`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`m10 7-3 3 3 3`,key:`1eugdv`}],[`path`,{d:`M17 13v-1a2 2 0 0 0-2-2H7`,key:`ernfh3`}]]),ni=z(`message-square`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),ri=z(`package-plus`,[[`path`,{d:`M16 16h6`,key:`100bgy`}],[`path`,{d:`M19 13v6`,key:`85cyf1`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),ii=z(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),ai=z(`panel-top-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`m9 16 3-3 3 3`,key:`1idcnm`}]]),oi=z(`pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),si=z(`pen-line`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),ci=z(`pencil-line`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}],[`path`,{d:`m15 5 3 3`,key:`1w25hb`}]]),li=z(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),ui=z(`play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),di=z(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),fi=z(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),pi=z(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),mi=z(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),hi=z(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),gi=z(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),_i=z(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),vi=z(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),yi=z(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),bi=z(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),xi=z(`settings-2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Si=z(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Ci=z(`settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),wi=z(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Ti=z(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ei=z(`sliders-horizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),Di=z(`sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),Oi=z(`square-kanban`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 7v7`,key:`1x2jlm`}],[`path`,{d:`M12 7v4`,key:`xawao1`}],[`path`,{d:`M16 7v9`,key:`1hp2iy`}]]),ki=z(`square-slash`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),Ai=z(`ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),ji=z(`trash-2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),Mi=z(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ni=z(`waypoints`,[[`circle`,{cx:`12`,cy:`4.5`,r:`2.5`,key:`r5ysbb`}],[`path`,{d:`m10.2 6.3-3.9 3.9`,key:`1nzqf6`}],[`circle`,{cx:`4.5`,cy:`12`,r:`2.5`,key:`jydg6v`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`circle`,{cx:`19.5`,cy:`12`,r:`2.5`,key:`1piiel`}],[`path`,{d:`m13.8 17.7 3.9-3.9`,key:`1wyg1y`}],[`circle`,{cx:`12`,cy:`19.5`,r:`2.5`,key:`13o1pw`}]]),B=z(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),Pi=z(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Fi=g();function Ii(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ii(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Li(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ii(e))&&(r&&(r+=` `),r+=t);return r}var Ri=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},zi=(e,t)=>({classGroupId:e,validator:t}),Bi=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Vi=`-`,Hi=[],Ui=`arbitrary..`,Wi=e=>{let t=qi(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Ki(e);let n=e.split(Vi);return Gi(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ri(i,t):t:i||Hi}return n[e]||Hi}}},Gi=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Gi(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Vi):e.slice(t).join(Vi),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Ki=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Ui+r:void 0})(),qi=e=>{let{theme:t,classGroups:n}=e;return Ji(n,t)},Ji=(e,t)=>{let n=Bi();for(let r in e){let i=e[r];Yi(i,n,r,t)}return n},Yi=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Xi(i,t,n,r)}},Xi=(e,t,n,r)=>{if(typeof e==`string`){Zi(e,t,n);return}if(typeof e==`function`){Qi(e,t,n,r);return}$i(e,t,n,r)},Zi=(e,t,n)=>{let r=e===``?t:ea(t,e);r.classGroupId=n},Qi=(e,t,n,r)=>{if(ta(e)){Yi(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(zi(n,e))},$i=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Yi(o,ea(t,a),n,r)}},ea=(e,t)=>{let n=e,r=t.split(Vi),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Bi(),n.nextPart.set(t,i)),n=i}return n},ta=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,na=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},ra=`!`,ia=`:`,aa=[],oa=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),sa=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===ia){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(ra)?(c=s.slice(0,-1),l=!0):s.startsWith(ra)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return oa(t,l,c,u)};if(t){let e=t+ia,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):oa(aa,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ca=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},la=e=>({cache:na(e.cacheSize),parseClassName:sa(e),sortModifiers:ca(e),...Wi(e)}),ua=/\s+/,da=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(ua),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+ra:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},fa=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=pa(n))&&(i&&(i+=` `),i+=r);return i},pa=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=pa(e[r]))&&(n&&(n+=` `),n+=t);return n},ma=(e,...t)=>{let n,r,i,a,o=o=>(n=la(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=da(e,n);return i(e,a),a};return a=o,(...e)=>a(fa(...e))},ha=[],ga=e=>{let t=t=>t[e]||ha;return t.isThemeGetter=!0,t},_a=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,va=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ya=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ba=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xa=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Sa=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ca=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,wa=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ta=e=>ya.test(e),V=e=>!!e&&!Number.isNaN(Number(e)),Ea=e=>!!e&&Number.isInteger(Number(e)),Da=e=>e.endsWith(`%`)&&V(e.slice(0,-1)),Oa=e=>ba.test(e),ka=()=>!0,Aa=e=>xa.test(e)&&!Sa.test(e),ja=()=>!1,Ma=e=>Ca.test(e),Na=e=>wa.test(e),Pa=e=>!H(e)&&!U(e),Fa=e=>Xa(e,eo,ja),H=e=>_a.test(e),Ia=e=>Xa(e,to,Aa),La=e=>Xa(e,no,V),Ra=e=>Xa(e,io,ka),za=e=>Xa(e,ro,ja),Ba=e=>Xa(e,Qa,ja),Va=e=>Xa(e,$a,Na),Ha=e=>Xa(e,ao,Ma),U=e=>va.test(e),Ua=e=>Za(e,to),Wa=e=>Za(e,ro),Ga=e=>Za(e,Qa),Ka=e=>Za(e,eo),qa=e=>Za(e,$a),Ja=e=>Za(e,ao,!0),Ya=e=>Za(e,io,!0),Xa=(e,t,n)=>{let r=_a.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Za=(e,t,n=!1)=>{let r=va.exec(e);return r?r[1]?t(r[1]):n:!1},Qa=e=>e===`position`||e===`percentage`,$a=e=>e===`image`||e===`url`,eo=e=>e===`length`||e===`size`||e===`bg-size`,to=e=>e===`length`,no=e=>e===`number`,ro=e=>e===`family-name`,io=e=>e===`number`||e===`weight`,ao=e=>e===`shadow`,oo=ma(()=>{let e=ga(`color`),t=ga(`font`),n=ga(`text`),r=ga(`font-weight`),i=ga(`tracking`),a=ga(`leading`),o=ga(`breakpoint`),s=ga(`container`),c=ga(`spacing`),l=ga(`radius`),u=ga(`shadow`),d=ga(`inset-shadow`),f=ga(`text-shadow`),p=ga(`drop-shadow`),m=ga(`blur`),h=ga(`perspective`),g=ga(`aspect`),_=ga(`ease`),v=ga(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),U,H],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[U,H,c],T=()=>[Ta,`full`,`auto`,...w()],E=()=>[Ea,`none`,`subgrid`,U,H],D=()=>[`auto`,{span:[`full`,Ea,U,H]},Ea,U,H],O=()=>[Ea,`auto`,U,H],k=()=>[`auto`,`min`,`max`,`fr`,U,H],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Ta,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ee=()=>[Ta,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],te=()=>[Ta,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,U,H],F=()=>[...b(),Ga,Ba,{position:[U,H]}],I=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ne=()=>[`auto`,`cover`,`contain`,Ka,Fa,{size:[U,H]}],re=()=>[Da,Ua,Ia],ie=()=>[``,`none`,`full`,l,U,H],L=()=>[``,V,Ua,Ia],R=()=>[`solid`,`dashed`,`dotted`,`double`],ae=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],oe=()=>[V,Da,Ga,Ba],se=()=>[``,`none`,m,U,H],ce=()=>[`none`,V,U,H],le=()=>[`none`,V,U,H],ue=()=>[V,U,H],de=()=>[Ta,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Oa],breakpoint:[Oa],color:[ka],container:[Oa],"drop-shadow":[Oa],ease:[`in`,`out`,`in-out`],font:[Pa],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Oa],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Oa],shadow:[Oa],spacing:[`px`,V],text:[Oa],"text-shadow":[Oa],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Ta,H,U,g]}],container:[`container`],columns:[{columns:[V,H,U,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Ea,`auto`,U,H]}],basis:[{basis:[Ta,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[V,Ta,`auto`,`initial`,`none`,H]}],grow:[{grow:[``,V,U,H]}],shrink:[{shrink:[``,V,U,H]}],order:[{order:[Ea,`first`,`last`,`none`,U,H]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...ee()]}],"min-inline-size":[{"min-inline":[`auto`,...ee()]}],"max-inline-size":[{"max-inline":[`none`,...ee()]}],"block-size":[{block:[`auto`,...te()]}],"min-block-size":[{"min-block":[`auto`,...te()]}],"max-block-size":[{"max-block":[`none`,...te()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,Ua,Ia]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Ya,Ra]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Da,H]}],"font-family":[{font:[Wa,za,t]}],"font-features":[{"font-features":[H]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,U,H]}],"line-clamp":[{"line-clamp":[V,`none`,U,La]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,U,H]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,U,H]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...R(),`wavy`]}],"text-decoration-thickness":[{decoration:[V,`from-font`,`auto`,U,Ia]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[V,`auto`,U,H]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,U,H]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,U,H]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Ea,U,H],radial:[``,U,H],conic:[Ea,U,H]},qa,Va]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:ie()}],"rounded-s":[{"rounded-s":ie()}],"rounded-e":[{"rounded-e":ie()}],"rounded-t":[{"rounded-t":ie()}],"rounded-r":[{"rounded-r":ie()}],"rounded-b":[{"rounded-b":ie()}],"rounded-l":[{"rounded-l":ie()}],"rounded-ss":[{"rounded-ss":ie()}],"rounded-se":[{"rounded-se":ie()}],"rounded-ee":[{"rounded-ee":ie()}],"rounded-es":[{"rounded-es":ie()}],"rounded-tl":[{"rounded-tl":ie()}],"rounded-tr":[{"rounded-tr":ie()}],"rounded-br":[{"rounded-br":ie()}],"rounded-bl":[{"rounded-bl":ie()}],"border-w":[{border:L()}],"border-w-x":[{"border-x":L()}],"border-w-y":[{"border-y":L()}],"border-w-s":[{"border-s":L()}],"border-w-e":[{"border-e":L()}],"border-w-bs":[{"border-bs":L()}],"border-w-be":[{"border-be":L()}],"border-w-t":[{"border-t":L()}],"border-w-r":[{"border-r":L()}],"border-w-b":[{"border-b":L()}],"border-w-l":[{"border-l":L()}],"divide-x":[{"divide-x":L()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":L()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...R(),`hidden`,`none`]}],"divide-style":[{divide:[...R(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...R(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[V,U,H]}],"outline-w":[{outline:[``,V,Ua,Ia]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,Ja,Ha]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,Ja,Ha]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:L()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[V,Ia]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":L()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,Ja,Ha]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[V,U,H]}],"mix-blend":[{"mix-blend":[...ae(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ae()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[V]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[U,H]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[V]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,U,H]}],filter:[{filter:[``,`none`,U,H]}],blur:[{blur:se()}],brightness:[{brightness:[V,U,H]}],contrast:[{contrast:[V,U,H]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Ja,Ha]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,V,U,H]}],"hue-rotate":[{"hue-rotate":[V,U,H]}],invert:[{invert:[``,V,U,H]}],saturate:[{saturate:[V,U,H]}],sepia:[{sepia:[``,V,U,H]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,U,H]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[V,U,H]}],"backdrop-contrast":[{"backdrop-contrast":[V,U,H]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,V,U,H]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[V,U,H]}],"backdrop-invert":[{"backdrop-invert":[``,V,U,H]}],"backdrop-opacity":[{"backdrop-opacity":[V,U,H]}],"backdrop-saturate":[{"backdrop-saturate":[V,U,H]}],"backdrop-sepia":[{"backdrop-sepia":[``,V,U,H]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,U,H]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[V,`initial`,U,H]}],ease:[{ease:[`linear`,`initial`,_,U,H]}],delay:[{delay:[V,U,H]}],animate:[{animate:[`none`,v,U,H]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,U,H]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":[`scale-3d`],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[U,H,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:de()}],"translate-x":[{"translate-x":de()}],"translate-y":[{"translate-y":de()}],"translate-z":[{"translate-z":de()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,U,H]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,U,H]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[V,Ua,Ia,La]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function W(...e){return oo(Li(e))}var so=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),G=o(((e,t)=>{t.exports=so()}))();function co({iconOnly:e=!1,className:t}){return(0,G.jsxs)(`span`,{className:W(`inline-flex items-center gap-2.5`,t),children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`relative inline-flex size-8 items-center justify-center rounded-xl bg-accent-500/12 ring-1 ring-accent-500/25`,children:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,className:`size-4 text-accent-300`,children:[(0,G.jsx)(`path`,{d:`M19 7.5A8 8 0 1 0 19 16.5`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`}),(0,G.jsx)(`circle`,{cx:`18.25`,cy:`12`,r:`1.6`,fill:`currentColor`})]})}),e?null:(0,G.jsx)(`span`,{className:`leading-none`,children:(0,G.jsx)(`span`,{className:`text-[17px] font-semibold tracking-tight text-fg`,children:`Coro`})})]})}var K=class extends Error{status;payload;constructor(e,t,n){super(e),this.name=`ApiError`,this.status=t,this.payload=n}};async function lo(e){return(e.headers.get(`content-type`)??``).includes(`application/json`)?e.json().catch(()=>null):e.text().catch(()=>null)}async function q(e,t){let n=await fetch(e,t),r=await lo(n);if(!n.ok)throw new K(typeof r==`object`&&r&&`error`in r&&typeof r.error==`string`?r.error:`HTTP ${n.status}`,n.status,r);return r}async function uo(e,t){let n=await fetch(e,t),r=await n.text();if(!n.ok)throw new K(r||`HTTP ${n.status}`,n.status,r);return r}function J(e,t){return{...t,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}}var fo={id:`job`,name:`Implementation Job`,workflowPath:`workflows/job/workflow.md`,description:`General-purpose work-item workflow for scoped changes in an existing repository.`,kind:`job`,layer:`base`};async function po(){return(await q(`/workflows?kind=job`)).workflows}var mo={"workflows/job/workflow.md":`15–35 minutes`,"workflows/job-fast/workflow.md":`5–15 minutes`,"workflows/job-deep/workflow.md":`45–90 minutes`,"workflows/campaign/workflow.md":`1–4 hours, sometimes much longer`};function ho(e,t){return mo[e]?mo[e]:t<=0?`Duration varies`:`${t*8}–${t*15} minutes (estimate)`}var go=`coro.newRun.draft`,_o={mode:`manual`,serviceName:``,repo:``,description:``,reviewers:``,ticketId:``,interactive:!1,workflowId:fo.id,scmId:``,trackerId:``};function vo(e){if(e.serviceName.trim()||e.repo.trim()||e.description.trim()||e.reviewers.trim()||e.ticketId.trim())return!0;let t=e.plan;return t?t.brief?!0:t.messages.some(e=>e.role===`user`):!1}function yo(){if(!(typeof window>`u`))try{window.localStorage.removeItem(go)}catch{}}function bo(e,t){let[n,r]=(0,x.useState)(()=>{if(typeof window>`u`)return t;try{let n=window.localStorage.getItem(e);return n?JSON.parse(n):t}catch{return t}});return(0,x.useEffect)(()=>{try{window.localStorage.setItem(e,JSON.stringify(n))}catch{}},[e,n]),[n,r]}var xo=`coro.workspace.tabs`,So=(0,x.createContext)(null);function Co({children:e}){let t=$e(),[n,r]=bo(xo,[]),i=(0,x.useCallback)(e=>{r(t=>{let n={...e,updatedAt:new Date().toISOString()},r=t.findIndex(t=>t.path===e.path);if(r>=0){let e=t.slice();return e[r]={...t[r],...n},e}let i=[...t,n];return i.length>10?i.slice(i.length-10):i})},[r]),a=(0,x.useCallback)(e=>{r(t=>t.filter(t=>t.path!==e))},[r]),o=(0,x.useCallback)(()=>{r([])},[r]);(0,x.useEffect)(()=>{r(e=>e.map(e=>e.path===t.pathname?{...e,updatedAt:new Date().toISOString()}:e))},[t.pathname,r]);let s=(0,x.useMemo)(()=>({tabs:n,activePath:t.pathname,upsertTab:i,closeTab:a,clearTabs:o}),[n,t.pathname,i,a,o]);return(0,G.jsx)(So.Provider,{value:s,children:e})}function wo(){let e=(0,x.useContext)(So);if(!e)throw Error(`useWorkspaceTabs must be used inside WorkspaceTabsProvider`);return e}function To(e){let{upsertTab:t}=wo(),n=e?.id,r=e?.kind,i=e?.path,a=e?.title,o=e?.subtitle;(0,x.useEffect)(()=>{!n||!r||!i||!a||t({id:n,kind:r,path:i,title:a,subtitle:o})},[n,r,i,o,a,t])}function Eo(e=5e3){let[t,n]=(0,x.useState)([]),[r,i]=(0,x.useState)(!0),[a,o]=(0,x.useState)(null),s=(0,x.useCallback)(async()=>{try{n(await q(`/jobs`)),o(null)}catch(e){o(e instanceof Error?e.message:`Failed to fetch jobs`)}finally{i(!1)}},[]);return(0,x.useEffect)(()=>{s();let t=setInterval(()=>void s(),e);return()=>clearInterval(t)},[s,e]),{jobs:t,loading:r,error:a,refetch:s}}var Do={queued:{label:`Queued`,category:`running`,tone:`neutral`,pulse:!0},planning:{label:`Planning`,category:`running`,tone:`accent`,pulse:!0},coding:{label:`Coding`,category:`running`,tone:`accent`,pulse:!0},reviewing:{label:`Reviewing`,category:`running`,tone:`accent`,pulse:!0},review:{label:`Reviewing`,category:`running`,tone:`accent`,pulse:!0},testing:{label:`Testing`,category:`running`,tone:`accent`,pulse:!0},evaluating:{label:`Evaluating`,category:`running`,tone:`accent`,pulse:!0},analysis:{label:`Analysis`,category:`running`,tone:`accent`,pulse:!0},"repo-setup":{label:`Repo Setup`,category:`running`,tone:`accent`,pulse:!0},reporting:{label:`Reporting`,category:`running`,tone:`accent`,pulse:!0},"spec-writing":{label:`Spec Writing`,category:`running`,tone:`accent`,pulse:!0},"campaign-planning":{label:`Campaign Planning`,category:`running`,tone:`accent`,pulse:!0},coordinating:{label:`Coordinating`,category:`running`,tone:`accent`,pulse:!0},aggregating:{label:`Aggregating`,category:`running`,tone:`accent`,pulse:!0},"awaiting-plan-approval":{label:`Awaiting Plan Approval`,category:`waiting`,tone:`warning`},"awaiting-pr-merge":{label:`Awaiting PR Merge`,category:`waiting`,tone:`warning`},"awaiting-developer-input":{label:`Awaiting Input`,category:`waiting`,tone:`warning`,pulse:!0},"awaiting-children":{label:`Awaiting Children`,category:`waiting`,tone:`warning`},"awaiting-rate-limit":{label:`Rate Limited`,category:`waiting`,tone:`warning`,pulse:!0},complete:{label:`Complete`,category:`terminal`,tone:`success`},cancelled:{label:`Cancelled`,category:`terminal`,tone:`neutral`},canceled:{label:`Cancelled`,category:`terminal`,tone:`neutral`},failed:{label:`Failed`,category:`terminal`,tone:`danger`},escalated:{label:`Escalated`,category:`terminal`,tone:`danger`}},Oo={connecting:{label:`Connecting`,category:`waiting`,tone:`warning`,pulse:!0},connected:{label:`Live`,category:`running`,tone:`success`,pulse:!0},disconnected:{label:`Stream Ended`,category:`idle`,tone:`neutral`},error:{label:`Connection Lost`,category:`terminal`,tone:`danger`}};function ko(e){return Do[e]??{label:e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `),category:`idle`,tone:`neutral`}}function Ao(e){return Oo[e]}function jo(e){return ko(e).category===`terminal`}function Mo(e){return ko(e).category===`waiting`}function No(e){return ko(e).category===`running`}function Po(e){return e!==`complete`&&e!==`cancelled`}function Fo(e){return e!==`complete`&&e!==`cancelled`}function Io(e,t){return e===`awaiting-developer-input`&&t===`developer-input: paused by developer`}function Lo(e,t){return Io(e,t)?!1:ko(e).category===`running`}function Ro(e){switch(e){case`accent`:case`indigo`:case`cyan`:case`violet`:return`accent`;case`success`:case`emerald`:return`success`;case`warning`:case`amber`:return`warning`;case`danger`:case`rose`:return`danger`;default:return`neutral`}}function zo(e){switch(Ro(e)){case`accent`:return`border-accent-500/30 bg-accent-500/10 text-accent-300`;case`success`:return`border-success-500/30 bg-success-500/10 text-success-400`;case`warning`:return`border-warning-500/30 bg-warning-500/10 text-warning-400`;case`danger`:return`border-danger-500/30 bg-danger-500/10 text-danger-400`;default:return`border-line-strong bg-overlay text-fg-muted`}}function Bo(e){switch(Ro(e)){case`accent`:return`bg-accent-400`;case`success`:return`bg-success-400`;case`warning`:return`bg-warning-400`;case`danger`:return`bg-danger-400`;default:return`bg-fg-subtle`}}function Vo(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Ho(...e){return t=>{let n=!1,r=e.map(e=>{let r=Vo(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Vo(e[t],null)}}}}function Uo(...e){return x.useCallback(Ho(...e),e)}var Wo=Symbol.for(`react.lazy`),Go=x.use;function Ko(e){return typeof e==`object`&&!!e&&`then`in e}function qo(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Wo&&`_payload`in e&&Ko(e._payload)}function Jo(e){let t=Xo(e),n=x.forwardRef((e,n)=>{let{children:r,...i}=e;qo(r)&&typeof Go==`function`&&(r=Go(r._payload));let a=x.Children.toArray(r),o=a.find(Qo);if(o){let e=o.props.children,r=a.map(t=>t===o?x.Children.count(e)>1?x.Children.only(null):x.isValidElement(e)?e.props.children:null:t);return(0,G.jsx)(t,{...i,ref:n,children:x.isValidElement(e)?x.cloneElement(e,void 0,r):null})}return(0,G.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Yo=Jo(`Slot`);function Xo(e){let t=x.forwardRef((e,t)=>{let{children:n,...r}=e;if(qo(n)&&typeof Go==`function`&&(n=Go(n._payload)),x.isValidElement(n)){let e=es(n),i=$o(r,n.props);return n.type!==x.Fragment&&(i.ref=t?Ho(t,e):e),x.cloneElement(n,i)}return x.Children.count(n)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Zo=Symbol(`radix.slottable`);function Qo(e){return x.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Zo}function $o(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function es(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ts=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,ns=Li,rs=(e,t)=>n=>{if(t?.variants==null)return ns(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=ts(t)||ts(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return ns(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},is=rs(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-xl text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60 disabled:pointer-events-none disabled:opacity-45 [&_svg]:pointer-events-none [&_svg]:size-4 shrink-0`,{variants:{variant:{primary:`bg-accent-500 text-white shadow-[0_10px_24px_-20px_rgba(97,114,255,0.85)] hover:bg-accent-400`,secondary:`bg-overlay text-fg ring-1 ring-line-strong hover:bg-panel-raised`,ghost:`text-fg-muted hover:bg-overlay hover:text-fg`,danger:`bg-danger-500/90 text-white hover:bg-danger-500`,success:`bg-success-500/90 text-white hover:bg-success-500`,outline:`bg-transparent text-fg ring-1 ring-line-strong hover:bg-overlay`},size:{sm:`h-8 px-3`,md:`h-10 px-4`,lg:`h-11 px-5`,icon:`size-10`}},defaultVariants:{variant:`primary`,size:`md`}}),Y=x.forwardRef(function({className:e,variant:t,size:n,asChild:r=!1,...i},a){return(0,G.jsx)(r?Yo:`button`,{className:W(is({variant:t,size:n}),e),ref:a,...i})}),as=c(m(),1);function os(e){let t=ss(e),n=x.forwardRef((e,n)=>{let{children:r,...i}=e,a=x.Children.toArray(r),o=a.find(us);if(o){let e=o.props.children,r=a.map(t=>t===o?x.Children.count(e)>1?x.Children.only(null):x.isValidElement(e)?e.props.children:null:t);return(0,G.jsx)(t,{...i,ref:n,children:x.isValidElement(e)?x.cloneElement(e,void 0,r):null})}return(0,G.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function ss(e){let t=x.forwardRef((e,t)=>{let{children:n,...r}=e;if(x.isValidElement(n)){let e=fs(n),i=ds(r,n.props);return n.type!==x.Fragment&&(i.ref=t?Ho(t,e):e),x.cloneElement(n,i)}return x.Children.count(n)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var cs=Symbol(`radix.slottable`);function ls(e){let t=({children:e})=>(0,G.jsx)(G.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=cs,t}function us(e){return x.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===cs}function ds(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function fs(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ps=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=os(`Primitive.${t}`),r=x.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,G.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ms(e,t){e&&as.flushSync(()=>e.dispatchEvent(t))}var hs=globalThis?.document?x.useLayoutEffect:()=>{};function gs(e,t){return x.useReducer((e,n)=>t[e][n]??e,e)}var _s=e=>{let{present:t,children:n}=e,r=vs(t),i=typeof n==`function`?n({present:r.isPresent}):x.Children.only(n),a=Uo(r.ref,bs(i));return typeof n==`function`||r.isPresent?x.cloneElement(i,{ref:a}):null};_s.displayName=`Presence`;function vs(e){let[t,n]=x.useState(),r=x.useRef(null),i=x.useRef(e),a=x.useRef(`none`),[o,s]=gs(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return x.useEffect(()=>{let e=ys(r.current);a.current=o===`mounted`?e:`none`},[o]),hs(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=ys(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),hs(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=ys(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=ys(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:x.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function ys(e){return e?.animationName||`none`}function bs(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function xs(e,t){let n=x.createContext(t),r=e=>{let{children:t,...r}=e,i=x.useMemo(()=>r,Object.values(r));return(0,G.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=x.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Ss(e,t=[]){let n=[];function r(t,r){let i=x.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=x.useMemo(()=>o,Object.values(o));return(0,G.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=x.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>x.createContext(e));return function(n){let r=n?.[e]||t;return x.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Cs(i,...t)]}function Cs(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function ws(e){let t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...e)=>t.current?.(...e),[])}var Ts=x.createContext(void 0);function Es(e){let t=x.useContext(Ts);return e||t||`ltr`}function Ds(e,[t,n]){return Math.min(n,Math.max(t,e))}typeof window<`u`&&window.document&&window.document.createElement;function X(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Os(e,t){return x.useReducer((e,n)=>t[e][n]??e,e)}var ks=`ScrollArea`,[As,js]=Ss(ks),[Ms,Ns]=As(ks),Ps=x.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=x.useState(null),[l,u]=x.useState(null),[d,f]=x.useState(null),[p,m]=x.useState(null),[h,g]=x.useState(null),[_,v]=x.useState(0),[y,b]=x.useState(0),[S,C]=x.useState(!1),[w,T]=x.useState(!1),E=Uo(t,e=>c(e)),D=Es(i);return(0,G.jsx)(Ms,{scope:n,type:r,dir:D,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:v,onCornerHeightChange:b,children:(0,G.jsx)(ps.div,{dir:D,...o,ref:E,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})})});Ps.displayName=ks;var Fs=`ScrollAreaViewport`,Is=x.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=Ns(Fs,n),s=Uo(t,x.useRef(null),o.onViewportChange);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,G.jsx)(ps.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,G.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});Is.displayName=Fs;var Ls=`ScrollAreaScrollbar`,Rs=x.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Ns(Ls,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return x.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,G.jsx)(zs,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,G.jsx)(Bs,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,G.jsx)(Vs,{...r,ref:t,forceMount:n}):i.type===`always`?(0,G.jsx)(Hs,{...r,ref:t}):null});Rs.displayName=Ls;var zs=x.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Ns(Ls,e.__scopeScrollArea),[a,o]=x.useState(!1);return x.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,G.jsx)(_s,{present:n||a,children:(0,G.jsx)(Vs,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),Bs=x.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Ns(Ls,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=cc(()=>c(`SCROLL_END`),100),[s,c]=Os(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return x.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),x.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,G.jsx)(_s,{present:n||s!==`hidden`,children:(0,G.jsx)(Hs,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:X(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:X(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),Vs=x.forwardRef((e,t)=>{let n=Ns(Ls,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=x.useState(!1),s=e.orientation===`horizontal`,c=cc(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return lc(n.viewport,c),lc(n.content,c),(0,G.jsx)(_s,{present:r||a,children:(0,G.jsx)(Hs,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),Hs=x.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=Ns(Ls,e.__scopeScrollArea),a=x.useRef(null),o=x.useRef(0),[s,c]=x.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=tc(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return rc(e,o.current,s,t)}return n===`horizontal`?(0,G.jsx)(Us,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=ic(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,G.jsx)(Ws,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=ic(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),Us=x.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=Ns(Ls,e.__scopeScrollArea),[o,s]=x.useState(),c=x.useRef(null),l=Uo(t,c,a.onScrollbarXChange);return x.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,G.jsx)(qs,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":nc(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),oc(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:ec(o.paddingLeft),paddingEnd:ec(o.paddingRight)}})}})}),Ws=x.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=Ns(Ls,e.__scopeScrollArea),[o,s]=x.useState(),c=x.useRef(null),l=Uo(t,c,a.onScrollbarYChange);return x.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,G.jsx)(qs,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":nc(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),oc(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:ec(o.paddingTop),paddingEnd:ec(o.paddingBottom)}})}})}),[Gs,Ks]=As(Ls),qs=x.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=Ns(Ls,n),[m,h]=x.useState(null),g=Uo(t,e=>h(e)),_=x.useRef(null),v=x.useRef(``),y=p.viewport,b=r.content-r.viewport,S=ws(u),C=ws(c),w=cc(d,10);function T(e){_.current&&l({x:e.clientX-_.current.left,y:e.clientY-_.current.top})}return x.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&S(e,b)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b,S]),x.useEffect(C,[r,C]),lc(m,w),lc(p.content,w),(0,G.jsx)(Gs,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:ws(a),onThumbPointerUp:ws(o),onThumbPositionChange:C,onThumbPointerDown:ws(s),children:(0,G.jsx)(ps.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:X(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:X(e.onPointerMove,T),onPointerUp:X(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})}),Js=`ScrollAreaThumb`,Ys=x.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Ks(Js,e.__scopeScrollArea);return(0,G.jsx)(_s,{present:n||i.hasThumb,children:(0,G.jsx)(Xs,{ref:t,...r})})}),Xs=x.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=Ns(Js,n),o=Ks(Js,n),{onThumbPositionChange:s}=o,c=Uo(t,e=>o.onThumbChange(e)),l=x.useRef(void 0),u=cc(()=>{l.current&&=(l.current(),void 0)},100);return x.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{u(),l.current||(l.current=sc(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,G.jsx)(ps.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:X(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:X(e.onPointerUp,o.onThumbPointerUp)})});Ys.displayName=Js;var Zs=`ScrollAreaCorner`,Qs=x.forwardRef((e,t)=>{let n=Ns(Zs,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,G.jsx)($s,{...e,ref:t}):null});Qs.displayName=Zs;var $s=x.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=Ns(Zs,n),[a,o]=x.useState(0),[s,c]=x.useState(0),l=!!(a&&s);return lc(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),lc(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,G.jsx)(ps.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function ec(e){return e?parseInt(e,10):0}function tc(e,t){let n=e/t;return isNaN(n)?0:n}function nc(e){let t=tc(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function rc(e,t,n,r=`ltr`){let i=nc(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return ac([c,l],d)(e)}function ic(e,t,n=`ltr`){let r=nc(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=Ds(e,n===`ltr`?[0,o]:[o*-1,0]);return ac([0,o],[0,s])(c)}function ac(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function oc(e,t){return e>0&&e<t}var sc=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function cc(e,t){let n=ws(e),r=x.useRef(0);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),x.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function lc(e,t){let n=ws(t);hs(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var uc=Ps,dc=Is,fc=Qs;function pc({className:e,children:t,...n}){return(0,G.jsxs)(uc,{className:W(`relative overflow-hidden`,e),...n,children:[(0,G.jsx)(dc,{className:`h-full w-full rounded-[inherit]`,children:t}),(0,G.jsx)(mc,{}),(0,G.jsx)(fc,{})]})}function mc({className:e,orientation:t=`vertical`,...n}){return(0,G.jsx)(Rs,{orientation:t,className:W(`flex touch-none select-none p-0.5 transition-colors`,t===`vertical`?`h-full w-2.5 border-l border-l-transparent`:`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,G.jsx)(Ys,{className:`relative flex-1 rounded-full bg-line-strong`})})}var hc=x.useInsertionEffect||hs;function gc({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=_c({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=x.useRef(e!==void 0);x.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,x.useCallback(t=>{if(s){let n=vc(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function _c({defaultProp:e,onChange:t}){let[n,r]=x.useState(e),i=x.useRef(n),a=x.useRef(t);return hc(()=>{a.current=t},[t]),x.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function vc(e){return typeof e==`function`}function yc(e){let t=e+`CollectionProvider`,[n,r]=Ss(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=x.useRef(null),a=x.useRef(new Map).current;return(0,G.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=os(s),l=x.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,G.jsx)(c,{ref:Uo(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=os(u),p=x.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=x.useRef(null),s=Uo(t,o),c=a(u,n);return x.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,G.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return x.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]}function bc(e,t=globalThis?.document){let n=ws(e);x.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var xc=`DismissableLayer`,Sc=`dismissableLayer.update`,Cc=`dismissableLayer.pointerDownOutside`,wc=`dismissableLayer.focusOutside`,Tc,Ec=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Dc=x.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=x.useContext(Ec),[u,d]=x.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=x.useState({}),m=Uo(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,S=Ac(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),C=jc(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return bc(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),x.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Tc=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Mc(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Tc)}},[u,f,n,l]),x.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Mc())},[u,l]),x.useEffect(()=>{let e=()=>p({});return document.addEventListener(Sc,e),()=>document.removeEventListener(Sc,e)},[]),(0,G.jsx)(ps.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:X(e.onFocusCapture,C.onFocusCapture),onBlurCapture:X(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:X(e.onPointerDownCapture,S.onPointerDownCapture)})});Dc.displayName=xc;var Oc=`DismissableLayerBranch`,kc=x.forwardRef((e,t)=>{let n=x.useContext(Ec),r=x.useRef(null),i=Uo(t,r);return x.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,G.jsx)(ps.div,{...e,ref:i})});kc.displayName=Oc;function Ac(e,t=globalThis?.document){let n=ws(e),r=x.useRef(!1),i=x.useRef(()=>{});return x.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Nc(Cc,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function jc(e,t=globalThis?.document){let n=ws(e),r=x.useRef(!1);return x.useEffect(()=>{let e=e=>{e.target&&!r.current&&Nc(wc,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Mc(){let e=new CustomEvent(Sc);document.dispatchEvent(e)}function Nc(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?ms(i,a):i.dispatchEvent(a)}var Pc=0;function Fc(){x.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Ic()),document.body.insertAdjacentElement(`beforeend`,e[1]??Ic()),Pc++,()=>{Pc===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Pc--}},[])}function Ic(){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 Lc=`focusScope.autoFocusOnMount`,Rc=`focusScope.autoFocusOnUnmount`,zc={bubbles:!1,cancelable:!0},Bc=`FocusScope`,Vc=x.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=x.useState(null),l=ws(i),u=ws(a),d=x.useRef(null),f=Uo(t,e=>c(e)),p=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Jc(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Jc(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Jc(s)};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]),x.useEffect(()=>{if(s){Yc.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Lc,zc);s.addEventListener(Lc,l),s.dispatchEvent(t),t.defaultPrevented||(Hc(Qc(Wc(s)),{select:!0}),document.activeElement===e&&Jc(s))}return()=>{s.removeEventListener(Lc,l),setTimeout(()=>{let t=new CustomEvent(Rc,zc);s.addEventListener(Rc,u),s.dispatchEvent(t),t.defaultPrevented||Jc(e??document.body,{select:!0}),s.removeEventListener(Rc,u),Yc.remove(p)},0)}}},[s,l,u,p]);let m=x.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]=Uc(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Jc(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Jc(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,G.jsx)(ps.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Vc.displayName=Bc;function Hc(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Jc(r,{select:t}),document.activeElement!==n)return}function Uc(e){let t=Wc(e);return[Gc(t,e),Gc(t.reverse(),e)]}function Wc(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode: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}});for(;n.nextNode();)t.push(n.currentNode);return t}function Gc(e,t){for(let n of e)if(!Kc(n,{upTo:t}))return n}function Kc(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}function qc(e){return e instanceof HTMLInputElement&&`select`in e}function Jc(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&qc(e)&&t&&e.select()}}var Yc=Xc();function Xc(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Zc(e,t),e.unshift(t)},remove(t){e=Zc(e,t),e[0]?.resume()}}}function Zc(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Qc(e){return e.filter(e=>e.tagName!==`A`)}var $c=x.useId||(()=>void 0),el=0;function tl(e){let[t,n]=x.useState($c());return hs(()=>{e||n(e=>e??String(el++))},[e]),e||(t?`radix-${t}`:``)}var nl=[`top`,`right`,`bottom`,`left`],rl=Math.min,il=Math.max,al=Math.round,ol=Math.floor,sl=e=>({x:e,y:e}),cl={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ll(e,t,n){return il(e,rl(t,n))}function ul(e,t){return typeof e==`function`?e(t):e}function dl(e){return e.split(`-`)[0]}function fl(e){return e.split(`-`)[1]}function pl(e){return e===`x`?`y`:`x`}function ml(e){return e===`y`?`height`:`width`}function hl(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function gl(e){return pl(hl(e))}function _l(e,t,n){n===void 0&&(n=!1);let r=fl(e),i=gl(e),a=ml(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=El(o)),[o,El(o)]}function vl(e){let t=El(e);return[yl(e),t,yl(t)]}function yl(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var bl=[`left`,`right`],xl=[`right`,`left`],Sl=[`top`,`bottom`],Cl=[`bottom`,`top`];function wl(e,t,n){switch(e){case`top`:case`bottom`:return n?t?xl:bl:t?bl:xl;case`left`:case`right`:return t?Sl:Cl;default:return[]}}function Tl(e,t,n,r){let i=fl(e),a=wl(dl(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(yl)))),a}function El(e){let t=dl(e);return cl[t]+e.slice(t.length)}function Dl(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ol(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Dl(e)}function kl(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 Al(e,t,n){let{reference:r,floating:i}=e,a=hl(t),o=gl(t),s=ml(o),c=dl(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(fl(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 jl(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}=ul(t,e),p=Ol(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=kl(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=kl(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 Ml=50,Nl=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:jl},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Al(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<Ml&&(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}=Al(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Pl=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}=ul(e,t)||{};if(l==null)return{};let d=Ol(u),f={x:n,y:r},p=gl(i),m=ml(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=rl(d[_],T),D=rl(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=ll(O,A,k),M=!c.arrow&&fl(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Fl=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}=ul(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=dl(r),_=hl(o),v=dl(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[El(o)]:vl(o)),x=p!==`none`;!d&&x&&b.push(...Tl(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=_l(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`&&_!==hl(t))||T.every(e=>hl(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=hl(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 Z(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Q(e){return nl.some(t=>e[t]>=0)}var Il=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=ul(e,t);switch(i){case`referenceHidden`:{let e=Z(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Q(e)}}}case`escaped`:{let e=Z(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Q(e)}}}default:return{}}}}},Ll=new Set([`left`,`top`]);async function Rl(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=dl(n),s=fl(n),c=hl(n)===`y`,l=Ll.has(o)?-1:1,u=a&&c?-1:1,d=ul(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 zl=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 Rl(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}}}}},Bl=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}=ul(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=hl(dl(i)),p=pl(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=ll(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=ll(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}}}}}},Vl=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}=ul(e,t),u={x:n,y:r},d=hl(i),f=pl(d),p=u[f],m=u[d],h=ul(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=Ll.has(dl(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}}}},Hl=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}=ul(e,t),u=await o.detectOverflow(t,l),d=dl(i),f=fl(i),p=hl(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=rl(h-u[g],v),x=rl(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=il(u.left,0),t=il(u.right,0),n=il(u.top,0),r=il(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:il(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:il(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 Ul(){return typeof window<`u`}function Wl(e){return ql(e)?(e.nodeName||``).toLowerCase():`#document`}function Gl(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Kl(e){return((ql(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ql(e){return Ul()?e instanceof Node||e instanceof Gl(e).Node:!1}function Jl(e){return Ul()?e instanceof Element||e instanceof Gl(e).Element:!1}function Yl(e){return Ul()?e instanceof HTMLElement||e instanceof Gl(e).HTMLElement:!1}function Xl(e){return!Ul()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Gl(e).ShadowRoot}function Zl(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=cu(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ql(e){return/^(table|td|th)$/.test(Wl(e))}function $l(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var eu=/transform|translate|scale|rotate|perspective|filter/,tu=/paint|layout|strict|content/,nu=e=>!!e&&e!==`none`,ru;function iu(e){let t=Jl(e)?cu(e):e;return nu(t.transform)||nu(t.translate)||nu(t.scale)||nu(t.rotate)||nu(t.perspective)||!ou()&&(nu(t.backdropFilter)||nu(t.filter))||eu.test(t.willChange||``)||tu.test(t.contain||``)}function au(e){let t=uu(e);for(;Yl(t)&&!su(t);){if(iu(t))return t;if($l(t))return null;t=uu(t)}return null}function ou(){return ru??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ru}function su(e){return/^(html|body|#document)$/.test(Wl(e))}function cu(e){return Gl(e).getComputedStyle(e)}function lu(e){return Jl(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function uu(e){if(Wl(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Xl(e)&&e.host||Kl(e);return Xl(t)?t.host:t}function du(e){let t=uu(e);return su(t)?e.ownerDocument?e.ownerDocument.body:e.body:Yl(t)&&Zl(t)?t:du(t)}function fu(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=du(e),i=r===e.ownerDocument?.body,a=Gl(r);if(i){let e=pu(a);return t.concat(a,a.visualViewport||[],Zl(r)?r:[],e&&n?fu(e):[])}else return t.concat(r,fu(r,[],n))}function pu(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mu(e){let t=cu(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Yl(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=al(n)!==a||al(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function hu(e){return Jl(e)?e:e.contextElement}function gu(e){let t=hu(e);if(!Yl(t))return sl(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=mu(t),o=(a?al(n.width):n.width)/r,s=(a?al(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var _u=sl(0);function vu(e){let t=Gl(e);return!ou()||!t.visualViewport?_u:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function yu(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Gl(e)?!1:t}function bu(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=hu(e),o=sl(1);t&&(r?Jl(r)&&(o=gu(r)):o=gu(e));let s=yu(a,n,r)?vu(a):sl(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=Gl(a),t=r&&Jl(r)?Gl(r):r,n=e,i=pu(n);for(;i&&r&&t!==n;){let e=gu(i),t=i.getBoundingClientRect(),r=cu(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=Gl(i),i=pu(n)}}return kl({width:u,height:d,x:c,y:l})}function xu(e,t){let n=lu(e).scrollLeft;return t?t.left+n:bu(Kl(e)).left+n}function Su(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-xu(e,n),y:n.top+t.scrollTop}}function Cu(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Kl(r),s=t?$l(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=sl(1),u=sl(0),d=Yl(r);if((d||!d&&!a)&&((Wl(r)!==`body`||Zl(o))&&(c=lu(r)),d)){let e=bu(r);l=gu(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Su(o,c):sl(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 wu(e){return Array.from(e.getClientRects())}function Tu(e){let t=Kl(e),n=lu(e),r=e.ownerDocument.body,i=il(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=il(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+xu(e),s=-n.scrollTop;return cu(r).direction===`rtl`&&(o+=il(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Eu=25;function Du(e,t){let n=Gl(e),r=Kl(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=ou();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=xu(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<=Eu&&(a-=o)}else l<=Eu&&(a+=l);return{width:a,height:o,x:s,y:c}}function Ou(e,t){let n=bu(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Yl(e)?gu(e):sl(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ku(e,t,n){let r;if(t===`viewport`)r=Du(e,n);else if(t===`document`)r=Tu(Kl(e));else if(Jl(t))r=Ou(t,n);else{let n=vu(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return kl(r)}function Au(e,t){let n=uu(e);return n===t||!Jl(n)||su(n)?!1:cu(n).position===`fixed`||Au(n,t)}function ju(e,t){let n=t.get(e);if(n)return n;let r=fu(e,[],!1).filter(e=>Jl(e)&&Wl(e)!==`body`),i=null,a=cu(e).position===`fixed`,o=a?uu(e):e;for(;Jl(o)&&!su(o);){let t=cu(o),n=iu(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Zl(o)&&!n&&Au(e,o))?r=r.filter(e=>e!==o):i=t,o=uu(o)}return t.set(e,r),r}function Mu(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?$l(t)?[]:ju(t,this._c):[].concat(n),r],o=ku(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=ku(t,a[e],i);s=il(n.top,s),c=rl(n.right,c),l=rl(n.bottom,l),u=il(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Nu(e){let{width:t,height:n}=mu(e);return{width:t,height:n}}function Pu(e,t,n){let r=Yl(t),i=Kl(t),a=n===`fixed`,o=bu(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=sl(0);function l(){c.x=xu(i)}if(r||!r&&!a)if((Wl(t)!==`body`||Zl(i))&&(s=lu(t)),r){let e=bu(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?Su(i,s):sl(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 Fu(e){return cu(e).position===`static`}function Iu(e,t){if(!Yl(e)||cu(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Kl(e)===n&&(n=n.ownerDocument.body),n}function Lu(e,t){let n=Gl(e);if($l(e))return n;if(!Yl(e)){let t=uu(e);for(;t&&!su(t);){if(Jl(t)&&!Fu(t))return t;t=uu(t)}return n}let r=Iu(e,t);for(;r&&Ql(r)&&Fu(r);)r=Iu(r,t);return r&&su(r)&&Fu(r)&&!iu(r)?n:r||au(e)||n}var Ru=async function(e){let t=this.getOffsetParent||Lu,n=this.getDimensions,r=await n(e.floating);return{reference:Pu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zu(e){return cu(e).direction===`rtl`}var Bu={convertOffsetParentRelativeRectToViewportRelativeRect:Cu,getDocumentElement:Kl,getClippingRect:Mu,getOffsetParent:Lu,getElementRects:Ru,getClientRects:wu,getDimensions:Nu,getScale:gu,isElement:Jl,isRTL:zu};function Vu(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Hu(e,t){let n=null,r,i=Kl(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=ol(d),h=ol(i.clientWidth-(u+f)),g=ol(i.clientHeight-(d+p)),_=ol(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:il(0,rl(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&&!Vu(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 Uu(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=hu(e),u=i||a?[...l?fu(l):[],...t?fu(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Hu(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?bu(e):null;c&&g();function g(){let t=bu(e);h&&!Vu(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 Wu=zl,Gu=Bl,Ku=Fl,qu=Hl,Ju=Il,Yu=Pl,Xu=Vl,Zu=(e,t,n)=>{let r=new Map,i={platform:Bu,...n},a={...i.platform,_c:r};return Nl(e,t,{...i,platform:a})},Qu=typeof document<`u`?x.useLayoutEffect:function(){};function $u(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(!$u(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)&&!$u(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ed(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function td(e,t){let n=ed(e);return Math.round(t*n)/n}function nd(e){let t=x.useRef(e);return Qu(()=>{t.current=e}),t}function rd(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]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=x.useState(r);$u(f,r)||p(r);let[m,h]=x.useState(null),[g,_]=x.useState(null),v=x.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=x.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),b=a||m,S=o||g,C=x.useRef(null),w=x.useRef(null),T=x.useRef(u),E=c!=null,D=nd(c),O=nd(i),k=nd(l),A=x.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Zu(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!$u(T.current,t)&&(T.current=t,as.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Qu(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=x.useRef(!1);Qu(()=>(j.current=!0,()=>{j.current=!1}),[]),Qu(()=>{if(b&&(C.current=b),S&&(w.current=S),b&&S){if(D.current)return D.current(b,S,A);A()}},[b,S,A,D,E]);let M=x.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=x.useMemo(()=>({reference:b,floating:S}),[b,S]),ee=x.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=td(N.floating,u.x),r=td(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ed(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:ee}),[u,A,M,N,ee])}var id=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?{}:Yu({element:r.current,padding:i}).fn(n):r?Yu({element:r,padding:i}).fn(n):{}}}},ad=(e,t)=>{let n=Wu(e);return{name:n.name,fn:n.fn,options:[e,t]}},od=(e,t)=>{let n=Gu(e);return{name:n.name,fn:n.fn,options:[e,t]}},sd=(e,t)=>({fn:Xu(e).fn,options:[e,t]}),cd=(e,t)=>{let n=Ku(e);return{name:n.name,fn:n.fn,options:[e,t]}},ld=(e,t)=>{let n=qu(e);return{name:n.name,fn:n.fn,options:[e,t]}},ud=(e,t)=>{let n=Ju(e);return{name:n.name,fn:n.fn,options:[e,t]}},dd=(e,t)=>{let n=id(e);return{name:n.name,fn:n.fn,options:[e,t]}},fd=`Arrow`,pd=x.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,G.jsx)(ps.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,G.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});pd.displayName=fd;var md=pd;function hd(e){let[t,n]=x.useState(void 0);return hs(()=>{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 gd=`Popper`,[_d,vd]=Ss(gd),[$,yd]=_d(gd),bd=e=>{let{__scopePopper:t,children:n}=e,[r,i]=x.useState(null);return(0,G.jsx)($,{scope:t,anchor:r,onAnchorChange:i,children:n})};bd.displayName=gd;var xd=`PopperAnchor`,Sd=x.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=yd(xd,n),o=x.useRef(null),s=Uo(t,o),c=x.useRef(null);return x.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,G.jsx)(ps.div,{...i,ref:s})});Sd.displayName=xd;var Cd=`PopperContent`,[wd,Td]=_d(Cd),Ed=x.forwardRef((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=yd(Cd,n),[_,v]=x.useState(null),y=Uo(t,e=>v(e)),[b,S]=x.useState(null),C=hd(b),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(Ad),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:ee,middlewareData:te}=rd({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>Uu(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[ad({mainAxis:i+T,alignmentAxis:o}),c&&od({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?sd():void 0,...A}),c&&cd({...A}),ld({...A,apply:({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`)}}),b&&dd({element:b,padding:s}),jd({arrowWidth:w,arrowHeight:T}),f&&ud({strategy:`referenceHidden`,...A})]}),[P,F]=Md(N),I=ws(m);hs(()=>{ee&&I?.()},[ee,I]);let ne=te.arrow?.x,re=te.arrow?.y,ie=te.arrow?.centerOffset!==0,[L,R]=x.useState();return hs(()=>{_&&R(window.getComputedStyle(_).zIndex)},[_]),(0,G.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:ee?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:L,"--radix-popper-transform-origin":[te.transformOrigin?.x,te.transformOrigin?.y].join(` `),...te.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,G.jsx)(wd,{scope:n,placedSide:P,onArrowChange:S,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,G.jsx)(ps.div,{"data-side":P,"data-align":F,...h,ref:y,style:{...h.style,animation:ee?void 0:`none`}})})})});Ed.displayName=Cd;var Dd=`PopperArrow`,Od={top:`bottom`,right:`left`,bottom:`top`,left:`right`},kd=x.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Td(Dd,n),a=Od[i.placedSide];return(0,G.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,G.jsx)(md,{...r,ref:t,style:{...r.style,display:`block`}})})});kd.displayName=Dd;function Ad(e){return e!==null}var jd=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]=Md(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}}}});function Md(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Nd=bd,Pd=Sd,Fd=Ed,Id=kd,Ld=`Portal`,Rd=x.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=x.useState(!1);hs(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?as.createPortal((0,G.jsx)(ps.div,{...r,ref:t}),o):null});Rd.displayName=Ld;var zd=`rovingFocusGroup.onEntryFocus`,Bd={bubbles:!1,cancelable:!0},Vd=`RovingFocusGroup`,[Hd,Ud,Wd]=yc(Vd),[Gd,Kd]=Ss(Vd,[Wd]),[qd,Jd]=Gd(Vd),Yd=x.forwardRef((e,t)=>(0,G.jsx)(Hd.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,G.jsx)(Hd.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,G.jsx)(Xd,{...e,ref:t})})}));Yd.displayName=Vd;var Xd=x.forwardRef((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=x.useRef(null),p=Uo(t,f),m=Es(a),[h,g]=gc({prop:o,defaultProp:s??null,onChange:c,caller:Vd}),[_,v]=x.useState(!1),y=ws(l),b=Ud(n),S=x.useRef(!1),[C,w]=x.useState(0);return x.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(zd,y),()=>e.removeEventListener(zd,y)},[y]),(0,G.jsx)(qd,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:x.useCallback(e=>g(e),[g]),onItemShiftTab:x.useCallback(()=>v(!0),[]),onFocusableItemAdd:x.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:x.useCallback(()=>w(e=>e-1),[]),children:(0,G.jsx)(ps.div,{tabIndex:_||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:X(e.onMouseDown,()=>{S.current=!0}),onFocus:X(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(zd,Bd);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);nf([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:X(e.onBlur,()=>v(!1))})})}),Zd=`RovingFocusGroupItem`,Qd=x.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=tl(),l=a||c,u=Jd(Zd,n),d=u.currentTabStopId===l,f=Ud(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return x.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,G.jsx)(Hd.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,G.jsx)(ps.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:X(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:X(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:X(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=tf(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?rf(n,r+1):n.slice(r+1)}setTimeout(()=>nf(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Qd.displayName=Zd;var $d={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function ef(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function tf(e,t,n){let r=ef(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return $d[r]}function nf(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function rf(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var af=Yd,of=Qd,sf=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},cf=new WeakMap,lf=new WeakMap,uf={},df=0,ff=function(e){return e&&(e.host||ff(e.parentNode))},pf=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ff(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})},mf=function(e,t,n,r){var i=pf(t,Array.isArray(e)?e:[e]);uf[n]||(uf[n]=new WeakMap);var a=uf[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=(cf.get(e)||0)+1,l=(a.get(e)||0)+1;cf.set(e,c),a.set(e,l),o.push(e),c===1&&i&&lf.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(),df++,function(){o.forEach(function(e){var t=cf.get(e)-1,i=a.get(e)-1;cf.set(e,t),a.set(e,i),t||(lf.has(e)||e.removeAttribute(r),lf.delete(e)),i||e.removeAttribute(n)}),df--,df||(cf=new WeakMap,cf=new WeakMap,lf=new WeakMap,uf={})}},hf=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||sf(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),mf(r,i,n,`aria-hidden`)):function(){return null}},gf=function(){return gf=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},gf.apply(this,arguments)};function _f(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 vf(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 yf=`right-scroll-bar-position`,bf=`width-before-scroll-bar`,xf=`with-scroll-bars-hidden`,Sf=`--removed-body-scroll-bar-size`;function Cf(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function wf(e,t){var n=(0,x.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 Tf=typeof window<`u`?x.useLayoutEffect:x.useEffect,Ef=new WeakMap;function Df(e,t){var n=wf(t||null,function(t){return e.forEach(function(e){return Cf(e,t)})});return Tf(function(){var t=Ef.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Cf(e,null)}),i.forEach(function(e){r.has(e)||Cf(e,a)})}Ef.set(n,e)},[e]),n}function Of(e){return e}function kf(e,t){t===void 0&&(t=Of);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 Af(e){e===void 0&&(e={});var t=kf(null);return t.options=gf({async:!0,ssr:!1},e),t}var jf=function(e){var t=e.sideCar,n=_f(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 x.createElement(r,gf({},n))};jf.isSideCarExport=!0;function Mf(e,t){return e.useMedium(t),jf}var Nf=Af(),Pf=function(){},Ff=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:Pf,onWheelCapture:Pf,onTouchMoveCapture:Pf}),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=_f(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=Df([n,t]),w=gf(gf({},b),i);return x.createElement(x.Fragment,null,u&&x.createElement(S,{sideCar:Nf,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?x.cloneElement(x.Children.only(s),gf(gf({},w),{ref:C})):x.createElement(v,gf({},w,{className:c,ref:C}),s))});Ff.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ff.classNames={fullWidth:bf,zeroRight:yf};var If,Lf=function(){if(If)return If;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Rf(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Lf();return t&&e.setAttribute(`nonce`,t),e}function zf(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Bf(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Vf=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Rf())&&(zf(t,n),Bf(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Hf=function(){var e=Vf();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Uf=function(){var e=Hf();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Wf={left:0,top:0,right:0,gap:0},Gf=function(e){return parseInt(e||``,10)||0},Kf=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[Gf(n),Gf(r),Gf(i)]},qf=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Wf;var t=Kf(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])}},Jf=Uf(),Yf=`data-scroll-locked`,Xf=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
11
+ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=$e(),d;if(t){let e=typeof t==`string`?j(t):t;T(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=ee(e,{pathname:p});E(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),E(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=gt(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Ce([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Ce([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?x.createElement(Ue.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function ut(){let e=Tt(),t=ke(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=x.createElement(x.Fragment,null,x.createElement(`p`,null,`💿 Hey developer 👋`),x.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,x.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,x.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),x.createElement(x.Fragment,null,x.createElement(`h2`,null,`Unexpected Application Error!`),x.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?x.createElement(`pre`,{style:i},n):null,o)}var dt=x.createElement(ut,null),ft=class extends x.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Xe(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:x.createElement(We.Provider,{value:this.props.routeContext},x.createElement(Ge.Provider,{value:e,children:this.props.component}));return this.context?x.createElement(mt,{error:e},t):t}};ft.contextType=Le;var pt=new WeakMap;function mt({children:e,error:t}){let{basename:n}=x.useContext(He);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Ye(t.digest);if(e){let r=pt.get(t);if(r)throw r;let i=Me(e.location,n);if(je&&!pt.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw pt.set(t,n),n}return x.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function ht({routeContext:e,match:t,children:n}){let r=x.useContext(Fe);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(We.Provider,{value:e},n)}function gt(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);T(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:Ae(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||dt,o&&(s<0&&c===0?(Ot(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?x.createElement(n.route.Component,null):n.route.element?n.route.element:e,x.createElement(ht,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?x.createElement(ft,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function _t(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vt(e){let t=x.useContext(Fe);return T(t,_t(e)),t}function yt(e){let t=x.useContext(Ie);return T(t,_t(e)),t}function bt(e){let t=x.useContext(We);return T(t,_t(e)),t}function xt(e){let t=bt(e),n=t.matches[t.matches.length-1];return T(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function St(){return xt(`useRouteId`)}function Ct(){return yt(`useNavigation`).navigation}function wt(){let{matches:e,loaderData:t}=yt(`useMatches`);return x.useMemo(()=>e.map(e=>P(e,t)),[e,t])}function Tt(){let e=x.useContext(Ge),t=yt(`useRouteError`),n=xt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Et(){let{router:e}=vt(`useNavigate`),t=xt(`useNavigate`),n=x.useRef(!1);return tt(()=>{n.current=!0}),x.useCallback(async(r,i={})=>{E(n.current,et),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Dt={};function Ot(e,t,n){!t&&!Dt[e]&&(Dt[e]=!0,E(!1,n))}x.memo(kt);function kt({routes:e,future:t,state:n,isStatic:r,onError:i}){return lt(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function At({to:e,replace:t,state:n,relative:r}){T(Qe(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=x.useContext(He);E(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=x.useContext(We),{pathname:o}=$e(),s=nt(),c=xe(e,be(a),o,r===`path`),l=JSON.stringify(c);return x.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function jt(e){return at(e.context)}function Mt(e){T(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Nt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){T(!Qe(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=x.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=j(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=x.useMemo(()=>{let e=me(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return E(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:x.createElement(He.Provider,{value:c},x.createElement(Ue.Provider,{children:t,value:h}))}function Pt({children:e,location:t}){return ct(Ft(e),t)}x.Component;function Ft(e,t=[]){let n=[];return x.Children.forEach(e,(e,r)=>{if(!x.isValidElement(e))return;let i=[...t,r];if(e.type===x.Fragment){n.push.apply(n,Ft(e.props.children,i));return}T(e.type===Mt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),T(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Ft(e.props.children,i)),n.push(a)}),n}var It=`get`,Lt=`application/x-www-form-urlencoded`;function Rt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function zt(e){return Rt(e)&&e.tagName.toLowerCase()===`button`}function Bt(e){return Rt(e)&&e.tagName.toLowerCase()===`form`}function Vt(e){return Rt(e)&&e.tagName.toLowerCase()===`input`}function Ht(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ut(e,t){return e.button===0&&(!t||t===`_self`)&&!Ht(e)}function Wt(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Gt(e,t){let n=Wt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Kt=null;function qt(){if(Kt===null)try{new FormData(document.createElement(`form`),0),Kt=!1}catch{Kt=!0}return Kt}var Jt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Yt(e){return e!=null&&!Jt.has(e)?(E(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Lt}"`),null):e}function Xt(e,t){let n,r,i,a,o;if(Bt(e)){let o=e.getAttribute(`action`);r=o?me(o,t):null,n=e.getAttribute(`method`)||It,i=Yt(e.getAttribute(`enctype`))||Lt,a=new FormData(e)}else if(zt(e)||Vt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?me(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||It,i=Yt(e.getAttribute(`formenctype`))||Yt(o.getAttribute(`enctype`))||Lt,a=new FormData(o,e),!qt()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Rt(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=It,r=null,i=Lt,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Zt={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Qt=/[&><\u2028\u2029]/g;function $t(e){return e.replace(Qt,e=>Zt[e])}function en(e,t){if(e===!1||e==null)throw Error(t)}function tn(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&me(i.pathname,t)===`/`?i.pathname=`${we(t)}/_root.${r}`:i.pathname=`${we(i.pathname)}.${r}`,i}async function nn(e,t){if(e.id in t)return t[e.id];try{let n=await b(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function rn(e){return e!=null&&typeof e.page==`string`}function an(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function on(e,t,n){return dn((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await nn(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(an).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function sn(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function cn(e,t,{includeHydrateFallback:n}={}){return ln(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function ln(e){return[...new Set(e)]}function un(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function dn(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!rn(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(un(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function fn(){let e=x.useContext(Fe);return en(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function pn(){let e=x.useContext(Ie);return en(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var mn=x.createContext(void 0);mn.displayName=`FrameworkContext`;function hn(){let e=x.useContext(mn);return en(e,`You must render this element inside a <HydratedRouter> element`),e}function gn(e,t){let n=x.useContext(mn),[r,i]=x.useState(!1),[a,o]=x.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=x.useRef(null);x.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),x.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:_n(s,p),onBlur:_n(c,m),onMouseEnter:_n(l,p),onMouseLeave:_n(u,m),onTouchStart:_n(d,p)}]:[a,f,{}]:[!1,f,{}]}function _n(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function vn({page:e,...t}){let n=Re(),{router:r}=fn(),i=x.useMemo(()=>ee(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?x.createElement(bn,{page:e,matches:i,...t}):x.createElement(xn,{page:e,matches:i,...t}):null}function yn(e){let{manifest:t,routeModules:n}=hn(),[r,i]=x.useState([]);return x.useEffect(()=>{let r=!1;return on(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function bn({page:e,matches:t,...n}){let r=$e(),{future:i}=hn(),{basename:a}=fn(),o=x.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=tn(e,a,i.unstable_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.unstable_trailingSlashAwareDataRequests,e,r,t]);return x.createElement(x.Fragment,null,o.map(e=>x.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function xn({page:e,matches:t,...n}){let r=$e(),{future:i,manifest:a,routeModules:o}=hn(),{basename:s}=fn(),{loaderData:c,matches:l}=pn(),u=x.useMemo(()=>sn(e,t,l,a,r,`data`),[e,t,l,a,r]),d=x.useMemo(()=>sn(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=x.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=tn(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=x.useMemo(()=>cn(d,a),[d,a]),m=yn(d);return x.createElement(x.Fragment,null,f.map(e=>x.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>x.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>x.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Sn(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}x.Component;var Cn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Cn&&(window.__reactRouterVersion=`7.14.2`)}catch{}function wn({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=x.useRef();i.current??=w({window:r,v5Compat:!0});let a=i.current,[o,s]=x.useState({action:a.action,location:a.location}),c=x.useCallback(e=>{n===!1?s(e):x.startTransition(()=>s(e))},[n]);return x.useLayoutEffect(()=>a.listen(c),[a,c]),x.createElement(Nt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function Tn({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=x.useState({action:n.action,location:n.location}),o=x.useCallback(e=>{r===!1?a(e):x.startTransition(()=>a(e))},[r]);return x.useLayoutEffect(()=>n.listen(o),[n,o]),x.createElement(Nt,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Tn.displayName=`unstable_HistoryRouter`;var En=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Dn=x.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,unstable_mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,unstable_useTransitions:_}=x.useContext(He),v=typeof l==`string`&&En.test(l),y=Me(l,h);l=y.to;let b=Ze(l,{relative:r}),S=$e(),C=null;if(o){let e=xe(o,[],S.unstable_mask?S.unstable_mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Ce([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=gn(n,p),D=Pn(l,{replace:a,unstable_mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:_});function O(t){e&&e(t),t.defaultPrevented||D(t)}let k=!(y.isExternal||i),A=x.createElement(`a`,{...p,...E,href:(k?C:void 0)||y.absoluteURL||b,onClick:k?O:e,ref:Sn(m,T),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return w&&!v?x.createElement(x.Fragment,null,A,x.createElement(vn,{page:b})):A});Dn.displayName=`Link`;var On=x.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=st(a,{relative:c.relative}),d=$e(),f=x.useContext(Ie),{navigator:p,basename:m}=x.useContext(He),h=f!=null&&Gn(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=me(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,S=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),C={isActive:b,isPending:S,isTransitioning:h},w=b?e:void 0,T;T=typeof n==`function`?n(C):[n,b?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return x.createElement(Dn,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});On.displayName=`NavLink`;var kn=x.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=It,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=x.useContext(He),g=Rn(),_=zn(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&En.test(s);return x.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?x.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});kn.displayName=`Form`;function An({getKey:e,storageKey:t,...n}){let r=x.useContext(mn),{basename:i}=x.useContext(He),a=$e(),o=wt();Un({getKey:e,storageKey:t});let s=x.useMemo(()=>{if(!r||!e)return null;let t=Hn(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return x.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${$t(JSON.stringify(t||Bn))}, ${$t(JSON.stringify(s))})`}})}An.displayName=`ScrollRestoration`;function jn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mn(e){let t=x.useContext(Fe);return T(t,jn(e)),t}function Nn(e){let t=x.useContext(Ie);return T(t,jn(e)),t}function Pn(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=nt(),d=$e(),f=st(e,{relative:o});return x.useCallback(p=>{if(Ut(p,t)){p.preventDefault();let t=n===void 0?A(d)===A(f):n,m=()=>u(e,{replace:t,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?x.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Fn(e){E(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=x.useRef(Wt(e)),n=x.useRef(!1),r=$e(),i=x.useMemo(()=>Gt(r.search,n.current?null:t.current),[r.search]),a=nt();return[i,x.useCallback((e,t)=>{let r=Wt(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var In=0,Ln=()=>`__${String(++In)}__`;function Rn(){let{router:e}=Mn(`useSubmit`),{basename:t}=x.useContext(He),n=St(),r=e.fetch,i=e.navigate;return x.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Xt(e,t);a.navigate===!1?await r(a.fetcherKey||Ln(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function zn(e,{relative:t}={}){let{basename:n}=x.useContext(He),r=x.useContext(We);T(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...st(e||`.`,{relative:t})},o=$e();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Ce([n,a.pathname])),A(a)}var Bn=`react-router-scroll-positions`,Vn={};function Hn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:me(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Un({getKey:e,storageKey:t}={}){let{router:n}=Mn(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Nn(`useScrollRestoration`),{basename:a}=x.useContext(He),o=$e(),s=wt(),c=Ct();x.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Wn(x.useCallback(()=>{if(c.state===`idle`){let t=Hn(o,s,a,e);Vn[t]=window.scrollY}try{sessionStorage.setItem(t||Bn,JSON.stringify(Vn))}catch(e){E(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(x.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Bn);e&&(Vn=JSON.parse(e))}catch{}},[t]),x.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Vn,()=>window.scrollY,e?(t,n)=>Hn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),x.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{E(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Wn(e,t){let{capture:n}=t||{};x.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Gn(e,{relative:t}={}){let n=x.useContext(ze);T(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Mn(`useViewTransitionState`),i=st(e,{relative:t});if(!n.isTransitioning)return!1;let a=me(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=me(n.nextLocation.pathname,r)||n.nextLocation.pathname;return de(i.pathname,o)!=null||de(i.pathname,a)!=null}var Kn=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),qn=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Jn=e=>{let t=qn(e);return t.charAt(0).toUpperCase()+t.slice(1)},Yn=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Xn=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},Zn={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Qn=(0,x.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,x.createElement)(`svg`,{ref:c,...Zn,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Yn(`lucide`,i),...!a&&!Xn(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,x.createElement)(e,t)),...Array.isArray(a)?a:[a]])),z=(e,t)=>{let n=(0,x.forwardRef)(({className:n,...r},i)=>(0,x.createElement)(Qn,{ref:i,iconNode:t,className:Yn(`lucide-${Kn(Jn(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Jn(e),n},$n=z(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),er=z(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),tr=z(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),nr=z(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),rr=z(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ir=z(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.9 4.9 14.2 14.2`,key:`1m5liu`}]]),ar=z(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),or=z(`brain`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`,key:`ep3f8r`}],[`path`,{d:`M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4`,key:`1p4c4q`}],[`path`,{d:`M17.599 6.5a3 3 0 0 0 .399-1.375`,key:`tmeiqw`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M19.938 10.5a4 4 0 0 1 .585.396`,key:`1qfode`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M19.967 17.484A4 4 0 0 1 18 18`,key:`159ez6`}]]),sr=z(`bug`,[[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M9 7.13v-1a3.003 3.003 0 1 1 6 0v1`,key:`d7y7pr`}],[`path`,{d:`M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6`,key:`xs1cw7`}],[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M6.53 9C4.6 8.8 3 7.1 3 5`,key:`32zzws`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`M3 21c0-2.1 1.7-3.9 3.8-4`,key:`4p0ekp`}],[`path`,{d:`M20.97 5c0 2.1-1.6 3.8-3.5 4`,key:`18gb23`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M17.2 17c2.1.1 3.8 1.9 3.8 4`,key:`k3fwyw`}]]),cr=z(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),lr=z(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ur=z(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),dr=z(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),fr=z(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),pr=z(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),mr=z(`circle-help`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),hr=z(`circle-pause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),gr=z(`circle-play`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polygon`,{points:`10 8 16 12 10 16 10 8`,key:`1cimsy`}]]),_r=z(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),vr=z(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),yr=z(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),br=z(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),xr=z(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Sr=z(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Cr=z(`corner-down-right`,[[`path`,{d:`m15 10 5 5-5 5`,key:`qqa56n`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),wr=z(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Tr=z(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Er=z(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Dr=z(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Or=z(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),kr=z(`file-code`,[[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z`,key:`1mlx9k`}]]),Ar=z(`file-diff`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),jr=z(`file-json-2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`fq0c9t`}],[`path`,{d:`M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`4gibmv`}]]),Mr=z(`file-minus-2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M3 15h6`,key:`4e2qda`}]]),Nr=z(`file-plus-2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M3 15h6`,key:`4e2qda`}],[`path`,{d:`M6 12v6`,key:`1u72j0`}]]),Pr=z(`file-stack`,[[`path`,{d:`M21 7h-3a2 2 0 0 1-2-2V2`,key:`9rb54x`}],[`path`,{d:`M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z`,key:`1059l0`}],[`path`,{d:`M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15`,key:`16874u`}],[`path`,{d:`M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11`,key:`k2ox98`}]]),Fr=z(`file-symlink`,[[`path`,{d:`m10 18 3-3-3-3`,key:`18f6ys`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 11V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7`,key:`50q2rw`}]]),Ir=z(`file-text`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Lr=z(`folder-kanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),Rr=z(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),zr=z(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Br=z(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Vr=z(`git-branch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),Hr=z(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),Ur=z(`hand`,[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]),Wr=z(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Gr=z(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),Kr=z(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),qr=z(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Jr=z(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Yr=z(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Xr=z(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Zr=z(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Qr=z(`list-tree`,[[`path`,{d:`M21 12h-8`,key:`1bmf0i`}],[`path`,{d:`M21 6H8`,key:`1pqkrb`}],[`path`,{d:`M21 18h-8`,key:`1tm79t`}],[`path`,{d:`M3 6v4c0 1.1.9 2 2 2h3`,key:`1ywdgy`}],[`path`,{d:`M3 10v6c0 1.1.9 2 2 2h3`,key:`2wc746`}]]),$r=z(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ei=z(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),ti=z(`message-square-reply`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`m10 7-3 3 3 3`,key:`1eugdv`}],[`path`,{d:`M17 13v-1a2 2 0 0 0-2-2H7`,key:`ernfh3`}]]),ni=z(`message-square`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),ri=z(`package-plus`,[[`path`,{d:`M16 16h6`,key:`100bgy`}],[`path`,{d:`M19 13v6`,key:`85cyf1`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),ii=z(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),ai=z(`panel-top-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`m9 16 3-3 3 3`,key:`1idcnm`}]]),oi=z(`pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),si=z(`pen-line`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),ci=z(`pencil-line`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}],[`path`,{d:`m15 5 3 3`,key:`1w25hb`}]]),li=z(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),ui=z(`play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),di=z(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),fi=z(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),pi=z(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),mi=z(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),hi=z(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),gi=z(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),_i=z(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),vi=z(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),yi=z(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),bi=z(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),xi=z(`settings-2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Si=z(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Ci=z(`settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),wi=z(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Ti=z(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ei=z(`sliders-horizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),Di=z(`sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),Oi=z(`square-kanban`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 7v7`,key:`1x2jlm`}],[`path`,{d:`M12 7v4`,key:`xawao1`}],[`path`,{d:`M16 7v9`,key:`1hp2iy`}]]),ki=z(`square-slash`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),Ai=z(`ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),ji=z(`trash-2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),Mi=z(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ni=z(`waypoints`,[[`circle`,{cx:`12`,cy:`4.5`,r:`2.5`,key:`r5ysbb`}],[`path`,{d:`m10.2 6.3-3.9 3.9`,key:`1nzqf6`}],[`circle`,{cx:`4.5`,cy:`12`,r:`2.5`,key:`jydg6v`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`circle`,{cx:`19.5`,cy:`12`,r:`2.5`,key:`1piiel`}],[`path`,{d:`m13.8 17.7 3.9-3.9`,key:`1wyg1y`}],[`circle`,{cx:`12`,cy:`19.5`,r:`2.5`,key:`13o1pw`}]]),B=z(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),Pi=z(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Fi=g();function Ii(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ii(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Li(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ii(e))&&(r&&(r+=` `),r+=t);return r}var Ri=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},zi=(e,t)=>({classGroupId:e,validator:t}),Bi=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Vi=`-`,Hi=[],Ui=`arbitrary..`,Wi=e=>{let t=qi(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Ki(e);let n=e.split(Vi);return Gi(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ri(i,t):t:i||Hi}return n[e]||Hi}}},Gi=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Gi(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Vi):e.slice(t).join(Vi),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Ki=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Ui+r:void 0})(),qi=e=>{let{theme:t,classGroups:n}=e;return Ji(n,t)},Ji=(e,t)=>{let n=Bi();for(let r in e){let i=e[r];Yi(i,n,r,t)}return n},Yi=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Xi(i,t,n,r)}},Xi=(e,t,n,r)=>{if(typeof e==`string`){Zi(e,t,n);return}if(typeof e==`function`){Qi(e,t,n,r);return}$i(e,t,n,r)},Zi=(e,t,n)=>{let r=e===``?t:ea(t,e);r.classGroupId=n},Qi=(e,t,n,r)=>{if(ta(e)){Yi(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(zi(n,e))},$i=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Yi(o,ea(t,a),n,r)}},ea=(e,t)=>{let n=e,r=t.split(Vi),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Bi(),n.nextPart.set(t,i)),n=i}return n},ta=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,na=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},ra=`!`,ia=`:`,aa=[],oa=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),sa=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===ia){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(ra)?(c=s.slice(0,-1),l=!0):s.startsWith(ra)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return oa(t,l,c,u)};if(t){let e=t+ia,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):oa(aa,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ca=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},la=e=>({cache:na(e.cacheSize),parseClassName:sa(e),sortModifiers:ca(e),...Wi(e)}),ua=/\s+/,da=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(ua),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+ra:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},fa=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=pa(n))&&(i&&(i+=` `),i+=r);return i},pa=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=pa(e[r]))&&(n&&(n+=` `),n+=t);return n},ma=(e,...t)=>{let n,r,i,a,o=o=>(n=la(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=da(e,n);return i(e,a),a};return a=o,(...e)=>a(fa(...e))},ha=[],ga=e=>{let t=t=>t[e]||ha;return t.isThemeGetter=!0,t},_a=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,va=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ya=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ba=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xa=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Sa=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ca=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,wa=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ta=e=>ya.test(e),V=e=>!!e&&!Number.isNaN(Number(e)),Ea=e=>!!e&&Number.isInteger(Number(e)),Da=e=>e.endsWith(`%`)&&V(e.slice(0,-1)),Oa=e=>ba.test(e),ka=()=>!0,Aa=e=>xa.test(e)&&!Sa.test(e),ja=()=>!1,Ma=e=>Ca.test(e),Na=e=>wa.test(e),Pa=e=>!H(e)&&!U(e),Fa=e=>Xa(e,eo,ja),H=e=>_a.test(e),Ia=e=>Xa(e,to,Aa),La=e=>Xa(e,no,V),Ra=e=>Xa(e,io,ka),za=e=>Xa(e,ro,ja),Ba=e=>Xa(e,Qa,ja),Va=e=>Xa(e,$a,Na),Ha=e=>Xa(e,ao,Ma),U=e=>va.test(e),Ua=e=>Za(e,to),Wa=e=>Za(e,ro),Ga=e=>Za(e,Qa),Ka=e=>Za(e,eo),qa=e=>Za(e,$a),Ja=e=>Za(e,ao,!0),Ya=e=>Za(e,io,!0),Xa=(e,t,n)=>{let r=_a.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Za=(e,t,n=!1)=>{let r=va.exec(e);return r?r[1]?t(r[1]):n:!1},Qa=e=>e===`position`||e===`percentage`,$a=e=>e===`image`||e===`url`,eo=e=>e===`length`||e===`size`||e===`bg-size`,to=e=>e===`length`,no=e=>e===`number`,ro=e=>e===`family-name`,io=e=>e===`number`||e===`weight`,ao=e=>e===`shadow`,oo=ma(()=>{let e=ga(`color`),t=ga(`font`),n=ga(`text`),r=ga(`font-weight`),i=ga(`tracking`),a=ga(`leading`),o=ga(`breakpoint`),s=ga(`container`),c=ga(`spacing`),l=ga(`radius`),u=ga(`shadow`),d=ga(`inset-shadow`),f=ga(`text-shadow`),p=ga(`drop-shadow`),m=ga(`blur`),h=ga(`perspective`),g=ga(`aspect`),_=ga(`ease`),v=ga(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),U,H],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[U,H,c],T=()=>[Ta,`full`,`auto`,...w()],E=()=>[Ea,`none`,`subgrid`,U,H],D=()=>[`auto`,{span:[`full`,Ea,U,H]},Ea,U,H],O=()=>[Ea,`auto`,U,H],k=()=>[`auto`,`min`,`max`,`fr`,U,H],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Ta,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ee=()=>[Ta,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],te=()=>[Ta,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,U,H],F=()=>[...b(),Ga,Ba,{position:[U,H]}],I=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ne=()=>[`auto`,`cover`,`contain`,Ka,Fa,{size:[U,H]}],re=()=>[Da,Ua,Ia],ie=()=>[``,`none`,`full`,l,U,H],L=()=>[``,V,Ua,Ia],R=()=>[`solid`,`dashed`,`dotted`,`double`],ae=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],oe=()=>[V,Da,Ga,Ba],se=()=>[``,`none`,m,U,H],ce=()=>[`none`,V,U,H],le=()=>[`none`,V,U,H],ue=()=>[V,U,H],de=()=>[Ta,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Oa],breakpoint:[Oa],color:[ka],container:[Oa],"drop-shadow":[Oa],ease:[`in`,`out`,`in-out`],font:[Pa],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Oa],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Oa],shadow:[Oa],spacing:[`px`,V],text:[Oa],"text-shadow":[Oa],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Ta,H,U,g]}],container:[`container`],columns:[{columns:[V,H,U,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Ea,`auto`,U,H]}],basis:[{basis:[Ta,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[V,Ta,`auto`,`initial`,`none`,H]}],grow:[{grow:[``,V,U,H]}],shrink:[{shrink:[``,V,U,H]}],order:[{order:[Ea,`first`,`last`,`none`,U,H]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...ee()]}],"min-inline-size":[{"min-inline":[`auto`,...ee()]}],"max-inline-size":[{"max-inline":[`none`,...ee()]}],"block-size":[{block:[`auto`,...te()]}],"min-block-size":[{"min-block":[`auto`,...te()]}],"max-block-size":[{"max-block":[`none`,...te()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,Ua,Ia]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Ya,Ra]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Da,H]}],"font-family":[{font:[Wa,za,t]}],"font-features":[{"font-features":[H]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,U,H]}],"line-clamp":[{"line-clamp":[V,`none`,U,La]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,U,H]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,U,H]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...R(),`wavy`]}],"text-decoration-thickness":[{decoration:[V,`from-font`,`auto`,U,Ia]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[V,`auto`,U,H]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,U,H]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,U,H]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Ea,U,H],radial:[``,U,H],conic:[Ea,U,H]},qa,Va]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:ie()}],"rounded-s":[{"rounded-s":ie()}],"rounded-e":[{"rounded-e":ie()}],"rounded-t":[{"rounded-t":ie()}],"rounded-r":[{"rounded-r":ie()}],"rounded-b":[{"rounded-b":ie()}],"rounded-l":[{"rounded-l":ie()}],"rounded-ss":[{"rounded-ss":ie()}],"rounded-se":[{"rounded-se":ie()}],"rounded-ee":[{"rounded-ee":ie()}],"rounded-es":[{"rounded-es":ie()}],"rounded-tl":[{"rounded-tl":ie()}],"rounded-tr":[{"rounded-tr":ie()}],"rounded-br":[{"rounded-br":ie()}],"rounded-bl":[{"rounded-bl":ie()}],"border-w":[{border:L()}],"border-w-x":[{"border-x":L()}],"border-w-y":[{"border-y":L()}],"border-w-s":[{"border-s":L()}],"border-w-e":[{"border-e":L()}],"border-w-bs":[{"border-bs":L()}],"border-w-be":[{"border-be":L()}],"border-w-t":[{"border-t":L()}],"border-w-r":[{"border-r":L()}],"border-w-b":[{"border-b":L()}],"border-w-l":[{"border-l":L()}],"divide-x":[{"divide-x":L()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":L()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...R(),`hidden`,`none`]}],"divide-style":[{divide:[...R(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...R(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[V,U,H]}],"outline-w":[{outline:[``,V,Ua,Ia]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,Ja,Ha]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,Ja,Ha]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:L()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[V,Ia]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":L()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,Ja,Ha]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[V,U,H]}],"mix-blend":[{"mix-blend":[...ae(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ae()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[V]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[U,H]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[V]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,U,H]}],filter:[{filter:[``,`none`,U,H]}],blur:[{blur:se()}],brightness:[{brightness:[V,U,H]}],contrast:[{contrast:[V,U,H]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Ja,Ha]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,V,U,H]}],"hue-rotate":[{"hue-rotate":[V,U,H]}],invert:[{invert:[``,V,U,H]}],saturate:[{saturate:[V,U,H]}],sepia:[{sepia:[``,V,U,H]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,U,H]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[V,U,H]}],"backdrop-contrast":[{"backdrop-contrast":[V,U,H]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,V,U,H]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[V,U,H]}],"backdrop-invert":[{"backdrop-invert":[``,V,U,H]}],"backdrop-opacity":[{"backdrop-opacity":[V,U,H]}],"backdrop-saturate":[{"backdrop-saturate":[V,U,H]}],"backdrop-sepia":[{"backdrop-sepia":[``,V,U,H]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,U,H]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[V,`initial`,U,H]}],ease:[{ease:[`linear`,`initial`,_,U,H]}],delay:[{delay:[V,U,H]}],animate:[{animate:[`none`,v,U,H]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,U,H]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":[`scale-3d`],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[U,H,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:de()}],"translate-x":[{"translate-x":de()}],"translate-y":[{"translate-y":de()}],"translate-z":[{"translate-z":de()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,U,H]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,U,H]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[V,Ua,Ia,La]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function W(...e){return oo(Li(e))}var so=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),G=o(((e,t)=>{t.exports=so()}))();function co({iconOnly:e=!1,className:t}){return(0,G.jsxs)(`span`,{className:W(`inline-flex items-center gap-2.5`,t),children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`relative inline-flex size-8 items-center justify-center rounded-xl bg-accent-500/12 ring-1 ring-accent-500/25`,children:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,className:`size-4 text-accent-300`,children:[(0,G.jsx)(`path`,{d:`M19 7.5A8 8 0 1 0 19 16.5`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`}),(0,G.jsx)(`circle`,{cx:`18.25`,cy:`12`,r:`1.6`,fill:`currentColor`})]})}),e?null:(0,G.jsx)(`span`,{className:`leading-none`,children:(0,G.jsx)(`span`,{className:`text-[17px] font-semibold tracking-tight text-fg`,children:`Coro`})})]})}var K=class extends Error{status;payload;constructor(e,t,n){super(e),this.name=`ApiError`,this.status=t,this.payload=n}};async function lo(e){return(e.headers.get(`content-type`)??``).includes(`application/json`)?e.json().catch(()=>null):e.text().catch(()=>null)}async function q(e,t){let n=await fetch(e,t),r=await lo(n);if(!n.ok)throw new K(typeof r==`object`&&r&&`error`in r&&typeof r.error==`string`?r.error:`HTTP ${n.status}`,n.status,r);return r}async function uo(e,t){let n=await fetch(e,t),r=await n.text();if(!n.ok)throw new K(r||`HTTP ${n.status}`,n.status,r);return r}function J(e,t){return{...t,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}}var fo={id:`job`,name:`Implementation Job`,workflowPath:`workflows/job/workflow.md`,description:`General-purpose work-item workflow for scoped changes in an existing repository.`,kind:`job`,layer:`base`};async function po(){return(await q(`/workflows?kind=job`)).workflows}var mo={"workflows/job/workflow.md":`15–35 minutes`,"workflows/job-fast/workflow.md":`5–15 minutes`,"workflows/job-deep/workflow.md":`45–90 minutes`,"workflows/campaign/workflow.md":`1–4 hours, sometimes much longer`};function ho(e,t){return mo[e]?mo[e]:t<=0?`Duration varies`:`${t*8}–${t*15} minutes (estimate)`}var go=`coro.newRun.draft`,_o={mode:`manual`,serviceName:``,repo:``,description:``,reviewers:``,ticketId:``,interactive:!1,workflowId:fo.id,scmId:``,trackerId:``};function vo(e){if(e.serviceName.trim()||e.repo.trim()||e.description.trim()||e.reviewers.trim()||e.ticketId.trim())return!0;let t=e.plan;return t?t.brief?!0:t.messages.some(e=>e.role===`user`):!1}function yo(){if(!(typeof window>`u`))try{window.localStorage.removeItem(go)}catch{}}function bo(e,t){let[n,r]=(0,x.useState)(()=>{if(typeof window>`u`)return t;try{let n=window.localStorage.getItem(e);return n?JSON.parse(n):t}catch{return t}});return(0,x.useEffect)(()=>{try{window.localStorage.setItem(e,JSON.stringify(n))}catch{}},[e,n]),[n,r]}var xo=`coro.workspace.tabs`,So=(0,x.createContext)(null);function Co({children:e}){let t=$e(),[n,r]=bo(xo,[]),i=(0,x.useCallback)(e=>{r(t=>{let n={...e,updatedAt:new Date().toISOString()},r=t.findIndex(t=>t.path===e.path);if(r>=0){let e=t.slice();return e[r]={...t[r],...n},e}let i=[...t,n];return i.length>10?i.slice(i.length-10):i})},[r]),a=(0,x.useCallback)(e=>{r(t=>t.filter(t=>t.path!==e))},[r]),o=(0,x.useCallback)(()=>{r([])},[r]);(0,x.useEffect)(()=>{r(e=>e.map(e=>e.path===t.pathname?{...e,updatedAt:new Date().toISOString()}:e))},[t.pathname,r]);let s=(0,x.useMemo)(()=>({tabs:n,activePath:t.pathname,upsertTab:i,closeTab:a,clearTabs:o}),[n,t.pathname,i,a,o]);return(0,G.jsx)(So.Provider,{value:s,children:e})}function wo(){let e=(0,x.useContext)(So);if(!e)throw Error(`useWorkspaceTabs must be used inside WorkspaceTabsProvider`);return e}function To(e){let{upsertTab:t}=wo(),n=e?.id,r=e?.kind,i=e?.path,a=e?.title,o=e?.subtitle;(0,x.useEffect)(()=>{!n||!r||!i||!a||t({id:n,kind:r,path:i,title:a,subtitle:o})},[n,r,i,o,a,t])}function Eo(e=5e3){let[t,n]=(0,x.useState)([]),[r,i]=(0,x.useState)(!0),[a,o]=(0,x.useState)(null),s=(0,x.useCallback)(async()=>{try{n(await q(`/jobs`)),o(null)}catch(e){o(e instanceof Error?e.message:`Failed to fetch jobs`)}finally{i(!1)}},[]);return(0,x.useEffect)(()=>{s();let t=setInterval(()=>void s(),e);return()=>clearInterval(t)},[s,e]),{jobs:t,loading:r,error:a,refetch:s}}var Do={queued:{label:`Queued`,category:`running`,tone:`neutral`,pulse:!0},planning:{label:`Planning`,category:`running`,tone:`accent`,pulse:!0},coding:{label:`Coding`,category:`running`,tone:`accent`,pulse:!0},reviewing:{label:`Reviewing`,category:`running`,tone:`accent`,pulse:!0},review:{label:`Reviewing`,category:`running`,tone:`accent`,pulse:!0},testing:{label:`Testing`,category:`running`,tone:`accent`,pulse:!0},evaluating:{label:`Evaluating`,category:`running`,tone:`accent`,pulse:!0},analysis:{label:`Analysis`,category:`running`,tone:`accent`,pulse:!0},"repo-setup":{label:`Repo Setup`,category:`running`,tone:`accent`,pulse:!0},reporting:{label:`Reporting`,category:`running`,tone:`accent`,pulse:!0},"spec-writing":{label:`Spec Writing`,category:`running`,tone:`accent`,pulse:!0},"campaign-architecture":{label:`Campaign Architecture`,category:`running`,tone:`accent`,pulse:!0},"campaign-planning":{label:`Campaign Planning`,category:`running`,tone:`accent`,pulse:!0},coordinating:{label:`Coordinating`,category:`running`,tone:`accent`,pulse:!0},integrating:{label:`Integrating`,category:`running`,tone:`accent`,pulse:!0},aggregating:{label:`Aggregating`,category:`running`,tone:`accent`,pulse:!0},"awaiting-plan-approval":{label:`Awaiting Plan Approval`,category:`waiting`,tone:`warning`},"awaiting-pr-merge":{label:`Awaiting PR Merge`,category:`waiting`,tone:`warning`},"awaiting-developer-input":{label:`Awaiting Input`,category:`waiting`,tone:`warning`,pulse:!0},"awaiting-children":{label:`Awaiting Children`,category:`waiting`,tone:`warning`},"awaiting-rate-limit":{label:`Rate Limited`,category:`waiting`,tone:`warning`,pulse:!0},complete:{label:`Complete`,category:`terminal`,tone:`success`},cancelled:{label:`Cancelled`,category:`terminal`,tone:`neutral`},canceled:{label:`Cancelled`,category:`terminal`,tone:`neutral`},failed:{label:`Failed`,category:`terminal`,tone:`danger`},escalated:{label:`Escalated`,category:`terminal`,tone:`danger`}},Oo={connecting:{label:`Connecting`,category:`waiting`,tone:`warning`,pulse:!0},connected:{label:`Live`,category:`running`,tone:`success`,pulse:!0},disconnected:{label:`Stream Ended`,category:`idle`,tone:`neutral`},error:{label:`Connection Lost`,category:`terminal`,tone:`danger`}};function ko(e){let t=Do[e];if(t)return t;let n=e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `);return e.startsWith(`awaiting-`)?{label:n,category:`waiting`,tone:`warning`}:{label:n,category:`running`,tone:`accent`,pulse:!0}}function Ao(e){return Oo[e]}function jo(e){return ko(e).category===`terminal`}function Mo(e){return ko(e).category===`waiting`}function No(e){return ko(e).category===`running`}function Po(e){return e!==`complete`&&e!==`cancelled`}function Fo(e){return e!==`complete`&&e!==`cancelled`}function Io(e,t){return e===`awaiting-developer-input`&&t===`developer-input: paused by developer`}function Lo(e,t){return Io(e,t)?!1:ko(e).category===`running`}function Ro(e){switch(e){case`accent`:case`indigo`:case`cyan`:case`violet`:return`accent`;case`success`:case`emerald`:return`success`;case`warning`:case`amber`:return`warning`;case`danger`:case`rose`:return`danger`;default:return`neutral`}}function zo(e){switch(Ro(e)){case`accent`:return`border-accent-500/30 bg-accent-500/10 text-accent-300`;case`success`:return`border-success-500/30 bg-success-500/10 text-success-400`;case`warning`:return`border-warning-500/30 bg-warning-500/10 text-warning-400`;case`danger`:return`border-danger-500/30 bg-danger-500/10 text-danger-400`;default:return`border-line-strong bg-overlay text-fg-muted`}}function Bo(e){switch(Ro(e)){case`accent`:return`bg-accent-400`;case`success`:return`bg-success-400`;case`warning`:return`bg-warning-400`;case`danger`:return`bg-danger-400`;default:return`bg-fg-subtle`}}function Vo(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Ho(...e){return t=>{let n=!1,r=e.map(e=>{let r=Vo(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Vo(e[t],null)}}}}function Uo(...e){return x.useCallback(Ho(...e),e)}var Wo=Symbol.for(`react.lazy`),Go=x.use;function Ko(e){return typeof e==`object`&&!!e&&`then`in e}function qo(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Wo&&`_payload`in e&&Ko(e._payload)}function Jo(e){let t=Xo(e),n=x.forwardRef((e,n)=>{let{children:r,...i}=e;qo(r)&&typeof Go==`function`&&(r=Go(r._payload));let a=x.Children.toArray(r),o=a.find(Qo);if(o){let e=o.props.children,r=a.map(t=>t===o?x.Children.count(e)>1?x.Children.only(null):x.isValidElement(e)?e.props.children:null:t);return(0,G.jsx)(t,{...i,ref:n,children:x.isValidElement(e)?x.cloneElement(e,void 0,r):null})}return(0,G.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Yo=Jo(`Slot`);function Xo(e){let t=x.forwardRef((e,t)=>{let{children:n,...r}=e;if(qo(n)&&typeof Go==`function`&&(n=Go(n._payload)),x.isValidElement(n)){let e=es(n),i=$o(r,n.props);return n.type!==x.Fragment&&(i.ref=t?Ho(t,e):e),x.cloneElement(n,i)}return x.Children.count(n)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Zo=Symbol(`radix.slottable`);function Qo(e){return x.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Zo}function $o(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function es(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ts=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,ns=Li,rs=(e,t)=>n=>{if(t?.variants==null)return ns(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=ts(t)||ts(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return ns(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},is=rs(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-xl text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60 disabled:pointer-events-none disabled:opacity-45 [&_svg]:pointer-events-none [&_svg]:size-4 shrink-0`,{variants:{variant:{primary:`bg-accent-500 text-white shadow-[0_10px_24px_-20px_rgba(97,114,255,0.85)] hover:bg-accent-400`,secondary:`bg-overlay text-fg ring-1 ring-line-strong hover:bg-panel-raised`,ghost:`text-fg-muted hover:bg-overlay hover:text-fg`,danger:`bg-danger-500/90 text-white hover:bg-danger-500`,success:`bg-success-500/90 text-white hover:bg-success-500`,outline:`bg-transparent text-fg ring-1 ring-line-strong hover:bg-overlay`},size:{sm:`h-8 px-3`,md:`h-10 px-4`,lg:`h-11 px-5`,icon:`size-10`}},defaultVariants:{variant:`primary`,size:`md`}}),Y=x.forwardRef(function({className:e,variant:t,size:n,asChild:r=!1,...i},a){return(0,G.jsx)(r?Yo:`button`,{className:W(is({variant:t,size:n}),e),ref:a,...i})}),as=c(m(),1);function os(e){let t=ss(e),n=x.forwardRef((e,n)=>{let{children:r,...i}=e,a=x.Children.toArray(r),o=a.find(us);if(o){let e=o.props.children,r=a.map(t=>t===o?x.Children.count(e)>1?x.Children.only(null):x.isValidElement(e)?e.props.children:null:t);return(0,G.jsx)(t,{...i,ref:n,children:x.isValidElement(e)?x.cloneElement(e,void 0,r):null})}return(0,G.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function ss(e){let t=x.forwardRef((e,t)=>{let{children:n,...r}=e;if(x.isValidElement(n)){let e=fs(n),i=ds(r,n.props);return n.type!==x.Fragment&&(i.ref=t?Ho(t,e):e),x.cloneElement(n,i)}return x.Children.count(n)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var cs=Symbol(`radix.slottable`);function ls(e){let t=({children:e})=>(0,G.jsx)(G.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=cs,t}function us(e){return x.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===cs}function ds(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function fs(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ps=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=os(`Primitive.${t}`),r=x.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,G.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ms(e,t){e&&as.flushSync(()=>e.dispatchEvent(t))}var hs=globalThis?.document?x.useLayoutEffect:()=>{};function gs(e,t){return x.useReducer((e,n)=>t[e][n]??e,e)}var _s=e=>{let{present:t,children:n}=e,r=vs(t),i=typeof n==`function`?n({present:r.isPresent}):x.Children.only(n),a=Uo(r.ref,bs(i));return typeof n==`function`||r.isPresent?x.cloneElement(i,{ref:a}):null};_s.displayName=`Presence`;function vs(e){let[t,n]=x.useState(),r=x.useRef(null),i=x.useRef(e),a=x.useRef(`none`),[o,s]=gs(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return x.useEffect(()=>{let e=ys(r.current);a.current=o===`mounted`?e:`none`},[o]),hs(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=ys(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),hs(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=ys(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=ys(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:x.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function ys(e){return e?.animationName||`none`}function bs(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function xs(e,t){let n=x.createContext(t),r=e=>{let{children:t,...r}=e,i=x.useMemo(()=>r,Object.values(r));return(0,G.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=x.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Ss(e,t=[]){let n=[];function r(t,r){let i=x.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=x.useMemo(()=>o,Object.values(o));return(0,G.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=x.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>x.createContext(e));return function(n){let r=n?.[e]||t;return x.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Cs(i,...t)]}function Cs(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function ws(e){let t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...e)=>t.current?.(...e),[])}var Ts=x.createContext(void 0);function Es(e){let t=x.useContext(Ts);return e||t||`ltr`}function Ds(e,[t,n]){return Math.min(n,Math.max(t,e))}typeof window<`u`&&window.document&&window.document.createElement;function X(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Os(e,t){return x.useReducer((e,n)=>t[e][n]??e,e)}var ks=`ScrollArea`,[As,js]=Ss(ks),[Ms,Ns]=As(ks),Ps=x.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=x.useState(null),[l,u]=x.useState(null),[d,f]=x.useState(null),[p,m]=x.useState(null),[h,g]=x.useState(null),[_,v]=x.useState(0),[y,b]=x.useState(0),[S,C]=x.useState(!1),[w,T]=x.useState(!1),E=Uo(t,e=>c(e)),D=Es(i);return(0,G.jsx)(Ms,{scope:n,type:r,dir:D,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:v,onCornerHeightChange:b,children:(0,G.jsx)(ps.div,{dir:D,...o,ref:E,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})})});Ps.displayName=ks;var Fs=`ScrollAreaViewport`,Is=x.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=Ns(Fs,n),s=Uo(t,x.useRef(null),o.onViewportChange);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,G.jsx)(ps.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,G.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});Is.displayName=Fs;var Ls=`ScrollAreaScrollbar`,Rs=x.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Ns(Ls,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return x.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,G.jsx)(zs,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,G.jsx)(Bs,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,G.jsx)(Vs,{...r,ref:t,forceMount:n}):i.type===`always`?(0,G.jsx)(Hs,{...r,ref:t}):null});Rs.displayName=Ls;var zs=x.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Ns(Ls,e.__scopeScrollArea),[a,o]=x.useState(!1);return x.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,G.jsx)(_s,{present:n||a,children:(0,G.jsx)(Vs,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),Bs=x.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Ns(Ls,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=cc(()=>c(`SCROLL_END`),100),[s,c]=Os(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return x.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),x.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,G.jsx)(_s,{present:n||s!==`hidden`,children:(0,G.jsx)(Hs,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:X(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:X(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),Vs=x.forwardRef((e,t)=>{let n=Ns(Ls,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=x.useState(!1),s=e.orientation===`horizontal`,c=cc(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return lc(n.viewport,c),lc(n.content,c),(0,G.jsx)(_s,{present:r||a,children:(0,G.jsx)(Hs,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),Hs=x.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=Ns(Ls,e.__scopeScrollArea),a=x.useRef(null),o=x.useRef(0),[s,c]=x.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=tc(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return rc(e,o.current,s,t)}return n===`horizontal`?(0,G.jsx)(Us,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=ic(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,G.jsx)(Ws,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=ic(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),Us=x.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=Ns(Ls,e.__scopeScrollArea),[o,s]=x.useState(),c=x.useRef(null),l=Uo(t,c,a.onScrollbarXChange);return x.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,G.jsx)(qs,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":nc(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),oc(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:ec(o.paddingLeft),paddingEnd:ec(o.paddingRight)}})}})}),Ws=x.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=Ns(Ls,e.__scopeScrollArea),[o,s]=x.useState(),c=x.useRef(null),l=Uo(t,c,a.onScrollbarYChange);return x.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,G.jsx)(qs,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":nc(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),oc(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:ec(o.paddingTop),paddingEnd:ec(o.paddingBottom)}})}})}),[Gs,Ks]=As(Ls),qs=x.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=Ns(Ls,n),[m,h]=x.useState(null),g=Uo(t,e=>h(e)),_=x.useRef(null),v=x.useRef(``),y=p.viewport,b=r.content-r.viewport,S=ws(u),C=ws(c),w=cc(d,10);function T(e){_.current&&l({x:e.clientX-_.current.left,y:e.clientY-_.current.top})}return x.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&S(e,b)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b,S]),x.useEffect(C,[r,C]),lc(m,w),lc(p.content,w),(0,G.jsx)(Gs,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:ws(a),onThumbPointerUp:ws(o),onThumbPositionChange:C,onThumbPointerDown:ws(s),children:(0,G.jsx)(ps.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:X(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:X(e.onPointerMove,T),onPointerUp:X(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})}),Js=`ScrollAreaThumb`,Ys=x.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Ks(Js,e.__scopeScrollArea);return(0,G.jsx)(_s,{present:n||i.hasThumb,children:(0,G.jsx)(Xs,{ref:t,...r})})}),Xs=x.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=Ns(Js,n),o=Ks(Js,n),{onThumbPositionChange:s}=o,c=Uo(t,e=>o.onThumbChange(e)),l=x.useRef(void 0),u=cc(()=>{l.current&&=(l.current(),void 0)},100);return x.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{u(),l.current||(l.current=sc(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,G.jsx)(ps.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:X(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:X(e.onPointerUp,o.onThumbPointerUp)})});Ys.displayName=Js;var Zs=`ScrollAreaCorner`,Qs=x.forwardRef((e,t)=>{let n=Ns(Zs,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,G.jsx)($s,{...e,ref:t}):null});Qs.displayName=Zs;var $s=x.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=Ns(Zs,n),[a,o]=x.useState(0),[s,c]=x.useState(0),l=!!(a&&s);return lc(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),lc(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,G.jsx)(ps.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function ec(e){return e?parseInt(e,10):0}function tc(e,t){let n=e/t;return isNaN(n)?0:n}function nc(e){let t=tc(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function rc(e,t,n,r=`ltr`){let i=nc(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return ac([c,l],d)(e)}function ic(e,t,n=`ltr`){let r=nc(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=Ds(e,n===`ltr`?[0,o]:[o*-1,0]);return ac([0,o],[0,s])(c)}function ac(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function oc(e,t){return e>0&&e<t}var sc=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function cc(e,t){let n=ws(e),r=x.useRef(0);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),x.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function lc(e,t){let n=ws(t);hs(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var uc=Ps,dc=Is,fc=Qs;function pc({className:e,children:t,...n}){return(0,G.jsxs)(uc,{className:W(`relative overflow-hidden`,e),...n,children:[(0,G.jsx)(dc,{className:`h-full w-full rounded-[inherit]`,children:t}),(0,G.jsx)(mc,{}),(0,G.jsx)(fc,{})]})}function mc({className:e,orientation:t=`vertical`,...n}){return(0,G.jsx)(Rs,{orientation:t,className:W(`flex touch-none select-none p-0.5 transition-colors`,t===`vertical`?`h-full w-2.5 border-l border-l-transparent`:`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,G.jsx)(Ys,{className:`relative flex-1 rounded-full bg-line-strong`})})}var hc=x.useInsertionEffect||hs;function gc({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=_c({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=x.useRef(e!==void 0);x.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,x.useCallback(t=>{if(s){let n=vc(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function _c({defaultProp:e,onChange:t}){let[n,r]=x.useState(e),i=x.useRef(n),a=x.useRef(t);return hc(()=>{a.current=t},[t]),x.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function vc(e){return typeof e==`function`}function yc(e){let t=e+`CollectionProvider`,[n,r]=Ss(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=x.useRef(null),a=x.useRef(new Map).current;return(0,G.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=os(s),l=x.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,G.jsx)(c,{ref:Uo(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=os(u),p=x.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=x.useRef(null),s=Uo(t,o),c=a(u,n);return x.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,G.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return x.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]}function bc(e,t=globalThis?.document){let n=ws(e);x.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var xc=`DismissableLayer`,Sc=`dismissableLayer.update`,Cc=`dismissableLayer.pointerDownOutside`,wc=`dismissableLayer.focusOutside`,Tc,Ec=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Dc=x.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=x.useContext(Ec),[u,d]=x.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=x.useState({}),m=Uo(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,S=Ac(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),C=jc(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return bc(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),x.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Tc=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Mc(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Tc)}},[u,f,n,l]),x.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Mc())},[u,l]),x.useEffect(()=>{let e=()=>p({});return document.addEventListener(Sc,e),()=>document.removeEventListener(Sc,e)},[]),(0,G.jsx)(ps.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:X(e.onFocusCapture,C.onFocusCapture),onBlurCapture:X(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:X(e.onPointerDownCapture,S.onPointerDownCapture)})});Dc.displayName=xc;var Oc=`DismissableLayerBranch`,kc=x.forwardRef((e,t)=>{let n=x.useContext(Ec),r=x.useRef(null),i=Uo(t,r);return x.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,G.jsx)(ps.div,{...e,ref:i})});kc.displayName=Oc;function Ac(e,t=globalThis?.document){let n=ws(e),r=x.useRef(!1),i=x.useRef(()=>{});return x.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Nc(Cc,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function jc(e,t=globalThis?.document){let n=ws(e),r=x.useRef(!1);return x.useEffect(()=>{let e=e=>{e.target&&!r.current&&Nc(wc,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Mc(){let e=new CustomEvent(Sc);document.dispatchEvent(e)}function Nc(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?ms(i,a):i.dispatchEvent(a)}var Pc=0;function Fc(){x.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Ic()),document.body.insertAdjacentElement(`beforeend`,e[1]??Ic()),Pc++,()=>{Pc===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Pc--}},[])}function Ic(){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 Lc=`focusScope.autoFocusOnMount`,Rc=`focusScope.autoFocusOnUnmount`,zc={bubbles:!1,cancelable:!0},Bc=`FocusScope`,Vc=x.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=x.useState(null),l=ws(i),u=ws(a),d=x.useRef(null),f=Uo(t,e=>c(e)),p=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Jc(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Jc(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Jc(s)};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]),x.useEffect(()=>{if(s){Yc.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Lc,zc);s.addEventListener(Lc,l),s.dispatchEvent(t),t.defaultPrevented||(Hc(Qc(Wc(s)),{select:!0}),document.activeElement===e&&Jc(s))}return()=>{s.removeEventListener(Lc,l),setTimeout(()=>{let t=new CustomEvent(Rc,zc);s.addEventListener(Rc,u),s.dispatchEvent(t),t.defaultPrevented||Jc(e??document.body,{select:!0}),s.removeEventListener(Rc,u),Yc.remove(p)},0)}}},[s,l,u,p]);let m=x.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]=Uc(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Jc(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Jc(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,G.jsx)(ps.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Vc.displayName=Bc;function Hc(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Jc(r,{select:t}),document.activeElement!==n)return}function Uc(e){let t=Wc(e);return[Gc(t,e),Gc(t.reverse(),e)]}function Wc(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode: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}});for(;n.nextNode();)t.push(n.currentNode);return t}function Gc(e,t){for(let n of e)if(!Kc(n,{upTo:t}))return n}function Kc(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}function qc(e){return e instanceof HTMLInputElement&&`select`in e}function Jc(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&qc(e)&&t&&e.select()}}var Yc=Xc();function Xc(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Zc(e,t),e.unshift(t)},remove(t){e=Zc(e,t),e[0]?.resume()}}}function Zc(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Qc(e){return e.filter(e=>e.tagName!==`A`)}var $c=x.useId||(()=>void 0),el=0;function tl(e){let[t,n]=x.useState($c());return hs(()=>{e||n(e=>e??String(el++))},[e]),e||(t?`radix-${t}`:``)}var nl=[`top`,`right`,`bottom`,`left`],rl=Math.min,il=Math.max,al=Math.round,ol=Math.floor,sl=e=>({x:e,y:e}),cl={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ll(e,t,n){return il(e,rl(t,n))}function ul(e,t){return typeof e==`function`?e(t):e}function dl(e){return e.split(`-`)[0]}function fl(e){return e.split(`-`)[1]}function pl(e){return e===`x`?`y`:`x`}function ml(e){return e===`y`?`height`:`width`}function hl(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function gl(e){return pl(hl(e))}function _l(e,t,n){n===void 0&&(n=!1);let r=fl(e),i=gl(e),a=ml(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=El(o)),[o,El(o)]}function vl(e){let t=El(e);return[yl(e),t,yl(t)]}function yl(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var bl=[`left`,`right`],xl=[`right`,`left`],Sl=[`top`,`bottom`],Cl=[`bottom`,`top`];function wl(e,t,n){switch(e){case`top`:case`bottom`:return n?t?xl:bl:t?bl:xl;case`left`:case`right`:return t?Sl:Cl;default:return[]}}function Tl(e,t,n,r){let i=fl(e),a=wl(dl(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(yl)))),a}function El(e){let t=dl(e);return cl[t]+e.slice(t.length)}function Dl(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ol(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Dl(e)}function kl(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 Al(e,t,n){let{reference:r,floating:i}=e,a=hl(t),o=gl(t),s=ml(o),c=dl(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(fl(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 jl(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}=ul(t,e),p=Ol(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=kl(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=kl(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 Ml=50,Nl=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:jl},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Al(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<Ml&&(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}=Al(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Pl=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}=ul(e,t)||{};if(l==null)return{};let d=Ol(u),f={x:n,y:r},p=gl(i),m=ml(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=rl(d[_],T),D=rl(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=ll(O,A,k),M=!c.arrow&&fl(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Fl=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}=ul(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=dl(r),_=hl(o),v=dl(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[El(o)]:vl(o)),x=p!==`none`;!d&&x&&b.push(...Tl(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=_l(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`&&_!==hl(t))||T.every(e=>hl(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=hl(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 Z(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Q(e){return nl.some(t=>e[t]>=0)}var Il=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=ul(e,t);switch(i){case`referenceHidden`:{let e=Z(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Q(e)}}}case`escaped`:{let e=Z(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Q(e)}}}default:return{}}}}},Ll=new Set([`left`,`top`]);async function Rl(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=dl(n),s=fl(n),c=hl(n)===`y`,l=Ll.has(o)?-1:1,u=a&&c?-1:1,d=ul(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 zl=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 Rl(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}}}}},Bl=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}=ul(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=hl(dl(i)),p=pl(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=ll(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=ll(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}}}}}},Vl=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}=ul(e,t),u={x:n,y:r},d=hl(i),f=pl(d),p=u[f],m=u[d],h=ul(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=Ll.has(dl(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}}}},Hl=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}=ul(e,t),u=await o.detectOverflow(t,l),d=dl(i),f=fl(i),p=hl(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=rl(h-u[g],v),x=rl(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=il(u.left,0),t=il(u.right,0),n=il(u.top,0),r=il(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:il(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:il(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 Ul(){return typeof window<`u`}function Wl(e){return ql(e)?(e.nodeName||``).toLowerCase():`#document`}function Gl(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Kl(e){return((ql(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ql(e){return Ul()?e instanceof Node||e instanceof Gl(e).Node:!1}function Jl(e){return Ul()?e instanceof Element||e instanceof Gl(e).Element:!1}function Yl(e){return Ul()?e instanceof HTMLElement||e instanceof Gl(e).HTMLElement:!1}function Xl(e){return!Ul()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Gl(e).ShadowRoot}function Zl(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=cu(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ql(e){return/^(table|td|th)$/.test(Wl(e))}function $l(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var eu=/transform|translate|scale|rotate|perspective|filter/,tu=/paint|layout|strict|content/,nu=e=>!!e&&e!==`none`,ru;function iu(e){let t=Jl(e)?cu(e):e;return nu(t.transform)||nu(t.translate)||nu(t.scale)||nu(t.rotate)||nu(t.perspective)||!ou()&&(nu(t.backdropFilter)||nu(t.filter))||eu.test(t.willChange||``)||tu.test(t.contain||``)}function au(e){let t=uu(e);for(;Yl(t)&&!su(t);){if(iu(t))return t;if($l(t))return null;t=uu(t)}return null}function ou(){return ru??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ru}function su(e){return/^(html|body|#document)$/.test(Wl(e))}function cu(e){return Gl(e).getComputedStyle(e)}function lu(e){return Jl(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function uu(e){if(Wl(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Xl(e)&&e.host||Kl(e);return Xl(t)?t.host:t}function du(e){let t=uu(e);return su(t)?e.ownerDocument?e.ownerDocument.body:e.body:Yl(t)&&Zl(t)?t:du(t)}function fu(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=du(e),i=r===e.ownerDocument?.body,a=Gl(r);if(i){let e=pu(a);return t.concat(a,a.visualViewport||[],Zl(r)?r:[],e&&n?fu(e):[])}else return t.concat(r,fu(r,[],n))}function pu(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mu(e){let t=cu(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Yl(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=al(n)!==a||al(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function hu(e){return Jl(e)?e:e.contextElement}function gu(e){let t=hu(e);if(!Yl(t))return sl(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=mu(t),o=(a?al(n.width):n.width)/r,s=(a?al(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var _u=sl(0);function vu(e){let t=Gl(e);return!ou()||!t.visualViewport?_u:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function yu(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Gl(e)?!1:t}function bu(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=hu(e),o=sl(1);t&&(r?Jl(r)&&(o=gu(r)):o=gu(e));let s=yu(a,n,r)?vu(a):sl(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=Gl(a),t=r&&Jl(r)?Gl(r):r,n=e,i=pu(n);for(;i&&r&&t!==n;){let e=gu(i),t=i.getBoundingClientRect(),r=cu(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=Gl(i),i=pu(n)}}return kl({width:u,height:d,x:c,y:l})}function xu(e,t){let n=lu(e).scrollLeft;return t?t.left+n:bu(Kl(e)).left+n}function Su(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-xu(e,n),y:n.top+t.scrollTop}}function Cu(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Kl(r),s=t?$l(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=sl(1),u=sl(0),d=Yl(r);if((d||!d&&!a)&&((Wl(r)!==`body`||Zl(o))&&(c=lu(r)),d)){let e=bu(r);l=gu(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Su(o,c):sl(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 wu(e){return Array.from(e.getClientRects())}function Tu(e){let t=Kl(e),n=lu(e),r=e.ownerDocument.body,i=il(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=il(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+xu(e),s=-n.scrollTop;return cu(r).direction===`rtl`&&(o+=il(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Eu=25;function Du(e,t){let n=Gl(e),r=Kl(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=ou();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=xu(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<=Eu&&(a-=o)}else l<=Eu&&(a+=l);return{width:a,height:o,x:s,y:c}}function Ou(e,t){let n=bu(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Yl(e)?gu(e):sl(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ku(e,t,n){let r;if(t===`viewport`)r=Du(e,n);else if(t===`document`)r=Tu(Kl(e));else if(Jl(t))r=Ou(t,n);else{let n=vu(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return kl(r)}function Au(e,t){let n=uu(e);return n===t||!Jl(n)||su(n)?!1:cu(n).position===`fixed`||Au(n,t)}function ju(e,t){let n=t.get(e);if(n)return n;let r=fu(e,[],!1).filter(e=>Jl(e)&&Wl(e)!==`body`),i=null,a=cu(e).position===`fixed`,o=a?uu(e):e;for(;Jl(o)&&!su(o);){let t=cu(o),n=iu(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Zl(o)&&!n&&Au(e,o))?r=r.filter(e=>e!==o):i=t,o=uu(o)}return t.set(e,r),r}function Mu(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?$l(t)?[]:ju(t,this._c):[].concat(n),r],o=ku(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=ku(t,a[e],i);s=il(n.top,s),c=rl(n.right,c),l=rl(n.bottom,l),u=il(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Nu(e){let{width:t,height:n}=mu(e);return{width:t,height:n}}function Pu(e,t,n){let r=Yl(t),i=Kl(t),a=n===`fixed`,o=bu(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=sl(0);function l(){c.x=xu(i)}if(r||!r&&!a)if((Wl(t)!==`body`||Zl(i))&&(s=lu(t)),r){let e=bu(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?Su(i,s):sl(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 Fu(e){return cu(e).position===`static`}function Iu(e,t){if(!Yl(e)||cu(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Kl(e)===n&&(n=n.ownerDocument.body),n}function Lu(e,t){let n=Gl(e);if($l(e))return n;if(!Yl(e)){let t=uu(e);for(;t&&!su(t);){if(Jl(t)&&!Fu(t))return t;t=uu(t)}return n}let r=Iu(e,t);for(;r&&Ql(r)&&Fu(r);)r=Iu(r,t);return r&&su(r)&&Fu(r)&&!iu(r)?n:r||au(e)||n}var Ru=async function(e){let t=this.getOffsetParent||Lu,n=this.getDimensions,r=await n(e.floating);return{reference:Pu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zu(e){return cu(e).direction===`rtl`}var Bu={convertOffsetParentRelativeRectToViewportRelativeRect:Cu,getDocumentElement:Kl,getClippingRect:Mu,getOffsetParent:Lu,getElementRects:Ru,getClientRects:wu,getDimensions:Nu,getScale:gu,isElement:Jl,isRTL:zu};function Vu(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Hu(e,t){let n=null,r,i=Kl(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=ol(d),h=ol(i.clientWidth-(u+f)),g=ol(i.clientHeight-(d+p)),_=ol(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:il(0,rl(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&&!Vu(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 Uu(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=hu(e),u=i||a?[...l?fu(l):[],...t?fu(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Hu(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?bu(e):null;c&&g();function g(){let t=bu(e);h&&!Vu(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 Wu=zl,Gu=Bl,Ku=Fl,qu=Hl,Ju=Il,Yu=Pl,Xu=Vl,Zu=(e,t,n)=>{let r=new Map,i={platform:Bu,...n},a={...i.platform,_c:r};return Nl(e,t,{...i,platform:a})},Qu=typeof document<`u`?x.useLayoutEffect:function(){};function $u(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(!$u(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)&&!$u(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ed(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function td(e,t){let n=ed(e);return Math.round(t*n)/n}function nd(e){let t=x.useRef(e);return Qu(()=>{t.current=e}),t}function rd(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]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=x.useState(r);$u(f,r)||p(r);let[m,h]=x.useState(null),[g,_]=x.useState(null),v=x.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=x.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),b=a||m,S=o||g,C=x.useRef(null),w=x.useRef(null),T=x.useRef(u),E=c!=null,D=nd(c),O=nd(i),k=nd(l),A=x.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Zu(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!$u(T.current,t)&&(T.current=t,as.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Qu(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=x.useRef(!1);Qu(()=>(j.current=!0,()=>{j.current=!1}),[]),Qu(()=>{if(b&&(C.current=b),S&&(w.current=S),b&&S){if(D.current)return D.current(b,S,A);A()}},[b,S,A,D,E]);let M=x.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=x.useMemo(()=>({reference:b,floating:S}),[b,S]),ee=x.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=td(N.floating,u.x),r=td(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ed(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:ee}),[u,A,M,N,ee])}var id=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?{}:Yu({element:r.current,padding:i}).fn(n):r?Yu({element:r,padding:i}).fn(n):{}}}},ad=(e,t)=>{let n=Wu(e);return{name:n.name,fn:n.fn,options:[e,t]}},od=(e,t)=>{let n=Gu(e);return{name:n.name,fn:n.fn,options:[e,t]}},sd=(e,t)=>({fn:Xu(e).fn,options:[e,t]}),cd=(e,t)=>{let n=Ku(e);return{name:n.name,fn:n.fn,options:[e,t]}},ld=(e,t)=>{let n=qu(e);return{name:n.name,fn:n.fn,options:[e,t]}},ud=(e,t)=>{let n=Ju(e);return{name:n.name,fn:n.fn,options:[e,t]}},dd=(e,t)=>{let n=id(e);return{name:n.name,fn:n.fn,options:[e,t]}},fd=`Arrow`,pd=x.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,G.jsx)(ps.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,G.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});pd.displayName=fd;var md=pd;function hd(e){let[t,n]=x.useState(void 0);return hs(()=>{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 gd=`Popper`,[_d,vd]=Ss(gd),[$,yd]=_d(gd),bd=e=>{let{__scopePopper:t,children:n}=e,[r,i]=x.useState(null);return(0,G.jsx)($,{scope:t,anchor:r,onAnchorChange:i,children:n})};bd.displayName=gd;var xd=`PopperAnchor`,Sd=x.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=yd(xd,n),o=x.useRef(null),s=Uo(t,o),c=x.useRef(null);return x.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,G.jsx)(ps.div,{...i,ref:s})});Sd.displayName=xd;var Cd=`PopperContent`,[wd,Td]=_d(Cd),Ed=x.forwardRef((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=yd(Cd,n),[_,v]=x.useState(null),y=Uo(t,e=>v(e)),[b,S]=x.useState(null),C=hd(b),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(Ad),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:ee,middlewareData:te}=rd({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>Uu(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[ad({mainAxis:i+T,alignmentAxis:o}),c&&od({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?sd():void 0,...A}),c&&cd({...A}),ld({...A,apply:({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`)}}),b&&dd({element:b,padding:s}),jd({arrowWidth:w,arrowHeight:T}),f&&ud({strategy:`referenceHidden`,...A})]}),[P,F]=Md(N),I=ws(m);hs(()=>{ee&&I?.()},[ee,I]);let ne=te.arrow?.x,re=te.arrow?.y,ie=te.arrow?.centerOffset!==0,[L,R]=x.useState();return hs(()=>{_&&R(window.getComputedStyle(_).zIndex)},[_]),(0,G.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:ee?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:L,"--radix-popper-transform-origin":[te.transformOrigin?.x,te.transformOrigin?.y].join(` `),...te.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,G.jsx)(wd,{scope:n,placedSide:P,onArrowChange:S,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,G.jsx)(ps.div,{"data-side":P,"data-align":F,...h,ref:y,style:{...h.style,animation:ee?void 0:`none`}})})})});Ed.displayName=Cd;var Dd=`PopperArrow`,Od={top:`bottom`,right:`left`,bottom:`top`,left:`right`},kd=x.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Td(Dd,n),a=Od[i.placedSide];return(0,G.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,G.jsx)(md,{...r,ref:t,style:{...r.style,display:`block`}})})});kd.displayName=Dd;function Ad(e){return e!==null}var jd=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]=Md(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}}}});function Md(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Nd=bd,Pd=Sd,Fd=Ed,Id=kd,Ld=`Portal`,Rd=x.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=x.useState(!1);hs(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?as.createPortal((0,G.jsx)(ps.div,{...r,ref:t}),o):null});Rd.displayName=Ld;var zd=`rovingFocusGroup.onEntryFocus`,Bd={bubbles:!1,cancelable:!0},Vd=`RovingFocusGroup`,[Hd,Ud,Wd]=yc(Vd),[Gd,Kd]=Ss(Vd,[Wd]),[qd,Jd]=Gd(Vd),Yd=x.forwardRef((e,t)=>(0,G.jsx)(Hd.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,G.jsx)(Hd.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,G.jsx)(Xd,{...e,ref:t})})}));Yd.displayName=Vd;var Xd=x.forwardRef((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=x.useRef(null),p=Uo(t,f),m=Es(a),[h,g]=gc({prop:o,defaultProp:s??null,onChange:c,caller:Vd}),[_,v]=x.useState(!1),y=ws(l),b=Ud(n),S=x.useRef(!1),[C,w]=x.useState(0);return x.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(zd,y),()=>e.removeEventListener(zd,y)},[y]),(0,G.jsx)(qd,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:x.useCallback(e=>g(e),[g]),onItemShiftTab:x.useCallback(()=>v(!0),[]),onFocusableItemAdd:x.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:x.useCallback(()=>w(e=>e-1),[]),children:(0,G.jsx)(ps.div,{tabIndex:_||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:X(e.onMouseDown,()=>{S.current=!0}),onFocus:X(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(zd,Bd);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);nf([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:X(e.onBlur,()=>v(!1))})})}),Zd=`RovingFocusGroupItem`,Qd=x.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=tl(),l=a||c,u=Jd(Zd,n),d=u.currentTabStopId===l,f=Ud(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return x.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,G.jsx)(Hd.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,G.jsx)(ps.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:X(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:X(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:X(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=tf(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?rf(n,r+1):n.slice(r+1)}setTimeout(()=>nf(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Qd.displayName=Zd;var $d={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function ef(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function tf(e,t,n){let r=ef(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return $d[r]}function nf(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function rf(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var af=Yd,of=Qd,sf=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},cf=new WeakMap,lf=new WeakMap,uf={},df=0,ff=function(e){return e&&(e.host||ff(e.parentNode))},pf=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ff(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})},mf=function(e,t,n,r){var i=pf(t,Array.isArray(e)?e:[e]);uf[n]||(uf[n]=new WeakMap);var a=uf[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=(cf.get(e)||0)+1,l=(a.get(e)||0)+1;cf.set(e,c),a.set(e,l),o.push(e),c===1&&i&&lf.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(),df++,function(){o.forEach(function(e){var t=cf.get(e)-1,i=a.get(e)-1;cf.set(e,t),a.set(e,i),t||(lf.has(e)||e.removeAttribute(r),lf.delete(e)),i||e.removeAttribute(n)}),df--,df||(cf=new WeakMap,cf=new WeakMap,lf=new WeakMap,uf={})}},hf=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||sf(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),mf(r,i,n,`aria-hidden`)):function(){return null}},gf=function(){return gf=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},gf.apply(this,arguments)};function _f(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 vf(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 yf=`right-scroll-bar-position`,bf=`width-before-scroll-bar`,xf=`with-scroll-bars-hidden`,Sf=`--removed-body-scroll-bar-size`;function Cf(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function wf(e,t){var n=(0,x.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 Tf=typeof window<`u`?x.useLayoutEffect:x.useEffect,Ef=new WeakMap;function Df(e,t){var n=wf(t||null,function(t){return e.forEach(function(e){return Cf(e,t)})});return Tf(function(){var t=Ef.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Cf(e,null)}),i.forEach(function(e){r.has(e)||Cf(e,a)})}Ef.set(n,e)},[e]),n}function Of(e){return e}function kf(e,t){t===void 0&&(t=Of);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 Af(e){e===void 0&&(e={});var t=kf(null);return t.options=gf({async:!0,ssr:!1},e),t}var jf=function(e){var t=e.sideCar,n=_f(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 x.createElement(r,gf({},n))};jf.isSideCarExport=!0;function Mf(e,t){return e.useMedium(t),jf}var Nf=Af(),Pf=function(){},Ff=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:Pf,onWheelCapture:Pf,onTouchMoveCapture:Pf}),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=_f(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=Df([n,t]),w=gf(gf({},b),i);return x.createElement(x.Fragment,null,u&&x.createElement(S,{sideCar:Nf,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?x.cloneElement(x.Children.only(s),gf(gf({},w),{ref:C})):x.createElement(v,gf({},w,{className:c,ref:C}),s))});Ff.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ff.classNames={fullWidth:bf,zeroRight:yf};var If,Lf=function(){if(If)return If;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Rf(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Lf();return t&&e.setAttribute(`nonce`,t),e}function zf(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Bf(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Vf=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Rf())&&(zf(t,n),Bf(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Hf=function(){var e=Vf();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Uf=function(){var e=Hf();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Wf={left:0,top:0,right:0,gap:0},Gf=function(e){return parseInt(e||``,10)||0},Kf=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[Gf(n),Gf(r),Gf(i)]},qf=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Wf;var t=Kf(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])}},Jf=Uf(),Yf=`data-scroll-locked`,Xf=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
12
12
  .${xf} {
13
13
  overflow: hidden ${r};
14
14
  padding-right: ${s}px ${r};
@@ -57,20 +57,20 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
57
57
  `),o=null,s=[];function c(){o&&=(n.push(`<${o} class="${o===`ul`?`list-disc`:`list-decimal`} space-y-1 pl-5 text-fg">${s.map(e=>`<li>${e}</li>`).join(``)}</${o}>`),s.length=0,null)}let l=[];function u(){l.length!==0&&(n.push(`<p class="text-fg-muted">${l.map(qb).join(` `)}</p>`),l=[])}for(;i<a.length;){let e=a[i],t=a.slice(i).join(`
58
58
  `),r=Gb.exec(t);if(r&&t.startsWith(r[0])){u(),c();let e=r[1];n.push(`<pre class="overflow-auto rounded-md border border-line bg-canvas/80 p-3 text-[11px] leading-5"><code data-lang="${Kb(e)}">${Kb(r[2])}</code></pre>`);let t=r[0].split(`
59
59
  `).length;i+=t;continue}let d=/^(#{1,6})\s+(.+?)\s*$/.exec(e);if(d){u(),c();let e=Math.min(d[1].length,4),t=`h${e}`;n.push(`<${t} class="${[`text-lg font-semibold text-fg`,`text-base font-semibold text-fg`,`text-sm font-semibold text-fg`,`text-sm font-medium text-fg`][e-1]}">${qb(d[2])}</${t}>`),i++;continue}let f=/^[-*]\s+(.+)$/.exec(e);if(f){u(),o!==`ul`&&c(),o=`ul`,s.push(qb(f[1])),i++;continue}let p=/^\d+\.\s+(.+)$/.exec(e);if(p){u(),o!==`ol`&&c(),o=`ol`,s.push(qb(p[1])),i++;continue}if(e.trim()===``){u(),c(),i++;continue}c(),l.push(e.trim()),i++}return u(),c(),n.join(`
60
- `)}var Yb=new Map;function Xb(e,t){return`${e}:${t}`}async function Zb(e,t){let n=Xb(e,t),r=Yb.get(n);if(typeof r==`string`||r)return r;let i=uo(`/jobs/${e}/artifacts/${t}/content`);Yb.set(n,i);try{let e=await i;return Yb.set(n,e),e}catch(e){throw Yb.delete(n),e}}async function Qb(e,t,n){let r=await q(`/jobs/${e}/artifacts/${t}/content`,J({content:n},{method:`PUT`}));return Yb.set(Xb(e,t),n),r.artifact}function $b(e,t){Yb.delete(Xb(e,t))}function ex(e){let t=e.data?.path;return typeof t==`string`&&t.trim().length>0}function tx(e){let t=e.data?.path;return(typeof t==`string`?t.toLowerCase():``).endsWith(`.md`)||e.kind.endsWith(`-md`)||e.kind.includes(`md`)}var nx=[`.md`,`.txt`,`.yml`,`.yaml`,`.json`];function rx(e){if(!ex(e))return!1;let t=e.data.path.toLowerCase();return nx.some(e=>t.endsWith(e))}function ix({jobId:e,artifacts:t,phaseLabel:n,onApprove:r,onRequestChanges:i,onCancel:a,onViewChanges:o,sending:s=!1}){let c=t.some(e=>e.kind===`pr-preview`),[l,u]=(0,x.useState)(t[0]?.id??``),[d,f]=(0,x.useState)(!1),[p,m]=(0,x.useState)(``),[h,g]=(0,x.useState)(null),[_,v]=(0,x.useState)(null);(0,x.useEffect)(()=>{t.length>0&&!t.some(e=>e.id===l)&&u(t[0].id)},[t,l]);let y=t.find(e=>e.id===l)??t[0],b=!!y&&h===y.id,S=s||h!==null;return(0,G.jsxs)(vv,{delayDuration:250,children:[(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-line bg-overlay/30`,children:[(0,G.jsxs)(`header`,{className:`space-y-1 border-b border-line px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`text-sm font-semibold text-fg`,children:[`Review what Coro produced in the `,(0,G.jsx)(`span`,{className:`font-mono`,children:n}),` phase`]}),(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Read the output below, edit it if needed, then approve or request changes.`})]}),t.length>1?(0,G.jsx)(ax,{artifacts:t,activeId:l,onChange:e=>{u(e),g(null)},editingId:h}):null,y?(0,G.jsx)(ox,{jobId:e,artifact:y,editing:b,disabled:s,onStartEdit:()=>g(y.id),onCancelEdit:()=>g(null),onSaved:()=>g(null),onOpenFullScreen:()=>v(y.id)}):null,(0,G.jsxs)(`div`,{className:`space-y-3 border-t border-line bg-overlay/40 px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(`span`,{children:(0,G.jsxs)(Y,{type:`button`,variant:`success`,size:`sm`,disabled:S,onClick:r,children:[(0,G.jsx)(fr,{}),`Approve and continue`]})})}),h===null?null:(0,G.jsx)(xv,{children:`Save or cancel your edit first.`})]}),c&&o?(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,size:`sm`,disabled:s,onClick:o,children:[(0,G.jsx)(Ar,{}),`Review code changes`]}):null,(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,size:`sm`,disabled:s,onClick:()=>f(e=>!e),children:[(0,G.jsx)(ni,{}),d?`Hide change request`:`Request changes`]}),(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,disabled:s,onClick:()=>{window.confirm(`Cancel this run?`)&&a()},children:[(0,G.jsx)(ir,{}),`Cancel run`]})]}),d?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(bb,{rows:3,value:p,onChange:e=>m(e.target.value),placeholder:`Describe what should change before continuing…`,disabled:s}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Y,{type:`button`,size:`sm`,disabled:s||!p.trim(),onClick:()=>{i(p.trim()),m(``),f(!1)},children:`Send feedback`})})]}):(0,G.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:`You can also send any message to Coro using the message box below.`})]})]}),_&&y&&y.id===_?(0,G.jsx)(vx,{jobId:e,artifact:y,onClose:()=>v(null)}):null]})}function ax({artifacts:e,activeId:t,onChange:n,editingId:r}){return(0,G.jsx)(`div`,{className:`overflow-x-auto border-b border-line bg-overlay/20 px-2 py-2`,children:(0,G.jsx)(`div`,{className:`flex min-w-max items-center gap-1`,children:e.map(e=>{let i=e.id===t,a=r===e.id;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:W(`group flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors`,i?`bg-overlay text-fg ring-1 ring-line-strong`:`text-fg-muted hover:bg-overlay/70 hover:text-fg`),children:[(0,G.jsx)(_x,{kind:e.kind}),(0,G.jsx)(`span`,{className:`max-w-[18ch] truncate font-medium`,children:e.title||e.kind||e.id}),(0,G.jsx)(vg,{variant:`neutral`,className:`text-[10px] uppercase`,children:e.kind}),a?(0,G.jsx)(`span`,{className:`rounded-full bg-warning-500/20 px-1.5 py-0.5 text-[9px] uppercase tracking-wide text-warning-300`,children:`Editing`}):null]},e.id)})})})}function ox({jobId:e,artifact:t,editing:n,disabled:r,onStartEdit:i,onCancelEdit:a,onSaved:o,onOpenFullScreen:s}){return ex(t)?(0,G.jsx)(ux,{jobId:e,artifact:t,editing:n,disabled:r,onStartEdit:i,onCancelEdit:a,onSaved:o,onOpenFullScreen:s}):(0,G.jsxs)(`div`,{className:`space-y-3 px-4 py-4`,children:[(0,G.jsx)(sx,{artifact:t}),(0,G.jsx)(cx,{artifact:t})]})}function sx({artifact:e}){let t=typeof e.data.path==`string`?e.data.path:``;return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:e.title||e.kind}),(0,G.jsx)(vg,{variant:`neutral`,children:e.kind}),t?(0,G.jsx)(`span`,{className:`truncate font-mono text-fg-subtle`,children:t}):null,(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[`Posted `,Oy(e.createdAt)]}),e.editedAt?(0,G.jsxs)(`span`,{className:`text-warning-300`,children:[`Edited `,Oy(e.editedAt)]}):null]})}function cx({artifact:e}){if(e.kind===`pr-preview`)return(0,G.jsx)(lx,{data:e.data});let t=typeof e.data.url==`string`?e.data.url:null;return(e.kind===`pr-link`||e.kind===`url`)&&t?(0,G.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`group flex items-start gap-3 rounded-2xl border border-line bg-overlay/40 px-4 py-3 transition-colors hover:border-accent-500/30 hover:bg-overlay/60`,children:[(0,G.jsx)(`div`,{className:`rounded-lg border border-line bg-overlay p-2 text-fg-muted`,children:e.kind===`pr-link`?(0,G.jsx)(Hr,{className:`size-4`}):(0,G.jsx)(Zr,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,G.jsx)(`div`,{className:`mt-0.5 truncate text-sm text-fg-muted`,children:t})]}),(0,G.jsx)(Er,{className:`mt-1 size-4 shrink-0 text-fg-subtle group-hover:text-accent-300`})]}):(0,G.jsx)(pc,{className:`h-[min(40vh,360px)] rounded-xl border border-line bg-canvas/60`,children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words p-4 font-mono text-xs leading-6 text-fg`,children:JSON.stringify(e.data,null,2)})})}function lx({data:e}){let t=t=>typeof e[t]==`string`?e[t]:void 0,n=t(`description`),r=t(`base`),i=t(`sourceBranch`),a=t(`workItem`);return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`This is the pull request Coro will open once you approve. Use “Review code changes” to see the diff.`}),i||a?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[i?(0,G.jsxs)(vg,{variant:`neutral`,className:`font-mono`,children:[i,r?(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[` → `,r]}):null]}):null,a?(0,G.jsx)(vg,{variant:`neutral`,children:a}):null]}):null,n?(0,G.jsx)(pc,{className:`h-[min(40vh,360px)] rounded-xl border border-line bg-canvas/40`,children:(0,G.jsx)(`div`,{className:`prose-coro space-y-2 p-4 text-sm leading-6 text-fg`,dangerouslySetInnerHTML:{__html:Jb(n)}})}):(0,G.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:`No PR description was provided.`})]})}function ux({jobId:e,artifact:t,editing:n,disabled:r,onStartEdit:i,onCancelEdit:a,onSaved:o,onOpenFullScreen:s}){let[c,l]=(0,x.useState)(null),[u,d]=(0,x.useState)(``),[f,p]=(0,x.useState)(!0),[m,h]=(0,x.useState)(null),[g,_]=(0,x.useState)(!1),[v,y]=(0,x.useState)(null),[b,S]=(0,x.useState)(!1),C=(0,x.useRef)(``),w=tx(t),T=rx(t);(0,x.useEffect)(()=>{let n=!1,r=`${t.id}:${t.editedAt??``}`;return C.current=r,p(!0),h(null),Zb(e,t.id).then(e=>{n||C.current!==r||(l(e),d(e),p(!1))}).catch(e=>{n||C.current!==r||(h(e instanceof Error?e.message:String(e)),p(!1))}),()=>{n=!0}},[e,t.id,t.editedAt]);let E=(0,x.useCallback)(async()=>{if(c!=null)try{await navigator.clipboard.writeText(c),S(!0),window.setTimeout(()=>S(!1),1500)}catch{}},[c]),D=(0,x.useCallback)(()=>{if(c==null)return;let e=(t.data.path??`${t.kind}.txt`).split(`/`).pop()??`${t.id}.txt`,n=new Blob([c],{type:`text/plain;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},[c,t.data,t.id,t.kind]),O=(0,x.useCallback)(async()=>{if(c!=null){_(!0),y(null);try{await Qb(e,t.id,u),l(u),o()}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}},[e,t.id,u,c,o]),k=(0,x.useCallback)(()=>{d(c??``),y(null),a()},[c,a]),A=(0,x.useCallback)(()=>{$b(e,t.id),l(null),p(!0),h(null),Zb(e,t.id).then(e=>{l(e),d(e),p(!1)}).catch(e=>{h(e instanceof Error?e.message:String(e)),p(!1)})},[e,t.id]),j=n&&u!==c,M=`h-[min(60vh,640px)]`;return(0,G.jsxs)(`div`,{className:`space-y-3 px-4 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsx)(sx,{artifact:t}),(0,G.jsx)(dx,{editing:n,editable:T,dirty:j,saving:g,disabled:r||f||!!m,copied:b,onCopy:E,onDownload:D,onOpenFullScreen:s,onStartEdit:i,onCancelEdit:k,onSave:O,onRevert:A})]}),f?(0,G.jsx)(`div`,{className:W(`flex items-center justify-center rounded-xl border border-line bg-canvas/40 text-sm text-fg-subtle`,M),children:(0,G.jsx)(`span`,{className:`animate-pulse`,children:`Loading artifact…`})}):m?(0,G.jsx)(gg,{title:`Could not load artifact`,message:m}):n?(0,G.jsx)(hx,{draft:u,onChange:d,disabled:g,heightClass:M,saveError:v}):w?(0,G.jsx)(px,{content:c??``,heightClass:M}):(0,G.jsx)(mx,{content:c??``,heightClass:M})]})}function dx({editing:e,editable:t,dirty:n,saving:r,disabled:i,copied:a,onCopy:o,onDownload:s,onOpenFullScreen:c,onStartEdit:l,onCancelEdit:u,onSave:d,onRevert:f}){return(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,children:e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`primary`,onClick:d,disabled:r||!n,children:[(0,G.jsx)(vi,{}),r?`Saving…`:`Save edits`]}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`ghost`,onClick:u,disabled:r,children:[(0,G.jsx)(Pi,{}),`Cancel edit`]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(fx,{tooltip:a?`Copied!`:`Copy contents`,onClick:o,disabled:i,children:(0,G.jsx)(Sr,{})}),(0,G.jsx)(fx,{tooltip:`Download`,onClick:s,disabled:i,children:(0,G.jsx)(wr,{})}),(0,G.jsx)(fx,{tooltip:`Re-fetch from disk`,onClick:f,disabled:i,children:(0,G.jsx)(gi,{})}),(0,G.jsx)(fx,{tooltip:`Open full screen`,onClick:c,disabled:i,children:(0,G.jsx)(ei,{})}),t?(0,G.jsx)(fx,{tooltip:`Edit this artifact`,onClick:l,disabled:i,children:(0,G.jsx)(ci,{})}):(0,G.jsx)(fx,{tooltip:`This file type is not editable from the dashboard`,onClick:()=>{},disabled:!0,children:(0,G.jsx)(ci,{})})]})})}function fx({children:e,tooltip:t,onClick:n,disabled:r}){return(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:W(`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors`,`hover:bg-overlay hover:text-fg disabled:pointer-events-none disabled:opacity-50`,`[&_svg]:size-4`),children:e})}),(0,G.jsx)(xv,{children:t})]})}function px({content:e,heightClass:t}){return(0,G.jsxs)(Bb,{defaultValue:`rendered`,children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Hb,{value:`rendered`,children:`Rendered`}),(0,G.jsx)(Hb,{value:`source`,children:`Source`})]}),(0,G.jsx)(Ub,{value:`rendered`,className:W(`rounded-xl border border-line bg-canvas/40`),children:(0,G.jsx)(pc,{className:t,children:(0,G.jsx)(`div`,{className:`prose-coro space-y-3 p-4 text-sm leading-6 text-fg`,dangerouslySetInnerHTML:{__html:Jb(e)}})})}),(0,G.jsx)(Ub,{value:`source`,className:W(`rounded-xl border border-line bg-canvas/60`),children:(0,G.jsx)(pc,{className:t,children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words p-4 font-mono text-xs leading-6 text-fg`,children:e})})})]})}function mx({content:e,heightClass:t}){let n=e.trim().startsWith(`{`)||e.trim().startsWith(`[`);return(0,G.jsx)(pc,{className:W(t,`rounded-xl border border-line bg-canvas/60`),children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words p-4 font-mono text-xs leading-6 text-fg`,children:n?gx(e):e})})}function hx({draft:e,onChange:t,disabled:n,heightClass:r,saveError:i}){return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(bb,{value:e,onChange:e=>t(e.target.value),disabled:n,spellCheck:!1,className:W(`w-full resize-none rounded-xl border border-line bg-canvas/70 font-mono text-xs leading-6`,r)}),i?(0,G.jsx)(`div`,{className:`text-xs text-danger-400`,children:i}):null]})}function gx(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function _x({kind:e}){return e===`pr-preview`?(0,G.jsx)(Ar,{className:`size-3.5`}):e===`pr-link`?(0,G.jsx)(Hr,{className:`size-3.5`}):e===`url`?(0,G.jsx)(Zr,{className:`size-3.5`}):e.endsWith(`-md`)||e===`analysis-contract`?(0,G.jsx)(Ir,{className:`size-3.5`}):(0,G.jsx)(jr,{className:`size-3.5`})}function vx({jobId:e,artifact:t,onClose:n}){let[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(null),s=tx(t);(0,x.useEffect)(()=>{let n=!1;return i(null),o(null),Zb(e,t.id).then(e=>{n||i(e)}).catch(e=>{n||o(e instanceof Error?e.message:String(e))}),()=>{n=!0}},[e,t.id,t.editedAt]);let c=t.data.path;return(0,G.jsx)(c_,{open:!0,onOpenChange:e=>{e||n()},children:(0,G.jsxs)(d_,{children:[(0,G.jsxs)(f_,{children:[(0,G.jsx)(p_,{children:t.title}),(0,G.jsxs)(`div`,{className:`space-y-1 text-sm text-fg-muted`,children:[c?(0,G.jsx)(`div`,{className:`font-mono text-xs text-fg-subtle`,children:c}):null,(0,G.jsxs)(`div`,{children:[`Posted `,Oy(t.createdAt),t.editedAt?(0,G.jsxs)(`span`,{className:`ml-2 text-warning-300`,children:[`· Edited `,Oy(t.editedAt)]}):null]})]})]}),(0,G.jsx)(h_,{children:a?(0,G.jsx)(gg,{title:`Could not load artifact`,message:a}):r?s?(0,G.jsxs)(Bb,{defaultValue:`rendered`,className:`space-y-3`,children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Hb,{value:`rendered`,children:`Rendered`}),(0,G.jsx)(Hb,{value:`source`,children:`Source`})]}),(0,G.jsx)(Ub,{value:`rendered`,className:`rounded-2xl border border-line bg-canvas/40`,children:(0,G.jsx)(pc,{className:`h-[70vh]`,children:(0,G.jsx)(`div`,{className:`prose-coro space-y-3 p-5 text-sm leading-6 text-fg`,dangerouslySetInnerHTML:{__html:Jb(r)}})})}),(0,G.jsx)(Ub,{value:`source`,className:`rounded-2xl border border-line bg-canvas/60`,children:(0,G.jsx)(pc,{className:`h-[70vh]`,children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-fg`,children:r})})})]}):(0,G.jsx)(pc,{className:`h-[70vh] rounded-2xl border border-line bg-canvas/60`,children:(0,G.jsx)(`div`,{className:`p-5`,children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-6 text-fg`,children:r})})}):(0,G.jsx)(`div`,{className:`animate-pulse text-sm text-fg-subtle`,children:`Loading artifact content…`})})]})})}var yx=`Approved. Please continue to the next phase.`;function bx({job:e,onSend:t,onCancel:n,onViewChanges:r}){let[i,a]=(0,x.useState)(``),[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(null);if(e.status!==`awaiting-developer-input`)return null;let u=e.workflowPhases?.find(t=>t.name===e.phase);if(u&&u.agent===null)return null;let d=(e.artifacts??[]).filter(t=>t.phase===e.phase),f=d.length>0,p=xx(e.awaitingEvent),m=!e.awaitingNextPhase,h=f&&!m,g=async e=>{s(!0),l(null);try{await t(e),a(``)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}},_=async()=>{if(n){s(!0),l(null);try{await n()}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}};return(0,G.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-warning-500/25 bg-warning-500/8 p-5`,children:[h?(0,G.jsx)(ix,{jobId:e.id,artifacts:d,phaseLabel:e.phase,sending:o,onApprove:()=>void g(yx),onRequestChanges:e=>void g(e),onCancel:()=>void _(),onViewChanges:r}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl border border-warning-500/25 bg-warning-500/10 text-warning-400`,children:(0,G.jsx)(ti,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[15px] font-semibold text-fg`,children:m?`Agent paused for your input`:`Approval needed to continue`}),(0,G.jsx)(`div`,{className:`mt-0.5 text-sm text-fg-muted`,children:m?(0,G.jsxs)(G.Fragment,{children:[`Mid-phase in `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:e.phase}),p?(0,G.jsxs)(G.Fragment,{children:[` — `,(0,G.jsx)(`span`,{className:`italic`,children:p})]}):null]}):(0,G.jsxs)(G.Fragment,{children:[`After phase `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:e.phase}),e.awaitingNextPhase?(0,G.jsxs)(G.Fragment,{children:[` → next: `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:e.awaitingNextPhase})]}):null]})})]})]}),m?null:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsxs)(Y,{type:`button`,onClick:()=>void g(yx),disabled:o,variant:`success`,size:`sm`,children:[(0,G.jsx)(fr,{}),o?`Sending…`:`Approve & continue`]}),(0,G.jsx)(`span`,{className:`text-sm text-fg-muted`,children:`or send the agent back with changes below`})]}),(0,G.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&g(i.trim())},className:`space-y-3`,children:[(0,G.jsx)(bb,{rows:4,value:i,onChange:e=>a(e.target.value),placeholder:m?`Answer the agent or provide the missing detail it asked for…`:`Request changes, clarify the plan, or send additional guidance…`,disabled:o,className:`border-warning-500/20 focus-visible:ring-warning-500/40`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c?(0,G.jsx)(`span`,{className:`text-sm text-danger-400`,children:c}):(0,G.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`The agent will do the work and re-park for approval.`}),(0,G.jsx)(Y,{type:`submit`,disabled:o||!i.trim(),variant:`secondary`,size:`sm`,children:o?`Sending…`:`Send message`})]})]})]}),h&&c?(0,G.jsx)(`div`,{className:`text-sm text-danger-400`,children:c}):null]})}function xx(e){if(!e)return null;if(e.startsWith(`developer-input:`)){let t=e.slice(16).trim();return t.startsWith(`approval after `)?null:t||null}return null}function Sx({jobId:e,artifact:t}){let{kind:n,title:r,data:i}=t;if(n===`pr-link`||n===`url`){let e=i.url;if(e)return(0,G.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`group flex items-start gap-3 rounded-2xl border border-line bg-overlay/40 px-4 py-3 transition-colors hover:border-accent-500/30 hover:bg-overlay/60`,children:[(0,G.jsx)(Cx,{kind:n}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:r}),(0,G.jsx)(vg,{variant:`neutral`,children:n})]}),(0,G.jsx)(`div`,{className:`mt-1 truncate text-sm text-fg-muted`,children:e}),(0,G.jsxs)(`div`,{className:`mt-1.5 text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:[`Posted `,Oy(t.createdAt)]})]}),(0,G.jsx)(Er,{className:`mt-1 size-4 shrink-0 text-fg-subtle group-hover:text-accent-300`})]})}return typeof i.path==`string`&&i.path.trim()?(0,G.jsx)(Tx,{jobId:e,artifact:t}):(0,G.jsx)(Ox,{artifact:t})}function Cx({kind:e}){return(0,G.jsx)(`div`,{className:`rounded-lg border border-line bg-overlay p-2 text-fg-muted`,children:wx(e)})}function wx(e){return e===`pr-link`?(0,G.jsx)(Hr,{className:`size-4`}):e===`url`?(0,G.jsx)(Zr,{className:`size-4`}):e.endsWith(`-md`)||e===`analysis-contract`?(0,G.jsx)(Ir,{className:`size-4`}):(0,G.jsx)(jr,{className:`size-4`})}function Tx({jobId:e,artifact:t}){let[n,r]=(0,x.useState)(!1),i=t.data.path;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`group flex w-full items-start gap-3 rounded-2xl border border-line bg-overlay/40 px-4 py-3 text-left transition-colors hover:border-accent-500/30 hover:bg-overlay/60`,children:[(0,G.jsx)(Cx,{kind:t.kind}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:t.title}),(0,G.jsx)(vg,{variant:`neutral`,children:t.kind}),t.editedAt?(0,G.jsx)(`span`,{className:`rounded-full bg-warning-500/15 px-2 py-0.5 text-[10px] uppercase tracking-wide text-warning-300`,children:`Edited`}):null]}),(0,G.jsx)(`div`,{className:`mt-1 truncate font-mono text-xs text-fg-subtle`,children:i}),(0,G.jsxs)(`div`,{className:`mt-1.5 text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:[`Posted `,Oy(t.createdAt),t.editedAt?` · Edited ${Oy(t.editedAt)}`:``]})]}),(0,G.jsx)(Or,{className:`mt-1 size-4 shrink-0 text-fg-subtle group-hover:text-accent-300`})]}),n?(0,G.jsx)(Ex,{jobId:e,artifact:t,onClose:()=>r(!1)}):null]})}function Ex({jobId:e,artifact:t,onClose:n}){let[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(``),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(null),[h,g]=(0,x.useState)(!1),[_,v]=(0,x.useState)(t.editedAt),y=tx(t),b=rx(t);(0,x.useEffect)(()=>{let n=!1;return i(null),o(``),f(null),Zb(e,t.id).then(e=>{n||(i(e),o(e))}).catch(e=>{n||f(e instanceof Error?e.message:String(e))}),()=>{n=!0}},[e,t.id,_]),(0,x.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!s&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,s]);let S=(0,x.useCallback)(async()=>{if(r!=null)try{await navigator.clipboard.writeText(r),g(!0),window.setTimeout(()=>g(!1),1500)}catch{}},[r]),C=(0,x.useCallback)(()=>{if(r==null)return;let e=(t.data.path??`${t.kind}.txt`).split(`/`).pop()??`${t.id}.txt`,n=new Blob([r],{type:`text/plain;charset=utf-8`}),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)},[r,t.data,t.id,t.kind]),w=(0,x.useCallback)(async()=>{if(r!=null){u(!0),m(null);try{let n=await Qb(e,t.id,a);i(a),v(n.editedAt),c(!1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1)}}},[e,t.id,a,r]),T=(0,x.useCallback)(()=>{$b(e,t.id),i(null),o(``),f(null),Zb(e,t.id).then(e=>{i(e),o(e)}).catch(e=>{f(e instanceof Error?e.message:String(e))})},[e,t.id]),E=s&&a!==r,D=t.data.path;return(0,G.jsx)(vv,{delayDuration:250,children:(0,G.jsx)(c_,{open:!0,onOpenChange:e=>{!e&&!s&&n()},children:(0,G.jsxs)(d_,{children:[(0,G.jsxs)(f_,{children:[(0,G.jsx)(p_,{children:t.title}),(0,G.jsxs)(`div`,{className:`space-y-1 text-sm text-fg-muted`,children:[(0,G.jsx)(`div`,{className:`font-mono text-xs text-fg-subtle`,children:D}),(0,G.jsxs)(`div`,{children:[`Posted `,Oy(t.createdAt),_?(0,G.jsxs)(`span`,{className:`ml-2 text-warning-300`,children:[`· Edited `,Oy(_)]}):null]})]})]}),(0,G.jsxs)(h_,{children:[(0,G.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`primary`,onClick:w,disabled:l||!E,children:[(0,G.jsx)(vi,{}),l?`Saving…`:`Save edits`]}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{o(r??``),m(null),c(!1)},disabled:l,children:[(0,G.jsx)(Pi,{}),`Cancel edit`]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Dx,{tooltip:h?`Copied!`:`Copy contents`,onClick:S,disabled:!r,children:(0,G.jsx)(Sr,{})}),(0,G.jsx)(Dx,{tooltip:`Download`,onClick:C,disabled:!r,children:(0,G.jsx)(wr,{})}),(0,G.jsx)(Dx,{tooltip:`Re-fetch from disk`,onClick:T,disabled:!r,children:(0,G.jsx)(gi,{})}),b?(0,G.jsx)(Dx,{tooltip:`Edit this artifact`,onClick:()=>c(!0),disabled:!r,children:(0,G.jsx)(ci,{})}):(0,G.jsx)(Dx,{tooltip:`This file type is not editable from the dashboard`,disabled:!0,children:(0,G.jsx)(ci,{})})]})}),p?(0,G.jsx)(`div`,{className:`text-xs text-danger-400`,children:p}):null]}),d?(0,G.jsx)(gg,{title:`Could not load artifact`,message:d}):r?s?(0,G.jsx)(`div`,{className:`space-y-2`,children:(0,G.jsx)(bb,{value:a,onChange:e=>o(e.target.value),disabled:l,spellCheck:!1,className:`h-[60vh] w-full resize-none rounded-2xl border border-line bg-canvas/70 font-mono text-xs leading-6`})}):y?(0,G.jsxs)(Bb,{defaultValue:`rendered`,className:`space-y-3`,children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Hb,{value:`rendered`,children:`Rendered`}),(0,G.jsx)(Hb,{value:`source`,children:`Source`})]}),(0,G.jsx)(Ub,{value:`rendered`,className:`rounded-2xl border border-line bg-canvas/40`,children:(0,G.jsx)(pc,{className:`h-[60vh]`,children:(0,G.jsx)(`div`,{className:`prose-coro space-y-3 p-5 text-sm leading-6 text-fg`,dangerouslySetInnerHTML:{__html:Jb(r)}})})}),(0,G.jsx)(Ub,{value:`source`,className:`rounded-2xl border border-line bg-canvas/60`,children:(0,G.jsx)(pc,{className:`h-[60vh]`,children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-fg`,children:r})})})]}):(0,G.jsx)(pc,{className:`h-[60vh] rounded-2xl border border-line bg-canvas/60`,children:(0,G.jsx)(`div`,{className:`p-5`,children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-6 text-fg`,children:r})})}):(0,G.jsx)(`div`,{className:`animate-pulse text-sm text-fg-subtle`,children:`Loading artifact content…`})]})]})})})}function Dx({children:e,tooltip:t,onClick:n,disabled:r}){return(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:W(`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors`,`hover:bg-overlay hover:text-fg disabled:pointer-events-none disabled:opacity-50`,`[&_svg]:size-4`),children:e})}),(0,G.jsx)(xv,{children:t})]})}function Ox({artifact:e}){let[t,n]=(0,x.useState)(!1);return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-line bg-overlay/40`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex w-full items-center justify-between gap-3 px-4 py-3 text-left transition-colors hover:bg-overlay/60`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,G.jsx)(Cx,{kind:e.kind}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:e.kind})]})]}),(0,G.jsx)(lr,{className:W(`size-4 shrink-0 text-fg-subtle transition-transform`,t&&`rotate-180`)})]}),t?(0,G.jsx)(`pre`,{className:`max-h-80 overflow-auto border-t border-line bg-canvas/60 p-4 font-mono text-xs text-fg whitespace-pre-wrap break-words`,children:JSON.stringify(e.data,null,2)}):null]})}function kx({value:e,className:t,indicatorClassName:n}){return(0,G.jsx)(`div`,{className:W(`relative h-1.5 overflow-hidden rounded-full bg-overlay`,t),children:(0,G.jsx)(`div`,{className:W(`h-full rounded-full bg-accent-400 transition-[width]`,n),style:{width:`${Math.max(0,Math.min(100,e))}%`}})})}function Ax({checked:e,onCheckedChange:t,disabled:n=!1,ariaLabel:r,size:i=`md`,className:a}){let o=()=>{n||t(!e)},s=i===`sm`?{track:`h-4 w-7`,thumb:`size-3`,translate:`translate-x-3`}:{track:`h-5 w-9`,thumb:`size-4`,translate:`translate-x-4`};return(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":r,disabled:n,onClick:o,className:W(`relative inline-flex shrink-0 items-center rounded-full transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60`,`disabled:cursor-not-allowed disabled:opacity-50`,s.track,e?`bg-accent-500`:`bg-overlay ring-1 ring-line-strong`,a),children:(0,G.jsx)(`span`,{className:W(`inline-block transform rounded-full bg-white shadow transition-transform`,s.thumb,e?s.translate:`translate-x-0.5`)})})}function jx(e){return e.summary?.status??e.status}function Mx(e){return e===`failed`||e===`escalated`}function Nx({status:e,rateLimitInfo:t}){let n=ko(e),r=Px(e===`awaiting-rate-limit`?t?.resumeAt:void 0);return(0,G.jsxs)(vg,{variant:`neutral`,className:zo(n.tone),children:[(0,G.jsx)(`span`,{className:W(`size-1.5 rounded-full`,Bo(n.tone),n.pulse&&`animate-pulse-dot`)}),n.label,r?(0,G.jsx)(`span`,{className:`ml-1 font-mono tabular-nums text-[10px] opacity-80`,children:r}):null]})}function Px(e){let[t,n]=(0,x.useState)(()=>Date.now());if((0,x.useEffect)(()=>{if(e==null)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e==null)return null;let r=Math.max(0,Math.ceil((e-t)/1e3)),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60,s=e=>e.toString().padStart(2,`0`);return`${s(i)}:${s(a)}:${s(o)}`}function Fx(e){return Ty(e)}function Ix(e){let t={inputTokens:0,outputTokens:0,cacheReadInputTokens:0,cacheCreationInputTokens:0,totalCostUsd:0,totalDurationMs:0};for(let n of e){let e=n.summary?.tokenUsage;e&&(t.inputTokens+=e.inputTokens??0,t.outputTokens+=e.outputTokens??0,t.cacheReadInputTokens+=e.cacheReadInputTokens??0,t.cacheCreationInputTokens+=e.cacheCreationInputTokens??0,t.totalCostUsd+=e.totalCostUsd??0),n.startedAt&&n.completedAt&&(t.totalDurationMs+=new Date(n.completedAt).getTime()-new Date(n.startedAt).getTime())}return t}function Lx({children:e}){let t=(0,x.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.name,n);let n=[],r=new Set,i=0;for(;t.size>0&&i<50;){let e=[];for(let n of t.values())n.dependsOn.every(e=>r.has(e)||!t.has(e))&&e.push(n);if(e.length===0){n.push(Array.from(t.values()));break}for(let n of e)r.add(n.name),t.delete(n.name);n.push(e),i++}return n},[e]);return t.length===0?null:(0,G.jsx)(`div`,{className:`flex flex-col gap-3 overflow-x-auto`,children:t.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`w-10 shrink-0 text-[10px] uppercase tracking-[0.16em] text-fg-subtle`,children:[`L`,t+1]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>{let t=jx(e);return(0,G.jsxs)(`div`,{className:W(`flex items-center gap-2 rounded-lg border px-2.5 py-1.5 text-xs`,zo(ko(t).tone)),children:[(0,G.jsx)(Nx,{status:t,rateLimitInfo:e.summary?.rateLimitInfo}),(0,G.jsx)(`span`,{className:`font-medium`,children:e.name}),e.dependsOn.length>0?(0,G.jsxs)(`span`,{className:`text-[10px] text-fg-subtle`,children:[`← `,e.dependsOn.join(`, `)]}):null]},e.name)})})]},t))})}function Rx({jobId:e,child:t,onMutated:n}){let[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(``),d=(0,x.useRef)(null),f=async(r,a,s)=>{i(s),o(null);try{await q(`/jobs/${e}/children/${encodeURIComponent(t.name)}/${r}`,J(a??{},{method:`POST`})),c(!1),u(``),n()}catch(e){o(e instanceof Error?e.message:`Action failed`)}finally{i(null)}},p=Mx(jx(t));if(t.status===`complete`||t.status===`skipped`||t.status===`cancelled`)return null;let m=()=>{if(!s){c(!0),queueMicrotask(()=>d.current?.focus());return}f(`resume`,l.trim()?{note:l.trim()}:void 0,`resume`)},h=()=>{window.confirm(`Start a fresh job for "${t.name}"?\n\nThis DROPS the existing child Job (transcript, partial work, any open PR will be orphaned) and dispatches a brand-new Job from the original spec. Use "Resume" instead unless the current Job is genuinely unrecoverable.`)&&f(`rerun`,void 0,`rerun`)};return(0,G.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t.status===`ready`?(0,G.jsxs)(Y,{onClick:()=>void f(`start`,void 0,`start`),disabled:r!==null,size:`sm`,className:`h-7 px-2 text-[11px]`,title:`Start this child now. Dependencies are satisfied; this bypasses the parallelism cap and any halt-on-failure pause.`,children:[(0,G.jsx)(ui,{className:`size-3.5`}),r===`start`?`…`:`Start`]}):null,p?(0,G.jsxs)(Y,{onClick:m,disabled:r!==null,size:`sm`,className:`h-7 px-2 text-[11px]`,title:s?`Resume the existing child Job — optionally with the note as developer guidance`:`Resume the existing child Job at its last phase`,children:[(0,G.jsx)(ui,{className:`size-3.5`}),r===`resume`?`…`:`Resume`]}):null,(0,G.jsxs)(Y,{onClick:()=>void f(`abandon`,void 0,`abandon`),disabled:r!==null,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-[11px] text-danger-400 hover:bg-danger-500/10 hover:text-danger-400`,title:p?`Abandon — mark as not-needed, unblocks dependents`:`Abandon this child — unblocks dependents, descopes the work`,children:[(0,G.jsx)(ki,{className:`size-3.5`}),r===`abandon`?`…`:`Abandon`]}),p?(0,G.jsxs)(Jh,{children:[(0,G.jsx)(Yh,{asChild:!0,children:(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:`h-7 px-1.5 text-[11px]`,disabled:r!==null,"aria-label":`More actions`,title:`More actions`,children:(0,G.jsx)(Tr,{className:`size-3.5`})})}),(0,G.jsx)(Zh,{align:`end`,className:`min-w-56`,children:(0,G.jsxs)(Qh,{onSelect:e=>{e.preventDefault(),h()},className:`text-danger-400 focus:text-danger-400`,children:[(0,G.jsx)(gi,{className:`size-3.5`}),`Start fresh job…`]})})]}):(0,G.jsx)(`span`,{"aria-hidden":!0,className:`inline-block h-7 w-7`})]}),s&&p?(0,G.jsxs)(`div`,{className:`flex w-full max-w-md flex-col items-end gap-1.5`,children:[(0,G.jsx)(`textarea`,{ref:d,value:l,onChange:e=>u(e.target.value),placeholder:`Optional: tell the agent what changed (becomes developer-input for the next turn)`,rows:3,className:`w-full resize-y rounded-md border border-line bg-overlay/60 px-2 py-1.5 text-[11px] text-fg placeholder:text-fg-subtle focus:border-accent focus:outline-none`,disabled:r!==null}),(0,G.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,G.jsx)(Y,{onClick:()=>{c(!1),u(``)},variant:`ghost`,size:`sm`,className:`h-7 px-2 text-[11px]`,disabled:r!==null,children:`Cancel`})})]}):null,a?(0,G.jsx)(`span`,{className:`text-[11px] text-danger-400`,title:a,children:a}):null]})}function zx({label:e,value:t,detail:n}){return(0,G.jsxs)(`div`,{className:`rounded-xl border border-line bg-overlay/40 p-3`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:e}),(0,G.jsx)(`div`,{className:`mt-1 text-lg font-semibold text-fg`,children:t}),n?(0,G.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:n}):null]})}function Bx({job:e,children:t,onMutated:n}){let[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(null),s=(0,x.useMemo)(()=>t.filter(e=>Mx(jx(e))),[t]);if(e.status!==`awaiting-developer-input`||s.length===0)return null;let c=async t=>{i(t),o(null);let r=[];for(let n of s)try{await q(`/jobs/${e.id}/children/${encodeURIComponent(n.name)}/${t}`,J({},{method:`POST`}))}catch(e){r.push(`${n.name}: ${e instanceof Error?e.message:`failed`}`)}i(null),r.length>0&&o(`${r.length} action(s) failed — ${r.slice(0,2).join(`; `)}${r.length>2?`…`:``}`),n()},l=s.length===1?By.singularLower:By.pluralLower,u=`${s.length} failed ${l}`;return(0,G.jsxs)(`div`,{className:`rounded-xl border border-warning-500/40 bg-warning-500/10 p-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(Mi,{className:`mt-0.5 size-4 shrink-0 text-warning-400`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Campaign halted on failure`}),(0,G.jsxs)(`p`,{className:`text-[12px] leading-snug text-fg-muted`,children:[u,` — Resume retries each at its last phase, Abandon descopes them. Use per-row buttons below if you want to add a note or mix actions.`]}),(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-fg-subtle`,children:s.map(e=>e.name).join(`, `)})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsxs)(Y,{onClick:()=>void c(`resume`),disabled:r!==null,size:`sm`,className:`h-7 px-2 text-[11px]`,title:`Resume all ${u} at their last phase`,children:[(0,G.jsx)(ui,{className:`size-3.5`}),r===`resume`?`…`:`Resume all (${s.length})`]}),(0,G.jsxs)(Y,{onClick:()=>void c(`abandon`),disabled:r!==null,variant:`outline`,size:`sm`,className:`h-7 px-2 text-[11px] text-danger-400 hover:bg-danger-500/10 hover:text-danger-400`,title:`Abandon all ${u} — descope and let the campaign continue`,children:[(0,G.jsx)(ki,{className:`size-3.5`}),r===`abandon`?`…`:`Abandon all (${s.length})`]})]})]}),a?(0,G.jsx)(`div`,{className:`mt-2 text-[11px] text-danger-400`,children:a}):null]})}function Vx({job:e,onMutated:t}){let n=e.campaignChildren??[],r=Ix(n),i=n.reduce((e,t)=>(e[t.status]=(e[t.status]??0)+1,e),{pending:0,ready:0,dispatched:0,complete:0,failed:0,escalated:0,skipped:0,cancelled:0}),a=(0,x.useMemo)(()=>{let e={};for(let t of n){let n=jx(t);e[n]=(e[n]??0)+1}return e},[n]),[o,s]=(0,x.useState)(!0),c=(0,x.useMemo)(()=>o?n.filter(e=>e.status!==`cancelled`):n,[n,o]);if(n.length===0)return(0,G.jsx)(lg,{children:(0,G.jsxs)(ug,{children:[(0,G.jsx)(dg,{children:By.plural}),(0,G.jsx)(fg,{children:`No ${By.pluralLower} registered yet. The campaign planner is still defining the execution graph.`})]})});let l=n.reduce((e,t)=>e+(t.summary?.prMappings.length??0),0),u=n.length-i.cancelled,d=i.complete+i.skipped,f=u===0?0:d/u*100;return(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`gap-4 border-b border-line pb-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(dg,{children:By.plural}),(0,G.jsx)(fg,{children:`Dependency-aware execution view with per-${By.singularLower} controls.`})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:Object.keys(a).filter(e=>a[e]>0).map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px]`,children:[(0,G.jsx)(Nx,{status:e}),(0,G.jsx)(`span`,{className:`tabular-nums text-fg-muted`,children:a[e]})]},e))})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-4`,children:[(0,G.jsx)(zx,{label:`Progress`,value:`${d}/${u}`,detail:`${Math.round(f)}% complete`}),(0,G.jsx)(zx,{label:`Tokens`,value:Fx(r.inputTokens+r.outputTokens),detail:`Across all ${By.pluralLower}`}),(0,G.jsx)(zx,{label:`Cost`,value:Ey(r.totalCostUsd),detail:`Aggregate ${By.singularLower} spend`}),(0,G.jsx)(zx,{label:`Pull requests`,value:l.toString(),detail:`Opened across ${By.pluralLower}`})]}),(0,G.jsx)(kx,{value:f})]}),(0,G.jsxs)(pg,{className:`space-y-5 pt-5`,children:[(0,G.jsx)(Bx,{job:e,children:n,onMutated:t}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-[11px] font-medium uppercase tracking-[0.16em] text-fg-subtle`,children:[(0,G.jsx)(Yr,{className:`size-3.5`}),`Dependency graph`]}),(0,G.jsx)(Lx,{children:c})]}),i.cancelled>0?(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-2 text-[11px] text-fg-muted`,children:[(0,G.jsxs)(`span`,{children:[`Hide cancelled (`,i.cancelled,`)`]}),(0,G.jsx)(Ax,{size:`sm`,checked:o,onCheckedChange:s,ariaLabel:`Hide cancelled children`})]}):null,(0,G.jsx)(`div`,{className:`overflow-x-auto rounded-2xl border border-line`,children:(0,G.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,G.jsx)(`thead`,{className:`bg-overlay/40 text-fg-subtle`,children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Name`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Status`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Phase`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Tracker`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Job`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`PRs`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Tokens`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Actions`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line`,children:c.map(n=>{let r=n.summary?.phase??`—`,i=n.summary?.prMappings.length??0,a=(n.summary?.tokenUsage?.inputTokens??0)+(n.summary?.tokenUsage?.outputTokens??0);return(0,G.jsxs)(`tr`,{className:`transition-colors hover:bg-overlay/40`,children:[(0,G.jsxs)(`td`,{className:`px-3 py-2.5`,children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:n.name}),n.description?(0,G.jsx)(`div`,{className:`line-clamp-2 max-w-[280px] text-[11px] text-fg-subtle`,children:n.description}):null]}),(0,G.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,G.jsx)(Nx,{status:jx(n),rateLimitInfo:n.summary?.rateLimitInfo})}),(0,G.jsx)(`td`,{className:`px-3 py-2.5 text-fg-muted`,children:r}),(0,G.jsx)(`td`,{className:`px-3 py-2.5`,children:n.trackerRef?(0,G.jsx)(`a`,{href:n.trackerRef.url,target:`_blank`,rel:`noreferrer`,className:`text-accent-300 hover:text-accent-400`,children:n.trackerRef.key}):(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`—`})}),(0,G.jsx)(`td`,{className:`px-3 py-2.5`,children:n.jobId?(0,G.jsxs)(Dn,{to:`/jobs/${n.jobId}`,className:`font-mono text-[11px] text-accent-300 hover:text-accent-400`,title:`Open ${By.singularLower} detail`,children:[n.jobId.slice(0,18),`…`]}):(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`—`})}),(0,G.jsx)(`td`,{className:`px-3 py-2.5 text-right tabular-nums text-fg-muted`,children:i}),(0,G.jsx)(`td`,{className:`px-3 py-2.5 text-right tabular-nums text-fg-muted`,children:a>0?Fx(a):`—`}),(0,G.jsx)(`td`,{className:`px-3 py-2.5 text-right`,children:(0,G.jsx)(Rx,{jobId:e.id,child:n,onMutated:t})})]},n.name)})})]})}),(0,G.jsxs)(`div`,{className:`grid gap-3 border-t border-line pt-4 text-sm sm:grid-cols-4`,children:[(0,G.jsx)(Hx,{label:`Tokens in / out`,value:`${Fx(r.inputTokens)} / ${Fx(r.outputTokens)}`}),(0,G.jsx)(Hx,{label:`Cache read`,value:Fx(r.cacheReadInputTokens)}),(0,G.jsx)(Hx,{label:`Latest update`,value:Cy(e.updatedAt)}),(0,G.jsx)(Hx,{label:`Running ${By.pluralLower}`,value:(i.dispatched+i.ready).toString()})]})]})]})}function Hx({label:e,value:t}){return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:e}),(0,G.jsx)(`div`,{className:`mt-1 font-medium text-fg`,children:t})]})}function Ux({status:e,lastHeartbeat:t}){let[n,r]=(0,x.useState)(0);(0,x.useEffect)(()=>{let e=setInterval(()=>{r(Math.floor((Date.now()-t)/1e3))},1e3);return()=>clearInterval(e)},[t]);let i=Ao(e);return(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border px-2.5 py-1 text-[11px] ${zo(i.tone)}`,children:[(0,G.jsx)(`span`,{className:`size-1.5 rounded-full ${Bo(i.tone)} ${i.pulse?`animate-pulse-dot`:``}`}),(0,G.jsx)(`span`,{className:`font-medium uppercase tracking-[0.16em]`,children:i.label}),e===`connected`&&n>0?(0,G.jsxs)(`span`,{className:`text-fg-muted normal-case tracking-normal`,children:[`· `,Cy(new Date(Date.now()-n*1e3))]}):null]})}var Wx=[{value:`tenant`,label:`Team`},{value:`repo`,label:`Repo`},{value:`evaluator`,label:`Let evaluator decide`}],Gx=[{value:`all`,label:`All`},{value:`pending`,label:`Pending`},{value:`approved`,label:`Approved`},{value:`rejected`,label:`Rejected`}];function Kx(e){return e.status??`pending`}function qx(e){return e.userLayer??e.suggestedLayer}function Jx(e){return e.userLayer===`tenant`?`tenant`:e.userLayer===`repo`?`repo`:`evaluator`}function Yx(e){return e===`approved`?`success`:e===`rejected`?`danger`:`warning`}function Xx({jobId:e,insights:t,onChanged:n}){let[r,i]=(0,x.useState)(t),[a,o]=(0,x.useState)(`all`),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(null),[d,f]=(0,x.useState)({summary:``,detail:``,suggestion:``}),[p,m]=(0,x.useState)(null),[h,g]=(0,x.useState)(null);async function _(){try{i((await q(`/jobs/${encodeURIComponent(e)}/insights`)).insights??[]),m(null)}catch(e){m(e instanceof K?`${e.status}: ${e.message}`:e.message)}}(0,x.useEffect)(()=>{_()},[e]),(0,x.useEffect)(()=>{t.length>r.length&&_()},[t.length]);let v=(0,x.useMemo)(()=>{let e={pending:0,approved:0,rejected:0};for(let t of r)e[Kx(t)]++;return e},[r]),y=(0,x.useMemo)(()=>a===`all`?r:r.filter(e=>Kx(e)===a),[r,a]),b=(0,x.useMemo)(()=>{let e=new Map,t=0;for(let n of r)Kx(n)!==`rejected`&&(t++,e.set(n.id??`${n.phase}:${n.summary}`,t));return e},[r]);async function S(t,r){g(t),m(null);try{let a=await q(`/jobs/${encodeURIComponent(e)}/insights/${encodeURIComponent(t)}`,J(r,{method:`PATCH`}));a?.insight?i(e=>e.map(e=>e.id===t?a.insight:e)):await _(),n()}catch(e){m(e instanceof K?`${e.status}: ${e.message}`:e.message)}finally{g(null)}}function C(e){u(e.id??null),f({summary:e.editedSummary??e.summary,detail:e.editedDetail??e.detail,suggestion:e.editedSuggestion??e.suggestion??``})}async function w(e){if(!e.id)return;let t={};t.editedSummary=d.summary===e.summary?null:d.summary,t.editedDetail=d.detail===e.detail?null:d.detail;let n=e.suggestion??``;t.editedSuggestion=d.suggestion===n?null:d.suggestion||null,await S(e.id,t),u(null)}function T(){u(null)}async function E(e,t){e.id&&await S(e.id,{userLayer:t===`evaluator`?null:t})}async function D(e,t){e.id&&await S(e.id,{status:t})}return(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`gap-3 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(dg,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Xr,{className:`size-4 text-amber-500`,"aria-hidden":`true`}),`Insights`,(0,G.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`(`,v.pending,` pending · `,v.approved,` approved · `,v.rejected,` rejected)`]})]}),(0,G.jsx)(fg,{children:`Findings recorded by agents during the run. Approve the ones you want the evaluator to ship as memory PRs and tag whether they belong in your team or repo intelligence layer. Rejected entries are kept for audit but skipped by the evaluator.`})]}),(0,G.jsx)(ab,{options:Gx,value:a,onChange:o,size:`sm`,ariaLabel:`Filter insights by status`})]}),(0,G.jsxs)(pg,{className:`space-y-3 pt-5`,children:[p?(0,G.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:p}):null,y.length===0?(0,G.jsx)(`div`,{className:`rounded-md border border-dashed border-line px-4 py-8 text-center text-sm text-muted-foreground`,children:r.length===0?`No insights have been recorded yet. Agents call add_insight during the run to surface findings here.`:`No insights match the "${a}" filter.`}):null,y.map(e=>{let t=Kx(e),n=e.id??`${e.phase}:${e.summary}`,r=s===n,i=l===n,a=h===e.id,o=qx(e),u=e.editedSummary||e.editedDetail||e.editedSuggestion,p=e.editedSummary??e.summary,m=e.editedDetail??e.detail,g=e.editedSuggestion??e.suggestion,_=b.get(n);return(0,G.jsxs)(`div`,{className:W(`rounded-md border border-line bg-overlay/40 transition-opacity`,t===`rejected`&&`opacity-60`,a&&`opacity-50`),children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3 p-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>c(r?null:n),className:`mt-0.5 text-muted-foreground hover:text-foreground`,"aria-label":r?`Collapse`:`Expand`,children:r?(0,G.jsx)(lr,{className:`size-4`}):(0,G.jsx)(ur,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[_==null?null:(0,G.jsxs)(vg,{variant:`neutral`,className:`font-mono normal-case tracking-normal`,title:e.id?`Insight ${e.id}`:void 0,children:[`#`,_]}),(0,G.jsx)(vg,{variant:Yx(t),className:`capitalize`,children:t}),(0,G.jsx)(vg,{variant:`neutral`,className:`font-mono`,children:e.phase}),(0,G.jsx)(vg,{variant:`accent`,children:e.category}),o?(0,G.jsxs)(vg,{variant:`neutral`,children:[e.userLayer?`layer: `:`suggested: `,o===`tenant`?`team`:`repo`]}):null,e.sourceChildName?(0,G.jsxs)(vg,{variant:`neutral`,children:[`from `,e.sourceChildName]}):null,u?(0,G.jsx)(vg,{variant:`warning`,children:`edited`}):null]}),(0,G.jsx)(`p`,{className:`text-sm font-medium leading-snug`,children:p}),e.editedAt||e.decidedAt?(0,G.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[e.decidedAt?(0,G.jsxs)(G.Fragment,{children:[`decided `,Cy(e.decidedAt),e.decidedBy?` by ${e.decidedBy}`:``]}):null,e.decidedAt&&e.editedAt?` · `:``,e.editedAt?(0,G.jsxs)(G.Fragment,{children:[`edited `,Cy(e.editedAt),e.editedBy?` by ${e.editedBy}`:``]}):null]}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[t===`approved`?null:(0,G.jsxs)(Y,{size:`sm`,variant:`success`,disabled:a,onClick:()=>void D(e,`approved`),children:[(0,G.jsx)(cr,{className:`size-3.5`}),` Approve`]}),t===`rejected`?null:(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,disabled:a,onClick:()=>void D(e,`rejected`),children:[(0,G.jsx)(Pi,{className:`size-3.5`}),` Reject`]}),t===`pending`?null:(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,disabled:a,onClick:()=>void D(e,`pending`),title:`Reset to pending`,children:(0,G.jsx)(gi,{className:`size-3.5`})})]})]}),r?(0,G.jsxs)(`div`,{className:`space-y-4 border-t border-line/60 px-3 py-4`,children:[i?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Summary`}),(0,G.jsx)(bb,{rows:2,value:d.summary,onChange:e=>f({...d,summary:e.target.value})})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Detail`}),(0,G.jsx)(bb,{rows:6,value:d.detail,onChange:e=>f({...d,detail:e.target.value})})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Suggestion (optional)`}),(0,G.jsx)(bb,{rows:3,value:d.suggestion,onChange:e=>f({...d,suggestion:e.target.value})})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,onClick:T,children:`Cancel`}),(0,G.jsx)(Y,{size:`sm`,variant:`primary`,onClick:()=>void w(e),children:`Save edits`})]})]}):(0,G.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Detail`}),(0,G.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap leading-relaxed`,children:m})]}),g?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Suggestion`}),(0,G.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap leading-relaxed`,children:g})]}):null,u?(0,G.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer`,children:`Show original (pre-edit)`}),(0,G.jsxs)(`div`,{className:`mt-2 space-y-2 rounded bg-muted/30 p-2`,children:[(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`Summary:`}),` `,e.summary]}),(0,G.jsxs)(`p`,{className:`whitespace-pre-wrap`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`Detail:`}),` `,e.detail]}),e.suggestion?(0,G.jsxs)(`p`,{className:`whitespace-pre-wrap`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`Suggestion:`}),` `,e.suggestion]}):null]})]}):null]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-line/40 pt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Target layer:`}),(0,G.jsx)(ab,{options:Wx,value:Jx(e),onChange:t=>void E(e,t),size:`sm`,ariaLabel:`Target intelligence layer`})]}),i?null:(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,onClick:()=>C(e),children:[(0,G.jsx)(li,{className:`size-3.5`}),` Edit`]})]})]}):null]},n)})]})]})}async function Zx(e,t={}){let n=new URLSearchParams;t.base&&n.set(`base`,t.base),t.head&&n.set(`head`,t.head);let r=n.toString();return q(`/jobs/${e}/diff${r?`?${r}`:``}`)}var Qx=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function $x(e){return e===`/dev/null`?e:e.startsWith(`a/`)||e.startsWith(`b/`)?e.slice(2):e}function eS(e){if(!e.trim())return[];let t=e.split(`
61
- `),n=[],r=null,i=null,a=0,o=0,s=()=>{if(r){let e=r.status===`deleted`?r.oldPath:r.newPath||r.oldPath;r.path=e,n.push(r)}};for(let e of t){if(e.startsWith(`diff --git`)){s(),i=null;let t=e.match(/^diff --git (.+) (.+)$/),n=t?$x(t[1]):``,a=t?$x(t[2]):``;r={oldPath:n,newPath:a,path:a||n,status:`modified`,binary:!1,hunks:[],additions:0,deletions:0};continue}if(!r)continue;if(e.startsWith(`new file mode`)){r.status=`added`;continue}if(e.startsWith(`deleted file mode`)){r.status=`deleted`;continue}if(e.startsWith(`rename from `)){r.status=`renamed`,r.oldPath=e.slice(12);continue}if(e.startsWith(`rename to `)){r.status=`renamed`,r.newPath=e.slice(10);continue}if(e.startsWith(`Binary files`)||e.startsWith(`GIT binary patch`)){r.binary=!0;continue}if(e.startsWith(`--- `)){let t=$x(e.slice(4));t!==`/dev/null`&&(r.oldPath=t);continue}if(e.startsWith(`+++ `)){let t=$x(e.slice(4));t!==`/dev/null`&&(r.newPath=t);continue}let t=e.match(Qx);if(t){a=parseInt(t[1],10),o=parseInt(t[3],10),i={header:e,lines:[]},r.hunks.push(i);continue}if(i&&!e.startsWith(`\\`))if(e.startsWith(`+`))i.lines.push({type:`add`,text:e.slice(1),oldNo:null,newNo:o}),r.additions+=1,o+=1;else if(e.startsWith(`-`))i.lines.push({type:`del`,text:e.slice(1),oldNo:a,newNo:null}),r.deletions+=1,a+=1;else{let t=e.startsWith(` `)?e.slice(1):e;i.lines.push({type:`context`,text:t,oldNo:a,newNo:o}),a+=1,o+=1}}return s(),n}async function tS(){return q(`/system/editors`)}async function nS(e,t){return q(`/jobs/${e}/open`,J(t,{method:`POST`}))}var rS={code:`M23.15 2.587L18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z`,cursor:`M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23`,codium:`M11.583.54a1.467 1.467 0 0 0-.441 2.032c2.426 3.758 2.999 6.592 2.75 9.075-1.004 4.756-3.187 5.721-5.094 5.721-1.863 0-1.364-3.065.036-3.962.836-.522 1.906-.861 2.728-.861.814 0 1.474-.658 1.474-1.47 0-.812-.66-1.47-1.474-1.47-.96 0-1.901.202-2.78.545.18-.847.246-1.762.014-2.735-.352-1.477-1.367-2.889-3.128-4.257a1.476 1.476 0 0 0-2.069.256c-.5.64-.384 1.564.259 2.063 1.435 1.114 1.908 1.939 2.07 2.618.162.679.032 1.407-.293 2.408-.416 1.349-.9 2.553-1.11 3.708-.105.568-.114 1.187-.14 1.68-1.034-1.006-1.438-2.336-1.438-4.279 0-.811-.66-1.47-1.474-1.47-.814.001-1.473.659-1.473 1.47 0 2.654.776 5.179 2.855 6.863 1.883 1.793 6.67 1.13 6.67 4.01 0 .812 1.19 1.208 2.004 1.208.834 0 1.885-.558 1.885-1.208 0-3.267 3.443-5.253 9.11-5.244A1.472 1.472 0 0 0 24 15.773 1.472 1.472 0 0 0 22.53 14.3c-.388 0-.765.013-1.138.035.634-1.49.915-3.13.857-4.903a1.473 1.473 0 0 0-1.522-1.42 1.472 1.472 0 0 0-1.425 1.517c.076 2.32-.01 4.393-1.74 5.485-.49.31-1.062.58-1.604.58.42-1.145.738-2.353.869-3.655.083-.83.091-1.818-.003-2.585-.148-1.188-.325-2.535.126-3.55.405-.874 1.313-1.24 2.645-1.24.814 0 1.473-.659 1.473-1.47 0-.811-.659-1.47-1.473-1.47-1.98 0-3.481 1.042-4.332 2.3-.445-.95-.987-1.929-1.642-2.943a1.474 1.474 0 0 0-2.037-.44z`,windsurf:`M23.55 5.067c-1.2038-.002-2.1806.973-2.1806 2.1765v4.8676c0 .972-.8035 1.7594-1.7597 1.7594-.568 0-1.1352-.286-1.4718-.7659l-4.9713-7.1003c-.4125-.5896-1.0837-.941-1.8103-.941-1.1334 0-2.1533.9635-2.1533 2.153v4.8957c0 .972-.7969 1.7594-1.7596 1.7594-.57 0-1.1363-.286-1.4728-.7658L.4076 5.1598C.2822 4.9798 0 5.0688 0 5.2882v4.2452c0 .2147.0656.4228.1884.599l5.4748 7.8183c.3234.462.8006.8052 1.3509.9298 1.3771.313 2.6446-.747 2.6446-2.0977v-4.893c0-.972.7875-1.7593 1.7596-1.7593h.003a1.798 1.798 0 0 1 1.4718.7658l4.9723 7.0994c.4135.5905 1.05.941 1.8093.941 1.1587 0 2.1515-.9645 2.1515-2.153v-4.8948c0-.972.7875-1.7594 1.7596-1.7594h.194a.22.22 0 0 0 .2204-.2202v-4.622a.22.22 0 0 0-.2203-.2203Z`};rS[`code-insiders`]=rS.code;function iS({id:e,className:t}){let n=rS[e];return n?(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,className:t,fill:`currentColor`,"aria-hidden":`true`,role:`img`,children:(0,G.jsx)(`path`,{d:n})}):(0,G.jsx)(xr,{className:t})}var aS=10,oS=800;function sS({files:e,truncated:t,defaultCollapsed:n,showFileMap:r=!0}){let i=(0,x.useMemo)(()=>{if(n)return!1;let t=e.reduce((e,t)=>e+t.additions+t.deletions,0);return e.length<=aS&&t<=oS},[e,n]),[a,o]=(0,x.useState)(()=>e.map(()=>i));(0,x.useEffect)(()=>{o(e.map(()=>i))},[e,i]);let s=(0,x.useRef)([]),c=(0,x.useCallback)(t=>o(e.map(()=>t)),[e]),l=(0,x.useCallback)(e=>o(t=>t.map((t,n)=>n===e?!t:t)),[]),u=(0,x.useCallback)(e=>{o(t=>t.map((t,n)=>n===e?!0:t)),requestAnimationFrame(()=>s.current[e]?.scrollIntoView({block:`nearest`,behavior:`smooth`}))},[]);if(e.length===0)return null;let d=a.length>0&&a.every(Boolean),f=a.every(e=>!e);return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[r&&e.length>1?(0,G.jsx)(cS,{files:e,onJump:u,onExpandAll:()=>c(!0),onCollapseAll:()=>c(!1),allOpen:d,allClosed:f}):null,e.map((e,t)=>(0,G.jsx)(lS,{file:e,open:a[t]??!1,onToggle:()=>l(t),cardRef:e=>{s.current[t]=e}},t)),t?(0,G.jsx)(`p`,{className:`rounded-lg border border-warning-500/20 bg-warning-500/5 px-3 py-2 text-xs text-warning-300`,children:`This diff is very large and was truncated. Open the full PR on the SCM to review every line.`}):null]})}function cS({files:e,onJump:t,onExpandAll:n,onCollapseAll:r,allOpen:i,allClosed:a}){return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-line bg-canvas/40`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-line px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,G.jsx)(Qr,{className:`size-3.5 text-fg-subtle`}),e.length,` files changed`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:n,disabled:i,className:`text-fg-subtle transition-colors hover:text-fg disabled:opacity-40`,children:`Expand all`}),(0,G.jsx)(`span`,{className:`text-line`,children:`·`}),(0,G.jsx)(`button`,{type:`button`,onClick:r,disabled:a,className:`text-fg-subtle transition-colors hover:text-fg disabled:opacity-40`,children:`Collapse all`})]})]}),(0,G.jsx)(`ul`,{className:`max-h-56 overflow-y-auto py-1`,children:e.map((e,n)=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n),className:`flex w-full items-center gap-2 px-3 py-1 text-left transition-colors hover:bg-overlay/40`,children:[(0,G.jsx)(dS,{status:e.status}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-fg-muted`,children:e.status===`renamed`&&e.oldPath!==e.newPath?`${e.oldPath} → ${e.newPath}`:e.path}),e.additions>0?(0,G.jsxs)(`span`,{className:`font-mono text-xs text-success-400`,children:[`+`,e.additions]}):null,e.deletions>0?(0,G.jsxs)(`span`,{className:`font-mono text-xs text-danger-400`,children:[`−`,e.deletions]}):null]})},n))})]})}function lS({file:e,open:t,onToggle:n,cardRef:r}){return(0,G.jsxs)(`div`,{ref:r,className:`scroll-mt-4 overflow-hidden rounded-xl border border-line bg-canvas/40`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:n,className:`flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-overlay/40`,children:[t?(0,G.jsx)(lr,{className:`size-3.5 shrink-0 text-fg-subtle`}):(0,G.jsx)(ur,{className:`size-3.5 shrink-0 text-fg-subtle`}),(0,G.jsx)(dS,{status:e.status}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-fg`,children:e.status===`renamed`&&e.oldPath!==e.newPath?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[e.oldPath,` → `]}),e.newPath]}):e.path}),e.additions>0?(0,G.jsxs)(`span`,{className:`font-mono text-xs text-success-400`,children:[`+`,e.additions]}):null,e.deletions>0?(0,G.jsxs)(`span`,{className:`font-mono text-xs text-danger-400`,children:[`−`,e.deletions]}):null]}),t?e.binary?(0,G.jsx)(`div`,{className:`border-t border-line px-3 py-3 text-xs text-fg-subtle`,children:`Binary file not shown.`}):e.hunks.length===0?(0,G.jsx)(`div`,{className:`border-t border-line px-3 py-3 text-xs text-fg-subtle`,children:`No textual changes.`}):(0,G.jsx)(`div`,{className:`overflow-x-auto border-t border-line`,children:(0,G.jsx)(`table`,{className:`w-full border-collapse font-mono text-xs leading-5`,children:(0,G.jsx)(`tbody`,{children:e.hunks.map((e,t)=>(0,G.jsx)(uS,{hunk:e},t))})})}):null]})}function uS({hunk:e}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`tr`,{className:`bg-overlay/40 text-fg-subtle`,children:[(0,G.jsx)(`td`,{className:`select-none px-2 text-right align-top`}),(0,G.jsx)(`td`,{className:`select-none px-2 text-right align-top`}),(0,G.jsx)(`td`,{className:`whitespace-pre-wrap break-words px-3 py-0.5`,children:e.header})]}),e.lines.map((e,t)=>(0,G.jsxs)(`tr`,{className:W(e.type===`add`&&`bg-success-500/10`,e.type===`del`&&`bg-danger-500/10`),children:[(0,G.jsx)(`td`,{className:`w-[1%] select-none whitespace-nowrap px-2 text-right align-top text-fg-subtle/70`,children:e.oldNo??``}),(0,G.jsx)(`td`,{className:`w-[1%] select-none whitespace-nowrap px-2 text-right align-top text-fg-subtle/70`,children:e.newNo??``}),(0,G.jsxs)(`td`,{className:W(`whitespace-pre-wrap break-words px-3 align-top`,e.type===`add`&&`text-success-400`,e.type===`del`&&`text-danger-400`,e.type===`context`&&`text-fg-muted`),children:[(0,G.jsx)(`span`,{className:`select-none text-fg-subtle/60`,children:e.type===`add`?`+`:e.type===`del`?`−`:` `}),e.text]})]},t))]})}function dS({status:e}){let t=`size-3.5 shrink-0`;switch(e){case`added`:return(0,G.jsx)(Nr,{className:W(t,`text-success-400`)});case`deleted`:return(0,G.jsx)(Mr,{className:W(t,`text-danger-400`)});case`renamed`:return(0,G.jsx)(Fr,{className:W(t,`text-accent-300`)});default:return(0,G.jsx)(Ar,{className:W(t,`text-fg-muted`)})}}var fS=4e3;function pS(e){let t=[],n=new Map;for(let r of e.artifacts??[]){if(r.kind!==`pr-preview`)continue;let e=r.data,i=t=>typeof e[t]==`string`?e[t]:void 0,a={title:i(`title`),description:i(`description`),base:i(`base`),sourceBranch:i(`sourceBranch`),workItem:i(`workItem`)},o=a.sourceBranch;o&&n.has(o)?t[n.get(o)]=a:(o&&n.set(o,t.length),t.push(a))}return t}function mS(e,t){if(t.title)for(let n of e.artifacts??[]){if(n.kind!==`pr-link`)continue;let e=n.data;if(e.title!==t.title)continue;let r=typeof e.url==`string`?e.url:void 0,i=e.prId,a=typeof i==`number`?i:typeof i==`string`&&i.trim()?Number(i):void 0;return{url:r,prId:Number.isFinite(a)?a:void 0}}}function hS(e,t){let n=e.workItem,r=n?t.workItems?.find(e=>e.name===n):void 0,i=mS(t,e),a=i?.url,o=i?.prId==null?void 0:t.prMappings?.find(e=>e.prId===i.prId);return r?.status===`escalated`?{label:`Escalated`,variant:`danger`,prUrl:a}:o?.mergedAt?{label:`Merged`,variant:`success`,prUrl:a}:o&&!o.mergedAt?{label:`PR open`,variant:`accent`,prUrl:a}:r?.status===`complete`?{label:`Merged`,variant:`success`,prUrl:a}:n&&n===t.currentWorkItem?{label:`In progress`,variant:`warning`,prUrl:a}:{label:`Awaiting review`,variant:`neutral`,prUrl:a}}function gS(e){let t=e.params;for(let e of[`targetBranch`,`baseBranch`,`defaultBranch`]){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim()}return`main`}function _S(e){if(e.length===0)return{base:`main`};let t=new Set(e.map(e=>e.sourceBranch).filter(Boolean)),n=e.map(e=>e.base).filter(e=>!!e),r=e[0].base??`main`;for(let n of e)if(n.base&&!t.has(n.base)){r=n.base;break}let i;for(let t of e)t.sourceBranch&&!n.includes(t.sourceBranch)&&(i=t.sourceBranch);return{base:r,head:i}}function vS(e,t){let n=e.currentWorkItem,r=n?t.filter(e=>e.workItem===n):t,i=r.filter(t=>{let{label:n}=hS(t,e);return n===`PR open`||n===`In progress`||n===`Awaiting review`}),a=i.length>0?i:r;if(a.length===0)return{base:gS(e)};let{base:o,head:s}=_S(a);return{base:o||gS(e),head:s}}function yS(e){return pS(e).some(t=>{let{label:n}=hS(t,e);return n!==`Merged`&&n!==`Escalated`})}function bS(e,t){let{base:n,head:r,live:i,enabled:a=!0}=t,[o,s]=(0,x.useState)(null),[c,l]=(0,x.useState)(!0),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(!1),m=(0,x.useRef)(!1),h=(0,x.useCallback)(async t=>{if(!m.current){m.current=!0,t&&p(!0);try{s(await Zx(e,{base:n,head:r})),d(null)}catch(e){d(e instanceof Error?e.message:`Failed to load changes`)}finally{m.current=!1,l(!1),t&&p(!1)}}},[e,n,r]);return(0,x.useEffect)(()=>{if(!a||(h(!1),!i))return;let e=window.setInterval(()=>void h(!1),fS);return()=>window.clearInterval(e)},[h,i,a]),{diff:o,loading:c,error:u,refresh:()=>h(!0),refreshing:f}}function xS({job:e,live:t}){let n=(0,x.useMemo)(()=>pS(e),[e]),r=(0,x.useMemo)(()=>vS(e,n),[e,n]),i=t||n.length===0;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(SS,{jobId:e.id}),i?(0,G.jsx)(CS,{jobId:e.id,live:t,workItem:e.currentWorkItem,diffOpts:r,stackedPrCount:n.filter(t=>t.workItem===e.currentWorkItem&&hS(t,e).label===`PR open`).length}):null,n.length>0?(0,G.jsx)(wS,{jobId:e.id,job:e,live:t,previews:n}):null]})}function SS({jobId:e}){let[t,n]=(0,x.useState)(null),[r,i]=(0,x.useState)(!1),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(null);(0,x.useEffect)(()=>{let e=!0;return tS().then(t=>{e&&(i(t.mode===`local`),n(t.editors))}).catch(()=>{e&&n([])}),()=>{e=!1}},[]);let l=(0,x.useCallback)(async(t,n)=>{o(n??t),c(null);try{await nS(e,{target:t,editor:n})}catch(e){c(e instanceof Error?e.message:`Could not open`)}finally{o(null)}},[e]);return r?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(t??[]).length>0?(0,G.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:`Open in`}):null,(t??[]).map(e=>(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`icon`,className:`size-8`,onClick:()=>l(`editor`,e.id),disabled:a!==null,title:`Open in ${e.name}`,"aria-label":`Open in ${e.name}`,children:(0,G.jsx)(iS,{id:e.id})},e.id)),(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8`,onClick:()=>l(`folder`),disabled:a!==null,title:`Reveal folder in file manager`,"aria-label":`Reveal folder in file manager`,children:(0,G.jsx)(Rr,{})}),s?(0,G.jsx)(`span`,{className:`text-xs text-danger-400`,children:s}):null]}):null}function CS({jobId:e,live:t,workItem:n,diffOpts:r,stackedPrCount:i}){let{diff:a,loading:o,error:s,refresh:c,refreshing:l}=bS(e,{live:t,...r}),u=(0,x.useMemo)(()=>eS(a?.patch??``),[a?.patch]);return(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Working now`}),n?(0,G.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[`Work item: `,(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),i>1?` — cumulative diff across ${i} open PRs (stack tip vs ${r.base??`main`}).`:r.head?` — changes on ${r.head} vs ${r.base??`main`}.`:` — live changes in the repo checkout.`]}):(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:`Live changes in the cloned repository.`})]}),(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`gap-3 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsx)(fg,{className:`m-0`,children:(0,G.jsx)(DS,{diff:a})}),(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:c,disabled:l,children:[(0,G.jsx)(hi,{className:W(l&&`animate-spin`)}),`Refresh`]})]}),(0,G.jsx)(pg,{className:`pt-5`,children:o&&!a?(0,G.jsx)(`div`,{className:`animate-pulse text-sm text-fg-subtle`,children:`Loading changes…`}):s?(0,G.jsx)(gg,{title:`Could not load changes`,message:s}):!a||u.length===0?(0,G.jsx)(OS,{available:a?.available??!1}):(0,G.jsx)(sS,{files:u,truncated:a.truncated})})]})]})}function wS({jobId:e,job:t,live:n,previews:r}){return(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Pull requests`}),(0,G.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[r.length,` pull request`,r.length===1?``:`s`,` — expand to review each branch's changes (including stacked PRs).`]})]}),(0,G.jsx)(`div`,{className:`space-y-3`,children:r.map((r,i)=>(0,G.jsx)(TS,{jobId:e,live:n,preview:r,status:hS(r,t)},r.sourceBranch??`wi-${i}`))})]})}function TS({jobId:e,live:t,preview:n,status:r}){let[i,a]=(0,x.useState)(!1),{diff:o,loading:s,error:c,refresh:l,refreshing:u}=bS(e,{base:n.base,head:n.sourceBranch,live:t,enabled:i}),d=(0,x.useMemo)(()=>eS(o?.patch??``),[o?.patch]);return(0,G.jsxs)(lg,{className:`border-line`,children:[(0,G.jsx)(ug,{className:`gap-2 pb-3`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex w-full items-start gap-2 text-left`,children:[i?(0,G.jsx)(lr,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}):(0,G.jsx)(ur,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,G.jsx)(Hr,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(dg,{className:`truncate text-sm`,children:n.title||n.workItem||`Pull request`}),(0,G.jsx)(ES,{status:r})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2 text-xs`,children:[n.workItem?(0,G.jsx)(vg,{variant:`neutral`,children:n.workItem}):null,n.sourceBranch?(0,G.jsxs)(vg,{variant:`neutral`,className:`font-mono normal-case tracking-normal`,children:[n.sourceBranch,n.base?(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[` → `,n.base]}):null]}):null,r.prUrl?(0,G.jsxs)(`a`,{href:r.prUrl,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`inline-flex items-center gap-1 text-accent-300 hover:text-accent-200`,children:[`View PR`,(0,G.jsx)(Er,{className:`size-3`})]}):null,i?(0,G.jsx)(DS,{diff:o,compact:!0}):null]})]})]})}),i?(0,G.jsxs)(pg,{className:`space-y-4 border-t border-line pt-4`,children:[n.description?(0,G.jsx)(`div`,{className:`prose-coro space-y-2 text-sm leading-6 text-fg`,dangerouslySetInnerHTML:{__html:Jb(n.description)}}):null,r.label===`Merged`&&(!o||d.length===0)?(0,G.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:`This work item was merged. Expand showed no local diff — open the PR on the SCM for the final changes.`}):null,(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:l,disabled:u,children:[(0,G.jsx)(hi,{className:W(u&&`animate-spin`)}),`Refresh`]})}),s&&!o?(0,G.jsx)(`div`,{className:`animate-pulse text-sm text-fg-subtle`,children:`Loading changes…`}):c?(0,G.jsx)(gg,{title:`Could not load changes`,message:c}):!o||d.length===0?r.label===`Merged`?null:(0,G.jsx)(OS,{available:o?.available??!1}):(0,G.jsx)(sS,{files:d,truncated:o.truncated,defaultCollapsed:!0})]}):null]})}function ES({status:e}){return(0,G.jsx)(vg,{variant:e.variant,children:e.label})}function DS({diff:e,compact:t}){return!e||e.files.length===0?t?null:(0,G.jsx)(G.Fragment,{children:`Code the agent has written in the cloned repo, before any PR is opened.`}):(0,G.jsxs)(`span`,{className:W(t&&`text-fg-subtle`),children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e.stats.files}),` file`,e.stats.files===1?``:`s`,` changed`,e.stats.insertions>0?(0,G.jsxs)(`span`,{className:`ml-2 text-success-400`,children:[`+`,e.stats.insertions]}):null,e.stats.deletions>0?(0,G.jsxs)(`span`,{className:`ml-2 text-danger-400`,children:[`−`,e.stats.deletions]}):null,(0,G.jsxs)(`span`,{className:`ml-2 text-fg-subtle`,children:[`vs `,e.base]})]})}function OS({available:e}){return(0,G.jsx)(`div`,{className:`rounded-xl border border-dashed border-line bg-canvas/30 px-4 py-8 text-center text-sm text-fg-subtle`,children:e?`No changes yet. They will appear here as the agent edits files.`:`No repository checkout yet. Changes appear once the agent clones the repo and starts coding.`})}var kS=x.forwardRef(function({className:e,children:t,...n},r){return(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`select`,{ref:r,className:W(`flex h-11 w-full appearance-none rounded-xl border border-line-strong bg-overlay px-3.5 py-2.5 pr-10 text-sm text-fg shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60 disabled:cursor-not-allowed disabled:opacity-50`,e),...n,children:t}),(0,G.jsx)(lr,{"aria-hidden":!0,className:`pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`})]})});function AS({job:e,workflowPhases:t,refreshing:n,onRefresh:r,cancelling:i,cancelError:a,onCancel:o,pausing:s,pauseError:c,onPause:l,resuming:u,resumeError:d,resumePhase:f,clearSession:p,onResumePhaseChange:m,onClearSessionChange:h,onResume:g,interactiveOverride:_,onInteractiveChange:v}){let y=Po(e.status),b=Fo(e.status),S=Lo(e.status,e.awaitingEvent),C=_??e.interactive,[w,T]=(0,x.useState)(!1),[E,D]=(0,x.useState)(null);(0,x.useEffect)(()=>{_===void 0&&D(null)},[_]);async function O(t){T(!0),D(null),v(t);try{await q(`/jobs/${e.id}/interactive`,J({interactive:t},{method:`PATCH`}))}catch(e){D(e instanceof Error?e.message:`Failed to update interactive mode`),v(!t)}finally{T(!1)}}return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:W(`flex flex-wrap items-center gap-2 rounded-2xl border border-line bg-overlay/40 px-3 py-2`,`sm:gap-3 sm:px-4`),children:[(0,G.jsx)(jS,{label:`Controls`}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>void r(),disabled:n||i,children:[n?(0,G.jsx)($r,{className:`animate-spin`}):(0,G.jsx)(mi,{}),`Refresh`]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>void o(),disabled:!b||i||u,children:[i?(0,G.jsx)($r,{className:`animate-spin`}):(0,G.jsx)(ir,{}),i?`Cancelling…`:`Cancel`]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>void l(),disabled:!S||s||i||u,title:S?`Park the run at the next safe boundary so you can think and steer`:void 0,children:[s?(0,G.jsx)($r,{className:`animate-spin`}):(0,G.jsx)(oi,{}),s?`Pausing…`:`Pause`]}),(0,G.jsx)(NS,{job:e,workflowPhases:t,canResume:y,resuming:u,resumePhase:f,clearSession:p,onResumePhaseChange:m,onClearSessionChange:h,onResume:g}),(0,G.jsx)(MS,{}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,G.jsx)(Ax,{checked:C,onCheckedChange:O,disabled:w,ariaLabel:`Toggle interactive mode`}),(0,G.jsxs)(`div`,{className:`flex flex-col leading-tight`,children:[(0,G.jsx)(`span`,{className:`text-[12px] font-medium text-fg`,children:C?`Interactive`:`Autonomous`}),(0,G.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:C?`Will park at checkpoints`:`Will run end-to-end`})]})]})]}),a||c||d||E?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[a?(0,G.jsx)(gg,{title:`Cancel failed`,message:a}):null,c?(0,G.jsx)(gg,{title:`Pause failed`,message:c}):null,d?(0,G.jsx)(gg,{title:`Resume failed`,message:d}):null,E?(0,G.jsx)(gg,{title:`Interactive toggle failed`,message:E}):null]}):null]})}function jS({label:e}){return(0,G.jsx)(`span`,{className:`hidden text-[11px] font-medium uppercase tracking-[0.16em] text-fg-subtle sm:inline`,children:e})}function MS(){return(0,G.jsx)(`span`,{className:`hidden h-6 w-px bg-line sm:block`,"aria-hidden":!0})}function NS({job:e,workflowPhases:t,canResume:n,resuming:r,resumePhase:i,clearSession:a,onResumePhaseChange:o,onClearSessionChange:s,onResume:c}){let[l,u]=(0,x.useState)(!1);return n?(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsxs)(Y,{size:`sm`,onClick:()=>void c(i||void 0,a),disabled:r,children:[r?(0,G.jsx)($r,{className:`animate-spin`}):(0,G.jsx)(ui,{}),r?`Resuming…`:`Resume`]}),(0,G.jsxs)(Jh,{open:l,onOpenChange:u,children:[(0,G.jsx)(Yh,{asChild:!0,children:(0,G.jsx)(Y,{size:`sm`,variant:`secondary`,"aria-label":`Resume options`,className:`px-2`,children:(0,G.jsx)(lr,{})})}),(0,G.jsx)(Zh,{align:`start`,className:`min-w-72 p-3`,children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-1.5 block text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:`Resume from phase`}),(0,G.jsxs)(kS,{value:i,onChange:e=>o(e.target.value),children:[(0,G.jsxs)(`option`,{value:``,children:[`Current phase (`,e.phase,`)`]}),t.map(t=>(0,G.jsxs)(`option`,{value:t.name,children:[t.name,t.name===e.phase?` (current)`:``]},t.name))]})]}),(0,G.jsxs)(`label`,{className:`flex items-start gap-2 text-[13px] text-fg-muted`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>s(e.target.checked),className:`mt-0.5`}),(0,G.jsxs)(`span`,{children:[`Start with a fresh session.`,(0,G.jsx)(`span`,{className:`block text-[11px] text-fg-subtle`,children:`Use when the current conversation history is no longer useful.`})]})]}),(0,G.jsx)(`div`,{className:`flex justify-end pt-1`,children:(0,G.jsx)(Y,{size:`sm`,onClick:()=>{u(!1),c(i||void 0,a)},disabled:r,children:r?`Resuming…`:`Resume with options`})})]})})]})]}):(0,G.jsx)(`span`,{className:`rounded-md border border-dashed border-line px-2.5 py-1 text-[12px] text-fg-subtle`,title:`This ${zy.singularLower} can't be resumed from its current state.`,children:`Not resumable`})}var PS={text:{textClass:`text-fg`,iconClass:`text-fg-subtle`,icon:ar},tool_use:{textClass:`text-fg`,iconClass:`text-accent-300`,icon:rr,label:`Tool`},tool_summary:{textClass:`text-fg-muted`,iconClass:`text-fg-subtle`,icon:Yr,label:`Summary`,dimmed:!0},thinking:{textClass:`text-fg-muted`,iconClass:`text-fg-subtle`,icon:yi,label:`Thinking`,dimmed:!0},tool_progress:{textClass:`text-fg-muted`,iconClass:`text-warning-400`,icon:$r,label:`Progress`,dimmed:!0},error:{textClass:`text-danger-400`,iconClass:`text-danger-400`,icon:Mi,label:`Error`},guardrail:{textClass:`text-warning-400`,iconClass:`text-warning-400`,icon:wi,label:`Guardrail`},warning:{textClass:`text-warning-400`,iconClass:`text-warning-400`,icon:Mi,label:`Warning`},result:{textClass:`text-success-400`,iconClass:`text-success-400`,icon:fr,label:`Result`},phase:{textClass:`text-accent-300`,iconClass:`text-accent-300`,icon:Vr,label:`Phase`},insight:{textClass:`text-accent-300`,iconClass:`text-accent-300`,icon:ar,label:`Insight`},session_reset:{textClass:`text-warning-400`,iconClass:`text-warning-400`,icon:mi,label:`Reset`},webhook:{textClass:`text-warning-400`,iconClass:`text-warning-400`,icon:Ni,label:`Webhook`},human:{textClass:`text-fg`,iconClass:`text-accent-300`,icon:ti,label:`Developer`},system:{textClass:`text-fg-subtle`,iconClass:`text-fg-subtle`,icon:xi,label:`System`,dimmed:!0}};function FS(e){let t=e.content;return e.lineType===`tool_progress`?t.replace(/^⏳\s*/,``):e.lineType===`system`&&t.startsWith(`[event:`)?t.replace(/^\[event:([^\]]+)\]\s*/,`$1: `):e.lineType===`tool_use`||e.lineType===`text`||e.lineType===`phase`?t:t.replace(/^\[[^\]]+\]\s*/,``)}function IS({lineType:e,className:t=``}){let n=PS[e],r=n.icon;return(0,G.jsx)(r,{className:W(`mt-0.5 size-3.5 shrink-0`,n.iconClass,n.dimmed&&`opacity-60`,e===`tool_progress`&&`animate-spin`,t),"aria-hidden":`true`})}function LS(e){if(!e)return``;try{return new Date(e).toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}catch{return``}}function RS({line:e}){let t=PS[e.lineType],n=FS(e);if(e.lineType===`phase`)return(0,G.jsxs)(`div`,{className:`my-2 flex items-center gap-3 py-1.5`,children:[(0,G.jsx)(`div`,{className:`h-px flex-1 bg-accent-500/20`}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-accent-500/25 bg-accent-500/10 px-3 py-0.5 text-[11px] font-semibold uppercase tracking-[0.16em] text-accent-300`,children:[(0,G.jsx)(IS,{lineType:e.lineType,className:`mt-0 size-3`}),n]}),(0,G.jsx)(`div`,{className:`h-px flex-1 bg-accent-500/20`})]});if(e.lineType===`error`||e.lineType===`warning`||e.lineType===`guardrail`)return(0,G.jsxs)(`div`,{className:W(`my-1 flex items-start gap-3 rounded-xl px-4 py-2.5`,e.lineType===`error`?`border border-danger-500/25 bg-danger-500/8`:`border border-warning-500/25 bg-warning-500/8`),children:[(0,G.jsx)(IS,{lineType:e.lineType}),(0,G.jsx)(`span`,{className:t.textClass,children:n})]});if(e.lineType===`result`)return(0,G.jsxs)(`div`,{className:`my-1 flex items-start gap-3 rounded-xl border border-success-500/25 bg-success-500/8 px-4 py-2.5`,children:[(0,G.jsx)(IS,{lineType:e.lineType}),(0,G.jsx)(`span`,{className:t.textClass,children:n})]});if(e.lineType===`human`)return(0,G.jsxs)(`div`,{className:`my-1 flex items-start gap-3 rounded-xl border border-accent-500/25 bg-accent-500/8 px-4 py-2.5`,children:[(0,G.jsx)(IS,{lineType:e.lineType}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mr-2 text-[11px] font-semibold uppercase tracking-[0.14em] text-accent-300`,children:`Developer`}),(0,G.jsx)(`span`,{className:`text-fg`,children:n})]})]});if(e.lineType===`tool_use`){let e=n.match(/^→ (\S+)(.*)/);if(e)return(0,G.jsxs)(`span`,{className:t.dimmed?`opacity-60`:``,children:[(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`→ `}),(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:e[1]}),(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:e[2]})]})}return(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(IS,{lineType:e.lineType}),(0,G.jsxs)(`span`,{className:W(t.textClass,t.dimmed&&`opacity-70`),children:[t.label?(0,G.jsx)(`span`,{className:`mr-2 text-[11px] font-semibold uppercase tracking-[0.14em] text-fg-subtle`,children:t.label}):null,n]})]})}function zS(e,t=`auto`){e&&e.scrollTo({top:e.scrollHeight,behavior:t})}function BS(e,t=64){let{scrollTop:n,scrollHeight:r,clientHeight:i}=e;return r-n-i<=t}var VS=[{value:`all`,label:`All`},{value:`main`,label:`Agent`},{value:`tools`,label:`Tools`}];function HS({lines:e,className:t=``}){let n=(0,x.useRef)(null),[r,i]=(0,x.useState)(!0),a=(0,x.useRef)(!0),[o,s]=(0,x.useState)(`all`),c=(0,x.useRef)(!1);(0,x.useEffect)(()=>{a.current=r},[r]);let l=()=>{let e=n.current;if(!e)return;if(c.current){c.current=!1;return}let t=BS(e);a.current=t,i(t)};(0,x.useEffect)(()=>{if(!r)return;let e=requestAnimationFrame(()=>{!a.current||!n.current||(c.current=!0,zS(n.current,`auto`))});return()=>{cancelAnimationFrame(e)}},[e,r,o]),(0,x.useEffect)(()=>{let e=n.current;if(!e||!r)return;let t=new ResizeObserver(()=>{!n.current||!a.current||(c.current=!0,zS(n.current,`auto`))});return t.observe(e),()=>{t.disconnect()}},[r]);let u=[`tool_use`,`tool_summary`,`tool_progress`,`thinking`,`system`],d=[`text`,`phase`,`error`,`guardrail`,`warning`,`result`,`insight`,`session_reset`,`webhook`,`human`],f=e.filter(e=>o===`all`?!0:o===`main`?d.includes(e.lineType):o===`tools`?u.includes(e.lineType):!0);return(0,G.jsxs)(`div`,{className:W(`flex flex-col overflow-hidden rounded-2xl border border-line bg-canvas/60`,t),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-line px-3 py-2.5`,children:[(0,G.jsx)(ab,{options:VS,value:o,onChange:s,size:`sm`,ariaLabel:`Filter log lines`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:[f.length,` / `,e.length,` lines`]}),r?null:(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{a.current=!0,i(!0),n.current&&(c.current=!0,zS(n.current,`smooth`))},children:[(0,G.jsx)(er,{}),`Follow`]})]})]}),(0,G.jsx)(`div`,{ref:n,onScroll:l,className:`min-h-[280px] max-h-[calc(100vh-320px)] flex-1 overflow-y-auto p-4 font-mono text-[12.5px] leading-relaxed`,children:f.length===0?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center text-sm text-fg-subtle`,children:`Waiting for log output…`}):f.map((e,t)=>(0,G.jsxs)(`div`,{className:W(`flex gap-3 animate-fade-in`,e.lineType===`phase`?``:`rounded-lg px-2 py-1 hover:bg-overlay/40`),children:[e.lineType===`phase`?null:(0,G.jsx)(`span`,{className:`shrink-0 select-none pt-0.5 text-[11px] tabular-nums text-fg-subtle/70`,children:LS(e.timestamp)}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1 break-words whitespace-pre-wrap`,children:(0,G.jsx)(RS,{line:e})})]},t))})]})}var US=new Set([`complete`,`failed`,`escalated`,`cancelled`,`canceled`]);function WS(e){return!US.has(e.status)}function GS(e,t){let n=e.findIndex(e=>e.name===t);if(n!==-1)return n;let r=t.toLowerCase();return e.findIndex(e=>e.name.toLowerCase()===r)}function KS(e,t,n){let r=GS(t,n.phase),i=GS(t,e),a=(n.phaseUsage??[]).some(t=>t.phase===e);return i===-1?`pending`:i===r?n.status===`awaiting-developer-input`?`awaiting-input`:n.status===`complete`?`complete`:`in-progress`:r!==-1&&i<r||a||n.status===`complete`?`complete`:`pending`}function qS(e,t){let n=`relative flex-1 min-w-[150px] rounded-xl border px-3.5 py-2.5 text-left transition-colors cursor-pointer`,r=t?`ring-2 ring-accent-400/60 ring-offset-2 ring-offset-canvas`:``;switch(e){case`complete`:return W(n,r,`border-success-500/25 bg-success-500/8 hover:border-success-500/40`);case`in-progress`:return W(n,r,`border-accent-500/30 bg-accent-500/10 hover:border-accent-500/45`);case`awaiting-input`:return W(n,r,`border-warning-500/30 bg-warning-500/10 hover:border-warning-500/45 animate-pulse-slow`);default:return W(n,r,`border-line bg-overlay/40 hover:border-line-strong`)}}function JS({state:e}){switch(e){case`complete`:return(0,G.jsx)(cr,{className:`size-3.5 text-success-400`,strokeWidth:2.5});case`in-progress`:return(0,G.jsx)(`span`,{className:`size-1.5 rounded-full bg-accent-400 animate-pulse-dot`,"aria-hidden":!0});case`awaiting-input`:return(0,G.jsx)(Gr,{className:`size-3.5 text-warning-400`});default:return(0,G.jsx)(`span`,{className:`size-1.5 rounded-full bg-fg-subtle/60`,"aria-hidden":!0})}}function YS(e){switch(e){case`complete`:return`Complete`;case`in-progress`:return`Running`;case`awaiting-input`:return`Awaiting input`;case`pending`:return`Pending`}}function XS({job:e,phases:t,selectedPhase:n,onSelectPhase:r}){if(t.length===0)return(0,G.jsx)(`div`,{className:`px-2 py-3 text-sm italic text-fg-subtle`,children:`No workflow phases defined for this job.`});let i=new Map;for(let t of e.artifacts??[]){let e=i.get(t.phase)??[];e.push(t),i.set(t.phase,e)}let a=new Map;for(let t of e.phaseUsage??[])a.set(t.phase,(a.get(t.phase)??0)+1);return(0,G.jsx)(`div`,{className:`w-full overflow-x-auto`,children:(0,G.jsx)(`div`,{className:`flex min-w-max items-stretch gap-2 pb-1`,children:t.map((o,s)=>{let c=KS(o.name,t,e),l=n===o.name,u=i.get(o.name)??[],d=a.get(o.name)??0;return(0,G.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(o.name),className:qS(c,l),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`flex size-4 items-center justify-center`,children:(0,G.jsx)(JS,{state:c})}),(0,G.jsx)(`span`,{className:`truncate text-[13px] font-medium text-fg`,children:o.name}),o.interactiveCheckpoint&&e.interactive?(0,G.jsx)(`span`,{title:`Interactive checkpoint — the job will park here for developer approval`,className:`inline-flex items-center rounded-full border border-warning-500/25 bg-warning-500/10 px-1 py-0.5 text-warning-400`,children:(0,G.jsx)(Ur,{className:`size-3`})}):null]}),(0,G.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.16em] text-fg-subtle`,children:YS(c)}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[d>1?(0,G.jsxs)(`span`,{title:`Phase ran ${d} times (loop-back)`,className:`inline-flex items-center gap-0.5 rounded-full border border-accent-500/25 bg-accent-500/10 px-1.5 py-0.5 text-[10px] text-accent-300`,children:[(0,G.jsx)(_i,{className:`size-2.5`}),d,`×`]}):null,u.length>0?(0,G.jsx)(`span`,{title:`${u.length} artifact${u.length===1?``:`s`}`,className:`rounded-full border border-line bg-overlay/60 px-1.5 py-0.5 text-[10px] text-fg-muted`,children:u.length}):null]})]})]}),s<t.length-1?(0,G.jsx)(`div`,{className:`flex shrink-0 items-center px-1 text-fg-subtle/60`,"aria-hidden":!0,children:(0,G.jsx)(ur,{className:`size-4`})}):null]},o.name)})})})}function ZS(e){let t=[];for(let n of e.workItems??[]){let r=(e.phaseUsage??[]).filter(e=>e.workItem===n.name),i=[];for(let e of r)i.includes(e.phase)||i.push(e.phase);t.push({item:n,executions:r,distinctPhases:i,hasStarted:r.length>0})}return t}function QS(e){return e.status===`complete`?`Complete`:e.status===`in-progress`?`In progress`:e.status===`escalated`?`Escalated`:`Pending`}function $S(e){switch(e.status){case`complete`:return`bg-success-400`;case`in-progress`:return`bg-accent-400 animate-pulse-dot`;case`escalated`:return`bg-danger-400`;default:return`bg-fg-subtle/60`}}function eC({phaseName:e,count:t,state:n,onClick:r}){return(0,G.jsxs)(`button`,{type:`button`,onClick:r,className:W(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] font-medium transition-colors cursor-pointer`,n===`in-progress`?`border-accent-500/35 bg-accent-500/10 text-fg hover:border-accent-500/55`:n===`complete`?`border-success-500/25 bg-success-500/8 text-fg hover:border-success-500/40`:`border-line bg-overlay/40 text-fg-muted hover:border-line-strong`),children:[n===`complete`?(0,G.jsx)(cr,{className:`size-3 text-success-400`,strokeWidth:2.5}):n===`in-progress`?(0,G.jsx)(`span`,{className:`size-1.5 rounded-full bg-accent-400 animate-pulse-dot`,"aria-hidden":!0}):(0,G.jsx)(`span`,{className:`size-1.5 rounded-full bg-fg-subtle/60`,"aria-hidden":!0}),(0,G.jsx)(`span`,{children:e}),t>1?(0,G.jsxs)(`span`,{title:`Ran ${t} times for this work item`,className:`inline-flex items-center gap-0.5 rounded-full bg-overlay/80 px-1 text-[10px] text-fg-muted`,children:[(0,G.jsx)(_i,{className:`size-2.5`}),t]}):null]})}function tC({job:e,phases:t,onSelectPhase:n}){if(!e.workItems||e.workItems.length===0)return null;let r=ZS(e),i=new Set(t.map(e=>e.name)),a=WS(e),o=r.find(e=>e.hasStarted)?.item.name??null;return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:[`Work items `,(0,G.jsxs)(`span`,{className:`text-fg-muted`,children:[`(`,e.workItems.length,`)`]})]}),e.currentWorkItem?(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[`current: `,(0,G.jsx)(`span`,{className:`text-fg`,children:e.currentWorkItem})]}):null]}),(0,G.jsx)(`div`,{className:`space-y-1.5`,children:r.map(t=>{let{item:r,executions:s,distinctPhases:c,hasStarted:l}=t,u=e.currentWorkItem===r.name,d=r.status===`complete`,f=!l&&d&&o!==null&&o!==r.name,p=c.map(e=>({name:e,count:s.filter(t=>t.phase===e).length}));return(0,G.jsxs)(`div`,{className:W(`flex flex-wrap items-center gap-3 rounded-xl border px-3 py-2`,u?`border-accent-500/30 bg-accent-500/8`:l||f?`border-line bg-overlay/40`:`border-line bg-overlay/20 opacity-70`),children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:W(`size-2 rounded-full shrink-0`,$S(r))}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`truncate text-[13px] font-medium text-fg`,children:r.name}),(0,G.jsxs)(`div`,{className:`text-[10px] uppercase tracking-[0.14em] text-fg-subtle`,children:[QS(r),r.loopCount>0?(0,G.jsxs)(`span`,{className:`ml-2 normal-case tracking-normal text-fg-muted`,children:[`· `,r.loopCount,` retr`,r.loopCount===1?`y`:`ies`]}):null]})]})]}),l?(0,G.jsxs)(`div`,{className:`flex flex-1 flex-wrap items-center gap-1.5`,children:[p.map(({name:t,count:o})=>{let s=u&&e.phase===t&&a,c=i.has(t),l=s?`in-progress`:`complete`;return(0,G.jsx)(eC,{phaseName:c?t:`${t} (ad-hoc)`,count:o,state:l,onClick:()=>n(t)},`${r.name}:${t}`)}),u&&a&&e.phase&&!c.includes(e.phase)?(0,G.jsx)(eC,{phaseName:e.phase,count:1,state:`in-progress`,onClick:()=>n(e.phase)}):null]}):f?(0,G.jsx)(`div`,{className:`flex flex-1 flex-wrap items-center gap-1.5`,children:(0,G.jsxs)(`span`,{title:`This work item was delivered together with "${o}" in a single execution cycle (one shared PR / verification run). The actual phase executions are attributed to that item above.`,className:`inline-flex items-center gap-1.5 rounded-full border border-success-500/20 bg-success-500/8 px-2.5 py-1 text-[11px] font-medium text-fg-muted`,children:[(0,G.jsx)(cr,{className:`size-3 text-success-400/80`,strokeWidth:2.5}),`delivered with `,(0,G.jsx)(`span`,{className:`text-fg`,children:o})]})}):(0,G.jsx)(`div`,{className:`text-[11px] italic text-fg-subtle`,children:u?`starting…`:`waiting`}),r.status===`escalated`?(0,G.jsxs)(`span`,{title:`This work item escalated and is waiting on a human`,className:`inline-flex items-center gap-1 rounded-full border border-danger-500/30 bg-danger-500/10 px-2 py-0.5 text-[10px] text-danger-400`,children:[(0,G.jsx)(Mi,{className:`size-3`}),`escalated`]}):null]},r.name)})})]})}function nC(e,t,n){if(!t||!n)return null;let r=e[t];return r?r.find(e=>e.id===n)??null:null}function rC(e){let t=aC(e);return t?`${t.symbol} ${t.label}`:null}function iC(e){return aC(e)?.symbol??``}function aC(e){let t=e?.pricing;if(!t)return null;let n=t.inputPerMTokens,r=t.outputPerMTokens;if(n==null&&r==null)return null;let i=n!=null&&r!=null?(n+r)/2:n??r??0,a,o;return i<=1?(a=1,o=`cheapest`):i<=5?(a=2,o=`low`):i<=20?(a=3,o=`mid`):i<=50?(a=4,o=`high`):(a=5,o=`frontier`),{symbol:`$`.repeat(a),label:o}}function oC(e,t){let n=e?.pricing;if(!n||!t)return null;let r=e=>(e??0)/1e6;return(t.inputTokens??0)*r(n.inputPerMTokens)+(t.outputTokens??0)*r(n.outputPerMTokens)+(t.cacheReadInputTokens??0)*r(n.cacheReadPerMTokens)+(t.cacheCreationInputTokens??0)*r(n.cacheCreationPerMTokens??n.inputPerMTokens)}function sC(e){return Number.isFinite(e)?e===0?`0.00`:Math.abs(e)<.01?e.toFixed(4):Math.abs(e)<1?e.toFixed(3):e.toFixed(2):`—`}var cC=`::`;function lC(e,t){return!e||!t?``:`${e}${cC}${t}`}function uC(e){let t=e.indexOf(cC);return t<0?{provider:``,model:``}:{provider:e.slice(0,t),model:e.slice(t+2)}}function dC({value:e,onChange:t,providers:n,modelsByProvider:r,loadModels:i,className:a,disabled:o=!1,hideLabel:s=!1,label:c=`Model`}){(0,x.useEffect)(()=>{for(let e of n)i(e.id)},[n.map(e=>e.id).join(`|`)]);let l=(0,x.useMemo)(()=>n.some(e=>r[e.id]===null||r[e.id]===void 0),[n,r]),u=(0,x.useMemo)(()=>n.reduce((e,t)=>e+(r[t.id]?.length??0),0),[n,r]),d=lC(e.provider,e.model),f=rC(nC(r,e.provider,e.model)),p=!!e.provider&&!!e.model&&(r[e.provider]??[]).some(t=>t.id===e.model),m=!!e.model&&!p,h=n.length===0?`(no enabled providers)`:l&&u===0?`Loading…`:u===0?`(no models published)`:`(select a model)`;return(0,G.jsxs)(Sv,{label:s?``:c,className:a,children:[(0,G.jsxs)(`select`,{value:d,disabled:o||n.length===0,onChange:e=>t(uC(e.target.value)),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg disabled:opacity-60`,"aria-label":s?c:void 0,children:[(0,G.jsx)(`option`,{value:``,children:h}),m?(0,G.jsxs)(`option`,{value:d,children:[e.model,` · `,e.provider,` (saved)`]}):null,n.map(e=>{let t=r[e.id];return!t||t.length===0?null:(0,G.jsx)(`optgroup`,{label:e.displayName,children:t.map(t=>{let n=iC(t);return(0,G.jsx)(`option`,{value:lC(e.id,t.id),children:n?`${t.displayName} — ${n}`:t.displayName},`${e.id}::${t.id}`)})},e.id)})]}),f?(0,G.jsx)(`div`,{className:`mt-1 text-[11px] text-fg-subtle`,title:`Static pricing hint published by the provider plugin. Runtime accounting always uses actual reported cost.`,children:f}):null]})}function fC(){let[e,t]=(0,x.useState)([]),[n,r]=(0,x.useState)(!0),[i,a]=(0,x.useState)(null);return(0,x.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await q(`/plugins`);if(e)return;t(n.plugins.filter(e=>e.manifest.kind===`executor`&&e.installed!==!1).map(e=>({id:e.manifest.id,displayName:e.manifest.displayName})).sort((e,t)=>e.displayName.localeCompare(t.displayName)))}catch(t){if(e)return;a(t instanceof K?t.message:String(t))}finally{e||r(!1)}})(),()=>{e=!0}},[]),{providers:e,loading:n,error:i}}function pC(){let[e,t]=(0,x.useState)({});return{modelsByProvider:e,loadModels:(0,x.useCallback)(async n=>{if(n&&e[n]===void 0){t(e=>({...e,[n]:null}));try{let e=await q(`/plugins/${encodeURIComponent(n)}/models`);t(t=>({...t,[n]:e.models??[]}))}catch(e){if(!(e instanceof K))throw e;t(e=>({...e,[n]:[]}))}}},[e])}}function mC({job:e,phase:t,onMutated:n}){let r=t===e.phase,i=e.status===`running`,a=e.phaseModelOverrides?.[t],{providers:o,loading:s}=fC(),{modelsByProvider:c,loadModels:l}=pC(),[u,d]=(0,x.useState)(()=>({provider:a?.provider??``,model:a?.model??``}));(0,x.useEffect)(()=>{d({provider:a?.provider??``,model:a?.model??``})},[t,a?.provider,a?.model]);let[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null),[g,_]=(0,x.useState)(!1),v=(0,x.useMemo)(()=>{let n=(e.phaseUsage??[]).filter(e=>e.phase===t);return n.length>0?n[n.length-1].model:null},[e.phaseUsage,t]),y=(0,x.useMemo)(()=>{let n=(e.phaseUsage??[]).filter(e=>e.phase===t);return n.length>0?n[n.length-1]:null},[e.phaseUsage,t]),b=oC(nC(c,u.provider,u.model),y??void 0),S=y?.costUsd??null,C=b!=null&&S!=null?b-S:null,w=(0,x.useMemo)(()=>(u.provider||``)!==(a?.provider??``)||(u.model||``)!==(a?.model??``),[u,a]),T=async r=>{p(r),h(null);try{if(r===`apply`){if(!u.model)throw Error(`Pick a model first.`);await q(`/jobs/${encodeURIComponent(e.id)}/phase-overrides`,J({phase:t,model:u.model,provider:u.provider||void 0},{method:`PATCH`}))}else if(r===`clear`)await q(`/jobs/${encodeURIComponent(e.id)}/phase-overrides`,J({phase:t,clear:!0},{method:`PATCH`})),d({provider:``,model:``});else if(r===`rerun`){let n={};u.model&&(n.model=u.model),u.provider&&(n.provider=u.provider),await q(`/jobs/${encodeURIComponent(e.id)}/phases/${encodeURIComponent(t)}/rerun`,J(n,{method:`POST`}))}r!==`rerun`&&_(!1),n()}catch(e){h(e instanceof K||e instanceof Error?e.message:String(e))}finally{p(null)}},E=a?.model??v??null,D=a?`override`:v?`last-used`:`default`;return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px]`,children:[(0,G.jsx)(`span`,{className:`text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:`Model`}),(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:E??(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`(workflow default)`})}),D===`override`?(0,G.jsx)(`span`,{className:`rounded-full border border-info-400/40 bg-info-500/10 px-1.5 py-0 text-[10px] uppercase tracking-wide text-info-200`,children:`override`}):D===`last-used`?(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:`last run`}):null,g?null:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>_(!0),className:`ml-auto inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] text-fg-muted transition-colors hover:bg-overlay hover:text-fg`,"aria-label":`Change model for this phase`,title:`Change model for this phase`,children:[(0,G.jsx)(li,{className:`size-3`}),`Change`]})]}),g?(0,G.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-line bg-canvas/40 p-3`,children:[s?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-fg-subtle`,children:[(0,G.jsx)($r,{className:`size-3 animate-spin`}),` Loading providers…`]}):o.length===0?(0,G.jsx)(`div`,{className:`text-[12px] text-fg-subtle`,children:`No LLM provider plugins are installed. Configure one in Settings → LLM Providers before overriding a phase model.`}):(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`min-w-[12rem] max-w-xs flex-1`,children:(0,G.jsx)(dC,{value:u,onChange:d,providers:o,modelsByProvider:c,loadModels:l,disabled:f!==null,hideLabel:!0})}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`primary`,disabled:!w||!u.model||f!==null,onClick:()=>void T(`apply`),children:[f===`apply`?(0,G.jsx)($r,{className:`size-3 animate-spin`}):null,`Apply`]}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`ghost`,disabled:!a||f!==null,onClick:()=>void T(`clear`),title:a?`Remove the per-phase override and revert to workflow default`:`No override to clear`,children:[(0,G.jsx)(Pi,{className:`size-3`}),` Clear`]}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`secondary`,disabled:f!==null||r&&i,onClick:()=>void T(`rerun`),title:r&&i?`Pause the job before re-running the live phase`:`Re-enter this phase, optionally with the chosen model`,children:[f===`rerun`?(0,G.jsx)($r,{className:`size-3 animate-spin`}):(0,G.jsx)(_i,{className:`size-3`}),`Re-run`]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{_(!1),h(null),d({provider:a?.provider??``,model:a?.model??``})},className:`text-[11px] text-fg-subtle hover:text-fg`,children:`Cancel`})]}),b!=null&&S!=null&&y?(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[`For this phase's last run (`,y.inputTokens.toLocaleString(),` in /`,` `,y.outputTokens.toLocaleString(),` out tokens):`,` `,(0,G.jsxs)(`span`,{className:`text-fg`,children:[`$`,sC(S)]}),` →`,` `,(0,G.jsxs)(`span`,{className:`text-fg`,children:[`$`,sC(b)]}),C==null?null:(0,G.jsxs)(`span`,{className:C>0?`ml-1 text-warning-400`:C<0?`ml-1 text-success-400`:`ml-1 text-fg-subtle`,children:[`(`,C>=0?`+`:`−`,`$`,sC(Math.abs(C)),`)`]})]}):null,r&&i?(0,G.jsx)(`div`,{className:`rounded-lg border border-warning-400/30 bg-warning-500/5 px-2.5 py-1.5 text-[11px] leading-4 text-warning-100`,children:`This phase is running now. The override applies on the next selectModel call — the in-flight turn keeps its original model. Use “Re-run” to apply immediately.`}):null,m?(0,G.jsx)(`div`,{className:`rounded-lg border border-danger-400/40 bg-danger-500/5 px-2.5 py-1.5 text-[11px] text-danger-200`,children:m}):null]}):null]})}var hC=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Jo(`Primitive.${t}`),r=x.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,G.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),gC=`Separator`,_C=`horizontal`,vC=[`horizontal`,`vertical`],yC=x.forwardRef((e,t)=>{let{decorative:n,orientation:r=_C,...i}=e,a=bC(r)?r:_C,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,G.jsx)(hC.div,{"data-orientation":a,...o,...i,ref:t})});yC.displayName=gC;function bC(e){return vC.includes(e)}var xC=yC;function SC({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,G.jsx)(xC,{decorative:n,orientation:t,className:W(`shrink-0 bg-line`,t===`horizontal`?`h-px w-full`:`h-full w-px`,e),...r})}function CC(e){let[t,n]=(0,x.useState)(null),[r,i]=(0,x.useState)(!0),[a,o]=(0,x.useState)(null),s=(0,x.useCallback)(async()=>{if(e)try{n(await q(`/jobs/${e}`)),o(null)}catch(e){o(e instanceof Error?e.message:`Failed to fetch job`)}finally{i(!1)}},[e]);return(0,x.useEffect)(()=>{s()},[s]),{job:t,loading:r,error:a,refetch:s}}var wC=/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z)\s+/;function TC(e){let t=e.replace(wC,``),n=t.toLowerCase();return t.startsWith(`→ `)?{content:t,lineType:`tool_use`}:t.startsWith(`[thinking]`)?{content:t,lineType:`thinking`}:t.startsWith(`[tool_summary]`)?{content:t,lineType:`tool_summary`}:t.startsWith(`⏳`)?{content:t,lineType:`tool_progress`}:t.startsWith(`[error]`)?{content:t,lineType:`error`}:t.startsWith(`[guardrail]`)?{content:t,lineType:`guardrail`}:t.startsWith(`[warning]`)?{content:t,lineType:`warning`}:t.startsWith(`[result]`)?{content:t,lineType:`result`}:t.startsWith(`[insight]`)?{content:t,lineType:`insight`}:t.startsWith(`[session-reset]`)?{content:t,lineType:`session_reset`}:t.startsWith(`[webhook]`)?{content:t,lineType:`webhook`}:t.startsWith(`[human]`)?{content:t,lineType:`human`}:t.startsWith(`[init]`)||t.startsWith(`[usage]`)||t.startsWith(`[phase-end]`)||t.startsWith(`[artifact]`)||t.startsWith(`[repo-cloned]`)||t.startsWith(`[campaign]`)||t.startsWith(`[control]`)||t.startsWith(`[sdk-stderr]`)||t.startsWith(`[event:`)||t.startsWith(`System prompt:`)?{content:t,lineType:`system`}:t.startsWith(`Phase advanced`)||t.startsWith(`Runner started`)||t.startsWith(`Job parked`)||t.startsWith(`All phases complete`)?{content:t,lineType:`phase`}:t.startsWith(`Runner crashed`)?{content:t,lineType:`error`}:n.includes(`here's what was accomplished`)||/\bphase (is )?complete\b/.test(n)?{content:t,lineType:`result`}:/\bphase started\b/.test(n)?{content:t,lineType:`phase`}:{content:t,lineType:`text`}}function EC(e){let t=e.match(wC);return t?t[1]:``}function DC(e,t=!0){let[n,r]=(0,x.useState)([]),[i,a]=(0,x.useState)(`connecting`),[o,s]=(0,x.useState)(Date.now()),c=(0,x.useRef)(null),l=(0,x.useRef)(!1),u=(0,x.useRef)(void 0),d=(0,x.useRef)(!0),f=(0,x.useCallback)(()=>{l.current=!0,c.current&&=(c.current.close(),null)},[]);return(0,x.useEffect)(()=>{if(!e)return;let n=u.current,i=d.current,o=n!==e,p=!i&&t;if(u.current=e,d.current=t,(o||p)&&r([]),!t){f(),a(`disconnected`);return}a(`connecting`),l.current=!1;let m=new EventSource(`/jobs/${e}/stream`);return c.current=m,m.onopen=()=>{a(`connected`),s(Date.now())},m.onmessage=e=>{s(Date.now());let t=e.data;if(!t||t.trim()===``)return;let n=EC(t),{content:i,lineType:a}=TC(t);r(e=>[...e,{timestamp:n,content:i,lineType:a}])},m.onerror=()=>{m.close(),c.current=null,l.current=!0,a(`disconnected`)},()=>{m.close(),c.current=null}},[f,e,t]),{lines:n,status:i,lastHeartbeat:o,disconnect:f}}function OC({tone:e,children:t}){return(0,G.jsx)(`span`,{className:W(`ml-1 inline-flex h-4 min-w-[16px] items-center justify-center rounded-full px-1 text-[10px] font-medium tabular-nums ring-1`,e===`warning`?`bg-warning-500/15 text-warning-300 ring-warning-500/30`:`bg-overlay text-fg-muted ring-line`),children:t})}function kC(e){if(!e)return[];if(e.workflowPhases&&e.workflowPhases.length>0)return e.workflowPhases;let t=new Set,n=[];for(let r of e.phaseUsage??[])t.has(r.phase)||(t.add(r.phase),n.push({name:r.phase,status:r.phase}));return t.has(e.phase)||n.push({name:e.phase,status:e.phase}),n}function AC({parentRunId:e}){return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[13px]`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-line bg-overlay px-1.5 py-0.5 text-[10px] uppercase tracking-[0.14em] text-fg-subtle`,title:By.singular,children:[(0,G.jsx)(Cr,{className:`size-2.5`,"aria-hidden":!0}),By.singularLower]}),(0,G.jsxs)(`span`,{className:`text-fg-muted`,children:[`of`,` `,(0,G.jsx)(Dn,{to:My({id:e}),className:`inline-block max-w-[min(100%,28rem)] truncate align-bottom font-mono text-[12px] font-medium text-accent-300 underline-offset-2 hover:text-accent-400 hover:underline`,title:e,children:e})]})]})}function jC({job:e}){let t=Iy(e),n=Py(e),r=qy(e);return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Dn,{to:Zy,className:`inline-flex items-center gap-1.5 text-sm text-fg-muted transition-colors hover:text-fg`,children:[(0,G.jsx)(nr,{className:`size-4`}),Vy.backToRuns]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[r?(0,G.jsx)(AC,{parentRunId:r}):null,(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h1`,{className:`text-[1.75rem] font-semibold tracking-tight text-fg sm:text-[2rem]`,children:Ny(e)}),(0,G.jsx)(yg,{status:e.status})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[12px] text-fg-subtle`,children:[(0,G.jsx)(`span`,{className:`rounded-md border border-line bg-overlay px-1.5 py-0.5 uppercase tracking-[0.14em]`,title:`Workflow`,children:Yy(e)}),Ky(e)?(0,G.jsx)(`span`,{className:`rounded-md border border-line bg-overlay px-1.5 py-0.5 uppercase tracking-[0.14em]`,title:`Hosts ${By.pluralLower}`,children:By.pluralLower}):null,(0,G.jsx)(`span`,{className:`font-mono`,children:e.id}),t?(0,G.jsxs)(`span`,{children:[`· `,t]}):null,(0,G.jsxs)(`span`,{children:[`· updated `,Cy(e.updatedAt)]})]}),n?(0,G.jsx)(MC,{description:n}):null]})]})}function MC({description:e}){let[t,n]=(0,x.useState)(!1);return e.length>140||e.includes(`
62
- `)?(0,G.jsx)(`div`,{className:`max-w-3xl text-sm text-fg-muted`,children:(0,G.jsxs)(`div`,{className:W(`relative pr-9`,!t&&`line-clamp-2`),children:[(0,G.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e}),(0,G.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":t?`Collapse description`:`Expand description`,onClick:()=>n(e=>!e),className:`absolute right-0 bottom-0 inline-flex size-6 items-center justify-center rounded-md border border-line bg-panel/95 text-fg-subtle shadow-[var(--shadow-card)] transition-[color,transform,background-color] hover:bg-panel-raised hover:text-fg`,children:(0,G.jsx)(lr,{className:W(`size-4 transition-transform`,t&&`rotate-180`)})})]})}):(0,G.jsx)(`p`,{className:`max-w-3xl text-sm text-fg-muted whitespace-pre-wrap break-words`,children:e})}function NC({job:e}){return(0,G.jsxs)(`div`,{className:`grid gap-px overflow-hidden rounded-2xl border border-line bg-line sm:grid-cols-2 xl:grid-cols-4`,children:[(0,G.jsx)(PC,{label:`Workflow`,value:jy(e.workflowPath),detail:e.workflowPath,mono:!0}),(0,G.jsx)(PC,{label:`Phase`,value:e.phase,detail:`Started ${Oy(e.createdAt)}`}),(0,G.jsx)(PC,{label:`Working on`,value:Ly(e),detail:e.awaitingEvent??`Live execution`}),(0,G.jsx)(PC,{label:`Spend`,value:Ey(e.tokenUsage?.totalCostUsd??0),detail:`${e.prMappings?.length??0} PR mappings`})]})}function PC({label:e,value:t,detail:n,mono:r=!1}){return(0,G.jsxs)(`div`,{className:`bg-panel p-4`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:e}),(0,G.jsx)(`div`,{className:W(`mt-1 line-clamp-2 text-sm text-fg`,r?`font-mono`:`font-medium`),children:t}),n?(0,G.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[11px] text-fg-subtle`,children:n}):null]})}function FC({label:e,value:t,detail:n}){return(0,G.jsxs)(`div`,{className:`rounded-xl border border-line bg-overlay/40 p-4`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:e}),(0,G.jsx)(`div`,{className:`mt-1 text-xl font-semibold text-fg`,children:t}),n?(0,G.jsx)(`div`,{className:`mt-1 text-[12px] text-fg-muted`,children:n}):null]})}function IC({title:e,tone:t,children:n}){return(0,G.jsxs)(`div`,{className:W(`rounded-2xl border p-4`,{neutral:`border-line bg-overlay/40 text-fg`,accent:`border-accent-500/25 bg-accent-500/8 text-fg`,success:`border-success-500/25 bg-success-500/8 text-fg`,warning:`border-warning-500/25 bg-warning-500/8 text-fg`,danger:`border-danger-500/25 bg-danger-500/8 text-fg`}[t]),children:[(0,G.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:e}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n})]})}function LC({usage:e}){if(!e)return(0,G.jsx)(lg,{children:(0,G.jsxs)(ug,{children:[(0,G.jsx)(dg,{children:`Token usage`}),(0,G.jsx)(fg,{children:`Token usage will populate once this job has run through at least one model turn.`})]})});let t=e.inputTokens+e.outputTokens,n=e.inputTokens+e.cacheCreationInputTokens,r=n>0?e.cacheReadInputTokens/n*100:0;return(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{children:[(0,G.jsx)(dg,{children:`Token usage`}),(0,G.jsx)(fg,{children:`Token footprint, cache efficiency, and spend for the full run.`})]}),(0,G.jsxs)(pg,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,G.jsx)(FC,{label:`Total`,value:wy(t),detail:`${wy(e.inputTokens)} in / ${wy(e.outputTokens)} out`}),(0,G.jsx)(FC,{label:`Cache read`,value:wy(e.cacheReadInputTokens),detail:`${wy(e.cacheCreationInputTokens)} cache writes`}),(0,G.jsx)(FC,{label:`Hit rate`,value:r>0?`${r.toFixed(0)}%`:`—`,detail:`Across cache-eligible requests`}),(0,G.jsx)(FC,{label:`Spend`,value:Ey(e.totalCostUsd),detail:`USD across all turns`})]})]})}function RC({phases:e}){return e.length?(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{children:[(0,G.jsx)(dg,{children:`Usage by phase`}),(0,G.jsx)(fg,{children:`Per-phase token consumption, wall time, and model selection.`})]}),(0,G.jsx)(pg,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full min-w-[680px] text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-line text-left text-[10px] uppercase tracking-[0.16em] text-fg-subtle`,children:[(0,G.jsx)(`th`,{className:`px-2 py-2 font-medium`,children:`Phase`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Input`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Output`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Duration`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Turns`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Cost`}),(0,G.jsx)(`th`,{className:`px-2 py-2 font-medium`,children:`Model`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line text-fg`,children:e.map((e,t)=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`px-2 py-3 font-medium text-fg`,children:e.phase}),(0,G.jsx)(`td`,{className:`px-2 py-3 text-right tabular-nums`,children:wy(e.inputTokens)}),(0,G.jsx)(`td`,{className:`px-2 py-3 text-right tabular-nums`,children:wy(e.outputTokens)}),(0,G.jsx)(`td`,{className:`px-2 py-3 text-right tabular-nums`,children:Dy(e.durationMs)}),(0,G.jsx)(`td`,{className:`px-2 py-3 text-right tabular-nums`,children:e.numTurns}),(0,G.jsx)(`td`,{className:`px-2 py-3 text-right tabular-nums`,children:Ey(e.costUsd)}),(0,G.jsx)(`td`,{className:`px-2 py-3 text-fg-muted`,children:e.model})]},`${e.phase}-${t}`))})]})})]}):(0,G.jsx)(lg,{children:(0,G.jsxs)(ug,{children:[(0,G.jsx)(dg,{children:`Usage by phase`}),(0,G.jsx)(fg,{children:`No phase-level usage snapshots have been recorded yet.`})]})})}function zC({job:e}){return!e.awaitingEvent&&!e.escalationMessage&&!e.rateLimitInfo?null:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[e.status===`awaiting-rate-limit`&&e.rateLimitInfo?(0,G.jsx)(BC,{info:e.rateLimitInfo}):null,e.awaitingEvent&&e.status!==`awaiting-developer-input`&&e.status!==`awaiting-rate-limit`?(0,G.jsxs)(IC,{title:`Awaiting external event`,tone:`warning`,children:[e.awaitingEvent,e.awaitingPrId?` (PR #${e.awaitingPrId})`:``]}):null,e.escalationMessage?(0,G.jsx)(IC,{title:`Escalation message`,tone:`danger`,children:e.escalationMessage}):null]})}function BC({info:e}){let[t,n]=(0,x.useState)(()=>Date.now());(0,x.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let r=Math.max(0,e.resumeAt-t),i=Math.ceil(r/1e3),a=Math.floor(i/3600),o=Math.floor(i%3600/60),s=i%60,c=e=>e.toString().padStart(2,`0`),l=`${c(a)}:${c(o)}:${c(s)}`,u=e.kind===`overloaded`?`overloaded`:`rate-limit`;return(0,G.jsx)(IC,{title:r===0?`Provider ${u} — resuming…`:`Provider ${u} — auto-resume in ${l}`,tone:`warning`,children:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{children:[e.provider,` (attempt `,e.retryAttempt,`, source: `,e.source,`)`]}),e.lastErrorMessage?(0,G.jsx)(`div`,{className:`text-xs text-neutral-400 break-words`,children:e.lastErrorMessage}):null]})})}function VC({job:e,selectedPhase:t,phases:n,onSelectPhase:r,onMutated:i}){let a=t??e.phase,o=(e.artifacts??[]).filter(e=>e.phase===a),s=(e.phaseUsage??[]).find(e=>e.phase===a);return(0,G.jsxs)(lg,{children:[(0,G.jsx)(ug,{className:`border-b border-line pb-4`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(dg,{children:jy(e.workflowPath)}),(0,G.jsxs)(fg,{children:[n.length,` phases · click any to inspect`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:[(0,G.jsx)(`span`,{children:`current`}),(0,G.jsx)(vg,{variant:`neutral`,className:`border-line bg-overlay text-fg`,children:e.phase})]})]})}),(0,G.jsxs)(pg,{className:`space-y-5 pt-5`,children:[(0,G.jsx)(XS,{job:e,phases:n,selectedPhase:t,onSelectPhase:r}),(0,G.jsx)(tC,{job:e,phases:n,onSelectPhase:r}),(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:`Selected phase`}),(0,G.jsx)(`div`,{className:`text-base font-semibold text-fg`,children:a})]}),s?(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 text-[12px] text-fg-muted`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`in`}),` `,(0,G.jsx)(`span`,{className:`tabular-nums text-fg`,children:wy(s.inputTokens)})]}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`out`}),` `,(0,G.jsx)(`span`,{className:`tabular-nums text-fg`,children:wy(s.outputTokens)})]}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`turns`}),` `,(0,G.jsx)(`span`,{className:`tabular-nums text-fg`,children:s.numTurns})]}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`duration`}),` `,(0,G.jsx)(`span`,{className:`tabular-nums text-fg`,children:Dy(s.durationMs)})]})]}):null]}),(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsx)(`div`,{className:`mb-2 text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:`Phase artifacts`}),o.length===0?(0,G.jsx)(`div`,{className:`rounded-xl border border-dashed border-line px-4 py-3 text-[13px] text-fg-subtle`,children:`No artifacts have been posted for this phase yet.`}):(0,G.jsx)(`div`,{className:`grid gap-2 xl:grid-cols-2`,children:o.map(t=>(0,G.jsx)(Sx,{jobId:e.id,artifact:t},t.id))})]}),(0,G.jsx)(`div`,{className:`mt-4`,children:(0,G.jsx)(mC,{job:e,phase:a,onMutated:i})})]})]})]})}function HC({title:e=`Send message`,description:t=`Send additional guidance into the live run. Multiple messages are allowed.`,submitLabel:n=`Send message`,value:r,onChange:i,onSend:a,error:o,onStepIn:s,steppedIn:c=!1,placeholder:l=`Tell the agent what changed, what to prioritize, or where to look next…`,textareaRef:u}){return(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`gap-1.5 pb-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(dg,{children:e}),(0,G.jsx)(fg,{children:t})]}),s?(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>void s(),children:`Step in`}):null]}),c?(0,G.jsx)(`div`,{className:`rounded-lg border border-warning-500/25 bg-warning-500/8 px-3 py-2 text-xs text-warning-200`,children:`Paused — your next message will steer the run.`}):null]}),(0,G.jsxs)(pg,{className:`space-y-2.5 pt-0`,children:[o?(0,G.jsx)(gg,{message:o}):null,(0,G.jsx)(bb,{ref:u,rows:3,value:r,onChange:e=>i(e.target.value),placeholder:l,className:`min-h-24`}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsxs)(Y,{onClick:()=>void a(),disabled:!r.trim(),size:`sm`,children:[(0,G.jsx)(bi,{}),n]})})]})]})}function UC({messages:e}){return e.length===0?null:(0,G.jsxs)(`div`,{className:`border-t border-line pt-4`,children:[(0,G.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:[(0,G.jsx)(yr,{className:`size-3.5`}),`Pending messages`]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:e.map((e,t)=>(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/35 px-3 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,G.jsx)(yr,{className:`mt-0.5 size-3.5 shrink-0 text-warning-400`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-sm text-fg whitespace-pre-wrap break-words`,children:e.text}),(0,G.jsx)(`div`,{className:`mt-1 text-[11px] text-fg-subtle`,children:t===0?`Waiting for the next safe point. Queued ${Cy(e.queuedAt)}.`:`Queued behind ${t} earlier message${t===1?``:`s`} since ${Cy(e.queuedAt)}.`})]})]})},e.id))})]})}function WC({label:e,data:t,defaultOpen:n=!1}){let[r,i]=(0,x.useState)(n);return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-line bg-overlay/30`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`flex w-full items-center justify-between gap-3 px-4 py-3 text-left transition-colors hover:bg-overlay/60`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e}),(0,G.jsx)(lr,{className:W(`size-4 text-fg-subtle transition-transform`,r&&`rotate-180`)})]}),r?(0,G.jsx)(`pre`,{className:`max-h-[420px] overflow-auto border-t border-line p-4 font-mono text-[12px] text-fg whitespace-pre-wrap break-words`,children:JSON.stringify(t,null,2)}):null]})}function GC({job:e}){let t=Fy(e),n=Iy(e),r=qy(e),i=[];return i.push({label:`Workflow`,value:Yy(e)}),i.push({label:`Phase`,value:e.phase}),n&&i.push({label:`Repository`,value:n}),t.length>0&&i.push({label:`Reviewers`,value:t.join(`, `)}),r&&i.push({label:Xy(),value:(0,G.jsx)(Dn,{to:My({id:r}),className:`font-mono text-accent-300 hover:text-accent-400`,children:r})}),e.prMappings&&e.prMappings.length>0&&i.push({label:`Pull requests`,value:(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-fg-muted`,children:[(0,G.jsx)(Hr,{className:`size-3.5`}),e.prMappings.length,` mapping`,e.prMappings.length===1?``:`s`]})}),(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{children:[(0,G.jsx)(dg,{children:`Context`}),(0,G.jsx)(fg,{children:`${zy.singular} metadata and coordination signals.`})]}),(0,G.jsx)(pg,{className:`space-y-3 text-sm`,children:i.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsx)(`span`,{className:`text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:e.label}),(0,G.jsx)(`span`,{className:`text-right text-fg`,children:e.value})]},t))})]})}function KC(){let{jobId:e}=ot(),t=$e(),{job:n,loading:r,error:i,refetch:a}=CC(e),{lines:o,status:s,lastHeartbeat:c}=DC(e,n?!jo(n.status):!0),l=(0,x.useRef)(void 0),u=(0,x.useRef)(0),[d,f]=(0,x.useState)(`activity`),[p,m]=(0,x.useState)(null),[h,g]=(0,x.useState)(``),[_,v]=(0,x.useState)(!1),[y,b]=(0,x.useState)(!1),[S,C]=(0,x.useState)(null),[w,T]=(0,x.useState)(!1),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(!1),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(``),[ee,te]=(0,x.useState)(null),P=(0,x.useRef)(null),[F,I]=(0,x.useState)([]),[ne,re]=(0,x.useState)(!1),[ie,L]=(0,x.useState)(void 0),R=(0,x.useRef)([]),ae=(0,x.useRef)(!1),oe=(0,x.useRef)(0),se=n?Ay(n):!1;To(e?{id:e,kind:`run`,path:t.pathname,title:n?Ny(n):e,subtitle:n?.phase}:null),(0,x.useEffect)(()=>{l.current=void 0,u.current=0,m(null),oe.current+=1,R.current=[],ae.current=!1,I([])},[e]),(0,x.useEffect)(()=>{if(!n)return;let e=l.current;l.current=n.phase,m(t=>t===null||e===void 0||t===e?n.phase:t)},[n?.id,n?.phase]),(0,x.useEffect)(()=>{if(o.length<=u.current){u.current=o.length;return}let e=o.slice(u.current);u.current=o.length,e.some(e=>e.lineType===`phase`)&&a()},[o,a]),(0,x.useEffect)(()=>{if(!n||jo(n.status))return;let e=window.setInterval(()=>{a()},4e3);return()=>{window.clearInterval(e)}},[n?.id,n?.status,a]);let ce=(0,x.useMemo)(()=>kC(n??null),[n]);async function le(t,n=!1){if(e){k(!0),j(null);try{let r={};t&&(r.fromPhase=t),n&&(r.clearSession=!0),await q(`/jobs/${e}/resume`,J(r,{method:`POST`})),await a()}catch(e){j(e instanceof Error?e.message:`Resume failed`)}finally{k(!1)}}}async function ue(){if(e&&window.confirm(`Cancel this run? It will stop at the next safe boundary and will not auto-resume.`)){b(!0),C(null);try{await q(`/jobs/${e}/cancel`,J({},{method:`POST`})),await a()}catch(e){C(e instanceof Error?e.message:`Cancel failed`)}finally{b(!1)}}}async function de(){if(!e)return!1;T(!0),D(null);try{return await q(`/jobs/${e}/pause`,J({},{method:`POST`})),await a(),requestAnimationFrame(()=>P.current?.focus()),!0}catch(e){return D(e instanceof Error?e.message:`Pause failed`),!1}finally{T(!1)}}async function fe(){await de()}async function pe(){re(!0);try{await a()}finally{re(!1)}}(0,x.useEffect)(()=>{n&&ie!==void 0&&ie===n.interactive&&L(void 0)},[n?.interactive,ie]);function me(e){let t=e(R.current);R.current=t,I(t)}async function he(t){if(!e)throw Error(`No job id`);await q(`/jobs/${e}/message`,J({message:t},{method:`POST`})),a()}async function ge(){if(ae.current)return;ae.current=!0;let e=oe.current;try{for(;oe.current===e;){let t=R.current[0];if(!t)break;try{if(await he(t.text),oe.current!==e)return;te(null)}catch(t){if(oe.current!==e)return;te(t instanceof Error?t.message:`Failed to send message`)}finally{if(oe.current!==e)return;me(e=>e.filter(e=>e.id!==t.id))}}}finally{oe.current===e&&(ae.current=!1)}}async function _e(){let e=M.trim();e&&(te(null),N(``),me(t=>[...t,{id:crypto.randomUUID(),text:e,queuedAt:Date.now()}]),ge())}if(r)return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsx)(bg,{className:`h-32 w-full`}),(0,G.jsx)(bg,{className:`h-20 w-full`}),(0,G.jsx)(bg,{className:`h-12 w-full`}),(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,G.jsx)(bg,{className:`h-[520px] w-full`}),(0,G.jsx)(bg,{className:`h-[420px] w-full`})]})]});if(i||!n)return(0,G.jsx)(lg,{children:(0,G.jsxs)(pg,{className:`flex flex-col items-center gap-4 py-16 text-center`,children:[(0,G.jsx)(`div`,{className:`text-lg font-semibold text-fg`,children:i??`${zy.singular} not found`}),(0,G.jsx)(`p`,{className:`max-w-md text-sm text-fg-muted`,children:`The ${zy.singularLower} could not be loaded. It may have been deleted or the runner could not reach its backing state store.`}),(0,G.jsx)(Y,{asChild:!0,variant:`secondary`,children:(0,G.jsx)(Dn,{to:Zy,children:Vy.backToRuns})})]})});let ve=Io(n.status,n.awaitingEvent),ye=No(n.status)&&s!==`disconnected`||Mo(n.status)&&n.status!==`awaiting-developer-input`||ve,be=n.status===`escalated`;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(jC,{job:n}),(0,G.jsx)(zC,{job:n}),(0,G.jsx)(AS,{job:n,workflowPhases:ce,refreshing:ne,onRefresh:pe,cancelling:y,cancelError:S,onCancel:ue,pausing:w,pauseError:E,onPause:de,resuming:O,resumeError:A,resumePhase:h,clearSession:_,onResumePhaseChange:g,onClearSessionChange:v,onResume:le,interactiveOverride:ie,onInteractiveChange:L}),(0,G.jsx)(NC,{job:n}),(0,G.jsx)(VC,{job:n,selectedPhase:p,phases:ce,onSelectPhase:m,onMutated:()=>void a()}),se?(0,G.jsx)(Vx,{job:n,onMutated:()=>void a()}):null,(0,G.jsxs)(Bb,{value:d,onValueChange:e=>f(e),children:[(0,G.jsxs)(Vb,{children:[(0,G.jsxs)(Hb,{value:`activity`,children:[(0,G.jsx)($n,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),`Activity`,No(n.status)?(0,G.jsx)(`span`,{title:`Run is active`,className:`ml-1 inline-flex size-1.5 rounded-full bg-accent-400 animate-pulse-dot`}):null]}),(0,G.jsxs)(Hb,{value:`changes`,children:[(0,G.jsx)(Hr,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),`Changes`,yS(n)?(0,G.jsx)(`span`,{title:`A pull request is ready for your review`,className:`ml-1 inline-flex size-1.5 rounded-full bg-accent-400`}):null]}),(0,G.jsxs)(Hb,{value:`insights`,children:[(0,G.jsx)(Xr,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),`Insights`,(()=>{let e=(n.insights??[]).filter(e=>!e.sourceChildName&&(e.status??`pending`)===`pending`).length;return e>0?(0,G.jsx)(OC,{tone:`warning`,children:e}):null})()]}),(0,G.jsxs)(Hb,{value:`diagnostics`,children:[(0,G.jsx)(sr,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),`Diagnostics`,(()=>{let e=(n.tokenUsage?.inputTokens??0)+(n.tokenUsage?.outputTokens??0);return e>0?(0,G.jsx)(OC,{tone:`neutral`,children:wy(e)}):null})()]})]}),(0,G.jsx)(Ub,{value:`activity`,className:`space-y-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,G.jsxs)(`div`,{className:`space-y-5`,children:[n.status===`awaiting-developer-input`&&!ve?(0,G.jsx)(bx,{job:n,onSend:he,onCancel:ue,onViewChanges:()=>f(`changes`)}):null,be?(0,G.jsx)(HC,{title:`Reply to escalation`,description:`Send guidance back into the parked run. Your reply will resume the current phase in the existing job.`,submitLabel:`Send reply`,value:M,onChange:N,onSend:_e,error:ee}):null,(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`gap-3 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(dg,{children:`Live console`}),(0,G.jsx)(fg,{children:`Streaming runner output, tool execution summaries, and developer interventions.`})]}),(0,G.jsx)(Ux,{status:s,lastHeartbeat:c})]}),(0,G.jsxs)(pg,{className:`space-y-4 pt-5`,children:[(0,G.jsx)(HS,{lines:o}),(0,G.jsx)(UC,{messages:F})]})]}),ye?(0,G.jsx)(HC,{value:M,onChange:N,onSend:_e,error:ee,onStepIn:Lo(n.status,n.awaitingEvent)?fe:void 0,steppedIn:ve,placeholder:ve?`Tell Coro what to change before continuing…`:void 0,textareaRef:P}):null]}),(0,G.jsx)(`div`,{className:`space-y-4`,children:(0,G.jsx)(GC,{job:n})})]})}),(0,G.jsx)(Ub,{value:`changes`,className:`space-y-5`,children:(0,G.jsx)(xS,{job:n,live:!jo(n.status)})}),(0,G.jsx)(Ub,{value:`insights`,className:`space-y-5`,children:(0,G.jsx)(Xx,{jobId:n.id,insights:n.insights??[],onChanged:()=>void a()})}),(0,G.jsxs)(Ub,{value:`diagnostics`,className:`space-y-5`,children:[(0,G.jsx)(LC,{usage:n.tokenUsage}),(0,G.jsx)(RC,{phases:n.phaseUsage??[]}),(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`border-b border-line pb-4`,children:[(0,G.jsx)(dg,{children:`Raw state`}),(0,G.jsx)(fg,{children:`Inspect the underlying job object, parameters, and PR mappings. Insights have moved to their own tab.`})]}),(0,G.jsxs)(pg,{className:`space-y-3 pt-5`,children:[(0,G.jsx)(WC,{label:`Job parameters`,data:n.params,defaultOpen:!0}),(0,G.jsx)(WC,{label:`Full job object`,data:n}),n.prMappings?.length>0?(0,G.jsx)(WC,{label:`PR mappings (${n.prMappings.length})`,data:n.prMappings}):null]})]})]})]}),(0,G.jsx)(SC,{className:`opacity-0`})]})}var qC={base:{label:`Coro`,Icon:ii,tone:`bg-fg/8 text-fg-muted ring-line`,description:`Ships with the Coro runner. Read-only — override in your Custom or Repo layer.`},tenant:{label:`Custom`,Icon:Yr,tone:`bg-accent-500/15 text-accent-200 ring-accent-500/30`,description:`Your custom overlay (~/.coro/intelligence). Edit here to apply across every repo.`},repo:{label:`Repo`,Icon:Si,tone:`bg-success/15 text-success ring-success/30`,description:`The target repo's .coro/ folder. Edit here for repo-local customisations.`}};function JC({layer:e,overrides:t,size:n=`md`,className:r}){let i=qC[e],a=i.Icon;return(0,G.jsxs)(`span`,{title:t?`${i.description}\nOverrides ${qC[t].label.toLowerCase()} layer.`:i.description,className:W(`inline-flex items-center gap-1 rounded-md font-medium uppercase tracking-wide ring-1`,n===`sm`?`px-1.5 py-0.5 text-[10px]`:`px-2 py-0.5 text-[11px]`,i.tone,r),children:[(0,G.jsx)(a,{className:n===`sm`?`size-2.5`:`size-3`}),i.label,t?(0,G.jsxs)(`span`,{className:`ml-0.5 normal-case text-[10px] opacity-70`,children:[`↳ overrides `,qC[t].label.toLowerCase()]}):null]})}function YC({tone:e,children:t,title:n}){let r={accent:`bg-accent-500/15 text-accent-200 ring-accent-500/30`,warning:`bg-warning-500/12 text-warning-200 ring-warning-500/30`,muted:`bg-overlay/60 text-fg-muted ring-line`,model:`bg-overlay/60 text-fg-muted ring-line`}[e];return(0,G.jsx)(`span`,{title:n,className:W(`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide ring-1`,r),children:t})}function XC({workflow:e,compact:t=!1}){let n=e.phases??[];return n.length===0?(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/30 p-3 text-xs text-fg-muted`,children:`No phase information available.`}):(0,G.jsx)(`ol`,{className:W(`space-y-1.5`,t&&`space-y-1`),children:n.map((r,i)=>{let a=r.name===e.initialPhase,o=i===n.length-1;return(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`div`,{className:W(`rounded-xl border px-3 transition-colors`,t?`py-2`:`py-3`,a?`border-accent-500/40 bg-accent-500/5`:`border-line bg-overlay/30`),children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,G.jsx)(`span`,{className:W(`mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-full text-[10px] font-mono ring-1`,a?`bg-accent-500/20 ring-accent-500/40 text-accent-200`:`bg-overlay/60 ring-line text-fg-muted`),children:i+1}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1`,children:[(0,G.jsx)(`span`,{className:W(`font-medium text-fg`,t?`text-xs`:`text-sm`),children:r.name}),a?(0,G.jsxs)(YC,{tone:`accent`,children:[(0,G.jsx)(pr,{className:`size-2.5`}),`Start`]}):null,(0,G.jsx)(YC,{tone:`model`,children:r.model}),r.interactiveCheckpoint?(0,G.jsxs)(YC,{tone:`warning`,title:`Runner pauses for your approval before advancing when interactive mode is on`,children:[(0,G.jsx)(hr,{className:`size-2.5`}),`Checkpoint`]}):null]}),t?null:(0,G.jsxs)(`div`,{className:`mt-1 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,G.jsx)(ar,{className:`size-3 shrink-0`}),r.agent?(0,G.jsx)(`span`,{className:`font-mono`,children:r.agent}):(0,G.jsx)(`span`,{className:`italic`,children:`Runner-managed`})]})]})]})}),o?null:(0,G.jsx)(`div`,{className:`flex justify-center py-0.5`,children:(0,G.jsx)(tr,{className:`size-3 text-fg-subtle`})})]},r.name)})})}function ZC({workflow:e,open:t,onOpenChange:n}){return(0,G.jsx)(c_,{open:t,onOpenChange:n,children:(0,G.jsxs)(d_,{className:`flex max-w-2xl flex-col gap-0 max-h-[min(720px,calc(100vh-2rem))]`,children:[(0,G.jsx)(f_,{className:`shrink-0`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-500/15 ring-1 ring-accent-500/30 text-accent-200`,children:(0,G.jsx)(B,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(p_,{children:e?.name??`Workflow`}),e?.layer?(0,G.jsx)(JC,{layer:e.layer,overrides:e.overrides}):null]}),e?(0,G.jsx)(m_,{className:`font-mono text-[11px] text-fg-subtle`,children:e.workflowPath}):null]})]})}),(0,G.jsxs)(h_,{className:`flex-1 min-h-0 space-y-5`,children:[e?.description?(0,G.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:e.description}):null,e&&e.phases&&e.phases.length>0?(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,G.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-fg-subtle`,children:`Phases`}),(0,G.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[e.phases.length,` phase`,e.phases.length===1?``:`s`]})]}),(0,G.jsx)(XC,{workflow:e})]}):(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/30 p-4 text-sm text-fg-muted`,children:`No phase information available for this workflow.`}),e?(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-line pt-4 text-xs text-fg-subtle`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{children:`From`}),e.layer?(0,G.jsx)(JC,{layer:e.layer,overrides:e.overrides,size:`sm`}):(0,G.jsx)(`span`,{className:`font-mono`,children:QC(e.source)}),e.layer&&e.source?(0,G.jsx)(`span`,{className:`font-mono text-[10px] opacity-60`,title:e.source,children:QC(e.source)}):null]}),e.kind===`job`?null:(0,G.jsxs)(YC,{tone:`muted`,children:[(0,G.jsx)(Er,{className:`size-2.5`}),e.kind]})]}):null]})]})})}function QC(e){if(!e)return`unknown`;let t=e.split(`/`).filter(Boolean);return t.length<=2?e:`…/`+t.slice(-2).join(`/`)}function $C({workflow:e,interactive:t,mode:n,serviceName:r,repo:i,ticketId:a,formValid:o,loading:s=!1}){if(s||!e)return(0,G.jsxs)(`div`,{className:`space-y-3 rounded-2xl border border-line bg-overlay/30 p-5`,children:[(0,G.jsx)(bg,{className:`h-5 w-2/3`}),(0,G.jsx)(bg,{className:`h-4 w-full`}),(0,G.jsx)(bg,{className:`h-32 w-full`})]});let c=e.phases?.[0]?.name??`the first phase`,l=e.phases?.length??0,u=t?`Coro starts at ${c} and pauses at every checkpoint for your approval.`:`Coro runs end-to-end and opens a PR. You can pause or message it mid-run.`,d=n===`manual`?r?.trim()||i?.trim()||`Your run details`:a?.trim()||`Tracker ticket run`;return(0,G.jsxs)(`div`,{className:W(`space-y-4 rounded-2xl border border-line bg-overlay/30 p-5 transition-opacity`,!o&&`opacity-50`),children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-[0.16em] text-fg-subtle`,children:`What will happen`}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:e.name}),e.layer?(0,G.jsx)(JC,{layer:e.layer,overrides:e.overrides,size:`sm`}):null,(0,G.jsx)(`span`,{className:`rounded-md border border-line bg-overlay/60 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-fg-muted`,children:e.kind})]}),e.description?(0,G.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-fg-muted`,children:e.description}):null,(0,G.jsx)(`p`,{className:`mt-1 text-xs font-medium text-fg`,children:d})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-2 text-[11px] font-semibold uppercase tracking-wider text-fg-subtle`,children:`Phases`}),(0,G.jsx)(XC,{workflow:e,compact:!0})]}),(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/40 px-3 py-2.5 text-xs leading-relaxed text-fg-muted`,children:u}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,G.jsx)(br,{className:`size-3.5 shrink-0 text-fg-subtle`}),(0,G.jsx)(`span`,{children:ho(e.workflowPath,l)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-2 text-[11px] font-semibold uppercase tracking-wider text-fg-subtle`,children:`Mid-run controls`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(ew,{icon:oi,label:`Pause`}),(0,G.jsx)(ew,{icon:ni,label:`Message`}),(0,G.jsx)(ew,{icon:ir,label:`Cancel`})]})]}),(0,G.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:`Token cost shows live on the run page.`})]})}function ew({icon:e,label:t}){return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-line bg-overlay/50 px-2.5 py-1 text-[11px] font-medium text-fg-muted`,children:[(0,G.jsx)(e,{className:`size-3 text-fg-subtle`}),t]})}var tw={"bug-fix":{label:`Bug fix`,icon:`🐛`,blurb:`Investigate and fix broken behaviour.`},refactor:{label:`Refactor`,icon:`♻️`,blurb:`Clean up structure without changing behaviour.`},"feature-small":{label:`Small feature`,icon:`✨`,blurb:`Scoped additions to existing code.`},"feature-medium":{label:`Medium feature`,icon:`🚀`,blurb:`Multi-file changes with clear acceptance criteria.`},tests:{label:`Tests`,icon:`🧪`,blurb:`Add or improve test coverage.`},docs:{label:`Documentation`,icon:`📝`,blurb:`Update README or inline docs.`},dependency:{label:`Dependency`,icon:`📦`,blurb:`Bump packages and fix breakage.`},"tracker-triage":{label:`Tracker ticket`,icon:`🎫`,blurb:`Start from an issue in your tracker.`}},nw=[{id:`add-validation`,category:`feature-small`,title:`Add input validation`,preview:`Validate request payloads on an endpoint with clear error messages.`,description:"Add input validation to the `<endpoint>` endpoint. Return 400 with a structured error body when validation fails. Include unit tests for the happy path and at least two failure cases.",mode:`manual`,tags:[`validation`,`api`,`endpoint`]},{id:`fix-flaky-test`,category:`bug-fix`,title:`Fix a flaky test`,preview:`Investigate timing or ordering issues causing intermittent failures.`,description:"The test `<test file>` is flaky. Investigate the root cause, fix it, and add a brief comment explaining what made it unstable. The test must pass reliably when run 10 times in a row.",mode:`manual`,tags:[`test`,`flaky`,`ci`]},{id:`extract-helper`,category:`refactor`,title:`Extract a shared helper`,preview:`Pull repeated logic into a reusable function without changing behaviour.`,description:"Extract the repeated `<pattern>` block into a shared helper. Update all call sites to use it. Behaviour must remain identical — no functional changes. Add or update tests if coverage would drop.",mode:`manual`,tags:[`refactor`,`dedupe`]},{id:`add-rate-limit`,category:`feature-small`,title:`Add rate limiting`,preview:`Protect an endpoint with token-bucket or similar limiting.`,description:"Add rate limiting to `<endpoint>` using the existing `<library>` utility. Return clear retry-after headers when a caller exceeds the limit. Include acceptance criteria: limit applies per caller, headers are present, and existing tests still pass.",mode:`manual`,tags:[`rate-limit`,`api`,`security`]},{id:`bump-dependency`,category:`dependency`,title:`Bump a dependency`,preview:`Upgrade a package to the latest compatible version.`,description:"Bump `<package>` to the latest minor version compatible with our runtime. Fix any compile or test breakage. Summarise breaking API changes in the PR description.",mode:`manual`,tags:[`dependency`,`upgrade`]},{id:`improve-readme`,category:`docs`,title:`Update README`,preview:`Document a new feature or changed behaviour in the README.`,description:"Update the README to reflect the new `<feature>`. Include setup steps if they changed, and add a short usage example. Keep the tone consistent with the existing doc.",mode:`manual`,tags:[`docs`,`readme`]},{id:`add-unit-tests`,category:`tests`,title:`Add unit tests`,preview:`Cover a module with focused unit tests for edge cases.`,description:"Add unit-test coverage for `<module>` focusing on `<edge cases>`. Follow existing test conventions in the repo. Tests must be deterministic and not require network access.",mode:`manual`,tags:[`tests`,`coverage`]},{id:`triage-ticket`,category:`tracker-triage`,title:`Work from a tracker ticket`,preview:`Switch to ticket mode — Coro pulls scope from your issue tracker.`,description:``,mode:`ticket`,tags:[`jira`,`linear`,`ticket`]}],rw=`coro.promptTemplates.recent`;function iw(){if(typeof window>`u`)return[];try{let e=window.localStorage.getItem(rw);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`).slice(0,3):[]}catch{return[]}}function aw(e){if(typeof window>`u`)return;let t=iw().filter(t=>t!==e);window.localStorage.setItem(rw,JSON.stringify([e,...t].slice(0,3)))}function ow(e){let t=e.match(/<[^>]+>/);return!t||t.index===void 0?null:{start:t.index,end:t.index+t[0].length}}function sw({open:e,onOpenChange:t,onSelect:n,hasExistingDescription:r}){let[i,a]=(0,x.useState)(`feature-small`),[o,s]=(0,x.useState)(``),c=(0,x.useMemo)(()=>e?iw():[],[e]),l=(0,x.useMemo)(()=>{let e=o.trim().toLowerCase(),t=i===`recent`?c.map(e=>nw.find(t=>t.id===e)).filter(e=>!!e):nw.filter(e=>e.category===i);return e&&(t=nw.filter(t=>t.title.toLowerCase().includes(e)||t.preview.toLowerCase().includes(e)||t.tags?.some(t=>t.includes(e)))),t},[i,o,c]);function u(e){r&&e.description&&!window.confirm(`Replace your current description with this example?`)||(aw(e.id),n(e),t(!1))}let d=Object.keys(tw);return(0,G.jsx)(c_,{open:e,onOpenChange:t,children:(0,G.jsxs)(d_,{className:`flex max-w-3xl flex-col gap-0 max-h-[min(720px,calc(100vh-2rem))]`,children:[(0,G.jsxs)(f_,{className:`shrink-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Di,{className:`size-4 text-accent-300`}),(0,G.jsx)(p_,{children:`Start from an example`})]}),(0,G.jsx)(m_,{children:`Pick a template to pre-fill your description. Swap in your repo, endpoints, and specifics.`})]}),(0,G.jsxs)(h_,{className:`flex min-h-0 flex-1 flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(yi,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),(0,G.jsx)(O_,{value:o,onChange:e=>s(e.target.value),placeholder:`Search examples…`,className:`pl-9`})]}),(0,G.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-4 md:grid-cols-[180px_minmax(0,1fr)]`,children:[(0,G.jsxs)(`nav`,{className:`space-y-1 overflow-y-auto`,children:[c.length>0?(0,G.jsx)(cw,{active:i===`recent`,label:`Recent`,blurb:`Recently used`,onClick:()=>a(`recent`)}):null,d.map(e=>(0,G.jsx)(cw,{active:i===e,label:tw[e].label,blurb:tw[e].blurb,count:nw.filter(t=>t.category===e).length,onClick:()=>a(e)},e))]}),(0,G.jsx)(`div`,{className:`min-h-0 space-y-2 overflow-y-auto pr-1`,children:l.length===0?(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/30 p-4 text-sm text-fg-muted`,children:`No examples match your search.`}):l.map(e=>(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/30 p-4 transition-colors hover:border-line-strong`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:e.preview})]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>u(e),children:`Use this`})]})},e.id))})]})]})]})})}function cw({active:e,label:t,blurb:n,count:r,onClick:i}){return(0,G.jsxs)(`button`,{type:`button`,onClick:i,className:W(`w-full rounded-lg border px-3 py-2 text-left text-sm transition-colors`,e?`border-accent-500/40 bg-accent-500/10 text-fg`:`border-transparent text-fg-muted hover:bg-overlay/50 hover:text-fg`),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:t}),r===void 0?null:(0,G.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-subtle`,children:r})]}),(0,G.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-4 text-fg-subtle`,children:n})]})}function lw({onClick:e}){return(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:e,className:`shrink-0`,children:[(0,G.jsx)(Di,{className:`size-3.5`}),`Start from an example`]})}function uw(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function dw(e,t){let n=e.match(/<brief>\s*([\s\S]*?)\s*<\/brief>/i);if(!n?.[1])return null;let r;try{r=JSON.parse(n[1].trim())}catch{return null}if(!r||typeof r!=`object`)return null;let i=r,a=typeof i.repo==`string`?i.repo.trim():``,o=typeof i.serviceName==`string`?i.serviceName.trim():``,s=typeof i.description==`string`?i.description.trim():``,c=typeof i.workflowPath==`string`?i.workflowPath.trim():``,l=i.interactive!==!1;if(!a||s.length<20||!t.includes(c))return null;let u=``;return Array.isArray(i.reviewers)?u=i.reviewers.filter(e=>typeof e==`string`&&e.trim().length>0).join(`, `):typeof i.reviewers==`string`&&(u=i.reviewers.trim()),{repo:a,serviceName:o||a.split(`/`).pop()||a,description:s,reviewers:u,workflowPath:c,interactive:l}}function fw(e,t=5){let n=[],r=[],i=new Set,a=new Set,o=[...e].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime());for(let e of o){let o=typeof e.params?.repo==`string`&&e.params.repo||typeof e.params?.repoSlug==`string`&&e.params.repoSlug||``;o&&!i.has(o)&&(i.add(o),n.push(o));let s=e.params?.reviewers;if(Array.isArray(s))for(let e of s)typeof e==`string`&&e.trim()&&!a.has(e.trim())&&(a.add(e.trim()),r.push(e.trim()));if(n.length>=t&&r.length>=t)break}return{recentRepos:n.slice(0,t),recentReviewers:r.slice(0,t)}}function pw(e,t,n,r=3){let i=t.toLowerCase().split(/\W+/).filter(e=>e.length>3);return i.length===0&&!n?[]:e.filter(e=>![`cancelled`,`canceled`].includes(e.status)).map(e=>{let t=0,r=typeof e.params?.repo==`string`&&e.params.repo||typeof e.params?.repoSlug==`string`&&e.params.repoSlug||``;n&&r===n&&(t+=5);let a=(typeof e.params?.description==`string`&&e.params.description||typeof e.params?.serviceName==`string`&&e.params.serviceName||``).toLowerCase();for(let e of i)a.includes(e)&&(t+=1);return{job:e,score:t}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score).slice(0,r).map(e=>e.job)}function mw(){let[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(null),[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)([]),c=(0,x.useRef)(null),l=(0,x.useRef)(typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`intake-${Date.now()}`),[u,d]=(0,x.useState)(0),[f,p]=(0,x.useState)(0),m=(0,x.useCallback)(()=>{c.current?.abort(),c.current=null,t(!1),s([])},[]),h=(0,x.useCallback)(async(e,n,i,o,u)=>{r(null),a(!1),t(!0),s([]),c.current?.abort();let f=new AbortController;c.current=f;let m=``,h=[],g=()=>{s([...h]),u?.([...h])};try{let t=await fetch(`/intake/stream`,{...J({sessionId:l.current,messages:e.map(e=>({role:e.role,content:e.content})),...o?.model?.trim()?{model:o.model.trim(),...o.provider?.trim()?{provider:o.provider.trim()}:{}}:{},context:{recentRepos:n.recentRepos,recentReviewers:n.recentReviewers,availableWorkflows:n.availableWorkflows.map(e=>({id:e.id,name:e.name,workflowPath:e.workflowPath,description:e.description})),userLocale:n.userLocale??navigator.language}},{method:`POST`}),signal:f.signal});if(!t.ok){let e=await t.json().catch(()=>({}));if(t.status===503||e.reason===`no-llm`)return a(!0),{assistantText:``,toolCalls:[],noLlm:!0,error:e.error??`No LLM provider configured`};throw Error(e.error??`Plan mode failed (${t.status})`)}if(!t.body)throw Error(`No response body from plan mode stream`);let r=t.body.getReader(),c=new TextDecoder,u=``,_;for(;;){let{done:e,value:t}=await r.read();if(e)break;u+=c.decode(t,{stream:!0});let n=u.split(`
60
+ `)}var Yb=new Map;function Xb(e,t){return`${e}:${t}`}async function Zb(e,t){let n=Xb(e,t),r=Yb.get(n);if(typeof r==`string`||r)return r;let i=uo(`/jobs/${e}/artifacts/${t}/content`);Yb.set(n,i);try{let e=await i;return Yb.set(n,e),e}catch(e){throw Yb.delete(n),e}}async function Qb(e,t,n){let r=await q(`/jobs/${e}/artifacts/${t}/content`,J({content:n},{method:`PUT`}));return Yb.set(Xb(e,t),n),r.artifact}function $b(e,t){Yb.delete(Xb(e,t))}function ex(e){let t=e.data?.path;return typeof t==`string`&&t.trim().length>0}function tx(e){let t=e.data?.path;return(typeof t==`string`?t.toLowerCase():``).endsWith(`.md`)||e.kind.endsWith(`-md`)||e.kind.includes(`md`)}var nx=[`.md`,`.txt`,`.yml`,`.yaml`,`.json`];function rx(e){if(!ex(e))return!1;let t=e.data.path.toLowerCase();return nx.some(e=>t.endsWith(e))}function ix({jobId:e,artifacts:t,phaseLabel:n,onApprove:r,onRequestChanges:i,onCancel:a,onViewChanges:o,sending:s=!1}){let c=t.some(e=>e.kind===`pr-preview`),[l,u]=(0,x.useState)(t[0]?.id??``),[d,f]=(0,x.useState)(!1),[p,m]=(0,x.useState)(``),[h,g]=(0,x.useState)(null),[_,v]=(0,x.useState)(null);(0,x.useEffect)(()=>{t.length>0&&!t.some(e=>e.id===l)&&u(t[0].id)},[t,l]);let y=t.find(e=>e.id===l)??t[0],b=!!y&&h===y.id,S=s||h!==null;return(0,G.jsxs)(vv,{delayDuration:250,children:[(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-line bg-overlay/30`,children:[(0,G.jsxs)(`header`,{className:`space-y-1 border-b border-line px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`text-sm font-semibold text-fg`,children:[`Review what Coro produced in the `,(0,G.jsx)(`span`,{className:`font-mono`,children:n}),` phase`]}),(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Read the output below, edit it if needed, then approve or request changes.`})]}),t.length>1?(0,G.jsx)(ax,{artifacts:t,activeId:l,onChange:e=>{u(e),g(null)},editingId:h}):null,y?(0,G.jsx)(ox,{jobId:e,artifact:y,editing:b,disabled:s,onStartEdit:()=>g(y.id),onCancelEdit:()=>g(null),onSaved:()=>g(null),onOpenFullScreen:()=>v(y.id)}):null,(0,G.jsxs)(`div`,{className:`space-y-3 border-t border-line bg-overlay/40 px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(`span`,{children:(0,G.jsxs)(Y,{type:`button`,variant:`success`,size:`sm`,disabled:S,onClick:r,children:[(0,G.jsx)(fr,{}),`Approve and continue`]})})}),h===null?null:(0,G.jsx)(xv,{children:`Save or cancel your edit first.`})]}),c&&o?(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,size:`sm`,disabled:s,onClick:o,children:[(0,G.jsx)(Ar,{}),`Review code changes`]}):null,(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,size:`sm`,disabled:s,onClick:()=>f(e=>!e),children:[(0,G.jsx)(ni,{}),d?`Hide change request`:`Request changes`]}),(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,disabled:s,onClick:()=>{window.confirm(`Cancel this run?`)&&a()},children:[(0,G.jsx)(ir,{}),`Cancel run`]})]}),d?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(bb,{rows:3,value:p,onChange:e=>m(e.target.value),placeholder:`Describe what should change before continuing…`,disabled:s}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Y,{type:`button`,size:`sm`,disabled:s||!p.trim(),onClick:()=>{i(p.trim()),m(``),f(!1)},children:`Send feedback`})})]}):(0,G.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:`You can also send any message to Coro using the message box below.`})]})]}),_&&y&&y.id===_?(0,G.jsx)(vx,{jobId:e,artifact:y,onClose:()=>v(null)}):null]})}function ax({artifacts:e,activeId:t,onChange:n,editingId:r}){return(0,G.jsx)(`div`,{className:`overflow-x-auto border-b border-line bg-overlay/20 px-2 py-2`,children:(0,G.jsx)(`div`,{className:`flex min-w-max items-center gap-1`,children:e.map(e=>{let i=e.id===t,a=r===e.id;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:W(`group flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors`,i?`bg-overlay text-fg ring-1 ring-line-strong`:`text-fg-muted hover:bg-overlay/70 hover:text-fg`),children:[(0,G.jsx)(_x,{kind:e.kind}),(0,G.jsx)(`span`,{className:`max-w-[18ch] truncate font-medium`,children:e.title||e.kind||e.id}),(0,G.jsx)(vg,{variant:`neutral`,className:`text-[10px] uppercase`,children:e.kind}),a?(0,G.jsx)(`span`,{className:`rounded-full bg-warning-500/20 px-1.5 py-0.5 text-[9px] uppercase tracking-wide text-warning-300`,children:`Editing`}):null]},e.id)})})})}function ox({jobId:e,artifact:t,editing:n,disabled:r,onStartEdit:i,onCancelEdit:a,onSaved:o,onOpenFullScreen:s}){return ex(t)?(0,G.jsx)(ux,{jobId:e,artifact:t,editing:n,disabled:r,onStartEdit:i,onCancelEdit:a,onSaved:o,onOpenFullScreen:s}):(0,G.jsxs)(`div`,{className:`space-y-3 px-4 py-4`,children:[(0,G.jsx)(sx,{artifact:t}),(0,G.jsx)(cx,{artifact:t})]})}function sx({artifact:e}){let t=typeof e.data.path==`string`?e.data.path:``;return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:e.title||e.kind}),(0,G.jsx)(vg,{variant:`neutral`,children:e.kind}),t?(0,G.jsx)(`span`,{className:`truncate font-mono text-fg-subtle`,children:t}):null,(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[`Posted `,Oy(e.createdAt)]}),e.editedAt?(0,G.jsxs)(`span`,{className:`text-warning-300`,children:[`Edited `,Oy(e.editedAt)]}):null]})}function cx({artifact:e}){if(e.kind===`pr-preview`)return(0,G.jsx)(lx,{data:e.data});let t=typeof e.data.url==`string`?e.data.url:null;return(e.kind===`pr-link`||e.kind===`url`)&&t?(0,G.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`group flex items-start gap-3 rounded-2xl border border-line bg-overlay/40 px-4 py-3 transition-colors hover:border-accent-500/30 hover:bg-overlay/60`,children:[(0,G.jsx)(`div`,{className:`rounded-lg border border-line bg-overlay p-2 text-fg-muted`,children:e.kind===`pr-link`?(0,G.jsx)(Hr,{className:`size-4`}):(0,G.jsx)(Zr,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,G.jsx)(`div`,{className:`mt-0.5 truncate text-sm text-fg-muted`,children:t})]}),(0,G.jsx)(Er,{className:`mt-1 size-4 shrink-0 text-fg-subtle group-hover:text-accent-300`})]}):(0,G.jsx)(pc,{className:`h-[min(40vh,360px)] rounded-xl border border-line bg-canvas/60`,children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words p-4 font-mono text-xs leading-6 text-fg`,children:JSON.stringify(e.data,null,2)})})}function lx({data:e}){let t=t=>typeof e[t]==`string`?e[t]:void 0,n=t(`description`),r=t(`base`),i=t(`sourceBranch`),a=t(`workItem`);return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`This is the pull request Coro will open once you approve. Use “Review code changes” to see the diff.`}),i||a?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[i?(0,G.jsxs)(vg,{variant:`neutral`,className:`font-mono`,children:[i,r?(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[` → `,r]}):null]}):null,a?(0,G.jsx)(vg,{variant:`neutral`,children:a}):null]}):null,n?(0,G.jsx)(pc,{className:`h-[min(40vh,360px)] rounded-xl border border-line bg-canvas/40`,children:(0,G.jsx)(`div`,{className:`prose-coro space-y-2 p-4 text-sm leading-6 text-fg`,dangerouslySetInnerHTML:{__html:Jb(n)}})}):(0,G.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:`No PR description was provided.`})]})}function ux({jobId:e,artifact:t,editing:n,disabled:r,onStartEdit:i,onCancelEdit:a,onSaved:o,onOpenFullScreen:s}){let[c,l]=(0,x.useState)(null),[u,d]=(0,x.useState)(``),[f,p]=(0,x.useState)(!0),[m,h]=(0,x.useState)(null),[g,_]=(0,x.useState)(!1),[v,y]=(0,x.useState)(null),[b,S]=(0,x.useState)(!1),C=(0,x.useRef)(``),w=tx(t),T=rx(t);(0,x.useEffect)(()=>{let n=!1,r=`${t.id}:${t.editedAt??``}`;return C.current=r,p(!0),h(null),Zb(e,t.id).then(e=>{n||C.current!==r||(l(e),d(e),p(!1))}).catch(e=>{n||C.current!==r||(h(e instanceof Error?e.message:String(e)),p(!1))}),()=>{n=!0}},[e,t.id,t.editedAt]);let E=(0,x.useCallback)(async()=>{if(c!=null)try{await navigator.clipboard.writeText(c),S(!0),window.setTimeout(()=>S(!1),1500)}catch{}},[c]),D=(0,x.useCallback)(()=>{if(c==null)return;let e=(t.data.path??`${t.kind}.txt`).split(`/`).pop()??`${t.id}.txt`,n=new Blob([c],{type:`text/plain;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},[c,t.data,t.id,t.kind]),O=(0,x.useCallback)(async()=>{if(c!=null){_(!0),y(null);try{await Qb(e,t.id,u),l(u),o()}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}},[e,t.id,u,c,o]),k=(0,x.useCallback)(()=>{d(c??``),y(null),a()},[c,a]),A=(0,x.useCallback)(()=>{$b(e,t.id),l(null),p(!0),h(null),Zb(e,t.id).then(e=>{l(e),d(e),p(!1)}).catch(e=>{h(e instanceof Error?e.message:String(e)),p(!1)})},[e,t.id]),j=n&&u!==c,M=`h-[min(60vh,640px)]`;return(0,G.jsxs)(`div`,{className:`space-y-3 px-4 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsx)(sx,{artifact:t}),(0,G.jsx)(dx,{editing:n,editable:T,dirty:j,saving:g,disabled:r||f||!!m,copied:b,onCopy:E,onDownload:D,onOpenFullScreen:s,onStartEdit:i,onCancelEdit:k,onSave:O,onRevert:A})]}),f?(0,G.jsx)(`div`,{className:W(`flex items-center justify-center rounded-xl border border-line bg-canvas/40 text-sm text-fg-subtle`,M),children:(0,G.jsx)(`span`,{className:`animate-pulse`,children:`Loading artifact…`})}):m?(0,G.jsx)(gg,{title:`Could not load artifact`,message:m}):n?(0,G.jsx)(hx,{draft:u,onChange:d,disabled:g,heightClass:M,saveError:v}):w?(0,G.jsx)(px,{content:c??``,heightClass:M}):(0,G.jsx)(mx,{content:c??``,heightClass:M})]})}function dx({editing:e,editable:t,dirty:n,saving:r,disabled:i,copied:a,onCopy:o,onDownload:s,onOpenFullScreen:c,onStartEdit:l,onCancelEdit:u,onSave:d,onRevert:f}){return(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,children:e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`primary`,onClick:d,disabled:r||!n,children:[(0,G.jsx)(vi,{}),r?`Saving…`:`Save edits`]}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`ghost`,onClick:u,disabled:r,children:[(0,G.jsx)(Pi,{}),`Cancel edit`]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(fx,{tooltip:a?`Copied!`:`Copy contents`,onClick:o,disabled:i,children:(0,G.jsx)(Sr,{})}),(0,G.jsx)(fx,{tooltip:`Download`,onClick:s,disabled:i,children:(0,G.jsx)(wr,{})}),(0,G.jsx)(fx,{tooltip:`Re-fetch from disk`,onClick:f,disabled:i,children:(0,G.jsx)(gi,{})}),(0,G.jsx)(fx,{tooltip:`Open full screen`,onClick:c,disabled:i,children:(0,G.jsx)(ei,{})}),t?(0,G.jsx)(fx,{tooltip:`Edit this artifact`,onClick:l,disabled:i,children:(0,G.jsx)(ci,{})}):(0,G.jsx)(fx,{tooltip:`This file type is not editable from the dashboard`,onClick:()=>{},disabled:!0,children:(0,G.jsx)(ci,{})})]})})}function fx({children:e,tooltip:t,onClick:n,disabled:r}){return(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:W(`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors`,`hover:bg-overlay hover:text-fg disabled:pointer-events-none disabled:opacity-50`,`[&_svg]:size-4`),children:e})}),(0,G.jsx)(xv,{children:t})]})}function px({content:e,heightClass:t}){return(0,G.jsxs)(Bb,{defaultValue:`rendered`,children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Hb,{value:`rendered`,children:`Rendered`}),(0,G.jsx)(Hb,{value:`source`,children:`Source`})]}),(0,G.jsx)(Ub,{value:`rendered`,className:W(`rounded-xl border border-line bg-canvas/40`),children:(0,G.jsx)(pc,{className:t,children:(0,G.jsx)(`div`,{className:`prose-coro space-y-3 p-4 text-sm leading-6 text-fg`,dangerouslySetInnerHTML:{__html:Jb(e)}})})}),(0,G.jsx)(Ub,{value:`source`,className:W(`rounded-xl border border-line bg-canvas/60`),children:(0,G.jsx)(pc,{className:t,children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words p-4 font-mono text-xs leading-6 text-fg`,children:e})})})]})}function mx({content:e,heightClass:t}){let n=e.trim().startsWith(`{`)||e.trim().startsWith(`[`);return(0,G.jsx)(pc,{className:W(t,`rounded-xl border border-line bg-canvas/60`),children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words p-4 font-mono text-xs leading-6 text-fg`,children:n?gx(e):e})})}function hx({draft:e,onChange:t,disabled:n,heightClass:r,saveError:i}){return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(bb,{value:e,onChange:e=>t(e.target.value),disabled:n,spellCheck:!1,className:W(`w-full resize-none rounded-xl border border-line bg-canvas/70 font-mono text-xs leading-6`,r)}),i?(0,G.jsx)(`div`,{className:`text-xs text-danger-400`,children:i}):null]})}function gx(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function _x({kind:e}){return e===`pr-preview`?(0,G.jsx)(Ar,{className:`size-3.5`}):e===`pr-link`?(0,G.jsx)(Hr,{className:`size-3.5`}):e===`url`?(0,G.jsx)(Zr,{className:`size-3.5`}):e.endsWith(`-md`)||e===`analysis-contract`?(0,G.jsx)(Ir,{className:`size-3.5`}):(0,G.jsx)(jr,{className:`size-3.5`})}function vx({jobId:e,artifact:t,onClose:n}){let[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(null),s=tx(t);(0,x.useEffect)(()=>{let n=!1;return i(null),o(null),Zb(e,t.id).then(e=>{n||i(e)}).catch(e=>{n||o(e instanceof Error?e.message:String(e))}),()=>{n=!0}},[e,t.id,t.editedAt]);let c=t.data.path;return(0,G.jsx)(c_,{open:!0,onOpenChange:e=>{e||n()},children:(0,G.jsxs)(d_,{children:[(0,G.jsxs)(f_,{children:[(0,G.jsx)(p_,{children:t.title}),(0,G.jsxs)(`div`,{className:`space-y-1 text-sm text-fg-muted`,children:[c?(0,G.jsx)(`div`,{className:`font-mono text-xs text-fg-subtle`,children:c}):null,(0,G.jsxs)(`div`,{children:[`Posted `,Oy(t.createdAt),t.editedAt?(0,G.jsxs)(`span`,{className:`ml-2 text-warning-300`,children:[`· Edited `,Oy(t.editedAt)]}):null]})]})]}),(0,G.jsx)(h_,{children:a?(0,G.jsx)(gg,{title:`Could not load artifact`,message:a}):r?s?(0,G.jsxs)(Bb,{defaultValue:`rendered`,className:`space-y-3`,children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Hb,{value:`rendered`,children:`Rendered`}),(0,G.jsx)(Hb,{value:`source`,children:`Source`})]}),(0,G.jsx)(Ub,{value:`rendered`,className:`rounded-2xl border border-line bg-canvas/40`,children:(0,G.jsx)(pc,{className:`h-[70vh]`,children:(0,G.jsx)(`div`,{className:`prose-coro space-y-3 p-5 text-sm leading-6 text-fg`,dangerouslySetInnerHTML:{__html:Jb(r)}})})}),(0,G.jsx)(Ub,{value:`source`,className:`rounded-2xl border border-line bg-canvas/60`,children:(0,G.jsx)(pc,{className:`h-[70vh]`,children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-fg`,children:r})})})]}):(0,G.jsx)(pc,{className:`h-[70vh] rounded-2xl border border-line bg-canvas/60`,children:(0,G.jsx)(`div`,{className:`p-5`,children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-6 text-fg`,children:r})})}):(0,G.jsx)(`div`,{className:`animate-pulse text-sm text-fg-subtle`,children:`Loading artifact content…`})})]})})}var yx=`Approved. Please continue to the next phase.`;function bx({job:e,onSend:t,onCancel:n,onViewChanges:r}){let[i,a]=(0,x.useState)(``),[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(null);if(e.status!==`awaiting-developer-input`)return null;let u=e.workflowPhases?.find(t=>t.name===e.phase);if(u&&u.agent===null)return null;let d=(e.artifacts??[]).filter(t=>t.phase===e.phase),f=d.length>0,p=xx(e.awaitingEvent),m=!e.awaitingNextPhase,h=f&&!m,g=async e=>{s(!0),l(null);try{await t(e),a(``)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}},_=async()=>{if(n){s(!0),l(null);try{await n()}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}};return(0,G.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-warning-500/25 bg-warning-500/8 p-5`,children:[h?(0,G.jsx)(ix,{jobId:e.id,artifacts:d,phaseLabel:e.phase,sending:o,onApprove:()=>void g(yx),onRequestChanges:e=>void g(e),onCancel:()=>void _(),onViewChanges:r}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl border border-warning-500/25 bg-warning-500/10 text-warning-400`,children:(0,G.jsx)(ti,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[15px] font-semibold text-fg`,children:m?`Agent paused for your input`:`Approval needed to continue`}),(0,G.jsx)(`div`,{className:`mt-0.5 text-sm text-fg-muted`,children:m?(0,G.jsxs)(G.Fragment,{children:[`Mid-phase in `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:e.phase}),p?(0,G.jsxs)(G.Fragment,{children:[` — `,(0,G.jsx)(`span`,{className:`italic`,children:p})]}):null]}):(0,G.jsxs)(G.Fragment,{children:[`After phase `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:e.phase}),e.awaitingNextPhase?(0,G.jsxs)(G.Fragment,{children:[` → next: `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:e.awaitingNextPhase})]}):null]})})]})]}),m?null:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsxs)(Y,{type:`button`,onClick:()=>void g(yx),disabled:o,variant:`success`,size:`sm`,children:[(0,G.jsx)(fr,{}),o?`Sending…`:`Approve & continue`]}),(0,G.jsx)(`span`,{className:`text-sm text-fg-muted`,children:`or send the agent back with changes below`})]}),(0,G.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&g(i.trim())},className:`space-y-3`,children:[(0,G.jsx)(bb,{rows:4,value:i,onChange:e=>a(e.target.value),placeholder:m?`Answer the agent or provide the missing detail it asked for…`:`Request changes, clarify the plan, or send additional guidance…`,disabled:o,className:`border-warning-500/20 focus-visible:ring-warning-500/40`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c?(0,G.jsx)(`span`,{className:`text-sm text-danger-400`,children:c}):(0,G.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`The agent will do the work and re-park for approval.`}),(0,G.jsx)(Y,{type:`submit`,disabled:o||!i.trim(),variant:`secondary`,size:`sm`,children:o?`Sending…`:`Send message`})]})]})]}),h&&c?(0,G.jsx)(`div`,{className:`text-sm text-danger-400`,children:c}):null]})}function xx(e){if(!e)return null;if(e.startsWith(`developer-input:`)){let t=e.slice(16).trim();return t.startsWith(`approval after `)?null:t||null}return null}function Sx({jobId:e,artifact:t,variant:n=`default`}){let{kind:r,title:i,data:a}=t,o=n===`compact`;if(r===`pr-link`||r===`url`){let e=a.url;if(e)return(0,G.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:W(`group flex items-center gap-2.5 text-left transition-colors`,o?`px-3 py-2 hover:bg-overlay/50`:`items-start gap-3 rounded-2xl border border-line bg-overlay/40 px-4 py-3 hover:border-accent-500/30 hover:bg-overlay/60`),children:[(0,G.jsx)(Cx,{kind:r,compact:o}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:i}),(0,G.jsx)(vg,{variant:`neutral`,className:o?`shrink-0 text-[10px]`:void 0,children:r})]}),o?(0,G.jsx)(`div`,{className:`truncate font-mono text-[11px] text-fg-subtle`,children:e}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`mt-1 truncate text-sm text-fg-muted`,children:e}),(0,G.jsxs)(`div`,{className:`mt-1.5 text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:[`Posted `,Oy(t.createdAt)]})]})]}),(0,G.jsx)(Er,{className:W(`size-4 shrink-0 text-fg-subtle group-hover:text-accent-300`,!o&&`mt-1`)})]})}return typeof a.path==`string`&&a.path.trim()?(0,G.jsx)(Tx,{jobId:e,artifact:t,compact:o}):(0,G.jsx)(Ox,{artifact:t,compact:o})}function Cx({kind:e,compact:t=!1}){return(0,G.jsx)(`div`,{className:W(`shrink-0 rounded-md border border-line bg-overlay text-fg-muted`,t?`p-1.5 [&_svg]:size-3.5`:`rounded-lg p-2`),children:wx(e)})}function wx(e){return e===`pr-link`?(0,G.jsx)(Hr,{className:`size-4`}):e===`url`?(0,G.jsx)(Zr,{className:`size-4`}):e.endsWith(`-md`)||e===`analysis-contract`?(0,G.jsx)(Ir,{className:`size-4`}):(0,G.jsx)(jr,{className:`size-4`})}function Tx({jobId:e,artifact:t,compact:n=!1}){let[r,i]=(0,x.useState)(!1),a=t.data.path;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:W(`group flex w-full items-center gap-2.5 text-left transition-colors`,n?`px-3 py-2 hover:bg-overlay/50`:`items-start gap-3 rounded-2xl border border-line bg-overlay/40 px-4 py-3 hover:border-accent-500/30 hover:bg-overlay/60`),children:[(0,G.jsx)(Cx,{kind:t.kind,compact:n}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:t.title}),(0,G.jsx)(vg,{variant:`neutral`,className:n?`shrink-0 text-[10px]`:void 0,children:t.kind}),t.editedAt?(0,G.jsx)(`span`,{className:`shrink-0 rounded-full bg-warning-500/15 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-warning-300`,children:`Edited`}):null]}),n?(0,G.jsx)(`div`,{className:`truncate font-mono text-[11px] text-fg-subtle`,children:a}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`mt-1 truncate font-mono text-xs text-fg-subtle`,children:a}),(0,G.jsxs)(`div`,{className:`mt-1.5 text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:[`Posted `,Oy(t.createdAt),t.editedAt?` · Edited ${Oy(t.editedAt)}`:``]})]})]}),(0,G.jsx)(Or,{className:W(`size-4 shrink-0 text-fg-subtle group-hover:text-accent-300`,!n&&`mt-1`)})]}),r?(0,G.jsx)(Ex,{jobId:e,artifact:t,onClose:()=>i(!1)}):null]})}function Ex({jobId:e,artifact:t,onClose:n}){let[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(``),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(null),[h,g]=(0,x.useState)(!1),[_,v]=(0,x.useState)(t.editedAt),y=tx(t),b=rx(t);(0,x.useEffect)(()=>{let n=!1;return i(null),o(``),f(null),Zb(e,t.id).then(e=>{n||(i(e),o(e))}).catch(e=>{n||f(e instanceof Error?e.message:String(e))}),()=>{n=!0}},[e,t.id,_]),(0,x.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!s&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,s]);let S=(0,x.useCallback)(async()=>{if(r!=null)try{await navigator.clipboard.writeText(r),g(!0),window.setTimeout(()=>g(!1),1500)}catch{}},[r]),C=(0,x.useCallback)(()=>{if(r==null)return;let e=(t.data.path??`${t.kind}.txt`).split(`/`).pop()??`${t.id}.txt`,n=new Blob([r],{type:`text/plain;charset=utf-8`}),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)},[r,t.data,t.id,t.kind]),w=(0,x.useCallback)(async()=>{if(r!=null){u(!0),m(null);try{let n=await Qb(e,t.id,a);i(a),v(n.editedAt),c(!1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1)}}},[e,t.id,a,r]),T=(0,x.useCallback)(()=>{$b(e,t.id),i(null),o(``),f(null),Zb(e,t.id).then(e=>{i(e),o(e)}).catch(e=>{f(e instanceof Error?e.message:String(e))})},[e,t.id]),E=s&&a!==r,D=t.data.path;return(0,G.jsx)(vv,{delayDuration:250,children:(0,G.jsx)(c_,{open:!0,onOpenChange:e=>{!e&&!s&&n()},children:(0,G.jsxs)(d_,{children:[(0,G.jsxs)(f_,{children:[(0,G.jsx)(p_,{children:t.title}),(0,G.jsxs)(`div`,{className:`space-y-1 text-sm text-fg-muted`,children:[(0,G.jsx)(`div`,{className:`font-mono text-xs text-fg-subtle`,children:D}),(0,G.jsxs)(`div`,{children:[`Posted `,Oy(t.createdAt),_?(0,G.jsxs)(`span`,{className:`ml-2 text-warning-300`,children:[`· Edited `,Oy(_)]}):null]})]})]}),(0,G.jsxs)(h_,{children:[(0,G.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`primary`,onClick:w,disabled:l||!E,children:[(0,G.jsx)(vi,{}),l?`Saving…`:`Save edits`]}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{o(r??``),m(null),c(!1)},disabled:l,children:[(0,G.jsx)(Pi,{}),`Cancel edit`]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Dx,{tooltip:h?`Copied!`:`Copy contents`,onClick:S,disabled:!r,children:(0,G.jsx)(Sr,{})}),(0,G.jsx)(Dx,{tooltip:`Download`,onClick:C,disabled:!r,children:(0,G.jsx)(wr,{})}),(0,G.jsx)(Dx,{tooltip:`Re-fetch from disk`,onClick:T,disabled:!r,children:(0,G.jsx)(gi,{})}),b?(0,G.jsx)(Dx,{tooltip:`Edit this artifact`,onClick:()=>c(!0),disabled:!r,children:(0,G.jsx)(ci,{})}):(0,G.jsx)(Dx,{tooltip:`This file type is not editable from the dashboard`,disabled:!0,children:(0,G.jsx)(ci,{})})]})}),p?(0,G.jsx)(`div`,{className:`text-xs text-danger-400`,children:p}):null]}),d?(0,G.jsx)(gg,{title:`Could not load artifact`,message:d}):r?s?(0,G.jsx)(`div`,{className:`space-y-2`,children:(0,G.jsx)(bb,{value:a,onChange:e=>o(e.target.value),disabled:l,spellCheck:!1,className:`h-[60vh] w-full resize-none rounded-2xl border border-line bg-canvas/70 font-mono text-xs leading-6`})}):y?(0,G.jsxs)(Bb,{defaultValue:`rendered`,className:`space-y-3`,children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Hb,{value:`rendered`,children:`Rendered`}),(0,G.jsx)(Hb,{value:`source`,children:`Source`})]}),(0,G.jsx)(Ub,{value:`rendered`,className:`rounded-2xl border border-line bg-canvas/40`,children:(0,G.jsx)(pc,{className:`h-[60vh]`,children:(0,G.jsx)(`div`,{className:`prose-coro space-y-3 p-5 text-sm leading-6 text-fg`,dangerouslySetInnerHTML:{__html:Jb(r)}})})}),(0,G.jsx)(Ub,{value:`source`,className:`rounded-2xl border border-line bg-canvas/60`,children:(0,G.jsx)(pc,{className:`h-[60vh]`,children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-fg`,children:r})})})]}):(0,G.jsx)(pc,{className:`h-[60vh] rounded-2xl border border-line bg-canvas/60`,children:(0,G.jsx)(`div`,{className:`p-5`,children:(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-6 text-fg`,children:r})})}):(0,G.jsx)(`div`,{className:`animate-pulse text-sm text-fg-subtle`,children:`Loading artifact content…`})]})]})})})}function Dx({children:e,tooltip:t,onClick:n,disabled:r}){return(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:W(`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors`,`hover:bg-overlay hover:text-fg disabled:pointer-events-none disabled:opacity-50`,`[&_svg]:size-4`),children:e})}),(0,G.jsx)(xv,{children:t})]})}function Ox({artifact:e,compact:t=!1}){let[n,r]=(0,x.useState)(!1);return(0,G.jsxs)(`div`,{className:W(`overflow-hidden`,t?`bg-transparent`:`rounded-2xl border border-line bg-overlay/40`),children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),className:W(`flex w-full items-center justify-between gap-3 text-left transition-colors`,t?`px-3 py-2 hover:bg-overlay/50`:`px-4 py-3 hover:bg-overlay/60`),children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,G.jsx)(Cx,{kind:e.kind,compact:t}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:e.kind})]})]}),(0,G.jsx)(lr,{className:W(`size-4 shrink-0 text-fg-subtle transition-transform`,n&&`rotate-180`)})]}),n?(0,G.jsx)(`pre`,{className:W(`overflow-auto border-t border-line bg-canvas/60 font-mono text-xs text-fg whitespace-pre-wrap break-words`,t?`max-h-48 px-3 py-2`:`max-h-80 p-4`),children:JSON.stringify(e.data,null,2)}):null]})}function kx({jobId:e,artifacts:t,phaseName:n}){let[r,i]=(0,x.useState)(!1),a=t.length,o=a===0?`No artifacts yet`:`${a} artifact${a===1?``:`s`}`;return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-line bg-canvas/20`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),"aria-expanded":r,className:`flex w-full items-center justify-between gap-3 px-3 py-2.5 text-left transition-colors hover:bg-overlay/50`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:`Phase artifacts`}),(0,G.jsxs)(`div`,{className:`truncate text-[13px] text-fg-muted`,children:[o,a>0&&!r?(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[` `,`· `,t.map(e=>e.title).join(`, `)]}):null]})]}),(0,G.jsx)(lr,{className:W(`size-4 shrink-0 text-fg-subtle transition-transform`,r&&`rotate-180`)})]}),r?(0,G.jsx)(`div`,{className:`border-t border-line`,children:a===0?(0,G.jsxs)(`div`,{className:`px-3 py-2.5 text-[13px] text-fg-subtle`,children:[`No artifacts have been posted for `,(0,G.jsx)(`span`,{className:`font-mono`,children:n}),` yet.`]}):(0,G.jsx)(`div`,{className:`max-h-[min(280px,40vh)] divide-y divide-line overflow-y-auto`,children:t.map(t=>(0,G.jsx)(Sx,{jobId:e,artifact:t,variant:`compact`},t.id))})}):null]})}function Ax({value:e,className:t,indicatorClassName:n}){return(0,G.jsx)(`div`,{className:W(`relative h-1.5 overflow-hidden rounded-full bg-overlay`,t),children:(0,G.jsx)(`div`,{className:W(`h-full rounded-full bg-accent-400 transition-[width]`,n),style:{width:`${Math.max(0,Math.min(100,e))}%`}})})}function jx({checked:e,onCheckedChange:t,disabled:n=!1,ariaLabel:r,size:i=`md`,className:a}){let o=()=>{n||t(!e)},s=i===`sm`?{track:`h-4 w-7`,thumb:`size-3`,translate:`translate-x-3`}:{track:`h-5 w-9`,thumb:`size-4`,translate:`translate-x-4`};return(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":r,disabled:n,onClick:o,className:W(`relative inline-flex shrink-0 items-center rounded-full transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60`,`disabled:cursor-not-allowed disabled:opacity-50`,s.track,e?`bg-accent-500`:`bg-overlay ring-1 ring-line-strong`,a),children:(0,G.jsx)(`span`,{className:W(`inline-block transform rounded-full bg-white shadow transition-transform`,s.thumb,e?s.translate:`translate-x-0.5`)})})}function Mx(e){return e.summary?.status??e.status}function Nx(e){return e===`failed`||e===`escalated`}function Px({status:e,rateLimitInfo:t}){let n=ko(e),r=Fx(e===`awaiting-rate-limit`?t?.resumeAt:void 0);return(0,G.jsxs)(vg,{variant:`neutral`,className:zo(n.tone),children:[(0,G.jsx)(`span`,{className:W(`size-1.5 rounded-full`,Bo(n.tone),n.pulse&&`animate-pulse-dot`)}),n.label,r?(0,G.jsx)(`span`,{className:`ml-1 font-mono tabular-nums text-[10px] opacity-80`,children:r}):null]})}function Fx(e){let[t,n]=(0,x.useState)(()=>Date.now());if((0,x.useEffect)(()=>{if(e==null)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e==null)return null;let r=Math.max(0,Math.ceil((e-t)/1e3)),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60,s=e=>e.toString().padStart(2,`0`);return`${s(i)}:${s(a)}:${s(o)}`}function Ix(e){return Ty(e)}function Lx(e){let t={inputTokens:0,outputTokens:0,cacheReadInputTokens:0,cacheCreationInputTokens:0,totalCostUsd:0,totalDurationMs:0};for(let n of e){let e=n.summary?.tokenUsage;e&&(t.inputTokens+=e.inputTokens??0,t.outputTokens+=e.outputTokens??0,t.cacheReadInputTokens+=e.cacheReadInputTokens??0,t.cacheCreationInputTokens+=e.cacheCreationInputTokens??0,t.totalCostUsd+=e.totalCostUsd??0),n.startedAt&&n.completedAt&&(t.totalDurationMs+=new Date(n.completedAt).getTime()-new Date(n.startedAt).getTime())}return t}function Rx({children:e}){let t=(0,x.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.name,n);let n=[],r=new Set,i=0;for(;t.size>0&&i<50;){let e=[];for(let n of t.values())n.dependsOn.every(e=>r.has(e)||!t.has(e))&&e.push(n);if(e.length===0){n.push(Array.from(t.values()));break}for(let n of e)r.add(n.name),t.delete(n.name);n.push(e),i++}return n},[e]);return t.length===0?null:(0,G.jsx)(`div`,{className:`flex flex-col gap-3 overflow-x-auto`,children:t.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`w-10 shrink-0 text-[10px] uppercase tracking-[0.16em] text-fg-subtle`,children:[`L`,t+1]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>{let t=Mx(e);return(0,G.jsxs)(`div`,{className:W(`flex items-center gap-2 rounded-lg border px-2.5 py-1.5 text-xs`,zo(ko(t).tone)),children:[(0,G.jsx)(Px,{status:t,rateLimitInfo:e.summary?.rateLimitInfo}),(0,G.jsx)(`span`,{className:`font-medium`,children:e.name}),e.dependsOn.length>0?(0,G.jsxs)(`span`,{className:`text-[10px] text-fg-subtle`,children:[`← `,e.dependsOn.join(`, `)]}):null]},e.name)})})]},t))})}function zx({jobId:e,child:t,onMutated:n}){let[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(``),d=(0,x.useRef)(null),f=async(r,a,s)=>{i(s),o(null);try{await q(`/jobs/${e}/children/${encodeURIComponent(t.name)}/${r}`,J(a??{},{method:`POST`})),c(!1),u(``),n()}catch(e){o(e instanceof Error?e.message:`Action failed`)}finally{i(null)}},p=Nx(Mx(t));if(t.status===`complete`||t.status===`skipped`||t.status===`cancelled`)return null;let m=()=>{if(!s){c(!0),queueMicrotask(()=>d.current?.focus());return}f(`resume`,l.trim()?{note:l.trim()}:void 0,`resume`)},h=()=>{window.confirm(`Start a fresh job for "${t.name}"?\n\nThis DROPS the existing child Job (transcript, partial work, any open PR will be orphaned) and dispatches a brand-new Job from the original spec. Use "Resume" instead unless the current Job is genuinely unrecoverable.`)&&f(`rerun`,void 0,`rerun`)};return(0,G.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t.status===`ready`?(0,G.jsxs)(Y,{onClick:()=>void f(`start`,void 0,`start`),disabled:r!==null,size:`sm`,className:`h-7 px-2 text-[11px]`,title:`Start this child now. Dependencies are satisfied; this bypasses the parallelism cap and any halt-on-failure pause.`,children:[(0,G.jsx)(ui,{className:`size-3.5`}),r===`start`?`…`:`Start`]}):null,p?(0,G.jsxs)(Y,{onClick:m,disabled:r!==null,size:`sm`,className:`h-7 px-2 text-[11px]`,title:s?`Resume the existing child Job — optionally with the note as developer guidance`:`Resume the existing child Job at its last phase`,children:[(0,G.jsx)(ui,{className:`size-3.5`}),r===`resume`?`…`:`Resume`]}):null,(0,G.jsxs)(Y,{onClick:()=>void f(`abandon`,void 0,`abandon`),disabled:r!==null,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-[11px] text-danger-400 hover:bg-danger-500/10 hover:text-danger-400`,title:p?`Abandon — mark as not-needed, unblocks dependents`:`Abandon this child — unblocks dependents, descopes the work`,children:[(0,G.jsx)(ki,{className:`size-3.5`}),r===`abandon`?`…`:`Abandon`]}),p?(0,G.jsxs)(Jh,{children:[(0,G.jsx)(Yh,{asChild:!0,children:(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:`h-7 px-1.5 text-[11px]`,disabled:r!==null,"aria-label":`More actions`,title:`More actions`,children:(0,G.jsx)(Tr,{className:`size-3.5`})})}),(0,G.jsx)(Zh,{align:`end`,className:`min-w-56`,children:(0,G.jsxs)(Qh,{onSelect:e=>{e.preventDefault(),h()},className:`text-danger-400 focus:text-danger-400`,children:[(0,G.jsx)(gi,{className:`size-3.5`}),`Start fresh job…`]})})]}):(0,G.jsx)(`span`,{"aria-hidden":!0,className:`inline-block h-7 w-7`})]}),s&&p?(0,G.jsxs)(`div`,{className:`flex w-full max-w-md flex-col items-end gap-1.5`,children:[(0,G.jsx)(`textarea`,{ref:d,value:l,onChange:e=>u(e.target.value),placeholder:`Optional: tell the agent what changed (becomes developer-input for the next turn)`,rows:3,className:`w-full resize-y rounded-md border border-line bg-overlay/60 px-2 py-1.5 text-[11px] text-fg placeholder:text-fg-subtle focus:border-accent focus:outline-none`,disabled:r!==null}),(0,G.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,G.jsx)(Y,{onClick:()=>{c(!1),u(``)},variant:`ghost`,size:`sm`,className:`h-7 px-2 text-[11px]`,disabled:r!==null,children:`Cancel`})})]}):null,a?(0,G.jsx)(`span`,{className:`text-[11px] text-danger-400`,title:a,children:a}):null]})}function Bx({label:e,value:t,detail:n}){return(0,G.jsxs)(`div`,{className:`rounded-xl border border-line bg-overlay/40 p-3`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:e}),(0,G.jsx)(`div`,{className:`mt-1 text-lg font-semibold text-fg`,children:t}),n?(0,G.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:n}):null]})}function Vx({job:e,children:t,onMutated:n}){let[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(null),s=(0,x.useMemo)(()=>t.filter(e=>Nx(Mx(e))),[t]);if(e.status!==`awaiting-developer-input`||s.length===0)return null;let c=async t=>{i(t),o(null);let r=[];for(let n of s)try{await q(`/jobs/${e.id}/children/${encodeURIComponent(n.name)}/${t}`,J({},{method:`POST`}))}catch(e){r.push(`${n.name}: ${e instanceof Error?e.message:`failed`}`)}i(null),r.length>0&&o(`${r.length} action(s) failed — ${r.slice(0,2).join(`; `)}${r.length>2?`…`:``}`),n()},l=s.length===1?By.singularLower:By.pluralLower,u=`${s.length} failed ${l}`;return(0,G.jsxs)(`div`,{className:`rounded-xl border border-warning-500/40 bg-warning-500/10 p-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(Mi,{className:`mt-0.5 size-4 shrink-0 text-warning-400`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Campaign halted on failure`}),(0,G.jsxs)(`p`,{className:`text-[12px] leading-snug text-fg-muted`,children:[u,` — Resume retries each at its last phase, Abandon descopes them. Use per-row buttons below if you want to add a note or mix actions.`]}),(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-fg-subtle`,children:s.map(e=>e.name).join(`, `)})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsxs)(Y,{onClick:()=>void c(`resume`),disabled:r!==null,size:`sm`,className:`h-7 px-2 text-[11px]`,title:`Resume all ${u} at their last phase`,children:[(0,G.jsx)(ui,{className:`size-3.5`}),r===`resume`?`…`:`Resume all (${s.length})`]}),(0,G.jsxs)(Y,{onClick:()=>void c(`abandon`),disabled:r!==null,variant:`outline`,size:`sm`,className:`h-7 px-2 text-[11px] text-danger-400 hover:bg-danger-500/10 hover:text-danger-400`,title:`Abandon all ${u} — descope and let the campaign continue`,children:[(0,G.jsx)(ki,{className:`size-3.5`}),r===`abandon`?`…`:`Abandon all (${s.length})`]})]})]}),a?(0,G.jsx)(`div`,{className:`mt-2 text-[11px] text-danger-400`,children:a}):null]})}function Hx({job:e,onMutated:t}){let n=e.campaignChildren??[],r=Lx(n),i=n.reduce((e,t)=>(e[t.status]=(e[t.status]??0)+1,e),{pending:0,ready:0,dispatched:0,complete:0,failed:0,escalated:0,skipped:0,cancelled:0}),a=(0,x.useMemo)(()=>{let e={};for(let t of n){let n=Mx(t);e[n]=(e[n]??0)+1}return e},[n]),[o,s]=(0,x.useState)(!0),c=(0,x.useMemo)(()=>o?n.filter(e=>e.status!==`cancelled`):n,[n,o]);if(n.length===0)return(0,G.jsx)(lg,{children:(0,G.jsxs)(ug,{children:[(0,G.jsx)(dg,{children:By.plural}),(0,G.jsx)(fg,{children:`No ${By.pluralLower} registered yet. The campaign planner is still defining the execution graph.`})]})});let l=n.reduce((e,t)=>e+(t.summary?.prMappings.length??0),0),u=n.length-i.cancelled,d=i.complete+i.skipped,f=u===0?0:d/u*100;return(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`gap-4 border-b border-line pb-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(dg,{children:By.plural}),(0,G.jsx)(fg,{children:`Dependency-aware execution view with per-${By.singularLower} controls.`})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:Object.keys(a).filter(e=>a[e]>0).map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px]`,children:[(0,G.jsx)(Px,{status:e}),(0,G.jsx)(`span`,{className:`tabular-nums text-fg-muted`,children:a[e]})]},e))})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-4`,children:[(0,G.jsx)(Bx,{label:`Progress`,value:`${d}/${u}`,detail:`${Math.round(f)}% complete`}),(0,G.jsx)(Bx,{label:`Tokens`,value:Ix(r.inputTokens+r.outputTokens),detail:`Across all ${By.pluralLower}`}),(0,G.jsx)(Bx,{label:`Cost`,value:Ey(r.totalCostUsd),detail:`Aggregate ${By.singularLower} spend`}),(0,G.jsx)(Bx,{label:`Pull requests`,value:l.toString(),detail:`Opened across ${By.pluralLower}`})]}),(0,G.jsx)(Ax,{value:f})]}),(0,G.jsxs)(pg,{className:`space-y-5 pt-5`,children:[(0,G.jsx)(Vx,{job:e,children:n,onMutated:t}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-[11px] font-medium uppercase tracking-[0.16em] text-fg-subtle`,children:[(0,G.jsx)(Yr,{className:`size-3.5`}),`Dependency graph`]}),(0,G.jsx)(Rx,{children:c})]}),i.cancelled>0?(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-2 text-[11px] text-fg-muted`,children:[(0,G.jsxs)(`span`,{children:[`Hide cancelled (`,i.cancelled,`)`]}),(0,G.jsx)(jx,{size:`sm`,checked:o,onCheckedChange:s,ariaLabel:`Hide cancelled children`})]}):null,(0,G.jsx)(`div`,{className:`overflow-x-auto rounded-2xl border border-line`,children:(0,G.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,G.jsx)(`thead`,{className:`bg-overlay/40 text-fg-subtle`,children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Name`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Status`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Phase`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Tracker`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Job`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`PRs`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Tokens`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Actions`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line`,children:c.map(n=>{let r=n.summary?.phase??`—`,i=n.summary?.prMappings.length??0,a=(n.summary?.tokenUsage?.inputTokens??0)+(n.summary?.tokenUsage?.outputTokens??0);return(0,G.jsxs)(`tr`,{className:`transition-colors hover:bg-overlay/40`,children:[(0,G.jsxs)(`td`,{className:`px-3 py-2.5`,children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:n.name}),n.description?(0,G.jsx)(`div`,{className:`line-clamp-2 max-w-[280px] text-[11px] text-fg-subtle`,children:n.description}):null]}),(0,G.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,G.jsx)(Px,{status:Mx(n),rateLimitInfo:n.summary?.rateLimitInfo})}),(0,G.jsx)(`td`,{className:`px-3 py-2.5 text-fg-muted`,children:r}),(0,G.jsx)(`td`,{className:`px-3 py-2.5`,children:n.trackerRef?(0,G.jsx)(`a`,{href:n.trackerRef.url,target:`_blank`,rel:`noreferrer`,className:`text-accent-300 hover:text-accent-400`,children:n.trackerRef.key}):(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`—`})}),(0,G.jsx)(`td`,{className:`px-3 py-2.5`,children:n.jobId?(0,G.jsxs)(Dn,{to:`/jobs/${n.jobId}`,className:`font-mono text-[11px] text-accent-300 hover:text-accent-400`,title:`Open ${By.singularLower} detail`,children:[n.jobId.slice(0,18),`…`]}):(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`—`})}),(0,G.jsx)(`td`,{className:`px-3 py-2.5 text-right tabular-nums text-fg-muted`,children:i}),(0,G.jsx)(`td`,{className:`px-3 py-2.5 text-right tabular-nums text-fg-muted`,children:a>0?Ix(a):`—`}),(0,G.jsx)(`td`,{className:`px-3 py-2.5 text-right`,children:(0,G.jsx)(zx,{jobId:e.id,child:n,onMutated:t})})]},n.name)})})]})}),(0,G.jsxs)(`div`,{className:`grid gap-3 border-t border-line pt-4 text-sm sm:grid-cols-4`,children:[(0,G.jsx)(Ux,{label:`Tokens in / out`,value:`${Ix(r.inputTokens)} / ${Ix(r.outputTokens)}`}),(0,G.jsx)(Ux,{label:`Cache read`,value:Ix(r.cacheReadInputTokens)}),(0,G.jsx)(Ux,{label:`Latest update`,value:Cy(e.updatedAt)}),(0,G.jsx)(Ux,{label:`Running ${By.pluralLower}`,value:(i.dispatched+i.ready).toString()})]})]})]})}function Ux({label:e,value:t}){return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:e}),(0,G.jsx)(`div`,{className:`mt-1 font-medium text-fg`,children:t})]})}function Wx({status:e,lastHeartbeat:t}){let[n,r]=(0,x.useState)(0);(0,x.useEffect)(()=>{let e=setInterval(()=>{r(Math.floor((Date.now()-t)/1e3))},1e3);return()=>clearInterval(e)},[t]);let i=Ao(e);return(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border px-2.5 py-1 text-[11px] ${zo(i.tone)}`,children:[(0,G.jsx)(`span`,{className:`size-1.5 rounded-full ${Bo(i.tone)} ${i.pulse?`animate-pulse-dot`:``}`}),(0,G.jsx)(`span`,{className:`font-medium uppercase tracking-[0.16em]`,children:i.label}),e===`connected`&&n>0?(0,G.jsxs)(`span`,{className:`text-fg-muted normal-case tracking-normal`,children:[`· `,Cy(new Date(Date.now()-n*1e3))]}):null]})}var Gx=[{value:`tenant`,label:`Team`},{value:`repo`,label:`Repo`},{value:`evaluator`,label:`Let evaluator decide`}],Kx=[{value:`all`,label:`All`},{value:`pending`,label:`Pending`},{value:`approved`,label:`Approved`},{value:`rejected`,label:`Rejected`}];function qx(e){return e.status??`pending`}function Jx(e){return e.userLayer??e.suggestedLayer}function Yx(e){return e.userLayer===`tenant`?`tenant`:e.userLayer===`repo`?`repo`:`evaluator`}function Xx(e){return e===`approved`?`success`:e===`rejected`?`danger`:`warning`}function Zx({jobId:e,insights:t,onChanged:n}){let[r,i]=(0,x.useState)(t),[a,o]=(0,x.useState)(`all`),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(null),[d,f]=(0,x.useState)({summary:``,detail:``,suggestion:``}),[p,m]=(0,x.useState)(null),[h,g]=(0,x.useState)(null);async function _(){try{i((await q(`/jobs/${encodeURIComponent(e)}/insights`)).insights??[]),m(null)}catch(e){m(e instanceof K?`${e.status}: ${e.message}`:e.message)}}(0,x.useEffect)(()=>{_()},[e]),(0,x.useEffect)(()=>{t.length>r.length&&_()},[t.length]);let v=(0,x.useMemo)(()=>{let e={pending:0,approved:0,rejected:0};for(let t of r)e[qx(t)]++;return e},[r]),y=(0,x.useMemo)(()=>a===`all`?r:r.filter(e=>qx(e)===a),[r,a]),b=(0,x.useMemo)(()=>{let e=new Map,t=0;for(let n of r)qx(n)!==`rejected`&&(t++,e.set(n.id??`${n.phase}:${n.summary}`,t));return e},[r]);async function S(t,r){g(t),m(null);try{let a=await q(`/jobs/${encodeURIComponent(e)}/insights/${encodeURIComponent(t)}`,J(r,{method:`PATCH`}));a?.insight?i(e=>e.map(e=>e.id===t?a.insight:e)):await _(),n()}catch(e){m(e instanceof K?`${e.status}: ${e.message}`:e.message)}finally{g(null)}}function C(e){u(e.id??null),f({summary:e.editedSummary??e.summary,detail:e.editedDetail??e.detail,suggestion:e.editedSuggestion??e.suggestion??``})}async function w(e){if(!e.id)return;let t={};t.editedSummary=d.summary===e.summary?null:d.summary,t.editedDetail=d.detail===e.detail?null:d.detail;let n=e.suggestion??``;t.editedSuggestion=d.suggestion===n?null:d.suggestion||null,await S(e.id,t),u(null)}function T(){u(null)}async function E(e,t){e.id&&await S(e.id,{userLayer:t===`evaluator`?null:t})}async function D(e,t){e.id&&await S(e.id,{status:t})}return(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`gap-3 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(dg,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Xr,{className:`size-4 text-amber-500`,"aria-hidden":`true`}),`Insights`,(0,G.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`(`,v.pending,` pending · `,v.approved,` approved · `,v.rejected,` rejected)`]})]}),(0,G.jsx)(fg,{children:`Findings recorded by agents during the run. Approve the ones you want the evaluator to ship as memory PRs and tag whether they belong in your team or repo intelligence layer. Rejected entries are kept for audit but skipped by the evaluator.`})]}),(0,G.jsx)(ab,{options:Kx,value:a,onChange:o,size:`sm`,ariaLabel:`Filter insights by status`})]}),(0,G.jsxs)(pg,{className:`space-y-3 pt-5`,children:[p?(0,G.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:p}):null,y.length===0?(0,G.jsx)(`div`,{className:`rounded-md border border-dashed border-line px-4 py-8 text-center text-sm text-muted-foreground`,children:r.length===0?`No insights have been recorded yet. Agents call add_insight during the run to surface findings here.`:`No insights match the "${a}" filter.`}):null,y.map(e=>{let t=qx(e),n=e.id??`${e.phase}:${e.summary}`,r=s===n,i=l===n,a=h===e.id,o=Jx(e),u=e.editedSummary||e.editedDetail||e.editedSuggestion,p=e.editedSummary??e.summary,m=e.editedDetail??e.detail,g=e.editedSuggestion??e.suggestion,_=b.get(n);return(0,G.jsxs)(`div`,{className:W(`rounded-md border border-line bg-overlay/40 transition-opacity`,t===`rejected`&&`opacity-60`,a&&`opacity-50`),children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3 p-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>c(r?null:n),className:`mt-0.5 text-muted-foreground hover:text-foreground`,"aria-label":r?`Collapse`:`Expand`,children:r?(0,G.jsx)(lr,{className:`size-4`}):(0,G.jsx)(ur,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[_==null?null:(0,G.jsxs)(vg,{variant:`neutral`,className:`font-mono normal-case tracking-normal`,title:e.id?`Insight ${e.id}`:void 0,children:[`#`,_]}),(0,G.jsx)(vg,{variant:Xx(t),className:`capitalize`,children:t}),(0,G.jsx)(vg,{variant:`neutral`,className:`font-mono`,children:e.phase}),(0,G.jsx)(vg,{variant:`accent`,children:e.category}),o?(0,G.jsxs)(vg,{variant:`neutral`,children:[e.userLayer?`layer: `:`suggested: `,o===`tenant`?`team`:`repo`]}):null,e.sourceChildName?(0,G.jsxs)(vg,{variant:`neutral`,children:[`from `,e.sourceChildName]}):null,u?(0,G.jsx)(vg,{variant:`warning`,children:`edited`}):null]}),(0,G.jsx)(`p`,{className:`text-sm font-medium leading-snug`,children:p}),e.editedAt||e.decidedAt?(0,G.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[e.decidedAt?(0,G.jsxs)(G.Fragment,{children:[`decided `,Cy(e.decidedAt),e.decidedBy?` by ${e.decidedBy}`:``]}):null,e.decidedAt&&e.editedAt?` · `:``,e.editedAt?(0,G.jsxs)(G.Fragment,{children:[`edited `,Cy(e.editedAt),e.editedBy?` by ${e.editedBy}`:``]}):null]}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[t===`approved`?null:(0,G.jsxs)(Y,{size:`sm`,variant:`success`,disabled:a,onClick:()=>void D(e,`approved`),children:[(0,G.jsx)(cr,{className:`size-3.5`}),` Approve`]}),t===`rejected`?null:(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,disabled:a,onClick:()=>void D(e,`rejected`),children:[(0,G.jsx)(Pi,{className:`size-3.5`}),` Reject`]}),t===`pending`?null:(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,disabled:a,onClick:()=>void D(e,`pending`),title:`Reset to pending`,children:(0,G.jsx)(gi,{className:`size-3.5`})})]})]}),r?(0,G.jsxs)(`div`,{className:`space-y-4 border-t border-line/60 px-3 py-4`,children:[i?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Summary`}),(0,G.jsx)(bb,{rows:2,value:d.summary,onChange:e=>f({...d,summary:e.target.value})})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Detail`}),(0,G.jsx)(bb,{rows:6,value:d.detail,onChange:e=>f({...d,detail:e.target.value})})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Suggestion (optional)`}),(0,G.jsx)(bb,{rows:3,value:d.suggestion,onChange:e=>f({...d,suggestion:e.target.value})})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,onClick:T,children:`Cancel`}),(0,G.jsx)(Y,{size:`sm`,variant:`primary`,onClick:()=>void w(e),children:`Save edits`})]})]}):(0,G.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Detail`}),(0,G.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap leading-relaxed`,children:m})]}),g?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Suggestion`}),(0,G.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap leading-relaxed`,children:g})]}):null,u?(0,G.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer`,children:`Show original (pre-edit)`}),(0,G.jsxs)(`div`,{className:`mt-2 space-y-2 rounded bg-muted/30 p-2`,children:[(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`Summary:`}),` `,e.summary]}),(0,G.jsxs)(`p`,{className:`whitespace-pre-wrap`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`Detail:`}),` `,e.detail]}),e.suggestion?(0,G.jsxs)(`p`,{className:`whitespace-pre-wrap`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`Suggestion:`}),` `,e.suggestion]}):null]})]}):null]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-line/40 pt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Target layer:`}),(0,G.jsx)(ab,{options:Gx,value:Yx(e),onChange:t=>void E(e,t),size:`sm`,ariaLabel:`Target intelligence layer`})]}),i?null:(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,onClick:()=>C(e),children:[(0,G.jsx)(li,{className:`size-3.5`}),` Edit`]})]})]}):null]},n)})]})]})}async function Qx(e,t={}){let n=new URLSearchParams;t.base&&n.set(`base`,t.base),t.head&&n.set(`head`,t.head);let r=n.toString();return q(`/jobs/${e}/diff${r?`?${r}`:``}`)}var $x=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function eS(e){return e===`/dev/null`?e:e.startsWith(`a/`)||e.startsWith(`b/`)?e.slice(2):e}function tS(e){if(!e.trim())return[];let t=e.split(`
61
+ `),n=[],r=null,i=null,a=0,o=0,s=()=>{if(r){let e=r.status===`deleted`?r.oldPath:r.newPath||r.oldPath;r.path=e,n.push(r)}};for(let e of t){if(e.startsWith(`diff --git`)){s(),i=null;let t=e.match(/^diff --git (.+) (.+)$/),n=t?eS(t[1]):``,a=t?eS(t[2]):``;r={oldPath:n,newPath:a,path:a||n,status:`modified`,binary:!1,hunks:[],additions:0,deletions:0};continue}if(!r)continue;if(e.startsWith(`new file mode`)){r.status=`added`;continue}if(e.startsWith(`deleted file mode`)){r.status=`deleted`;continue}if(e.startsWith(`rename from `)){r.status=`renamed`,r.oldPath=e.slice(12);continue}if(e.startsWith(`rename to `)){r.status=`renamed`,r.newPath=e.slice(10);continue}if(e.startsWith(`Binary files`)||e.startsWith(`GIT binary patch`)){r.binary=!0;continue}if(e.startsWith(`--- `)){let t=eS(e.slice(4));t!==`/dev/null`&&(r.oldPath=t);continue}if(e.startsWith(`+++ `)){let t=eS(e.slice(4));t!==`/dev/null`&&(r.newPath=t);continue}let t=e.match($x);if(t){a=parseInt(t[1],10),o=parseInt(t[3],10),i={header:e,lines:[]},r.hunks.push(i);continue}if(i&&!e.startsWith(`\\`))if(e.startsWith(`+`))i.lines.push({type:`add`,text:e.slice(1),oldNo:null,newNo:o}),r.additions+=1,o+=1;else if(e.startsWith(`-`))i.lines.push({type:`del`,text:e.slice(1),oldNo:a,newNo:null}),r.deletions+=1,a+=1;else{let t=e.startsWith(` `)?e.slice(1):e;i.lines.push({type:`context`,text:t,oldNo:a,newNo:o}),a+=1,o+=1}}return s(),n}async function nS(){return q(`/system/editors`)}async function rS(e,t){return q(`/jobs/${e}/open`,J(t,{method:`POST`}))}var iS={code:`M23.15 2.587L18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z`,cursor:`M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23`,codium:`M11.583.54a1.467 1.467 0 0 0-.441 2.032c2.426 3.758 2.999 6.592 2.75 9.075-1.004 4.756-3.187 5.721-5.094 5.721-1.863 0-1.364-3.065.036-3.962.836-.522 1.906-.861 2.728-.861.814 0 1.474-.658 1.474-1.47 0-.812-.66-1.47-1.474-1.47-.96 0-1.901.202-2.78.545.18-.847.246-1.762.014-2.735-.352-1.477-1.367-2.889-3.128-4.257a1.476 1.476 0 0 0-2.069.256c-.5.64-.384 1.564.259 2.063 1.435 1.114 1.908 1.939 2.07 2.618.162.679.032 1.407-.293 2.408-.416 1.349-.9 2.553-1.11 3.708-.105.568-.114 1.187-.14 1.68-1.034-1.006-1.438-2.336-1.438-4.279 0-.811-.66-1.47-1.474-1.47-.814.001-1.473.659-1.473 1.47 0 2.654.776 5.179 2.855 6.863 1.883 1.793 6.67 1.13 6.67 4.01 0 .812 1.19 1.208 2.004 1.208.834 0 1.885-.558 1.885-1.208 0-3.267 3.443-5.253 9.11-5.244A1.472 1.472 0 0 0 24 15.773 1.472 1.472 0 0 0 22.53 14.3c-.388 0-.765.013-1.138.035.634-1.49.915-3.13.857-4.903a1.473 1.473 0 0 0-1.522-1.42 1.472 1.472 0 0 0-1.425 1.517c.076 2.32-.01 4.393-1.74 5.485-.49.31-1.062.58-1.604.58.42-1.145.738-2.353.869-3.655.083-.83.091-1.818-.003-2.585-.148-1.188-.325-2.535.126-3.55.405-.874 1.313-1.24 2.645-1.24.814 0 1.473-.659 1.473-1.47 0-.811-.659-1.47-1.473-1.47-1.98 0-3.481 1.042-4.332 2.3-.445-.95-.987-1.929-1.642-2.943a1.474 1.474 0 0 0-2.037-.44z`,windsurf:`M23.55 5.067c-1.2038-.002-2.1806.973-2.1806 2.1765v4.8676c0 .972-.8035 1.7594-1.7597 1.7594-.568 0-1.1352-.286-1.4718-.7659l-4.9713-7.1003c-.4125-.5896-1.0837-.941-1.8103-.941-1.1334 0-2.1533.9635-2.1533 2.153v4.8957c0 .972-.7969 1.7594-1.7596 1.7594-.57 0-1.1363-.286-1.4728-.7658L.4076 5.1598C.2822 4.9798 0 5.0688 0 5.2882v4.2452c0 .2147.0656.4228.1884.599l5.4748 7.8183c.3234.462.8006.8052 1.3509.9298 1.3771.313 2.6446-.747 2.6446-2.0977v-4.893c0-.972.7875-1.7593 1.7596-1.7593h.003a1.798 1.798 0 0 1 1.4718.7658l4.9723 7.0994c.4135.5905 1.05.941 1.8093.941 1.1587 0 2.1515-.9645 2.1515-2.153v-4.8948c0-.972.7875-1.7594 1.7596-1.7594h.194a.22.22 0 0 0 .2204-.2202v-4.622a.22.22 0 0 0-.2203-.2203Z`};iS[`code-insiders`]=iS.code;function aS({id:e,className:t}){let n=iS[e];return n?(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,className:t,fill:`currentColor`,"aria-hidden":`true`,role:`img`,children:(0,G.jsx)(`path`,{d:n})}):(0,G.jsx)(xr,{className:t})}function oS({files:e,truncated:t,showFileMap:n=!0}){let[r,i]=(0,x.useState)(()=>e.map(()=>!1));(0,x.useEffect)(()=>{i(e.map(()=>!1))},[e]);let a=(0,x.useRef)([]),o=(0,x.useCallback)(t=>i(e.map(()=>t)),[e]),s=(0,x.useCallback)(e=>i(t=>t.map((t,n)=>n===e?!t:t)),[]),c=(0,x.useCallback)(e=>{i(t=>t.map((t,n)=>n===e?!0:t)),requestAnimationFrame(()=>a.current[e]?.scrollIntoView({block:`nearest`,behavior:`smooth`}))},[]);if(e.length===0)return null;let l=r.length>0&&r.every(Boolean),u=r.every(e=>!e);return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[n&&e.length>1?(0,G.jsx)(sS,{files:e,onJump:c,onExpandAll:()=>o(!0),onCollapseAll:()=>o(!1),allOpen:l,allClosed:u}):null,e.map((e,t)=>(0,G.jsx)(cS,{file:e,open:r[t]??!1,onToggle:()=>s(t),cardRef:e=>{a.current[t]=e}},t)),t?(0,G.jsx)(`p`,{className:`rounded-lg border border-warning-500/20 bg-warning-500/5 px-3 py-2 text-xs text-warning-300`,children:`This diff is very large and was truncated. Open the full PR on the SCM to review every line.`}):null]})}function sS({files:e,onJump:t,onExpandAll:n,onCollapseAll:r,allOpen:i,allClosed:a}){return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-line bg-canvas/40`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-line px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,G.jsx)(Qr,{className:`size-3.5 text-fg-subtle`}),e.length,` files changed`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:n,disabled:i,className:`text-fg-subtle transition-colors hover:text-fg disabled:opacity-40`,children:`Expand all`}),(0,G.jsx)(`span`,{className:`text-line`,children:`·`}),(0,G.jsx)(`button`,{type:`button`,onClick:r,disabled:a,className:`text-fg-subtle transition-colors hover:text-fg disabled:opacity-40`,children:`Collapse all`})]})]}),(0,G.jsx)(`ul`,{className:`max-h-56 overflow-y-auto py-1`,children:e.map((e,n)=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n),className:`flex w-full items-center gap-2 px-3 py-1 text-left transition-colors hover:bg-overlay/40`,children:[(0,G.jsx)(uS,{status:e.status}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-fg-muted`,children:e.status===`renamed`&&e.oldPath!==e.newPath?`${e.oldPath} → ${e.newPath}`:e.path}),e.additions>0?(0,G.jsxs)(`span`,{className:`font-mono text-xs text-success-400`,children:[`+`,e.additions]}):null,e.deletions>0?(0,G.jsxs)(`span`,{className:`font-mono text-xs text-danger-400`,children:[`−`,e.deletions]}):null]})},n))})]})}function cS({file:e,open:t,onToggle:n,cardRef:r}){return(0,G.jsxs)(`div`,{ref:r,className:`scroll-mt-4 overflow-hidden rounded-xl border border-line bg-canvas/40`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:n,className:`flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-overlay/40`,children:[t?(0,G.jsx)(lr,{className:`size-3.5 shrink-0 text-fg-subtle`}):(0,G.jsx)(ur,{className:`size-3.5 shrink-0 text-fg-subtle`}),(0,G.jsx)(uS,{status:e.status}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-fg`,children:e.status===`renamed`&&e.oldPath!==e.newPath?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[e.oldPath,` → `]}),e.newPath]}):e.path}),e.additions>0?(0,G.jsxs)(`span`,{className:`font-mono text-xs text-success-400`,children:[`+`,e.additions]}):null,e.deletions>0?(0,G.jsxs)(`span`,{className:`font-mono text-xs text-danger-400`,children:[`−`,e.deletions]}):null]}),t?e.binary?(0,G.jsx)(`div`,{className:`border-t border-line px-3 py-3 text-xs text-fg-subtle`,children:`Binary file not shown.`}):e.hunks.length===0?(0,G.jsx)(`div`,{className:`border-t border-line px-3 py-3 text-xs text-fg-subtle`,children:`No textual changes.`}):(0,G.jsx)(`div`,{className:`overflow-x-auto border-t border-line`,children:(0,G.jsx)(`table`,{className:`w-full border-collapse font-mono text-xs leading-5`,children:(0,G.jsx)(`tbody`,{children:e.hunks.map((e,t)=>(0,G.jsx)(lS,{hunk:e},t))})})}):null]})}function lS({hunk:e}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`tr`,{className:`bg-overlay/40 text-fg-subtle`,children:[(0,G.jsx)(`td`,{className:`select-none px-2 text-right align-top`}),(0,G.jsx)(`td`,{className:`select-none px-2 text-right align-top`}),(0,G.jsx)(`td`,{className:`whitespace-pre-wrap break-words px-3 py-0.5`,children:e.header})]}),e.lines.map((e,t)=>(0,G.jsxs)(`tr`,{className:W(e.type===`add`&&`bg-success-500/10`,e.type===`del`&&`bg-danger-500/10`),children:[(0,G.jsx)(`td`,{className:`w-[1%] select-none whitespace-nowrap px-2 text-right align-top text-fg-subtle/70`,children:e.oldNo??``}),(0,G.jsx)(`td`,{className:`w-[1%] select-none whitespace-nowrap px-2 text-right align-top text-fg-subtle/70`,children:e.newNo??``}),(0,G.jsxs)(`td`,{className:W(`whitespace-pre-wrap break-words px-3 align-top`,e.type===`add`&&`text-success-400`,e.type===`del`&&`text-danger-400`,e.type===`context`&&`text-fg-muted`),children:[(0,G.jsx)(`span`,{className:`select-none text-fg-subtle/60`,children:e.type===`add`?`+`:e.type===`del`?`−`:` `}),e.text]})]},t))]})}function uS({status:e}){let t=`size-3.5 shrink-0`;switch(e){case`added`:return(0,G.jsx)(Nr,{className:W(t,`text-success-400`)});case`deleted`:return(0,G.jsx)(Mr,{className:W(t,`text-danger-400`)});case`renamed`:return(0,G.jsx)(Fr,{className:W(t,`text-accent-300`)});default:return(0,G.jsx)(Ar,{className:W(t,`text-fg-muted`)})}}var dS=4e3;function fS(e){let t=[],n=new Map;for(let r of e.artifacts??[]){if(r.kind!==`pr-preview`)continue;let e=r.data,i=t=>typeof e[t]==`string`?e[t]:void 0,a={title:i(`title`),description:i(`description`),base:i(`base`),sourceBranch:i(`sourceBranch`),workItem:i(`workItem`),createdAt:r.createdAt},o=a.sourceBranch;o&&n.has(o)?t[n.get(o)]=a:(o&&n.set(o,t.length),t.push(a))}return t.sort((e,t)=>t.createdAt.localeCompare(e.createdAt))}function pS(e,t){if(t.title)for(let n of e.artifacts??[]){if(n.kind!==`pr-link`)continue;let e=n.data;if(e.title!==t.title)continue;let r=typeof e.url==`string`?e.url:void 0,i=e.prId,a=typeof i==`number`?i:typeof i==`string`&&i.trim()?Number(i):void 0;return{url:r,prId:Number.isFinite(a)?a:void 0}}}function mS(e,t){let n=e.workItem,r=n?t.workItems?.find(e=>e.name===n):void 0,i=pS(t,e),a=i?.url,o=i?.prId==null?void 0:t.prMappings?.find(e=>e.prId===i.prId);return r?.status===`escalated`?{label:`Escalated`,variant:`danger`,prUrl:a}:o?.mergedAt?{label:`Merged`,variant:`success`,prUrl:a}:o&&!o.mergedAt?{label:`PR open`,variant:`accent`,prUrl:a}:r?.status===`complete`?{label:`Merged`,variant:`success`,prUrl:a}:n&&n===t.currentWorkItem?{label:`In progress`,variant:`warning`,prUrl:a}:{label:`Awaiting review`,variant:`neutral`,prUrl:a}}function hS(e){let t=e.params;for(let e of[`targetBranch`,`baseBranch`,`defaultBranch`]){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim()}return`main`}function gS(e){if(e.length===0)return{base:`main`};let t=new Set(e.map(e=>e.sourceBranch).filter(Boolean)),n=e.map(e=>e.base).filter(e=>!!e),r=e[0].base??`main`;for(let n of e)if(n.base&&!t.has(n.base)){r=n.base;break}let i;for(let t of e)t.sourceBranch&&!n.includes(t.sourceBranch)&&(i=t.sourceBranch);return{base:r,head:i}}function _S(e,t){let n=e.currentWorkItem,r=n?t.filter(e=>e.workItem===n):t,i=r.filter(t=>{let{label:n}=mS(t,e);return n===`PR open`||n===`In progress`||n===`Awaiting review`}),a=i.length>0?i:r;if(a.length===0)return{base:hS(e)};let{base:o,head:s}=gS(a);return{base:o||hS(e),head:s}}function vS(e){return fS(e).some(t=>{let{label:n}=mS(t,e);return n!==`Merged`&&n!==`Escalated`})}function yS(e,t){let{base:n,head:r,live:i,enabled:a=!0}=t,[o,s]=(0,x.useState)(null),[c,l]=(0,x.useState)(!0),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(!1),m=(0,x.useRef)(!1),h=(0,x.useCallback)(async t=>{if(!m.current){m.current=!0,t&&p(!0);try{s(await Qx(e,{base:n,head:r})),d(null)}catch(e){d(e instanceof Error?e.message:`Failed to load changes`)}finally{m.current=!1,l(!1),t&&p(!1)}}},[e,n,r]);return(0,x.useEffect)(()=>{if(!a||(h(!1),!i))return;let e=window.setInterval(()=>void h(!1),dS);return()=>window.clearInterval(e)},[h,i,a]),{diff:o,loading:c,error:u,refresh:()=>h(!0),refreshing:f}}function bS({job:e,live:t}){let n=(0,x.useMemo)(()=>fS(e),[e]),r=(0,x.useMemo)(()=>_S(e,n),[e,n]),i=t||n.length===0;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(xS,{jobId:e.id}),i?(0,G.jsx)(SS,{jobId:e.id,live:t,workItem:e.currentWorkItem,diffOpts:r,stackedPrCount:n.filter(t=>t.workItem===e.currentWorkItem&&mS(t,e).label===`PR open`).length}):null,n.length>0?(0,G.jsx)(CS,{jobId:e.id,job:e,live:t,previews:n}):null]})}function xS({jobId:e}){let[t,n]=(0,x.useState)(null),[r,i]=(0,x.useState)(!1),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(null);(0,x.useEffect)(()=>{let e=!0;return nS().then(t=>{e&&(i(t.mode===`local`),n(t.editors))}).catch(()=>{e&&n([])}),()=>{e=!1}},[]);let l=(0,x.useCallback)(async(t,n)=>{o(n??t),c(null);try{await rS(e,{target:t,editor:n})}catch(e){c(e instanceof Error?e.message:`Could not open`)}finally{o(null)}},[e]);return r?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(t??[]).length>0?(0,G.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:`Open in`}):null,(t??[]).map(e=>(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`icon`,className:`size-8`,onClick:()=>l(`editor`,e.id),disabled:a!==null,title:`Open in ${e.name}`,"aria-label":`Open in ${e.name}`,children:(0,G.jsx)(aS,{id:e.id})},e.id)),(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8`,onClick:()=>l(`folder`),disabled:a!==null,title:`Reveal folder in file manager`,"aria-label":`Reveal folder in file manager`,children:(0,G.jsx)(Rr,{})}),s?(0,G.jsx)(`span`,{className:`text-xs text-danger-400`,children:s}):null]}):null}function SS({jobId:e,live:t,workItem:n,diffOpts:r,stackedPrCount:i}){let{diff:a,loading:o,error:s,refresh:c,refreshing:l}=yS(e,{live:t,...r}),u=(0,x.useMemo)(()=>tS(a?.patch??``),[a?.patch]);return(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Working now`}),n?(0,G.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[`Work item: `,(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),i>1?` — cumulative diff across ${i} open PRs (stack tip vs ${r.base??`main`}).`:r.head?` — changes on ${r.head} vs ${r.base??`main`}.`:` — live changes in the repo checkout.`]}):(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:`Live changes in the cloned repository.`})]}),(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`gap-3 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsx)(fg,{className:`m-0`,children:(0,G.jsx)(ES,{diff:a})}),(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:c,disabled:l,children:[(0,G.jsx)(hi,{className:W(l&&`animate-spin`)}),`Refresh`]})]}),(0,G.jsx)(pg,{className:`pt-5`,children:o&&!a?(0,G.jsx)(`div`,{className:`animate-pulse text-sm text-fg-subtle`,children:`Loading changes…`}):s?(0,G.jsx)(gg,{title:`Could not load changes`,message:s}):!a||u.length===0?(0,G.jsx)(DS,{available:a?.available??!1}):(0,G.jsx)(oS,{files:u,truncated:a.truncated})})]})]})}function CS({jobId:e,job:t,live:n,previews:r}){return(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Pull requests`}),(0,G.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[r.length,` pull request`,r.length===1?``:`s`,` — expand to review each branch's changes (including stacked PRs).`]})]}),(0,G.jsx)(`div`,{className:`space-y-3`,children:r.map((r,i)=>(0,G.jsx)(wS,{jobId:e,live:n,preview:r,status:mS(r,t)},r.sourceBranch??`wi-${i}`))})]})}function wS({jobId:e,live:t,preview:n,status:r}){let[i,a]=(0,x.useState)(!1),{diff:o,loading:s,error:c,refresh:l,refreshing:u}=yS(e,{base:n.base,head:n.sourceBranch,live:t,enabled:i}),d=(0,x.useMemo)(()=>tS(o?.patch??``),[o?.patch]);return(0,G.jsxs)(lg,{className:`border-line`,children:[(0,G.jsx)(ug,{className:`gap-2 pb-3`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex w-full items-start gap-2 text-left`,children:[i?(0,G.jsx)(lr,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}):(0,G.jsx)(ur,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,G.jsx)(Hr,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(dg,{className:`truncate text-sm`,children:n.title||n.workItem||`Pull request`}),(0,G.jsx)(TS,{status:r})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2 text-xs`,children:[n.workItem?(0,G.jsx)(vg,{variant:`neutral`,children:n.workItem}):null,n.sourceBranch?(0,G.jsxs)(vg,{variant:`neutral`,className:`font-mono normal-case tracking-normal`,children:[n.sourceBranch,n.base?(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[` → `,n.base]}):null]}):null,r.prUrl?(0,G.jsxs)(`a`,{href:r.prUrl,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`inline-flex items-center gap-1 text-accent-300 hover:text-accent-200`,children:[`View PR`,(0,G.jsx)(Er,{className:`size-3`})]}):null,i?(0,G.jsx)(ES,{diff:o,compact:!0}):null]})]})]})}),i?(0,G.jsxs)(pg,{className:`space-y-4 border-t border-line pt-4`,children:[n.description?(0,G.jsx)(`div`,{className:`prose-coro space-y-2 text-sm leading-6 text-fg`,dangerouslySetInnerHTML:{__html:Jb(n.description)}}):null,r.label===`Merged`&&(!o||d.length===0)?(0,G.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:`This work item was merged. Expand showed no local diff — open the PR on the SCM for the final changes.`}):null,(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:l,disabled:u,children:[(0,G.jsx)(hi,{className:W(u&&`animate-spin`)}),`Refresh`]})}),s&&!o?(0,G.jsx)(`div`,{className:`animate-pulse text-sm text-fg-subtle`,children:`Loading changes…`}):c?(0,G.jsx)(gg,{title:`Could not load changes`,message:c}):!o||d.length===0?r.label===`Merged`?null:(0,G.jsx)(DS,{available:o?.available??!1}):(0,G.jsx)(oS,{files:d,truncated:o.truncated})]}):null]})}function TS({status:e}){return(0,G.jsx)(vg,{variant:e.variant,children:e.label})}function ES({diff:e,compact:t}){return!e||e.files.length===0?t?null:(0,G.jsx)(G.Fragment,{children:`Code the agent has written in the cloned repo, before any PR is opened.`}):(0,G.jsxs)(`span`,{className:W(t&&`text-fg-subtle`),children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e.stats.files}),` file`,e.stats.files===1?``:`s`,` changed`,e.stats.insertions>0?(0,G.jsxs)(`span`,{className:`ml-2 text-success-400`,children:[`+`,e.stats.insertions]}):null,e.stats.deletions>0?(0,G.jsxs)(`span`,{className:`ml-2 text-danger-400`,children:[`−`,e.stats.deletions]}):null,(0,G.jsxs)(`span`,{className:`ml-2 text-fg-subtle`,children:[`vs `,e.base]})]})}function DS({available:e}){return(0,G.jsx)(`div`,{className:`rounded-xl border border-dashed border-line bg-canvas/30 px-4 py-8 text-center text-sm text-fg-subtle`,children:e?`No changes yet. They will appear here as the agent edits files.`:`No repository checkout yet. Changes appear once the agent clones the repo and starts coding.`})}var OS=x.forwardRef(function({className:e,children:t,...n},r){return(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`select`,{ref:r,className:W(`flex h-11 w-full appearance-none rounded-xl border border-line-strong bg-overlay px-3.5 py-2.5 pr-10 text-sm text-fg shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60 disabled:cursor-not-allowed disabled:opacity-50`,e),...n,children:t}),(0,G.jsx)(lr,{"aria-hidden":!0,className:`pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`})]})});function kS({job:e,workflowPhases:t,refreshing:n,onRefresh:r,cancelling:i,cancelError:a,onCancel:o,pausing:s,pauseError:c,onPause:l,resuming:u,resumeError:d,resumePhase:f,clearSession:p,onResumePhaseChange:m,onClearSessionChange:h,onResume:g,interactiveOverride:_,onInteractiveChange:v}){let y=Po(e.status),b=Fo(e.status),S=Lo(e.status,e.awaitingEvent),C=_??e.interactive,[w,T]=(0,x.useState)(!1),[E,D]=(0,x.useState)(null);(0,x.useEffect)(()=>{_===void 0&&D(null)},[_]);async function O(t){T(!0),D(null),v(t);try{await q(`/jobs/${e.id}/interactive`,J({interactive:t},{method:`PATCH`}))}catch(e){D(e instanceof Error?e.message:`Failed to update interactive mode`),v(!t)}finally{T(!1)}}return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:W(`flex flex-wrap items-center gap-2 rounded-2xl border border-line bg-overlay/40 px-3 py-2`,`sm:gap-3 sm:px-4`),children:[(0,G.jsx)(AS,{label:`Controls`}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>void r(),disabled:n||i,children:[n?(0,G.jsx)($r,{className:`animate-spin`}):(0,G.jsx)(mi,{}),`Refresh`]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>void o(),disabled:!b||i||u,children:[i?(0,G.jsx)($r,{className:`animate-spin`}):(0,G.jsx)(ir,{}),i?`Cancelling…`:`Cancel`]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>void l(),disabled:!S||s||i||u,title:S?`Park the run at the next safe boundary so you can think and steer`:void 0,children:[s?(0,G.jsx)($r,{className:`animate-spin`}):(0,G.jsx)(oi,{}),s?`Pausing…`:`Pause`]}),(0,G.jsx)(MS,{job:e,workflowPhases:t,canResume:y,resuming:u,resumePhase:f,clearSession:p,onResumePhaseChange:m,onClearSessionChange:h,onResume:g}),(0,G.jsx)(jS,{}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,G.jsx)(jx,{checked:C,onCheckedChange:O,disabled:w,ariaLabel:`Toggle interactive mode`}),(0,G.jsxs)(`div`,{className:`flex flex-col leading-tight`,children:[(0,G.jsx)(`span`,{className:`text-[12px] font-medium text-fg`,children:C?`Interactive`:`Autonomous`}),(0,G.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:C?`Will park at checkpoints`:`Will run end-to-end`})]})]})]}),a||c||d||E?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[a?(0,G.jsx)(gg,{title:`Cancel failed`,message:a}):null,c?(0,G.jsx)(gg,{title:`Pause failed`,message:c}):null,d?(0,G.jsx)(gg,{title:`Resume failed`,message:d}):null,E?(0,G.jsx)(gg,{title:`Interactive toggle failed`,message:E}):null]}):null]})}function AS({label:e}){return(0,G.jsx)(`span`,{className:`hidden text-[11px] font-medium uppercase tracking-[0.16em] text-fg-subtle sm:inline`,children:e})}function jS(){return(0,G.jsx)(`span`,{className:`hidden h-6 w-px bg-line sm:block`,"aria-hidden":!0})}function MS({job:e,workflowPhases:t,canResume:n,resuming:r,resumePhase:i,clearSession:a,onResumePhaseChange:o,onClearSessionChange:s,onResume:c}){let[l,u]=(0,x.useState)(!1);return n?(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsxs)(Y,{size:`sm`,onClick:()=>void c(i||void 0,a),disabled:r,children:[r?(0,G.jsx)($r,{className:`animate-spin`}):(0,G.jsx)(ui,{}),r?`Resuming…`:`Resume`]}),(0,G.jsxs)(Jh,{open:l,onOpenChange:u,children:[(0,G.jsx)(Yh,{asChild:!0,children:(0,G.jsx)(Y,{size:`sm`,variant:`secondary`,"aria-label":`Resume options`,className:`px-2`,children:(0,G.jsx)(lr,{})})}),(0,G.jsx)(Zh,{align:`start`,className:`min-w-72 p-3`,children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-1.5 block text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:`Resume from phase`}),(0,G.jsxs)(OS,{value:i,onChange:e=>o(e.target.value),children:[(0,G.jsxs)(`option`,{value:``,children:[`Current phase (`,e.phase,`)`]}),t.map(t=>(0,G.jsxs)(`option`,{value:t.name,children:[t.name,t.name===e.phase?` (current)`:``]},t.name))]})]}),(0,G.jsxs)(`label`,{className:`flex items-start gap-2 text-[13px] text-fg-muted`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>s(e.target.checked),className:`mt-0.5`}),(0,G.jsxs)(`span`,{children:[`Start with a fresh session.`,(0,G.jsx)(`span`,{className:`block text-[11px] text-fg-subtle`,children:`Use when the current conversation history is no longer useful.`})]})]}),(0,G.jsx)(`div`,{className:`flex justify-end pt-1`,children:(0,G.jsx)(Y,{size:`sm`,onClick:()=>{u(!1),c(i||void 0,a)},disabled:r,children:r?`Resuming…`:`Resume with options`})})]})})]})]}):(0,G.jsx)(`span`,{className:`rounded-md border border-dashed border-line px-2.5 py-1 text-[12px] text-fg-subtle`,title:`This ${zy.singularLower} can't be resumed from its current state.`,children:`Not resumable`})}var NS={text:{textClass:`text-fg`,iconClass:`text-fg-subtle`,icon:ar},tool_use:{textClass:`text-fg`,iconClass:`text-accent-300`,icon:rr,label:`Tool`},tool_summary:{textClass:`text-fg-muted`,iconClass:`text-fg-subtle`,icon:Yr,label:`Summary`,dimmed:!0},thinking:{textClass:`text-fg-muted`,iconClass:`text-fg-subtle`,icon:yi,label:`Thinking`,dimmed:!0},tool_progress:{textClass:`text-fg-muted`,iconClass:`text-warning-400`,icon:$r,label:`Progress`,dimmed:!0},error:{textClass:`text-danger-400`,iconClass:`text-danger-400`,icon:Mi,label:`Error`},guardrail:{textClass:`text-warning-400`,iconClass:`text-warning-400`,icon:wi,label:`Guardrail`},warning:{textClass:`text-warning-400`,iconClass:`text-warning-400`,icon:Mi,label:`Warning`},result:{textClass:`text-success-400`,iconClass:`text-success-400`,icon:fr,label:`Result`},phase:{textClass:`text-accent-300`,iconClass:`text-accent-300`,icon:Vr,label:`Phase`},insight:{textClass:`text-accent-300`,iconClass:`text-accent-300`,icon:ar,label:`Insight`},session_reset:{textClass:`text-warning-400`,iconClass:`text-warning-400`,icon:mi,label:`Reset`},webhook:{textClass:`text-warning-400`,iconClass:`text-warning-400`,icon:Ni,label:`Webhook`},human:{textClass:`text-fg`,iconClass:`text-accent-300`,icon:ti,label:`Developer`},system:{textClass:`text-fg-subtle`,iconClass:`text-fg-subtle`,icon:xi,label:`System`,dimmed:!0}};function PS(e){let t=e.content;return e.lineType===`tool_progress`?t.replace(/^⏳\s*/,``):e.lineType===`system`&&t.startsWith(`[event:`)?t.replace(/^\[event:([^\]]+)\]\s*/,`$1: `):e.lineType===`tool_use`||e.lineType===`text`||e.lineType===`phase`?t:t.replace(/^\[[^\]]+\]\s*/,``)}function FS({lineType:e,className:t=``}){let n=NS[e],r=n.icon;return(0,G.jsx)(r,{className:W(`mt-0.5 size-3.5 shrink-0`,n.iconClass,n.dimmed&&`opacity-60`,e===`tool_progress`&&`animate-spin`,t),"aria-hidden":`true`})}function IS(e){if(!e)return``;try{return new Date(e).toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}catch{return``}}function LS({line:e}){let t=NS[e.lineType],n=PS(e);if(e.lineType===`phase`)return(0,G.jsxs)(`div`,{className:`my-2 flex items-center gap-3 py-1.5`,children:[(0,G.jsx)(`div`,{className:`h-px flex-1 bg-accent-500/20`}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-accent-500/25 bg-accent-500/10 px-3 py-0.5 text-[11px] font-semibold uppercase tracking-[0.16em] text-accent-300`,children:[(0,G.jsx)(FS,{lineType:e.lineType,className:`mt-0 size-3`}),n]}),(0,G.jsx)(`div`,{className:`h-px flex-1 bg-accent-500/20`})]});if(e.lineType===`error`||e.lineType===`warning`||e.lineType===`guardrail`)return(0,G.jsxs)(`div`,{className:W(`my-1 flex items-start gap-3 rounded-xl px-4 py-2.5`,e.lineType===`error`?`border border-danger-500/25 bg-danger-500/8`:`border border-warning-500/25 bg-warning-500/8`),children:[(0,G.jsx)(FS,{lineType:e.lineType}),(0,G.jsx)(`span`,{className:t.textClass,children:n})]});if(e.lineType===`result`)return(0,G.jsxs)(`div`,{className:`my-1 flex items-start gap-3 rounded-xl border border-success-500/25 bg-success-500/8 px-4 py-2.5`,children:[(0,G.jsx)(FS,{lineType:e.lineType}),(0,G.jsx)(`span`,{className:t.textClass,children:n})]});if(e.lineType===`human`)return(0,G.jsxs)(`div`,{className:`my-1 flex items-start gap-3 rounded-xl border border-accent-500/25 bg-accent-500/8 px-4 py-2.5`,children:[(0,G.jsx)(FS,{lineType:e.lineType}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mr-2 text-[11px] font-semibold uppercase tracking-[0.14em] text-accent-300`,children:`Developer`}),(0,G.jsx)(`span`,{className:`text-fg`,children:n})]})]});if(e.lineType===`tool_use`){let e=n.match(/^→ (\S+)(.*)/);if(e)return(0,G.jsxs)(`span`,{className:t.dimmed?`opacity-60`:``,children:[(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`→ `}),(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:e[1]}),(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:e[2]})]})}return(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(FS,{lineType:e.lineType}),(0,G.jsxs)(`span`,{className:W(t.textClass,t.dimmed&&`opacity-70`),children:[t.label?(0,G.jsx)(`span`,{className:`mr-2 text-[11px] font-semibold uppercase tracking-[0.14em] text-fg-subtle`,children:t.label}):null,n]})]})}function RS(e,t=`auto`){e&&e.scrollTo({top:e.scrollHeight,behavior:t})}function zS(e,t=64){let{scrollTop:n,scrollHeight:r,clientHeight:i}=e;return r-n-i<=t}var BS=[{value:`all`,label:`All`},{value:`main`,label:`Agent`},{value:`tools`,label:`Tools`}];function VS({lines:e,className:t=``}){let n=(0,x.useRef)(null),[r,i]=(0,x.useState)(!0),a=(0,x.useRef)(!0),[o,s]=(0,x.useState)(`all`),c=(0,x.useRef)(!1);(0,x.useEffect)(()=>{a.current=r},[r]);let l=()=>{let e=n.current;if(!e)return;if(c.current){c.current=!1;return}let t=zS(e);a.current=t,i(t)};(0,x.useEffect)(()=>{if(!r)return;let e=requestAnimationFrame(()=>{!a.current||!n.current||(c.current=!0,RS(n.current,`auto`))});return()=>{cancelAnimationFrame(e)}},[e,r,o]),(0,x.useEffect)(()=>{let e=n.current;if(!e||!r)return;let t=new ResizeObserver(()=>{!n.current||!a.current||(c.current=!0,RS(n.current,`auto`))});return t.observe(e),()=>{t.disconnect()}},[r]);let u=[`tool_use`,`tool_summary`,`tool_progress`,`thinking`,`system`],d=[`text`,`phase`,`error`,`guardrail`,`warning`,`result`,`insight`,`session_reset`,`webhook`,`human`],f=e.filter(e=>o===`all`?!0:o===`main`?d.includes(e.lineType):o===`tools`?u.includes(e.lineType):!0);return(0,G.jsxs)(`div`,{className:W(`flex flex-col overflow-hidden rounded-2xl border border-line bg-canvas/60`,t),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-line px-3 py-2.5`,children:[(0,G.jsx)(ab,{options:BS,value:o,onChange:s,size:`sm`,ariaLabel:`Filter log lines`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:[f.length,` / `,e.length,` lines`]}),r?null:(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{a.current=!0,i(!0),n.current&&(c.current=!0,RS(n.current,`smooth`))},children:[(0,G.jsx)(er,{}),`Follow`]})]})]}),(0,G.jsx)(`div`,{ref:n,onScroll:l,className:`min-h-[280px] max-h-[calc(100vh-320px)] flex-1 overflow-y-auto p-4 font-mono text-[12.5px] leading-relaxed`,children:f.length===0?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center text-sm text-fg-subtle`,children:`Waiting for log output…`}):f.map((e,t)=>(0,G.jsxs)(`div`,{className:W(`flex gap-3 animate-fade-in`,e.lineType===`phase`?``:`rounded-lg px-2 py-1 hover:bg-overlay/40`),children:[e.lineType===`phase`?null:(0,G.jsx)(`span`,{className:`shrink-0 select-none pt-0.5 text-[11px] tabular-nums text-fg-subtle/70`,children:IS(e.timestamp)}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1 break-words whitespace-pre-wrap`,children:(0,G.jsx)(LS,{line:e})})]},t))})]})}function HS(e,t){let n=e.findIndex(e=>e.name===t);if(n!==-1)return n;let r=t.toLowerCase();return e.findIndex(e=>e.name.toLowerCase()===r)}function US(e,t,n){let r=HS(t,n.phase),i=HS(t,e),a=(n.phaseUsage??[]).some(t=>t.phase===e);return i===-1?`pending`:i===r?n.status===`complete`?`complete`:Mo(n.status)?`awaiting-input`:`in-progress`:r!==-1&&i<r||a||n.status===`complete`?`complete`:`pending`}function WS(e,t){let n=`relative flex-1 min-w-[150px] rounded-xl border px-3.5 py-2.5 text-left transition-colors cursor-pointer`,r=t?`ring-2 ring-accent-400/60 ring-offset-2 ring-offset-canvas`:``;switch(e){case`complete`:return W(n,r,`border-success-500/25 bg-success-500/8 hover:border-success-500/40`);case`in-progress`:return W(n,r,`border-transparent bg-accent-500/10 hover:bg-accent-500/15 animate-border-travel`);case`awaiting-input`:return W(n,r,`border-warning-500/30 bg-warning-500/10 hover:border-warning-500/45 animate-pulse-slow`);default:return W(n,r,`border-line bg-overlay/40 hover:border-line-strong`)}}function GS({state:e}){switch(e){case`complete`:return(0,G.jsx)(cr,{className:`size-3.5 text-success-400`,strokeWidth:2.5});case`in-progress`:return(0,G.jsx)(`span`,{className:`size-1.5 rounded-full bg-accent-400 animate-pulse-dot`,"aria-hidden":!0});case`awaiting-input`:return(0,G.jsx)(Gr,{className:`size-3.5 text-warning-400`});default:return(0,G.jsx)(`span`,{className:`size-1.5 rounded-full bg-fg-subtle/60`,"aria-hidden":!0})}}function KS(e){switch(e){case`complete`:return`Complete`;case`in-progress`:return`Running`;case`awaiting-input`:return`Awaiting input`;case`pending`:return`Pending`}}function qS({job:e,phases:t,selectedPhase:n,onSelectPhase:r}){if(t.length===0)return(0,G.jsx)(`div`,{className:`px-2 py-3 text-sm italic text-fg-subtle`,children:`No workflow phases defined for this job.`});let i=new Map;for(let t of e.artifacts??[]){let e=i.get(t.phase)??[];e.push(t),i.set(t.phase,e)}let a=new Map;for(let t of e.phaseUsage??[])a.set(t.phase,(a.get(t.phase)??0)+1);return(0,G.jsx)(`div`,{className:`w-full overflow-x-auto py-1.5`,children:(0,G.jsx)(`div`,{className:`flex min-w-max items-stretch gap-2`,children:t.map((o,s)=>{let c=US(o.name,t,e),l=n===o.name,u=i.get(o.name)??[],d=a.get(o.name)??0;return(0,G.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(o.name),className:WS(c,l),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`flex size-4 items-center justify-center`,children:(0,G.jsx)(GS,{state:c})}),(0,G.jsx)(`span`,{className:`truncate text-[13px] font-medium text-fg`,children:o.name}),o.interactiveCheckpoint&&e.interactive?(0,G.jsx)(`span`,{title:`Interactive checkpoint — the job will park here for developer approval`,className:`inline-flex items-center rounded-full border border-warning-500/25 bg-warning-500/10 px-1 py-0.5 text-warning-400`,children:(0,G.jsx)(Ur,{className:`size-3`})}):null]}),(0,G.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.16em] text-fg-subtle`,children:KS(c)}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[d>1?(0,G.jsxs)(`span`,{title:`Phase ran ${d} times (loop-back)`,className:`inline-flex items-center gap-0.5 rounded-full border border-accent-500/25 bg-accent-500/10 px-1.5 py-0.5 text-[10px] text-accent-300`,children:[(0,G.jsx)(_i,{className:`size-2.5`}),d,`×`]}):null,u.length>0?(0,G.jsx)(`span`,{title:`${u.length} artifact${u.length===1?``:`s`}`,className:`rounded-full border border-line bg-overlay/60 px-1.5 py-0.5 text-[10px] text-fg-muted`,children:u.length}):null]})]})]}),s<t.length-1?(0,G.jsx)(`div`,{className:`flex shrink-0 items-center px-1 text-fg-subtle/60`,"aria-hidden":!0,children:(0,G.jsx)(ur,{className:`size-4`})}):null]},o.name)})})})}function JS(e){let t=[];for(let n of e.workItems??[]){let r=(e.phaseUsage??[]).filter(e=>e.workItem===n.name),i=[];for(let e of r)i.includes(e.phase)||i.push(e.phase);t.push({item:n,executions:r,distinctPhases:i,hasStarted:r.length>0})}return t}function YS(e){return e.status===`complete`?`Complete`:e.status===`in-progress`?`In progress`:e.status===`escalated`?`Escalated`:`Pending`}function XS(e){switch(e.status){case`complete`:return`bg-success-400`;case`in-progress`:return`bg-accent-400 animate-pulse-dot`;case`escalated`:return`bg-danger-400`;default:return`bg-fg-subtle/60`}}function ZS({phaseName:e,count:t,state:n,onClick:r}){return(0,G.jsxs)(`button`,{type:`button`,onClick:r,className:W(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] font-medium transition-colors cursor-pointer`,n===`in-progress`?`border-accent-500/35 bg-accent-500/10 text-fg hover:border-accent-500/55`:n===`complete`?`border-success-500/25 bg-success-500/8 text-fg hover:border-success-500/40`:`border-line bg-overlay/40 text-fg-muted hover:border-line-strong`),children:[n===`complete`?(0,G.jsx)(cr,{className:`size-3 text-success-400`,strokeWidth:2.5}):n===`in-progress`?(0,G.jsx)(`span`,{className:`size-1.5 rounded-full bg-accent-400 animate-pulse-dot`,"aria-hidden":!0}):(0,G.jsx)(`span`,{className:`size-1.5 rounded-full bg-fg-subtle/60`,"aria-hidden":!0}),(0,G.jsx)(`span`,{children:e}),t>1?(0,G.jsxs)(`span`,{title:`Ran ${t} times for this work item`,className:`inline-flex items-center gap-0.5 rounded-full bg-overlay/80 px-1 text-[10px] text-fg-muted`,children:[(0,G.jsx)(_i,{className:`size-2.5`}),t]}):null]})}function QS({job:e,phases:t,onSelectPhase:n}){if(!e.workItems||e.workItems.length===0)return null;let r=JS(e),i=new Set(t.map(e=>e.name)),a=r.find(e=>e.hasStarted)?.item.name??null;return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:[`Work items `,(0,G.jsxs)(`span`,{className:`text-fg-muted`,children:[`(`,e.workItems.length,`)`]})]}),e.currentWorkItem?(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[`current: `,(0,G.jsx)(`span`,{className:`text-fg`,children:e.currentWorkItem})]}):null]}),(0,G.jsx)(`div`,{className:`space-y-1.5`,children:r.map(t=>{let{item:r,executions:o,distinctPhases:s,hasStarted:c}=t,l=e.currentWorkItem===r.name,u=r.status===`complete`,d=!c&&u&&a!==null&&a!==r.name,f=s.map(e=>({name:e,count:o.filter(t=>t.phase===e).length}));return(0,G.jsxs)(`div`,{className:W(`flex flex-wrap items-center gap-3 rounded-xl border px-3 py-2`,l?`border-accent-500/30 bg-accent-500/8`:c||d?`border-line bg-overlay/40`:`border-line bg-overlay/20 opacity-70`),children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:W(`size-2 rounded-full shrink-0`,XS(r))}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`truncate text-[13px] font-medium text-fg`,children:r.name}),(0,G.jsxs)(`div`,{className:`text-[10px] uppercase tracking-[0.14em] text-fg-subtle`,children:[YS(r),r.loopCount>0?(0,G.jsxs)(`span`,{className:`ml-2 normal-case tracking-normal text-fg-muted`,children:[`· `,r.loopCount,` retr`,r.loopCount===1?`y`:`ies`]}):null]})]})]}),c?(0,G.jsxs)(`div`,{className:`flex flex-1 flex-wrap items-center gap-1.5`,children:[f.map(({name:t,count:a})=>{let o=l&&e.phase===t&&No(e.status),s=i.has(t),c=o?`in-progress`:`complete`;return(0,G.jsx)(ZS,{phaseName:s?t:`${t} (ad-hoc)`,count:a,state:c,onClick:()=>n(t)},`${r.name}:${t}`)}),l&&No(e.status)&&e.phase&&!s.includes(e.phase)?(0,G.jsx)(ZS,{phaseName:e.phase,count:1,state:`in-progress`,onClick:()=>n(e.phase)}):null]}):d?(0,G.jsx)(`div`,{className:`flex flex-1 flex-wrap items-center gap-1.5`,children:(0,G.jsxs)(`span`,{title:`This work item was delivered together with "${a}" in a single execution cycle (one shared PR / verification run). The actual phase executions are attributed to that item above.`,className:`inline-flex items-center gap-1.5 rounded-full border border-success-500/20 bg-success-500/8 px-2.5 py-1 text-[11px] font-medium text-fg-muted`,children:[(0,G.jsx)(cr,{className:`size-3 text-success-400/80`,strokeWidth:2.5}),`delivered with `,(0,G.jsx)(`span`,{className:`text-fg`,children:a})]})}):(0,G.jsx)(`div`,{className:`text-[11px] italic text-fg-subtle`,children:l?`starting…`:`waiting`}),r.status===`escalated`?(0,G.jsxs)(`span`,{title:`This work item escalated and is waiting on a human`,className:`inline-flex items-center gap-1 rounded-full border border-danger-500/30 bg-danger-500/10 px-2 py-0.5 text-[10px] text-danger-400`,children:[(0,G.jsx)(Mi,{className:`size-3`}),`escalated`]}):null]},r.name)})})]})}function $S(e,t,n){if(!t||!n)return null;let r=e[t];return r?r.find(e=>e.id===n)??null:null}function eC(e){let t=nC(e);return t?`${t.symbol} ${t.label}`:null}function tC(e){return nC(e)?.symbol??``}function nC(e){let t=e?.pricing;if(!t)return null;let n=t.inputPerMTokens,r=t.outputPerMTokens;if(n==null&&r==null)return null;let i=n!=null&&r!=null?(n+r)/2:n??r??0,a,o;return i<=1?(a=1,o=`cheapest`):i<=5?(a=2,o=`low`):i<=20?(a=3,o=`mid`):i<=50?(a=4,o=`high`):(a=5,o=`frontier`),{symbol:`$`.repeat(a),label:o}}function rC(e,t){let n=e?.pricing;if(!n||!t)return null;let r=e=>(e??0)/1e6;return(t.inputTokens??0)*r(n.inputPerMTokens)+(t.outputTokens??0)*r(n.outputPerMTokens)+(t.cacheReadInputTokens??0)*r(n.cacheReadPerMTokens)+(t.cacheCreationInputTokens??0)*r(n.cacheCreationPerMTokens??n.inputPerMTokens)}function iC(e){return Number.isFinite(e)?e===0?`0.00`:Math.abs(e)<.01?e.toFixed(4):Math.abs(e)<1?e.toFixed(3):e.toFixed(2):`—`}var aC=`::`;function oC(e,t){return!e||!t?``:`${e}${aC}${t}`}function sC(e){let t=e.indexOf(aC);return t<0?{provider:``,model:``}:{provider:e.slice(0,t),model:e.slice(t+2)}}function cC({value:e,onChange:t,providers:n,modelsByProvider:r,loadModels:i,className:a,disabled:o=!1,hideLabel:s=!1,label:c=`Model`}){(0,x.useEffect)(()=>{for(let e of n)i(e.id)},[n.map(e=>e.id).join(`|`)]);let l=(0,x.useMemo)(()=>n.some(e=>r[e.id]===null||r[e.id]===void 0),[n,r]),u=(0,x.useMemo)(()=>n.reduce((e,t)=>e+(r[t.id]?.length??0),0),[n,r]),d=oC(e.provider,e.model),f=eC($S(r,e.provider,e.model)),p=!!e.provider&&!!e.model&&(r[e.provider]??[]).some(t=>t.id===e.model),m=!!e.model&&!p,h=n.length===0?`(no enabled providers)`:l&&u===0?`Loading…`:u===0?`(no models published)`:`(select a model)`;return(0,G.jsxs)(Sv,{label:s?``:c,className:a,children:[(0,G.jsxs)(`select`,{value:d,disabled:o||n.length===0,onChange:e=>t(sC(e.target.value)),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg disabled:opacity-60`,"aria-label":s?c:void 0,children:[(0,G.jsx)(`option`,{value:``,children:h}),m?(0,G.jsxs)(`option`,{value:d,children:[e.model,` · `,e.provider,` (saved)`]}):null,n.map(e=>{let t=r[e.id];return!t||t.length===0?null:(0,G.jsx)(`optgroup`,{label:e.displayName,children:t.map(t=>{let n=tC(t);return(0,G.jsx)(`option`,{value:oC(e.id,t.id),children:n?`${t.displayName} — ${n}`:t.displayName},`${e.id}::${t.id}`)})},e.id)})]}),f?(0,G.jsx)(`div`,{className:`mt-1 text-[11px] text-fg-subtle`,title:`Static pricing hint published by the provider plugin. Runtime accounting always uses actual reported cost.`,children:f}):null]})}function lC(){let[e,t]=(0,x.useState)([]),[n,r]=(0,x.useState)(!0),[i,a]=(0,x.useState)(null);return(0,x.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await q(`/plugins`);if(e)return;t(n.plugins.filter(e=>e.manifest.kind===`executor`&&e.installed!==!1).map(e=>({id:e.manifest.id,displayName:e.manifest.displayName})).sort((e,t)=>e.displayName.localeCompare(t.displayName)))}catch(t){if(e)return;a(t instanceof K?t.message:String(t))}finally{e||r(!1)}})(),()=>{e=!0}},[]),{providers:e,loading:n,error:i}}function uC(){let[e,t]=(0,x.useState)({});return{modelsByProvider:e,loadModels:(0,x.useCallback)(async n=>{if(n&&e[n]===void 0){t(e=>({...e,[n]:null}));try{let e=await q(`/plugins/${encodeURIComponent(n)}/models`);t(t=>({...t,[n]:e.models??[]}))}catch(e){if(!(e instanceof K))throw e;t(e=>({...e,[n]:[]}))}}},[e])}}function dC({job:e,phase:t,onMutated:n}){let r=t===e.phase,i=e.status===`running`,a=e.phaseModelOverrides?.[t],{providers:o,loading:s}=lC(),{modelsByProvider:c,loadModels:l}=uC(),[u,d]=(0,x.useState)(()=>({provider:a?.provider??``,model:a?.model??``}));(0,x.useEffect)(()=>{d({provider:a?.provider??``,model:a?.model??``})},[t,a?.provider,a?.model]);let[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null),[g,_]=(0,x.useState)(!1),v=(0,x.useMemo)(()=>{let n=(e.phaseUsage??[]).filter(e=>e.phase===t);return n.length>0?n[n.length-1].model:null},[e.phaseUsage,t]),y=(0,x.useMemo)(()=>{let n=(e.phaseUsage??[]).filter(e=>e.phase===t);return n.length>0?n[n.length-1]:null},[e.phaseUsage,t]),b=rC($S(c,u.provider,u.model),y??void 0),S=y?.costUsd??null,C=b!=null&&S!=null?b-S:null,w=(0,x.useMemo)(()=>(u.provider||``)!==(a?.provider??``)||(u.model||``)!==(a?.model??``),[u,a]),T=async r=>{p(r),h(null);try{if(r===`apply`){if(!u.model)throw Error(`Pick a model first.`);await q(`/jobs/${encodeURIComponent(e.id)}/phase-overrides`,J({phase:t,model:u.model,provider:u.provider||void 0},{method:`PATCH`}))}else if(r===`clear`)await q(`/jobs/${encodeURIComponent(e.id)}/phase-overrides`,J({phase:t,clear:!0},{method:`PATCH`})),d({provider:``,model:``});else if(r===`rerun`){let n={};u.model&&(n.model=u.model),u.provider&&(n.provider=u.provider),await q(`/jobs/${encodeURIComponent(e.id)}/phases/${encodeURIComponent(t)}/rerun`,J(n,{method:`POST`}))}r!==`rerun`&&_(!1),n()}catch(e){h(e instanceof K||e instanceof Error?e.message:String(e))}finally{p(null)}},E=a?.model??v??null,D=a?`override`:v?`last-used`:`default`;return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px]`,children:[(0,G.jsx)(`span`,{className:`text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:`Model`}),(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:E??(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`(workflow default)`})}),D===`override`?(0,G.jsx)(`span`,{className:`rounded-full border border-info-400/40 bg-info-500/10 px-1.5 py-0 text-[10px] uppercase tracking-wide text-info-200`,children:`override`}):D===`last-used`?(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:`last run`}):null,g?null:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>_(!0),className:`ml-auto inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] text-fg-muted transition-colors hover:bg-overlay hover:text-fg`,"aria-label":`Change model for this phase`,title:`Change model for this phase`,children:[(0,G.jsx)(li,{className:`size-3`}),`Change`]})]}),g?(0,G.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-line bg-canvas/40 p-3`,children:[s?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-fg-subtle`,children:[(0,G.jsx)($r,{className:`size-3 animate-spin`}),` Loading providers…`]}):o.length===0?(0,G.jsx)(`div`,{className:`text-[12px] text-fg-subtle`,children:`No LLM provider plugins are installed. Configure one in Settings → LLM Providers before overriding a phase model.`}):(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`min-w-[12rem] max-w-xs flex-1`,children:(0,G.jsx)(cC,{value:u,onChange:d,providers:o,modelsByProvider:c,loadModels:l,disabled:f!==null,hideLabel:!0})}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`primary`,disabled:!w||!u.model||f!==null,onClick:()=>void T(`apply`),children:[f===`apply`?(0,G.jsx)($r,{className:`size-3 animate-spin`}):null,`Apply`]}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`ghost`,disabled:!a||f!==null,onClick:()=>void T(`clear`),title:a?`Remove the per-phase override and revert to workflow default`:`No override to clear`,children:[(0,G.jsx)(Pi,{className:`size-3`}),` Clear`]}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`secondary`,disabled:f!==null||r&&i,onClick:()=>void T(`rerun`),title:r&&i?`Pause the job before re-running the live phase`:`Re-enter this phase, optionally with the chosen model`,children:[f===`rerun`?(0,G.jsx)($r,{className:`size-3 animate-spin`}):(0,G.jsx)(_i,{className:`size-3`}),`Re-run`]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{_(!1),h(null),d({provider:a?.provider??``,model:a?.model??``})},className:`text-[11px] text-fg-subtle hover:text-fg`,children:`Cancel`})]}),b!=null&&S!=null&&y?(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[`For this phase's last run (`,y.inputTokens.toLocaleString(),` in /`,` `,y.outputTokens.toLocaleString(),` out tokens):`,` `,(0,G.jsxs)(`span`,{className:`text-fg`,children:[`$`,iC(S)]}),` →`,` `,(0,G.jsxs)(`span`,{className:`text-fg`,children:[`$`,iC(b)]}),C==null?null:(0,G.jsxs)(`span`,{className:C>0?`ml-1 text-warning-400`:C<0?`ml-1 text-success-400`:`ml-1 text-fg-subtle`,children:[`(`,C>=0?`+`:`−`,`$`,iC(Math.abs(C)),`)`]})]}):null,r&&i?(0,G.jsx)(`div`,{className:`rounded-lg border border-warning-400/30 bg-warning-500/5 px-2.5 py-1.5 text-[11px] leading-4 text-warning-100`,children:`This phase is running now. The override applies on the next selectModel call — the in-flight turn keeps its original model. Use “Re-run” to apply immediately.`}):null,m?(0,G.jsx)(`div`,{className:`rounded-lg border border-danger-400/40 bg-danger-500/5 px-2.5 py-1.5 text-[11px] text-danger-200`,children:m}):null]}):null]})}var fC=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Jo(`Primitive.${t}`),r=x.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,G.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),pC=`Separator`,mC=`horizontal`,hC=[`horizontal`,`vertical`],gC=x.forwardRef((e,t)=>{let{decorative:n,orientation:r=mC,...i}=e,a=_C(r)?r:mC,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,G.jsx)(fC.div,{"data-orientation":a,...o,...i,ref:t})});gC.displayName=pC;function _C(e){return hC.includes(e)}var vC=gC;function yC({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,G.jsx)(vC,{decorative:n,orientation:t,className:W(`shrink-0 bg-line`,t===`horizontal`?`h-px w-full`:`h-full w-px`,e),...r})}function bC(e){let[t,n]=(0,x.useState)(null),[r,i]=(0,x.useState)(!0),[a,o]=(0,x.useState)(null),s=(0,x.useCallback)(async()=>{if(e)try{n(await q(`/jobs/${e}`)),o(null)}catch(e){o(e instanceof Error?e.message:`Failed to fetch job`)}finally{i(!1)}},[e]);return(0,x.useEffect)(()=>{s()},[s]),{job:t,loading:r,error:a,refetch:s}}var xC=/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z)\s+/;function SC(e){let t=e.replace(xC,``),n=t.toLowerCase();return t.startsWith(`→ `)?{content:t,lineType:`tool_use`}:t.startsWith(`[thinking]`)?{content:t,lineType:`thinking`}:t.startsWith(`[tool_summary]`)?{content:t,lineType:`tool_summary`}:t.startsWith(`⏳`)?{content:t,lineType:`tool_progress`}:t.startsWith(`[error]`)?{content:t,lineType:`error`}:t.startsWith(`[guardrail]`)?{content:t,lineType:`guardrail`}:t.startsWith(`[warning]`)?{content:t,lineType:`warning`}:t.startsWith(`[result]`)?{content:t,lineType:`result`}:t.startsWith(`[insight]`)?{content:t,lineType:`insight`}:t.startsWith(`[session-reset]`)?{content:t,lineType:`session_reset`}:t.startsWith(`[webhook]`)?{content:t,lineType:`webhook`}:t.startsWith(`[human]`)?{content:t,lineType:`human`}:t.startsWith(`[init]`)||t.startsWith(`[usage]`)||t.startsWith(`[phase-end]`)||t.startsWith(`[artifact]`)||t.startsWith(`[repo-cloned]`)||t.startsWith(`[campaign]`)||t.startsWith(`[control]`)||t.startsWith(`[sdk-stderr]`)||t.startsWith(`[event:`)||t.startsWith(`System prompt:`)?{content:t,lineType:`system`}:t.startsWith(`Phase advanced`)||t.startsWith(`Runner started`)||t.startsWith(`Job parked`)||t.startsWith(`All phases complete`)?{content:t,lineType:`phase`}:t.startsWith(`Runner crashed`)?{content:t,lineType:`error`}:n.includes(`here's what was accomplished`)||/\bphase (is )?complete\b/.test(n)?{content:t,lineType:`result`}:/\bphase started\b/.test(n)?{content:t,lineType:`phase`}:{content:t,lineType:`text`}}function CC(e){let t=e.match(xC);return t?t[1]:``}function wC(e,t=!0){let[n,r]=(0,x.useState)([]),[i,a]=(0,x.useState)(`connecting`),[o,s]=(0,x.useState)(Date.now()),c=(0,x.useRef)(null),l=(0,x.useRef)(!1),u=(0,x.useRef)(void 0),d=(0,x.useRef)(!0),f=(0,x.useCallback)(()=>{l.current=!0,c.current&&=(c.current.close(),null)},[]);return(0,x.useEffect)(()=>{if(!e)return;let n=u.current,i=d.current,o=n!==e,p=!i&&t;if(u.current=e,d.current=t,(o||p)&&r([]),!t){f(),a(`disconnected`);return}a(`connecting`),l.current=!1;let m=new EventSource(`/jobs/${e}/stream`);return c.current=m,m.onopen=()=>{a(`connected`),s(Date.now())},m.onmessage=e=>{s(Date.now());let t=e.data;if(!t||t.trim()===``)return;let n=CC(t),{content:i,lineType:a}=SC(t);r(e=>[...e,{timestamp:n,content:i,lineType:a}])},m.onerror=()=>{m.close(),c.current=null,l.current=!0,a(`disconnected`)},()=>{m.close(),c.current=null}},[f,e,t]),{lines:n,status:i,lastHeartbeat:o,disconnect:f}}function TC({tone:e,children:t}){return(0,G.jsx)(`span`,{className:W(`ml-1 inline-flex h-4 min-w-[16px] items-center justify-center rounded-full px-1 text-[10px] font-medium tabular-nums ring-1`,e===`warning`?`bg-warning-500/15 text-warning-300 ring-warning-500/30`:`bg-overlay text-fg-muted ring-line`),children:t})}function EC(e){if(!e)return[];if(e.workflowPhases&&e.workflowPhases.length>0)return e.workflowPhases;let t=new Set,n=[];for(let r of e.phaseUsage??[])t.has(r.phase)||(t.add(r.phase),n.push({name:r.phase,status:r.phase}));return t.has(e.phase)||n.push({name:e.phase,status:e.phase}),n}function DC({parentRunId:e}){return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[13px]`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-line bg-overlay px-1.5 py-0.5 text-[10px] uppercase tracking-[0.14em] text-fg-subtle`,title:By.singular,children:[(0,G.jsx)(Cr,{className:`size-2.5`,"aria-hidden":!0}),By.singularLower]}),(0,G.jsxs)(`span`,{className:`text-fg-muted`,children:[`of`,` `,(0,G.jsx)(Dn,{to:My({id:e}),className:`inline-block max-w-[min(100%,28rem)] truncate align-bottom font-mono text-[12px] font-medium text-accent-300 underline-offset-2 hover:text-accent-400 hover:underline`,title:e,children:e})]})]})}function OC({job:e}){let t=Iy(e),n=Py(e),r=qy(e);return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Dn,{to:Zy,className:`inline-flex items-center gap-1.5 text-sm text-fg-muted transition-colors hover:text-fg`,children:[(0,G.jsx)(nr,{className:`size-4`}),Vy.backToRuns]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[r?(0,G.jsx)(DC,{parentRunId:r}):null,(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h1`,{className:`text-[1.75rem] font-semibold tracking-tight text-fg sm:text-[2rem]`,children:Ny(e)}),(0,G.jsx)(yg,{status:e.status})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[12px] text-fg-subtle`,children:[(0,G.jsx)(`span`,{className:`rounded-md border border-line bg-overlay px-1.5 py-0.5 uppercase tracking-[0.14em]`,title:`Workflow`,children:Yy(e)}),Ky(e)?(0,G.jsx)(`span`,{className:`rounded-md border border-line bg-overlay px-1.5 py-0.5 uppercase tracking-[0.14em]`,title:`Hosts ${By.pluralLower}`,children:By.pluralLower}):null,(0,G.jsx)(`span`,{className:`font-mono`,children:e.id}),t?(0,G.jsxs)(`span`,{children:[`· `,t]}):null,(0,G.jsxs)(`span`,{children:[`· updated `,Cy(e.updatedAt)]})]}),n?(0,G.jsx)(kC,{description:n}):null]})]})}function kC({description:e}){let[t,n]=(0,x.useState)(!1);return e.length>140||e.includes(`
62
+ `)?(0,G.jsx)(`div`,{className:`max-w-3xl text-sm text-fg-muted`,children:(0,G.jsxs)(`div`,{className:W(`relative pr-9`,!t&&`line-clamp-2`),children:[(0,G.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e}),(0,G.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":t?`Collapse description`:`Expand description`,onClick:()=>n(e=>!e),className:`absolute right-0 bottom-0 inline-flex size-6 items-center justify-center rounded-md border border-line bg-panel/95 text-fg-subtle shadow-[var(--shadow-card)] transition-[color,transform,background-color] hover:bg-panel-raised hover:text-fg`,children:(0,G.jsx)(lr,{className:W(`size-4 transition-transform`,t&&`rotate-180`)})})]})}):(0,G.jsx)(`p`,{className:`max-w-3xl text-sm text-fg-muted whitespace-pre-wrap break-words`,children:e})}function AC({label:e,value:t,detail:n}){return(0,G.jsxs)(`div`,{className:`rounded-xl border border-line bg-overlay/40 p-4`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:e}),(0,G.jsx)(`div`,{className:`mt-1 text-xl font-semibold text-fg`,children:t}),n?(0,G.jsx)(`div`,{className:`mt-1 text-[12px] text-fg-muted`,children:n}):null]})}function jC({title:e,tone:t,children:n}){return(0,G.jsxs)(`div`,{className:W(`rounded-2xl border p-4`,{neutral:`border-line bg-overlay/40 text-fg`,accent:`border-accent-500/25 bg-accent-500/8 text-fg`,success:`border-success-500/25 bg-success-500/8 text-fg`,warning:`border-warning-500/25 bg-warning-500/8 text-fg`,danger:`border-danger-500/25 bg-danger-500/8 text-fg`}[t]),children:[(0,G.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:e}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n})]})}function MC({usage:e}){if(!e)return(0,G.jsx)(lg,{children:(0,G.jsxs)(ug,{children:[(0,G.jsx)(dg,{children:`Token usage`}),(0,G.jsx)(fg,{children:`Token usage will populate once this job has run through at least one model turn.`})]})});let t=e.inputTokens+e.outputTokens,n=e.inputTokens+e.cacheCreationInputTokens,r=n>0?e.cacheReadInputTokens/n*100:0;return(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{children:[(0,G.jsx)(dg,{children:`Token usage`}),(0,G.jsx)(fg,{children:`Token footprint, cache efficiency, and spend for the full run.`})]}),(0,G.jsxs)(pg,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,G.jsx)(AC,{label:`Total`,value:wy(t),detail:`${wy(e.inputTokens)} in / ${wy(e.outputTokens)} out`}),(0,G.jsx)(AC,{label:`Cache read`,value:wy(e.cacheReadInputTokens),detail:`${wy(e.cacheCreationInputTokens)} cache writes`}),(0,G.jsx)(AC,{label:`Hit rate`,value:r>0?`${r.toFixed(0)}%`:`—`,detail:`Across cache-eligible requests`}),(0,G.jsx)(AC,{label:`Spend`,value:Ey(e.totalCostUsd),detail:`USD across all turns`})]})]})}function NC({phases:e}){return e.length?(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{children:[(0,G.jsx)(dg,{children:`Usage by phase`}),(0,G.jsx)(fg,{children:`Per-phase token consumption, wall time, and model selection.`})]}),(0,G.jsx)(pg,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full min-w-[680px] text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-line text-left text-[10px] uppercase tracking-[0.16em] text-fg-subtle`,children:[(0,G.jsx)(`th`,{className:`px-2 py-2 font-medium`,children:`Phase`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Input`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Output`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Duration`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Turns`}),(0,G.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Cost`}),(0,G.jsx)(`th`,{className:`px-2 py-2 font-medium`,children:`Model`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line text-fg`,children:e.map((e,t)=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`px-2 py-3 font-medium text-fg`,children:e.phase}),(0,G.jsx)(`td`,{className:`px-2 py-3 text-right tabular-nums`,children:wy(e.inputTokens)}),(0,G.jsx)(`td`,{className:`px-2 py-3 text-right tabular-nums`,children:wy(e.outputTokens)}),(0,G.jsx)(`td`,{className:`px-2 py-3 text-right tabular-nums`,children:Dy(e.durationMs)}),(0,G.jsx)(`td`,{className:`px-2 py-3 text-right tabular-nums`,children:e.numTurns}),(0,G.jsx)(`td`,{className:`px-2 py-3 text-right tabular-nums`,children:Ey(e.costUsd)}),(0,G.jsx)(`td`,{className:`px-2 py-3 text-fg-muted`,children:e.model})]},`${e.phase}-${t}`))})]})})]}):(0,G.jsx)(lg,{children:(0,G.jsxs)(ug,{children:[(0,G.jsx)(dg,{children:`Usage by phase`}),(0,G.jsx)(fg,{children:`No phase-level usage snapshots have been recorded yet.`})]})})}function PC({job:e}){return!e.awaitingEvent&&!e.escalationMessage&&!e.rateLimitInfo?null:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[e.status===`awaiting-rate-limit`&&e.rateLimitInfo?(0,G.jsx)(FC,{info:e.rateLimitInfo}):null,e.awaitingEvent&&e.status!==`awaiting-developer-input`&&e.status!==`awaiting-rate-limit`?(0,G.jsxs)(jC,{title:`Awaiting external event`,tone:`warning`,children:[e.awaitingEvent,e.awaitingPrId?` (PR #${e.awaitingPrId})`:``]}):null,e.escalationMessage?(0,G.jsx)(jC,{title:`Escalation message`,tone:`danger`,children:e.escalationMessage}):null]})}function FC({info:e}){let[t,n]=(0,x.useState)(()=>Date.now());(0,x.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let r=Math.max(0,e.resumeAt-t),i=Math.ceil(r/1e3),a=Math.floor(i/3600),o=Math.floor(i%3600/60),s=i%60,c=e=>e.toString().padStart(2,`0`),l=`${c(a)}:${c(o)}:${c(s)}`,u=e.kind===`overloaded`?`overloaded`:`rate-limit`;return(0,G.jsx)(jC,{title:r===0?`Provider ${u} — resuming…`:`Provider ${u} — auto-resume in ${l}`,tone:`warning`,children:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{children:[e.provider,` (attempt `,e.retryAttempt,`, source: `,e.source,`)`]}),e.lastErrorMessage?(0,G.jsx)(`div`,{className:`text-xs text-neutral-400 break-words`,children:e.lastErrorMessage}):null]})})}function IC({job:e,selectedPhase:t,phases:n,onSelectPhase:r,onMutated:i}){let a=t??e.phase,o=(e.artifacts??[]).filter(e=>e.phase===a),s=(e.phaseUsage??[]).find(e=>e.phase===a);return(0,G.jsxs)(lg,{children:[(0,G.jsx)(ug,{className:`border-b border-line pb-4`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(dg,{children:jy(e.workflowPath)}),(0,G.jsxs)(fg,{children:[n.length,` phases · click any to inspect`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:[(0,G.jsx)(`span`,{children:`spend`}),(0,G.jsx)(vg,{variant:`neutral`,className:`border-line bg-overlay text-fg tabular-nums`,children:Ey(e.tokenUsage?.totalCostUsd??0)})]})]})}),(0,G.jsxs)(pg,{className:`space-y-5 pt-5`,children:[(0,G.jsx)(qS,{job:e,phases:n,selectedPhase:t,onSelectPhase:r}),(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:`Selected phase`}),(0,G.jsx)(`div`,{className:`text-base font-semibold text-fg`,children:a})]}),s?(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 text-[12px] text-fg-muted`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`in`}),` `,(0,G.jsx)(`span`,{className:`tabular-nums text-fg`,children:wy(s.inputTokens)})]}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`out`}),` `,(0,G.jsx)(`span`,{className:`tabular-nums text-fg`,children:wy(s.outputTokens)})]}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`turns`}),` `,(0,G.jsx)(`span`,{className:`tabular-nums text-fg`,children:s.numTurns})]}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`duration`}),` `,(0,G.jsx)(`span`,{className:`tabular-nums text-fg`,children:Dy(s.durationMs)})]})]}):null]}),(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(kx,{jobId:e.id,artifacts:o,phaseName:a})}),(0,G.jsx)(`div`,{className:`mt-4`,children:(0,G.jsx)(dC,{job:e,phase:a,onMutated:i})})]}),(0,G.jsx)(QS,{job:e,phases:n,onSelectPhase:r})]})]})}function LC({title:e=`Send message`,description:t=`Send additional guidance into the live run. Multiple messages are allowed.`,submitLabel:n=`Send message`,value:r,onChange:i,onSend:a,error:o,onStepIn:s,steppedIn:c=!1,placeholder:l=`Tell the agent what changed, what to prioritize, or where to look next…`,textareaRef:u}){return(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`gap-1.5 pb-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(dg,{children:e}),(0,G.jsx)(fg,{children:t})]}),s?(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>void s(),children:`Step in`}):null]}),c?(0,G.jsx)(`div`,{className:`rounded-lg border border-warning-500/25 bg-warning-500/8 px-3 py-2 text-xs text-warning-200`,children:`Paused — your next message will steer the run.`}):null]}),(0,G.jsxs)(pg,{className:`space-y-2.5 pt-0`,children:[o?(0,G.jsx)(gg,{message:o}):null,(0,G.jsx)(bb,{ref:u,rows:3,value:r,onChange:e=>i(e.target.value),placeholder:l,className:`min-h-24`}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsxs)(Y,{onClick:()=>void a(),disabled:!r.trim(),size:`sm`,children:[(0,G.jsx)(bi,{}),n]})})]})]})}function RC({messages:e}){return e.length===0?null:(0,G.jsxs)(`div`,{className:`border-t border-line pt-4`,children:[(0,G.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:[(0,G.jsx)(yr,{className:`size-3.5`}),`Pending messages`]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:e.map((e,t)=>(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/35 px-3 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,G.jsx)(yr,{className:`mt-0.5 size-3.5 shrink-0 text-warning-400`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-sm text-fg whitespace-pre-wrap break-words`,children:e.text}),(0,G.jsx)(`div`,{className:`mt-1 text-[11px] text-fg-subtle`,children:t===0?`Waiting for the next safe point. Queued ${Cy(e.queuedAt)}.`:`Queued behind ${t} earlier message${t===1?``:`s`} since ${Cy(e.queuedAt)}.`})]})]})},e.id))})]})}function zC({label:e,data:t,defaultOpen:n=!1}){let[r,i]=(0,x.useState)(n);return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-line bg-overlay/30`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`flex w-full items-center justify-between gap-3 px-4 py-3 text-left transition-colors hover:bg-overlay/60`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e}),(0,G.jsx)(lr,{className:W(`size-4 text-fg-subtle transition-transform`,r&&`rotate-180`)})]}),r?(0,G.jsx)(`pre`,{className:`max-h-[420px] overflow-auto border-t border-line p-4 font-mono text-[12px] text-fg whitespace-pre-wrap break-words`,children:JSON.stringify(t,null,2)}):null]})}function BC({job:e}){let t=Fy(e),n=Iy(e),r=qy(e),i=[];return i.push({label:`Workflow`,value:Yy(e)}),i.push({label:`Phase`,value:e.phase}),n&&i.push({label:`Repository`,value:n}),t.length>0&&i.push({label:`Reviewers`,value:t.join(`, `)}),r&&i.push({label:Xy(),value:(0,G.jsx)(Dn,{to:My({id:r}),className:`font-mono text-accent-300 hover:text-accent-400`,children:r})}),e.prMappings&&e.prMappings.length>0&&i.push({label:`Pull requests`,value:(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-fg-muted`,children:[(0,G.jsx)(Hr,{className:`size-3.5`}),e.prMappings.length,` mapping`,e.prMappings.length===1?``:`s`]})}),(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{children:[(0,G.jsx)(dg,{children:`Context`}),(0,G.jsx)(fg,{children:`${zy.singular} metadata and coordination signals.`})]}),(0,G.jsx)(pg,{className:`space-y-3 text-sm`,children:i.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsx)(`span`,{className:`text-[11px] uppercase tracking-[0.14em] text-fg-subtle`,children:e.label}),(0,G.jsx)(`span`,{className:`text-right text-fg`,children:e.value})]},t))})]})}function VC(){let{jobId:e}=ot(),t=$e(),{job:n,loading:r,error:i,refetch:a}=bC(e),{lines:o,status:s,lastHeartbeat:c}=wC(e,n?!jo(n.status):!0),l=(0,x.useRef)(void 0),u=(0,x.useRef)(0),[d,f]=(0,x.useState)(`activity`),[p,m]=(0,x.useState)(null),[h,g]=(0,x.useState)(``),[_,v]=(0,x.useState)(!1),[y,b]=(0,x.useState)(!1),[S,C]=(0,x.useState)(null),[w,T]=(0,x.useState)(!1),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(!1),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(``),[ee,te]=(0,x.useState)(null),P=(0,x.useRef)(null),[F,I]=(0,x.useState)([]),[ne,re]=(0,x.useState)(!1),[ie,L]=(0,x.useState)(void 0),R=(0,x.useRef)([]),ae=(0,x.useRef)(!1),oe=(0,x.useRef)(0),se=n?Ay(n):!1;To(e?{id:e,kind:`run`,path:t.pathname,title:n?Ny(n):e,subtitle:n?.phase}:null),(0,x.useEffect)(()=>{l.current=void 0,u.current=0,m(null),oe.current+=1,R.current=[],ae.current=!1,I([])},[e]),(0,x.useEffect)(()=>{if(!n)return;let e=l.current;l.current=n.phase,m(t=>t===null||e===void 0||t===e?n.phase:t)},[n?.id,n?.phase]),(0,x.useEffect)(()=>{if(o.length<=u.current){u.current=o.length;return}let e=o.slice(u.current);u.current=o.length,e.some(e=>e.lineType===`phase`)&&a()},[o,a]),(0,x.useEffect)(()=>{if(!n||jo(n.status))return;let e=window.setInterval(()=>{a()},4e3);return()=>{window.clearInterval(e)}},[n?.id,n?.status,a]);let ce=(0,x.useMemo)(()=>EC(n??null),[n]);async function le(t,n=!1){if(e){k(!0),j(null);try{let r={};t&&(r.fromPhase=t),n&&(r.clearSession=!0),await q(`/jobs/${e}/resume`,J(r,{method:`POST`})),await a()}catch(e){j(e instanceof Error?e.message:`Resume failed`)}finally{k(!1)}}}async function ue(){if(e&&window.confirm(`Cancel this run? It will stop at the next safe boundary and will not auto-resume.`)){b(!0),C(null);try{await q(`/jobs/${e}/cancel`,J({},{method:`POST`})),await a()}catch(e){C(e instanceof Error?e.message:`Cancel failed`)}finally{b(!1)}}}async function de(){if(!e)return!1;T(!0),D(null);try{return await q(`/jobs/${e}/pause`,J({},{method:`POST`})),await a(),requestAnimationFrame(()=>P.current?.focus()),!0}catch(e){return D(e instanceof Error?e.message:`Pause failed`),!1}finally{T(!1)}}async function fe(){await de()}async function pe(){re(!0);try{await a()}finally{re(!1)}}(0,x.useEffect)(()=>{n&&ie!==void 0&&ie===n.interactive&&L(void 0)},[n?.interactive,ie]);function me(e){let t=e(R.current);R.current=t,I(t)}async function he(t){if(!e)throw Error(`No job id`);await q(`/jobs/${e}/message`,J({message:t},{method:`POST`})),a()}async function ge(){if(ae.current)return;ae.current=!0;let e=oe.current;try{for(;oe.current===e;){let t=R.current[0];if(!t)break;try{if(await he(t.text),oe.current!==e)return;te(null)}catch(t){if(oe.current!==e)return;te(t instanceof Error?t.message:`Failed to send message`)}finally{if(oe.current!==e)return;me(e=>e.filter(e=>e.id!==t.id))}}}finally{oe.current===e&&(ae.current=!1)}}async function _e(){let e=M.trim();e&&(te(null),N(``),me(t=>[...t,{id:crypto.randomUUID(),text:e,queuedAt:Date.now()}]),ge())}if(r)return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsx)(bg,{className:`h-32 w-full`}),(0,G.jsx)(bg,{className:`h-20 w-full`}),(0,G.jsx)(bg,{className:`h-12 w-full`}),(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,G.jsx)(bg,{className:`h-[520px] w-full`}),(0,G.jsx)(bg,{className:`h-[420px] w-full`})]})]});if(i||!n)return(0,G.jsx)(lg,{children:(0,G.jsxs)(pg,{className:`flex flex-col items-center gap-4 py-16 text-center`,children:[(0,G.jsx)(`div`,{className:`text-lg font-semibold text-fg`,children:i??`${zy.singular} not found`}),(0,G.jsx)(`p`,{className:`max-w-md text-sm text-fg-muted`,children:`The ${zy.singularLower} could not be loaded. It may have been deleted or the runner could not reach its backing state store.`}),(0,G.jsx)(Y,{asChild:!0,variant:`secondary`,children:(0,G.jsx)(Dn,{to:Zy,children:Vy.backToRuns})})]})});let ve=Io(n.status,n.awaitingEvent),ye=No(n.status)&&s!==`disconnected`||Mo(n.status)&&n.status!==`awaiting-developer-input`||ve,be=n.status===`escalated`;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(OC,{job:n}),(0,G.jsx)(PC,{job:n}),(0,G.jsx)(kS,{job:n,workflowPhases:ce,refreshing:ne,onRefresh:pe,cancelling:y,cancelError:S,onCancel:ue,pausing:w,pauseError:E,onPause:de,resuming:O,resumeError:A,resumePhase:h,clearSession:_,onResumePhaseChange:g,onClearSessionChange:v,onResume:le,interactiveOverride:ie,onInteractiveChange:L}),(0,G.jsx)(IC,{job:n,selectedPhase:p,phases:ce,onSelectPhase:m,onMutated:()=>void a()}),se?(0,G.jsx)(Hx,{job:n,onMutated:()=>void a()}):null,(0,G.jsxs)(Bb,{value:d,onValueChange:e=>f(e),children:[(0,G.jsxs)(Vb,{children:[(0,G.jsxs)(Hb,{value:`activity`,children:[(0,G.jsx)($n,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),`Activity`,No(n.status)?(0,G.jsx)(`span`,{title:`Run is active`,className:`ml-1 inline-flex size-1.5 rounded-full bg-accent-400 animate-pulse-dot`}):null]}),(0,G.jsxs)(Hb,{value:`changes`,children:[(0,G.jsx)(Hr,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),`Changes`,vS(n)?(0,G.jsx)(`span`,{title:`A pull request is ready for your review`,className:`ml-1 inline-flex size-1.5 rounded-full bg-accent-400`}):null]}),(0,G.jsxs)(Hb,{value:`insights`,children:[(0,G.jsx)(Xr,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),`Insights`,(()=>{let e=(n.insights??[]).filter(e=>!e.sourceChildName&&(e.status??`pending`)===`pending`).length;return e>0?(0,G.jsx)(TC,{tone:`warning`,children:e}):null})()]}),(0,G.jsxs)(Hb,{value:`diagnostics`,children:[(0,G.jsx)(sr,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),`Diagnostics`,(()=>{let e=(n.tokenUsage?.inputTokens??0)+(n.tokenUsage?.outputTokens??0);return e>0?(0,G.jsx)(TC,{tone:`neutral`,children:wy(e)}):null})()]})]}),(0,G.jsx)(Ub,{value:`activity`,className:`space-y-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,G.jsxs)(`div`,{className:`space-y-5`,children:[n.status===`awaiting-developer-input`&&!ve?(0,G.jsx)(bx,{job:n,onSend:he,onCancel:ue,onViewChanges:()=>f(`changes`)}):null,be?(0,G.jsx)(LC,{title:`Reply to escalation`,description:`Send guidance back into the parked run. Your reply will resume the current phase in the existing job.`,submitLabel:`Send reply`,value:M,onChange:N,onSend:_e,error:ee}):null,(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`gap-3 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(dg,{children:`Live console`}),(0,G.jsx)(fg,{children:`Streaming runner output, tool execution summaries, and developer interventions.`})]}),(0,G.jsx)(Wx,{status:s,lastHeartbeat:c})]}),(0,G.jsxs)(pg,{className:`space-y-4 pt-5`,children:[(0,G.jsx)(VS,{lines:o}),(0,G.jsx)(RC,{messages:F})]})]}),ye?(0,G.jsx)(LC,{value:M,onChange:N,onSend:_e,error:ee,onStepIn:Lo(n.status,n.awaitingEvent)?fe:void 0,steppedIn:ve,placeholder:ve?`Tell Coro what to change before continuing…`:void 0,textareaRef:P}):null]}),(0,G.jsx)(`div`,{className:`space-y-4`,children:(0,G.jsx)(BC,{job:n})})]})}),(0,G.jsx)(Ub,{value:`changes`,className:`space-y-5`,children:(0,G.jsx)(bS,{job:n,live:!jo(n.status)})}),(0,G.jsx)(Ub,{value:`insights`,className:`space-y-5`,children:(0,G.jsx)(Zx,{jobId:n.id,insights:n.insights??[],onChanged:()=>void a()})}),(0,G.jsxs)(Ub,{value:`diagnostics`,className:`space-y-5`,children:[(0,G.jsx)(MC,{usage:n.tokenUsage}),(0,G.jsx)(NC,{phases:n.phaseUsage??[]}),(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`border-b border-line pb-4`,children:[(0,G.jsx)(dg,{children:`Raw state`}),(0,G.jsx)(fg,{children:`Inspect the underlying job object, parameters, and PR mappings. Insights have moved to their own tab.`})]}),(0,G.jsxs)(pg,{className:`space-y-3 pt-5`,children:[(0,G.jsx)(zC,{label:`Job parameters`,data:n.params,defaultOpen:!0}),(0,G.jsx)(zC,{label:`Full job object`,data:n}),n.prMappings?.length>0?(0,G.jsx)(zC,{label:`PR mappings (${n.prMappings.length})`,data:n.prMappings}):null]})]})]})]}),(0,G.jsx)(yC,{className:`opacity-0`})]})}var HC={base:{label:`Coro`,Icon:ii,tone:`bg-fg/8 text-fg-muted ring-line`,description:`Ships with the Coro runner. Read-only — override in your Custom or Repo layer.`},tenant:{label:`Custom`,Icon:Yr,tone:`bg-accent-500/15 text-accent-200 ring-accent-500/30`,description:`Your custom overlay (~/.coro/intelligence). Edit here to apply across every repo.`},repo:{label:`Repo`,Icon:Si,tone:`bg-success/15 text-success ring-success/30`,description:`The target repo's .coro/ folder. Edit here for repo-local customisations.`}};function UC({layer:e,overrides:t,size:n=`md`,className:r}){let i=HC[e],a=i.Icon;return(0,G.jsxs)(`span`,{title:t?`${i.description}\nOverrides ${HC[t].label.toLowerCase()} layer.`:i.description,className:W(`inline-flex items-center gap-1 rounded-md font-medium uppercase tracking-wide ring-1`,n===`sm`?`px-1.5 py-0.5 text-[10px]`:`px-2 py-0.5 text-[11px]`,i.tone,r),children:[(0,G.jsx)(a,{className:n===`sm`?`size-2.5`:`size-3`}),i.label,t?(0,G.jsxs)(`span`,{className:`ml-0.5 normal-case text-[10px] opacity-70`,children:[`↳ overrides `,HC[t].label.toLowerCase()]}):null]})}function WC({tone:e,children:t,title:n}){let r={accent:`bg-accent-500/15 text-accent-200 ring-accent-500/30`,warning:`bg-warning-500/12 text-warning-200 ring-warning-500/30`,muted:`bg-overlay/60 text-fg-muted ring-line`,model:`bg-overlay/60 text-fg-muted ring-line`}[e];return(0,G.jsx)(`span`,{title:n,className:W(`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide ring-1`,r),children:t})}function GC({workflow:e,compact:t=!1}){let n=e.phases??[];return n.length===0?(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/30 p-3 text-xs text-fg-muted`,children:`No phase information available.`}):(0,G.jsx)(`ol`,{className:W(`space-y-1.5`,t&&`space-y-1`),children:n.map((r,i)=>{let a=r.name===e.initialPhase,o=i===n.length-1;return(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`div`,{className:W(`rounded-xl border px-3 transition-colors`,t?`py-2`:`py-3`,a?`border-accent-500/40 bg-accent-500/5`:`border-line bg-overlay/30`),children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,G.jsx)(`span`,{className:W(`mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-full text-[10px] font-mono ring-1`,a?`bg-accent-500/20 ring-accent-500/40 text-accent-200`:`bg-overlay/60 ring-line text-fg-muted`),children:i+1}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1`,children:[(0,G.jsx)(`span`,{className:W(`font-medium text-fg`,t?`text-xs`:`text-sm`),children:r.name}),a?(0,G.jsxs)(WC,{tone:`accent`,children:[(0,G.jsx)(pr,{className:`size-2.5`}),`Start`]}):null,(0,G.jsx)(WC,{tone:`model`,children:r.model}),r.interactiveCheckpoint?(0,G.jsxs)(WC,{tone:`warning`,title:`Runner pauses for your approval before advancing when interactive mode is on`,children:[(0,G.jsx)(hr,{className:`size-2.5`}),`Checkpoint`]}):null]}),t?null:(0,G.jsxs)(`div`,{className:`mt-1 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,G.jsx)(ar,{className:`size-3 shrink-0`}),r.agent?(0,G.jsx)(`span`,{className:`font-mono`,children:r.agent}):(0,G.jsx)(`span`,{className:`italic`,children:`Runner-managed`})]})]})]})}),o?null:(0,G.jsx)(`div`,{className:`flex justify-center py-0.5`,children:(0,G.jsx)(tr,{className:`size-3 text-fg-subtle`})})]},r.name)})})}function KC({workflow:e,open:t,onOpenChange:n}){return(0,G.jsx)(c_,{open:t,onOpenChange:n,children:(0,G.jsxs)(d_,{className:`flex max-w-2xl flex-col gap-0 max-h-[min(720px,calc(100vh-2rem))]`,children:[(0,G.jsx)(f_,{className:`shrink-0`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-500/15 ring-1 ring-accent-500/30 text-accent-200`,children:(0,G.jsx)(B,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(p_,{children:e?.name??`Workflow`}),e?.layer?(0,G.jsx)(UC,{layer:e.layer,overrides:e.overrides}):null]}),e?(0,G.jsx)(m_,{className:`font-mono text-[11px] text-fg-subtle`,children:e.workflowPath}):null]})]})}),(0,G.jsxs)(h_,{className:`flex-1 min-h-0 space-y-5`,children:[e?.description?(0,G.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:e.description}):null,e&&e.phases&&e.phases.length>0?(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,G.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-fg-subtle`,children:`Phases`}),(0,G.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[e.phases.length,` phase`,e.phases.length===1?``:`s`]})]}),(0,G.jsx)(GC,{workflow:e})]}):(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/30 p-4 text-sm text-fg-muted`,children:`No phase information available for this workflow.`}),e?(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-line pt-4 text-xs text-fg-subtle`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{children:`From`}),e.layer?(0,G.jsx)(UC,{layer:e.layer,overrides:e.overrides,size:`sm`}):(0,G.jsx)(`span`,{className:`font-mono`,children:qC(e.source)}),e.layer&&e.source?(0,G.jsx)(`span`,{className:`font-mono text-[10px] opacity-60`,title:e.source,children:qC(e.source)}):null]}),e.kind===`job`?null:(0,G.jsxs)(WC,{tone:`muted`,children:[(0,G.jsx)(Er,{className:`size-2.5`}),e.kind]})]}):null]})]})})}function qC(e){if(!e)return`unknown`;let t=e.split(`/`).filter(Boolean);return t.length<=2?e:`…/`+t.slice(-2).join(`/`)}function JC({workflow:e,interactive:t,mode:n,serviceName:r,repo:i,ticketId:a,formValid:o,loading:s=!1}){if(s||!e)return(0,G.jsxs)(`div`,{className:`space-y-3 rounded-2xl border border-line bg-overlay/30 p-5`,children:[(0,G.jsx)(bg,{className:`h-5 w-2/3`}),(0,G.jsx)(bg,{className:`h-4 w-full`}),(0,G.jsx)(bg,{className:`h-32 w-full`})]});let c=e.phases?.[0]?.name??`the first phase`,l=e.phases?.length??0,u=t?`Coro starts at ${c} and pauses at every checkpoint for your approval.`:`Coro runs end-to-end and opens a PR. You can pause or message it mid-run.`,d=n===`manual`?r?.trim()||i?.trim()||`Your run details`:a?.trim()||`Tracker ticket run`;return(0,G.jsxs)(`div`,{className:W(`space-y-4 rounded-2xl border border-line bg-overlay/30 p-5 transition-opacity`,!o&&`opacity-50`),children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-[0.16em] text-fg-subtle`,children:`What will happen`}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:e.name}),e.layer?(0,G.jsx)(UC,{layer:e.layer,overrides:e.overrides,size:`sm`}):null,(0,G.jsx)(`span`,{className:`rounded-md border border-line bg-overlay/60 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-fg-muted`,children:e.kind})]}),e.description?(0,G.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-fg-muted`,children:e.description}):null,(0,G.jsx)(`p`,{className:`mt-1 text-xs font-medium text-fg`,children:d})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-2 text-[11px] font-semibold uppercase tracking-wider text-fg-subtle`,children:`Phases`}),(0,G.jsx)(GC,{workflow:e,compact:!0})]}),(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/40 px-3 py-2.5 text-xs leading-relaxed text-fg-muted`,children:u}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,G.jsx)(br,{className:`size-3.5 shrink-0 text-fg-subtle`}),(0,G.jsx)(`span`,{children:ho(e.workflowPath,l)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-2 text-[11px] font-semibold uppercase tracking-wider text-fg-subtle`,children:`Mid-run controls`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(YC,{icon:oi,label:`Pause`}),(0,G.jsx)(YC,{icon:ni,label:`Message`}),(0,G.jsx)(YC,{icon:ir,label:`Cancel`})]})]}),(0,G.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:`Token cost shows live on the run page.`})]})}function YC({icon:e,label:t}){return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-line bg-overlay/50 px-2.5 py-1 text-[11px] font-medium text-fg-muted`,children:[(0,G.jsx)(e,{className:`size-3 text-fg-subtle`}),t]})}var XC={"bug-fix":{label:`Bug fix`,icon:`🐛`,blurb:`Investigate and fix broken behaviour.`},refactor:{label:`Refactor`,icon:`♻️`,blurb:`Clean up structure without changing behaviour.`},"feature-small":{label:`Small feature`,icon:`✨`,blurb:`Scoped additions to existing code.`},"feature-medium":{label:`Medium feature`,icon:`🚀`,blurb:`Multi-file changes with clear acceptance criteria.`},tests:{label:`Tests`,icon:`🧪`,blurb:`Add or improve test coverage.`},docs:{label:`Documentation`,icon:`📝`,blurb:`Update README or inline docs.`},dependency:{label:`Dependency`,icon:`📦`,blurb:`Bump packages and fix breakage.`},"tracker-triage":{label:`Tracker ticket`,icon:`🎫`,blurb:`Start from an issue in your tracker.`}},ZC=[{id:`add-validation`,category:`feature-small`,title:`Add input validation`,preview:`Validate request payloads on an endpoint with clear error messages.`,description:"Add input validation to the `<endpoint>` endpoint. Return 400 with a structured error body when validation fails. Include unit tests for the happy path and at least two failure cases.",mode:`manual`,tags:[`validation`,`api`,`endpoint`]},{id:`fix-flaky-test`,category:`bug-fix`,title:`Fix a flaky test`,preview:`Investigate timing or ordering issues causing intermittent failures.`,description:"The test `<test file>` is flaky. Investigate the root cause, fix it, and add a brief comment explaining what made it unstable. The test must pass reliably when run 10 times in a row.",mode:`manual`,tags:[`test`,`flaky`,`ci`]},{id:`extract-helper`,category:`refactor`,title:`Extract a shared helper`,preview:`Pull repeated logic into a reusable function without changing behaviour.`,description:"Extract the repeated `<pattern>` block into a shared helper. Update all call sites to use it. Behaviour must remain identical — no functional changes. Add or update tests if coverage would drop.",mode:`manual`,tags:[`refactor`,`dedupe`]},{id:`add-rate-limit`,category:`feature-small`,title:`Add rate limiting`,preview:`Protect an endpoint with token-bucket or similar limiting.`,description:"Add rate limiting to `<endpoint>` using the existing `<library>` utility. Return clear retry-after headers when a caller exceeds the limit. Include acceptance criteria: limit applies per caller, headers are present, and existing tests still pass.",mode:`manual`,tags:[`rate-limit`,`api`,`security`]},{id:`bump-dependency`,category:`dependency`,title:`Bump a dependency`,preview:`Upgrade a package to the latest compatible version.`,description:"Bump `<package>` to the latest minor version compatible with our runtime. Fix any compile or test breakage. Summarise breaking API changes in the PR description.",mode:`manual`,tags:[`dependency`,`upgrade`]},{id:`improve-readme`,category:`docs`,title:`Update README`,preview:`Document a new feature or changed behaviour in the README.`,description:"Update the README to reflect the new `<feature>`. Include setup steps if they changed, and add a short usage example. Keep the tone consistent with the existing doc.",mode:`manual`,tags:[`docs`,`readme`]},{id:`add-unit-tests`,category:`tests`,title:`Add unit tests`,preview:`Cover a module with focused unit tests for edge cases.`,description:"Add unit-test coverage for `<module>` focusing on `<edge cases>`. Follow existing test conventions in the repo. Tests must be deterministic and not require network access.",mode:`manual`,tags:[`tests`,`coverage`]},{id:`triage-ticket`,category:`tracker-triage`,title:`Work from a tracker ticket`,preview:`Switch to ticket mode — Coro pulls scope from your issue tracker.`,description:``,mode:`ticket`,tags:[`jira`,`linear`,`ticket`]}],QC=`coro.promptTemplates.recent`;function $C(){if(typeof window>`u`)return[];try{let e=window.localStorage.getItem(QC);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`).slice(0,3):[]}catch{return[]}}function ew(e){if(typeof window>`u`)return;let t=$C().filter(t=>t!==e);window.localStorage.setItem(QC,JSON.stringify([e,...t].slice(0,3)))}function tw(e){let t=e.match(/<[^>]+>/);return!t||t.index===void 0?null:{start:t.index,end:t.index+t[0].length}}function nw({open:e,onOpenChange:t,onSelect:n,hasExistingDescription:r}){let[i,a]=(0,x.useState)(`feature-small`),[o,s]=(0,x.useState)(``),c=(0,x.useMemo)(()=>e?$C():[],[e]),l=(0,x.useMemo)(()=>{let e=o.trim().toLowerCase(),t=i===`recent`?c.map(e=>ZC.find(t=>t.id===e)).filter(e=>!!e):ZC.filter(e=>e.category===i);return e&&(t=ZC.filter(t=>t.title.toLowerCase().includes(e)||t.preview.toLowerCase().includes(e)||t.tags?.some(t=>t.includes(e)))),t},[i,o,c]);function u(e){r&&e.description&&!window.confirm(`Replace your current description with this example?`)||(ew(e.id),n(e),t(!1))}let d=Object.keys(XC);return(0,G.jsx)(c_,{open:e,onOpenChange:t,children:(0,G.jsxs)(d_,{className:`flex max-w-3xl flex-col gap-0 max-h-[min(720px,calc(100vh-2rem))]`,children:[(0,G.jsxs)(f_,{className:`shrink-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Di,{className:`size-4 text-accent-300`}),(0,G.jsx)(p_,{children:`Start from an example`})]}),(0,G.jsx)(m_,{children:`Pick a template to pre-fill your description. Swap in your repo, endpoints, and specifics.`})]}),(0,G.jsxs)(h_,{className:`flex min-h-0 flex-1 flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(yi,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),(0,G.jsx)(O_,{value:o,onChange:e=>s(e.target.value),placeholder:`Search examples…`,className:`pl-9`})]}),(0,G.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-4 md:grid-cols-[180px_minmax(0,1fr)]`,children:[(0,G.jsxs)(`nav`,{className:`space-y-1 overflow-y-auto`,children:[c.length>0?(0,G.jsx)(rw,{active:i===`recent`,label:`Recent`,blurb:`Recently used`,onClick:()=>a(`recent`)}):null,d.map(e=>(0,G.jsx)(rw,{active:i===e,label:XC[e].label,blurb:XC[e].blurb,count:ZC.filter(t=>t.category===e).length,onClick:()=>a(e)},e))]}),(0,G.jsx)(`div`,{className:`min-h-0 space-y-2 overflow-y-auto pr-1`,children:l.length===0?(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/30 p-4 text-sm text-fg-muted`,children:`No examples match your search.`}):l.map(e=>(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/30 p-4 transition-colors hover:border-line-strong`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:e.preview})]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>u(e),children:`Use this`})]})},e.id))})]})]})]})})}function rw({active:e,label:t,blurb:n,count:r,onClick:i}){return(0,G.jsxs)(`button`,{type:`button`,onClick:i,className:W(`w-full rounded-lg border px-3 py-2 text-left text-sm transition-colors`,e?`border-accent-500/40 bg-accent-500/10 text-fg`:`border-transparent text-fg-muted hover:bg-overlay/50 hover:text-fg`),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:t}),r===void 0?null:(0,G.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-subtle`,children:r})]}),(0,G.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-4 text-fg-subtle`,children:n})]})}function iw({onClick:e}){return(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:e,className:`shrink-0`,children:[(0,G.jsx)(Di,{className:`size-3.5`}),`Start from an example`]})}function aw(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function ow(e,t){let n=e.match(/<brief>\s*([\s\S]*?)\s*<\/brief>/i);if(!n?.[1])return null;let r;try{r=JSON.parse(n[1].trim())}catch{return null}if(!r||typeof r!=`object`)return null;let i=r,a=typeof i.repo==`string`?i.repo.trim():``,o=typeof i.serviceName==`string`?i.serviceName.trim():``,s=typeof i.description==`string`?i.description.trim():``,c=typeof i.workflowPath==`string`?i.workflowPath.trim():``,l=i.interactive!==!1;if(!a||s.length<20||!t.includes(c))return null;let u=``;return Array.isArray(i.reviewers)?u=i.reviewers.filter(e=>typeof e==`string`&&e.trim().length>0).join(`, `):typeof i.reviewers==`string`&&(u=i.reviewers.trim()),{repo:a,serviceName:o||a.split(`/`).pop()||a,description:s,reviewers:u,workflowPath:c,interactive:l}}function sw(e,t=5){let n=[],r=[],i=new Set,a=new Set,o=[...e].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime());for(let e of o){let o=typeof e.params?.repo==`string`&&e.params.repo||typeof e.params?.repoSlug==`string`&&e.params.repoSlug||``;o&&!i.has(o)&&(i.add(o),n.push(o));let s=e.params?.reviewers;if(Array.isArray(s))for(let e of s)typeof e==`string`&&e.trim()&&!a.has(e.trim())&&(a.add(e.trim()),r.push(e.trim()));if(n.length>=t&&r.length>=t)break}return{recentRepos:n.slice(0,t),recentReviewers:r.slice(0,t)}}function cw(e,t,n,r=3){let i=t.toLowerCase().split(/\W+/).filter(e=>e.length>3);return i.length===0&&!n?[]:e.filter(e=>![`cancelled`,`canceled`].includes(e.status)).map(e=>{let t=0,r=typeof e.params?.repo==`string`&&e.params.repo||typeof e.params?.repoSlug==`string`&&e.params.repoSlug||``;n&&r===n&&(t+=5);let a=(typeof e.params?.description==`string`&&e.params.description||typeof e.params?.serviceName==`string`&&e.params.serviceName||``).toLowerCase();for(let e of i)a.includes(e)&&(t+=1);return{job:e,score:t}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score).slice(0,r).map(e=>e.job)}function lw(){let[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(null),[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)([]),c=(0,x.useRef)(null),l=(0,x.useRef)(typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`intake-${Date.now()}`),[u,d]=(0,x.useState)(0),[f,p]=(0,x.useState)(0),m=(0,x.useCallback)(()=>{c.current?.abort(),c.current=null,t(!1),s([])},[]),h=(0,x.useCallback)(async(e,n,i,o,u)=>{r(null),a(!1),t(!0),s([]),c.current?.abort();let f=new AbortController;c.current=f;let m=``,h=[],g=()=>{s([...h]),u?.([...h])};try{let t=await fetch(`/intake/stream`,{...J({sessionId:l.current,messages:e.map(e=>({role:e.role,content:e.content})),...o?.model?.trim()?{model:o.model.trim(),...o.provider?.trim()?{provider:o.provider.trim()}:{}}:{},context:{recentRepos:n.recentRepos,recentReviewers:n.recentReviewers,availableWorkflows:n.availableWorkflows.map(e=>({id:e.id,name:e.name,workflowPath:e.workflowPath,description:e.description})),userLocale:n.userLocale??navigator.language}},{method:`POST`}),signal:f.signal});if(!t.ok){let e=await t.json().catch(()=>({}));if(t.status===503||e.reason===`no-llm`)return a(!0),{assistantText:``,toolCalls:[],noLlm:!0,error:e.error??`No LLM provider configured`};throw Error(e.error??`Plan mode failed (${t.status})`)}if(!t.body)throw Error(`No response body from plan mode stream`);let r=t.body.getReader(),c=new TextDecoder,u=``,_;for(;;){let{done:e,value:t}=await r.read();if(e)break;u+=c.decode(t,{stream:!0});let n=u.split(`
63
63
 
64
64
  `);u=n.pop()??``;for(let e of n)for(let t of e.split(`
65
- `)){if(!t.startsWith(`data: `))continue;let e=t.slice(6).trim();if(!e)continue;let n;try{n=JSON.parse(e)}catch{continue}if(n.type===`token`&&n.text)m+=n.text,i(n.text);else if(n.type===`tool_start`)h.push({name:n.name,input:n.input,status:`running`}),g();else if(n.type===`tool_end`){let e=h.findLastIndex(e=>e.name===n.name&&e.status===`running`);e>=0&&(h[e]={...h[e],status:`done`,durationMs:n.durationMs,ok:n.ok,summary:n.summary,error:n.error},g())}else if(n.type===`done`)_=n.usage,n.usage?.totalTokens&&p(e=>e+n.usage.totalTokens);else if(n.type===`error`){if(n.reason===`no-llm`)return a(!0),{assistantText:m,toolCalls:h,noLlm:!0,error:n.message};throw Error(n.message)}}}return d(e=>e+1),s([]),{assistantText:m,toolCalls:h,usage:_}}catch(e){if(e.name===`AbortError`)return{assistantText:m,toolCalls:h,error:`Cancelled`};let t=e instanceof Error?e.message:String(e);return r(t),{assistantText:m,toolCalls:h,error:t}}finally{t(!1),c.current=null}},[]);return{streaming:e,error:n,noLlm:i,turnCount:u,totalTokens:f,activeToolCalls:o,sessionId:l.current,send:h,cancel:m}}var hw=8,gw=`Hi — tell me what you'd like Coro to work on. I'll ask a few questions if needed, then propose a run brief you can edit before dispatching.`;function _w({workflows:e,jobs:t,initialPlan:n,onPlanChange:r,onDispatched:i,onUseForm:a,onNoLlm:o}){let s=nt(),[c,l]=(0,x.useState)(()=>n?.messages?.length?n.messages:[{role:`assistant`,content:gw}]),[u,d]=(0,x.useState)(``),[f,p]=(0,x.useState)(``),[m,h]=(0,x.useState)([]),[g,_]=(0,x.useState)(()=>n?.brief??null),[v,y]=(0,x.useState)(!1),[b,S]=(0,x.useState)(null),[C,w]=(0,x.useState)(()=>n?.modelChoice??{provider:``,model:``}),T=(0,x.useRef)(null),E=(0,x.useMemo)(()=>c.filter(e=>e.role===`user`).length,[c]),{providers:D}=fC(),{modelsByProvider:O,loadModels:k}=pC();(0,x.useEffect)(()=>{r?.({messages:c,brief:g,modelChoice:C})},[c,g,C,r]),(0,x.useEffect)(()=>{q(`/config`).then(e=>{let t=e.config?.llm?.aliases?.[`tier:planning`]??e.config?.llm?.aliases?.planning;t?.model&&w(e=>e.model?e:{provider:t.provider??``,model:t.model})})},[]);let A=(0,x.useMemo)(()=>fw(t),[t]),j=(0,x.useMemo)(()=>pw(t,u||c.filter(e=>e.role===`user`).map(e=>e.content).join(` `),g?.repo),[t,u,c,g?.repo]),{streaming:M,error:N,noLlm:ee,turnCount:te,totalTokens:P,send:F,cancel:I}=mw();(0,x.useEffect)(()=>{ee&&o()},[ee,o]),(0,x.useEffect)(()=>{T.current?.scrollTo({top:T.current.scrollHeight,behavior:`smooth`})},[c,f]);let ne=(0,x.useMemo)(()=>e.map(e=>e.workflowPath),[e]),re=(0,x.useCallback)(async(t,n=!1)=>{let r=t.trim();if(!r&&!n)return;let i=[...c,...r?[{role:`user`,content:r}]:[]];n&&r&&i.push({role:`user`,content:`Please emit your best <brief> now with what we have so far.`}),l(i),d(``),p(``),h([]),_(null);let a=await F(i,{recentRepos:A.recentRepos,recentReviewers:A.recentReviewers,availableWorkflows:e,userLocale:navigator.language},e=>p(t=>t+e),C.model?C:void 0,h);if(a.noLlm)return;let o=(a.assistantText||f).trim();(o||a.toolCalls.length>0)&&l(e=>[...e,{role:`assistant`,content:o,...a.toolCalls.length>0?{toolCalls:a.toolCalls}:{}}]),p(``),h([]);let s=dw(o,ne);s?_(s):E+1>=hw&&S(`We could not get to a clean brief. Try the form with your description prefilled.`)},[c,F,A,e,ne,f,E,C]);async function ie(){if(g){y(!0),S(null);try{let e=await q(`/jobs`,J({type:`job`,workflowPath:g.workflowPath,repo:g.repo.trim(),serviceName:g.serviceName.trim(),description:g.description.trim(),reviewers:uw(g.reviewers),interactive:g.interactive},{method:`POST`}));i?.(),s(`/jobs/${e.jobId}`)}catch(e){S((e instanceof K,e.message)),y(!1)}}}return(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]`,children:[(0,G.jsxs)(`div`,{className:`flex min-h-[480px] flex-col rounded-2xl border border-line bg-overlay/30`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,G.jsx)(Di,{className:`size-4 text-accent-300`}),`Coro plan mode`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-fg-subtle`,children:[(0,G.jsxs)(`span`,{children:[te,` turns · `,P.toLocaleString(),` tokens`]}),(0,G.jsx)(`button`,{type:`button`,className:`text-accent-300 hover:underline`,onClick:a,children:`Use the form instead`})]})]}),(0,G.jsxs)(`div`,{ref:T,className:`flex-1 space-y-3 overflow-y-auto p-4`,children:[c.map((e,t)=>(0,G.jsxs)(`div`,{className:`space-y-1`,children:[e.content?(0,G.jsx)(Ew,{role:e.role,content:e.content}):null,e.toolCalls?.length?(0,G.jsx)(Cw,{calls:e.toolCalls,collapsed:!M}):null]},t)),f||m.length>0?(0,G.jsxs)(`div`,{className:`space-y-1`,children:[f?(0,G.jsx)(Ew,{role:`assistant`,content:f,streaming:M}):null,m.length>0?(0,G.jsx)(Cw,{calls:m,collapsed:!1}):null]}):null,M&&!f&&m.length===0?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,G.jsx)($r,{className:`size-3 animate-spin`}),`Thinking…`]}):null,N?(0,G.jsxs)(`div`,{className:`rounded-xl border border-danger-500/30 bg-danger-500/10 p-3 text-sm text-danger-200`,children:[N,(0,G.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>void re(u),children:`Retry`}),(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`outline`,onClick:a,children:`Use the form`})]})]}):null]}),(0,G.jsxs)(`div`,{className:`border-t border-line p-4`,children:[(0,G.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),re(u)},className:`flex items-end gap-2`,children:[(0,G.jsx)(Dw,{value:u,onChange:d,onSubmit:()=>void re(u),placeholder:`Describe what you want Coro to do… (Shift+Enter for a new line)`,disabled:M}),(0,G.jsx)(Y,{type:`submit`,disabled:M||!u.trim(),children:(0,G.jsx)(bi,{})})]}),(0,G.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,G.jsx)(vw,{value:C,onChange:w,providers:D,modelsByProvider:O,loadModels:k,disabled:M}),(0,G.jsxs)(`div`,{className:`flex items-center`,children:[(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,disabled:M,onClick:()=>void re(u,!0),children:`Force brief now`}),M?(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:I,children:`Stop`}):null]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-4 lg:sticky lg:top-6 lg:self-start`,children:[j.length>0?(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wider text-fg-subtle`,children:`Similar past runs`}),(0,G.jsx)(`ul`,{className:`mt-2 space-y-2`,children:j.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,className:`w-full rounded-lg border border-line bg-overlay/40 px-3 py-2 text-left text-xs hover:border-line-strong`,onClick:()=>s(`/jobs/${e.id}`),children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:typeof e.params?.serviceName==`string`?e.params.serviceName:e.id}),(0,G.jsx)(`div`,{className:`text-fg-muted`,children:e.status})]})},e.id))})]}):null,g?(0,G.jsx)(Ow,{brief:g,workflows:e,onChange:_,onSubmit:()=>void ie(),submitting:v,error:b}):(0,G.jsx)(`div`,{className:`rounded-2xl border border-dashed border-line bg-overlay/20 p-5 text-sm text-fg-muted`,children:`Your brief will appear here once we have the basics.`})]})]})}function vw({value:e,onChange:t,providers:n,modelsByProvider:r,loadModels:i,disabled:a=!1}){return(0,x.useEffect)(()=>{for(let e of n)i(e.id)},[n.map(e=>e.id).join(`|`)]),(0,G.jsxs)(Jh,{children:[(0,G.jsx)(Yh,{asChild:!0,disabled:a,children:(0,G.jsxs)(`button`,{type:`button`,className:`text-[11px] text-fg-subtle transition-colors hover:text-fg-muted disabled:opacity-50`,children:[`Model: `,(0,G.jsx)(`span`,{className:`font-mono text-fg-muted`,children:(0,x.useMemo)(()=>e.model?nC(r,e.provider,e.model)?.displayName??e.model:`Planning tier default`,[e,r])})]})}),(0,G.jsx)(Zh,{align:`start`,className:`max-h-72 overflow-y-auto`,children:n.map((n,i)=>{let a=r[n.id];return a?.length?(0,G.jsxs)(`div`,{children:[i>0?(0,G.jsx)(eg,{}):null,(0,G.jsx)($h,{children:n.displayName}),a.map(r=>{let i=e.provider===n.id&&e.model===r.id;return(0,G.jsxs)(Qh,{onClick:()=>t({provider:n.id,model:r.id}),children:[(0,G.jsx)(`span`,{className:W(i&&`text-accent-300`),children:r.displayName}),i?(0,G.jsx)(cr,{className:`ml-auto size-3.5 text-accent-300`}):null]},`${n.id}:${r.id}`)})]},n.id):null})})]})}var yw=/<brief>[\s\S]*?<\/brief>/gi,bw=[`Brief's ready — give it a once-over on the right and dispatch when you're happy.`,`Drafted a brief for you. Take a look on the right and tweak anything before sending it off.`,`Brief is on the right. Edit anything that feels off, then dispatch the run.`];function xw(e,t){return e!==`assistant`||!yw.test(t)?t:(yw.lastIndex=0,t.replace(yw,``).trim()||bw[Math.abs(Sw(t))%bw.length])}function Sw(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}function Cw({calls:e,collapsed:t}){let[n,r]=(0,x.useState)(!1),i=e.filter(e=>e.status===`done`).length,a=e.find(e=>e.status===`running`);return t&&!n?(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(!0),className:`ml-1 text-[11px] text-fg-subtle hover:text-fg-muted`,children:a?ww(a):`Read ${i} item${i===1?``:`s`}`}):(0,G.jsxs)(`div`,{className:`ml-1 space-y-1`,children:[e.map((e,t)=>(0,G.jsx)(Tw,{call:e},`${e.name}-${t}`)),t?(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(!1),className:`text-[11px] text-fg-subtle hover:text-fg-muted`,children:`Hide`}):null]})}function ww(e){let t=e.input&&typeof e.input==`object`&&`key`in e.input?String(e.input.key):e.input&&typeof e.input==`object`&&`path`in e.input?String(e.input.path):null;switch(e.name){case`tracker_get_issue`:return t?`Coro is reading ${t}…`:`Coro is reading a ticket…`;case`tracker_search_issues`:return`Coro is searching tickets…`;case`scm_read_file`:return t?`Coro is reading ${t}…`:`Coro is reading a file…`;case`scm_search_code`:return`Coro is searching code…`;default:return`Coro is working…`}}function Tw({call:e}){let[t,n]=(0,x.useState)(!1),r=e.status===`running`?ww(e):e.summary??e.name;return(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:W(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5`,e.status===`running`?`border-line bg-overlay/40`:e.ok===!1?`border-danger-500/30 bg-danger-500/10 text-danger-200`:`border-line bg-overlay/20 hover:bg-overlay/40`),children:[e.status===`running`?(0,G.jsx)($r,{className:`size-3 animate-spin`}):null,(0,G.jsx)(`span`,{children:r})]}),t?(0,G.jsx)(`pre`,{className:`mt-1 max-h-40 overflow-auto rounded-lg border border-line bg-canvas/80 p-2 text-[10px] text-fg-muted`,children:JSON.stringify(e.input??e.error??e.summary,null,2)}):null]})}function Ew({role:e,content:t,streaming:n=!1}){let r=xw(e,t);return(0,G.jsx)(`div`,{className:W(`flex`,e===`user`?`justify-end`:`justify-start`),children:(0,G.jsx)(`div`,{className:W(`max-w-[85%] whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed`,e===`user`?`bg-accent-500/15 text-fg`:`border border-line bg-canvas/60 text-fg-muted`,n&&`animate-pulse`),children:r})})}function Dw({value:e,onChange:t,onSubmit:n,placeholder:r,disabled:i}){let a=(0,x.useRef)(null);return(0,x.useEffect)(()=>{let e=a.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,144)}px`)},[e]),(0,G.jsx)(`textarea`,{ref:a,rows:1,value:e,onChange:e=>t(e.target.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&!t.nativeEvent.isComposing&&(t.preventDefault(),!i&&e.trim()&&n())},placeholder:r,disabled:i,className:`flex-1 resize-none rounded-xl border border-line-strong bg-overlay px-3.5 py-2.5 text-sm leading-6 text-fg shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60 disabled:cursor-not-allowed disabled:opacity-50`})}function Ow({brief:e,workflows:t,onChange:n,onSubmit:r,submitting:i,error:a}){let o=t.find(t=>t.workflowPath===e.workflowPath);return(0,G.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-accent-500/30 bg-accent-500/5 p-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:`Run brief`}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:`Edit anything before dispatching.`})]}),(0,G.jsx)(Sv,{label:`Repository`,required:!0,children:(0,G.jsx)(O_,{value:e.repo,onChange:t=>n({...e,repo:t.target.value})})}),(0,G.jsx)(Sv,{label:`Service name`,required:!0,children:(0,G.jsx)(O_,{value:e.serviceName,onChange:t=>n({...e,serviceName:t.target.value})})}),(0,G.jsx)(Sv,{label:`Description`,required:!0,children:(0,G.jsx)(bb,{rows:5,value:e.description,onChange:t=>n({...e,description:t.target.value})})}),(0,G.jsx)(Sv,{label:`Reviewers`,children:(0,G.jsx)(O_,{value:e.reviewers,onChange:t=>n({...e,reviewers:t.target.value}),placeholder:`alice, bob`})}),(0,G.jsx)(Sv,{label:`Workflow`,children:(0,G.jsx)(`select`,{className:`w-full rounded-lg border border-line bg-overlay/40 px-3 py-2 text-sm`,value:e.workflowPath,onChange:t=>n({...e,workflowPath:t.target.value}),children:t.map(e=>(0,G.jsx)(`option`,{value:e.workflowPath,children:e.name},e.id))})}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:e.interactive,onChange:t=>n({...e,interactive:t.target.checked})}),`Interactive (pause at checkpoints)`]}),a?(0,G.jsx)(`div`,{className:`text-sm text-danger-300`,children:a}):null,(0,G.jsxs)(Y,{type:`button`,className:`w-full`,disabled:i,onClick:r,children:[i?(0,G.jsx)($r,{className:`animate-spin`}):null,i?`Starting run…`:`Start this run`]}),o?(0,G.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:o.description}):null]})}function kw(){let e=nt(),{jobs:t}=Eo(3e4),{closeTab:n}=wo(),r=(0,x.useRef)(null),[i,a]=bo(go,_o),o=(0,x.useCallback)(e=>{a(t=>({...t,...e}))},[a]),s=(0,x.useCallback)(()=>{yo(),a(_o),n(`/jobs/new`)},[a,n]),{mode:c,serviceName:l,repo:u,description:d,reviewers:f,ticketId:p,interactive:m,workflowId:h,scmId:g,trackerId:_}=i;To((0,x.useMemo)(()=>vo(i),[i])?{id:`new-run`,kind:`run`,path:`/jobs/new`,title:`New run`,subtitle:c===`ticket`?p.trim()||`Ticket`:l.trim()||u.trim()||`Draft`}:null);let[v,y]=(0,x.useState)(!0),[b,S]=(0,x.useState)(null),[C,w]=(0,x.useState)(null),[T,E]=(0,x.useState)(()=>{let e=gy();return e===`ai`||e===`form`?e:null}),[D,O]=(0,x.useState)(!1),[k,A]=(0,x.useState)([fo]),[j,M]=(0,x.useState)(!1),[N,ee]=(0,x.useState)(null),te=k.find(e=>e.id===h)??k[0]??fo,P=(0,x.useMemo)(()=>fw(t),[t]),F=uy(b??void 0),I=b?.enabled!==!1;(0,x.useEffect)(()=>{F&&M(!0)},[F]),(0,x.useEffect)(()=>{q(`/config`).then(e=>{S(e.config?.coachMode??null),w(py(e.config?.intake,e.config?.coachMode))}).catch(()=>w(`form`))},[]);let ne=C===`ask-each-time`?vy():null,re=C===`ask-each-time`&&!T&&!ne,ie=(T??ne??(C===`ai`?`ai`:`form`))===`ai`,[L,R]=(0,x.useState)(!1);(0,x.useEffect)(()=>{!L&&b!==null&&(o({interactive:I&&F}),R(!0))},[b,I,F,L,o]);let[ae,oe]=(0,x.useState)([]),[se,ce]=(0,x.useState)([]),[le,ue]=(0,x.useState)(!1),[de,fe]=(0,x.useState)(!1),[pe,me]=(0,x.useState)(null);(0,x.useEffect)(()=>{(async()=>{try{let e=await po();e.length>0&&(A(e),a(t=>{if(e.some(e=>e.id===t.workflowId))return t;let n=e.find(e=>e.id===`job`);return{...t,workflowId:(n??e[0]).id}}))}catch{}finally{y(!1)}})()},[]),(0,x.useEffect)(()=>{(async()=>{try{let e=await q(`/plugins`),t=e=>e.active??e.configured??e.installed??!1,n=e.plugins.filter(e=>e.manifest.kind===`scm`&&t(e)).map(e=>e.manifest),r=e.plugins.filter(e=>e.manifest.kind===`tracker`&&t(e)).map(e=>e.manifest);oe(n),ce(r),a(t=>({...t,scmId:t.scmId||e.defaults.scm||(n.length===1?n[0].id:``),trackerId:t.trackerId||e.defaults.tracker||(r.length===1?r[0].id:``)}))}catch{}finally{ue(!0)}})()},[]);let he=(0,x.useMemo)(()=>le?c===`manual`&&ae.length===0?`Connect a source-control provider in Settings → Source control before dispatching a manual run.`:c===`ticket`&&se.length===0?`Connect an issue tracker in Settings → Issue tracker before dispatching a ticket-driven run.`:null:null,[c,le,ae.length,se.length]),ge=(0,x.useMemo)(()=>he?!1:c===`manual`?!!(l.trim()&&u.trim()&&d.trim()):!!p.trim(),[he,c,l,u,d,p]);async function _e(t){if(!ge||de)return;me(null),fe(!0);let n={};g&&(n.scm=g),_&&(n.tracker=_);let r=c===`ticket`?{type:`job`,workflowPath:te.workflowPath,jiraTicketId:p.trim(),interactive:t,...Object.keys(n).length?{params:n}:{}}:{type:`job`,workflowPath:te.workflowPath,repo:u.trim(),serviceName:l.trim(),description:d.trim(),reviewers:f.split(`,`).map(e=>e.trim()).filter(Boolean),interactive:t,...Object.keys(n).length?{params:n}:{}};try{let t=await q(`/jobs`,J(r,{method:`POST`}));s(),e(`/jobs/${t.jobId}`)}catch(e){me((e instanceof K,e.message)),fe(!1)}}function ve(e){if(o({mode:e.mode}),e.description&&(o({description:e.description}),requestAnimationFrame(()=>{let t=r.current;if(!t)return;t.focus();let n=ow(e.description);n&&t.setSelectionRange(n.start,n.end)})),e.suggestedWorkflow){let t=k.find(t=>t.workflowPath===e.suggestedWorkflow);t&&o({workflowId:t.id})}}let ye=(0,x.useCallback)(e=>{a(t=>({...t,plan:e}))},[a]),be=(0,x.useMemo)(()=>d.length<=20||/\/|\.|should|must/i.test(d)?null:`Add a file path or acceptance criterion to help Coro plan.`,[d]);return re&&C!==null?(0,G.jsx)(vv,{children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-6 pb-32`,children:[(0,G.jsx)(cg,{title:`New run`,description:`How would you like to describe this run?`,actions:(0,G.jsxs)(Y,{variant:`outline`,onClick:()=>e(`/jobs`),children:[(0,G.jsx)(nr,{}),`Back`]})}),(0,G.jsx)(Aw,{onChoose:e=>{yy(e),E(e)}})]})}):ie&&C!==null?(0,G.jsx)(vv,{children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-6 pb-32`,children:[(0,G.jsx)(cg,{title:`New run`,description:`Coro plan mode — describe your goal in conversation and review a brief before dispatching.`,actions:(0,G.jsxs)(Y,{variant:`outline`,onClick:()=>e(`/jobs`),children:[(0,G.jsx)(nr,{}),`Back`]})}),F?(0,G.jsx)(jw,{}):null,(0,G.jsx)(_w,{workflows:k,jobs:t,initialPlan:i.plan,onPlanChange:ye,onDispatched:s,onUseForm:()=>{_y(`form`),E(`form`)},onNoLlm:()=>{_y(`form`),E(`form`)}})]})}):(0,G.jsx)(vv,{children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-6 pb-32`,children:[(0,G.jsx)(cg,{title:`New run`,actions:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C===`ai`||I?(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{_y(`ai`),E(`ai`)},children:`Try Coro plan mode`}):null,(0,G.jsxs)(Y,{variant:`outline`,onClick:()=>e(`/jobs`),children:[(0,G.jsx)(nr,{}),`Back`]})]})}),F?(0,G.jsx)(jw,{}):null,he?(0,G.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-warning-500/30 bg-warning-500/8 p-4`,children:[(0,G.jsx)(Mi,{className:`mt-0.5 size-4 shrink-0 text-warning-300`}),(0,G.jsxs)(`div`,{className:`flex-1 text-sm text-warning-200`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:`Setup needed`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-warning-200/85`,children:he})]}),(0,G.jsx)(Y,{asChild:!0,size:`sm`,variant:`outline`,children:(0,G.jsxs)(Dn,{to:`/settings#source-control`,children:[(0,G.jsx)(Ci,{}),`Open settings`]})})]}):null,(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[minmax(0,2fr)_minmax(280px,1fr)]`,children:[(0,G.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),_e(I&&F?!0:m)},className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`header`,{children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`How would you like to start?`}),(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Pick whichever feels most natural — both end in a pull request.`})]}),(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,G.jsx)(Mw,{icon:si,title:`Describe what to build`,description:`Free-form prompt. Best for ad-hoc work or quick experiments.`,selected:c===`manual`,onSelect:()=>o({mode:`manual`})}),(0,G.jsx)(Mw,{icon:Ai,title:`From a tracker ticket`,description:`Coro pulls the title, description, and acceptance criteria from your tracker.`,selected:c===`ticket`,onSelect:()=>o({mode:`ticket`}),disabled:se.length===0,disabledHint:`Connect a tracker in Settings to use this mode.`})]})]}),(0,G.jsx)(`section`,{className:`space-y-4 rounded-2xl border border-line bg-overlay/30 p-5`,children:c===`manual`?(0,G.jsx)(Nw,{repo:u,setRepo:e=>o({repo:e}),serviceName:l,setServiceName:e=>o({serviceName:e}),description:d,setDescription:e=>o({description:e}),reviewers:f,setReviewers:e=>o({reviewers:e}),scmPlugins:ae,scmId:g,setScmId:e=>o({scmId:e}),recentRepos:P.recentRepos,recentReviewers:P.recentReviewers,descriptionRef:r,specificityHint:be,onOpenExamples:()=>O(!0)}):(0,G.jsx)(Pw,{ticketId:p,setTicketId:e=>o({ticketId:e}),trackerPlugins:se,trackerId:_,setTrackerId:e=>o({trackerId:e})})}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsx)(`header`,{children:(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Run options`})}),(0,G.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-between gap-4 rounded-2xl border border-line bg-overlay/30 p-4 transition-colors hover:border-line-strong`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Interactive checkpoints`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:`When on, Coro pauses at every workflow checkpoint for your approval.`})]}),(0,G.jsx)(Ax,{checked:m,onCheckedChange:e=>o({interactive:e}),"aria-label":`Interactive mode`})]})]}),(0,G.jsxs)(`section`,{className:`rounded-2xl border border-line bg-overlay/30`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>M(e=>!e),className:`flex w-full items-center justify-between gap-3 px-5 py-3 text-left transition-colors hover:bg-overlay/50`,"aria-expanded":j,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:`Advanced`}),(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Pick a workflow other than the default. Custom workflows added to your intelligence overlay show up here.`})]}),(0,G.jsx)(lr,{className:W(`size-4 shrink-0 text-fg-muted transition-transform`,j&&`rotate-180`)})]}),j?(0,G.jsx)(`div`,{className:`border-t border-line px-5 py-4 space-y-4`,children:(0,G.jsx)(Sv,{label:`Workflow`,hint:`The phase definition Coro will execute. The default fits most ad-hoc work.`,children:(0,G.jsx)(`div`,{className:`space-y-2`,children:k.map(e=>{let t=e.id===h;return(0,G.jsxs)(`div`,{className:W(`group flex items-start gap-3 rounded-xl border px-3 py-2.5 transition-colors`,t?`border-accent-500/50 bg-accent-500/10`:`border-line bg-overlay/40 hover:border-line-strong`),children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>o({workflowId:e.id}),className:`flex flex-1 items-start gap-3 text-left`,children:[(0,G.jsx)(`span`,{className:W(`mt-0.5 inline-flex size-7 shrink-0 items-center justify-center rounded-lg ring-1`,t?`bg-accent-500/20 ring-accent-500/40 text-accent-200`:`bg-overlay/60 ring-line text-fg-muted`),children:(0,G.jsx)(B,{className:`size-3.5`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.layer?(0,G.jsx)(JC,{layer:e.layer,overrides:e.overrides,size:`sm`}):null,(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-fg-subtle`,children:e.workflowPath}),e.phases?(0,G.jsxs)(`span`,{className:`text-[10px] text-fg-subtle`,children:[`· `,e.phases.length,` phase`,e.phases.length===1?``:`s`]}):null]}),e.description?(0,G.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-fg-muted`,children:e.description}):null]})]}),(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>ee(e),className:`shrink-0`,children:[(0,G.jsx)(qr,{}),`Details`]})]},e.id)})})})}):null]}),pe?(0,G.jsx)(`div`,{className:`rounded-2xl border border-danger-500/30 bg-danger-500/10 p-4 text-sm text-danger-200`,children:pe}):null]}),(0,G.jsx)(`div`,{className:`hidden lg:block`,children:(0,G.jsx)(`div`,{className:`sticky top-6`,children:(0,G.jsx)($C,{workflow:te,interactive:m,mode:c,serviceName:l,repo:u,ticketId:p,formValid:ge,loading:v})})})]}),(0,G.jsx)(`div`,{className:`lg:hidden`,children:(0,G.jsxs)(`details`,{className:`rounded-2xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:`What will happen?`}),(0,G.jsx)(`div`,{className:`mt-4`,children:(0,G.jsx)($C,{workflow:te,interactive:m,mode:c,serviceName:l,repo:u,ticketId:p,formValid:ge,loading:v})})]})}),(0,G.jsxs)(`div`,{className:`fixed inset-x-0 bottom-0 z-30 border-t border-line bg-canvas/85 backdrop-blur supports-[backdrop-filter]:bg-canvas/70`,children:[(0,G.jsxs)(`div`,{className:`mx-auto flex max-w-6xl flex-wrap items-center justify-between gap-4 px-6 py-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 text-xs text-fg-muted`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:te.name}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>ee(te),className:`inline-flex items-center gap-1 rounded text-[11px] text-fg-subtle transition-colors hover:text-accent-200`,children:[(0,G.jsx)(qr,{className:`size-3`}),`Details`]})]}),(0,G.jsx)(`div`,{className:`truncate`,children:c===`manual`?l.trim()||`Add a service name and prompt to dispatch`:p.trim()||`Enter a tracker ticket to dispatch`})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:I&&F?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{type:`button`,size:`lg`,disabled:!ge||de,onClick:()=>void _e(!0),children:[de?(0,G.jsx)($r,{className:`animate-spin`}):null,`Interactive`,de?null:(0,G.jsx)(rr,{})]}),(0,G.jsx)(Y,{type:`button`,size:`lg`,variant:`secondary`,disabled:!ge||de,onClick:()=>void _e(!1),children:`Autonomous`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{type:`button`,size:`lg`,disabled:!ge||de,onClick:()=>void _e(!0),variant:`secondary`,children:`Interactive`}),(0,G.jsxs)(Y,{type:`button`,size:`lg`,disabled:!ge||de,onClick:()=>void _e(!1),children:[de?(0,G.jsx)($r,{className:`animate-spin`}):null,de?`Dispatching…`:`Autonomous`,de?null:(0,G.jsx)(rr,{})]})]})})]}),(0,G.jsx)(`p`,{className:`mx-auto max-w-6xl px-6 pb-2 text-[10px] text-fg-subtle`,children:`Interactive: Coro pauses at every checkpoint for approval. You can switch to Autonomous mid-run.`})]}),(0,G.jsx)(sw,{open:D,onOpenChange:O,onSelect:ve,hasExistingDescription:!!d.trim()}),(0,G.jsx)(ZC,{workflow:N,open:N!==null,onOpenChange:e=>{e||ee(null)}})]})})}function Aw({onChoose:e}){return(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>e(`ai`),className:`rounded-2xl border border-border bg-surface p-6 text-left transition hover:border-accent-500/40 hover:bg-accent-500/5`,children:[(0,G.jsx)(`div`,{className:`text-[15px] font-semibold text-fg`,children:`Coro plan mode`}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:`Talk through your goal with Coro. It asks clarifying questions and proposes a brief you can edit before dispatching.`})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>e(`form`),className:`rounded-2xl border border-border bg-surface p-6 text-left transition hover:border-accent-500/40 hover:bg-accent-500/5`,children:[(0,G.jsx)(`div`,{className:`text-[15px] font-semibold text-fg`,children:`Use the form`}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:`Fill in repo, description, and reviewers directly — with previews, examples, and coach-mode guidance.`})]})]})}function jw(){return(0,G.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-accent-500/25 bg-accent-500/8 p-4 text-sm text-fg-muted`,children:[(0,G.jsx)(qr,{className:`mt-0.5 size-4 shrink-0 text-accent-300`}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:`Coach mode is on.`}),` Coro will pause at every workflow checkpoint so you can review. Turn this off in`,` `,(0,G.jsx)(Dn,{to:`/settings#general`,className:`text-accent-300 hover:underline`,children:`Settings`}),` `,`or per-run below.`]})]})}function Mw({icon:e,title:t,description:n,selected:r,onSelect:i,disabled:a,disabledHint:o}){return(0,G.jsxs)(`button`,{type:`button`,onClick:a?void 0:i,disabled:a,className:W(`group relative overflow-hidden rounded-2xl border p-4 text-left transition-all`,r?`border-accent-500/50 bg-accent-500/10 shadow-[0_0_0_1px_rgba(97,114,255,0.3)]`:`border-line bg-overlay/40 hover:border-line-strong hover:bg-overlay/60`,a&&`cursor-not-allowed opacity-50`),title:a?o:void 0,children:[(0,G.jsx)(`span`,{className:W(`inline-flex size-9 items-center justify-center rounded-xl ring-1 transition-colors`,r?`bg-accent-500/20 ring-accent-500/40 text-accent-200`:`bg-overlay/60 ring-line text-fg-muted group-hover:text-fg`),children:(0,G.jsx)(e,{className:`size-4`})}),(0,G.jsx)(`div`,{className:`mt-3 text-sm font-medium text-fg`,children:t}),(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:n})]})}function Nw(e){return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsx)(Sv,{label:`Service name`,required:!0,hint:`Used as a label across runs.`,tooltip:`A short human-readable name shown on the Runs list and run detail header.`,children:(0,G.jsx)(O_,{value:e.serviceName,onChange:t=>e.setServiceName(t.target.value),placeholder:`Billing API`,required:!0})}),(0,G.jsxs)(Sv,{label:`Repository`,required:!0,hint:`owner/repo or workspace/repo, depending on your provider.`,tooltip:`The repo Coro clones to implement your change. Must match your SCM provider's slug format.`,children:[(0,G.jsx)(O_,{value:e.repo,onChange:t=>e.setRepo(t.target.value),placeholder:`my-org/billing-api`,required:!0}),e.recentRepos.length>0?(0,G.jsx)(Fw,{label:`Recent`,items:e.recentRepos,onPick:e.setRepo}):null]})]}),(0,G.jsxs)(Sv,{label:`What should Coro build?`,required:!0,hint:`Be specific. Coro's planner reads this verbatim — include the goal, constraints, and any acceptance criteria.`,tooltip:`This becomes the primary input for spec-writing and planning. Mention files, endpoints, and acceptance criteria when you can.`,action:(0,G.jsx)(lw,{onClick:e.onOpenExamples}),children:[(0,G.jsx)(bb,{ref:e.descriptionRef,value:e.description,onChange:t=>e.setDescription(t.target.value),rows:6,placeholder:`Add rate limiting to /api/users. Use the existing token bucket utility, and return clear retry-after headers when a caller exceeds the limit.`,required:!0}),(0,G.jsxs)(`div`,{className:`mt-1 flex justify-between text-[11px] text-fg-subtle`,children:[(0,G.jsx)(`span`,{children:e.specificityHint??`\xA0`}),(0,G.jsxs)(`span`,{children:[e.description.length,` chars`]})]})]}),(0,G.jsxs)(Sv,{label:`Reviewers`,hint:`Optional. Comma-separated usernames. They'll be added to the resulting pull request.`,tooltip:`Usernames on your git host who should review the PR Coro opens.`,children:[(0,G.jsx)(O_,{value:e.reviewers,onChange:t=>e.setReviewers(t.target.value),placeholder:`alice, bob`}),e.recentReviewers.length>0?(0,G.jsx)(Fw,{label:`Recent`,items:e.recentReviewers,onPick:t=>{let n=e.reviewers.split(`,`).map(e=>e.trim()).filter(Boolean);n.includes(t)||e.setReviewers([...n,t].join(`, `))}}):null]}),e.scmPlugins.length>1?(0,G.jsx)(Sv,{label:`Source control`,hint:`Multiple SCM providers are configured. Choose one for this run.`,children:(0,G.jsx)(Iw,{options:e.scmPlugins,value:e.scmId,onChange:e.setScmId})}):null]})}function Pw(e){return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Sv,{label:`Ticket ID`,required:!0,hint:`Tracker-specific issue key (Jira: ENG-1234, Linear: ENG-12, GitHub Issues: 42).`,children:(0,G.jsx)(O_,{value:e.ticketId,onChange:t=>e.setTicketId(t.target.value),placeholder:`ENG-1234`,required:!0,autoFocus:!0})}),e.trackerPlugins.length>1?(0,G.jsx)(Sv,{label:`Issue tracker`,hint:`Multiple trackers are configured. Choose one for this run.`,children:(0,G.jsx)(Iw,{options:e.trackerPlugins,value:e.trackerId,onChange:e.setTrackerId})}):null]})}function Fw({label:e,items:t,onPick:n}){return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-[11px] text-fg-subtle`,children:[(0,G.jsxs)(`span`,{className:`text-fg-subtle/80`,children:[e,`:`]}),t.map((e,r)=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`rounded text-fg-muted underline-offset-2 transition-colors hover:text-accent-200 hover:underline`,children:e}),r<t.length-1?(0,G.jsx)(`span`,{"aria-hidden":!0,className:`text-fg-subtle/60`,children:`·`}):null]},e))]})}function Iw({options:e,value:t,onChange:n}){return(0,G.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:e.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e.id),className:W(`rounded-xl border px-3 py-2.5 text-left text-sm transition-colors`,e.id===t?`border-accent-500/50 bg-accent-500/10 text-fg`:`border-line bg-overlay/40 text-fg-muted hover:border-line-strong`),children:e.displayName},e.id))})}function Lw(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function Rw(e,t){let n=zw(e.replace(/\r\n/g,`
65
+ `)){if(!t.startsWith(`data: `))continue;let e=t.slice(6).trim();if(!e)continue;let n;try{n=JSON.parse(e)}catch{continue}if(n.type===`token`&&n.text)m+=n.text,i(n.text);else if(n.type===`tool_start`)h.push({name:n.name,input:n.input,status:`running`}),g();else if(n.type===`tool_end`){let e=h.findLastIndex(e=>e.name===n.name&&e.status===`running`);e>=0&&(h[e]={...h[e],status:`done`,durationMs:n.durationMs,ok:n.ok,summary:n.summary,error:n.error},g())}else if(n.type===`done`)_=n.usage,n.usage?.totalTokens&&p(e=>e+n.usage.totalTokens);else if(n.type===`error`){if(n.reason===`no-llm`)return a(!0),{assistantText:m,toolCalls:h,noLlm:!0,error:n.message};throw Error(n.message)}}}return d(e=>e+1),s([]),{assistantText:m,toolCalls:h,usage:_}}catch(e){if(e.name===`AbortError`)return{assistantText:m,toolCalls:h,error:`Cancelled`};let t=e instanceof Error?e.message:String(e);return r(t),{assistantText:m,toolCalls:h,error:t}}finally{t(!1),c.current=null}},[]);return{streaming:e,error:n,noLlm:i,turnCount:u,totalTokens:f,activeToolCalls:o,sessionId:l.current,send:h,cancel:m}}var uw=8,dw=`Hi — tell me what you'd like Coro to work on. I'll ask a few questions if needed, then propose a run brief you can edit before dispatching.`;function fw({workflows:e,jobs:t,initialPlan:n,onPlanChange:r,onDispatched:i,onUseForm:a,onNoLlm:o}){let s=nt(),[c,l]=(0,x.useState)(()=>n?.messages?.length?n.messages:[{role:`assistant`,content:dw}]),[u,d]=(0,x.useState)(``),[f,p]=(0,x.useState)(``),[m,h]=(0,x.useState)([]),[g,_]=(0,x.useState)(()=>n?.brief??null),[v,y]=(0,x.useState)(!1),[b,S]=(0,x.useState)(null),[C,w]=(0,x.useState)(()=>n?.modelChoice??{provider:``,model:``}),T=(0,x.useRef)(null),E=(0,x.useMemo)(()=>c.filter(e=>e.role===`user`).length,[c]),{providers:D}=lC(),{modelsByProvider:O,loadModels:k}=uC();(0,x.useEffect)(()=>{r?.({messages:c,brief:g,modelChoice:C})},[c,g,C,r]),(0,x.useEffect)(()=>{q(`/config`).then(e=>{let t=e.config?.llm?.aliases?.[`tier:planning`]??e.config?.llm?.aliases?.planning;t?.model&&w(e=>e.model?e:{provider:t.provider??``,model:t.model})})},[]);let A=(0,x.useMemo)(()=>sw(t),[t]),j=(0,x.useMemo)(()=>cw(t,u||c.filter(e=>e.role===`user`).map(e=>e.content).join(` `),g?.repo),[t,u,c,g?.repo]),{streaming:M,error:N,noLlm:ee,turnCount:te,totalTokens:P,send:F,cancel:I}=lw();(0,x.useEffect)(()=>{ee&&o()},[ee,o]),(0,x.useEffect)(()=>{T.current?.scrollTo({top:T.current.scrollHeight,behavior:`smooth`})},[c,f]);let ne=(0,x.useMemo)(()=>e.map(e=>e.workflowPath),[e]),re=(0,x.useCallback)(async(t,n=!1)=>{let r=t.trim();if(!r&&!n)return;let i=[...c,...r?[{role:`user`,content:r}]:[]];n&&r&&i.push({role:`user`,content:`Please emit your best <brief> now with what we have so far.`}),l(i),d(``),p(``),h([]),_(null);let a=await F(i,{recentRepos:A.recentRepos,recentReviewers:A.recentReviewers,availableWorkflows:e,userLocale:navigator.language},e=>p(t=>t+e),C.model?C:void 0,h);if(a.noLlm)return;let o=(a.assistantText||f).trim();(o||a.toolCalls.length>0)&&l(e=>[...e,{role:`assistant`,content:o,...a.toolCalls.length>0?{toolCalls:a.toolCalls}:{}}]),p(``),h([]);let s=ow(o,ne);s?_(s):E+1>=uw&&S(`We could not get to a clean brief. Try the form with your description prefilled.`)},[c,F,A,e,ne,f,E,C]);async function ie(){if(g){y(!0),S(null);try{let e=await q(`/jobs`,J({type:`job`,workflowPath:g.workflowPath,repo:g.repo.trim(),serviceName:g.serviceName.trim(),description:g.description.trim(),reviewers:aw(g.reviewers),interactive:g.interactive},{method:`POST`}));i?.(),s(`/jobs/${e.jobId}`)}catch(e){S((e instanceof K,e.message)),y(!1)}}}return(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] lg:items-start`,children:[(0,G.jsxs)(`div`,{className:`flex min-h-[480px] w-full flex-col rounded-2xl border border-line bg-overlay/30 lg:self-start`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,G.jsx)(Di,{className:`size-4 text-accent-300`}),`Coro plan mode`]}),(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[te,` turns · `,P.toLocaleString(),` tokens`]})]}),(0,G.jsxs)(`div`,{ref:T,className:`flex-1 space-y-3 overflow-y-auto p-4`,children:[c.map((e,t)=>(0,G.jsxs)(`div`,{className:`space-y-1`,children:[e.content?(0,G.jsx)(xw,{role:e.role,content:e.content}):null,e.toolCalls?.length?(0,G.jsx)(vw,{calls:e.toolCalls,collapsed:!M}):null]},t)),f||m.length>0?(0,G.jsxs)(`div`,{className:`space-y-1`,children:[f?(0,G.jsx)(xw,{role:`assistant`,content:f,streaming:M}):null,m.length>0?(0,G.jsx)(vw,{calls:m,collapsed:!1}):null]}):null,M&&!f&&m.length===0?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,G.jsx)($r,{className:`size-3 animate-spin`}),`Thinking…`]}):null,N?(0,G.jsxs)(`div`,{className:`rounded-xl border border-danger-500/30 bg-danger-500/10 p-3 text-sm text-danger-200`,children:[N,(0,G.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>void re(u),children:`Retry`}),(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`outline`,onClick:a,children:`Use the form`})]})]}):null]}),(0,G.jsxs)(`div`,{className:`border-t border-line p-4`,children:[(0,G.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),re(u)},className:`flex items-end gap-2`,children:[(0,G.jsx)(Sw,{value:u,onChange:d,onSubmit:()=>void re(u),placeholder:`Describe what you want Coro to do… (Shift+Enter for a new line)`,disabled:M}),(0,G.jsx)(Y,{type:`submit`,disabled:M||!u.trim(),children:(0,G.jsx)(bi,{})})]}),(0,G.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,G.jsx)(pw,{value:C,onChange:w,providers:D,modelsByProvider:O,loadModels:k,disabled:M}),(0,G.jsxs)(`div`,{className:`flex items-center`,children:[(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,disabled:M,onClick:()=>void re(u,!0),children:`Force brief now`}),M?(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:I,children:`Stop`}):null]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-4 lg:sticky lg:top-6 lg:max-h-[calc(100vh-5rem)] lg:w-full lg:self-start lg:overflow-y-auto`,children:[j.length>0?(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wider text-fg-subtle`,children:`Similar past runs`}),(0,G.jsx)(`ul`,{className:`mt-2 space-y-2`,children:j.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,className:`w-full rounded-lg border border-line bg-overlay/40 px-3 py-2 text-left text-xs hover:border-line-strong`,onClick:()=>s(`/jobs/${e.id}`),children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:typeof e.params?.serviceName==`string`?e.params.serviceName:e.id}),(0,G.jsx)(`div`,{className:`text-fg-muted`,children:e.status})]})},e.id))})]}):null,g?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Cw,{brief:g,workflows:e,onChange:_,onSubmit:()=>void ie(),submitting:v,error:b}),(0,G.jsx)(JC,{workflow:e.find(e=>e.workflowPath===g.workflowPath)??null,interactive:g.interactive,mode:`manual`,serviceName:g.serviceName,repo:g.repo,formValid:!!(g.repo.trim()&&g.serviceName.trim()&&g.description.trim())})]}):(0,G.jsx)(`div`,{className:`rounded-2xl border border-dashed border-line bg-overlay/20 p-5 text-sm text-fg-muted`,children:`Your brief will appear here once we have the basics.`})]})]})}function pw({value:e,onChange:t,providers:n,modelsByProvider:r,loadModels:i,disabled:a=!1}){return(0,x.useEffect)(()=>{for(let e of n)i(e.id)},[n.map(e=>e.id).join(`|`)]),(0,G.jsxs)(Jh,{children:[(0,G.jsx)(Yh,{asChild:!0,disabled:a,children:(0,G.jsxs)(`button`,{type:`button`,className:`text-[11px] text-fg-subtle transition-colors hover:text-fg-muted disabled:opacity-50`,children:[`Model: `,(0,G.jsx)(`span`,{className:`font-mono text-fg-muted`,children:(0,x.useMemo)(()=>e.model?$S(r,e.provider,e.model)?.displayName??e.model:`Planning tier default`,[e,r])})]})}),(0,G.jsx)(Zh,{align:`start`,side:`top`,className:`max-h-72 overflow-y-auto`,children:n.map((n,i)=>{let a=r[n.id];return a?.length?(0,G.jsxs)(`div`,{children:[i>0?(0,G.jsx)(eg,{}):null,(0,G.jsx)($h,{children:n.displayName}),a.map(r=>{let i=e.provider===n.id&&e.model===r.id;return(0,G.jsxs)(Qh,{onClick:()=>t({provider:n.id,model:r.id}),children:[(0,G.jsx)(`span`,{className:W(i&&`text-accent-300`),children:r.displayName}),i?(0,G.jsx)(cr,{className:`ml-auto size-3.5 text-accent-300`}):null]},`${n.id}:${r.id}`)})]},n.id):null})})]})}var mw=/<brief>[\s\S]*?<\/brief>/gi,hw=[`Brief's ready — give it a once-over on the right and dispatch when you're happy.`,`Drafted a brief for you. Take a look on the right and tweak anything before sending it off.`,`Brief is on the right. Edit anything that feels off, then dispatch the run.`];function gw(e,t){return e!==`assistant`||!mw.test(t)?t:(mw.lastIndex=0,t.replace(mw,``).trim()||hw[Math.abs(_w(t))%hw.length])}function _w(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}function vw({calls:e,collapsed:t}){let[n,r]=(0,x.useState)(!1),i=e.filter(e=>e.status===`done`).length,a=e.find(e=>e.status===`running`);return t&&!n?(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(!0),className:`ml-1 text-[11px] text-fg-subtle hover:text-fg-muted`,children:a?yw(a):`Read ${i} item${i===1?``:`s`}`}):(0,G.jsxs)(`div`,{className:`ml-1 space-y-1`,children:[e.map((e,t)=>(0,G.jsx)(bw,{call:e},`${e.name}-${t}`)),t?(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(!1),className:`text-[11px] text-fg-subtle hover:text-fg-muted`,children:`Hide`}):null]})}function yw(e){let t=e.input&&typeof e.input==`object`&&`key`in e.input?String(e.input.key):e.input&&typeof e.input==`object`&&`path`in e.input?String(e.input.path):null;switch(e.name){case`tracker_get_issue`:return t?`Coro is reading ${t}…`:`Coro is reading a ticket…`;case`tracker_search_issues`:return`Coro is searching tickets…`;case`scm_read_file`:return t?`Coro is reading ${t}…`:`Coro is reading a file…`;case`scm_search_code`:return`Coro is searching code…`;default:return`Coro is working…`}}function bw({call:e}){let[t,n]=(0,x.useState)(!1),r=e.status===`running`?yw(e):e.summary??e.name;return(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:W(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5`,e.status===`running`?`border-line bg-overlay/40`:e.ok===!1?`border-danger-500/30 bg-danger-500/10 text-danger-200`:`border-line bg-overlay/20 hover:bg-overlay/40`),children:[e.status===`running`?(0,G.jsx)($r,{className:`size-3 animate-spin`}):null,(0,G.jsx)(`span`,{children:r})]}),t?(0,G.jsx)(`pre`,{className:`mt-1 max-h-40 overflow-auto rounded-lg border border-line bg-canvas/80 p-2 text-[10px] text-fg-muted`,children:JSON.stringify(e.input??e.error??e.summary,null,2)}):null]})}function xw({role:e,content:t,streaming:n=!1}){let r=gw(e,t);return(0,G.jsx)(`div`,{className:W(`flex`,e===`user`?`justify-end`:`justify-start`),children:(0,G.jsx)(`div`,{className:W(`max-w-[85%] whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed`,e===`user`?`bg-accent-500/15 text-fg`:`border border-line bg-canvas/60 text-fg-muted`,n&&`animate-pulse`),children:r})})}function Sw({value:e,onChange:t,onSubmit:n,placeholder:r,disabled:i}){let a=(0,x.useRef)(null);return(0,x.useEffect)(()=>{let e=a.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,144)}px`)},[e]),(0,G.jsx)(`textarea`,{ref:a,rows:1,value:e,onChange:e=>t(e.target.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&!t.nativeEvent.isComposing&&(t.preventDefault(),!i&&e.trim()&&n())},placeholder:r,disabled:i,className:`flex-1 resize-none rounded-xl border border-line-strong bg-overlay px-3.5 py-2.5 text-sm leading-6 text-fg shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60 disabled:cursor-not-allowed disabled:opacity-50`})}function Cw({brief:e,workflows:t,onChange:n,onSubmit:r,submitting:i,error:a}){return(0,G.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-accent-500/30 bg-accent-500/5 p-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:`Run brief`}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:`Edit anything before dispatching.`})]}),(0,G.jsx)(Sv,{label:`Repository`,required:!0,children:(0,G.jsx)(O_,{value:e.repo,onChange:t=>n({...e,repo:t.target.value})})}),(0,G.jsx)(Sv,{label:`Service name`,required:!0,children:(0,G.jsx)(O_,{value:e.serviceName,onChange:t=>n({...e,serviceName:t.target.value})})}),(0,G.jsx)(Sv,{label:`Description`,required:!0,children:(0,G.jsx)(bb,{rows:5,value:e.description,onChange:t=>n({...e,description:t.target.value})})}),(0,G.jsx)(Sv,{label:`Reviewers`,children:(0,G.jsx)(O_,{value:e.reviewers,onChange:t=>n({...e,reviewers:t.target.value}),placeholder:`alice, bob`})}),(0,G.jsx)(Sv,{label:`Workflow`,children:(0,G.jsx)(`select`,{className:`w-full rounded-lg border border-line bg-overlay/40 px-3 py-2 text-sm`,value:e.workflowPath,onChange:t=>n({...e,workflowPath:t.target.value}),children:t.map(e=>(0,G.jsx)(`option`,{value:e.workflowPath,children:e.name},e.id))})}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:e.interactive,onChange:t=>n({...e,interactive:t.target.checked})}),`Interactive (pause at checkpoints)`]}),a?(0,G.jsx)(`div`,{className:`text-sm text-danger-300`,children:a}):null,(0,G.jsxs)(Y,{type:`button`,className:`w-full`,disabled:i,onClick:r,children:[i?(0,G.jsx)($r,{className:`animate-spin`}):null,i?`Starting run…`:`Start this run`]})]})}function ww(){let e=nt(),{jobs:t}=Eo(3e4),{closeTab:n}=wo(),r=(0,x.useRef)(null),[i,a]=bo(go,_o),o=(0,x.useCallback)(e=>{a(t=>({...t,...e}))},[a]),s=(0,x.useCallback)(()=>{yo(),a(_o),n(`/jobs/new`)},[a,n]),{mode:c,serviceName:l,repo:u,description:d,reviewers:f,ticketId:p,interactive:m,workflowId:h,scmId:g,trackerId:_}=i;To((0,x.useMemo)(()=>vo(i),[i])?{id:`new-run`,kind:`run`,path:`/jobs/new`,title:`New run`,subtitle:c===`ticket`?p.trim()||`Ticket`:l.trim()||u.trim()||`Draft`}:null);let[v,y]=(0,x.useState)(!0),[b,S]=(0,x.useState)(null),[C,w]=(0,x.useState)(null),[T,E]=(0,x.useState)(()=>{let e=gy();return e===`ai`||e===`form`?e:null}),[D,O]=(0,x.useState)(!1),[k,A]=(0,x.useState)([fo]),[j,M]=(0,x.useState)(!1),[N,ee]=(0,x.useState)(null),te=k.find(e=>e.id===h)??k[0]??fo,P=(0,x.useMemo)(()=>sw(t),[t]),F=uy(b??void 0),I=b?.enabled!==!1;(0,x.useEffect)(()=>{F&&M(!0)},[F]),(0,x.useEffect)(()=>{q(`/config`).then(e=>{S(e.config?.coachMode??null),w(py(e.config?.intake,e.config?.coachMode))}).catch(()=>w(`form`))},[]);let ne=C===`ask-each-time`?vy():null,re=C===`ask-each-time`&&!T&&!ne,ie=(T??ne??(C===`ai`?`ai`:`form`))===`ai`,[L,R]=(0,x.useState)(!1);(0,x.useEffect)(()=>{!L&&b!==null&&(o({interactive:I&&F}),R(!0))},[b,I,F,L,o]);let[ae,oe]=(0,x.useState)([]),[se,ce]=(0,x.useState)([]),[le,ue]=(0,x.useState)(!1),[de,fe]=(0,x.useState)(!1),[pe,me]=(0,x.useState)(null);(0,x.useEffect)(()=>{(async()=>{try{let e=await po();e.length>0&&(A(e),a(t=>{if(e.some(e=>e.id===t.workflowId))return t;let n=e.find(e=>e.id===`job`);return{...t,workflowId:(n??e[0]).id}}))}catch{}finally{y(!1)}})()},[]),(0,x.useEffect)(()=>{(async()=>{try{let e=await q(`/plugins`),t=e=>e.active??e.configured??e.installed??!1,n=e.plugins.filter(e=>e.manifest.kind===`scm`&&t(e)).map(e=>e.manifest),r=e.plugins.filter(e=>e.manifest.kind===`tracker`&&t(e)).map(e=>e.manifest);oe(n),ce(r),a(t=>({...t,scmId:t.scmId||e.defaults.scm||(n.length===1?n[0].id:``),trackerId:t.trackerId||e.defaults.tracker||(r.length===1?r[0].id:``)}))}catch{}finally{ue(!0)}})()},[]);let he=(0,x.useMemo)(()=>le?c===`manual`&&ae.length===0?`Connect a source-control provider in Settings → Source control before dispatching a manual run.`:c===`ticket`&&se.length===0?`Connect an issue tracker in Settings → Issue tracker before dispatching a ticket-driven run.`:null:null,[c,le,ae.length,se.length]),ge=(0,x.useMemo)(()=>he?!1:c===`manual`?!!(l.trim()&&u.trim()&&d.trim()):!!p.trim(),[he,c,l,u,d,p]);async function _e(t){if(!ge||de)return;me(null),fe(!0);let n={};g&&(n.scm=g),_&&(n.tracker=_);let r=c===`ticket`?{type:`job`,workflowPath:te.workflowPath,jiraTicketId:p.trim(),interactive:t,...Object.keys(n).length?{params:n}:{}}:{type:`job`,workflowPath:te.workflowPath,repo:u.trim(),serviceName:l.trim(),description:d.trim(),reviewers:f.split(`,`).map(e=>e.trim()).filter(Boolean),interactive:t,...Object.keys(n).length?{params:n}:{}};try{let t=await q(`/jobs`,J(r,{method:`POST`}));s(),e(`/jobs/${t.jobId}`)}catch(e){me((e instanceof K,e.message)),fe(!1)}}function ve(e){if(o({mode:e.mode}),e.description&&(o({description:e.description}),requestAnimationFrame(()=>{let t=r.current;if(!t)return;t.focus();let n=tw(e.description);n&&t.setSelectionRange(n.start,n.end)})),e.suggestedWorkflow){let t=k.find(t=>t.workflowPath===e.suggestedWorkflow);t&&o({workflowId:t.id})}}let ye=(0,x.useCallback)(e=>{a(t=>({...t,plan:e}))},[a]),be=(0,x.useMemo)(()=>d.length<=20||/\/|\.|should|must/i.test(d)?null:`Add a file path or acceptance criterion to help Coro plan.`,[d]);return re&&C!==null?(0,G.jsx)(vv,{children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-6 pb-32`,children:[(0,G.jsx)(cg,{title:`New run`,description:`How would you like to describe this run?`,actions:(0,G.jsxs)(Y,{variant:`outline`,onClick:()=>e(`/jobs`),children:[(0,G.jsx)(nr,{}),`Back`]})}),(0,G.jsx)(Tw,{onChoose:e=>{yy(e),E(e)}})]})}):ie&&C!==null?(0,G.jsx)(vv,{children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-6 pb-32`,children:[(0,G.jsx)(cg,{title:`New run`,description:`Coro plan mode — describe your goal in conversation and review a brief before dispatching.`,actions:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{_y(`form`),E(`form`)},children:`Use the form instead`}),(0,G.jsxs)(Y,{variant:`outline`,onClick:()=>e(`/jobs`),children:[(0,G.jsx)(nr,{}),`Back`]})]})}),F?(0,G.jsx)(Ew,{}):null,(0,G.jsx)(fw,{workflows:k,jobs:t,initialPlan:i.plan,onPlanChange:ye,onDispatched:s,onUseForm:()=>{_y(`form`),E(`form`)},onNoLlm:()=>{_y(`form`),E(`form`)}})]})}):(0,G.jsx)(vv,{children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-6 pb-32`,children:[(0,G.jsx)(cg,{title:`New run`,actions:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C===`ai`||I?(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{_y(`ai`),E(`ai`)},children:`Try Coro plan mode`}):null,(0,G.jsxs)(Y,{variant:`outline`,onClick:()=>e(`/jobs`),children:[(0,G.jsx)(nr,{}),`Back`]})]})}),F?(0,G.jsx)(Ew,{}):null,he?(0,G.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-warning-500/30 bg-warning-500/8 p-4`,children:[(0,G.jsx)(Mi,{className:`mt-0.5 size-4 shrink-0 text-warning-300`}),(0,G.jsxs)(`div`,{className:`flex-1 text-sm text-warning-200`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:`Setup needed`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-warning-200/85`,children:he})]}),(0,G.jsx)(Y,{asChild:!0,size:`sm`,variant:`outline`,children:(0,G.jsxs)(Dn,{to:`/settings#source-control`,children:[(0,G.jsx)(Ci,{}),`Open settings`]})})]}):null,(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[minmax(0,2fr)_minmax(280px,1fr)]`,children:[(0,G.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),_e(I&&F?!0:m)},className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`header`,{children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`How would you like to start?`}),(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Pick whichever feels most natural — both end in a pull request.`})]}),(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,G.jsx)(Dw,{icon:si,title:`Describe what to build`,description:`Free-form prompt. Best for ad-hoc work or quick experiments.`,selected:c===`manual`,onSelect:()=>o({mode:`manual`})}),(0,G.jsx)(Dw,{icon:Ai,title:`From a tracker ticket`,description:`Coro pulls the title, description, and acceptance criteria from your tracker.`,selected:c===`ticket`,onSelect:()=>o({mode:`ticket`}),disabled:se.length===0,disabledHint:`Connect a tracker in Settings to use this mode.`})]})]}),(0,G.jsx)(`section`,{className:`space-y-4 rounded-2xl border border-line bg-overlay/30 p-5`,children:c===`manual`?(0,G.jsx)(Ow,{repo:u,setRepo:e=>o({repo:e}),serviceName:l,setServiceName:e=>o({serviceName:e}),description:d,setDescription:e=>o({description:e}),reviewers:f,setReviewers:e=>o({reviewers:e}),scmPlugins:ae,scmId:g,setScmId:e=>o({scmId:e}),recentRepos:P.recentRepos,recentReviewers:P.recentReviewers,descriptionRef:r,specificityHint:be,onOpenExamples:()=>O(!0)}):(0,G.jsx)(kw,{ticketId:p,setTicketId:e=>o({ticketId:e}),trackerPlugins:se,trackerId:_,setTrackerId:e=>o({trackerId:e})})}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsx)(`header`,{children:(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Run options`})}),(0,G.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-between gap-4 rounded-2xl border border-line bg-overlay/30 p-4 transition-colors hover:border-line-strong`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Interactive checkpoints`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:`When on, Coro pauses at every workflow checkpoint for your approval.`})]}),(0,G.jsx)(jx,{checked:m,onCheckedChange:e=>o({interactive:e}),"aria-label":`Interactive mode`})]})]}),(0,G.jsxs)(`section`,{className:`rounded-2xl border border-line bg-overlay/30`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>M(e=>!e),className:`flex w-full items-center justify-between gap-3 px-5 py-3 text-left transition-colors hover:bg-overlay/50`,"aria-expanded":j,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:`Advanced`}),(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Pick a workflow other than the default. Custom workflows added to your intelligence overlay show up here.`})]}),(0,G.jsx)(lr,{className:W(`size-4 shrink-0 text-fg-muted transition-transform`,j&&`rotate-180`)})]}),j?(0,G.jsx)(`div`,{className:`border-t border-line px-5 py-4 space-y-4`,children:(0,G.jsx)(Sv,{label:`Workflow`,hint:`The phase definition Coro will execute. The default fits most ad-hoc work.`,children:(0,G.jsx)(`div`,{className:`space-y-2`,children:k.map(e=>{let t=e.id===h;return(0,G.jsxs)(`div`,{className:W(`group flex items-start gap-3 rounded-xl border px-3 py-2.5 transition-colors`,t?`border-accent-500/50 bg-accent-500/10`:`border-line bg-overlay/40 hover:border-line-strong`),children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>o({workflowId:e.id}),className:`flex flex-1 items-start gap-3 text-left`,children:[(0,G.jsx)(`span`,{className:W(`mt-0.5 inline-flex size-7 shrink-0 items-center justify-center rounded-lg ring-1`,t?`bg-accent-500/20 ring-accent-500/40 text-accent-200`:`bg-overlay/60 ring-line text-fg-muted`),children:(0,G.jsx)(B,{className:`size-3.5`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.layer?(0,G.jsx)(UC,{layer:e.layer,overrides:e.overrides,size:`sm`}):null,(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-fg-subtle`,children:e.workflowPath}),e.phases?(0,G.jsxs)(`span`,{className:`text-[10px] text-fg-subtle`,children:[`· `,e.phases.length,` phase`,e.phases.length===1?``:`s`]}):null]}),e.description?(0,G.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-fg-muted`,children:e.description}):null]})]}),(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>ee(e),className:`shrink-0`,children:[(0,G.jsx)(qr,{}),`Details`]})]},e.id)})})})}):null]}),pe?(0,G.jsx)(`div`,{className:`rounded-2xl border border-danger-500/30 bg-danger-500/10 p-4 text-sm text-danger-200`,children:pe}):null]}),(0,G.jsx)(`div`,{className:`hidden lg:block`,children:(0,G.jsx)(`div`,{className:`sticky top-6`,children:(0,G.jsx)(JC,{workflow:te,interactive:m,mode:c,serviceName:l,repo:u,ticketId:p,formValid:ge,loading:v})})})]}),(0,G.jsx)(`div`,{className:`lg:hidden`,children:(0,G.jsxs)(`details`,{className:`rounded-2xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:`What will happen?`}),(0,G.jsx)(`div`,{className:`mt-4`,children:(0,G.jsx)(JC,{workflow:te,interactive:m,mode:c,serviceName:l,repo:u,ticketId:p,formValid:ge,loading:v})})]})}),(0,G.jsxs)(`div`,{className:`fixed inset-x-0 bottom-0 z-30 border-t border-line bg-canvas/85 backdrop-blur supports-[backdrop-filter]:bg-canvas/70`,children:[(0,G.jsxs)(`div`,{className:`mx-auto flex max-w-6xl flex-wrap items-center justify-between gap-4 px-6 py-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 text-xs text-fg-muted`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:te.name}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>ee(te),className:`inline-flex items-center gap-1 rounded text-[11px] text-fg-subtle transition-colors hover:text-accent-200`,children:[(0,G.jsx)(qr,{className:`size-3`}),`Details`]})]}),(0,G.jsx)(`div`,{className:`truncate`,children:c===`manual`?l.trim()||`Add a service name and prompt to dispatch`:p.trim()||`Enter a tracker ticket to dispatch`})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:I&&F?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{type:`button`,size:`lg`,disabled:!ge||de,onClick:()=>void _e(!0),children:[de?(0,G.jsx)($r,{className:`animate-spin`}):null,`Interactive`,de?null:(0,G.jsx)(rr,{})]}),(0,G.jsx)(Y,{type:`button`,size:`lg`,variant:`secondary`,disabled:!ge||de,onClick:()=>void _e(!1),children:`Autonomous`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{type:`button`,size:`lg`,disabled:!ge||de,onClick:()=>void _e(!0),variant:`secondary`,children:`Interactive`}),(0,G.jsxs)(Y,{type:`button`,size:`lg`,disabled:!ge||de,onClick:()=>void _e(!1),children:[de?(0,G.jsx)($r,{className:`animate-spin`}):null,de?`Dispatching…`:`Autonomous`,de?null:(0,G.jsx)(rr,{})]})]})})]}),(0,G.jsx)(`p`,{className:`mx-auto max-w-6xl px-6 pb-2 text-[10px] text-fg-subtle`,children:`Interactive: Coro pauses at every checkpoint for approval. You can switch to Autonomous mid-run.`})]}),(0,G.jsx)(nw,{open:D,onOpenChange:O,onSelect:ve,hasExistingDescription:!!d.trim()}),(0,G.jsx)(KC,{workflow:N,open:N!==null,onOpenChange:e=>{e||ee(null)}})]})})}function Tw({onChoose:e}){return(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>e(`ai`),className:`rounded-2xl border border-border bg-surface p-6 text-left transition hover:border-accent-500/40 hover:bg-accent-500/5`,children:[(0,G.jsx)(`div`,{className:`text-[15px] font-semibold text-fg`,children:`Coro plan mode`}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:`Talk through your goal with Coro. It asks clarifying questions and proposes a brief you can edit before dispatching.`})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>e(`form`),className:`rounded-2xl border border-border bg-surface p-6 text-left transition hover:border-accent-500/40 hover:bg-accent-500/5`,children:[(0,G.jsx)(`div`,{className:`text-[15px] font-semibold text-fg`,children:`Use the form`}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:`Fill in repo, description, and reviewers directly — with previews, examples, and coach-mode guidance.`})]})]})}function Ew(){return(0,G.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-accent-500/25 bg-accent-500/8 p-4 text-sm text-fg-muted`,children:[(0,G.jsx)(qr,{className:`mt-0.5 size-4 shrink-0 text-accent-300`}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:`Coach mode is on.`}),` Coro will pause at every workflow checkpoint so you can review. Turn this off in`,` `,(0,G.jsx)(Dn,{to:`/settings#general`,className:`text-accent-300 hover:underline`,children:`Settings`}),` `,`or per-run below.`]})]})}function Dw({icon:e,title:t,description:n,selected:r,onSelect:i,disabled:a,disabledHint:o}){return(0,G.jsxs)(`button`,{type:`button`,onClick:a?void 0:i,disabled:a,className:W(`group relative overflow-hidden rounded-2xl border p-4 text-left transition-all`,r?`border-accent-500/50 bg-accent-500/10 shadow-[0_0_0_1px_rgba(97,114,255,0.3)]`:`border-line bg-overlay/40 hover:border-line-strong hover:bg-overlay/60`,a&&`cursor-not-allowed opacity-50`),title:a?o:void 0,children:[(0,G.jsx)(`span`,{className:W(`inline-flex size-9 items-center justify-center rounded-xl ring-1 transition-colors`,r?`bg-accent-500/20 ring-accent-500/40 text-accent-200`:`bg-overlay/60 ring-line text-fg-muted group-hover:text-fg`),children:(0,G.jsx)(e,{className:`size-4`})}),(0,G.jsx)(`div`,{className:`mt-3 text-sm font-medium text-fg`,children:t}),(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:n})]})}function Ow(e){return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsx)(Sv,{label:`Service name`,required:!0,hint:`Used as a label across runs.`,tooltip:`A short human-readable name shown on the Runs list and run detail header.`,children:(0,G.jsx)(O_,{value:e.serviceName,onChange:t=>e.setServiceName(t.target.value),placeholder:`Billing API`,required:!0})}),(0,G.jsxs)(Sv,{label:`Repository`,required:!0,hint:`owner/repo or workspace/repo, depending on your provider.`,tooltip:`The repo Coro clones to implement your change. Must match your SCM provider's slug format.`,children:[(0,G.jsx)(O_,{value:e.repo,onChange:t=>e.setRepo(t.target.value),placeholder:`my-org/billing-api`,required:!0}),e.recentRepos.length>0?(0,G.jsx)(Aw,{label:`Recent`,items:e.recentRepos,onPick:e.setRepo}):null]})]}),(0,G.jsxs)(Sv,{label:`What should Coro build?`,required:!0,hint:`Be specific. Coro's planner reads this verbatim — include the goal, constraints, and any acceptance criteria.`,tooltip:`This becomes the primary input for spec-writing and planning. Mention files, endpoints, and acceptance criteria when you can.`,action:(0,G.jsx)(iw,{onClick:e.onOpenExamples}),children:[(0,G.jsx)(bb,{ref:e.descriptionRef,value:e.description,onChange:t=>e.setDescription(t.target.value),rows:6,placeholder:`Add rate limiting to /api/users. Use the existing token bucket utility, and return clear retry-after headers when a caller exceeds the limit.`,required:!0}),(0,G.jsxs)(`div`,{className:`mt-1 flex justify-between text-[11px] text-fg-subtle`,children:[(0,G.jsx)(`span`,{children:e.specificityHint??`\xA0`}),(0,G.jsxs)(`span`,{children:[e.description.length,` chars`]})]})]}),(0,G.jsxs)(Sv,{label:`Reviewers`,hint:`Optional. Comma-separated usernames. They'll be added to the resulting pull request.`,tooltip:`Usernames on your git host who should review the PR Coro opens.`,children:[(0,G.jsx)(O_,{value:e.reviewers,onChange:t=>e.setReviewers(t.target.value),placeholder:`alice, bob`}),e.recentReviewers.length>0?(0,G.jsx)(Aw,{label:`Recent`,items:e.recentReviewers,onPick:t=>{let n=e.reviewers.split(`,`).map(e=>e.trim()).filter(Boolean);n.includes(t)||e.setReviewers([...n,t].join(`, `))}}):null]}),e.scmPlugins.length>1?(0,G.jsx)(Sv,{label:`Source control`,hint:`Multiple SCM providers are configured. Choose one for this run.`,children:(0,G.jsx)(jw,{options:e.scmPlugins,value:e.scmId,onChange:e.setScmId})}):null]})}function kw(e){return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Sv,{label:`Ticket ID`,required:!0,hint:`Tracker-specific issue key (Jira: ENG-1234, Linear: ENG-12, GitHub Issues: 42).`,children:(0,G.jsx)(O_,{value:e.ticketId,onChange:t=>e.setTicketId(t.target.value),placeholder:`ENG-1234`,required:!0,autoFocus:!0})}),e.trackerPlugins.length>1?(0,G.jsx)(Sv,{label:`Issue tracker`,hint:`Multiple trackers are configured. Choose one for this run.`,children:(0,G.jsx)(jw,{options:e.trackerPlugins,value:e.trackerId,onChange:e.setTrackerId})}):null]})}function Aw({label:e,items:t,onPick:n}){return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-[11px] text-fg-subtle`,children:[(0,G.jsxs)(`span`,{className:`text-fg-subtle/80`,children:[e,`:`]}),t.map((e,r)=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`rounded text-fg-muted underline-offset-2 transition-colors hover:text-accent-200 hover:underline`,children:e}),r<t.length-1?(0,G.jsx)(`span`,{"aria-hidden":!0,className:`text-fg-subtle/60`,children:`·`}):null]},e))]})}function jw({options:e,value:t,onChange:n}){return(0,G.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:e.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e.id),className:W(`rounded-xl border px-3 py-2.5 text-left text-sm transition-colors`,e.id===t?`border-accent-500/50 bg-accent-500/10 text-fg`:`border-line bg-overlay/40 text-fg-muted hover:border-line-strong`),children:e.displayName},e.id))})}function Mw(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function Nw(e,t){let n=Pw(e.replace(/\r\n/g,`
66
66
  `).split(`
67
67
  `),t.replace(/\r\n/g,`
68
68
  `).split(`
69
- `)),r=0,i=0,a=0;for(let e of n)e.kind===`+`?r++:e.kind===`-`?i++:a++;return{added:r,removed:i,unchanged:a}}function zw(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=1;a<=n;a++)for(let n=1;n<=r;n++)i[a][n]=e[a-1]===t[n-1]?i[a-1][n-1]+1:Math.max(i[a-1][n],i[a][n-1]);let a=[],o=n,s=r;for(;o>0||s>0;)o>0&&s>0&&e[o-1]===t[s-1]?(a.push({kind:`=`,left:e[o-1],right:t[s-1]}),o--,s--):s>0&&(o===0||i[o][s-1]>=i[o-1][s])?(a.push({kind:`+`,left:null,right:t[s-1]}),s--):(a.push({kind:`-`,left:e[o-1],right:null}),o--);return a.reverse(),a}function Bw(e,t){let n=zw(e.replace(/\r\n/g,`
69
+ `)),r=0,i=0,a=0;for(let e of n)e.kind===`+`?r++:e.kind===`-`?i++:a++;return{added:r,removed:i,unchanged:a}}function Pw(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=1;a<=n;a++)for(let n=1;n<=r;n++)i[a][n]=e[a-1]===t[n-1]?i[a-1][n-1]+1:Math.max(i[a-1][n],i[a][n-1]);let a=[],o=n,s=r;for(;o>0||s>0;)o>0&&s>0&&e[o-1]===t[s-1]?(a.push({kind:`=`,left:e[o-1],right:t[s-1]}),o--,s--):s>0&&(o===0||i[o][s-1]>=i[o-1][s])?(a.push({kind:`+`,left:null,right:t[s-1]}),s--):(a.push({kind:`-`,left:e[o-1],right:null}),o--);return a.reverse(),a}function Fw(e,t){let n=Pw(e.replace(/\r\n/g,`
70
70
  `).split(`
71
71
  `),t.replace(/\r\n/g,`
72
72
  `).split(`
73
- `)),r=[],i=0,a=0;for(let e of n)e.kind===`=`?(i++,a++,r.push({op:e,leftNo:i,rightNo:a})):e.kind===`-`?(i++,r.push({op:e,leftNo:i,rightNo:null})):(a++,r.push({op:e,leftNo:null,rightNo:a}));let o=String(Math.max(i,a,1)).length,s=[],c=-1;for(let e=0;e<=r.length;e++){let t=r[e],n=t?.op.kind===`=`;if(n&&c===-1&&(c=e),!n&&c!==-1){let t=e,n=t-c,i=c===0?0:3;if(n>i+3+1){for(let e=c;e<c+i;e++)s.push(Hw(r[e],o));s.push(Vw(n-i-3,o));for(let e=t-3;e<t;e++)s.push(Hw(r[e],o))}else for(let e=c;e<t;e++)s.push(Hw(r[e],o));c=-1}t&&!n&&s.push(Hw(t,o))}if(c!==-1){let e=r.length-c,t=c===0?0:3;if(e>t+1){for(let e=c;e<c+t;e++)s.push(Hw(r[e],o));s.push(Vw(e-t,o))}else for(let e=c;e<r.length;e++)s.push(Hw(r[e],o))}return s.length===0?`<div class="p-4 text-sm text-fg-muted">Files are identical.</div>`:`<div class="font-mono text-[12px] leading-[1.55]">${s.join(``)}</div>`}function Vw(e,t){let n=`${t+1}ch`;return`<div class="flex items-center border-y border-line bg-overlay/40 text-[10px] uppercase tracking-wide text-fg-subtle"><span style="width:${n}" class="shrink-0 select-none border-r border-line py-1 text-center opacity-60">⋯</span><span style="width:${n}" class="shrink-0 select-none border-r border-line py-1 text-center opacity-60">⋯</span><span class="px-3 py-1">… ${e} unchanged line${e===1?``:`s`} …</span></div>`}function Hw(e,t){let{op:n,leftNo:r,rightNo:i}=e,a=n.kind===`+`?n.right??``:n.left??``,o=``,s=`border-l-[3px] border-transparent`,c=`text-fg-subtle`,l=` `;n.kind===`+`?(o=`bg-success-500/15`,s=`border-l-[3px] border-success-500/70`,c=`font-bold text-success-400`,l=`+`):n.kind===`-`&&(o=`bg-danger-500/15`,s=`border-l-[3px] border-danger-500/70`,c=`font-bold text-danger-400`,l=`−`);let u=`${t+1}ch`,d=r===null?``:String(r),f=i===null?``:String(i),p=`shrink-0 select-none border-r border-line/60 px-1 py-0.5 text-right text-[10px] tabular-nums text-fg-subtle/70`;return`<div${n.kind===`+`?` data-diff-kind="add"`:n.kind===`-`?` data-diff-kind="del"`:``} class="${o} ${s} flex items-stretch"><span style="width:${u}" class="${p}">${Lw(d)}</span><span style="width:${u}" class="${p}">${Lw(f)}</span><span class="w-5 shrink-0 select-none py-0.5 text-center ${c}">${l}</span><span class="flex-1 whitespace-pre-wrap break-words py-0.5 pr-3">${Lw(a)}</span></div>`}function Uw({preflight:e,loading:t}){return t&&!e?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-fg-subtle`,children:[(0,G.jsx)($r,{className:`size-3 animate-spin`}),` Validating…`]}):e?(0,G.jsxs)(`div`,{className:`space-y-1 rounded-md border px-3 py-2 text-[12px] ${e.ok?`border-success-500/40 bg-success-500/10`:`border-danger-500/40 bg-danger-500/10`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[e.ok?(0,G.jsx)(fr,{className:`size-3.5 text-success-400`}):(0,G.jsx)(dr,{className:`size-3.5 text-danger-400`}),e.ok?`Ready to save`:`Validation errors`]}),e.errors.length>0?(0,G.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-5 text-danger-400`,children:e.errors.map((e,t)=>(0,G.jsx)(`li`,{children:e},t))}):null,e.warnings.length>0?(0,G.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-5 text-warning`,children:e.warnings.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-1`,children:[(0,G.jsx)(Mi,{className:`mt-0.5 size-3 shrink-0`}),(0,G.jsx)(`span`,{children:e})]},t))}):null]}):null}function Ww({open:e,onOpenChange:t,target:n,onChanged:r}){let[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(null),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(`rendered`),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null),[g,_]=(0,x.useState)(null),[v,y]=(0,x.useState)(null);(0,x.useEffect)(()=>{if(!e||!n){a(null),s(null),p(null),h(null),y(null);return}p(n.layer),h(n.path)},[e,n]),(0,x.useEffect)(()=>{if(!e||!f||!m)return;let t=new AbortController;return l(!0),s(null),a(null),d(`rendered`),q(`/intelligence/file?layer=${encodeURIComponent(f)}&path=${encodeURIComponent(m)}`,{signal:t.signal}).then(e=>a(e)).catch(e=>{e.name!==`AbortError`&&s(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}).finally(()=>l(!1)),()=>t.abort()},[e,f,m]);let b=!!(i?.lowerContent&&i.lowerLayer),S=(0,x.useRef)(null);function C(){let e=S.current;e&&e.querySelector(`[data-diff-kind="add"]`)?.scrollIntoView({behavior:`smooth`,block:`center`})}async function w(e){if(!(!i||!m)){_(`override`),y(null);try{await q(`/intelligence/file`,J({layer:e,path:m,content:i.content},{method:`PUT`})),p(e),r?.({layer:e,path:m})}catch(e){y(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{_(null)}}}async function T(){if(!(!i||!f||!m||!i.lowerLayer)){_(`revert`),y(null);try{await q(`/intelligence/file?layer=${encodeURIComponent(f)}&path=${encodeURIComponent(m)}`,{method:`DELETE`});let e=i.lowerLayer;p(e),r?.({layer:e,path:m})}catch(e){y(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{_(null)}}}let[E,D]=(0,x.useState)(!1),[O,k]=(0,x.useState)(``),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(!1),[ee,te]=(0,x.useState)(!1),P=(0,x.useRef)(null),F=f===`tenant`||f===`repo`,I=E?O:i?.content??``,ne=(0,x.useMemo)(()=>i?.lowerContent?Rw(i.lowerContent,I):null,[i,I]);(0,x.useEffect)(()=>{D(!1),k(``),j(null)},[f,m]);function re(){i&&(k(i.content),D(!0),d(`source`),j(null))}function ie(){D(!1),k(``),j(null)}(0,x.useEffect)(()=>{if(!(!E||!m))return P.current&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>{N(!0),q(`/intelligence/preflight`,J({path:m,content:O},{method:`POST`})).then(e=>j(e)).catch(()=>j(null)).finally(()=>N(!1))},250),()=>{P.current&&window.clearTimeout(P.current)}},[E,O,m]);async function L(){if(!(!f||!m||!A?.ok||ee)){te(!0),y(null);try{await q(`/intelligence/file`,J({layer:f,path:m,content:O},{method:`PUT`})),D(!1),k(``),j(null),r?.({layer:f,path:m}),h(e=>e),p(e=>e),a(await q(`/intelligence/file?layer=${encodeURIComponent(f)}&path=${encodeURIComponent(m)}`))}catch(e){y(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{te(!1)}}}return(0,G.jsx)(c_,{open:e,onOpenChange:t,children:(0,G.jsxs)(d_,{className:`flex max-w-4xl flex-col gap-0 max-h-[min(820px,calc(100vh-2rem))]`,children:[(0,G.jsxs)(f_,{className:`shrink-0`,children:[(0,G.jsxs)(p_,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ir,{className:`size-4 text-fg-muted`}),(0,G.jsx)(`span`,{className:`truncate`,children:n?.displayName??`File`}),n?(0,G.jsx)(JC,{layer:n.layer,overrides:n.overrides,size:`sm`}):null]}),(0,G.jsx)(m_,{className:`font-mono text-[11px]`,children:n?.path})]}),(0,G.jsx)(h_,{className:`flex-1 min-h-0 overflow-y-auto px-6 pb-6`,children:c?(0,G.jsx)(`div`,{className:`flex h-48 items-center justify-center text-fg-muted`,children:(0,G.jsx)($r,{className:`size-4 animate-spin`})}):o?(0,G.jsx)(`div`,{className:`rounded-lg border border-danger/40 bg-danger/10 p-3 text-sm text-danger`,children:o}):i?(0,G.jsxs)(Bb,{value:u,onValueChange:e=>d(e),className:`gap-3`,children:[(0,G.jsxs)(`div`,{className:`sticky top-0 z-30 -mx-6 border-b border-line bg-panel px-6 pb-3 pt-1`,children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Hb,{value:`rendered`,children:`Rendered`}),(0,G.jsx)(Hb,{value:`source`,children:`Source`}),(0,G.jsxs)(Hb,{value:`diff`,disabled:!b,children:[`Diff`,b&&i.lowerLayer?(0,G.jsxs)(`span`,{className:`ml-1.5 text-[10px] opacity-70`,children:[`vs `,i.lowerLayer]}):null]})]}),u===`diff`&&i.lowerContent&&ne?(0,G.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 rounded-lg border border-line bg-panel-raised px-3 py-1.5 text-[10px] uppercase tracking-wide text-fg-subtle`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-md border border-danger-500/40 bg-danger-500/15 px-1.5 py-0.5 font-mono text-[11px] normal-case text-danger-400`,children:[`−`,ne.removed]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-md border border-success-500/40 bg-success-500/15 px-1.5 py-0.5 font-mono text-[11px] normal-case text-success-400`,children:[`+`,ne.added]}),(0,G.jsxs)(`span`,{className:`text-fg-subtle/70`,children:[i.lowerLayer,` → `,i.layer]})]}),ne.added>0?(0,G.jsxs)(`button`,{type:`button`,onClick:C,className:`inline-flex items-center gap-1 rounded-md border border-success-500/30 bg-success-500/10 px-2 py-0.5 font-medium normal-case tracking-normal text-success-400 transition-colors hover:bg-success-500/20`,children:[(0,G.jsx)(tr,{className:`size-3`}),`Jump to first added line`]}):null]}):null]}),(0,G.jsx)(Ub,{value:`rendered`,className:`rounded-lg border border-line bg-canvas/40 p-4`,children:(0,G.jsx)(`div`,{className:`prose-coro space-y-3 text-sm leading-6 text-fg`,dangerouslySetInnerHTML:{__html:Jb(I)}})}),(0,G.jsx)(Ub,{value:`source`,className:`rounded-lg border border-line bg-canvas/60`,children:E?(0,G.jsxs)(`div`,{className:`space-y-2 p-3`,children:[(0,G.jsx)(`textarea`,{value:O,onChange:e=>k(e.target.value),spellCheck:!1,className:`h-[360px] w-full resize-y rounded-md border border-line bg-canvas/80 p-3 font-mono text-[12px] leading-5 text-fg outline-none focus:border-accent-400`}),(0,G.jsx)(Uw,{preflight:A,loading:M})]}):(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words p-4 font-mono text-[12px] leading-5 text-fg`,children:i.content})}),(0,G.jsx)(Ub,{value:`diff`,className:`rounded-lg border border-line bg-canvas/60`,children:i.lowerContent?(0,G.jsx)(`div`,{ref:S,children:(0,G.jsx)(`div`,{dangerouslySetInnerHTML:{__html:Bw(i.lowerContent,I)}})}):(0,G.jsx)(`div`,{className:`p-4 text-sm text-fg-muted`,children:`No lower layer to diff against.`})})]}):null}),(0,G.jsx)(`div`,{className:`shrink-0 border-t border-line px-6 py-3`,children:i?(0,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i.layer===`base`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{size:`sm`,variant:`primary`,disabled:g!==null,onClick:()=>w(`tenant`),children:[g===`override`?(0,G.jsx)($r,{className:`mr-1 size-3 animate-spin`}):(0,G.jsx)(pi,{className:`mr-1 size-3`}),`Override in Custom`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,disabled:!0,title:`No repo overlay mounted`,children:[(0,G.jsx)(pi,{className:`mr-1 size-3`}),`Override in Repo`]})]}):(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,disabled:g!==null||!i.lowerLayer||E,onClick:T,title:i.lowerLayer?`Delete this override and fall back to ${i.lowerLayer}`:`Nothing to revert to — no lower layer`,children:[g===`revert`?(0,G.jsx)($r,{className:`mr-1 size-3 animate-spin`}):(0,G.jsx)(gi,{className:`mr-1 size-3`}),`Revert to Coro`]}),F&&!E?(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,onClick:re,children:[(0,G.jsx)(li,{className:`mr-1 size-3`}),`Edit`]}):null,E?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{size:`sm`,variant:`primary`,onClick:L,disabled:!A?.ok||ee||M,children:[ee?(0,G.jsx)($r,{className:`mr-1 size-3 animate-spin`}):(0,G.jsx)(vi,{className:`mr-1 size-3`}),`Save`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,onClick:ie,disabled:ee,children:[(0,G.jsx)(Pi,{className:`mr-1 size-3`}),`Cancel`]})]}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-fg-subtle`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(Ir,{className:`size-3`}),i.layer===`base`?`Base file`:`Override file`]}),i.lowerLayer?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`Shadowing`,(0,G.jsx)(JC,{layer:i.lowerLayer,size:`sm`})]}):null]})]}),v?(0,G.jsx)(`div`,{className:`text-[11px] text-danger-400`,children:v}):null]}):null})]})})}var Gw={workflow:`Workflow`,agent:`Agent`,skill:`Skill`,memory:`Memory note`};function Kw(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,60)}function qw(e,t){switch(e){case`workflow`:return{path:`workflows/${t}/workflow.md`,content:`---
73
+ `)),r=[],i=0,a=0;for(let e of n)e.kind===`=`?(i++,a++,r.push({op:e,leftNo:i,rightNo:a})):e.kind===`-`?(i++,r.push({op:e,leftNo:i,rightNo:null})):(a++,r.push({op:e,leftNo:null,rightNo:a}));let o=String(Math.max(i,a,1)).length,s=[],c=-1;for(let e=0;e<=r.length;e++){let t=r[e],n=t?.op.kind===`=`;if(n&&c===-1&&(c=e),!n&&c!==-1){let t=e,n=t-c,i=c===0?0:3;if(n>i+3+1){for(let e=c;e<c+i;e++)s.push(Lw(r[e],o));s.push(Iw(n-i-3,o));for(let e=t-3;e<t;e++)s.push(Lw(r[e],o))}else for(let e=c;e<t;e++)s.push(Lw(r[e],o));c=-1}t&&!n&&s.push(Lw(t,o))}if(c!==-1){let e=r.length-c,t=c===0?0:3;if(e>t+1){for(let e=c;e<c+t;e++)s.push(Lw(r[e],o));s.push(Iw(e-t,o))}else for(let e=c;e<r.length;e++)s.push(Lw(r[e],o))}return s.length===0?`<div class="p-4 text-sm text-fg-muted">Files are identical.</div>`:`<div class="font-mono text-[12px] leading-[1.55]">${s.join(``)}</div>`}function Iw(e,t){let n=`${t+1}ch`;return`<div class="flex items-center border-y border-line bg-overlay/40 text-[10px] uppercase tracking-wide text-fg-subtle"><span style="width:${n}" class="shrink-0 select-none border-r border-line py-1 text-center opacity-60">⋯</span><span style="width:${n}" class="shrink-0 select-none border-r border-line py-1 text-center opacity-60">⋯</span><span class="px-3 py-1">… ${e} unchanged line${e===1?``:`s`} …</span></div>`}function Lw(e,t){let{op:n,leftNo:r,rightNo:i}=e,a=n.kind===`+`?n.right??``:n.left??``,o=``,s=`border-l-[3px] border-transparent`,c=`text-fg-subtle`,l=` `;n.kind===`+`?(o=`bg-success-500/15`,s=`border-l-[3px] border-success-500/70`,c=`font-bold text-success-400`,l=`+`):n.kind===`-`&&(o=`bg-danger-500/15`,s=`border-l-[3px] border-danger-500/70`,c=`font-bold text-danger-400`,l=`−`);let u=`${t+1}ch`,d=r===null?``:String(r),f=i===null?``:String(i),p=`shrink-0 select-none border-r border-line/60 px-1 py-0.5 text-right text-[10px] tabular-nums text-fg-subtle/70`;return`<div${n.kind===`+`?` data-diff-kind="add"`:n.kind===`-`?` data-diff-kind="del"`:``} class="${o} ${s} flex items-stretch"><span style="width:${u}" class="${p}">${Mw(d)}</span><span style="width:${u}" class="${p}">${Mw(f)}</span><span class="w-5 shrink-0 select-none py-0.5 text-center ${c}">${l}</span><span class="flex-1 whitespace-pre-wrap break-words py-0.5 pr-3">${Mw(a)}</span></div>`}function Rw({preflight:e,loading:t}){return t&&!e?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-fg-subtle`,children:[(0,G.jsx)($r,{className:`size-3 animate-spin`}),` Validating…`]}):e?(0,G.jsxs)(`div`,{className:`space-y-1 rounded-md border px-3 py-2 text-[12px] ${e.ok?`border-success-500/40 bg-success-500/10`:`border-danger-500/40 bg-danger-500/10`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[e.ok?(0,G.jsx)(fr,{className:`size-3.5 text-success-400`}):(0,G.jsx)(dr,{className:`size-3.5 text-danger-400`}),e.ok?`Ready to save`:`Validation errors`]}),e.errors.length>0?(0,G.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-5 text-danger-400`,children:e.errors.map((e,t)=>(0,G.jsx)(`li`,{children:e},t))}):null,e.warnings.length>0?(0,G.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-5 text-warning`,children:e.warnings.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-1`,children:[(0,G.jsx)(Mi,{className:`mt-0.5 size-3 shrink-0`}),(0,G.jsx)(`span`,{children:e})]},t))}):null]}):null}function zw({open:e,onOpenChange:t,target:n,onChanged:r}){let[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(null),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(`rendered`),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null),[g,_]=(0,x.useState)(null),[v,y]=(0,x.useState)(null);(0,x.useEffect)(()=>{if(!e||!n){a(null),s(null),p(null),h(null),y(null);return}p(n.layer),h(n.path)},[e,n]),(0,x.useEffect)(()=>{if(!e||!f||!m)return;let t=new AbortController;return l(!0),s(null),a(null),d(`rendered`),q(`/intelligence/file?layer=${encodeURIComponent(f)}&path=${encodeURIComponent(m)}`,{signal:t.signal}).then(e=>a(e)).catch(e=>{e.name!==`AbortError`&&s(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}).finally(()=>l(!1)),()=>t.abort()},[e,f,m]);let b=!!(i?.lowerContent&&i.lowerLayer),S=(0,x.useRef)(null);function C(){let e=S.current;e&&e.querySelector(`[data-diff-kind="add"]`)?.scrollIntoView({behavior:`smooth`,block:`center`})}async function w(e){if(!(!i||!m)){_(`override`),y(null);try{await q(`/intelligence/file`,J({layer:e,path:m,content:i.content},{method:`PUT`})),p(e),r?.({layer:e,path:m})}catch(e){y(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{_(null)}}}async function T(){if(!(!i||!f||!m||!i.lowerLayer)){_(`revert`),y(null);try{await q(`/intelligence/file?layer=${encodeURIComponent(f)}&path=${encodeURIComponent(m)}`,{method:`DELETE`});let e=i.lowerLayer;p(e),r?.({layer:e,path:m})}catch(e){y(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{_(null)}}}let[E,D]=(0,x.useState)(!1),[O,k]=(0,x.useState)(``),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(!1),[ee,te]=(0,x.useState)(!1),P=(0,x.useRef)(null),F=f===`tenant`||f===`repo`,I=E?O:i?.content??``,ne=(0,x.useMemo)(()=>i?.lowerContent?Nw(i.lowerContent,I):null,[i,I]);(0,x.useEffect)(()=>{D(!1),k(``),j(null)},[f,m]);function re(){i&&(k(i.content),D(!0),d(`source`),j(null))}function ie(){D(!1),k(``),j(null)}(0,x.useEffect)(()=>{if(!(!E||!m))return P.current&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>{N(!0),q(`/intelligence/preflight`,J({path:m,content:O},{method:`POST`})).then(e=>j(e)).catch(()=>j(null)).finally(()=>N(!1))},250),()=>{P.current&&window.clearTimeout(P.current)}},[E,O,m]);async function L(){if(!(!f||!m||!A?.ok||ee)){te(!0),y(null);try{await q(`/intelligence/file`,J({layer:f,path:m,content:O},{method:`PUT`})),D(!1),k(``),j(null),r?.({layer:f,path:m}),h(e=>e),p(e=>e),a(await q(`/intelligence/file?layer=${encodeURIComponent(f)}&path=${encodeURIComponent(m)}`))}catch(e){y(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{te(!1)}}}return(0,G.jsx)(c_,{open:e,onOpenChange:t,children:(0,G.jsxs)(d_,{className:`flex max-w-4xl flex-col gap-0 max-h-[min(820px,calc(100vh-2rem))]`,children:[(0,G.jsxs)(f_,{className:`shrink-0`,children:[(0,G.jsxs)(p_,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ir,{className:`size-4 text-fg-muted`}),(0,G.jsx)(`span`,{className:`truncate`,children:n?.displayName??`File`}),n?(0,G.jsx)(UC,{layer:n.layer,overrides:n.overrides,size:`sm`}):null]}),(0,G.jsx)(m_,{className:`font-mono text-[11px]`,children:n?.path})]}),(0,G.jsx)(h_,{className:`flex-1 min-h-0 overflow-y-auto px-6 pb-6`,children:c?(0,G.jsx)(`div`,{className:`flex h-48 items-center justify-center text-fg-muted`,children:(0,G.jsx)($r,{className:`size-4 animate-spin`})}):o?(0,G.jsx)(`div`,{className:`rounded-lg border border-danger/40 bg-danger/10 p-3 text-sm text-danger`,children:o}):i?(0,G.jsxs)(Bb,{value:u,onValueChange:e=>d(e),className:`gap-3`,children:[(0,G.jsxs)(`div`,{className:`sticky top-0 z-30 -mx-6 border-b border-line bg-panel px-6 pb-3 pt-1`,children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(Hb,{value:`rendered`,children:`Rendered`}),(0,G.jsx)(Hb,{value:`source`,children:`Source`}),(0,G.jsxs)(Hb,{value:`diff`,disabled:!b,children:[`Diff`,b&&i.lowerLayer?(0,G.jsxs)(`span`,{className:`ml-1.5 text-[10px] opacity-70`,children:[`vs `,i.lowerLayer]}):null]})]}),u===`diff`&&i.lowerContent&&ne?(0,G.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 rounded-lg border border-line bg-panel-raised px-3 py-1.5 text-[10px] uppercase tracking-wide text-fg-subtle`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-md border border-danger-500/40 bg-danger-500/15 px-1.5 py-0.5 font-mono text-[11px] normal-case text-danger-400`,children:[`−`,ne.removed]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-md border border-success-500/40 bg-success-500/15 px-1.5 py-0.5 font-mono text-[11px] normal-case text-success-400`,children:[`+`,ne.added]}),(0,G.jsxs)(`span`,{className:`text-fg-subtle/70`,children:[i.lowerLayer,` → `,i.layer]})]}),ne.added>0?(0,G.jsxs)(`button`,{type:`button`,onClick:C,className:`inline-flex items-center gap-1 rounded-md border border-success-500/30 bg-success-500/10 px-2 py-0.5 font-medium normal-case tracking-normal text-success-400 transition-colors hover:bg-success-500/20`,children:[(0,G.jsx)(tr,{className:`size-3`}),`Jump to first added line`]}):null]}):null]}),(0,G.jsx)(Ub,{value:`rendered`,className:`rounded-lg border border-line bg-canvas/40 p-4`,children:(0,G.jsx)(`div`,{className:`prose-coro space-y-3 text-sm leading-6 text-fg`,dangerouslySetInnerHTML:{__html:Jb(I)}})}),(0,G.jsx)(Ub,{value:`source`,className:`rounded-lg border border-line bg-canvas/60`,children:E?(0,G.jsxs)(`div`,{className:`space-y-2 p-3`,children:[(0,G.jsx)(`textarea`,{value:O,onChange:e=>k(e.target.value),spellCheck:!1,className:`h-[360px] w-full resize-y rounded-md border border-line bg-canvas/80 p-3 font-mono text-[12px] leading-5 text-fg outline-none focus:border-accent-400`}),(0,G.jsx)(Rw,{preflight:A,loading:M})]}):(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words p-4 font-mono text-[12px] leading-5 text-fg`,children:i.content})}),(0,G.jsx)(Ub,{value:`diff`,className:`rounded-lg border border-line bg-canvas/60`,children:i.lowerContent?(0,G.jsx)(`div`,{ref:S,children:(0,G.jsx)(`div`,{dangerouslySetInnerHTML:{__html:Fw(i.lowerContent,I)}})}):(0,G.jsx)(`div`,{className:`p-4 text-sm text-fg-muted`,children:`No lower layer to diff against.`})})]}):null}),(0,G.jsx)(`div`,{className:`shrink-0 border-t border-line px-6 py-3`,children:i?(0,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i.layer===`base`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{size:`sm`,variant:`primary`,disabled:g!==null,onClick:()=>w(`tenant`),children:[g===`override`?(0,G.jsx)($r,{className:`mr-1 size-3 animate-spin`}):(0,G.jsx)(pi,{className:`mr-1 size-3`}),`Override in Custom`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,disabled:!0,title:`No repo overlay mounted`,children:[(0,G.jsx)(pi,{className:`mr-1 size-3`}),`Override in Repo`]})]}):(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,disabled:g!==null||!i.lowerLayer||E,onClick:T,title:i.lowerLayer?`Delete this override and fall back to ${i.lowerLayer}`:`Nothing to revert to — no lower layer`,children:[g===`revert`?(0,G.jsx)($r,{className:`mr-1 size-3 animate-spin`}):(0,G.jsx)(gi,{className:`mr-1 size-3`}),`Revert to Coro`]}),F&&!E?(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,onClick:re,children:[(0,G.jsx)(li,{className:`mr-1 size-3`}),`Edit`]}):null,E?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{size:`sm`,variant:`primary`,onClick:L,disabled:!A?.ok||ee||M,children:[ee?(0,G.jsx)($r,{className:`mr-1 size-3 animate-spin`}):(0,G.jsx)(vi,{className:`mr-1 size-3`}),`Save`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,onClick:ie,disabled:ee,children:[(0,G.jsx)(Pi,{className:`mr-1 size-3`}),`Cancel`]})]}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-fg-subtle`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(Ir,{className:`size-3`}),i.layer===`base`?`Base file`:`Override file`]}),i.lowerLayer?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`Shadowing`,(0,G.jsx)(UC,{layer:i.lowerLayer,size:`sm`})]}):null]})]}),v?(0,G.jsx)(`div`,{className:`text-[11px] text-danger-400`,children:v}):null]}):null})]})})}var Bw={workflow:`Workflow`,agent:`Agent`,skill:`Skill`,memory:`Memory note`};function Vw(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,60)}function Hw(e,t){switch(e){case`workflow`:return{path:`workflows/${t}/workflow.md`,content:`---
74
74
  display_name: ${t}
75
75
  description: New tenant workflow.
76
76
  kind: job
@@ -116,8 +116,8 @@ Provide the actual conventions, snippets, or domain knowledge.
116
116
  `};case`memory`:return{path:`memory/${t}.md`,content:`# ${t}
117
117
 
118
118
  A short, durable insight worth remembering across jobs.
119
- `}}}function Jw({open:e,onOpenChange:t,layer:n,kind:r,onCreated:i}){let[a,o]=(0,x.useState)(``),[s,c]=(0,x.useState)(``),[l,u]=(0,x.useState)(``),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(!1),[h,g]=(0,x.useState)(!1),[_,v]=(0,x.useState)(null),y=(0,x.useRef)(null),b=(0,x.useMemo)(()=>Kw(a),[a]);(0,x.useEffect)(()=>{if(!e)return;let t=qw(r,`my-`+r);o(`my-`+r),c(t.content),u(t.path),f(null),v(null)},[e,r]),(0,x.useEffect)(()=>{if(!e)return;let t=qw(r,b||`my-`+r);u(t.path),c(e=>e.includes(`# Agent: my-`)||e.includes(`# Workflow: my-`)||e.startsWith(`---
120
- name: my-`)||e.startsWith(`# my-`)?t.content:e)},[b,r,e]),(0,x.useEffect)(()=>{if(!e||!l||!s){f(null);return}return y.current&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>{m(!0),q(`/intelligence/preflight`,J({path:l,content:s},{method:`POST`})).then(e=>f(e)).catch(()=>f(null)).finally(()=>m(!1))},250),()=>{y.current&&window.clearTimeout(y.current)}},[e,l,s]);async function S(){if(!(!d?.ok||h)){g(!0),v(null);try{await q(`/intelligence/file`,J({layer:n,path:l,content:s},{method:`PUT`})),i({layer:n,path:l}),t(!1)}catch(e){v(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{g(!1)}}}let C=d?.ok===!0&&!h&&!p;return(0,G.jsx)(c_,{open:e,onOpenChange:t,children:(0,G.jsxs)(d_,{className:`flex max-w-3xl flex-col gap-0 max-h-[min(820px,calc(100vh-2rem))]`,children:[(0,G.jsxs)(f_,{className:`px-6 pt-6`,children:[(0,G.jsxs)(p_,{className:`flex items-center gap-2`,children:[(0,G.jsx)(kr,{className:`size-4 text-accent-300`}),`New `,Gw[r],` in `,n===`tenant`?`Custom`:n]}),(0,G.jsx)(m_,{children:`Pick a name, edit the scaffolded content, and Coro pre-validates before saving.`})]}),(0,G.jsxs)(h_,{className:`flex-1 min-h-0 overflow-y-auto space-y-4 px-6 pb-6`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-[160px_1fr] items-center gap-3`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,children:`Name`}),(0,G.jsx)(O_,{value:a,onChange:e=>o(e.target.value),placeholder:`my-${r}`,autoFocus:!0}),(0,G.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,children:`Resolved path`}),(0,G.jsx)(`code`,{className:`truncate rounded bg-overlay/60 px-2 py-1 font-mono text-[11px] text-fg-subtle`,children:l})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,children:`Content`}),(0,G.jsxs)(`span`,{className:`text-[10px] text-fg-subtle`,children:[s.length,` chars`]})]}),(0,G.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),spellCheck:!1,className:`h-[280px] w-full resize-y rounded-md border border-line bg-canvas/60 px-3 py-2 font-mono text-[12px] leading-relaxed text-fg outline-none focus:border-accent-400`})]}),(0,G.jsx)(Uw,{preflight:d,loading:p}),_?(0,G.jsx)(`div`,{className:`rounded-md border border-danger-500/50 bg-danger-500/10 px-3 py-2 text-[12px] text-danger-400`,children:_}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-line px-6 py-3`,children:[(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(!1),disabled:h,children:`Cancel`}),(0,G.jsxs)(Y,{variant:`primary`,size:`sm`,onClick:S,disabled:!C,children:[h?(0,G.jsx)($r,{className:`mr-1 size-3 animate-spin`}):null,`Create`]})]})]})})}var Yw={workflow:{label:`Workflow`,plural:`Workflows`,Icon:B,tone:`text-accent-300`,description:`Multi-phase plans the runner dispatches against. Each workflow sequences agents into phases.`},agent:{label:`Agent`,plural:`Agents`,Icon:ar,tone:`text-success`,description:`Per-phase Claude personas. Override one to change how a phase reasons or what tools it uses.`},skill:{label:`Skill`,plural:`Skills`,Icon:Di,tone:`text-warning`,description:`Claude Code skills picked up automatically when the matching context appears.`},memory:{label:`Memory`,plural:`Memory`,Icon:or,tone:`text-fg-muted`,description:`Append-mode notes. Every layer’s memory file is concatenated at runtime — nothing is shadowed.`}},Xw={base:{label:`Coro`,Icon:ii,tone:`text-fg-muted`,pitch:`Ships with the Coro runner. Read-only — copy any artefact into Custom or Repo to customise it.`},tenant:{label:`Custom`,Icon:Yr,tone:`text-accent-300`,pitch:`Your overlay at ~/.coro/intelligence. Wins over Coro for every repo on this machine.`},repo:{label:`Repo`,Icon:Si,tone:`text-success`,pitch:`The target repo’s .coro/ folder. Highest priority — wins over both Coro and Custom.`}},Zw=`coro:intelligence:intro-dismissed`;function Qw(){let[e,t]=(0,x.useState)(null),[n,r]=(0,x.useState)(null),[i,a]=(0,x.useState)(!0),[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(()=>typeof window>`u`?!0:window.localStorage.getItem(Zw)!==`1`),[u,d]=(0,x.useState)([]),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(null),[v,y]=(0,x.useState)(!1);async function b(e){try{let[n,i]=await Promise.all([q(`/intelligence/layers`,{signal:e}),po().catch(()=>[])]);if(e?.aborted)return;t(n),d(i),r(null)}catch(e){if(e.name===`AbortError`)return;r(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{a(!1),s(!1)}}(0,x.useEffect)(()=>{let e=new AbortController;return b(e.signal),()=>e.abort()},[]);function S(){l(!1),typeof window<`u`&&window.localStorage.setItem(Zw,`1`)}async function C(){s(!0),await b()}let w=(0,x.useMemo)(()=>{let t={workflow:[],agent:[],skill:[],memory:[]};if(!e)return t;for(let n of e.artefacts)t[n.kind].push(n);return t},[e]);function T(e){let t=e.path.split(`/`)[1],n=u.find(n=>n.id===t||n.workflowPath===e.path);n&&(p(n),h(!0))}function E(e){_({layer:e.layer,path:e.path,displayName:e.displayName,overrides:e.overrides}),y(!0)}let D=(0,x.useMemo)(()=>e?.layers.filter(e=>e.writable).map(e=>e.layer)??[],[e]);function O(e){C(),_({layer:e.layer,path:e.path,displayName:e.path.split(`/`).pop()??e.path}),y(!0)}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(cg,{eyebrow:`Intelligence`,title:`Layered Intelligence`,description:`Every workflow, agent, skill, and memory note the runner can see — grouped by the layer it lives on. Drop files into Custom or Repo to customise behaviour without forking the Coro intelligence.`,actions:(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:C,disabled:i||o,children:[(0,G.jsx)(hi,{className:`size-3.5 ${o?`animate-spin`:``}`}),`Refresh`]})}),c?(0,G.jsxs)(`div`,{className:`relative rounded-xl border border-line bg-overlay/40 p-4 pr-10 text-sm text-fg-muted`,children:[(0,G.jsx)(`button`,{onClick:S,className:`absolute right-3 top-3 rounded-md p-1 text-fg-subtle hover:bg-overlay hover:text-fg`,"aria-label":`Dismiss`,children:(0,G.jsx)(Pi,{className:`size-3.5`})}),(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(qr,{className:`mt-0.5 size-4 shrink-0 text-accent-300`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`p`,{children:[`Coro resolves intelligence in three layers: `,(0,G.jsx)(`strong`,{className:`text-fg`,children:`Repo`}),` `,`(the working repo’s `,(0,G.jsx)(`code`,{className:`rounded bg-overlay px-1`,children:`.coro/`}),` folder) wins over`,` `,(0,G.jsx)(`strong`,{className:`text-fg`,children:`Custom`}),` (your`,` `,(0,G.jsx)(`code`,{className:`rounded bg-overlay px-1`,children:`~/.coro/intelligence`}),` overlay), which wins over the`,` `,(0,G.jsx)(`strong`,{className:`text-fg`,children:`Coro`}),` intelligence shipped with the runner.`]}),(0,G.jsxs)(`p`,{children:[`Most artefacts use `,(0,G.jsx)(`em`,{children:`last-wins replace`}),`: the highest-priority copy is the only one used. Memory files use `,(0,G.jsx)(`em`,{children:`append`}),`: every layer’s contribution is concatenated, so notes stack across layers. Drop a file at the matching path in a higher layer to override (or extend, for memory).`]})]})]})]}):null,i&&!e?(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,G.jsx)(bg,{className:`h-28`}),(0,G.jsx)(bg,{className:`h-28`}),(0,G.jsx)(bg,{className:`h-28`})]}):e?(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[e.layers.map(e=>(0,G.jsx)($w,{layer:e,onCreated:O},e.layer)),e.layers.some(e=>e.layer===`repo`)?null:(0,G.jsx)(eT,{})]}):null,n?(0,G.jsx)(gg,{title:`Couldn’t load intelligence catalogue`,message:n}):null,e?(0,G.jsx)(`div`,{className:`grid gap-4 lg:grid-cols-2 xl:grid-cols-4`,children:[`workflow`,`agent`,`skill`,`memory`].map(e=>(0,G.jsx)(tT,{kind:e,artefacts:w[e],writableLayers:D,onCreated:O,onOpenInspector:E,onOpenWorkflow:e===`workflow`?T:void 0},e))}):null,(0,G.jsx)(ZC,{open:m,onOpenChange:h,workflow:f}),(0,G.jsx)(Ww,{open:v,onOpenChange:y,target:g,onChanged:e=>{e&&_(t=>t&&{...t,layer:e.layer,path:e.path}),C()}})]})}function $w({layer:e,onCreated:t}){let n=Xw[e.layer],r=n.Icon,i=e.counts.workflow+e.counts.agent+e.counts.skill+e.counts.memory;return(0,G.jsxs)(lg,{className:`flex flex-col`,children:[(0,G.jsxs)(ug,{className:`flex flex-row items-start justify-between gap-3 space-y-0 pb-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(r,{className:`size-4 ${n.tone}`}),(0,G.jsx)(dg,{className:`text-sm font-semibold`,children:n.label}),(0,G.jsx)(JC,{layer:e.layer,size:`sm`}),e.writable?null:(0,G.jsx)(`span`,{className:`rounded bg-fg/8 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-fg-subtle`,children:`read-only`})]}),(0,G.jsx)(`p`,{className:`text-xs leading-snug text-fg-muted`,children:n.pitch})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[e.writable?(0,G.jsx)(iT,{layer:e.layer,onCreated:t}):null,(0,G.jsxs)(`div`,{className:`text-right`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-semibold tabular-nums`,children:i}),(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:`files`})]})]})]}),(0,G.jsxs)(pg,{className:`space-y-2 pt-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-fg-subtle`,children:[(0,G.jsx)(Rr,{className:`size-3`}),(0,G.jsx)(`code`,{className:`truncate font-mono`,title:e.root,children:rT(e.root)})]}),e.exists?null:(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-fg-subtle`,children:[(0,G.jsx)(Mi,{className:`size-3 text-warning`}),`Not yet created on disk.`]}),(0,G.jsx)(`div`,{className:`grid grid-cols-4 gap-1 pt-1`,children:[`workflow`,`agent`,`skill`,`memory`].map(t=>{let n=Yw[t].Icon;return(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-0.5 rounded-md border border-line bg-overlay/30 px-1 py-1.5`,title:Yw[t].plural,children:[(0,G.jsx)(n,{className:`size-3 ${Yw[t].tone}`}),(0,G.jsx)(`span`,{className:`text-xs font-medium tabular-nums`,children:e.counts[t]})]},t)})})]})]})}function eT(){return(0,G.jsx)(lg,{className:`flex flex-col border-dashed bg-overlay/20`,children:(0,G.jsx)(ug,{className:`flex flex-row items-start justify-between gap-3 space-y-0 pb-3`,children:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Si,{className:`size-4 text-success`}),(0,G.jsx)(dg,{className:`text-sm font-semibold`,children:`Repo`}),(0,G.jsx)(JC,{layer:`repo`,size:`sm`})]}),(0,G.jsxs)(`p`,{className:`text-xs leading-snug text-fg-muted`,children:[`Highest-priority overlay, scoped to a single repo via its `,(0,G.jsx)(`code`,{className:`rounded bg-overlay px-1`,children:`.coro/`}),` folder. Surfaces here once a job clones a repo with one.`]})]})})})}function tT({kind:e,artefacts:t,writableLayers:n,onCreated:r,onOpenInspector:i,onOpenWorkflow:a}){let o=Yw[e],s=o.Icon;return(0,G.jsxs)(lg,{className:`flex min-h-[12rem] flex-col`,children:[(0,G.jsxs)(ug,{className:`space-y-1 pb-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(s,{className:`size-4 ${o.tone}`}),(0,G.jsx)(dg,{className:`text-sm font-semibold`,children:o.plural})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`rounded bg-overlay/60 px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-muted`,children:t.length}),n.length>0?(0,G.jsx)(aT,{kind:e,writableLayers:n,onCreated:r}):null]})]}),(0,G.jsx)(`p`,{className:`text-[11px] leading-snug text-fg-subtle`,children:o.description})]}),(0,G.jsx)(pg,{className:`flex-1 space-y-1.5 pt-0`,children:t.length===0?(0,G.jsxs)(`div`,{className:`flex h-24 items-center justify-center text-center text-[11px] text-fg-subtle`,children:[`No `,o.plural.toLowerCase(),` found.`]}):t.map(e=>(0,G.jsx)(nT,{artefact:e,onOpenInspector:i,onOpenWorkflow:a},`${e.layer}:${e.path}`))})]})}function nT({artefact:e,onOpenInspector:t,onOpenWorkflow:n}){return(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`group block w-full rounded-lg border border-line bg-canvas/30 p-2.5 text-left transition-colors hover:border-accent-500/40 hover:bg-overlay/40`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`truncate text-[13px] font-medium text-fg`,children:e.displayName}),e.kind===`memory`?(0,G.jsx)(`span`,{title:`Append-mode: stacks across layers`,className:`text-[10px] text-fg-subtle`,children:`∥`}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(Ir,{className:`size-2.5 shrink-0 text-fg-subtle`}),(0,G.jsx)(`code`,{className:`truncate font-mono text-[10px] text-fg-subtle`,title:e.path,children:e.path})]}),e.description?(0,G.jsx)(`p`,{className:`line-clamp-2 text-[11px] leading-snug text-fg-muted`,children:e.description}):null,e.kind===`workflow`&&n?(0,G.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),n(e)},className:`mt-1 inline-flex items-center gap-1 text-[10px] font-medium uppercase tracking-wide text-accent-300 hover:text-accent-200`,children:`View phases →`}):null]}),(0,G.jsx)(JC,{layer:e.layer,overrides:e.overrides,size:`sm`})]})})}function rT(e){if(typeof window>`u`)return e;let t=e.match(/^\/(?:Users|home)\/[^/]+/);return t?`~`+e.slice(t[0].length):e}function iT({layer:e,onCreated:t}){let[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(`memory`);function o(e){a(e),r(!0)}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Jh,{children:[(0,G.jsx)(Yh,{asChild:!0,children:(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 px-2`,children:[(0,G.jsx)(pi,{className:`size-3`}),`New`]})}),(0,G.jsxs)(Zh,{align:`end`,className:`w-44`,children:[(0,G.jsx)($h,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:`New artefact`}),(0,G.jsx)(eg,{}),[`workflow`,`agent`,`skill`,`memory`].map(e=>{let t=Yw[e].Icon;return(0,G.jsxs)(Qh,{onClick:()=>o(e),children:[(0,G.jsx)(t,{className:`mr-2 size-3.5 ${Yw[e].tone}`}),Yw[e].label]},e)})]})]}),(0,G.jsx)(Jw,{open:n,onOpenChange:r,layer:e,kind:i,onCreated:e=>t?.(e)})]})}function aT({kind:e,writableLayers:t,onCreated:n}){let[r,i]=(0,x.useState)(!1),[a,o]=(0,x.useState)(t[0]),s=Yw[e];function c(e){o(e),i(!0)}let l=`inline-flex size-6 items-center justify-center rounded text-fg-subtle transition-colors hover:bg-overlay/60 hover:text-fg`,u=`New ${s.label.toLowerCase()}`;return(0,G.jsxs)(G.Fragment,{children:[t.length===1?(0,G.jsx)(`button`,{type:`button`,onClick:()=>c(t[0]),className:l,title:u,"aria-label":u,children:(0,G.jsx)(pi,{className:`size-3.5`})}):(0,G.jsxs)(Jh,{children:[(0,G.jsx)(Yh,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,className:l,title:u,"aria-label":u,children:(0,G.jsx)(pi,{className:`size-3.5`})})}),(0,G.jsxs)(Zh,{align:`end`,className:`w-44`,children:[(0,G.jsxs)($h,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:[`New `,s.label.toLowerCase(),` in…`]}),(0,G.jsx)(eg,{}),t.map(e=>(0,G.jsxs)(Qh,{onClick:()=>c(e),children:[(0,G.jsx)(JC,{layer:e,size:`sm`}),(0,G.jsx)(`span`,{className:`ml-2`,children:Xw[e].label})]},e))]})]}),(0,G.jsx)(Jw,{open:r,onOpenChange:i,layer:a,kind:e,onCreated:e=>n?.(e)})]})}var oT=[{id:`general`,group:`setup`,label:`General`,description:`Coach mode and Coro plan mode preferences.`,icon:Ei,required:!1},{id:`llm-provider`,group:`setup`,label:`LLM provider`,description:`Authenticate the runner against the model that drives every job.`,icon:ar,required:!0},{id:`source-control`,group:`setup`,label:`Source control`,description:`Git credentials used for clone, branch, push, and PR operations.`,icon:Vr,required:!0},{id:`issue-tracker`,group:`setup`,label:`Issue tracker`,description:`Optional. Used by campaigns when they need to file an epic + child issues.`,icon:Ai,required:!1},{id:`plugins`,group:`extensions`,label:`Plugins`,description:`Provider integrations the runner has loaded plus drop-in installation.`,icon:fi,required:!1},{id:`mcp`,group:`extensions`,label:`MCP servers`,description:`Bring-your-own MCP servers and Claude Code inheritance.`,icon:Si,required:!1},{id:`guardrails`,group:`extensions`,label:`Guardrails`,description:`Policies the runner enforces before agents open PRs or call tools.`,icon:Ti,required:!1},{id:`paths`,group:`advanced`,label:`Paths`,description:`Filesystem locations for intelligence overlays and working repositories.`,icon:zr,required:!1}],sT={setup:{title:`Setup`,hint:`Required to run jobs. Finish these first.`},extensions:{title:`Extensions`,hint:`Opt-in capabilities. Add when you need them.`},advanced:{title:`Advanced`,hint:`Rarely changed. Defaults work for most installs.`}};function cT(e){let t=oT.find(t=>t.id===e);if(!t)throw Error(`Unknown settings section id: ${e}`);return t}function lT({title:e,description:t,status:n,statusLabel:r,required:i,action:a,footer:o,className:s,children:c}){return(0,G.jsxs)(lg,{className:s,children:[(0,G.jsxs)(ug,{className:W(`gap-3 border-b border-line pb-4`,a?`sm:flex-row sm:items-start sm:justify-between`:``),children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(dg,{children:e}),i?(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.18em] text-fg-subtle`,children:`Required`}):null,n?(0,G.jsx)(jv,{status:n,label:r}):null]}),t?(0,G.jsx)(fg,{children:t}):null]}),a?(0,G.jsx)(`div`,{className:`shrink-0`,children:a}):null]}),(0,G.jsx)(pg,{className:`space-y-5 pt-5`,children:c}),o?(0,G.jsx)(`div`,{className:`border-t border-line bg-overlay/30 px-6 py-3 text-xs text-fg-subtle`,children:o}):null]})}function uT({onTest:e,disabled:t,label:n,className:r}){let[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)(null);async function c(){a(!0),s(null);try{s(await e())}catch(e){s({ok:!1,message:e instanceof Error?e.message:String(e)})}finally{a(!1)}}return(0,G.jsxs)(`div`,{className:W(`flex w-full flex-col gap-2`,r),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void c(),disabled:t||i,children:[i?(0,G.jsx)($r,{className:`size-3.5 animate-spin`}):(0,G.jsx)(di,{className:`size-3.5`}),i?`Testing…`:n??`Test connection`]}),o?(0,G.jsxs)(`div`,{className:W(`flex items-center gap-1.5 text-xs`,o.ok?`text-success-300`:`text-danger-300`),role:`status`,children:[o.ok?(0,G.jsx)(fr,{className:`size-3.5`}):(0,G.jsx)(_r,{className:`size-3.5`}),(0,G.jsx)(`span`,{children:o.message??(o.ok?`Connection succeeded.`:`Connection failed.`)})]}):null]}),o?.checks&&o.checks.length>0?(0,G.jsx)(`ul`,{className:`space-y-1 rounded-xl border border-line bg-overlay/30 px-3 py-2 text-xs`,children:o.checks.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2`,children:[e.ok?(0,G.jsx)(fr,{className:`mt-0.5 size-3.5 shrink-0 text-success-300`}):(0,G.jsx)(_r,{className:`mt-0.5 size-3.5 shrink-0 text-danger-300`}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,G.jsx)(`span`,{className:W(`font-medium`,e.ok?`text-fg`:`text-danger-300`),children:e.name}),(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:e.message})]}),!e.ok&&e.hint?(0,G.jsxs)(`span`,{className:`text-fg-subtle italic`,children:[`→ `,e.hint]}):null]})]},`${e.name}-${t}`))}):null]})}var dT={1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-2 xl:grid-cols-4`};function fT({name:e,value:t,options:n,onChange:r,cols:i=3,className:a}){let o=e??`choice-${Math.random().toString(36).slice(2,8)}`;return(0,G.jsx)(`div`,{role:`radiogroup`,className:W(`grid gap-3`,dT[i],a),children:n.map(e=>{let n=e.value===t;return(0,G.jsxs)(`label`,{className:W(`cursor-pointer rounded-2xl border px-4 py-3 text-left text-sm transition-colors`,n?`border-accent-500/40 bg-accent-500/8 text-fg ring-1 ring-accent-500/30`:`border-line bg-overlay/40 text-fg-muted hover:border-line-strong hover:text-fg`,e.disabled&&`cursor-not-allowed opacity-60`),children:[(0,G.jsx)(`input`,{type:`radio`,name:o,value:e.value,checked:n,disabled:e.disabled,onChange:()=>!e.disabled&&r(e.value),className:`sr-only`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:e.label}),e.badge]}),e.description?(0,G.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:e.description}):null]},e.value)})})}var pT=[{value:`claudeLogin`,label:`Claude login`,description:`Recommended. Uses Claude Code's local session and MCP permissions.`},{value:`apiKey`,label:`API key`,description:`Direct Anthropic billing with explicit service credentials.`},{value:`oauth`,label:`Legacy OAuth token`,description:`Fallback only. Stores a raw token without session refresh.`}];function mT({pluginId:e,onConnected:t}){let{draft:n,setPluginField:r}=y_(),i=n.pluginInstalled[e]?.config??{},a=i.method??`claudeLogin`,o=i.apiKey??``,s=i.oauthToken??``,c=i.account??null,[l,u]=(0,x.useState)({status:`idle`}),[d,f]=(0,x.useState)(!1),[p,m]=(0,x.useState)(!1),[h,g]=(0,x.useState)(``),[_,v]=(0,x.useState)(``),[y,b]=(0,x.useState)(null),[S,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(!1);(0,x.useEffect)(()=>{a===`claudeLogin`&&l.status===`idle`&&c&&u({status:`connected`,account:c})},[a,c,l.status]),(0,x.useEffect)(()=>{if(l.status!==`authorizing`)return;let n=window.setInterval(async()=>{try{let n=await q(`/config/anthropic/claude-login/status`);if(n.status===`idle`)return;u(n),n.status===`connected`&&(r(e,`method`,`claudeLogin`),n.account&&r(e,`account`,n.account),t?.())}catch{}},2e3);return()=>window.clearInterval(n)},[l.status,e,r,t]);let A=l.account??c,j=l.automaticUrl??l.manualUrl??null,M=l.status===`connected`||!!A;function N(t){r(e,`method`,t),b(null),T(null),D(null)}async function ee(){f(!0),b(null);try{let n=await q(`/config/anthropic/claude-login/start`,{method:`POST`});if(u(n),r(e,`method`,`claudeLogin`),n.account&&r(e,`account`,n.account),n.status===`connected`){t?.();return}if(n.status===`authorizing`&&(n.automaticUrl||n.manualUrl)&&window.open(n.automaticUrl??n.manualUrl,`_blank`,`noopener,noreferrer`),n.status===`error`)throw Error(n.error??`Claude login failed to start.`)}catch(e){b(e instanceof K||e instanceof Error?e.message:String(e))}finally{f(!1)}}async function te(){m(!0),b(null);try{let n=await q(`/config/anthropic/claude-login/callback`,J(gT(h,_),{method:`POST`}));if(u(n),n.status!==`connected`)throw Error(n.error??`Claude login did not complete.`);r(e,`method`,`claudeLogin`),n.account&&r(e,`account`,n.account),g(``),v(``),t?.()}catch(e){b(e instanceof K||e instanceof Error?e.message:String(e))}finally{m(!1)}}async function P(){try{return await q(`/test/llm`,J({provider:e,config:i},{method:`POST`}))}catch(e){return{ok:!1,message:e instanceof Error?e.message:String(e)}}}let F=a===`claudeLogin`?l.status===`connected`||!!c:a===`apiKey`?o.length>0:s.length>0;async function I(){C(!0),T(`Launching Claude Code login. Complete sign-in in your browser…`),D(null),b(null);try{let t=await q(`/config/anthropic/generate-oauth-token`,{method:`POST`});t.authUrl&&D(t.authUrl),t.token?(r(e,`oauthToken`,t.token),r(e,`method`,`oauth`),T(`Token captured (${t.token.slice(0,16)}…). Click Save to persist it.`)):(b(`Token generation returned no token.`),T(null))}catch(e){if(e instanceof K){let t=e.payload;t?.authUrl&&D(t.authUrl),(t?.error===`CLI_NOT_FOUND`||t?.error===`PLATFORM_UNSUPPORTED`)&&k(!0),b(t?.message??t?.stderr??e.message)}else b(e instanceof Error?e.message:String(e));T(null)}finally{C(!1)}}return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsx)(Sv,{label:`Authentication method`,children:(0,G.jsx)(fT,{name:`${e}-anthropic-method`,value:a,onChange:N,options:pT,cols:3})}),y?(0,G.jsx)(Ov,{tone:`danger`,children:y}):null,a===`claudeLogin`?(0,G.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-line bg-overlay/40 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(jv,{status:vT(l),label:yT(l)}),A?.email?(0,G.jsx)(`span`,{className:`text-sm text-fg-muted`,children:A.email}):null]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:()=>void ee(),disabled:d,children:d?`Starting…`:M?`Reconnect`:`Connect Claude`})]}),(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Uses Claude Code's local login session, including MCP permissions and session refresh. No copy-pasted token is stored in Coro.`}),A?(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,G.jsx)(_T,{label:`Provider`,value:hT(A.apiProvider)}),(0,G.jsx)(_T,{label:`Organization`,value:A.organization??`Not reported`}),(0,G.jsx)(_T,{label:`Plan`,value:A.subscriptionType??`Not reported`}),(0,G.jsx)(_T,{label:`Token source`,value:A.tokenSource??`Not reported`})]}):null,l.status===`authorizing`?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(Ov,{tone:`warning`,children:`Waiting for the Claude browser login to finish. This panel polls automatically.`}),j?(0,G.jsxs)(`div`,{className:`rounded-xl border border-line bg-canvas/40 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,G.jsx)(`div`,{children:`Browser blocked? Continue here:`}),(0,G.jsx)(`a`,{href:j,target:`_blank`,rel:`noopener noreferrer`,className:`mt-1 block break-all text-accent-300 hover:text-accent-400`,children:j})]}):null,(0,G.jsxs)(`div`,{className:`grid gap-3 rounded-xl border border-line bg-canvas/40 p-3`,children:[(0,G.jsx)(Sv,{label:`Callback URL or authorization code`,hint:`Use this only if automatic completion fails.`,children:(0,G.jsx)(O_,{value:h,onChange:e=>g(e.target.value),placeholder:`Paste the redirected URL or the code parameter`})}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end`,children:[(0,G.jsx)(Sv,{label:`State override`,hint:`Optional if you pasted a raw authorization code.`,children:(0,G.jsx)(O_,{value:_,onChange:e=>v(e.target.value),placeholder:`Optional state`})}),(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>void te(),disabled:p,children:p?`Completing…`:`Complete manually`})]})]})]}):null]}):null,a===`apiKey`?(0,G.jsx)(Sv,{label:`API key`,required:!0,hint:`Anthropic API key from console.anthropic.com.`,children:(0,G.jsx)(Cv,{value:o,onChange:t=>r(e,`apiKey`,t.target.value),placeholder:`sk-ant-…`})}):null,a===`oauth`?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Sv,{label:`OAuth token`,required:!0,hint:`Legacy fallback only. Prefer Claude login whenever possible.`,children:(0,G.jsx)(Cv,{value:s,onChange:t=>r(e,`oauthToken`,t.target.value),placeholder:`sk-ant-oat01-…`})}),O?null:(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>void I(),disabled:S,children:[(0,G.jsx)(Jr,{}),S?`Generating…`:`Generate via claude setup-token`]}),w?(0,G.jsx)(Ov,{tone:`success`,children:w}):null,E?(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3 text-sm text-fg-muted`,children:[(0,G.jsx)(`div`,{children:`Browser blocked? Sign in here:`}),(0,G.jsx)(`a`,{href:E,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 block break-all text-accent-300 hover:text-accent-400`,children:E})]}):null]}):null,(0,G.jsxs)(`div`,{className:`border-t border-line pt-4`,children:[(0,G.jsx)(uT,{onTest:P,disabled:!F,label:`Test connection`}),(0,G.jsxs)(`p`,{className:`mt-2 text-[12px] text-fg-subtle`,children:[`Sends a 1-token `,(0,G.jsx)(`span`,{className:`font-mono`,children:`/v1/messages`}),` ping with your current credentials. For Claude login, reads the OAuth session from your local keychain.`]})]})]})}function hT(e){switch(e){case`firstParty`:return`Claude`;case`anthropicAws`:return`Anthropic AWS`;case`bedrock`:return`Amazon Bedrock`;case`vertex`:return`Vertex AI`;case`foundry`:return`Azure AI Foundry`;default:return e??`Unknown`}}function gT(e,t){let n=e.trim();if(!n)throw Error(`Paste the callback URL or authorization code to complete login manually.`);if(/^https?:\/\//i.test(n)){let e=new URL(n),r=e.searchParams.get(`code`);if(!r)throw Error(`The callback URL is missing the code query parameter.`);return{authorizationCode:r,state:e.searchParams.get(`state`)??(t.trim()||void 0)}}return{authorizationCode:n,state:t.trim()||void 0}}function _T({label:e,value:t}){return(0,G.jsxs)(`div`,{className:`rounded-xl border border-line bg-overlay/40 px-3 py-2.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:e}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg`,children:t})]})}function vT(e){switch(e.status){case`connected`:return`ok`;case`authorizing`:return`pending`;case`error`:return`error`;default:return`unset`}}function yT(e){switch(e.status){case`connected`:return`Connected`;case`authorizing`:return`Waiting for browser`;case`error`:return`Failed`;default:return`Not connected`}}var bT={"anthropic-auth":mT};function xT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&(e.properties!==void 0||e.type===`object`)}function ST(e){return/token|apikey|api_key|password|secret|appPassword/i.test(e)}function CT(e,t){return t?.format===`uri`||t?.format===`url`?!0:/url|baseUrl|endpoint|host/i.test(e)}function wT(e,t){return t?.title?t.title:e.replace(/[_-]+/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase())}function TT(e){if(!xT(e)||!e.properties)return[];let t=new Set(e.required??[]);return Object.entries(e.properties).map(([e,n])=>{let r=ST(e)?`secret`:CT(e,n)?`url`:`text`;return{name:e,label:wT(e,n),hint:n.description,required:t.has(e),kind:r,placeholder:n.default!==void 0&&typeof n.default!=`object`?String(n.default):void 0}})}function ET({plugin:e,onTest:t,defaultControl:n,footerNotice:r,onConnected:i}){let{draft:a,setPluginField:o,setPluginEnabled:s,dirtyPluginIds:c}=y_(),{manifest:l,source:u,configured:d,active:f,activationHint:p}=e,m=l.id in a.pluginInstalled,h=m?a.pluginInstalled[l.id]:{config:{}},g=m&&h.enabled!==!1,_=(0,x.useMemo)(()=>TT(l.configSchema),[l.configSchema]),v=c.has(l.id),y=l.ui?.customPanel?bT[l.ui.customPanel]:void 0,b=_.some(e=>e.required),S=_.filter(e=>e.required).every(e=>{let t=h.config[e.name];return typeof t==`string`?t.length>0:t!=null}),C=Object.values(h.config).some(e=>typeof e==`string`?e.length>0:e!=null),w=g?f&&d?{label:`active`,tone:`success`}:d?{label:`configured`,tone:`warning`}:S&&(b||C)?{label:`ready to save`,tone:`warning`}:{label:`needs setup`,tone:`neutral`}:m?{label:`disabled`,tone:`neutral`}:{label:`not configured`,tone:`neutral`};function T(e){let t=h.config[e.name],n=typeof t==`string`?t:t==null?``:String(t),r=t=>o(l.id,e.name,t);return e.kind===`secret`?(0,G.jsx)(Cv,{value:n,onChange:e=>r(e.target.value),placeholder:e.placeholder,autoComplete:`off`}):(0,G.jsx)(O_,{type:e.kind===`url`?`url`:`text`,value:n,onChange:e=>r(e.target.value),placeholder:e.placeholder,inputMode:e.kind===`url`?`url`:void 0})}return(0,G.jsxs)(`div`,{className:W(`rounded-2xl border bg-overlay/40 px-4 py-4 transition-colors`,v?`border-accent-400/50`:`border-line`),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(E_,{pluginId:l.id,size:20}),(0,G.jsx)(`div`,{className:`text-[15px] font-medium text-fg`,children:l.displayName}),(0,G.jsx)(`span`,{className:`font-mono text-[11px] text-fg-subtle`,children:l.id}),(0,G.jsx)(`span`,{className:W(`rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]`,u===`dropin`?`border-accent-400/40 bg-accent-500/10 text-accent-200`:`border-line bg-overlay/60 text-fg-muted`),children:u===`dropin`?`drop-in`:`built in`}),(0,G.jsx)(`span`,{className:W(`rounded-full border px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.16em]`,zo(w.tone)),children:w.label}),v?(0,G.jsx)(`span`,{className:`rounded-full border border-accent-400/50 bg-accent-500/10 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] text-accent-200`,children:`unsaved`}):null]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[12px] text-fg-muted`,children:[`v`,l.version,` · kind `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:l.kind})]}),p&&!d?(0,G.jsx)(`div`,{className:`mt-2 text-[12px] leading-5 text-fg-muted`,children:p}):null]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-[12px] text-fg-muted`,children:[(0,G.jsx)(`span`,{children:`Enabled`}),(0,G.jsx)(Ax,{checked:g,onCheckedChange:e=>s(l.id,e),ariaLabel:`Enable ${l.displayName}`,size:`sm`})]})]}),g?(0,G.jsxs)(G.Fragment,{children:[y?(0,G.jsx)(`div`,{className:`mt-4`,children:(0,G.jsx)(y,{pluginId:l.id,onConnected:i})}):_.length===0?(0,G.jsx)(Ov,{tone:`neutral`,className:`mt-4`,children:`This plugin doesn't expose configuration. Toggle Enable to register it.`}):(0,G.jsx)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:_.map(e=>(0,G.jsx)(Sv,{label:e.label,required:e.required,hint:e.hint,className:e.kind===`url`?`sm:col-span-2`:void 0,children:T(e)},e.name))}),(t||n||r)&&(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-3 border-t border-line pt-4`,children:[t&&!y?(0,G.jsx)(uT,{onTest:()=>t(h.config),disabled:!S}):null,n,r]})]}):null]})}async function DT(e,t){try{return await q(`/test/llm`,J({provider:e,config:t},{method:`POST`}))}catch(e){return{ok:!1,message:e instanceof Error?e.message:String(e)}}}var OT=[`tier:planning`,`tier:coding`,`tier:mini`];function kT(e,t){return e.startsWith(`tier:`)?`tier`:t.has(e)?`declared`:`custom`}function AT(){let[e,t]=(0,x.useState)(new Map);return(0,x.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await q(`/workflows`);if(e)return;let r=new Map,i=(e,t)=>{let n=r.get(e)??[];n.push(t),r.set(e,n)};for(let e of n.workflows??[])for(let t of e.phases??[]){let n={workflowId:e.id,workflowName:e.name,phaseName:t.name},r=(t.model??``).trim();r&&i(r,n);let a=(t.tier??``).trim();a&&i(`tier:${a}`,n)}t(r)}catch{}})(),()=>{e=!0}},[]),{usagesByAlias:e,referencedNames:(0,x.useMemo)(()=>Array.from(e.keys()).sort(),[e])}}function jT(){let{draft:e,setDraft:t,pluginsCatalogue:n,pluginsCatalogueError:r}=y_(),i=oy({draft:e,pluginsCatalogue:n}).byId[`llm-provider`],a=(0,x.useMemo)(()=>n?n.plugins.filter(e=>e.manifest.kind===`executor`).sort((e,t)=>e.source===t.source?e.manifest.displayName.localeCompare(t.manifest.displayName):e.source===`builtin`?-1:1):[],[n]),o=(0,x.useMemo)(()=>a.filter(t=>{let n=e.pluginInstalled[t.manifest.id];return n===void 0||n.enabled!==!1}).map(e=>e.manifest.id),[a,e.pluginInstalled]),s=e.llmDefaultProvider,c=e=>{t(`llmDefaultProvider`,e)},l=(0,x.useMemo)(()=>Object.entries(e.llmAliases),[e.llmAliases]),u=e=>{t(`llmAliases`,e)},d=(t,n)=>{if(!n||n===t||e.llmAliases[n])return;let r={};for(let[i,a]of Object.entries(e.llmAliases))r[i===t?n:i]=a;u(r)},f=(t,n)=>{let r=e.llmAliases[t]??{provider:``,model:``};u({...e.llmAliases,[t]:{...r,...n}})},p=t=>{let{[t]:n,...r}=e.llmAliases;u(r)},m=()=>{let t=1,n=`new-alias`;for(;e.llmAliases[n];)t+=1,n=`new-alias-${t}`;u({...e.llmAliases,[n]:{provider:s||o[0]||``,model:``}})},{modelsByProvider:h,loadModels:g}=pC();(0,x.useEffect)(()=>{let e=new Set;for(let[,t]of l)t.provider&&!e.has(t.provider)&&(e.add(t.provider),g(t.provider));s&&g(s)},[l,s,g]);let{usagesByAlias:_,referencedNames:v}=AT(),y=(0,x.useMemo)(()=>new Set(v),[v]),b=(0,x.useMemo)(()=>v.filter(t=>!(t in e.llmAliases)&&!t.startsWith(`tier:`)),[v,e.llmAliases]),S=(0,x.useMemo)(()=>OT.filter(t=>!(t in e.llmAliases)),[e.llmAliases]),C=(0,x.useMemo)(()=>{let e=[],t=[],n=[];for(let r of l){let i=kT(r[0],y);i===`tier`?e.push(r):i===`declared`?t.push(r):n.push(r)}return{tiers:e,declared:t,custom:n}},[l,y]),[w,T]=(0,x.useState)(!1),E=t=>{u({...e.llmAliases,[t]:{provider:s||o[0]||``,model:``}})},D=`alias-name-suggestions-${(0,x.useId)()}`;return(0,G.jsx)(lT,{title:`LLM providers`,description:`Configure one or more model providers and route workflow aliases to specific provider/model pairs.`,required:!0,status:i.status,statusLabel:i.label,children:(0,G.jsxs)(`div`,{className:`space-y-6`,children:[r?(0,G.jsxs)(Ov,{tone:`warning`,children:[`Couldn't load the plugin catalogue from the runner: `,r,`.`]}):null,a.length===0?(0,G.jsx)(Ov,{tone:`neutral`,children:`No LLM-provider plugins discovered. Built-ins are bundled with the runner — restart it if this looks wrong.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,G.jsx)(ET,{plugin:e,onTest:t=>DT(e.manifest.id,t)},e.manifest.id))}),(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5`,children:(0,G.jsx)(Sv,{label:`Default provider`,hint:`Used when an alias or workflow phase does not pin a provider explicitly.`,children:(0,G.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg`,children:[(0,G.jsx)(`option`,{value:``,children:`(let the runner choose — defaults to anthropic)`}),o.map(e=>(0,G.jsx)(`option`,{value:e,children:a.find(t=>t.manifest.id===e)?.manifest.displayName??e},e))]})})}),(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Aliases`}),(0,G.jsxs)(`div`,{className:`text-[12px] text-fg-muted`,children:[`Workflow shorthands that map to a concrete `,(0,G.jsx)(`span`,{className:`font-mono`,children:`provider/model`}),` pair. Three groups, in increasing specificity:`]}),(0,G.jsxs)(`ul`,{className:`mt-1.5 space-y-0.5 text-[12px] text-fg-subtle`,children:[(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:`Tiers`}),` — capability slots every workflow defaults to (planning / coding / mini).`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:`Workflow-declared`}),` — alias names a specific workflow phase pins via `,(0,G.jsx)(`span`,{className:`font-mono`,children:`model:`}),`.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:`Custom`}),` — anything you've added that no workflow references yet.`]})]})]}),(0,G.jsxs)(MT,{title:`Tiers`,subtitle:`Workflow defaults. Every install needs these — workflows fall back to the matching tier when a phase doesn't pin a model.`,children:[C.tiers.map(([t,n])=>(0,G.jsx)(NT,{name:t,row:n,kind:`tier`,nameLocked:!0,enabledIds:o,executorPlugins:a,modelsByProvider:h,loadModels:g,usages:_.get(t)??[],aliasNameDatalistId:D,existingAliasNames:Object.keys(e.llmAliases),onRename:d,onUpdate:f,onRemove:p},t)),S.length>0?(0,G.jsx)(`div`,{className:`space-y-1.5`,children:S.map(e=>(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl border border-dashed border-warning-400/50 bg-warning-50/5 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-mono text-sm text-fg`,children:e}),(0,G.jsx)(`div`,{className:`text-[11px] text-fg-subtle`,children:`Not defined in this draft. Active LLM plugins re-seed tier defaults on every runner start — click Define to pin one explicitly.`})]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>E(e),disabled:o.length===0,children:`Define`})]},e))}):null]}),C.declared.length>0||b.length>0?(0,G.jsxs)(MT,{title:`Workflow-declared`,subtitle:`Alias names referenced explicitly by a workflow phase via its model: field.`,children:[C.declared.map(([t,n])=>(0,G.jsx)(NT,{name:t,row:n,kind:`declared`,nameLocked:!0,enabledIds:o,executorPlugins:a,modelsByProvider:h,loadModels:g,usages:_.get(t)??[],aliasNameDatalistId:D,existingAliasNames:Object.keys(e.llmAliases),onRename:d,onUpdate:f,onRemove:p},t)),b.length>0?(0,G.jsx)(`div`,{className:`space-y-1.5`,children:b.map(t=>{let n=_.get(t)??[];return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl border border-dashed border-warning-400/50 bg-warning-50/5 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-mono text-sm text-fg`,children:t}),(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[`Needs definition · used by`,` `,n.map((e,t)=>(0,G.jsxs)(`span`,{children:[t>0?`, `:null,(0,G.jsx)(`span`,{className:`font-mono`,children:e.workflowId}),(0,G.jsxs)(`span`,{className:`opacity-70`,children:[` · `,e.phaseName]})]},`${e.workflowId}-${e.phaseName}-${t}`))]})]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>u({...e.llmAliases,[t]:{provider:s||o[0]||``,model:``}}),disabled:o.length===0,children:`Define`})]},t)})}):null]}):null,(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>T(e=>!e),className:`flex w-full items-center justify-between gap-2 text-left text-sm font-medium text-fg-muted hover:text-fg`,children:[(0,G.jsxs)(`span`,{children:[`Custom `,(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[`(`,C.custom.length,`)`]})]}),(0,G.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:w?`Hide`:`Show`})]}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`text-[12px] text-fg-subtle`,children:`Free-form aliases not referenced by any workflow. Useful for ad-hoc experiments.`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:C.custom.map(([t,n])=>(0,G.jsx)(NT,{name:t,row:n,kind:`custom`,enabledIds:o,executorPlugins:a,modelsByProvider:h,loadModels:g,usages:_.get(t)??[],aliasNameDatalistId:D,existingAliasNames:Object.keys(e.llmAliases),onRename:d,onUpdate:f,onRemove:p},t))}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:m,disabled:o.length===0,children:[(0,G.jsx)(pi,{}),`Add alias`]})})]}):null]}),(0,G.jsx)(`datalist`,{id:D,children:b.map(e=>(0,G.jsx)(`option`,{value:e},e))})]}),(0,G.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:i.detail})]})})}function MT({title:e,subtitle:t,children:n}){return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e}),(0,G.jsx)(`div`,{className:`text-[12px] text-fg-subtle`,children:t})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:n})]})}function NT({name:e,row:t,kind:n,nameLocked:r=!1,enabledIds:i,executorPlugins:a,modelsByProvider:o,loadModels:s,usages:c,aliasNameDatalistId:l,existingAliasNames:u,onRename:d,onUpdate:f,onRemove:p}){let[m,h]=(0,x.useState)(e),g=(0,x.useRef)(e);(0,x.useEffect)(()=>{e!==g.current&&(h(e),g.current=e)},[e]);let _=m.trim(),v=_!==e,y=v&&_.length>0&&u.includes(_),b=v&&_.length===0,S=()=>{if(v){if(y||b){h(e);return}d(e,_),g.current=_}},C=`alias-help-${e}`;return(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`grid gap-2 rounded-xl border border-line bg-canvas/40 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1.4fr)_auto] sm:items-end`,children:[(0,G.jsx)(Sv,{label:`Alias`,children:(0,G.jsx)(O_,{value:m,list:r?void 0:l,readOnly:r,tabIndex:r?-1:void 0,onChange:e=>h(e.target.value),onBlur:S,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),t.target.blur()):t.key===`Escape`&&(h(e),t.target.blur())},placeholder:`coding`,"aria-invalid":y||b||void 0,"aria-describedby":C,className:[y||b?`border-danger-400/60`:``,r?`cursor-default bg-overlay/40 font-mono`:``].filter(Boolean).join(` `)||void 0})}),(0,G.jsx)(`div`,{className:`sm:col-span-2`,children:(0,G.jsx)(dC,{value:{provider:t.provider,model:t.model},onChange:t=>{f(e,{provider:t.provider,model:t.model})},providers:i.map(e=>({id:e,displayName:a.find(t=>t.manifest.id===e)?.manifest.displayName??e})),modelsByProvider:o,loadModels:s})}),(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>p(e),"aria-label":`Remove ${e}`,disabled:n===`tier`,title:n===`tier`?`Tier aliases are required by every workflow.`:void 0,children:(0,G.jsx)(ji,{})})]}),(0,G.jsx)(`div`,{id:C,className:`px-1 text-[11px] leading-4 text-fg-subtle`,children:y?(0,G.jsx)(`span`,{className:`text-danger-400`,children:`An alias with that name already exists.`}):b?(0,G.jsx)(`span`,{className:`text-danger-400`,children:`Alias name cannot be empty.`}):c.length>0?(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-fg-muted`,children:`Used in:`}),` `,c.map((e,t)=>(0,G.jsxs)(`span`,{children:[t>0?`, `:null,(0,G.jsx)(`span`,{className:`font-mono`,children:e.workflowId}),(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[` · `,e.phaseName]})]},`${e.workflowId}-${e.phaseName}-${t}`))]}):(0,G.jsx)(`span`,{className:`opacity-70`,children:`Not referenced by any workflow yet.`})})]})}function PT(e,t){return e===`github`?{provider:`github`,username:String(t.owner??``),token:String(t.token??``),workspace:String(t.owner??``)}:e===`bitbucket`?{provider:`bitbucket`,username:String(t.coderUsername??``),token:String(t.coderToken??``),workspace:String(t.workspace??``),reviewerUsername:String(t.reviewerUsername??``),reviewerToken:String(t.reviewerToken??``)}:e===`gitlab`?{provider:`gitlab`,username:String(t.username??t.user??``),token:String(t.token??``),workspace:String(t.workspace??t.group??``)}:null}function FT(){let{draft:e,pluginsCatalogue:t,pluginsCatalogueError:n,setPluginDefault:r}=y_(),i=oy({draft:e,pluginsCatalogue:t}).byId[`source-control`],a=(0,x.useMemo)(()=>t?t.plugins.filter(e=>e.manifest.kind===`scm`).sort((e,t)=>e.source===t.source?e.manifest.displayName.localeCompare(t.manifest.displayName):e.source===`builtin`?-1:1):[],[t]),o=(0,x.useMemo)(()=>a.filter(t=>{let n=e.pluginInstalled[t.manifest.id];return n!==void 0&&n.enabled!==!1}).map(e=>e.manifest.id),[a,e.pluginInstalled]);async function s(e,t){let n=PT(e,t);if(!n)return{ok:!1,message:`No generic connection test available for drop-in plugins yet — save and check the plugin healthcheck.`};try{let e=await q(`/test/git`,J(n,{method:`POST`}));return{ok:e.ok,message:e.message??(e.ok?`Authenticated.`:`Connection failed.`),checks:e.checks}}catch(e){return{ok:!1,message:(e instanceof K,e.message)}}}return(0,G.jsxs)(lT,{title:`Source control`,description:`Git provider plugins. Each plugin handles clone, branch, push, PR, and review for one host. Multiple plugins can be configured side-by-side; the default below decides which one new jobs use unless overridden.`,required:!0,status:i.status,statusLabel:i.label,children:[n?(0,G.jsxs)(Ov,{tone:`warning`,children:[`Couldn't load the plugin catalogue from the runner: `,n,`.`]}):null,a.length===0?(0,G.jsx)(Ov,{tone:`neutral`,children:`No source-control plugins discovered. Built-ins are bundled with the runner — restart it if this looks wrong.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,G.jsx)(ET,{plugin:e,onTest:t=>s(e.manifest.id,t)},e.manifest.id))}),o.length>1?(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5`,children:(0,G.jsx)(Sv,{label:`Default for new jobs`,hint:`When more than one source-control plugin is enabled, jobs use this one unless they specify a different SCM at creation time.`,children:(0,G.jsxs)(`select`,{value:e.pluginDefaultScm,onChange:e=>r(`scm`,e.target.value),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg`,children:[(0,G.jsx)(`option`,{value:``,children:`(let the registry choose)`}),o.map(e=>(0,G.jsx)(`option`,{value:e,children:a.find(t=>t.manifest.id===e)?.manifest.displayName??e},e))]})})}):null,(0,G.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:i.detail})]})}function IT(e,t){return e===`jira`?{provider:`jira`,jira:{baseUrl:String(t.baseUrl??``),username:String(t.username??``),apiToken:String(t.apiToken??``)}}:e===`linear`?{provider:`linear`,linear:{apiKey:String(t.apiKey??``),teamKey:String(t.teamKey??``)}}:e===`github-issues`?{provider:`github`,git:{provider:`github`,username:String(t.defaultOwner??``),token:String(t.token??``),workspace:String(t.defaultOwner??``)}}:null}function LT(){let{draft:e,pluginsCatalogue:t,pluginsCatalogueError:n,setPluginDefault:r}=y_(),i=oy({draft:e,pluginsCatalogue:t}).byId[`issue-tracker`],a=(0,x.useMemo)(()=>t?t.plugins.filter(e=>e.manifest.kind===`tracker`).sort((e,t)=>e.source===t.source?e.manifest.displayName.localeCompare(t.manifest.displayName):e.source===`builtin`?-1:1):[],[t]),o=(0,x.useMemo)(()=>a.filter(t=>{let n=e.pluginInstalled[t.manifest.id];return n!==void 0&&n.enabled!==!1}).map(e=>e.manifest.id),[a,e.pluginInstalled]);async function s(e,t){let n=IT(e,t);if(!n)return{ok:!1,message:`No generic connection test available for drop-in plugins yet — save and check the plugin healthcheck.`};try{let e=await q(`/test/tracker`,J(n,{method:`POST`}));return{ok:e.ok,message:e.message??(e.ok?`Connected.`:`Connection failed.`)}}catch(e){return{ok:!1,message:(e instanceof K,e.message)}}}return(0,G.jsxs)(lT,{title:`Issue tracker`,description:`Tracker plugins. Each plugin maps Coro work units (epics + child issues) to a backlog system. Optional — leave all disabled to run jobs without tracker round-trips.`,status:i.status,statusLabel:i.status===`optional`?`Optional`:i.label,children:[n?(0,G.jsxs)(Ov,{tone:`warning`,children:[`Couldn't load the plugin catalogue from the runner: `,n,`.`]}):null,a.length===0?(0,G.jsx)(Ov,{tone:`neutral`,children:`No tracker plugins discovered. Built-ins are bundled with the runner — restart it if this looks wrong.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,G.jsx)(ET,{plugin:e,onTest:t=>s(e.manifest.id,t)},e.manifest.id))}),o.length>1?(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5`,children:(0,G.jsx)(Sv,{label:`Default for new jobs`,hint:`When more than one tracker plugin is enabled, jobs use this one unless they specify a different tracker at creation time.`,children:(0,G.jsxs)(`select`,{value:e.pluginDefaultTracker,onChange:e=>r(`tracker`,e.target.value),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg`,children:[(0,G.jsx)(`option`,{value:``,children:`(let the registry choose)`}),o.map(e=>(0,G.jsx)(`option`,{value:e,children:a.find(t=>t.manifest.id===e)?.manifest.displayName??e},e))]})})}):null,(0,G.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:i.detail})]})}function RT(e){return e.configured??e.installed}function zT(e){return RT(e)&&e.active?{label:`enabled`,tone:`success`}:RT(e)?{label:`configured`,tone:`warning`}:e.source===`builtin`?{label:`built in`,tone:`neutral`}:{label:`installed`,tone:`neutral`}}function BT(e){return RT(e)&&e.active?0:RT(e)?1:e.source===`builtin`?2:3}function VT(){let[e,t]=(0,x.useState)(null),[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(``),[o,s]=(0,x.useState)(``),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null);(0,x.useEffect)(()=>{g()},[]);async function g(){try{r(!0),t(await q(`/plugins`))}catch{t(null)}finally{r(!1)}}async function _(e){e.preventDefault(),d(null),p(null);let t=i.trim();if(!t){d("Enter an npm package name (e.g. `@coro-ai/plugin-gitlab`).");return}try{l(!0);let e={spec:t},n=o.trim();n&&(e.id=n);let r=await q(`/plugins/install`,J(e,{method:`POST`}));p(r.restartHint?`Installed "${r.manifest.displayName}". ${r.restartHint}`:`Installed "${r.manifest.displayName}" and loaded into the registry — no restart needed.`),a(``),s(``),g()}catch(e){d((e instanceof K,e.message))}finally{l(!1)}}async function v(e,t){if(d(null),p(null),window.confirm(`Remove drop-in plugin "${t}"? The runner will need a restart to drop it from memory.`))try{h(e),p(`Removed "${t}". ${(await q(`/plugins/${encodeURIComponent(e)}`,{method:`DELETE`})).restartHint??`Restart the runner to fully unload it.`}`),g()}catch(e){d(`Failed to uninstall ${t}: ${e instanceof K,e.message}`)}finally{h(null)}}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(lT,{title:`Install a plugin`,description:`Drop-in plugins live under ~/.coro/plugins/. Paste any npm package name or git/tarball spec — the runner installs it locally and hot-loads it into the registry; configure credentials below to start using it.`,children:(0,G.jsxs)(`form`,{onSubmit:_,className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[2fr_1fr_auto] sm:items-end`,children:[(0,G.jsx)(Sv,{label:`npm spec`,htmlFor:`plugin-install-spec`,hint:`Examples: @coro-ai/plugin-gitlab, coro-plugin-jenkins@1.2.0, github:my-org/coro-plugin-acme.`,children:(0,G.jsx)(O_,{id:`plugin-install-spec`,value:i,onChange:e=>a(e.target.value),placeholder:`@coro-ai/plugin-gitlab`,disabled:c})}),(0,G.jsx)(Sv,{label:`Plugin id (optional)`,htmlFor:`plugin-install-id`,children:(0,G.jsx)(O_,{id:`plugin-install-id`,value:o,onChange:e=>s(e.target.value),placeholder:`gitlab`,disabled:c})}),(0,G.jsxs)(Y,{type:`submit`,disabled:c||!i.trim(),children:[(0,G.jsx)(ri,{}),c?`Installing…`:`Install`]})]}),u?(0,G.jsx)(Ov,{tone:`danger`,children:u}):null,f?(0,G.jsx)(Ov,{tone:`success`,children:f}):null]})}),(0,G.jsx)(lT,{title:`Installed plugins`,description:`Provider integrations the runner has loaded. Each plugin contributes its own MCP tools, webhook normaliser, and (optionally) intelligence snippets.`,action:(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void g(),disabled:n,children:[(0,G.jsx)(mi,{}),n?`Refreshing…`:`Refresh`]}),children:e?(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:`Default SCM`}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg`,children:e.defaults.scm??`— (single enabled plugin wins)`})]}),(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:`Default tracker`}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg`,children:e.defaults.tracker??`— (single enabled plugin wins)`})]})]}),e.plugins.some(e=>RT(e)&&e.active)?null:(0,G.jsx)(Ov,{tone:`warning`,children:`No plugins are enabled yet. Coro ships with GitHub, Bitbucket, Jira, Linear, and GitHub Issues. Configure credentials under Source control / Issue tracker and restart the runner.`}),e.plugins.length===0?(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:`No plugins discovered.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:[...e.plugins].sort((e,t)=>{let n=BT(e)-BT(t);return n===0?e.manifest.displayName.localeCompare(t.manifest.displayName):n}).map(e=>{let{manifest:t,source:n,mcpServer:r,activationHint:i}=e,a=zT(e);return(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(fi,{className:`size-4 text-fg-subtle`}),(0,G.jsx)(`div`,{className:`text-[15px] font-medium text-fg`,children:t.displayName}),(0,G.jsx)(`span`,{className:`font-mono text-[11px] text-fg-subtle`,children:t.id}),n===`dropin`?(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] text-fg-muted`,children:`drop-in`}):null]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[12px] text-fg-muted`,children:[`kind: `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:t.kind}),` · `,`v`,t.version,` · `,`host `,t.hostCompatibility]}),!RT(e)&&i?(0,G.jsx)(`div`,{className:`mt-2 text-[12px] leading-5 text-fg-muted`,children:i}):null,r?(0,G.jsxs)(`div`,{className:`mt-2 text-[11px] text-fg-muted`,children:[`Attached MCP server: `,(0,G.jsx)(`span`,{className:`font-mono`,children:r.type}),` · agents see tools as `,(0,G.jsxs)(`span`,{className:`font-mono`,children:[`mcp__`,t.id,`__*`]})]}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:W(`rounded-full border px-2.5 py-1 text-[11px] font-medium uppercase tracking-[0.16em]`,zo(a.tone)),children:a.label}),n===`dropin`?(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void v(t.id,t.displayName),disabled:m===t.id,children:[(0,G.jsx)(ji,{}),m===t.id?`Removing…`:`Uninstall`]}):null]})]})},t.id)})})]}):(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:n?`Loading plugins…`:`Plugin discovery is unavailable. The runner may be too old or returned an error.`})})]})}var HT=`{
119
+ `}}}function Uw({open:e,onOpenChange:t,layer:n,kind:r,onCreated:i}){let[a,o]=(0,x.useState)(``),[s,c]=(0,x.useState)(``),[l,u]=(0,x.useState)(``),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(!1),[h,g]=(0,x.useState)(!1),[_,v]=(0,x.useState)(null),y=(0,x.useRef)(null),b=(0,x.useMemo)(()=>Vw(a),[a]);(0,x.useEffect)(()=>{if(!e)return;let t=Hw(r,`my-`+r);o(`my-`+r),c(t.content),u(t.path),f(null),v(null)},[e,r]),(0,x.useEffect)(()=>{if(!e)return;let t=Hw(r,b||`my-`+r);u(t.path),c(e=>e.includes(`# Agent: my-`)||e.includes(`# Workflow: my-`)||e.startsWith(`---
120
+ name: my-`)||e.startsWith(`# my-`)?t.content:e)},[b,r,e]),(0,x.useEffect)(()=>{if(!e||!l||!s){f(null);return}return y.current&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>{m(!0),q(`/intelligence/preflight`,J({path:l,content:s},{method:`POST`})).then(e=>f(e)).catch(()=>f(null)).finally(()=>m(!1))},250),()=>{y.current&&window.clearTimeout(y.current)}},[e,l,s]);async function S(){if(!(!d?.ok||h)){g(!0),v(null);try{await q(`/intelligence/file`,J({layer:n,path:l,content:s},{method:`PUT`})),i({layer:n,path:l}),t(!1)}catch(e){v(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{g(!1)}}}let C=d?.ok===!0&&!h&&!p;return(0,G.jsx)(c_,{open:e,onOpenChange:t,children:(0,G.jsxs)(d_,{className:`flex max-w-3xl flex-col gap-0 max-h-[min(820px,calc(100vh-2rem))]`,children:[(0,G.jsxs)(f_,{className:`px-6 pt-6`,children:[(0,G.jsxs)(p_,{className:`flex items-center gap-2`,children:[(0,G.jsx)(kr,{className:`size-4 text-accent-300`}),`New `,Bw[r],` in `,n===`tenant`?`Custom`:n]}),(0,G.jsx)(m_,{children:`Pick a name, edit the scaffolded content, and Coro pre-validates before saving.`})]}),(0,G.jsxs)(h_,{className:`flex-1 min-h-0 overflow-y-auto space-y-4 px-6 pb-6`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-[160px_1fr] items-center gap-3`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,children:`Name`}),(0,G.jsx)(O_,{value:a,onChange:e=>o(e.target.value),placeholder:`my-${r}`,autoFocus:!0}),(0,G.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,children:`Resolved path`}),(0,G.jsx)(`code`,{className:`truncate rounded bg-overlay/60 px-2 py-1 font-mono text-[11px] text-fg-subtle`,children:l})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,children:`Content`}),(0,G.jsxs)(`span`,{className:`text-[10px] text-fg-subtle`,children:[s.length,` chars`]})]}),(0,G.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),spellCheck:!1,className:`h-[280px] w-full resize-y rounded-md border border-line bg-canvas/60 px-3 py-2 font-mono text-[12px] leading-relaxed text-fg outline-none focus:border-accent-400`})]}),(0,G.jsx)(Rw,{preflight:d,loading:p}),_?(0,G.jsx)(`div`,{className:`rounded-md border border-danger-500/50 bg-danger-500/10 px-3 py-2 text-[12px] text-danger-400`,children:_}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-line px-6 py-3`,children:[(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(!1),disabled:h,children:`Cancel`}),(0,G.jsxs)(Y,{variant:`primary`,size:`sm`,onClick:S,disabled:!C,children:[h?(0,G.jsx)($r,{className:`mr-1 size-3 animate-spin`}):null,`Create`]})]})]})})}var Ww={workflow:{label:`Workflow`,plural:`Workflows`,Icon:B,tone:`text-accent-300`,description:`Multi-phase plans the runner dispatches against. Each workflow sequences agents into phases.`},agent:{label:`Agent`,plural:`Agents`,Icon:ar,tone:`text-success`,description:`Per-phase Claude personas. Override one to change how a phase reasons or what tools it uses.`},skill:{label:`Skill`,plural:`Skills`,Icon:Di,tone:`text-warning`,description:`Claude Code skills picked up automatically when the matching context appears.`},memory:{label:`Memory`,plural:`Memory`,Icon:or,tone:`text-fg-muted`,description:`Append-mode notes. Every layer’s memory file is concatenated at runtime — nothing is shadowed.`}},Gw={base:{label:`Coro`,Icon:ii,tone:`text-fg-muted`,pitch:`Ships with the Coro runner. Read-only — copy any artefact into Custom or Repo to customise it.`},tenant:{label:`Custom`,Icon:Yr,tone:`text-accent-300`,pitch:`Your overlay at ~/.coro/intelligence. Wins over Coro for every repo on this machine.`},repo:{label:`Repo`,Icon:Si,tone:`text-success`,pitch:`The target repo’s .coro/ folder. Highest priority — wins over both Coro and Custom.`}},Kw=`coro:intelligence:intro-dismissed`;function qw(){let[e,t]=(0,x.useState)(null),[n,r]=(0,x.useState)(null),[i,a]=(0,x.useState)(!0),[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(()=>typeof window>`u`?!0:window.localStorage.getItem(Kw)!==`1`),[u,d]=(0,x.useState)([]),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(null),[v,y]=(0,x.useState)(!1);async function b(e){try{let[n,i]=await Promise.all([q(`/intelligence/layers`,{signal:e}),po().catch(()=>[])]);if(e?.aborted)return;t(n),d(i),r(null)}catch(e){if(e.name===`AbortError`)return;r(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{a(!1),s(!1)}}(0,x.useEffect)(()=>{let e=new AbortController;return b(e.signal),()=>e.abort()},[]);function S(){l(!1),typeof window<`u`&&window.localStorage.setItem(Kw,`1`)}async function C(){s(!0),await b()}let w=(0,x.useMemo)(()=>{let t={workflow:[],agent:[],skill:[],memory:[]};if(!e)return t;for(let n of e.artefacts)t[n.kind].push(n);return t},[e]);function T(e){let t=e.path.split(`/`)[1],n=u.find(n=>n.id===t||n.workflowPath===e.path);n&&(p(n),h(!0))}function E(e){_({layer:e.layer,path:e.path,displayName:e.displayName,overrides:e.overrides}),y(!0)}let D=(0,x.useMemo)(()=>e?.layers.filter(e=>e.writable).map(e=>e.layer)??[],[e]);function O(e){C(),_({layer:e.layer,path:e.path,displayName:e.path.split(`/`).pop()??e.path}),y(!0)}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(cg,{eyebrow:`Intelligence`,title:`Layered Intelligence`,description:`Every workflow, agent, skill, and memory note the runner can see — grouped by the layer it lives on. Drop files into Custom or Repo to customise behaviour without forking the Coro intelligence.`,actions:(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:C,disabled:i||o,children:[(0,G.jsx)(hi,{className:`size-3.5 ${o?`animate-spin`:``}`}),`Refresh`]})}),c?(0,G.jsxs)(`div`,{className:`relative rounded-xl border border-line bg-overlay/40 p-4 pr-10 text-sm text-fg-muted`,children:[(0,G.jsx)(`button`,{onClick:S,className:`absolute right-3 top-3 rounded-md p-1 text-fg-subtle hover:bg-overlay hover:text-fg`,"aria-label":`Dismiss`,children:(0,G.jsx)(Pi,{className:`size-3.5`})}),(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(qr,{className:`mt-0.5 size-4 shrink-0 text-accent-300`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`p`,{children:[`Coro resolves intelligence in three layers: `,(0,G.jsx)(`strong`,{className:`text-fg`,children:`Repo`}),` `,`(the working repo’s `,(0,G.jsx)(`code`,{className:`rounded bg-overlay px-1`,children:`.coro/`}),` folder) wins over`,` `,(0,G.jsx)(`strong`,{className:`text-fg`,children:`Custom`}),` (your`,` `,(0,G.jsx)(`code`,{className:`rounded bg-overlay px-1`,children:`~/.coro/intelligence`}),` overlay), which wins over the`,` `,(0,G.jsx)(`strong`,{className:`text-fg`,children:`Coro`}),` intelligence shipped with the runner.`]}),(0,G.jsxs)(`p`,{children:[`Most artefacts use `,(0,G.jsx)(`em`,{children:`last-wins replace`}),`: the highest-priority copy is the only one used. Memory files use `,(0,G.jsx)(`em`,{children:`append`}),`: every layer’s contribution is concatenated, so notes stack across layers. Drop a file at the matching path in a higher layer to override (or extend, for memory).`]})]})]})]}):null,i&&!e?(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,G.jsx)(bg,{className:`h-28`}),(0,G.jsx)(bg,{className:`h-28`}),(0,G.jsx)(bg,{className:`h-28`})]}):e?(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[e.layers.map(e=>(0,G.jsx)(Jw,{layer:e,onCreated:O},e.layer)),e.layers.some(e=>e.layer===`repo`)?null:(0,G.jsx)(Yw,{})]}):null,n?(0,G.jsx)(gg,{title:`Couldn’t load intelligence catalogue`,message:n}):null,e?(0,G.jsx)(`div`,{className:`grid gap-4 lg:grid-cols-2 xl:grid-cols-4`,children:[`workflow`,`agent`,`skill`,`memory`].map(e=>(0,G.jsx)(Xw,{kind:e,artefacts:w[e],writableLayers:D,onCreated:O,onOpenInspector:E,onOpenWorkflow:e===`workflow`?T:void 0},e))}):null,(0,G.jsx)(KC,{open:m,onOpenChange:h,workflow:f}),(0,G.jsx)(zw,{open:v,onOpenChange:y,target:g,onChanged:e=>{e&&_(t=>t&&{...t,layer:e.layer,path:e.path}),C()}})]})}function Jw({layer:e,onCreated:t}){let n=Gw[e.layer],r=n.Icon,i=e.counts.workflow+e.counts.agent+e.counts.skill+e.counts.memory;return(0,G.jsxs)(lg,{className:`flex flex-col`,children:[(0,G.jsxs)(ug,{className:`flex flex-row items-start justify-between gap-3 space-y-0 pb-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(r,{className:`size-4 ${n.tone}`}),(0,G.jsx)(dg,{className:`text-sm font-semibold`,children:n.label}),(0,G.jsx)(UC,{layer:e.layer,size:`sm`}),e.writable?null:(0,G.jsx)(`span`,{className:`rounded bg-fg/8 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-fg-subtle`,children:`read-only`})]}),(0,G.jsx)(`p`,{className:`text-xs leading-snug text-fg-muted`,children:n.pitch})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[e.writable?(0,G.jsx)($w,{layer:e.layer,onCreated:t}):null,(0,G.jsxs)(`div`,{className:`text-right`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-semibold tabular-nums`,children:i}),(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:`files`})]})]})]}),(0,G.jsxs)(pg,{className:`space-y-2 pt-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-fg-subtle`,children:[(0,G.jsx)(Rr,{className:`size-3`}),(0,G.jsx)(`code`,{className:`truncate font-mono`,title:e.root,children:Qw(e.root)})]}),e.exists?null:(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-fg-subtle`,children:[(0,G.jsx)(Mi,{className:`size-3 text-warning`}),`Not yet created on disk.`]}),(0,G.jsx)(`div`,{className:`grid grid-cols-4 gap-1 pt-1`,children:[`workflow`,`agent`,`skill`,`memory`].map(t=>{let n=Ww[t].Icon;return(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-0.5 rounded-md border border-line bg-overlay/30 px-1 py-1.5`,title:Ww[t].plural,children:[(0,G.jsx)(n,{className:`size-3 ${Ww[t].tone}`}),(0,G.jsx)(`span`,{className:`text-xs font-medium tabular-nums`,children:e.counts[t]})]},t)})})]})]})}function Yw(){return(0,G.jsx)(lg,{className:`flex flex-col border-dashed bg-overlay/20`,children:(0,G.jsx)(ug,{className:`flex flex-row items-start justify-between gap-3 space-y-0 pb-3`,children:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Si,{className:`size-4 text-success`}),(0,G.jsx)(dg,{className:`text-sm font-semibold`,children:`Repo`}),(0,G.jsx)(UC,{layer:`repo`,size:`sm`})]}),(0,G.jsxs)(`p`,{className:`text-xs leading-snug text-fg-muted`,children:[`Highest-priority overlay, scoped to a single repo via its `,(0,G.jsx)(`code`,{className:`rounded bg-overlay px-1`,children:`.coro/`}),` folder. Surfaces here once a job clones a repo with one.`]})]})})})}function Xw({kind:e,artefacts:t,writableLayers:n,onCreated:r,onOpenInspector:i,onOpenWorkflow:a}){let o=Ww[e],s=o.Icon;return(0,G.jsxs)(lg,{className:`flex min-h-[12rem] flex-col`,children:[(0,G.jsxs)(ug,{className:`space-y-1 pb-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(s,{className:`size-4 ${o.tone}`}),(0,G.jsx)(dg,{className:`text-sm font-semibold`,children:o.plural})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`rounded bg-overlay/60 px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-muted`,children:t.length}),n.length>0?(0,G.jsx)(eT,{kind:e,writableLayers:n,onCreated:r}):null]})]}),(0,G.jsx)(`p`,{className:`text-[11px] leading-snug text-fg-subtle`,children:o.description})]}),(0,G.jsx)(pg,{className:`flex-1 space-y-1.5 pt-0`,children:t.length===0?(0,G.jsxs)(`div`,{className:`flex h-24 items-center justify-center text-center text-[11px] text-fg-subtle`,children:[`No `,o.plural.toLowerCase(),` found.`]}):t.map(e=>(0,G.jsx)(Zw,{artefact:e,onOpenInspector:i,onOpenWorkflow:a},`${e.layer}:${e.path}`))})]})}function Zw({artefact:e,onOpenInspector:t,onOpenWorkflow:n}){return(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`group block w-full rounded-lg border border-line bg-canvas/30 p-2.5 text-left transition-colors hover:border-accent-500/40 hover:bg-overlay/40`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`truncate text-[13px] font-medium text-fg`,children:e.displayName}),e.kind===`memory`?(0,G.jsx)(`span`,{title:`Append-mode: stacks across layers`,className:`text-[10px] text-fg-subtle`,children:`∥`}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(Ir,{className:`size-2.5 shrink-0 text-fg-subtle`}),(0,G.jsx)(`code`,{className:`truncate font-mono text-[10px] text-fg-subtle`,title:e.path,children:e.path})]}),e.description?(0,G.jsx)(`p`,{className:`line-clamp-2 text-[11px] leading-snug text-fg-muted`,children:e.description}):null,e.kind===`workflow`&&n?(0,G.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),n(e)},className:`mt-1 inline-flex items-center gap-1 text-[10px] font-medium uppercase tracking-wide text-accent-300 hover:text-accent-200`,children:`View phases →`}):null]}),(0,G.jsx)(UC,{layer:e.layer,overrides:e.overrides,size:`sm`})]})})}function Qw(e){if(typeof window>`u`)return e;let t=e.match(/^\/(?:Users|home)\/[^/]+/);return t?`~`+e.slice(t[0].length):e}function $w({layer:e,onCreated:t}){let[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(`memory`);function o(e){a(e),r(!0)}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Jh,{children:[(0,G.jsx)(Yh,{asChild:!0,children:(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 px-2`,children:[(0,G.jsx)(pi,{className:`size-3`}),`New`]})}),(0,G.jsxs)(Zh,{align:`end`,className:`w-44`,children:[(0,G.jsx)($h,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:`New artefact`}),(0,G.jsx)(eg,{}),[`workflow`,`agent`,`skill`,`memory`].map(e=>{let t=Ww[e].Icon;return(0,G.jsxs)(Qh,{onClick:()=>o(e),children:[(0,G.jsx)(t,{className:`mr-2 size-3.5 ${Ww[e].tone}`}),Ww[e].label]},e)})]})]}),(0,G.jsx)(Uw,{open:n,onOpenChange:r,layer:e,kind:i,onCreated:e=>t?.(e)})]})}function eT({kind:e,writableLayers:t,onCreated:n}){let[r,i]=(0,x.useState)(!1),[a,o]=(0,x.useState)(t[0]),s=Ww[e];function c(e){o(e),i(!0)}let l=`inline-flex size-6 items-center justify-center rounded text-fg-subtle transition-colors hover:bg-overlay/60 hover:text-fg`,u=`New ${s.label.toLowerCase()}`;return(0,G.jsxs)(G.Fragment,{children:[t.length===1?(0,G.jsx)(`button`,{type:`button`,onClick:()=>c(t[0]),className:l,title:u,"aria-label":u,children:(0,G.jsx)(pi,{className:`size-3.5`})}):(0,G.jsxs)(Jh,{children:[(0,G.jsx)(Yh,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,className:l,title:u,"aria-label":u,children:(0,G.jsx)(pi,{className:`size-3.5`})})}),(0,G.jsxs)(Zh,{align:`end`,className:`w-44`,children:[(0,G.jsxs)($h,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:[`New `,s.label.toLowerCase(),` in…`]}),(0,G.jsx)(eg,{}),t.map(e=>(0,G.jsxs)(Qh,{onClick:()=>c(e),children:[(0,G.jsx)(UC,{layer:e,size:`sm`}),(0,G.jsx)(`span`,{className:`ml-2`,children:Gw[e].label})]},e))]})]}),(0,G.jsx)(Uw,{open:r,onOpenChange:i,layer:a,kind:e,onCreated:e=>n?.(e)})]})}var tT=[{id:`general`,group:`setup`,label:`General`,description:`Coach mode and Coro plan mode preferences.`,icon:Ei,required:!1},{id:`llm-provider`,group:`setup`,label:`LLM provider`,description:`Authenticate the runner against the model that drives every job.`,icon:ar,required:!0},{id:`source-control`,group:`setup`,label:`Source control`,description:`Git credentials used for clone, branch, push, and PR operations.`,icon:Vr,required:!0},{id:`issue-tracker`,group:`setup`,label:`Issue tracker`,description:`Optional. Used by campaigns when they need to file an epic + child issues.`,icon:Ai,required:!1},{id:`plugins`,group:`extensions`,label:`Plugins`,description:`Provider integrations the runner has loaded plus drop-in installation.`,icon:fi,required:!1},{id:`mcp`,group:`extensions`,label:`MCP servers`,description:`Bring-your-own MCP servers and Claude Code inheritance.`,icon:Si,required:!1},{id:`guardrails`,group:`extensions`,label:`Guardrails`,description:`Policies the runner enforces before agents open PRs or call tools.`,icon:Ti,required:!1},{id:`paths`,group:`advanced`,label:`Paths`,description:`Filesystem locations for intelligence overlays and working repositories.`,icon:zr,required:!1}],nT={setup:{title:`Setup`,hint:`Required to run jobs. Finish these first.`},extensions:{title:`Extensions`,hint:`Opt-in capabilities. Add when you need them.`},advanced:{title:`Advanced`,hint:`Rarely changed. Defaults work for most installs.`}};function rT(e){let t=tT.find(t=>t.id===e);if(!t)throw Error(`Unknown settings section id: ${e}`);return t}function iT({title:e,description:t,status:n,statusLabel:r,required:i,action:a,footer:o,className:s,children:c}){return(0,G.jsxs)(lg,{className:s,children:[(0,G.jsxs)(ug,{className:W(`gap-3 border-b border-line pb-4`,a?`sm:flex-row sm:items-start sm:justify-between`:``),children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(dg,{children:e}),i?(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.18em] text-fg-subtle`,children:`Required`}):null,n?(0,G.jsx)(jv,{status:n,label:r}):null]}),t?(0,G.jsx)(fg,{children:t}):null]}),a?(0,G.jsx)(`div`,{className:`shrink-0`,children:a}):null]}),(0,G.jsx)(pg,{className:`space-y-5 pt-5`,children:c}),o?(0,G.jsx)(`div`,{className:`border-t border-line bg-overlay/30 px-6 py-3 text-xs text-fg-subtle`,children:o}):null]})}function aT({onTest:e,disabled:t,label:n,className:r}){let[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)(null);async function c(){a(!0),s(null);try{s(await e())}catch(e){s({ok:!1,message:e instanceof Error?e.message:String(e)})}finally{a(!1)}}return(0,G.jsxs)(`div`,{className:W(`flex w-full flex-col gap-2`,r),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void c(),disabled:t||i,children:[i?(0,G.jsx)($r,{className:`size-3.5 animate-spin`}):(0,G.jsx)(di,{className:`size-3.5`}),i?`Testing…`:n??`Test connection`]}),o?(0,G.jsxs)(`div`,{className:W(`flex items-center gap-1.5 text-xs`,o.ok?`text-success-300`:`text-danger-300`),role:`status`,children:[o.ok?(0,G.jsx)(fr,{className:`size-3.5`}):(0,G.jsx)(_r,{className:`size-3.5`}),(0,G.jsx)(`span`,{children:o.message??(o.ok?`Connection succeeded.`:`Connection failed.`)})]}):null]}),o?.checks&&o.checks.length>0?(0,G.jsx)(`ul`,{className:`space-y-1 rounded-xl border border-line bg-overlay/30 px-3 py-2 text-xs`,children:o.checks.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2`,children:[e.ok?(0,G.jsx)(fr,{className:`mt-0.5 size-3.5 shrink-0 text-success-300`}):(0,G.jsx)(_r,{className:`mt-0.5 size-3.5 shrink-0 text-danger-300`}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,G.jsx)(`span`,{className:W(`font-medium`,e.ok?`text-fg`:`text-danger-300`),children:e.name}),(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:e.message})]}),!e.ok&&e.hint?(0,G.jsxs)(`span`,{className:`text-fg-subtle italic`,children:[`→ `,e.hint]}):null]})]},`${e.name}-${t}`))}):null]})}var oT={1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-2 xl:grid-cols-4`};function sT({name:e,value:t,options:n,onChange:r,cols:i=3,className:a}){let o=e??`choice-${Math.random().toString(36).slice(2,8)}`;return(0,G.jsx)(`div`,{role:`radiogroup`,className:W(`grid gap-3`,oT[i],a),children:n.map(e=>{let n=e.value===t;return(0,G.jsxs)(`label`,{className:W(`cursor-pointer rounded-2xl border px-4 py-3 text-left text-sm transition-colors`,n?`border-accent-500/40 bg-accent-500/8 text-fg ring-1 ring-accent-500/30`:`border-line bg-overlay/40 text-fg-muted hover:border-line-strong hover:text-fg`,e.disabled&&`cursor-not-allowed opacity-60`),children:[(0,G.jsx)(`input`,{type:`radio`,name:o,value:e.value,checked:n,disabled:e.disabled,onChange:()=>!e.disabled&&r(e.value),className:`sr-only`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:e.label}),e.badge]}),e.description?(0,G.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:e.description}):null]},e.value)})})}var cT=[{value:`claudeLogin`,label:`Claude login`,description:`Recommended. Uses Claude Code's local session and MCP permissions.`},{value:`apiKey`,label:`API key`,description:`Direct Anthropic billing with explicit service credentials.`},{value:`oauth`,label:`Legacy OAuth token`,description:`Fallback only. Stores a raw token without session refresh.`}];function lT({pluginId:e,onConnected:t}){let{draft:n,setPluginField:r}=y_(),i=n.pluginInstalled[e]?.config??{},a=i.method??`claudeLogin`,o=i.apiKey??``,s=i.oauthToken??``,c=i.account??null,[l,u]=(0,x.useState)({status:`idle`}),[d,f]=(0,x.useState)(!1),[p,m]=(0,x.useState)(!1),[h,g]=(0,x.useState)(``),[_,v]=(0,x.useState)(``),[y,b]=(0,x.useState)(null),[S,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(!1);(0,x.useEffect)(()=>{a===`claudeLogin`&&l.status===`idle`&&c&&u({status:`connected`,account:c})},[a,c,l.status]),(0,x.useEffect)(()=>{if(l.status!==`authorizing`)return;let n=window.setInterval(async()=>{try{let n=await q(`/config/anthropic/claude-login/status`);if(n.status===`idle`)return;u(n),n.status===`connected`&&(r(e,`method`,`claudeLogin`),n.account&&r(e,`account`,n.account),t?.())}catch{}},2e3);return()=>window.clearInterval(n)},[l.status,e,r,t]);let A=l.account??c,j=l.automaticUrl??l.manualUrl??null,M=l.status===`connected`||!!A;function N(t){r(e,`method`,t),b(null),T(null),D(null)}async function ee(){f(!0),b(null);try{let n=await q(`/config/anthropic/claude-login/start`,{method:`POST`});if(u(n),r(e,`method`,`claudeLogin`),n.account&&r(e,`account`,n.account),n.status===`connected`){t?.();return}if(n.status===`authorizing`&&(n.automaticUrl||n.manualUrl)&&window.open(n.automaticUrl??n.manualUrl,`_blank`,`noopener,noreferrer`),n.status===`error`)throw Error(n.error??`Claude login failed to start.`)}catch(e){b(e instanceof K||e instanceof Error?e.message:String(e))}finally{f(!1)}}async function te(){m(!0),b(null);try{let n=await q(`/config/anthropic/claude-login/callback`,J(dT(h,_),{method:`POST`}));if(u(n),n.status!==`connected`)throw Error(n.error??`Claude login did not complete.`);r(e,`method`,`claudeLogin`),n.account&&r(e,`account`,n.account),g(``),v(``),t?.()}catch(e){b(e instanceof K||e instanceof Error?e.message:String(e))}finally{m(!1)}}async function P(){try{return await q(`/test/llm`,J({provider:e,config:i},{method:`POST`}))}catch(e){return{ok:!1,message:e instanceof Error?e.message:String(e)}}}let F=a===`claudeLogin`?l.status===`connected`||!!c:a===`apiKey`?o.length>0:s.length>0;async function I(){C(!0),T(`Launching Claude Code login. Complete sign-in in your browser…`),D(null),b(null);try{let t=await q(`/config/anthropic/generate-oauth-token`,{method:`POST`});t.authUrl&&D(t.authUrl),t.token?(r(e,`oauthToken`,t.token),r(e,`method`,`oauth`),T(`Token captured (${t.token.slice(0,16)}…). Click Save to persist it.`)):(b(`Token generation returned no token.`),T(null))}catch(e){if(e instanceof K){let t=e.payload;t?.authUrl&&D(t.authUrl),(t?.error===`CLI_NOT_FOUND`||t?.error===`PLATFORM_UNSUPPORTED`)&&k(!0),b(t?.message??t?.stderr??e.message)}else b(e instanceof Error?e.message:String(e));T(null)}finally{C(!1)}}return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsx)(Sv,{label:`Authentication method`,children:(0,G.jsx)(sT,{name:`${e}-anthropic-method`,value:a,onChange:N,options:cT,cols:3})}),y?(0,G.jsx)(Ov,{tone:`danger`,children:y}):null,a===`claudeLogin`?(0,G.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-line bg-overlay/40 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(jv,{status:pT(l),label:mT(l)}),A?.email?(0,G.jsx)(`span`,{className:`text-sm text-fg-muted`,children:A.email}):null]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:()=>void ee(),disabled:d,children:d?`Starting…`:M?`Reconnect`:`Connect Claude`})]}),(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Uses Claude Code's local login session, including MCP permissions and session refresh. No copy-pasted token is stored in Coro.`}),A?(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,G.jsx)(fT,{label:`Provider`,value:uT(A.apiProvider)}),(0,G.jsx)(fT,{label:`Organization`,value:A.organization??`Not reported`}),(0,G.jsx)(fT,{label:`Plan`,value:A.subscriptionType??`Not reported`}),(0,G.jsx)(fT,{label:`Token source`,value:A.tokenSource??`Not reported`})]}):null,l.status===`authorizing`?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(Ov,{tone:`warning`,children:`Waiting for the Claude browser login to finish. This panel polls automatically.`}),j?(0,G.jsxs)(`div`,{className:`rounded-xl border border-line bg-canvas/40 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,G.jsx)(`div`,{children:`Browser blocked? Continue here:`}),(0,G.jsx)(`a`,{href:j,target:`_blank`,rel:`noopener noreferrer`,className:`mt-1 block break-all text-accent-300 hover:text-accent-400`,children:j})]}):null,(0,G.jsxs)(`div`,{className:`grid gap-3 rounded-xl border border-line bg-canvas/40 p-3`,children:[(0,G.jsx)(Sv,{label:`Callback URL or authorization code`,hint:`Use this only if automatic completion fails.`,children:(0,G.jsx)(O_,{value:h,onChange:e=>g(e.target.value),placeholder:`Paste the redirected URL or the code parameter`})}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end`,children:[(0,G.jsx)(Sv,{label:`State override`,hint:`Optional if you pasted a raw authorization code.`,children:(0,G.jsx)(O_,{value:_,onChange:e=>v(e.target.value),placeholder:`Optional state`})}),(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>void te(),disabled:p,children:p?`Completing…`:`Complete manually`})]})]})]}):null]}):null,a===`apiKey`?(0,G.jsx)(Sv,{label:`API key`,required:!0,hint:`Anthropic API key from console.anthropic.com.`,children:(0,G.jsx)(Cv,{value:o,onChange:t=>r(e,`apiKey`,t.target.value),placeholder:`sk-ant-…`})}):null,a===`oauth`?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Sv,{label:`OAuth token`,required:!0,hint:`Legacy fallback only. Prefer Claude login whenever possible.`,children:(0,G.jsx)(Cv,{value:s,onChange:t=>r(e,`oauthToken`,t.target.value),placeholder:`sk-ant-oat01-…`})}),O?null:(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>void I(),disabled:S,children:[(0,G.jsx)(Jr,{}),S?`Generating…`:`Generate via claude setup-token`]}),w?(0,G.jsx)(Ov,{tone:`success`,children:w}):null,E?(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3 text-sm text-fg-muted`,children:[(0,G.jsx)(`div`,{children:`Browser blocked? Sign in here:`}),(0,G.jsx)(`a`,{href:E,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 block break-all text-accent-300 hover:text-accent-400`,children:E})]}):null]}):null,(0,G.jsxs)(`div`,{className:`border-t border-line pt-4`,children:[(0,G.jsx)(aT,{onTest:P,disabled:!F,label:`Test connection`}),(0,G.jsxs)(`p`,{className:`mt-2 text-[12px] text-fg-subtle`,children:[`Sends a 1-token `,(0,G.jsx)(`span`,{className:`font-mono`,children:`/v1/messages`}),` ping with your current credentials. For Claude login, reads the OAuth session from your local keychain.`]})]})]})}function uT(e){switch(e){case`firstParty`:return`Claude`;case`anthropicAws`:return`Anthropic AWS`;case`bedrock`:return`Amazon Bedrock`;case`vertex`:return`Vertex AI`;case`foundry`:return`Azure AI Foundry`;default:return e??`Unknown`}}function dT(e,t){let n=e.trim();if(!n)throw Error(`Paste the callback URL or authorization code to complete login manually.`);if(/^https?:\/\//i.test(n)){let e=new URL(n),r=e.searchParams.get(`code`);if(!r)throw Error(`The callback URL is missing the code query parameter.`);return{authorizationCode:r,state:e.searchParams.get(`state`)??(t.trim()||void 0)}}return{authorizationCode:n,state:t.trim()||void 0}}function fT({label:e,value:t}){return(0,G.jsxs)(`div`,{className:`rounded-xl border border-line bg-overlay/40 px-3 py-2.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:e}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg`,children:t})]})}function pT(e){switch(e.status){case`connected`:return`ok`;case`authorizing`:return`pending`;case`error`:return`error`;default:return`unset`}}function mT(e){switch(e.status){case`connected`:return`Connected`;case`authorizing`:return`Waiting for browser`;case`error`:return`Failed`;default:return`Not connected`}}var hT={"anthropic-auth":lT};function gT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&(e.properties!==void 0||e.type===`object`)}function _T(e){return/token|apikey|api_key|password|secret|appPassword/i.test(e)}function vT(e,t){return t?.format===`uri`||t?.format===`url`?!0:/url|baseUrl|endpoint|host/i.test(e)}function yT(e,t){return t?.title?t.title:e.replace(/[_-]+/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase())}function bT(e){if(!gT(e)||!e.properties)return[];let t=new Set(e.required??[]);return Object.entries(e.properties).map(([e,n])=>{let r=_T(e)?`secret`:vT(e,n)?`url`:`text`;return{name:e,label:yT(e,n),hint:n.description,required:t.has(e),kind:r,placeholder:n.default!==void 0&&typeof n.default!=`object`?String(n.default):void 0}})}function xT({plugin:e,onTest:t,defaultControl:n,footerNotice:r,onConnected:i}){let{draft:a,setPluginField:o,setPluginEnabled:s,dirtyPluginIds:c}=y_(),{manifest:l,source:u,configured:d,active:f,activationHint:p}=e,m=l.id in a.pluginInstalled,h=m?a.pluginInstalled[l.id]:{config:{}},g=m&&h.enabled!==!1,_=(0,x.useMemo)(()=>bT(l.configSchema),[l.configSchema]),v=c.has(l.id),y=l.ui?.customPanel?hT[l.ui.customPanel]:void 0,b=_.some(e=>e.required),S=_.filter(e=>e.required).every(e=>{let t=h.config[e.name];return typeof t==`string`?t.length>0:t!=null}),C=Object.values(h.config).some(e=>typeof e==`string`?e.length>0:e!=null),w=g?f&&d?{label:`active`,tone:`success`}:d?{label:`configured`,tone:`warning`}:S&&(b||C)?{label:`ready to save`,tone:`warning`}:{label:`needs setup`,tone:`neutral`}:m?{label:`disabled`,tone:`neutral`}:{label:`not configured`,tone:`neutral`};function T(e){let t=h.config[e.name],n=typeof t==`string`?t:t==null?``:String(t),r=t=>o(l.id,e.name,t);return e.kind===`secret`?(0,G.jsx)(Cv,{value:n,onChange:e=>r(e.target.value),placeholder:e.placeholder,autoComplete:`off`}):(0,G.jsx)(O_,{type:e.kind===`url`?`url`:`text`,value:n,onChange:e=>r(e.target.value),placeholder:e.placeholder,inputMode:e.kind===`url`?`url`:void 0})}return(0,G.jsxs)(`div`,{className:W(`rounded-2xl border bg-overlay/40 px-4 py-4 transition-colors`,v?`border-accent-400/50`:`border-line`),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(E_,{pluginId:l.id,size:20}),(0,G.jsx)(`div`,{className:`text-[15px] font-medium text-fg`,children:l.displayName}),(0,G.jsx)(`span`,{className:`font-mono text-[11px] text-fg-subtle`,children:l.id}),(0,G.jsx)(`span`,{className:W(`rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]`,u===`dropin`?`border-accent-400/40 bg-accent-500/10 text-accent-200`:`border-line bg-overlay/60 text-fg-muted`),children:u===`dropin`?`drop-in`:`built in`}),(0,G.jsx)(`span`,{className:W(`rounded-full border px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.16em]`,zo(w.tone)),children:w.label}),v?(0,G.jsx)(`span`,{className:`rounded-full border border-accent-400/50 bg-accent-500/10 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] text-accent-200`,children:`unsaved`}):null]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[12px] text-fg-muted`,children:[`v`,l.version,` · kind `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:l.kind})]}),p&&!d?(0,G.jsx)(`div`,{className:`mt-2 text-[12px] leading-5 text-fg-muted`,children:p}):null]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-[12px] text-fg-muted`,children:[(0,G.jsx)(`span`,{children:`Enabled`}),(0,G.jsx)(jx,{checked:g,onCheckedChange:e=>s(l.id,e),ariaLabel:`Enable ${l.displayName}`,size:`sm`})]})]}),g?(0,G.jsxs)(G.Fragment,{children:[y?(0,G.jsx)(`div`,{className:`mt-4`,children:(0,G.jsx)(y,{pluginId:l.id,onConnected:i})}):_.length===0?(0,G.jsx)(Ov,{tone:`neutral`,className:`mt-4`,children:`This plugin doesn't expose configuration. Toggle Enable to register it.`}):(0,G.jsx)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:_.map(e=>(0,G.jsx)(Sv,{label:e.label,required:e.required,hint:e.hint,className:e.kind===`url`?`sm:col-span-2`:void 0,children:T(e)},e.name))}),(t||n||r)&&(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-3 border-t border-line pt-4`,children:[t&&!y?(0,G.jsx)(aT,{onTest:()=>t(h.config),disabled:!S}):null,n,r]})]}):null]})}async function ST(e,t){try{return await q(`/test/llm`,J({provider:e,config:t},{method:`POST`}))}catch(e){return{ok:!1,message:e instanceof Error?e.message:String(e)}}}var CT=[`tier:planning`,`tier:coding`,`tier:mini`];function wT(e,t){return e.startsWith(`tier:`)?`tier`:t.has(e)?`declared`:`custom`}function TT(){let[e,t]=(0,x.useState)(new Map);return(0,x.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await q(`/workflows`);if(e)return;let r=new Map,i=(e,t)=>{let n=r.get(e)??[];n.push(t),r.set(e,n)};for(let e of n.workflows??[])for(let t of e.phases??[]){let n={workflowId:e.id,workflowName:e.name,phaseName:t.name},r=(t.model??``).trim();r&&i(r,n);let a=(t.tier??``).trim();a&&i(`tier:${a}`,n)}t(r)}catch{}})(),()=>{e=!0}},[]),{usagesByAlias:e,referencedNames:(0,x.useMemo)(()=>Array.from(e.keys()).sort(),[e])}}function ET(){let{draft:e,setDraft:t,pluginsCatalogue:n,pluginsCatalogueError:r}=y_(),i=oy({draft:e,pluginsCatalogue:n}).byId[`llm-provider`],a=(0,x.useMemo)(()=>n?n.plugins.filter(e=>e.manifest.kind===`executor`).sort((e,t)=>e.source===t.source?e.manifest.displayName.localeCompare(t.manifest.displayName):e.source===`builtin`?-1:1):[],[n]),o=(0,x.useMemo)(()=>a.filter(t=>{let n=e.pluginInstalled[t.manifest.id];return n===void 0||n.enabled!==!1}).map(e=>e.manifest.id),[a,e.pluginInstalled]),s=e.llmDefaultProvider,c=e=>{t(`llmDefaultProvider`,e)},l=(0,x.useMemo)(()=>Object.entries(e.llmAliases),[e.llmAliases]),u=e=>{t(`llmAliases`,e)},d=(t,n)=>{if(!n||n===t||e.llmAliases[n])return;let r={};for(let[i,a]of Object.entries(e.llmAliases))r[i===t?n:i]=a;u(r)},f=(t,n)=>{let r=e.llmAliases[t]??{provider:``,model:``};u({...e.llmAliases,[t]:{...r,...n}})},p=t=>{let{[t]:n,...r}=e.llmAliases;u(r)},m=()=>{let t=1,n=`new-alias`;for(;e.llmAliases[n];)t+=1,n=`new-alias-${t}`;u({...e.llmAliases,[n]:{provider:s||o[0]||``,model:``}})},{modelsByProvider:h,loadModels:g}=uC();(0,x.useEffect)(()=>{let e=new Set;for(let[,t]of l)t.provider&&!e.has(t.provider)&&(e.add(t.provider),g(t.provider));s&&g(s)},[l,s,g]);let{usagesByAlias:_,referencedNames:v}=TT(),y=(0,x.useMemo)(()=>new Set(v),[v]),b=(0,x.useMemo)(()=>v.filter(t=>!(t in e.llmAliases)&&!t.startsWith(`tier:`)),[v,e.llmAliases]),S=(0,x.useMemo)(()=>CT.filter(t=>!(t in e.llmAliases)),[e.llmAliases]),C=(0,x.useMemo)(()=>{let e=[],t=[],n=[];for(let r of l){let i=wT(r[0],y);i===`tier`?e.push(r):i===`declared`?t.push(r):n.push(r)}return{tiers:e,declared:t,custom:n}},[l,y]),[w,T]=(0,x.useState)(!1),E=t=>{u({...e.llmAliases,[t]:{provider:s||o[0]||``,model:``}})},D=`alias-name-suggestions-${(0,x.useId)()}`;return(0,G.jsx)(iT,{title:`LLM providers`,description:`Configure one or more model providers and route workflow aliases to specific provider/model pairs.`,required:!0,status:i.status,statusLabel:i.label,children:(0,G.jsxs)(`div`,{className:`space-y-6`,children:[r?(0,G.jsxs)(Ov,{tone:`warning`,children:[`Couldn't load the plugin catalogue from the runner: `,r,`.`]}):null,a.length===0?(0,G.jsx)(Ov,{tone:`neutral`,children:`No LLM-provider plugins discovered. Built-ins are bundled with the runner — restart it if this looks wrong.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,G.jsx)(xT,{plugin:e,onTest:t=>ST(e.manifest.id,t)},e.manifest.id))}),(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5`,children:(0,G.jsx)(Sv,{label:`Default provider`,hint:`Used when an alias or workflow phase does not pin a provider explicitly.`,children:(0,G.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg`,children:[(0,G.jsx)(`option`,{value:``,children:`(let the runner choose — defaults to anthropic)`}),o.map(e=>(0,G.jsx)(`option`,{value:e,children:a.find(t=>t.manifest.id===e)?.manifest.displayName??e},e))]})})}),(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Aliases`}),(0,G.jsxs)(`div`,{className:`text-[12px] text-fg-muted`,children:[`Workflow shorthands that map to a concrete `,(0,G.jsx)(`span`,{className:`font-mono`,children:`provider/model`}),` pair. Three groups, in increasing specificity:`]}),(0,G.jsxs)(`ul`,{className:`mt-1.5 space-y-0.5 text-[12px] text-fg-subtle`,children:[(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:`Tiers`}),` — capability slots every workflow defaults to (planning / coding / mini).`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:`Workflow-declared`}),` — alias names a specific workflow phase pins via `,(0,G.jsx)(`span`,{className:`font-mono`,children:`model:`}),`.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:`Custom`}),` — anything you've added that no workflow references yet.`]})]})]}),(0,G.jsxs)(DT,{title:`Tiers`,subtitle:`Workflow defaults. Every install needs these — workflows fall back to the matching tier when a phase doesn't pin a model.`,children:[C.tiers.map(([t,n])=>(0,G.jsx)(OT,{name:t,row:n,kind:`tier`,nameLocked:!0,enabledIds:o,executorPlugins:a,modelsByProvider:h,loadModels:g,usages:_.get(t)??[],aliasNameDatalistId:D,existingAliasNames:Object.keys(e.llmAliases),onRename:d,onUpdate:f,onRemove:p},t)),S.length>0?(0,G.jsx)(`div`,{className:`space-y-1.5`,children:S.map(e=>(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl border border-dashed border-warning-400/50 bg-warning-50/5 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-mono text-sm text-fg`,children:e}),(0,G.jsx)(`div`,{className:`text-[11px] text-fg-subtle`,children:`Not defined in this draft. Active LLM plugins re-seed tier defaults on every runner start — click Define to pin one explicitly.`})]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>E(e),disabled:o.length===0,children:`Define`})]},e))}):null]}),C.declared.length>0||b.length>0?(0,G.jsxs)(DT,{title:`Workflow-declared`,subtitle:`Alias names referenced explicitly by a workflow phase via its model: field.`,children:[C.declared.map(([t,n])=>(0,G.jsx)(OT,{name:t,row:n,kind:`declared`,nameLocked:!0,enabledIds:o,executorPlugins:a,modelsByProvider:h,loadModels:g,usages:_.get(t)??[],aliasNameDatalistId:D,existingAliasNames:Object.keys(e.llmAliases),onRename:d,onUpdate:f,onRemove:p},t)),b.length>0?(0,G.jsx)(`div`,{className:`space-y-1.5`,children:b.map(t=>{let n=_.get(t)??[];return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl border border-dashed border-warning-400/50 bg-warning-50/5 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-mono text-sm text-fg`,children:t}),(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[`Needs definition · used by`,` `,n.map((e,t)=>(0,G.jsxs)(`span`,{children:[t>0?`, `:null,(0,G.jsx)(`span`,{className:`font-mono`,children:e.workflowId}),(0,G.jsxs)(`span`,{className:`opacity-70`,children:[` · `,e.phaseName]})]},`${e.workflowId}-${e.phaseName}-${t}`))]})]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>u({...e.llmAliases,[t]:{provider:s||o[0]||``,model:``}}),disabled:o.length===0,children:`Define`})]},t)})}):null]}):null,(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>T(e=>!e),className:`flex w-full items-center justify-between gap-2 text-left text-sm font-medium text-fg-muted hover:text-fg`,children:[(0,G.jsxs)(`span`,{children:[`Custom `,(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[`(`,C.custom.length,`)`]})]}),(0,G.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:w?`Hide`:`Show`})]}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`text-[12px] text-fg-subtle`,children:`Free-form aliases not referenced by any workflow. Useful for ad-hoc experiments.`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:C.custom.map(([t,n])=>(0,G.jsx)(OT,{name:t,row:n,kind:`custom`,enabledIds:o,executorPlugins:a,modelsByProvider:h,loadModels:g,usages:_.get(t)??[],aliasNameDatalistId:D,existingAliasNames:Object.keys(e.llmAliases),onRename:d,onUpdate:f,onRemove:p},t))}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:m,disabled:o.length===0,children:[(0,G.jsx)(pi,{}),`Add alias`]})})]}):null]}),(0,G.jsx)(`datalist`,{id:D,children:b.map(e=>(0,G.jsx)(`option`,{value:e},e))})]}),(0,G.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:i.detail})]})})}function DT({title:e,subtitle:t,children:n}){return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e}),(0,G.jsx)(`div`,{className:`text-[12px] text-fg-subtle`,children:t})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:n})]})}function OT({name:e,row:t,kind:n,nameLocked:r=!1,enabledIds:i,executorPlugins:a,modelsByProvider:o,loadModels:s,usages:c,aliasNameDatalistId:l,existingAliasNames:u,onRename:d,onUpdate:f,onRemove:p}){let[m,h]=(0,x.useState)(e),g=(0,x.useRef)(e);(0,x.useEffect)(()=>{e!==g.current&&(h(e),g.current=e)},[e]);let _=m.trim(),v=_!==e,y=v&&_.length>0&&u.includes(_),b=v&&_.length===0,S=()=>{if(v){if(y||b){h(e);return}d(e,_),g.current=_}},C=`alias-help-${e}`;return(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`grid gap-2 rounded-xl border border-line bg-canvas/40 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1.4fr)_auto] sm:items-end`,children:[(0,G.jsx)(Sv,{label:`Alias`,children:(0,G.jsx)(O_,{value:m,list:r?void 0:l,readOnly:r,tabIndex:r?-1:void 0,onChange:e=>h(e.target.value),onBlur:S,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),t.target.blur()):t.key===`Escape`&&(h(e),t.target.blur())},placeholder:`coding`,"aria-invalid":y||b||void 0,"aria-describedby":C,className:[y||b?`border-danger-400/60`:``,r?`cursor-default bg-overlay/40 font-mono`:``].filter(Boolean).join(` `)||void 0})}),(0,G.jsx)(`div`,{className:`sm:col-span-2`,children:(0,G.jsx)(cC,{value:{provider:t.provider,model:t.model},onChange:t=>{f(e,{provider:t.provider,model:t.model})},providers:i.map(e=>({id:e,displayName:a.find(t=>t.manifest.id===e)?.manifest.displayName??e})),modelsByProvider:o,loadModels:s})}),(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>p(e),"aria-label":`Remove ${e}`,disabled:n===`tier`,title:n===`tier`?`Tier aliases are required by every workflow.`:void 0,children:(0,G.jsx)(ji,{})})]}),(0,G.jsx)(`div`,{id:C,className:`px-1 text-[11px] leading-4 text-fg-subtle`,children:y?(0,G.jsx)(`span`,{className:`text-danger-400`,children:`An alias with that name already exists.`}):b?(0,G.jsx)(`span`,{className:`text-danger-400`,children:`Alias name cannot be empty.`}):c.length>0?(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-fg-muted`,children:`Used in:`}),` `,c.map((e,t)=>(0,G.jsxs)(`span`,{children:[t>0?`, `:null,(0,G.jsx)(`span`,{className:`font-mono`,children:e.workflowId}),(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[` · `,e.phaseName]})]},`${e.workflowId}-${e.phaseName}-${t}`))]}):(0,G.jsx)(`span`,{className:`opacity-70`,children:`Not referenced by any workflow yet.`})})]})}function kT(e,t){return e===`github`?{provider:`github`,username:String(t.owner??``),token:String(t.token??``),workspace:String(t.owner??``)}:e===`bitbucket`?{provider:`bitbucket`,username:String(t.coderUsername??``),token:String(t.coderToken??``),workspace:String(t.workspace??``),reviewerUsername:String(t.reviewerUsername??``),reviewerToken:String(t.reviewerToken??``)}:e===`gitlab`?{provider:`gitlab`,username:String(t.username??t.user??``),token:String(t.token??``),workspace:String(t.workspace??t.group??``)}:null}function AT(){let{draft:e,pluginsCatalogue:t,pluginsCatalogueError:n,setPluginDefault:r}=y_(),i=oy({draft:e,pluginsCatalogue:t}).byId[`source-control`],a=(0,x.useMemo)(()=>t?t.plugins.filter(e=>e.manifest.kind===`scm`).sort((e,t)=>e.source===t.source?e.manifest.displayName.localeCompare(t.manifest.displayName):e.source===`builtin`?-1:1):[],[t]),o=(0,x.useMemo)(()=>a.filter(t=>{let n=e.pluginInstalled[t.manifest.id];return n!==void 0&&n.enabled!==!1}).map(e=>e.manifest.id),[a,e.pluginInstalled]);async function s(e,t){let n=kT(e,t);if(!n)return{ok:!1,message:`No generic connection test available for drop-in plugins yet — save and check the plugin healthcheck.`};try{let e=await q(`/test/git`,J(n,{method:`POST`}));return{ok:e.ok,message:e.message??(e.ok?`Authenticated.`:`Connection failed.`),checks:e.checks}}catch(e){return{ok:!1,message:(e instanceof K,e.message)}}}return(0,G.jsxs)(iT,{title:`Source control`,description:`Git provider plugins. Each plugin handles clone, branch, push, PR, and review for one host. Multiple plugins can be configured side-by-side; the default below decides which one new jobs use unless overridden.`,required:!0,status:i.status,statusLabel:i.label,children:[n?(0,G.jsxs)(Ov,{tone:`warning`,children:[`Couldn't load the plugin catalogue from the runner: `,n,`.`]}):null,a.length===0?(0,G.jsx)(Ov,{tone:`neutral`,children:`No source-control plugins discovered. Built-ins are bundled with the runner — restart it if this looks wrong.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,G.jsx)(xT,{plugin:e,onTest:t=>s(e.manifest.id,t)},e.manifest.id))}),o.length>1?(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5`,children:(0,G.jsx)(Sv,{label:`Default for new jobs`,hint:`When more than one source-control plugin is enabled, jobs use this one unless they specify a different SCM at creation time.`,children:(0,G.jsxs)(`select`,{value:e.pluginDefaultScm,onChange:e=>r(`scm`,e.target.value),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg`,children:[(0,G.jsx)(`option`,{value:``,children:`(let the registry choose)`}),o.map(e=>(0,G.jsx)(`option`,{value:e,children:a.find(t=>t.manifest.id===e)?.manifest.displayName??e},e))]})})}):null,(0,G.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:i.detail})]})}function jT(e,t){return e===`jira`?{provider:`jira`,jira:{baseUrl:String(t.baseUrl??``),username:String(t.username??``),apiToken:String(t.apiToken??``)}}:e===`linear`?{provider:`linear`,linear:{apiKey:String(t.apiKey??``),teamKey:String(t.teamKey??``)}}:e===`github-issues`?{provider:`github`,git:{provider:`github`,username:String(t.defaultOwner??``),token:String(t.token??``),workspace:String(t.defaultOwner??``)}}:null}function MT(){let{draft:e,pluginsCatalogue:t,pluginsCatalogueError:n,setPluginDefault:r}=y_(),i=oy({draft:e,pluginsCatalogue:t}).byId[`issue-tracker`],a=(0,x.useMemo)(()=>t?t.plugins.filter(e=>e.manifest.kind===`tracker`).sort((e,t)=>e.source===t.source?e.manifest.displayName.localeCompare(t.manifest.displayName):e.source===`builtin`?-1:1):[],[t]),o=(0,x.useMemo)(()=>a.filter(t=>{let n=e.pluginInstalled[t.manifest.id];return n!==void 0&&n.enabled!==!1}).map(e=>e.manifest.id),[a,e.pluginInstalled]);async function s(e,t){let n=jT(e,t);if(!n)return{ok:!1,message:`No generic connection test available for drop-in plugins yet — save and check the plugin healthcheck.`};try{let e=await q(`/test/tracker`,J(n,{method:`POST`}));return{ok:e.ok,message:e.message??(e.ok?`Connected.`:`Connection failed.`)}}catch(e){return{ok:!1,message:(e instanceof K,e.message)}}}return(0,G.jsxs)(iT,{title:`Issue tracker`,description:`Tracker plugins. Each plugin maps Coro work units (epics + child issues) to a backlog system. Optional — leave all disabled to run jobs without tracker round-trips.`,status:i.status,statusLabel:i.status===`optional`?`Optional`:i.label,children:[n?(0,G.jsxs)(Ov,{tone:`warning`,children:[`Couldn't load the plugin catalogue from the runner: `,n,`.`]}):null,a.length===0?(0,G.jsx)(Ov,{tone:`neutral`,children:`No tracker plugins discovered. Built-ins are bundled with the runner — restart it if this looks wrong.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,G.jsx)(xT,{plugin:e,onTest:t=>s(e.manifest.id,t)},e.manifest.id))}),o.length>1?(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5`,children:(0,G.jsx)(Sv,{label:`Default for new jobs`,hint:`When more than one tracker plugin is enabled, jobs use this one unless they specify a different tracker at creation time.`,children:(0,G.jsxs)(`select`,{value:e.pluginDefaultTracker,onChange:e=>r(`tracker`,e.target.value),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg`,children:[(0,G.jsx)(`option`,{value:``,children:`(let the registry choose)`}),o.map(e=>(0,G.jsx)(`option`,{value:e,children:a.find(t=>t.manifest.id===e)?.manifest.displayName??e},e))]})})}):null,(0,G.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:i.detail})]})}function NT(e){return e.configured??e.installed}function PT(e){return NT(e)&&e.active?{label:`enabled`,tone:`success`}:NT(e)?{label:`configured`,tone:`warning`}:e.source===`builtin`?{label:`built in`,tone:`neutral`}:{label:`installed`,tone:`neutral`}}function FT(e){return NT(e)&&e.active?0:NT(e)?1:e.source===`builtin`?2:3}function IT(){let[e,t]=(0,x.useState)(null),[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(``),[o,s]=(0,x.useState)(``),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null);(0,x.useEffect)(()=>{g()},[]);async function g(){try{r(!0),t(await q(`/plugins`))}catch{t(null)}finally{r(!1)}}async function _(e){e.preventDefault(),d(null),p(null);let t=i.trim();if(!t){d("Enter an npm package name (e.g. `@coro-ai/plugin-gitlab`).");return}try{l(!0);let e={spec:t},n=o.trim();n&&(e.id=n);let r=await q(`/plugins/install`,J(e,{method:`POST`}));p(r.restartHint?`Installed "${r.manifest.displayName}". ${r.restartHint}`:`Installed "${r.manifest.displayName}" and loaded into the registry — no restart needed.`),a(``),s(``),g()}catch(e){d((e instanceof K,e.message))}finally{l(!1)}}async function v(e,t){if(d(null),p(null),window.confirm(`Remove drop-in plugin "${t}"? The runner will need a restart to drop it from memory.`))try{h(e),p(`Removed "${t}". ${(await q(`/plugins/${encodeURIComponent(e)}`,{method:`DELETE`})).restartHint??`Restart the runner to fully unload it.`}`),g()}catch(e){d(`Failed to uninstall ${t}: ${e instanceof K,e.message}`)}finally{h(null)}}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(iT,{title:`Install a plugin`,description:`Drop-in plugins live under ~/.coro/plugins/. Paste any npm package name or git/tarball spec — the runner installs it locally and hot-loads it into the registry; configure credentials below to start using it.`,children:(0,G.jsxs)(`form`,{onSubmit:_,className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[2fr_1fr_auto] sm:items-end`,children:[(0,G.jsx)(Sv,{label:`npm spec`,htmlFor:`plugin-install-spec`,hint:`Examples: @coro-ai/plugin-gitlab, coro-plugin-jenkins@1.2.0, github:my-org/coro-plugin-acme.`,children:(0,G.jsx)(O_,{id:`plugin-install-spec`,value:i,onChange:e=>a(e.target.value),placeholder:`@coro-ai/plugin-gitlab`,disabled:c})}),(0,G.jsx)(Sv,{label:`Plugin id (optional)`,htmlFor:`plugin-install-id`,children:(0,G.jsx)(O_,{id:`plugin-install-id`,value:o,onChange:e=>s(e.target.value),placeholder:`gitlab`,disabled:c})}),(0,G.jsxs)(Y,{type:`submit`,disabled:c||!i.trim(),children:[(0,G.jsx)(ri,{}),c?`Installing…`:`Install`]})]}),u?(0,G.jsx)(Ov,{tone:`danger`,children:u}):null,f?(0,G.jsx)(Ov,{tone:`success`,children:f}):null]})}),(0,G.jsx)(iT,{title:`Installed plugins`,description:`Provider integrations the runner has loaded. Each plugin contributes its own MCP tools, webhook normaliser, and (optionally) intelligence snippets.`,action:(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void g(),disabled:n,children:[(0,G.jsx)(mi,{}),n?`Refreshing…`:`Refresh`]}),children:e?(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:`Default SCM`}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg`,children:e.defaults.scm??`— (single enabled plugin wins)`})]}),(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:`Default tracker`}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg`,children:e.defaults.tracker??`— (single enabled plugin wins)`})]})]}),e.plugins.some(e=>NT(e)&&e.active)?null:(0,G.jsx)(Ov,{tone:`warning`,children:`No plugins are enabled yet. Coro ships with GitHub, Bitbucket, Jira, Linear, and GitHub Issues. Configure credentials under Source control / Issue tracker and restart the runner.`}),e.plugins.length===0?(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:`No plugins discovered.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:[...e.plugins].sort((e,t)=>{let n=FT(e)-FT(t);return n===0?e.manifest.displayName.localeCompare(t.manifest.displayName):n}).map(e=>{let{manifest:t,source:n,mcpServer:r,activationHint:i}=e,a=PT(e);return(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(fi,{className:`size-4 text-fg-subtle`}),(0,G.jsx)(`div`,{className:`text-[15px] font-medium text-fg`,children:t.displayName}),(0,G.jsx)(`span`,{className:`font-mono text-[11px] text-fg-subtle`,children:t.id}),n===`dropin`?(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] text-fg-muted`,children:`drop-in`}):null]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[12px] text-fg-muted`,children:[`kind: `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:t.kind}),` · `,`v`,t.version,` · `,`host `,t.hostCompatibility]}),!NT(e)&&i?(0,G.jsx)(`div`,{className:`mt-2 text-[12px] leading-5 text-fg-muted`,children:i}):null,r?(0,G.jsxs)(`div`,{className:`mt-2 text-[11px] text-fg-muted`,children:[`Attached MCP server: `,(0,G.jsx)(`span`,{className:`font-mono`,children:r.type}),` · agents see tools as `,(0,G.jsxs)(`span`,{className:`font-mono`,children:[`mcp__`,t.id,`__*`]})]}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:W(`rounded-full border px-2.5 py-1 text-[11px] font-medium uppercase tracking-[0.16em]`,zo(a.tone)),children:a.label}),n===`dropin`?(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void v(t.id,t.displayName),disabled:m===t.id,children:[(0,G.jsx)(ji,{}),m===t.id?`Removing…`:`Uninstall`]}):null]})]})},t.id)})})]}):(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:n?`Loading plugins…`:`Plugin discovery is unavailable. The runner may be too old or returned an error.`})})]})}var LT=`{
121
121
  "slack": {
122
122
  "type": "stdio",
123
123
  "command": "npx",
@@ -135,4 +135,4 @@ name: my-`)||e.startsWith(`# my-`)?t.content:e)},[b,r,e]),(0,x.useEffect)(()=>{i
135
135
  "url": "https://mcp.datadoghq.com/sse",
136
136
  "enabled": false
137
137
  }
138
- }`;function UT(){let{draft:e,setDraft:t}=y_(),[n,r]=(0,x.useState)(null),[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(!1);(0,x.useEffect)(()=>{try{let t=JSON.parse(e.mcpServersText);r(typeof t!=`object`||!t||Array.isArray(t)?`mcpServers must be a JSON object keyed by server id.`:null)}catch(e){r(`Invalid JSON: ${e.message}`)}},[e.mcpServersText]);async function c(){try{s(!0),a(await q(`/config/claude-code-mcps`))}catch{a(null)}finally{s(!1)}}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(lT,{title:`Bring-your-own MCP servers`,description:"Attach any MCP server (Slack, Sentry, Datadog, internal tooling…) to every job session. The runner spawns each entry alongside the in-process `coro` server; agents see them as `mcp__<id>__*`.",footer:(0,G.jsxs)(`span`,{children:[`Reserved id `,(0,G.jsx)(`code`,{children:`coro`}),` is rejected. Use `,(0,G.jsx)(`code`,{children:`"enabled": false`}),` to keep an entry without attaching it.`,(0,G.jsx)(`code`,{children:` allowedTools`}),` / `,(0,G.jsx)(`code`,{children:`disallowedTools`}),` become per-server tool policy. Changes save with the rest of the page.`]}),children:[(0,G.jsx)(bb,{value:e.mcpServersText,onChange:e=>t(`mcpServersText`,e.target.value),spellCheck:!1,rows:14,className:`font-mono text-[12px]`}),n?(0,G.jsx)(Ov,{tone:`danger`,children:n}):null]}),(0,G.jsxs)(lT,{title:`Inherit from Claude Code`,description:`When enabled, the runner reads MCP servers from your user-level Claude Code config (~/.claude.json and ~/.claude/settings.json) and attaches them to every job session. Explicit BYO entries above override inherited entries with the same id.`,action:(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void c(),disabled:o,children:[(0,G.jsx)(mi,{}),o?`Refreshing…`:`Refresh`]}),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Inherit Claude Code MCP servers`}),(0,G.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`Off by default — Claude Code configs commonly carry developer-personal entries (Notion, GitHub Personal…) that an operator may not want every job to see.`})]}),(0,G.jsx)(Ax,{checked:e.inheritClaudeCodeMcps,onCheckedChange:e=>t(`inheritClaudeCodeMcps`,e),ariaLabel:`Inherit Claude Code MCP servers`})]}),i?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[i.sources.length>0?(0,G.jsxs)(`div`,{className:`text-[12px] text-fg-muted`,children:[`Read from`,` `,i.sources.map((e,t)=>(0,G.jsxs)(`span`,{className:`font-mono`,children:[t>0?`, `:``,e]},e))]}):(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:[`No Claude Code MCP servers found. Add one with `,(0,G.jsx)(`code`,{children:`claude mcp add <name> --scope user`}),` or paste an entry into `,(0,G.jsx)(`code`,{children:`~/.claude.json`}),` under `,(0,G.jsx)(`code`,{children:`mcpServers`}),`.`]}),Object.keys(i.servers).length>0?(0,G.jsx)(`pre`,{className:`overflow-auto rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-[12px] text-fg-muted`,children:JSON.stringify(i.servers,null,2)}):null]}):(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:o?`Loading discovered servers…`:`Click Refresh to preview the MCP servers Claude Code currently exposes.`})]}),(0,G.jsx)(lT,{title:`Examples`,description:"Drop these into the editor above. Replace placeholder secrets with real ones — values containing `...` are treated as redacted echoes and ignored on save.",children:(0,G.jsx)(`pre`,{className:`overflow-auto rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-[12px] text-fg-muted`,children:HT})})]})}function WT({targetPath:e,label:t}){let[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(null),o=typeof navigator<`u`&&/Win/i.test(navigator.platform)?`explorer`:typeof navigator<`u`&&/Mac/i.test(navigator.platform)?`finder`:`files`,s=o===`finder`?`Show in Finder`:o===`explorer`?`Show in Explorer`:`Open folder`;async function c(){if(e){a(null),r(!0);try{let t=await q(`/system/reveal`,J({path:e,create:!0},{method:`POST`}));t.ok||a(t.error??`Could not open folder`)}catch(e){a((e instanceof K,e.message))}finally{r(!1)}}}return(0,G.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void c(),disabled:!e||n,title:e??`${t} not configured`,children:[n?(0,G.jsx)($r,{className:`animate-spin`}):(0,G.jsx)(Rr,{}),s]}),i?(0,G.jsx)(`span`,{className:`text-[11px] text-danger-300`,children:i}):null]})}function GT(){let{draft:e,setDraft:t,meta:n}=y_(),r=e.intelligenceDir.trim()||n?.resolved.intelligenceDir,i=e.workingDir.trim()||n?.resolved.workingDir;return(0,G.jsxs)(lT,{title:`Paths`,description:`Filesystem locations the runner uses for intelligence materialisation and working repositories. Defaults are usually fine.`,children:[(0,G.jsxs)(Sv,{label:`Intelligence directory`,hint:`Leave blank to use the resolved default.`,children:[(0,G.jsx)(O_,{value:e.intelligenceDir,onChange:e=>t(`intelligenceDir`,e.target.value),placeholder:n?.resolved.intelligenceDir??``}),(0,G.jsx)(WT,{targetPath:r,label:`Intelligence directory`})]}),(0,G.jsx)(Sv,{label:`Intelligence git remote`,hint:`URL of your tenant intelligence Git repository. The runner clones it on first proposal and uses it when merging overlays.`,children:(0,G.jsx)(O_,{value:e.intelligenceRemote,onChange:e=>t(`intelligenceRemote`,e.target.value),placeholder:`https://github.com/org/coro-intelligence.git`})}),(0,G.jsxs)(Sv,{label:`Working directory`,hint:`Where repositories are cloned during job execution.`,children:[(0,G.jsx)(O_,{value:e.workingDir,onChange:e=>t(`workingDir`,e.target.value),placeholder:n?.resolved.workingDir??``}),(0,G.jsx)(WT,{targetPath:i,label:`Working directory`})]}),n?(0,G.jsxs)(`div`,{className:`grid gap-2 rounded-2xl border border-line bg-overlay/40 p-4 text-xs sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.18em] text-fg-subtle`,children:`Config path`}),(0,G.jsx)(`div`,{className:`mt-1 break-all font-mono text-fg-muted`,children:n.configPath}),(0,G.jsx)(WT,{targetPath:n.configPath,label:`Config file`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.18em] text-fg-subtle`,children:`Mode`}),(0,G.jsx)(`div`,{className:`mt-1 font-mono text-fg-muted`,children:n.mode})]})]}):null]})}function KT(e){let t=[`on ${e.on}`];return e.during?.length&&t.push(`during ${e.during.join(`, `)}`),t.join(` · `)}function qT({rule:e,onConfigChange:t}){let n=e.config??{},r=typeof n.minLength==`number`?n.minLength:80,i=Array.isArray(n.requiredHeadings)?n.requiredHeadings.join(`, `):`## What`;return(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsx)(Sv,{label:`Minimum description length`,children:(0,G.jsx)(O_,{type:`number`,min:1,value:r,onChange:e=>{let r=Number(e.target.value);t({...n,minLength:Number.isFinite(r)?r:80})}})}),(0,G.jsx)(Sv,{label:`Required headings (comma-separated)`,children:(0,G.jsx)(O_,{value:i,onChange:e=>{t({...n,requiredHeadings:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})}})})]})}function JT({rule:e,onConfigChange:t}){let n=e.config??{};return(0,G.jsx)(Sv,{label:`Minimum human approvals`,children:(0,G.jsx)(O_,{type:`number`,min:0,value:typeof n.minApprovals==`number`?n.minApprovals:1,onChange:e=>{let r=Number(e.target.value);t({...n,minApprovals:Number.isFinite(r)?r:1})}})})}function YT({rule:e,onConfigChange:t}){let n=e.config??{},r=typeof n.maxLines==`number`?n.maxLines:500,i=typeof n.maxFiles==`number`?n.maxFiles:40;return(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsx)(Sv,{label:`Max diff lines`,children:(0,G.jsx)(O_,{type:`number`,min:1,value:r,onChange:e=>{let r=Number(e.target.value);t({...n,maxLines:Number.isFinite(r)?r:500})}})}),(0,G.jsx)(Sv,{label:`Max changed files`,children:(0,G.jsx)(O_,{type:`number`,min:1,value:i,onChange:e=>{let r=Number(e.target.value);t({...n,maxFiles:Number.isFinite(r)?r:40})}})})]})}function XT(){let{draft:e,setDraft:t,setGuardrailRuleEnabled:n,setGuardrailRuleConfig:r,meta:i}=y_(),[a,o]=(0,x.useState)(!1),[s,c]=(0,x.useState)(null),l=(0,x.useMemo)(()=>e.guardrailRules.filter(e=>e.check===`script`),[e.guardrailRules]),u=(0,x.useMemo)(()=>e.guardrailRules.filter(e=>e.check!==`script`),[e.guardrailRules]),d=i?.resolved?.guardrails?.scriptsDir??`~/.coro/guardrails`;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(lT,{title:`Enable guardrails`,description:`When off, the runner skips all guardrail checks. Shipped defaults stay in the Coro package; this toggle controls whether they run.`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`span`,{className:`text-sm text-fg-muted`,children:`Enforce guardrails on jobs`}),(0,G.jsx)(Ax,{checked:e.guardrailsEnabled,onCheckedChange:e=>t(`guardrailsEnabled`,e)})]})}),u.map(t=>(0,G.jsx)(lT,{title:t.title??t.id,description:t.description,status:t.source===`override`?`warn`:void 0,statusLabel:t.source===`override`?`modified`:t.source===`bundled`?`default`:void 0,action:(0,G.jsx)(Ax,{checked:t.enabled,disabled:!e.guardrailsEnabled,onCheckedChange:e=>n(t.id,e)}),footer:(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:KT(t)}),children:t.enabled&&e.guardrailsEnabled?t.check===`pr-description`?(0,G.jsx)(qT,{rule:t,onConfigChange:e=>r(t.id,e)}):t.check===`pr-diff-size`?(0,G.jsx)(YT,{rule:t,onConfigChange:e=>r(t.id,e)}):t.check===`merge-requires-approval`?(0,G.jsx)(JT,{rule:t,onConfigChange:e=>r(t.id,e)}):(0,G.jsxs)(Ov,{tone:`neutral`,children:[`No dashboard fields for check `,(0,G.jsx)(`code`,{children:t.check}),`. Edit advanced JSON below.`]}):(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Rule disabled.`})},t.id)),l.length>0?(0,G.jsx)(lT,{title:`Custom script rules`,description:`Rules that run JavaScript from your guardrails folder. Edit the script file on disk; the runner loads it on the next tool call.`,children:(0,G.jsx)(`ul`,{className:`space-y-3`,children:l.map(t=>(0,G.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-line bg-overlay/30 px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-medium text-sm`,children:t.title??t.id}),(0,G.jsxs)(`p`,{className:`text-xs text-fg-muted font-mono`,children:[d,`/`,t.script,`.mjs`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:W(`rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide`,t.scriptFileExists?`bg-success/15 text-success`:`bg-danger/15 text-danger`),children:t.scriptFileExists?`script found`:`script missing`}),(0,G.jsx)(Ax,{checked:t.enabled,disabled:!e.guardrailsEnabled,onCheckedChange:e=>n(t.id,e)})]})]},t.id))})}):null,(0,G.jsx)(lT,{title:`Advanced`,description:`Override guardrails as raw JSON (same shape as ~/.coro/config.json guardrails.rules).`,action:(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-sm text-fg-muted hover:text-fg`,onClick:()=>o(e=>!e),children:[a?(0,G.jsx)(lr,{className:`h-4 w-4`}):(0,G.jsx)(ur,{className:`h-4 w-4`}),a?`Hide`:`Show`]}),children:a?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`textarea`,{value:e.guardrailsRulesText,onChange:e=>{t(`guardrailsRulesText`,e.target.value);try{JSON.parse(e.target.value),c(null)}catch(e){c(`Invalid JSON: ${e.message}`)}},spellCheck:!1,rows:10,className:`w-full rounded-md border border-line bg-bg font-mono text-[12px] p-3`}),s?(0,G.jsx)(Ov,{tone:`danger`,children:s}):null]}):null})]})}function ZT(){let{preferences:e,reload:t}=y_(),n=e?.coachMode,r=e?.intake,i=n?.enabled??!0,a=n?.graduateAfterRuns??5,o=r?.mode??(i?`ai`:`form`);async function s(e){await q(`/config`,J(e,{method:`PUT`})),await t()}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(lT,{title:`Coach mode`,description:`Safer defaults for new users — interactive checkpoints on by default until you graduate.`,children:(0,G.jsxs)(`label`,{className:`flex items-center justify-between gap-4 rounded-xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Enable coach mode`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:`New runs default to Interactive mode and show extra guidance on the New Run page.`})]}),(0,G.jsx)(Ax,{checked:i,onCheckedChange:e=>void s({coachMode:{enabled:e,graduateAfterRuns:a}}),"aria-label":`Coach mode`})]})}),(0,G.jsxs)(lT,{title:`Coro plan mode`,description:`Choose how the New Run page starts — plan mode conversation or the classic form.`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{className:`text-[11px] font-medium uppercase tracking-[0.16em] text-fg-subtle`,children:`Default new-run mode`}),(0,G.jsxs)(kS,{value:o,onChange:e=>void s({intake:{...r,mode:e.target.value}}),children:[(0,G.jsx)(`option`,{value:`ai`,children:`Coro plan mode (recommended with coach mode)`}),(0,G.jsx)(`option`,{value:`form`,children:`Classic form`}),(0,G.jsx)(`option`,{value:`ask-each-time`,children:`Ask each time`})]}),(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Coro plan mode uses your configured LLM to help shape a run brief before dispatch.`})]}),(0,G.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-4 rounded-xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Allow read-only lookups`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:`Let plan mode read tracker tickets and repository files to shape better briefs. Never writes.`})]}),(0,G.jsx)(Ax,{checked:r?.toolsEnabled!==!1,onCheckedChange:e=>void s({intake:{...r,toolsEnabled:e}}),"aria-label":`Plan mode read-only tools`})]})]})]})}var QT={general:ZT,"llm-provider":jT,"source-control":FT,"issue-tracker":LT,plugins:VT,mcp:UT,paths:GT,guardrails:XT};function $T({onLaunchWizard:e}){let{loading:t,loadError:n,reload:r,draft:i,isDirty:a,dirtySections:o,discardChanges:s,save:c,saving:l,saveError:u,saveNotice:d,clearSaveFeedback:f,meta:p,pluginsCatalogue:m}=y_(),[h,g]=(0,x.useState)(()=>{if(typeof window>`u`)return`llm-provider`;let e=window.location.hash.replace(/^#/,``);return oT.some(t=>t.id===e)?e:`llm-provider`});(0,x.useEffect)(()=>{typeof window>`u`||window.location.hash!==`#${h}`&&window.history.replaceState(null,``,`#${h}`)},[h]);let _=(0,x.useMemo)(()=>oy({draft:i,pluginsCatalogue:m}),[i,m]),v={setup:oT.filter(e=>e.group===`setup`),extensions:oT.filter(e=>e.group===`extensions`),advanced:oT.filter(e=>e.group===`advanced`)};if(t)return(0,G.jsx)(tE,{});let y=QT[h],b=cT(h),S=_.byId[h];return(0,G.jsxs)(`div`,{className:`space-y-6 pb-32`,children:[(0,G.jsx)(cg,{title:`Settings`,description:`Manage authentication, integrations, and runner internals.`,actions:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e?(0,G.jsxs)(Y,{type:`button`,variant:`outline`,onClick:e,children:[(0,G.jsx)(Di,{}),`Run setup wizard`]}):null,(0,G.jsxs)(Y,{type:`button`,variant:`outline`,onClick:()=>void r(),children:[(0,G.jsx)(mi,{}),`Reload`]})]})}),n?(0,G.jsx)(gg,{message:n}):null,p?.configError?(0,G.jsx)(Ov,{tone:`warning`,title:`Config file failed validation`,children:`The current config file failed schema validation. Save changes once to rewrite it cleanly.`}):null,_.ready?null:(0,G.jsxs)(Ov,{tone:`warning`,title:`Setup is not complete`,children:[`Required sections still need attention before jobs can run:`,` `,_.missingRequired.map(e=>cT(e).label).join(`, `),`.`]}),(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,G.jsx)(`aside`,{className:`space-y-6 lg:sticky lg:top-6 lg:self-start`,children:[`setup`,`extensions`,`advanced`].map(e=>{let t=v[e];if(t.length===0)return null;let n=sT[e];return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`px-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.2em] text-fg-subtle`,children:n.title}),(0,G.jsx)(`div`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:n.hint})]}),(0,G.jsx)(`nav`,{className:`space-y-1`,"aria-label":`${n.title} sections`,children:t.map(e=>{let t=e.id===h,n=_.byId[e.id],r=e.icon,i=o.has(e.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>g(e.id),className:W(`group flex w-full items-center gap-3 rounded-xl border px-3 py-2.5 text-left text-sm transition-colors`,t?`border-accent-500/35 bg-accent-500/8 text-fg`:`border-line/60 bg-overlay/40 text-fg-muted hover:border-line hover:text-fg`),children:[(0,G.jsx)(r,{className:W(`size-4 shrink-0`,t?`text-accent-300`:`text-fg-subtle`)}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.label}),i?(0,G.jsx)(`span`,{className:`inline-block size-1.5 shrink-0 rounded-full bg-accent-400`,"aria-label":`Unsaved changes`}):null]})}),(0,G.jsx)(eE,{status:n.status})]},e.id)})})]},e)})}),(0,G.jsxs)(`main`,{className:`space-y-6`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-fg-subtle`,children:sT[b.group].title}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-fg`,children:b.label}),b.required?(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.18em] text-fg-subtle`,children:`Required`}):null,(0,G.jsx)(jv,{status:S.status,label:S.label})]}),(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-5 text-fg-muted`,children:b.description})]})}),u?(0,G.jsx)(Ov,{tone:`danger`,title:`Save failed`,children:u}):null,d?(0,G.jsx)(Ov,{tone:`success`,children:d}):null,(0,G.jsx)(`div`,{className:`space-y-6`,children:(0,G.jsx)(y,{})})]})]}),a?(0,G.jsx)(`div`,{className:`fixed inset-x-0 bottom-0 z-30 border-t border-line bg-canvas/95 backdrop-blur supports-[backdrop-filter]:bg-canvas/85`,children:(0,G.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-wrap items-center justify-between gap-3 px-6 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-sm text-fg-muted`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-2 rounded-full bg-accent-400`}),`You have unsaved changes`,(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`·`}),(0,G.jsxs)(`span`,{className:`text-fg`,children:[o.size,` section`,o.size===1?``:`s`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{s(),f()},disabled:l,children:[(0,G.jsx)(gi,{}),`Discard changes`]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:()=>void c(),disabled:l,children:l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)($r,{className:`animate-spin`}),`Saving…`]}):(0,G.jsxs)(G.Fragment,{children:[`Save all changes`,(0,G.jsx)(`span`,{className:`ml-1 rounded-full border border-current/30 px-1.5 text-[10px] font-medium`,children:o.size})]})})]})]})}):null]})}function eE({status:e}){return e===`ok`?(0,G.jsx)(fr,{className:`size-4 shrink-0 text-success-300`,"aria-label":`Ready`}):e===`warn`?(0,G.jsx)(Mi,{className:`size-4 shrink-0 text-warning-300`,"aria-label":`Needs attention`}):e===`error`?(0,G.jsx)(_r,{className:`size-4 shrink-0 text-danger-300`,"aria-label":`Failed`}):e===`pending`?(0,G.jsx)($r,{className:`size-4 shrink-0 animate-spin text-accent-300`,"aria-label":`Working`}):null}function tE(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(bg,{className:`h-9 w-40`}),(0,G.jsx)(bg,{className:`h-4 w-72`}),(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,G.jsx)(bg,{className:`h-96 w-full`}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(bg,{className:`h-12 w-full`}),(0,G.jsx)(bg,{className:`h-64 w-full`})]})]})]})}function nE(){let[e,t]=(0,x.useState)(!1);return(0,G.jsxs)(S_,{children:[(0,G.jsx)($T,{onLaunchWizard:()=>t(!0)}),(0,G.jsx)($v,{open:e,onOpenChange:t})]})}function rE(){let{jobId:e}=ot();return(0,G.jsx)(At,{to:`/jobs/${e??``}`,replace:!0})}function iE(){return(0,G.jsx)(Pt,{children:(0,G.jsxs)(Mt,{element:(0,G.jsx)(sg,{}),children:[(0,G.jsx)(Mt,{path:`/`,element:(0,G.jsx)(nb,{})}),(0,G.jsx)(Mt,{path:`/jobs`,element:(0,G.jsx)(hb,{})}),(0,G.jsx)(Mt,{path:`/campaigns`,element:(0,G.jsx)(At,{to:`/jobs?workflow=campaign`,replace:!0})}),(0,G.jsx)(Mt,{path:`/history`,element:(0,G.jsx)(sb,{})}),(0,G.jsx)(Mt,{path:`/jobs/new`,element:(0,G.jsx)(kw,{})}),(0,G.jsx)(Mt,{path:`/jobs/:jobId`,element:(0,G.jsx)(KC,{})}),(0,G.jsx)(Mt,{path:`/campaigns/:jobId`,element:(0,G.jsx)(rE,{})}),(0,G.jsx)(Mt,{path:`/intelligence`,element:(0,G.jsx)(Qw,{})}),(0,G.jsx)(Mt,{path:`/settings`,element:(0,G.jsx)(nE,{})})]})})}(0,Fi.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(x.StrictMode,{children:(0,G.jsx)(wn,{basename:`/dashboard`,children:(0,G.jsx)(Co,{children:(0,G.jsx)(iE,{})})})}));
138
+ }`;function RT(){let{draft:e,setDraft:t}=y_(),[n,r]=(0,x.useState)(null),[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(!1);(0,x.useEffect)(()=>{try{let t=JSON.parse(e.mcpServersText);r(typeof t!=`object`||!t||Array.isArray(t)?`mcpServers must be a JSON object keyed by server id.`:null)}catch(e){r(`Invalid JSON: ${e.message}`)}},[e.mcpServersText]);async function c(){try{s(!0),a(await q(`/config/claude-code-mcps`))}catch{a(null)}finally{s(!1)}}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(iT,{title:`Bring-your-own MCP servers`,description:"Attach any MCP server (Slack, Sentry, Datadog, internal tooling…) to every job session. The runner spawns each entry alongside the in-process `coro` server; agents see them as `mcp__<id>__*`.",footer:(0,G.jsxs)(`span`,{children:[`Reserved id `,(0,G.jsx)(`code`,{children:`coro`}),` is rejected. Use `,(0,G.jsx)(`code`,{children:`"enabled": false`}),` to keep an entry without attaching it.`,(0,G.jsx)(`code`,{children:` allowedTools`}),` / `,(0,G.jsx)(`code`,{children:`disallowedTools`}),` become per-server tool policy. Changes save with the rest of the page.`]}),children:[(0,G.jsx)(bb,{value:e.mcpServersText,onChange:e=>t(`mcpServersText`,e.target.value),spellCheck:!1,rows:14,className:`font-mono text-[12px]`}),n?(0,G.jsx)(Ov,{tone:`danger`,children:n}):null]}),(0,G.jsxs)(iT,{title:`Inherit from Claude Code`,description:`When enabled, the runner reads MCP servers from your user-level Claude Code config (~/.claude.json and ~/.claude/settings.json) and attaches them to every job session. Explicit BYO entries above override inherited entries with the same id.`,action:(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void c(),disabled:o,children:[(0,G.jsx)(mi,{}),o?`Refreshing…`:`Refresh`]}),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Inherit Claude Code MCP servers`}),(0,G.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`Off by default — Claude Code configs commonly carry developer-personal entries (Notion, GitHub Personal…) that an operator may not want every job to see.`})]}),(0,G.jsx)(jx,{checked:e.inheritClaudeCodeMcps,onCheckedChange:e=>t(`inheritClaudeCodeMcps`,e),ariaLabel:`Inherit Claude Code MCP servers`})]}),i?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[i.sources.length>0?(0,G.jsxs)(`div`,{className:`text-[12px] text-fg-muted`,children:[`Read from`,` `,i.sources.map((e,t)=>(0,G.jsxs)(`span`,{className:`font-mono`,children:[t>0?`, `:``,e]},e))]}):(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:[`No Claude Code MCP servers found. Add one with `,(0,G.jsx)(`code`,{children:`claude mcp add <name> --scope user`}),` or paste an entry into `,(0,G.jsx)(`code`,{children:`~/.claude.json`}),` under `,(0,G.jsx)(`code`,{children:`mcpServers`}),`.`]}),Object.keys(i.servers).length>0?(0,G.jsx)(`pre`,{className:`overflow-auto rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-[12px] text-fg-muted`,children:JSON.stringify(i.servers,null,2)}):null]}):(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:o?`Loading discovered servers…`:`Click Refresh to preview the MCP servers Claude Code currently exposes.`})]}),(0,G.jsx)(iT,{title:`Examples`,description:"Drop these into the editor above. Replace placeholder secrets with real ones — values containing `...` are treated as redacted echoes and ignored on save.",children:(0,G.jsx)(`pre`,{className:`overflow-auto rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-[12px] text-fg-muted`,children:LT})})]})}function zT({targetPath:e,label:t}){let[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(null),o=typeof navigator<`u`&&/Win/i.test(navigator.platform)?`explorer`:typeof navigator<`u`&&/Mac/i.test(navigator.platform)?`finder`:`files`,s=o===`finder`?`Show in Finder`:o===`explorer`?`Show in Explorer`:`Open folder`;async function c(){if(e){a(null),r(!0);try{let t=await q(`/system/reveal`,J({path:e,create:!0},{method:`POST`}));t.ok||a(t.error??`Could not open folder`)}catch(e){a((e instanceof K,e.message))}finally{r(!1)}}}return(0,G.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void c(),disabled:!e||n,title:e??`${t} not configured`,children:[n?(0,G.jsx)($r,{className:`animate-spin`}):(0,G.jsx)(Rr,{}),s]}),i?(0,G.jsx)(`span`,{className:`text-[11px] text-danger-300`,children:i}):null]})}function BT(){let{draft:e,setDraft:t,meta:n}=y_(),r=e.intelligenceDir.trim()||n?.resolved.intelligenceDir,i=e.workingDir.trim()||n?.resolved.workingDir;return(0,G.jsxs)(iT,{title:`Paths`,description:`Filesystem locations the runner uses for intelligence materialisation and working repositories. Defaults are usually fine.`,children:[(0,G.jsxs)(Sv,{label:`Intelligence directory`,hint:`Leave blank to use the resolved default.`,children:[(0,G.jsx)(O_,{value:e.intelligenceDir,onChange:e=>t(`intelligenceDir`,e.target.value),placeholder:n?.resolved.intelligenceDir??``}),(0,G.jsx)(zT,{targetPath:r,label:`Intelligence directory`})]}),(0,G.jsx)(Sv,{label:`Intelligence git remote`,hint:`URL of your tenant intelligence Git repository. The runner clones it on first proposal and uses it when merging overlays.`,children:(0,G.jsx)(O_,{value:e.intelligenceRemote,onChange:e=>t(`intelligenceRemote`,e.target.value),placeholder:`https://github.com/org/coro-intelligence.git`})}),(0,G.jsxs)(Sv,{label:`Working directory`,hint:`Where repositories are cloned during job execution.`,children:[(0,G.jsx)(O_,{value:e.workingDir,onChange:e=>t(`workingDir`,e.target.value),placeholder:n?.resolved.workingDir??``}),(0,G.jsx)(zT,{targetPath:i,label:`Working directory`})]}),n?(0,G.jsxs)(`div`,{className:`grid gap-2 rounded-2xl border border-line bg-overlay/40 p-4 text-xs sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.18em] text-fg-subtle`,children:`Config path`}),(0,G.jsx)(`div`,{className:`mt-1 break-all font-mono text-fg-muted`,children:n.configPath}),(0,G.jsx)(zT,{targetPath:n.configPath,label:`Config file`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.18em] text-fg-subtle`,children:`Mode`}),(0,G.jsx)(`div`,{className:`mt-1 font-mono text-fg-muted`,children:n.mode})]})]}):null]})}function VT(e){let t=[`on ${e.on}`];return e.during?.length&&t.push(`during ${e.during.join(`, `)}`),t.join(` · `)}function HT({rule:e,onConfigChange:t}){let n=e.config??{},r=typeof n.minLength==`number`?n.minLength:80,i=Array.isArray(n.requiredHeadings)?n.requiredHeadings.join(`, `):`## What`;return(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsx)(Sv,{label:`Minimum description length`,children:(0,G.jsx)(O_,{type:`number`,min:1,value:r,onChange:e=>{let r=Number(e.target.value);t({...n,minLength:Number.isFinite(r)?r:80})}})}),(0,G.jsx)(Sv,{label:`Required headings (comma-separated)`,children:(0,G.jsx)(O_,{value:i,onChange:e=>{t({...n,requiredHeadings:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})}})})]})}function UT({rule:e,onConfigChange:t}){let n=e.config??{};return(0,G.jsx)(Sv,{label:`Minimum human approvals`,children:(0,G.jsx)(O_,{type:`number`,min:0,value:typeof n.minApprovals==`number`?n.minApprovals:1,onChange:e=>{let r=Number(e.target.value);t({...n,minApprovals:Number.isFinite(r)?r:1})}})})}function WT({rule:e,onConfigChange:t}){let n=e.config??{},r=typeof n.maxLines==`number`?n.maxLines:500,i=typeof n.maxFiles==`number`?n.maxFiles:40;return(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsx)(Sv,{label:`Max diff lines`,children:(0,G.jsx)(O_,{type:`number`,min:1,value:r,onChange:e=>{let r=Number(e.target.value);t({...n,maxLines:Number.isFinite(r)?r:500})}})}),(0,G.jsx)(Sv,{label:`Max changed files`,children:(0,G.jsx)(O_,{type:`number`,min:1,value:i,onChange:e=>{let r=Number(e.target.value);t({...n,maxFiles:Number.isFinite(r)?r:40})}})})]})}function GT(){let{draft:e,setDraft:t,setGuardrailRuleEnabled:n,setGuardrailRuleConfig:r,meta:i}=y_(),[a,o]=(0,x.useState)(!1),[s,c]=(0,x.useState)(null),l=(0,x.useMemo)(()=>e.guardrailRules.filter(e=>e.check===`script`),[e.guardrailRules]),u=(0,x.useMemo)(()=>e.guardrailRules.filter(e=>e.check!==`script`),[e.guardrailRules]),d=i?.resolved?.guardrails?.scriptsDir??`~/.coro/guardrails`;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(iT,{title:`Enable guardrails`,description:`When off, the runner skips all guardrail checks. Shipped defaults stay in the Coro package; this toggle controls whether they run.`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`span`,{className:`text-sm text-fg-muted`,children:`Enforce guardrails on jobs`}),(0,G.jsx)(jx,{checked:e.guardrailsEnabled,onCheckedChange:e=>t(`guardrailsEnabled`,e)})]})}),u.map(t=>(0,G.jsx)(iT,{title:t.title??t.id,description:t.description,status:t.source===`override`?`warn`:void 0,statusLabel:t.source===`override`?`modified`:t.source===`bundled`?`default`:void 0,action:(0,G.jsx)(jx,{checked:t.enabled,disabled:!e.guardrailsEnabled,onCheckedChange:e=>n(t.id,e)}),footer:(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:VT(t)}),children:t.enabled&&e.guardrailsEnabled?t.check===`pr-description`?(0,G.jsx)(HT,{rule:t,onConfigChange:e=>r(t.id,e)}):t.check===`pr-diff-size`?(0,G.jsx)(WT,{rule:t,onConfigChange:e=>r(t.id,e)}):t.check===`merge-requires-approval`?(0,G.jsx)(UT,{rule:t,onConfigChange:e=>r(t.id,e)}):(0,G.jsxs)(Ov,{tone:`neutral`,children:[`No dashboard fields for check `,(0,G.jsx)(`code`,{children:t.check}),`. Edit advanced JSON below.`]}):(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Rule disabled.`})},t.id)),l.length>0?(0,G.jsx)(iT,{title:`Custom script rules`,description:`Rules that run JavaScript from your guardrails folder. Edit the script file on disk; the runner loads it on the next tool call.`,children:(0,G.jsx)(`ul`,{className:`space-y-3`,children:l.map(t=>(0,G.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-line bg-overlay/30 px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-medium text-sm`,children:t.title??t.id}),(0,G.jsxs)(`p`,{className:`text-xs text-fg-muted font-mono`,children:[d,`/`,t.script,`.mjs`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:W(`rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide`,t.scriptFileExists?`bg-success/15 text-success`:`bg-danger/15 text-danger`),children:t.scriptFileExists?`script found`:`script missing`}),(0,G.jsx)(jx,{checked:t.enabled,disabled:!e.guardrailsEnabled,onCheckedChange:e=>n(t.id,e)})]})]},t.id))})}):null,(0,G.jsx)(iT,{title:`Advanced`,description:`Override guardrails as raw JSON (same shape as ~/.coro/config.json guardrails.rules).`,action:(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-sm text-fg-muted hover:text-fg`,onClick:()=>o(e=>!e),children:[a?(0,G.jsx)(lr,{className:`h-4 w-4`}):(0,G.jsx)(ur,{className:`h-4 w-4`}),a?`Hide`:`Show`]}),children:a?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`textarea`,{value:e.guardrailsRulesText,onChange:e=>{t(`guardrailsRulesText`,e.target.value);try{JSON.parse(e.target.value),c(null)}catch(e){c(`Invalid JSON: ${e.message}`)}},spellCheck:!1,rows:10,className:`w-full rounded-md border border-line bg-bg font-mono text-[12px] p-3`}),s?(0,G.jsx)(Ov,{tone:`danger`,children:s}):null]}):null})]})}function KT(){let{preferences:e,reload:t}=y_(),n=e?.coachMode,r=e?.intake,i=n?.enabled??!0,a=n?.graduateAfterRuns??5,o=r?.mode??(i?`ai`:`form`);async function s(e){await q(`/config`,J(e,{method:`PUT`})),await t()}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(iT,{title:`Coach mode`,description:`Safer defaults for new users — interactive checkpoints on by default until you graduate.`,children:(0,G.jsxs)(`label`,{className:`flex items-center justify-between gap-4 rounded-xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Enable coach mode`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:`New runs default to Interactive mode and show extra guidance on the New Run page.`})]}),(0,G.jsx)(jx,{checked:i,onCheckedChange:e=>void s({coachMode:{enabled:e,graduateAfterRuns:a}}),"aria-label":`Coach mode`})]})}),(0,G.jsxs)(iT,{title:`Coro plan mode`,description:`Choose how the New Run page starts — plan mode conversation or the classic form.`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{className:`text-[11px] font-medium uppercase tracking-[0.16em] text-fg-subtle`,children:`Default new-run mode`}),(0,G.jsxs)(OS,{value:o,onChange:e=>void s({intake:{...r,mode:e.target.value}}),children:[(0,G.jsx)(`option`,{value:`ai`,children:`Coro plan mode (recommended with coach mode)`}),(0,G.jsx)(`option`,{value:`form`,children:`Classic form`}),(0,G.jsx)(`option`,{value:`ask-each-time`,children:`Ask each time`})]}),(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Coro plan mode uses your configured LLM to help shape a run brief before dispatch.`})]}),(0,G.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-4 rounded-xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Allow read-only lookups`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:`Let plan mode read tracker tickets and repository files to shape better briefs. Never writes.`})]}),(0,G.jsx)(jx,{checked:r?.toolsEnabled!==!1,onCheckedChange:e=>void s({intake:{...r,toolsEnabled:e}}),"aria-label":`Plan mode read-only tools`})]})]})]})}var qT={general:KT,"llm-provider":ET,"source-control":AT,"issue-tracker":MT,plugins:IT,mcp:RT,paths:BT,guardrails:GT};function JT({onLaunchWizard:e}){let{loading:t,loadError:n,reload:r,draft:i,isDirty:a,dirtySections:o,discardChanges:s,save:c,saving:l,saveError:u,saveNotice:d,clearSaveFeedback:f,meta:p,pluginsCatalogue:m}=y_(),[h,g]=(0,x.useState)(()=>{if(typeof window>`u`)return`llm-provider`;let e=window.location.hash.replace(/^#/,``);return tT.some(t=>t.id===e)?e:`llm-provider`});(0,x.useEffect)(()=>{typeof window>`u`||window.location.hash!==`#${h}`&&window.history.replaceState(null,``,`#${h}`)},[h]);let _=(0,x.useMemo)(()=>oy({draft:i,pluginsCatalogue:m}),[i,m]),v={setup:tT.filter(e=>e.group===`setup`),extensions:tT.filter(e=>e.group===`extensions`),advanced:tT.filter(e=>e.group===`advanced`)};if(t)return(0,G.jsx)(XT,{});let y=qT[h],b=rT(h),S=_.byId[h];return(0,G.jsxs)(`div`,{className:`space-y-6 pb-32`,children:[(0,G.jsx)(cg,{title:`Settings`,description:`Manage authentication, integrations, and runner internals.`,actions:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e?(0,G.jsxs)(Y,{type:`button`,variant:`outline`,onClick:e,children:[(0,G.jsx)(Di,{}),`Run setup wizard`]}):null,(0,G.jsxs)(Y,{type:`button`,variant:`outline`,onClick:()=>void r(),children:[(0,G.jsx)(mi,{}),`Reload`]})]})}),n?(0,G.jsx)(gg,{message:n}):null,p?.configError?(0,G.jsx)(Ov,{tone:`warning`,title:`Config file failed validation`,children:`The current config file failed schema validation. Save changes once to rewrite it cleanly.`}):null,_.ready?null:(0,G.jsxs)(Ov,{tone:`warning`,title:`Setup is not complete`,children:[`Required sections still need attention before jobs can run:`,` `,_.missingRequired.map(e=>rT(e).label).join(`, `),`.`]}),(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,G.jsx)(`aside`,{className:`space-y-6 lg:sticky lg:top-6 lg:self-start`,children:[`setup`,`extensions`,`advanced`].map(e=>{let t=v[e];if(t.length===0)return null;let n=nT[e];return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`px-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.2em] text-fg-subtle`,children:n.title}),(0,G.jsx)(`div`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:n.hint})]}),(0,G.jsx)(`nav`,{className:`space-y-1`,"aria-label":`${n.title} sections`,children:t.map(e=>{let t=e.id===h,n=_.byId[e.id],r=e.icon,i=o.has(e.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>g(e.id),className:W(`group flex w-full items-center gap-3 rounded-xl border px-3 py-2.5 text-left text-sm transition-colors`,t?`border-accent-500/35 bg-accent-500/8 text-fg`:`border-line/60 bg-overlay/40 text-fg-muted hover:border-line hover:text-fg`),children:[(0,G.jsx)(r,{className:W(`size-4 shrink-0`,t?`text-accent-300`:`text-fg-subtle`)}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.label}),i?(0,G.jsx)(`span`,{className:`inline-block size-1.5 shrink-0 rounded-full bg-accent-400`,"aria-label":`Unsaved changes`}):null]})}),(0,G.jsx)(YT,{status:n.status})]},e.id)})})]},e)})}),(0,G.jsxs)(`main`,{className:`space-y-6`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-fg-subtle`,children:nT[b.group].title}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-fg`,children:b.label}),b.required?(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.18em] text-fg-subtle`,children:`Required`}):null,(0,G.jsx)(jv,{status:S.status,label:S.label})]}),(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-5 text-fg-muted`,children:b.description})]})}),u?(0,G.jsx)(Ov,{tone:`danger`,title:`Save failed`,children:u}):null,d?(0,G.jsx)(Ov,{tone:`success`,children:d}):null,(0,G.jsx)(`div`,{className:`space-y-6`,children:(0,G.jsx)(y,{})})]})]}),a?(0,G.jsx)(`div`,{className:`fixed inset-x-0 bottom-0 z-30 border-t border-line bg-canvas/95 backdrop-blur supports-[backdrop-filter]:bg-canvas/85`,children:(0,G.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-wrap items-center justify-between gap-3 px-6 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-sm text-fg-muted`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-2 rounded-full bg-accent-400`}),`You have unsaved changes`,(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`·`}),(0,G.jsxs)(`span`,{className:`text-fg`,children:[o.size,` section`,o.size===1?``:`s`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{s(),f()},disabled:l,children:[(0,G.jsx)(gi,{}),`Discard changes`]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:()=>void c(),disabled:l,children:l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)($r,{className:`animate-spin`}),`Saving…`]}):(0,G.jsxs)(G.Fragment,{children:[`Save all changes`,(0,G.jsx)(`span`,{className:`ml-1 rounded-full border border-current/30 px-1.5 text-[10px] font-medium`,children:o.size})]})})]})]})}):null]})}function YT({status:e}){return e===`ok`?(0,G.jsx)(fr,{className:`size-4 shrink-0 text-success-300`,"aria-label":`Ready`}):e===`warn`?(0,G.jsx)(Mi,{className:`size-4 shrink-0 text-warning-300`,"aria-label":`Needs attention`}):e===`error`?(0,G.jsx)(_r,{className:`size-4 shrink-0 text-danger-300`,"aria-label":`Failed`}):e===`pending`?(0,G.jsx)($r,{className:`size-4 shrink-0 animate-spin text-accent-300`,"aria-label":`Working`}):null}function XT(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(bg,{className:`h-9 w-40`}),(0,G.jsx)(bg,{className:`h-4 w-72`}),(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,G.jsx)(bg,{className:`h-96 w-full`}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(bg,{className:`h-12 w-full`}),(0,G.jsx)(bg,{className:`h-64 w-full`})]})]})]})}function ZT(){let[e,t]=(0,x.useState)(!1);return(0,G.jsxs)(S_,{children:[(0,G.jsx)(JT,{onLaunchWizard:()=>t(!0)}),(0,G.jsx)($v,{open:e,onOpenChange:t})]})}function QT(){let{jobId:e}=ot();return(0,G.jsx)(At,{to:`/jobs/${e??``}`,replace:!0})}function $T(){return(0,G.jsx)(Pt,{children:(0,G.jsxs)(Mt,{element:(0,G.jsx)(sg,{}),children:[(0,G.jsx)(Mt,{path:`/`,element:(0,G.jsx)(nb,{})}),(0,G.jsx)(Mt,{path:`/jobs`,element:(0,G.jsx)(hb,{})}),(0,G.jsx)(Mt,{path:`/campaigns`,element:(0,G.jsx)(At,{to:`/jobs?workflow=campaign`,replace:!0})}),(0,G.jsx)(Mt,{path:`/history`,element:(0,G.jsx)(sb,{})}),(0,G.jsx)(Mt,{path:`/jobs/new`,element:(0,G.jsx)(ww,{})}),(0,G.jsx)(Mt,{path:`/jobs/:jobId`,element:(0,G.jsx)(VC,{})}),(0,G.jsx)(Mt,{path:`/campaigns/:jobId`,element:(0,G.jsx)(QT,{})}),(0,G.jsx)(Mt,{path:`/intelligence`,element:(0,G.jsx)(qw,{})}),(0,G.jsx)(Mt,{path:`/settings`,element:(0,G.jsx)(ZT,{})})]})})}(0,Fi.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(x.StrictMode,{children:(0,G.jsx)(wn,{basename:`/dashboard`,children:(0,G.jsx)(Co,{children:(0,G.jsx)($T,{})})})}));