vibora 7.3.0 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/vibora.js
CHANGED
|
@@ -32629,7 +32629,7 @@ function installUv() {
|
|
|
32629
32629
|
var package_default = {
|
|
32630
32630
|
name: "vibora",
|
|
32631
32631
|
private: true,
|
|
32632
|
-
version: "7.
|
|
32632
|
+
version: "7.4.0",
|
|
32633
32633
|
description: "Harness Attention. Orchestrate Agents. Ship.",
|
|
32634
32634
|
license: "PolyForm-Shield-1.0.0",
|
|
32635
32635
|
type: "module",
|
|
@@ -172,10 +172,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
172
172
|
`)&&(f.children[0]={type:"text",value:m.replace(g,"").replace(/^\n+/,"")}),!m.includes(`
|
|
173
173
|
`))){const _=[];f.children.forEach((b,y)=>{y!=0&&(y==1&&b.type==="break"||_.push(b))}),f.children=[..._]}}return f});s&&(r.data={hName:t,hProperties:{class:`markdown-alert markdown-alert-${s}`,dir:"auto"}},u.unshift({type:"paragraph",children:[sst(s),{type:"text",value:o.replace(/^\//,"")}],data:{hProperties:{class:"markdown-alert-title",dir:"auto"}}})),r.children=[...u]})};function sst(e){let t=ost[e]??"";return{type:"emphasis",data:{hName:"svg",hProperties:{class:"octicon",viewBox:"0 0 16 16",width:"16",height:"16",ariaHidden:"true"}},children:[{type:"emphasis",data:{hName:"path",hProperties:{d:t}},children:[]}]}}const ost={note:"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z",tip:"M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z",important:"M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",warning:"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",caution:"M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"};function lst(e,t){if(typeof document>"u")return;const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style={position:"absolute",left:"-9999px"},document.body.appendChild(n);const r=document.getSelection().rangeCount>0?document.getSelection().getRangeAt(0):!1;n.select();let i=!1;try{i=!!document.execCommand("copy")}catch{i=!1}document.body.removeChild(n),r&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(r)),t&&t(i)}function Sfe(e){if(!e)return null;var t=e;return t.dataset.code&&t.classList.contains("copied")?t:t.parentElement?Sfe(t.parentElement):null}function ust(e){var t=n=>{var r=Sfe(n.target);r&&(r.classList.add("active"),lst(r.dataset.code,function(){setTimeout(()=>{r.classList.remove("active")},2e3)}))};A.useEffect(()=>{var n,r;return(n=e.current)==null||n.removeEventListener("click",t,!1),(r=e.current)==null||r.addEventListener("click",t,!1),()=>{var i;(i=e.current)==null||i.removeEventListener("click",t,!1)}},[e])}var cst=["prefixCls","className","source","style","disableCopy","skipHtml","onScroll","onMouseOver","pluginsFilter","rehypeRewrite","wrapperElement","warpperElement","urlTransform"],dst=e=>e;const fst=le.forwardRef((e,t)=>{var{prefixCls:n="wmde-markdown wmde-markdown-color",className:r,source:i,style:a,disableCopy:s=!1,skipHtml:o=!0,onScroll:l,onMouseOver:u,pluginsFilter:f,wrapperElement:d={},warpperElement:m={},urlTransform:g}=e,x=sUe(e,cst),_=le.useRef(null);A.useImperativeHandle(t,()=>Ou({},e,{mdp:_}),[_,e]);var b=(n||"")+" "+(r||"");ust(_);var y=[...x.rehypePlugins||[]],v={allowElement:(w,C,R)=>x.allowElement?x.allowElement(w,C,R):/^[A-Za-z0-9]+$/.test(w.tagName)};o||y.push(Ide);var S=[ast,...x.remarkPlugins||[],nst],T=Ou({},m,d);return p.jsx("div",Ou({ref:_,onScroll:l,onMouseOver:u},T,{className:b,style:a,children:p.jsx(qrt,Ou({},v,x,{skipHtml:!o,urlTransform:g||dst,rehypePlugins:f?f("rehype",y):y,remarkPlugins:f?f("remark",S):S,children:i||""}))}))});var pst=function(t){return n=>{ka(n,r=>{r.type==="element"&&r.tagName==="code"&&r.data&&r.data.meta&&(r.properties=Ou({},r.properties,{"data-meta":String(r.data.meta)}))})}},hst=function(t){return n=>{ka(n,r=>{if(r.type==="element"&&r.tagName==="code"&&r.properties&&r.properties.dataMeta){r.data||(r.data={});var i=r.properties.dataMeta;typeof i=="string"&&(r.data.meta=i),delete r.properties.dataMeta}})}};const mst=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g,gst=Object.hasOwnProperty;class bst{constructor(){this.occurrences,this.reset()}slug(t,n){const r=this;let i=vst(t,n===!0);const a=i;for(;gst.call(r.occurrences,i);)r.occurrences[a]++,i=a+"-"+r.occurrences[a];return r.occurrences[i]=0,i}reset(){this.occurrences=Object.create(null)}}function vst(e,t){return typeof e!="string"?"":(t||(e=e.toLowerCase()),e.replace(mst,"").replace(/ /g,"-"))}function wfe(e){const t=e.type==="element"?e.tagName.toLowerCase():"",n=t.length===2&&t.charCodeAt(0)===104?t.charCodeAt(1):0;return n>48&&n<55?n-48:void 0}const yst={},NJ=new bst;function xst(e){const n=(e||yst).prefix||"";return function(r){NJ.reset(),ka(r,"element",function(i){wfe(i)&&!i.properties.id&&(i.properties.id=n+NJ.slug(Bh(i)))})}}const Cfe=(function(e){if(e==null)return Sst;if(typeof e=="string")return Est(e);if(typeof e=="object")return _st(e);if(typeof e=="function")return _B(e);throw new Error("Expected function, string, or array as `test`")});function _st(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Cfe(e[n]);return _B(r);function r(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function Est(e){return _B(t);function t(n){return n.tagName===e}}function _B(e){return t;function t(n,r,i){return!!(wst(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Sst(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function wst(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const IJ={type:"element",tagName:"span",properties:{className:["icon","icon-link"]},children:[]},Cst={};function Tst(e){const t=e||Cst;let n=t.properties;const r=t.headingProperties,i=t.behavior||"prepend",a=t.content,s=t.group,o=Cfe(t.test);let l;return i==="after"||i==="before"?l=f:i==="wrap"?l=d:(l=u,n||(n={ariaHidden:"true",tabIndex:-1})),function(m){ka(m,"element",function(g,x,_){if(wfe(g)&&g.properties.id&&o(g,x,_))return Object.assign(g.properties,N_(r,g)),l(g,x,_)})};function u(m){const g=DJ(a||IJ,m);return m.children[i==="prepend"?"unshift":"push"](YI(m,N_(n,m),g)),[Pv]}function f(m,g,x){if(typeof g!="number"||!x)return;const _=DJ(a||IJ,m),b=YI(m,N_(n,m),_);let y=i==="before"?[b,m]:[m,b];if(s){const v=Tfe(s,m);v&&!Array.isArray(v)&&v.type==="element"&&(v.children=y,y=[v])}return x.children.splice(g,1,...y),[Pv,g+y.length]}function d(m){let g=m.children,x=[];return typeof a=="function"?(g=[],x=a(m)):a&&(x=EB(a)),m.children=[YI(m,N_(n,m),Array.isArray(x)?[...g,...x]:[...g,x])],[Pv]}}function EB(e){return dp(e)}function YI(e,t,n){return{type:"element",tagName:"a",properties:{...t,href:"#"+e.properties.id},children:n}}function DJ(e,t){const n=Tfe(e,t);return Array.isArray(n)?n:[n]}function Tfe(e,t){return typeof e=="function"?e(t):EB(e)}function N_(e,t){return typeof e=="function"?e(t):e?EB(e):{}}const Ast=(e={})=>{const{openDelimiter:t="rehype:ignore:start",closeDelimiter:n="rehype:ignore:end"}=e;return r=>{ka(r,(i,a,s)=>{if(i.type==="element"||i.type==="root"){let o=!1;i.children=i.children.filter(l=>{if(l.type==="raw"||l.type==="comment"){let u=(l.value||"").trim();if(u=u.replace(/^<!--(.*?)-->/,"$1"),u===t)return o=!0,!1;if(u===n)return o=!1,!1}return!o})}})}};var kst={type:"element",tagName:"svg",properties:{className:"octicon octicon-link",viewBox:"0 0 16 16",version:"1.1",width:"16",height:"16",ariaHidden:"true"},children:[{type:"element",tagName:"path",children:[],properties:{fillRule:"evenodd",d:"M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"}}]};function Ost(e){return e===void 0&&(e=""),{type:"element",tagName:"div",properties:{class:"copied","data-code":e},children:[{type:"element",tagName:"svg",properties:{className:"octicon-copy",ariaHidden:"true",viewBox:"0 0 16 16",fill:"currentColor",height:12,width:12},children:[{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"},children:[]},{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"},children:[]}]},{type:"element",tagName:"svg",properties:{className:"octicon-check",ariaHidden:"true",viewBox:"0 0 16 16",fill:"currentColor",height:12,width:12},children:[{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"},children:[]}]}]}}var Rst=(e,t)=>(n,r,i)=>{if(n.type==="element"&&i&&i.type==="root"&&/h(1|2|3|4|5|6)/.test(n.tagName)){var a=n.children&&n.children[0];a&&a.properties&&a.properties.ariaHidden==="true"&&(a.properties=Ou({class:"anchor"},a.properties),a.children=[kst])}if(n.type==="element"&&n.tagName==="pre"&&!e){var s=Vce(n.children);n.children.push(Ost(s))}t&&t(n,r===null?void 0:r,i===null?void 0:i)},Nst=[xst,Tst,Ast];const Ist=le.forwardRef((e,t)=>{var n,r=[pst,Ide,hst,...Nst,[$Xe,{rewrite:Rst((n=e.disableCopy)!=null?n:!1,e.rehypeRewrite)}],[WXe,{properties:"attr"}],...e.rehypePlugins||[],[bYe,{ignoreMissing:!0}]];return p.jsx(fst,Ou({},e,{rehypePlugins:r,ref:t}))});function Dst(e,t){if(e.startsWith("/")||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"))return e;const n=t.includes("/")?t.substring(0,t.lastIndexOf("/")):"",r=n?n.split("/"):[],i=e.split("/");for(const a of i)a===".."?r.pop():a!=="."&&r.push(a);return r.join("/")}function Lst(e,t,n){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("/api/"))return e;const r=Dst(e,n);return`/api/fs/image?${new URLSearchParams({path:r,root:t})}`}function Pst({content:e,worktreePath:t,filePath:n}){const{resolvedTheme:r}=Ed(),i=A.useMemo(()=>({img:({src:a,alt:s,...o})=>{if(!a)return null;const l=Lst(a,t,n);return p.jsx("img",{src:l,alt:s||"",loading:"lazy",style:{maxWidth:"100%"},...o})},a:({href:a,children:s,...o})=>p.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",...o,children:s})}),[t,n]);return p.jsx(pg,{className:"h-full",children:p.jsx("div",{className:"p-4","data-color-mode":r==="light"?"light":"dark",children:p.jsx(Ist,{source:e,style:{backgroundColor:"transparent",fontSize:"14px"},components:i})})})}const Mst=1e3,jst=F0(function({onBack:t}){const{worktreePath:n,readOnly:r,selectedFile:i,currentFile:a,isLoading:s,isSaving:o,loadError:l,isDirty:u,updateContent:f,saveFile:d,closeFile:m,toggleMarkdownView:g}=fae(),x=A.useRef(null);A.useEffect(()=>()=>{x.current&&clearTimeout(x.current)},[]);const _=A.useCallback(w=>{!i||r||(f(i,w),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{d(i).catch(C=>{console.error("Auto-save failed:",C)})},Mst))},[i,r,f,d]),b=A.useCallback(()=>{i&&(x.current&&(clearTimeout(x.current),x.current=null),m(i)),t?.()},[i,m,t]),y=A.useCallback(()=>{i&&g(i)},[i,g]);if(!i)return p.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Select a file to view"});if(s)return p.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Loading file..."});if(l)return p.jsx("div",{className:"flex h-full items-center justify-center text-destructive text-sm",children:l});if(!a)return p.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Unable to load file"});if(a.isBinary)return p.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-muted-foreground text-sm gap-2",children:[p.jsx("p",{children:"Binary file"}),p.jsxs("p",{className:"text-xs",children:[(a.size/1024).toFixed(1)," KB"]})]});if(a.isImage)return p.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[p.jsxs("div",{className:"flex shrink-0 items-center justify-between px-2 py-1.5 bg-card border-b border-border text-xs",children:[p.jsx("span",{className:"text-muted-foreground truncate",title:i,children:i.split("/").pop()||i}),p.jsx("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:"Close file",children:p.jsx(ae,{icon:Zr,size:14,strokeWidth:2})})]}),p.jsx("div",{className:"flex-1 overflow-auto p-4 bg-muted",children:p.jsx("img",{src:a.content,alt:i,className:"block mx-auto"})})]});const v=i.split("/").pop()||i,S=a.isMarkdown,T=S&&a.isMarkdownView;return p.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[p.jsxs("div",{className:"flex shrink-0 items-center gap-3 px-2 py-1.5 bg-card border-b border-border text-xs",children:[p.jsxs("span",{className:"text-muted-foreground truncate flex-1 flex items-center gap-1",title:i,children:[v,!r&&u&&p.jsx("span",{className:"text-amber-500",children:"*"}),!r&&o&&p.jsx("span",{className:"text-muted-foreground italic",children:"(saving...)"})]}),a.truncated&&p.jsxs("span",{className:"text-destructive",children:["Truncated (",a.lineCount.toLocaleString()," lines)"]}),p.jsxs("span",{className:"text-muted-foreground",children:[(a.size/1024).toFixed(1)," KB"]}),S&&p.jsx("button",{onClick:y,className:Be("p-1 rounded hover:bg-muted/50 transition-colors",T?"text-primary":"text-muted-foreground hover:text-foreground"),title:T?"Show code":"Preview markdown",children:p.jsx(ae,{icon:T?i_e:a_e,size:14,strokeWidth:2})}),p.jsx("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:"Close file",children:p.jsx(ae,{icon:Zr,size:14,strokeWidth:2})})]}),p.jsx("div",{className:"flex-1 min-h-0",children:T?p.jsx(Pst,{content:a.content,worktreePath:n||"",filePath:i}):p.jsx(lce,{filePath:i,content:a.content,onChange:_,readOnly:r||!a.isEditable})})]})}),Afe=A.createContext(void 0),Fst=F0(function(){const t=A.useContext(Afe),{selectedFile:n,expandedDirs:r,fileTree:i,isLoadingTree:a,treeError:s,selectFile:o,loadFile:l,toggleDir:u,collapseAll:f}=fae(),d=A.useCallback(x=>{o(x),l(x),t?.(x)},[o,l,t]),m=A.useCallback(x=>{u(x)},[u]),g=A.useCallback(()=>{o(null),t?.(null)},[o,t]);return a?p.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Loading files..."}):s?p.jsx("div",{className:"flex h-full items-center justify-center text-destructive text-sm",children:s}):n?p.jsx("div",{className:"flex h-full flex-col bg-background",children:p.jsx(jst,{onBack:g})}):p.jsx(cGe,{entries:i||[],selectedFile:n,expandedDirs:r,onSelectFile:d,onToggleDir:m,onCollapseAll:f})});function ZS({worktreePath:e,readOnly:t=!1,initialSelectedFile:n,onFileChange:r}){const i=NNe(e,t,n);return e?p.jsx(dae.Provider,{value:i,children:p.jsx(Afe.Provider,{value:r,children:p.jsx(Fst,{})})}):p.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"No worktree selected"})}const YP=Aa("/tasks/$taskId")({component:Bst,validateSearch:e=>({tab:["diff","browser","files"].includes(e.tab)?e.tab:void 0,file:typeof e.file=="string"?e.file:void 0})}),I_={IN_PROGRESS:"In Progress",IN_REVIEW:"In Review",DONE:"Done",CANCELED:"Canceled"},LJ={IN_PROGRESS:"bg-status-in-progress/20 text-status-in-progress",IN_REVIEW:"bg-status-in-review/20 text-status-in-review",DONE:"bg-status-done/20 text-status-done",CANCELED:"bg-status-canceled/20 text-status-canceled"};function Bst(){const{t:e}=Rt("common"),{taskId:t}=YP.useParams(),n=YP.useSearch(),r=Qr(),i=wge(),{data:a,isLoading:s}=kre(t),o=Iw(),l=Dw(),{viewState:u,setActiveTab:f,setFilesViewState:d}=aj(t),m=F3(),g=B3(),x=U3(),_=$3(),b=z3(),y=H3(),{data:v}=O0(),{data:S}=R0(),{data:T}=N0(),{data:w}=Rre(),{data:C}=Oqe(a?.linearTicketId??null),{data:R=[]}=fg(),O=R.find(ye=>ye.path===a?.repoPath),N=i.state,D=a?.aiMode??N?.aiMode,L=a?.description??N?.description,[z,P]=A.useState(!1),[q,H]=A.useState(!1),[F,G]=A.useState(!0),[V,B]=A.useState("terminal"),[j,$]=A.useState(0),[Y,W]=A.useState(null),ee=Yw(),oe=n.tab??u.activeTab,se=n.file??u.filesViewState.selectedFile,Z=A.useRef(null);A.useEffect(()=>{Z.current===t||n.tab||(Z.current=t,u.activeTab&&r({to:"/tasks/$taskId",params:{taskId:t},search:{tab:u.activeTab==="diff"?void 0:u.activeTab,file:u.filesViewState.selectedFile||void 0},replace:!0}))},[t,n.tab,u.activeTab,u.filesViewState.selectedFile,r]);const K=A.useCallback(ye=>{const xe=ye;f(xe),r({to:"/tasks/$taskId",params:{taskId:t},search:{tab:xe==="diff"?void 0:xe,file:xe==="files"&&se||void 0},replace:!0})},[t,r,f,se]),Q=A.useCallback(ye=>{d({selectedFile:ye}),r({to:"/tasks/$taskId",params:{taskId:t},search:{tab:"files",file:ye||void 0},replace:!0})},[t,r,d]),{terminals:te,sendInputToTerminal:ne,destroyTerminal:J}=sj(),me=xp(),be=te.find(ye=>a?.worktreePath&&ye.cwd.startsWith(a.worktreePath));A.useEffect(()=>Y?Ww(()=>me.terminals.items.some(xe=>xe.id===Y),xe=>{xe||(W(null),$(Me=>Me+1))},{fireImmediately:!0}):void 0,[Y,me]);const fe=()=>{if(!a?.worktreePath)return;const ye=me.terminals.items.find(xe=>xe.cwd.startsWith(a.worktreePath));ye?(W(ye.id),J(ye.id,{force:!0,reason:"retry"})):$(xe=>xe+1)},_e=ye=>{be?(ne(be.id,ye),Nt.info(e("git.sentToClaude"))):Nt.error(e("git.noTerminal"))},Ee=async()=>{if(!(!a?.repoPath||!a?.worktreePath))try{await m.mutateAsync({repoPath:a.repoPath,worktreePath:a.worktreePath,baseBranch:a.baseBranch}),Nt.success(e("git.syncedFromMain"))}catch(ye){const xe=ye instanceof Error?ye.message:"Sync failed",Me=a.baseBranch||"main";Nt.error(xe,{action:be?{label:"Resolve with Claude",onClick:()=>_e(`Rebase this worktree onto the parent repo's ${Me} branch. Error: "${xe}". Steps: 1) Check for uncommitted changes - stash or commit them first, 2) git fetch origin (in parent repo at ${a.repoPath}) to ensure ${Me} is current, 3) git rebase ${Me} (in worktree), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) If stashed, git stash pop. Worktree: ${a.worktreePath}, Parent repo: ${a.repoPath}.`)}:void 0})}},qe=async()=>{if(!(!a?.repoPath||!a?.worktreePath))try{await g.mutateAsync({repoPath:a.repoPath,worktreePath:a.worktreePath,baseBranch:a.baseBranch}),Nt.success(e("git.mergedToMain")),y.mutate(a.id),o.mutate({taskId:a.id,updates:{status:"DONE"}})}catch(ye){const xe=ye instanceof Error?ye.message:"Merge failed",Me=a.baseBranch||"main";Nt.error(xe,{action:be?{label:"Resolve with Claude",onClick:()=>_e(`Merge this worktree's branch into the parent repo's ${Me}. Error: "${xe}". Steps: 1) Ensure all changes in worktree are committed, 2) In parent repo at ${a.repoPath}, checkout ${Me} and pull latest from origin, 3) Squash merge the worktree branch into ${Me} (use git merge --squash, then commit), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Push ${Me} to origin. Worktree: ${a.worktreePath}, Parent repo: ${a.repoPath}.`)}:void 0})}},Ce=async()=>{if(a?.worktreePath)try{await x.mutateAsync({worktreePath:a.worktreePath}),Nt.success(e("git.pushedToOrigin"))}catch(ye){const xe=ye instanceof Error?ye.message:"Push failed";Nt.error(xe,{action:be?{label:"Resolve with Claude",onClick:()=>_e(`Push this worktree's branch to origin. Error: "${xe}". Steps: 1) Check for uncommitted changes and commit them, 2) If push is rejected, pull the latest changes first and resolve any conflicts, 3) Push to origin again. Worktree: ${a.worktreePath}.`)}:void 0})}},Le=async()=>{if(a?.repoPath)try{await _.mutateAsync({repoPath:a.repoPath,baseBranch:a.baseBranch}),Nt.success(e("git.parentSynced"))}catch(ye){const xe=ye instanceof Error?ye.message:"Sync parent failed",Me=a.baseBranch||"main";Nt.error(xe,{action:be?{label:"Resolve with Claude",onClick:()=>_e(`Sync the parent repo's ${Me} branch with origin. Error: "${xe}". Steps: 1) git fetch origin, 2) git pull origin ${Me} --ff-only, 3) If that fails, rebase with git rebase origin/${Me}, 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Once in sync, git push origin ${Me}. Work in the parent repo at ${a.repoPath}, not the worktree.`)}:void 0})}},Ae=()=>{be&&ne(be.id,"commit")},pe=async()=>{if(a?.worktreePath)try{const ye=await b.mutateAsync({worktreePath:a.worktreePath,title:a.title,baseBranch:a.baseBranch});o.mutate({taskId:a.id,updates:{prUrl:ye.prUrl}}),Nt.success(e("git.prCreated"),{action:{label:"View PR",onClick:()=>Al(ye.prUrl)}})}catch(ye){const xe=ye instanceof Error?ye.message:"Failed to create PR",Me=ye&&typeof ye=="object"&&"existingPrUrl"in ye?ye.existingPrUrl:void 0;if(Me){o.mutate({taskId:a.id,updates:{prUrl:Me}}),Nt.info(e("git.prExists"),{action:{label:"View PR",onClick:()=>Al(Me)}});return}const Ge=xe.split(`
|
|
174
174
|
`).filter(Boolean).pop()||xe;Nt.error(Ge,{action:{label:"Resolve with Claude",onClick:()=>_e(`Create a PR for this task. Error: "${xe}". After creating, link it using: vibora current-task pr <url>. Worktree: ${a.worktreePath}.`)}})}},de=()=>{if(!a?.worktreePath)return;const ye=Kw(a.worktreePath,v,S,T);Al(ye)},ke=ye=>{a&&o.mutate({taskId:a.id,updates:{status:ye}})},De=()=>{a&&l.mutate({taskId:a.id,deleteLinkedWorktree:F},{onSuccess:()=>{r({to:"/tasks"})}})},ge=ye=>{H(ye),ye||G(!1)};return s?p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx("p",{className:"text-muted-foreground",children:"Loading task..."})}):a?p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[p.jsxs("div",{className:"shrink-0 border-b border-border bg-background px-4 py-2",children:[p.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:a.title}),p.jsxs(Gh,{children:[p.jsx(Kh,{render:p.jsx("button",{type:"button",className:`rounded-full px-2 py-0.5 text-xs font-medium ${LJ[a.status]}`}),children:I_[a.status]}),p.jsx(Yh,{align:"end",children:p.jsx(dW,{value:a.status,onValueChange:ke,children:Object.entries(I_).map(([ye,xe])=>p.jsx(fW,{value:ye,children:xe},ye))})})]}),p.jsxs(Gh,{children:[p.jsx(Kh,{render:p.jsx(Ie,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),children:p.jsx(ae,{icon:dne,size:16,strokeWidth:2})}),p.jsxs(Yh,{align:"end",children:[p.jsxs(Ar,{onClick:Ee,disabled:m.isPending||!a.worktreePath,children:[p.jsx(ae,{icon:ny,size:14,strokeWidth:2}),"Pull from ",a.baseBranch]}),p.jsxs(Ar,{onClick:qe,disabled:g.isPending||!a.worktreePath,children:[p.jsx(ae,{icon:ty,size:14,strokeWidth:2}),"Merge to ",a.baseBranch]}),p.jsxs(Ar,{onClick:Ce,disabled:x.isPending||!a.worktreePath,children:[p.jsx(ae,{icon:ry,size:14,strokeWidth:2}),"Push to origin"]}),p.jsxs(Ar,{onClick:Le,disabled:_.isPending||!a.repoPath,children:[p.jsx(ae,{icon:ay,size:14,strokeWidth:2}),"Sync parent"]}),p.jsxs(Ar,{onClick:Ae,disabled:!be,children:[p.jsx(ae,{icon:iy,size:14,strokeWidth:2}),"Commit"]}),!a.prUrl&&p.jsxs(Ar,{onClick:pe,disabled:b.isPending,children:[p.jsx(ae,{icon:Du,size:14,strokeWidth:2,className:b.isPending?"animate-pulse":""}),"Create PR"]})]})]}),p.jsxs(Ns,{open:q,onOpenChange:ge,children:[p.jsx(Ku,{render:p.jsx(Ie,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive"}),children:p.jsx(ae,{icon:mo,size:16,strokeWidth:2})}),p.jsxs(Is,{children:[p.jsxs(Ds,{children:[p.jsx(Ps,{children:"Delete Task"}),p.jsxs(Ms,{children:['This will permanently delete "',a.title,'" and close its terminal.',F&&a.worktreePath&&" The linked worktree will also be removed."," ","This action cannot be undone."]}),a.worktreePath&&p.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[p.jsx(Ur,{checked:F,onCheckedChange:ye=>G(ye===!0),disabled:l.isPending}),"Also delete linked worktree"]})]}),p.jsxs(Ls,{children:[p.jsx(js,{disabled:l.isPending,children:"Cancel"}),p.jsx(_d,{onClick:De,variant:"destructive",disabled:l.isPending,children:l.isPending?"Deleting...":"Delete"})]})]})]})]}),p.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[p.jsx("button",{type:"button",className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:()=>P(!0),title:"Task settings",children:p.jsx(ae,{icon:RD,size:14,strokeWidth:2})}),p.jsx("button",{type:"button",className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:fe,title:"New task terminal",children:p.jsx(ae,{icon:Yz,size:14,strokeWidth:2})}),O?p.jsxs(pr,{to:"/repositories/$repoId",params:{repoId:O.id},className:"flex items-center gap-1 hover:text-foreground transition-colors",children:[p.jsx(ae,{icon:Cu,size:12,strokeWidth:2}),p.jsx("span",{children:a.repoName})]}):p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx(ae,{icon:Cu,size:12,strokeWidth:2}),p.jsx("span",{children:a.repoName})]}),p.jsx("div",{className:"ml-auto",children:p.jsx(Xh,{worktreePath:a.worktreePath})})]})]}),p.jsxs("div",{className:"hidden items-center gap-3 sm:flex",children:[p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("h1",{className:"text-sm font-medium",children:a.title}),p.jsx("button",{type:"button",className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:()=>P(!0),title:"Task settings",children:p.jsx(ae,{icon:RD,size:14,strokeWidth:2})}),p.jsx("button",{type:"button",className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:fe,title:"New task terminal",children:p.jsx(ae,{icon:Yz,size:14,strokeWidth:2})})]}),p.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[O?p.jsxs(pr,{to:"/repositories/$repoId",params:{repoId:O.id},className:"flex items-center gap-1 hover:text-foreground transition-colors",children:[p.jsx(ae,{icon:Cu,size:12,strokeWidth:2}),p.jsx("span",{children:a.repoName})]}):p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx(ae,{icon:Cu,size:12,strokeWidth:2}),p.jsx("span",{children:a.repoName})]}),p.jsx(ae,{icon:Ew,size:12,strokeWidth:2}),p.jsx("span",{className:"font-mono",children:a.branch}),a.prUrl&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground/50",children:"•"}),p.jsxs("a",{href:a.prUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-foreground hover:text-primary font-medium",onClick:ye=>ye.stopPropagation(),children:[p.jsx(ae,{icon:Du,size:14,strokeWidth:2}),p.jsxs("span",{children:["#",a.prUrl.match(/\/pull\/(\d+)/)?.[1]??"PR"]})]})]}),a.linearTicketUrl&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground/50",children:"•"}),p.jsxs("a",{href:C?.url??a.linearTicketUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-foreground hover:text-primary font-medium",onClick:ye=>ye.stopPropagation(),title:C?.title,children:[p.jsx(ae,{icon:JM,size:14,strokeWidth:2}),p.jsx("span",{children:a.linearTicketId}),C?.status&&p.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",C.status,")"]})]})]})]})]}),p.jsxs(Gh,{children:[p.jsx(Kh,{render:p.jsx("button",{type:"button",className:`rounded-full px-2 py-0.5 text-xs font-medium ${LJ[a.status]}`}),children:I_[a.status]}),p.jsx(Yh,{align:"end",children:p.jsx(dW,{value:a.status,onValueChange:ke,children:Object.entries(I_).map(([ye,xe])=>p.jsx(fW,{value:ye,children:xe},ye))})})]}),p.jsxs("div",{className:"flex items-center gap-0",children:[p.jsx(Ie,{variant:"ghost",size:"icon-sm",onClick:Ee,disabled:m.isPending||!a.worktreePath,className:"text-muted-foreground hover:text-foreground",title:`Pull from ${a.baseBranch}`,children:p.jsx(ae,{icon:ny,size:16,strokeWidth:2,className:m.isPending?"animate-spin":""})}),p.jsx(Ie,{variant:"ghost",size:"icon-sm",onClick:qe,disabled:g.isPending||!a.worktreePath,className:"text-muted-foreground hover:text-foreground",title:`Merge to ${a.baseBranch}`,children:p.jsx(ae,{icon:ty,size:16,strokeWidth:2,className:g.isPending?"animate-pulse":""})}),p.jsx(Ie,{variant:"ghost",size:"icon-sm",onClick:Ce,disabled:x.isPending||!a.worktreePath,className:"text-muted-foreground hover:text-foreground",title:"Push to origin",children:p.jsx(ae,{icon:ry,size:16,strokeWidth:2,className:x.isPending?"animate-pulse":""})}),p.jsx(Ie,{variant:"ghost",size:"icon-sm",onClick:Le,disabled:_.isPending||!a.repoPath,className:"text-muted-foreground hover:text-foreground",title:"Sync parent with origin",children:p.jsx(ae,{icon:ay,size:16,strokeWidth:2,className:_.isPending?"animate-spin":""})}),p.jsx(Ie,{variant:"ghost",size:"icon-sm",onClick:Ae,disabled:!be,className:"text-muted-foreground hover:text-foreground",title:"Commit",children:p.jsx(ae,{icon:iy,size:16,strokeWidth:2})}),!a.prUrl&&p.jsx(Ie,{variant:"ghost",size:"icon-sm",onClick:pe,disabled:b.isPending,className:"text-muted-foreground hover:text-foreground",title:"Create Pull Request",children:p.jsx(ae,{icon:Du,size:16,strokeWidth:2,className:b.isPending?"animate-pulse":""})}),p.jsx(Ie,{variant:"ghost",size:"icon-sm",onClick:de,disabled:!a.worktreePath,className:"text-muted-foreground hover:text-foreground",title:"Open in editor",children:p.jsx(ae,{icon:t3,size:16,strokeWidth:2})})]}),p.jsxs(Ns,{open:q,onOpenChange:ge,children:[p.jsx(Ku,{render:p.jsx(Ie,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive"}),children:p.jsx(ae,{icon:mo,size:16,strokeWidth:2})}),p.jsxs(Is,{children:[p.jsxs(Ds,{children:[p.jsx(Ps,{children:"Delete Task"}),p.jsxs(Ms,{children:['This will permanently delete "',a.title,'" and close its terminal.',F&&a.worktreePath&&" The linked worktree will also be removed."," ","This action cannot be undone."]}),a.worktreePath&&p.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[p.jsx(Ur,{checked:F,onCheckedChange:ye=>G(ye===!0),disabled:l.isPending}),"Also delete linked worktree"]})]}),p.jsxs(Ls,{children:[p.jsx(js,{disabled:l.isPending,children:"Cancel"}),p.jsx(_d,{onClick:De,variant:"destructive",disabled:l.isPending,children:l.isPending?"Deleting...":"Delete"})]})]})]})]})]}),ee?p.jsxs(jo,{value:V,onValueChange:ye=>B(ye),className:"flex min-h-0 flex-1 flex-col",children:[p.jsx("div",{className:"shrink-0 border-b border-border px-2 py-1",children:p.jsxs(Fo,{className:"w-full",children:[p.jsx(Sr,{value:"terminal",className:"flex-1",children:"Terminal"}),p.jsx(Sr,{value:"details",className:"flex-1",children:"Details"})]})}),p.jsx(Mr,{value:"terminal",className:"flex-1 min-h-0",children:p.jsx(HZ,{taskName:a.title,cwd:a.worktreePath,aiMode:D,description:L,startupScript:a.startupScript,claudeOptions:a.claudeOptions,serverPort:w},j)}),p.jsx(Mr,{value:"details",className:"flex-1 min-h-0 bg-background",children:p.jsxs(jo,{value:oe,onValueChange:K,className:"flex h-full flex-col",children:[p.jsxs("div",{className:"flex items-center justify-between shrink-0 border-b border-border bg-background px-2 py-1",children:[p.jsxs(Fo,{variant:"line",children:[p.jsxs(Sr,{value:"diff",children:[p.jsx(ae,{icon:kD,size:14,strokeWidth:2,"data-slot":"icon"}),"Diff"]}),p.jsxs(Sr,{value:"browser",children:[p.jsx(ae,{icon:AD,size:14,strokeWidth:2,"data-slot":"icon"}),"Browser"]}),p.jsxs(Sr,{value:"files",children:[p.jsx(ae,{icon:oa,size:14,strokeWidth:2,"data-slot":"icon"}),"Files"]})]}),p.jsx(Xh,{worktreePath:a.worktreePath})]}),p.jsx(Mr,{value:"diff",className:"flex-1 overflow-hidden",children:p.jsx(VZ,{taskId:a.id,worktreePath:a.worktreePath,baseBranch:a.baseBranch})}),p.jsx(Mr,{value:"browser",className:"flex-1 overflow-hidden",children:p.jsx(qZ,{taskId:a.id})}),p.jsx(Mr,{value:"files",className:"flex-1 overflow-hidden",children:p.jsx(ZS,{worktreePath:a.worktreePath,initialSelectedFile:se,onFileChange:Q})})]})})]}):p.jsxs(bf,{direction:"horizontal",className:"min-h-0 flex-1",children:[p.jsx(to,{defaultSize:50,minSize:30,children:p.jsx(HZ,{taskName:a.title,cwd:a.worktreePath,aiMode:D,description:L,startupScript:a.startupScript,claudeOptions:a.claudeOptions,serverPort:w},j)}),p.jsx(vf,{withHandle:!0}),p.jsx(to,{defaultSize:50,minSize:30,className:"bg-background",children:p.jsxs(jo,{value:oe,onValueChange:K,className:"flex h-full flex-col",children:[p.jsxs("div",{className:"flex items-center justify-between shrink-0 border-b border-border bg-background px-2 py-1",children:[p.jsxs(Fo,{variant:"line",children:[p.jsxs(Sr,{value:"diff",children:[p.jsx(ae,{icon:kD,size:14,strokeWidth:2,"data-slot":"icon"}),"Diff"]}),p.jsxs(Sr,{value:"browser",children:[p.jsx(ae,{icon:AD,size:14,strokeWidth:2,"data-slot":"icon"}),"Browser"]}),p.jsxs(Sr,{value:"files",children:[p.jsx(ae,{icon:oa,size:14,strokeWidth:2,"data-slot":"icon"}),"Files"]})]}),p.jsx(Xh,{worktreePath:a.worktreePath})]}),p.jsx(Mr,{value:"diff",className:"flex-1 overflow-hidden",children:p.jsx(VZ,{taskId:a.id,worktreePath:a.worktreePath,baseBranch:a.baseBranch})}),p.jsx(Mr,{value:"browser",className:"flex-1 overflow-hidden",children:p.jsx(qZ,{taskId:a.id})}),p.jsx(Mr,{value:"files",className:"flex-1 overflow-hidden",children:p.jsx(ZS,{worktreePath:a.worktreePath,initialSelectedFile:se,onFileChange:Q})})]})})]}),p.jsx(rse,{task:a,open:z,onOpenChange:P})]}):p.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4",children:[p.jsx("p",{className:"text-muted-foreground",children:"Task not found"}),p.jsx(pr,{to:"/tasks",children:p.jsx(Ie,{variant:"outline",children:"Back to Tasks"})})]})}function Ust({value:e,onChange:t}){const{t:n}=Rt("repositories"),[r,i]=A.useState(()=>{const f=Object.entries(e);return f.length===0?[]:f.map(([d,m])=>({id:crypto.randomUUID(),key:d,value:m}))}),a=A.useRef(null);A.useEffect(()=>{const f=Object.entries(e);if(f.length===0&&r.length===0)return;const d=s(r);JSON.stringify(d)!==JSON.stringify(e)&&i(f.map(([m,g])=>({id:crypto.randomUUID(),key:m,value:g})))},[e]);const s=f=>{const d={};for(const m of f){const g=m.key.trim();g&&(d[g]=m.value)}return d},o=(f,d,m)=>{const g=r.map(x=>x.id===f?{...x,[d]:m}:x);i(g),t(s(g))},l=()=>{const f={id:crypto.randomUUID(),key:"",value:""};i([...r,f]),setTimeout(()=>{a.current?.focus()},0)},u=f=>{const d=r.filter(m=>m.id!==f);i(d),t(s(d))};return p.jsxs("div",{className:"space-y-2",children:[r.length>0&&p.jsx("div",{className:"border border-border rounded-md overflow-hidden",children:p.jsxs("table",{className:"w-full text-sm",children:[p.jsx("thead",{children:p.jsxs("tr",{className:"bg-muted/50",children:[p.jsx("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground w-[40%]",children:n("detailView.settings.claudeOptionsFlag")}),p.jsx("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground",children:n("detailView.settings.claudeOptionsValue")}),p.jsx("th",{className:"w-10"})]})}),p.jsx("tbody",{children:r.map((f,d)=>p.jsxs("tr",{className:"border-t border-border",children:[p.jsx("td",{className:"px-2 py-1",children:p.jsx(Qt,{ref:d===r.length-1?a:void 0,value:f.key,onChange:m=>o(f.id,"key",m.target.value),placeholder:"model",className:"h-8 font-mono text-xs"})}),p.jsx("td",{className:"px-2 py-1",children:p.jsx(Qt,{value:f.value,onChange:m=>o(f.id,"value",m.target.value),placeholder:"haiku",className:"h-8 font-mono text-xs"})}),p.jsx("td",{className:"px-2 py-1",children:p.jsx(Ie,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>u(f.id),children:p.jsx(ae,{icon:mo,size:14,strokeWidth:2})})})]},f.id))})]})}),p.jsxs(Ie,{variant:"outline",size:"sm",onClick:l,className:"w-full",children:[p.jsx(ae,{icon:jxe,size:14,strokeWidth:2,"data-slot":"icon"}),n("detailView.settings.addClaudeOption")]})]})}function $st(e){const t=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return t?`https://${t[1]}/${t[2]}`:e.replace(/\.git$/,"")}function zst(e){return En({queryKey:["git-remote",e],queryFn:async()=>{if(!e)return null;const t=await fetch(`/api/git/remote?path=${encodeURIComponent(e)}`);return t.ok?(await t.json()).remoteUrl:null},enabled:!!e,staleTime:60*1e3})}function Hst(){const{t:e}=Rt("repositories"),{repoId:t}=XP.useParams(),{tab:n,file:r}=XP.useSearch(),i=Qr(),{data:a,isLoading:s,error:o}=LCe(t),l=MCe(),u=Lre(),{data:f}=zst(a?.path),d=dse(a?.id??null),{data:m,isLoading:g}=G3(a?.id??null),[x,_]=A.useState(""),[b,y]=A.useState(""),[v,S]=A.useState(""),[T,w]=A.useState({}),[C,R]=A.useState(!1),[O,N]=A.useState(!1),[D,L]=A.useState(!1),[z,P]=A.useState(!1),[q,H]=A.useState(!1),[F,G]=A.useState(!1),[V,B]=A.useState("terminal"),[j,$]=A.useState(null),[Y,W]=A.useState(!1),[ee,oe]=A.useState(!1),[se,Z]=A.useState(!1),K=A.useRef(null),Q=A.useRef(null),te=A.useRef(!1),ne=A.useRef(!1),{terminals:J,terminalsLoaded:me,connected:be,createTerminal:fe,attachXterm:_e,resizeTerminal:Ee,setupImagePaste:qe,writeToTerminal:Ce}=sj(),Le=n||"settings",Ae=Yw(),{openInTerminal:pe}=fse(),{data:de}=O0(),{data:ke}=R0(),{data:De}=N0(),ge=()=>{if(!a)return;const Se=Kw(a.path,de,ke,De);Al(Se)},ye=()=>{g||(m?.found?i({to:"/apps/new",search:{repoId:t}}):H(!0))};A.useEffect(()=>{Dt.repoTerminal.info("component mounted",{repoId:t,tab:n,activeTab:Le})},[t,n,Le]),A.useEffect(()=>{Dt.repoTerminal.debug("state changed",{terminalId:j,xtermReady:ee,containerReady:se,connected:be,terminalsLoaded:me,terminalCount:J.length,repoPath:a?.path})},[j,ee,se,be,me,J.length,a?.path]);const xe=A.useCallback(Se=>{i({to:"/repositories/$repoId",params:{repoId:t},search:Se==="settings"?{}:{tab:Se,file:r},replace:!0})},[i,t,r]),Me=A.useCallback(Se=>{i({to:"/repositories/$repoId",params:{repoId:t},search:{tab:"workspace",file:Se??void 0},replace:!0})},[i,t]);A.useEffect(()=>{a&&(_(a.displayName),y(a.startupScript||""),S(a.copyFiles||""),w(a.claudeOptions||{}),R(a.isCopierTemplate??!1),N(!1))},[a]),A.useEffect(()=>{if(a){const Se=x!==a.displayName||b!==(a.startupScript||"")||v!==(a.copyFiles||"")||JSON.stringify(T)!==JSON.stringify(a.claudeOptions||{})||C!==(a.isCopierTemplate??!1);N(Se)}},[x,b,v,T,C,a]);const Ge=()=>{a&&l.mutate({id:a.id,updates:{displayName:x.trim()||a.path.split("/").pop()||"repo",startupScript:b.trim()||null,copyFiles:v.trim()||null,claudeOptions:Object.keys(T).length>0?T:null,isCopierTemplate:C}},{onSuccess:()=>{Nt.success(e("detailView.saved")),N(!1)},onError:Se=>{Nt.error(e("detailView.failedToSave"),{description:Se instanceof Error?Se.message:"Unknown error"})}})},ft=async Se=>{a&&(await u.mutateAsync({id:a.id,deleteDirectory:Se}),i({to:"/repositories"}))};A.useEffect(()=>{te.current=!1,ne.current=!1,$(null),W(!1)},[a?.path]),A.useEffect(()=>{if(!be||!a?.path||!me||Le!=="workspace"||!ee){Dt.repoTerminal.debug("find/create: waiting",{connected:be,path:a?.path,terminalsLoaded:me,activeTab:Le,xtermReady:ee});return}const Se=J.find(Fe=>Fe.cwd===a.path&&Fe.status==="running");if(Se){Dt.repoTerminal.info("found existing terminal",{id:Se.id,cwd:Se.cwd}),$(Se.id);return}if(!te.current&&K.current){te.current=!0,W(!0);const{cols:Fe,rows:Je}=K.current;Dt.repoTerminal.info("creating terminal",{name:a.displayName,cwd:a.path,cols:Fe,rows:Je}),fe({name:a.displayName,cols:Fe,rows:Je,cwd:a.path})}},[be,a?.path,a?.displayName,me,J,Le,fe,ee]),A.useEffect(()=>{if(!a?.path)return;const Se=J.find(Je=>Je.cwd===a.path&&Je.status==="running");if(!Se)return;const Fe=j&&J.some(Je=>Je.id===j);(!j||!Fe)&&($(Se.id),W(!1),j&&!Fe&&(ne.current=!1))},[J,a?.path,j]);const tt=A.useCallback(Se=>{Dt.repoTerminal.info("xterm ready"),K.current=Se,oe(!0)},[]),lt=A.useCallback((Se,Fe)=>{j&&Ee(j,Se,Fe)},[j,Ee]),Ue=A.useCallback(Se=>{Dt.repoTerminal.info("container ready"),Q.current=Se,Z(!0)},[]),pt=A.useCallback(Se=>{j&&Ce(j,Se)},[j,Ce]);return A.useEffect(()=>{if(!j||!ee||!se){Dt.repoTerminal.debug("attach effect: waiting",{terminalId:j,xtermReady:ee,containerReady:se});return}if(!K.current||!Q.current){Dt.repoTerminal.warn("attach effect: refs not set despite ready states",{terminalId:j});return}if(ne.current){Dt.repoTerminal.debug("attach effect: already attached",{terminalId:j});return}return Dt.repoTerminal.info("attaching terminal",{terminalId:j}),_e(j,K.current),qe(Q.current,j),ne.current=!0,()=>{Dt.repoTerminal.debug("detaching terminal",{terminalId:j}),ne.current=!1}},[j,ee,se,_e,qe]),s?p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx(ae,{icon:Ot,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}):o||!a?p.jsxs("div",{className:"flex h-full flex-col",children:[p.jsx("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:p.jsxs(pr,{to:"/repositories",className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground",children:[p.jsx(ae,{icon:Fxe,size:16,strokeWidth:2}),e("detailView.breadcrumb")]})}),p.jsx("div",{className:"flex flex-1 items-center justify-center",children:p.jsxs("div",{className:"flex items-center gap-3 text-destructive",children:[p.jsx(ae,{icon:hr,size:20,strokeWidth:2}),p.jsx("span",{className:"text-sm",children:e("detailView.notFound")})]})})]}):p.jsxs("div",{className:"flex h-full flex-col",children:[p.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(Ie,{variant:"ghost",size:"sm",onClick:()=>L(!0),className:"text-muted-foreground hover:text-foreground",children:[p.jsx(ae,{icon:e3,size:16,strokeWidth:2,"data-slot":"icon",className:"-translate-y-px"}),p.jsx("span",{className:"max-sm:hidden",children:e("newTask")})]}),a.isCopierTemplate&&p.jsxs(Ie,{variant:"ghost",size:"sm",onClick:()=>G(!0),className:"text-muted-foreground hover:text-foreground",children:[p.jsx(ae,{icon:Gxe,size:16,strokeWidth:2,"data-slot":"icon"}),p.jsx("span",{className:"max-sm:hidden",children:e("newProject.button")})]}),p.jsxs(Ie,{variant:"ghost",size:"sm",onClick:()=>i({to:"/tasks",search:{repo:a.displayName}}),className:"text-muted-foreground hover:text-foreground",title:e("viewTasks"),children:[p.jsx(ae,{icon:fm,size:14,strokeWidth:2,"data-slot":"icon"}),p.jsx("span",{className:"max-sm:hidden",children:e("viewTasks")})]}),p.jsxs(Ie,{variant:"ghost",size:"sm",onClick:()=>pe(a.path,a.displayName),className:"text-muted-foreground hover:text-foreground",title:e("openInTerminal"),children:[p.jsx(ae,{icon:xw,size:14,strokeWidth:2,"data-slot":"icon"}),p.jsx("span",{className:"max-sm:hidden",children:e("terminal")})]}),p.jsxs(Ie,{variant:"ghost",size:"sm",onClick:ge,className:"text-muted-foreground hover:text-foreground",title:e("openInEditor",{editor:I3(de)}),children:[p.jsx(ae,{icon:t3,size:14,strokeWidth:2,"data-slot":"icon"}),p.jsx("span",{className:"max-sm:hidden",children:e("editor")})]}),d?p.jsx(pr,{to:"/apps",search:{repo:a.displayName},children:p.jsxs(Ie,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground",children:[p.jsx(ae,{icon:tp,size:14,strokeWidth:2,"data-slot":"icon"}),p.jsx("span",{className:"max-sm:hidden",children:e("applications")})]})}):p.jsxs(Ie,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground",onClick:ye,disabled:g,children:[p.jsx(ae,{icon:tp,size:14,strokeWidth:2,"data-slot":"icon"}),p.jsx("span",{className:"max-sm:hidden",children:e("createApp")})]})]}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(Xh,{worktreePath:a.path}),p.jsx("span",{className:"text-sm font-medium",children:a.displayName}),f&&p.jsx("a",{href:$st(f),target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors",title:f,children:p.jsx(ae,{icon:f.includes("github.com")?Kxe:ZM,size:14,strokeWidth:2})}),p.jsx(Ie,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-destructive",onClick:()=>P(!0),children:p.jsx(ae,{icon:mo,size:14,strokeWidth:2})})]})]}),p.jsxs(jo,{value:Le,onValueChange:Se=>xe(Se),className:"flex flex-1 flex-col overflow-hidden",children:[p.jsx("div",{className:"shrink-0 border-b border-border bg-muted/50 px-4",children:p.jsxs(Fo,{variant:"line",children:[p.jsx(Sr,{value:"settings",className:"px-3 py-1.5",children:e("detailView.tabs.settings")}),p.jsx(Sr,{value:"workspace",className:"px-3 py-1.5",children:e("detailView.tabs.workspace")})]})}),p.jsx(Mr,{value:"settings",className:"flex-1 overflow-hidden mt-0",children:p.jsx(pg,{className:"h-full",children:p.jsx("div",{className:"p-4",children:p.jsxs("div",{className:"mx-auto max-w-xl space-y-6 bg-card rounded-lg p-6 border border-border",children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[p.jsx(ae,{icon:oa,size:14,strokeWidth:2}),p.jsx("span",{className:"font-mono break-all",children:a.path})]}),p.jsxs(hm,{children:[p.jsxs(cr,{children:[p.jsx(dr,{htmlFor:"displayName",children:e("detailView.settings.displayName")}),p.jsx(Qt,{id:"displayName",value:x,onChange:Se=>_(Se.target.value),placeholder:a.path.split("/").pop()||"My Project"})]}),p.jsxs(cr,{children:[p.jsx(dr,{htmlFor:"startupScript",children:e("detailView.settings.startupScript")}),p.jsx(kw,{id:"startupScript",value:b,onChange:Se=>y(Se.target.value),placeholder:e("detailView.settings.startupScriptPlaceholder"),rows:3}),p.jsx($a,{children:e("detailView.settings.startupScriptDescription")})]}),p.jsxs(cr,{children:[p.jsx(dr,{children:e("detailView.settings.claudeOptions")}),p.jsx($a,{className:"mb-2",children:e("detailView.settings.claudeOptionsDescription")}),p.jsx(Ust,{value:T,onChange:w})]}),p.jsxs(cr,{children:[p.jsx(dr,{htmlFor:"copyFiles",children:e("detailView.settings.copyFiles")}),p.jsx(Qt,{id:"copyFiles",value:v,onChange:Se=>S(Se.target.value),placeholder:e("detailView.settings.copyFilesPlaceholder")}),p.jsx($a,{children:e("detailView.settings.copyFilesDescription")})]}),p.jsxs(cr,{children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Ur,{checked:C,onCheckedChange:Se=>R(Se===!0)}),p.jsx(dr,{className:"cursor-pointer",children:e("detailView.settings.isCopierTemplate")})]}),p.jsx($a,{children:e("detailView.settings.isCopierTemplateDescription")})]})]}),p.jsx("div",{className:"flex items-center justify-end pt-4 border-t border-border",children:p.jsxs(Ie,{size:"sm",onClick:Ge,disabled:!O||l.isPending,children:[p.jsx(ae,{icon:Pr,size:14,strokeWidth:2,"data-slot":"icon"}),l.isPending?e("detailView.saving"):e("detailView.save")]})})]})})})}),p.jsx(Mr,{value:"workspace",className:"flex-1 overflow-hidden mt-0",children:Ae?p.jsxs(jo,{value:V,onValueChange:Se=>B(Se),className:"flex min-h-0 flex-1 flex-col h-full",children:[p.jsx("div",{className:"shrink-0 border-b border-border px-2 py-1",children:p.jsxs(Fo,{className:"w-full",children:[p.jsx(Sr,{value:"terminal",className:"flex-1",children:e("detailView.mobileWorkspace.terminal")}),p.jsx(Sr,{value:"files",className:"flex-1",children:e("detailView.mobileWorkspace.files")})]})}),p.jsx(Mr,{value:"terminal",className:"flex-1 min-h-0",children:p.jsxs("div",{className:"h-full flex flex-col",children:[!be&&p.jsx("div",{className:"shrink-0 px-2 py-1 bg-muted-foreground/20 text-muted-foreground text-xs",children:e("detailView.workspace.connectingToTerminal")}),Y&&!j&&p.jsx("div",{className:"flex-1 flex items-center justify-center bg-terminal-background",children:p.jsxs("div",{className:"flex flex-col items-center gap-3",children:[p.jsx(ae,{icon:Ot,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"}),p.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:e("detailView.workspace.initializingTerminal")})]})}),p.jsx(JD,{className:"flex-1",onReady:tt,onResize:lt,onContainerReady:Ue,terminalId:j??void 0,setupImagePaste:qe,onSend:pt})]})}),p.jsx(Mr,{value:"files",className:"flex-1 min-h-0",children:p.jsx(ZS,{worktreePath:a.path,initialSelectedFile:r,onFileChange:Me})})]}):p.jsxs(bf,{direction:"horizontal",className:"h-full",children:[p.jsx(to,{defaultSize:50,minSize:30,children:p.jsxs("div",{className:"h-full flex flex-col",children:[!be&&p.jsx("div",{className:"shrink-0 px-2 py-1 bg-muted-foreground/20 text-muted-foreground text-xs",children:e("detailView.workspace.connectingToTerminal")}),Y&&!j&&p.jsx("div",{className:"flex-1 flex items-center justify-center bg-terminal-background",children:p.jsxs("div",{className:"flex flex-col items-center gap-3",children:[p.jsx(ae,{icon:Ot,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"}),p.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:e("detailView.workspace.initializingTerminal")})]})}),p.jsx(JD,{className:"flex-1",onReady:tt,onResize:lt,onContainerReady:Ue,terminalId:j??void 0,setupImagePaste:qe,onSend:pt})]})}),p.jsx(vf,{withHandle:!0}),p.jsx(to,{defaultSize:50,minSize:30,children:p.jsx(ZS,{worktreePath:a.path,initialSelectedFile:r,onFileChange:Me})})]})})]}),p.jsx(v3,{open:D,onOpenChange:L,defaultRepository:a,showTrigger:!1}),p.jsx(mse,{repository:a,open:z,onOpenChange:P,onDelete:ft}),p.jsx(hse,{initialTemplateSource:a.id,open:F,onOpenChange:G}),p.jsx(Xo,{open:q,onOpenChange:H,children:p.jsxs(Zo,{children:[p.jsxs(Ul,{children:[p.jsx($l,{children:e("createAppDialog.title")}),p.jsx(mp,{children:e("createAppDialog.description")})]}),p.jsx("p",{className:"text-sm",children:e("createAppDialog.instructions")}),p.jsx(Lu,{children:p.jsx(Ie,{onClick:()=>H(!1),children:e("createAppDialog.close")})})]})})]})}const XP=Aa("/repositories/$repoId")({component:Hst,validateSearch:e=>({tab:e.tab==="workspace"?"workspace":void 0,file:typeof e.file=="string"?e.file:void 0})});function Wst({className:e,...t}){return p.jsx(mwe,{"data-slot":"radio-group",className:Be("grid gap-3 w-full",e),...t})}function PJ({className:e,...t}){return p.jsx(fwe,{"data-slot":"radio-group-item",className:Be("border-input text-primary dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 data-checked:bg-primary data-checked:border-primary flex size-4 rounded-full transition-none focus-visible:ring-[2px] aria-invalid:ring-[2px] group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:p.jsx(pwe,{"data-slot":"radio-group-indicator",className:"group-aria-invalid/radio-group-item:text-destructive flex size-4 items-center justify-center text-white",children:p.jsx(ae,{icon:Uxe,strokeWidth:2,className:"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 fill-current"})})})}const kfe=Aa("/apps/new")({component:Vst,validateSearch:e=>({repoId:typeof e.repoId=="string"?e.repoId:void 0})});function Vst(){const e=Qr(),{repoId:t}=kfe.useSearch(),{data:n,isLoading:r}=fg(),{data:i}=Y3(),a=DLe(),s=i?.tunnelsAvailable??!1,[o,l]=A.useState("select-repo"),[u,f]=A.useState(null),[d,m]=A.useState(""),g=A.useRef(null),[x,_]=A.useState(""),[b,y]=A.useState(""),[v,S]=A.useState(!1),[T,w]=A.useState([]);A.useEffect(()=>{if(t&&n&&!u){const V=n.find(B=>B.id===t);V&&(f(V),_(V.displayName))}},[t,n,u,_]),A.useEffect(()=>{if(t&&u&&g.current){const V=g.current.querySelector(`[data-repo-id="${u.id}"]`);V&&V.scrollIntoView({behavior:"smooth",block:"nearest"})}},[t,u]);const{data:C,isLoading:R,error:O}=G3(u?.id??null),{data:N,isLoading:D}=FLe(C?.found?u?.id??null:null),{data:L}=Ore(u?.path??null);A.useEffect(()=>{L?.defaultBranch&&!b&&y(L.defaultBranch)},[L?.defaultBranch,b]);const z=A.useMemo(()=>n?d?.trim()?n.map(V=>({repo:V,score:Math.max(Ea(V.displayName,d),Ea(V.path,d))})).filter(({score:V})=>V>0).sort((V,B)=>B.score-V.score).map(({repo:V})=>V):n:[],[n,d]),P=V=>{w(V.map(B=>({serviceName:B.name,containerPort:B.ports?.[0]?.container??null,exposed:!1,domain:"",exposureMethod:"dns"})))},q=V=>{f(V),_(V.displayName),y("")},H=()=>{N&&P(N.services),l("configure-services")},F=(V,B)=>{w(j=>j.map(($,Y)=>Y===V?{...$,...B}:$))},G=async()=>{if(!(!u||!N))try{const V=await a.mutateAsync({name:x,repositoryId:u.id,branch:b||L?.defaultBranch||"main",composeFile:N.file,autoDeployEnabled:v,services:T.map(B=>({serviceName:B.serviceName,containerPort:B.containerPort??void 0,exposed:B.exposed,domain:B.domain||void 0,exposureMethod:B.exposureMethod}))});e({to:"/apps/$appId",params:{appId:V.id}})}catch{}};return p.jsxs("div",{className:"flex h-full flex-col",children:[p.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:[p.jsxs(pr,{to:"/apps",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground",children:[p.jsx(ae,{icon:dm,size:16,strokeWidth:2}),p.jsx("span",{className:"text-sm",children:"Apps"})]}),p.jsx("div",{className:"flex-1"}),p.jsxs("div",{className:"text-sm text-muted-foreground",children:["Step ",o==="select-repo"?"1":"2"," of 2"]})]}),p.jsx("div",{className:"flex-1 overflow-auto p-4",children:o==="select-repo"?p.jsx("div",{className:"mx-auto max-w-2xl",children:p.jsxs(li,{children:[p.jsx(ME,{children:p.jsx(jE,{children:"Select Repository"})}),p.jsxs(Rs,{className:"space-y-4",children:[p.jsxs("div",{className:"relative",children:[p.jsx(ae,{icon:ug,size:14,strokeWidth:2,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),p.jsx(Qt,{value:d,onChange:V=>m(V.target.value),placeholder:"Search repositories...",className:"pl-9"})]}),r?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx(ae,{icon:Ot,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}):p.jsxs("div",{ref:g,className:"space-y-2 max-h-80 overflow-auto",children:[z.map(V=>p.jsx(qst,{repo:V,selected:u?.id===V.id,onSelect:()=>q(V)},V.id)),z.length===0&&p.jsx("p",{className:"py-4 text-center text-sm text-muted-foreground",children:"No repositories found"})]}),u&&p.jsx("div",{className:"rounded-lg border bg-muted/50 p-4",children:R||D?p.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[p.jsx(ae,{icon:Ot,size:16,strokeWidth:2,className:"animate-spin"}),p.jsx("span",{className:"text-sm",children:"Checking for compose file..."})]}):O?p.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[p.jsx(ae,{icon:hr,size:16,strokeWidth:2}),p.jsxs("span",{className:"text-sm",children:["Error: ",O.message]})]}):C?.found?p.jsxs("div",{className:"flex items-center gap-2 text-green-600",children:[p.jsx(ae,{icon:Pl,size:16,strokeWidth:2}),p.jsxs("span",{className:"text-sm",children:["Found ",C.file,N&&` with ${N.services.length} service(s)`]})]}):p.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[p.jsx(ae,{icon:Zr,size:16,strokeWidth:2}),p.jsx("span",{className:"text-sm",children:"No compose file found in this repository"})]})}),p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(pr,{to:"/apps",children:p.jsx(Ie,{variant:"outline",children:"Cancel"})}),p.jsxs(Ie,{onClick:H,disabled:!u||!C?.found||!N,children:["Next",p.jsx(ae,{icon:Iu,size:16,strokeWidth:2})]})]})]})]})}):p.jsx("div",{className:"mx-auto max-w-2xl",children:p.jsxs(li,{children:[p.jsxs(ME,{children:[p.jsx(jE,{children:"Configure App"}),p.jsxs("p",{className:"text-sm text-muted-foreground",children:[u?.displayName," · ",N?.file]})]}),p.jsxs(Rs,{className:"space-y-6",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx(ko,{htmlFor:"appName",children:"App Name"}),p.jsx(Qt,{id:"appName",value:x,onChange:V=>_(V.target.value),placeholder:"my-app"})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(ko,{htmlFor:"branch",children:"Branch"}),p.jsx(Qt,{id:"branch",value:b,onChange:V=>y(V.target.value),placeholder:L?.defaultBranch??"main"})]}),p.jsxs("div",{className:"space-y-4",children:[p.jsx(ko,{children:"Services"}),p.jsx("div",{className:"space-y-3",children:T.map((V,B)=>p.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"font-medium",children:V.serviceName}),V.containerPort&&p.jsxs(Ta,{variant:"secondary",children:[":",V.containerPort]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Ur,{id:`expose-${B}`,checked:V.exposed,onCheckedChange:j=>F(B,{exposed:j===!0})}),p.jsx(ko,{htmlFor:`expose-${B}`,className:"text-sm",children:"Expose"})]})]}),V.exposed&&p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx(ko,{htmlFor:`domain-${B}`,className:"text-sm",children:"Domain"}),p.jsx(Qt,{id:`domain-${B}`,value:V.domain,onChange:j=>F(B,{domain:j.target.value}),placeholder:"app.example.com"})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(ko,{className:"text-sm",children:"Exposure Method"}),p.jsxs(Wst,{value:V.exposureMethod,onValueChange:j=>F(B,{exposureMethod:j}),className:"flex flex-col gap-2",children:[p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx(PJ,{value:"dns",id:`dns-${B}`}),p.jsx(ko,{htmlFor:`dns-${B}`,className:"text-sm font-normal cursor-pointer",children:"DNS (requires public IP and port forwarding)"})]}),p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx(PJ,{value:"tunnel",id:`tunnel-${B}`,disabled:!s}),p.jsx(ko,{htmlFor:`tunnel-${B}`,className:`text-sm font-normal cursor-pointer ${s?"":"text-muted-foreground"}`,children:"Cloudflare Tunnel (no public IP required)"})]})]}),!s&&p.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure Cloudflare Account ID in settings to enable tunnels"})]})]})]},V.serviceName))})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Ur,{id:"autoDeployEnabled",checked:v,onCheckedChange:V=>S(V===!0)}),p.jsxs(ko,{htmlFor:"autoDeployEnabled",children:["Auto-deploy on push to ",b]})]}),p.jsxs("div",{className:"flex justify-between gap-2",children:[p.jsxs(Ie,{variant:"outline",onClick:()=>l("select-repo"),children:[p.jsx(ae,{icon:dm,size:16,strokeWidth:2}),"Back"]}),p.jsx(Ie,{onClick:G,disabled:!x||a.isPending,children:a.isPending?p.jsxs(p.Fragment,{children:[p.jsx(ae,{icon:Ot,size:16,strokeWidth:2,className:"animate-spin"}),"Creating..."]}):"Create App"})]}),a.error&&p.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[p.jsx(ae,{icon:hr,size:16,strokeWidth:2}),p.jsx("span",{className:"text-sm",children:a.error.message})]})]})]})})})]})}function qst({repo:e,selected:t,onSelect:n}){return p.jsxs("button",{type:"button","data-repo-id":e.id,onClick:n,className:`w-full rounded-lg border p-3 text-left transition-colors ${t?"border-primary bg-primary/5":"border-border hover:border-foreground/20 hover:bg-muted/50"}`,children:[p.jsx("div",{className:"font-medium",children:e.displayName}),p.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate",children:e.path})]})}const Gst=/error|exception|failed|uncaught|fatal|crash|errno|reject/i,Kst=/warning|deprecated|caution|unstable|⚠️/i,Yst=/successfully|completed|listening|connected|ready|started|✓|✅|done|healthy|pulled|created|recreated/i,Xst=/debug|version|config|import|GET|POST|PUT|DELETE/i;function Zst(e){return Gst.test(e)?"error":Kst.test(e)?"warning":Yst.test(e)?"success":Xst.test(e)?"debug":"info"}function SB(e){return e.split(`
|
|
175
|
-
`).filter(t=>t.trim()).map(t=>({message:t,type:Zst(t)}))}var XI,MJ;function Qst(){if(MJ)return XI;MJ=1;var e=/["'&<>]/;XI=t;function t(n){var r=""+n,i=e.exec(r);if(!i)return r;var a,s="",o=0,l=0;for(o=i.index;o<r.length;o++){switch(r.charCodeAt(o)){case 34:a=""";break;case 38:a="&";break;case 39:a="'";break;case 60:a="<";break;case 62:a=">";break;default:continue}l!==o&&(s+=r.substring(l,o)),l=o+1,s+=a}return l!==o?s+r.substring(l,o):s}return XI}var Jst=Qst();const eot=kn(Jst),Dn={black:"#2e3436",red:"#cc0000",green:"#4e9a06",yellow:"#c4a000",blue:"#3465a4",magenta:"#75507b",cyan:"#06989a",white:"#d3d7cf","bright-black":"#555753","bright-red":"#ef2929","bright-green":"#8ae234","bright-yellow":"#fce94f","bright-blue":"#729fcf","bright-magenta":"#ad7fa8","bright-cyan":"#34e2e2","bright-white":"#eeeeec"};function Ofe({onlyFirst:e=!1}={}){const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}const tot=/^(?:\x1b\[([\x3c-\x3f]?)([\d;]*)([\x20-\x2f]?[\x40-\x7e]))|(?:\x1b\[[\x20-\x7e]*([\x00-\x1f:]))/,not=/^\x1b\]8;[\x20-\x3a\x3c-\x7e]*;([\x21-\x7e]{0,512})(?:(?:\x1b\\)|(?:\x07))([\x20-\x7e]+)\x1b\]8;;(?:(?:\x1b\\)|(?:\x07))/,rot=/(?:(\x1b\\)|(\x07))|([\x00-\x06]|[\x08-\x1a]|[\x1c-\x1f])/g;class iot{constructor(t){this.lastIndex=0,this.input=t}next(){const t=this.input.substring(this.lastIndex),n=t.length;if(n===0)return{value:null,done:!0};const r={kind:0,text:"",url:""},i=t.indexOf("\x1B");if(i===-1)return r.kind=1,r.text=t,this.lastIndex+=n,{value:r,done:!1};if(i>0)return r.kind=1,r.text=t.slice(0,i),this.lastIndex+=i,{value:r,done:!1};if(n<3)return{value:null,done:!0};const a=t.charAt(1);if(a!=="["&&a!=="]"&&a!=="(")return r.kind=2,r.text=t[0],this.lastIndex+=1,{value:r,done:!1};if(a==="["){const s=t.match(tot);return s===null?{value:null,done:!0}:s[4]?(r.kind=2,r.text=t[0],this.lastIndex+=1,{value:r,done:!1}):(s[1]!==""||s[3]!=="m"?r.kind=3:r.kind=4,r.text=s[2],this.lastIndex+=s[0].length,{value:r,done:!1})}if(a==="]"){if(n<4)return{value:null,done:!0};if(t.charAt(2)!=="8"||t.charAt(3)!==";")return r.kind=2,r.text=t[0],this.lastIndex+=1,{value:r,done:!1};const s=new RegExp(rot);{const l=s.exec(t);if(l===null)return{value:null,done:!0};if(l[3])return r.kind=2,r.text=t[0],this.lastIndex+=1,{value:r,done:!1}}{const l=s.exec(t);if(l===null)return{value:null,done:!0};if(l[3])return r.kind=2,r.text=t[0],this.lastIndex+=1,{value:r,done:!1}}const o=t.match(not);return o===null?(r.kind=2,r.text=t[0],this.lastIndex+=1,{value:r,done:!1}):(r.kind=5,r.url=o[1],r.text=o[2],this.lastIndex+=o[0].length,{value:r,done:!1})}return a==="("?(r.kind=3,this.lastIndex+=3,{value:r,done:!1}):{value:null,done:!0}}[Symbol.iterator](){return this}}const Rfe=14,Oa=new Array(Rfe);Oa[0]="background-color";Oa[1]="color";Oa[2]="font-family";Oa[3]="font-size";Oa[4]="font-style";Oa[5]="font-weight";Oa[6]="opacity";Oa[7]="outline";Oa[8]="text-decoration";Oa[9]="text-decoration-color";Oa[10]="text-decoration-line";Oa[11]="text-decoration-style";Oa[12]="vertical-align";Oa[13]="visibility";class pa{constructor(){this.attrArray=new Array(Rfe),this._size=0}get(t){return this.attrArray[t]}set(t,n){const r=this.attrArray[t];this.attrArray[t]=n,r===void 0&&n!==void 0&&(this._size+=1)}delete(t){const n=this.attrArray[t];this.attrArray[t]=void 0,n!==void 0&&(this._size-=1)}update(t){for(const n in t)if(t.hasOwnProperty(n)){const r=t[n];this.attrArray[n]=r,r!==void 0&&(this._size+=1)}}clear(){this.attrArray.fill(void 0),this._size=0}get size(){return this._size}toString(){let t="";return this.attrArray.forEach((n,r)=>{n!==void 0&&(t+=`${Oa[r]}:${n};`)}),t}static delete(...t){return n=>{t.forEach(r=>{n.delete(r)})}}static appendVal(t,n){return r=>{const i=r.get(t),a=i?i.split(" "):[];a.includes(n)||a.push(n),r.set(t,a.join(" "))}}static removeVal(t,n){return r=>{const i=r.get(t);let a=i?i.split(" "):[];a=a.filter(s=>s!==n),a.length?r.set(t,a.join(" ")):r.delete(t)}}}Ofe();Ofe({onlyFirst:!0});const _t=new Array(108);_t[0]={5:"var(--ansi-bold-font-weight, 600)"};_t[1]={5:"var(--ansi-bold-font-weight, 600)"};_t[2]={6:"var(--ansi-dim-opacity, 0.7)"};_t[3]={4:"italic"};_t[4]=pa.appendVal(8,"underline");_t[8]={13:"hidden"};_t[9]=pa.appendVal(8,"line-through");_t[10]=pa.delete(2);_t[11]={2:"var(--ansi-font-1)"};_t[12]={2:"var(--ansi-font-2)"};_t[13]={2:"var(--ansi-font-3)"};_t[14]={2:"var(--ansi-font-4)"};_t[15]={2:"var(--ansi-font-5)"};_t[16]={2:"var(--ansi-font-6)"};_t[17]={2:"var(--ansi-font-7)"};_t[18]={2:"var(--ansi-font-8)"};_t[19]={2:"var(--ansi-font-9)"};_t[21]={10:"underline",11:"double"};_t[22]=pa.delete(5);_t[23]=pa.delete(4);_t[24]=pa.removeVal(8,"underline");_t[28]=pa.delete(13);_t[29]=pa.removeVal(8,"line-through");_t[30]={1:`var(--ansi-black, ${Dn.black})`};_t[31]={1:`var(--ansi-red, ${Dn.red})`};_t[32]={1:`var(--ansi-green, ${Dn.green})`};_t[33]={1:`var(--ansi-yellow, ${Dn.yellow})`};_t[34]={1:`var(--ansi-blue, ${Dn.blue})`};_t[35]={1:`var(--ansi-magenta, ${Dn.magenta})`};_t[36]={1:`var(--ansi-cyan, ${Dn.cyan})`};_t[37]={1:`var(--ansi-white, ${Dn.white})`};_t[39]=pa.delete(1);_t[40]={0:`var(--ansi-black, ${Dn.black})`};_t[41]={0:`var(--ansi-red, ${Dn.red})`};_t[42]={0:`var(--ansi-green, ${Dn.green})`};_t[43]={0:`var(--ansi-yellow, ${Dn.yellow})`};_t[44]={0:`var(--ansi-blue, ${Dn.blue})`};_t[45]={0:`var(--ansi-magenta, ${Dn.magenta})`};_t[46]={0:`var(--ansi-cyan, ${Dn.cyan})`};_t[47]={0:`var(--ansi-white, ${Dn.white})`};_t[49]=pa.delete(0);_t[51]={7:"var(--ansi-frame-outline, 1px solid)"};_t[53]=pa.appendVal(8,"overline");_t[54]=pa.delete(7);_t[55]=pa.removeVal(8,"overline");_t[59]=pa.delete(9);_t[73]={12:"super",3:"var(--ansi-superscript-font-size, 80%)"};_t[74]={12:"sub",3:"var(--ansi-subscript-font-size, 80%)"};_t[75]=pa.delete(12,3);_t[90]={1:`var(--ansi-bright-black, ${Dn["bright-black"]})`};_t[91]={1:`var(--ansi-bright-red, ${Dn["bright-red"]})`};_t[92]={1:`var(--ansi-bright-green, ${Dn["bright-green"]})`};_t[93]={1:`var(--ansi-bright-yellow, ${Dn["bright-yellow"]})`};_t[94]={1:`var(--ansi-bright-blue, ${Dn["bright-blue"]})`};_t[95]={1:`var(--ansi-bright-magenta, ${Dn["bright-magenta"]})`};_t[96]={1:`var(--ansi-bright-cyan, ${Dn["bright-cyan"]})`};_t[97]={1:`var(--ansi-bright-white, ${Dn["bright-white"]})`};_t[100]={0:`var(--ansi-bright-black, ${Dn["bright-black"]})`};_t[101]={0:`var(--ansi-bright-red, ${Dn["bright-red"]})`};_t[102]={0:`var(--ansi-bright-green, ${Dn["bright-green"]})`};_t[103]={0:`var(--ansi-bright-yellow, ${Dn["bright-yellow"]})`};_t[104]={0:`var(--ansi-bright-blue, ${Dn["bright-blue"]})`};_t[105]={0:`var(--ansi-bright-magenta, ${Dn["bright-magenta"]})`};_t[106]={0:`var(--ansi-bright-cyan, ${Dn["bright-cyan"]})`};_t[107]={0:`var(--ansi-bright-white, ${Dn["bright-white"]})`};const ta=new Array(16);ta[0]="black";ta[1]="red";ta[2]="green";ta[3]="yellow";ta[4]="blue";ta[5]="magenta";ta[6]="cyan";ta[7]="white";ta[8]="bright-black";ta[9]="bright-red";ta[10]="bright-green";ta[11]="bright-yellow";ta[12]="bright-blue";ta[13]="bright-magenta";ta[14]="bright-cyan";ta[15]="bright-white";function Nfe(e){switch(e){case"38":return 1;case"48":return 0;case"58":return 9;default:throw new Error("not implemented")}}function aot(e,t){const n=e.text.split(";");if(n.length!==3)return;const r=Nfe(n[0]),i=parseInt(n[2],10);if(0<=i&&i<=15){const a=ta[i];t.set(r,`var(--ansi-${a}, ${Dn[a]})`)}else if(16<=i&&i<=231){const a=i-16,s=[0,95,135,175,215,255],o=s[a/36%6|0],l=s[a/6%6|0],u=s[a%6];t.set(r,`rgb(${o},${l},${u})`)}else if(232<=i&&i<=255){const a=8+(i-232)*10;t.set(r,`var(--ansi-gray-${256-i}, rgb(${a},${a},${a}))`)}}function sot(e,t){const n=e.text.split(";");if(n.length!==5)return;const r=Nfe(n[0]),[,,i,a,s]=n;t.set(r,`rgb(${i},${a},${s})`)}function oot(e,t){if(/^(38|48|58);(2|5);/.test(e.text)){e.text[3]==="2"?sot(e,t):aot(e,t);return}e.text.split(";").forEach(n=>{const r=parseInt(n||"0",10);if(r===0){t.clear();return}const i=_t[r];i&&(typeof i=="function"?i(t):t.update(i))})}class lot{toHtml(t){const n=new pa;let r="",i=!1;return Array.from(new iot(t)).forEach(a=>{switch(a.kind){case 1:r+=eot(a.text);break;case 4:i&&(r+="</span>",i=!1),oot(a,n),n.size&&(r+=`<span style="${n.toString()}">`,i=!0);break}}),i&&(r+="</span>"),r}}const uot=new lot,cot={error:{bg:"bg-red-500/10 hover:bg-red-500/15",badge:"bg-red-600/20 text-red-600 dark:bg-red-500/15 dark:text-red-400",border:"bg-red-500"},warning:{bg:"bg-yellow-500/10 hover:bg-yellow-500/15",badge:"bg-yellow-600/20 text-yellow-600 dark:bg-yellow-500/15 dark:text-yellow-400",border:"bg-yellow-500"},success:{bg:"bg-green-500/10 hover:bg-green-500/15",badge:"bg-emerald-600/20 text-emerald-600 dark:bg-emerald-500/15 dark:text-emerald-400",border:"bg-green-500"},info:{bg:"hover:bg-muted/50",badge:"bg-blue-600/20 text-blue-600 dark:bg-blue-500/15 dark:text-blue-400",border:"bg-blue-500"},debug:{bg:"bg-orange-500/10 hover:bg-orange-500/15",badge:"bg-orange-600/20 text-orange-600 dark:bg-orange-500/15 dark:text-orange-400",border:"bg-orange-500"}};function wB({message:e,type:t}){const n=cot[t],r=uot.toHtml(e);return p.jsxs("div",{className:Be("flex items-start gap-2 py-0.5 font-mono text-xs",n.bg),children:[p.jsx("div",{className:Be("w-0.5 self-stretch rounded-full shrink-0",n.border)}),p.jsx("span",{className:Be("shrink-0 rounded px-1 py-0.5 text-[10px] font-medium w-12 text-center",n.badge),children:t}),p.jsx("span",{className:"whitespace-pre-wrap break-all text-foreground",dangerouslySetInnerHTML:{__html:r}})]})}const ZP=Aa("/apps/$appId")({component:pot,validateSearch:e=>({tab:["general","deployments","logs","monitoring"].includes(e.tab)?e.tab:void 0})});function dot(e,t){const n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),i=Math.floor((r-n)/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60),s=i%60;return s===0?`${a}m`:`${a}m ${s}s`}function fot(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n,i=Math.floor(r/6e4);if(i<1)return"just now";if(i<60)return`about ${i} min ago`;const a=Math.floor(i/60);return a<24?`about ${a}h ago`:`about ${Math.floor(a/24)}d ago`}function pot(){const{t:e}=Rt("common"),{appId:t}=ZP.useParams(),{tab:n}=ZP.useSearch(),r=Qr(),{data:i,isLoading:a,error:s}=ILe(t),{data:o}=K3(),l=ose(),u=n||"general",[f,d]=A.useState(!1),m=PLe(),[g,x]=A.useState(!1),_=A.useCallback(()=>{i&&(m.deploy(i.id),x(!0))},[i,m]),b=A.useCallback(T=>{x(T),T||setTimeout(()=>m.reset(),300)},[m]),y=o&&!o.settings.cloudflareConfigured,v=A.useCallback(T=>{r({to:"/apps/$appId",params:{appId:t},search:T==="general"?{}:{tab:T},replace:!0})},[r,t]),S=async()=>{await l.mutateAsync({id:t}),r({to:"/apps"})};return a?p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx(ae,{icon:Ot,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}):s||!i?p.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4",children:[p.jsx(ae,{icon:hr,size:48,strokeWidth:1.5,className:"text-destructive"}),p.jsx("p",{className:"text-muted-foreground",children:s?.message??"App not found"}),p.jsx(pr,{to:"/apps",children:p.jsxs(Ie,{variant:"outline",children:[p.jsx(ae,{icon:dm,size:16,strokeWidth:2}),e("apps.backToApps")]})})]}):p.jsxs("div",{className:"flex h-full flex-col",children:[p.jsxs(jo,{value:u,onValueChange:T=>v(T),className:"flex h-full flex-col",children:[p.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-4 border-b border-border bg-background px-4 py-2",children:[p.jsxs(Gh,{children:[p.jsxs(Kh,{className:"flex items-center gap-2 sm:hidden",children:[p.jsx(ae,{icon:QM,size:18,strokeWidth:2}),p.jsx("span",{className:"text-sm font-medium",children:e(`apps.tabs.${u}`)})]}),p.jsxs(Yh,{align:"start",children:[p.jsx(Ar,{onClick:()=>v("general"),children:e("apps.tabs.general")}),p.jsx(Ar,{onClick:()=>v("deployments"),children:e("apps.tabs.deployments")}),p.jsx(Ar,{onClick:()=>v("logs"),children:e("apps.tabs.logs")}),p.jsx(Ar,{onClick:()=>v("monitoring"),children:e("apps.tabs.monitoring")})]})]}),p.jsxs(Fo,{variant:"line",className:"hidden sm:inline-flex",children:[p.jsx(Sr,{value:"general",className:"px-3 py-1.5",children:e("apps.tabs.general")}),p.jsx(Sr,{value:"deployments",className:"px-3 py-1.5",children:e("apps.tabs.deployments")}),p.jsx(Sr,{value:"logs",className:"px-3 py-1.5",children:e("apps.tabs.logs")}),p.jsx(Sr,{value:"monitoring",className:"px-3 py-1.5",children:e("apps.tabs.monitoring")})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"font-medium text-sm",children:i.name}),i.repository&&p.jsx(pr,{to:"/repositories/$repoId",params:{repoId:i.repository.id},className:"text-muted-foreground hover:text-foreground transition-colors",title:i.repository.displayName,children:p.jsx(ae,{icon:Cu,size:14,strokeWidth:2})}),p.jsx("div",{className:`h-2 w-2 rounded-full ${i.status==="running"?"bg-green-500":i.status==="building"?"bg-yellow-500":i.status==="failed"?"bg-red-500":"bg-gray-400"}`,title:e(`apps.status.${i.status}`)}),y&&p.jsxs(X3,{children:[p.jsx(Z3,{className:"p-1 text-amber-500 hover:text-amber-400 transition-colors",children:p.jsx(ae,{icon:hr,size:14,strokeWidth:2})}),p.jsxs(Q3,{side:"bottom",className:"max-w-xs",children:[p.jsx("p",{className:"font-medium",children:e("apps.manualDnsRequired")}),p.jsx("p",{className:"text-muted-foreground mt-1",children:e("apps.manualDnsRequiredDesc")})]})]}),p.jsx(Ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:()=>d(!0),children:p.jsx(ae,{icon:mo,size:14,strokeWidth:2})})]})]}),p.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[p.jsx(Mr,{value:"general",className:"mt-0",children:p.jsx(hot,{app:i,onDeploy:_,deployStream:m})}),p.jsx(Mr,{value:"deployments",className:"mt-0",children:p.jsx(vot,{appId:t})}),p.jsx(Mr,{value:"logs",className:"mt-0",children:p.jsx(bot,{appId:t,services:i.services})}),p.jsx(Mr,{value:"monitoring",className:"mt-0",children:p.jsx(Cot,{appId:i.id})})]})]}),p.jsx(mot,{appId:t,open:g,onOpenChange:b,logs:m.logs,stage:m.stage,error:m.error,isDeploying:m.isDeploying}),p.jsx(Ns,{open:f,onOpenChange:d,children:p.jsxs(Is,{children:[p.jsxs(Ds,{children:[p.jsx(Ps,{children:e("apps.deleteApp")}),p.jsx(Ms,{children:e("apps.deleteAppConfirm",{name:i.name})})]}),p.jsxs(Ls,{children:[p.jsx(js,{children:e("apps.cancel")}),p.jsx(_d,{onClick:S,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:l.isPending?e("apps.deleting"):e("apps.delete")})]})]})})]})}function hot({app:e,onDeploy:t,deployStream:n}){const{t:r}=Rt("common"),i=lse(),a=use(),s=q3(),o=async()=>{await i.mutateAsync(e.id)},l=async()=>{await a.mutateAsync(e.id)},u=n.isDeploying||e.status==="building",f=async g=>{await s.mutateAsync({id:e.id,updates:{autoDeployEnabled:g}})},d=async g=>{await s.mutateAsync({id:e.id,updates:{noCacheBuild:g}})},m=async g=>{await s.mutateAsync({id:e.id,updates:{notificationsEnabled:g}})};return p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[p.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[p.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:r("apps.general.deploy")}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsxs(Ie,{size:"sm",onClick:t,disabled:u,children:[u?p.jsx(ae,{icon:Ot,size:14,strokeWidth:2,className:"animate-spin"}):p.jsx(ae,{icon:fne,size:14,strokeWidth:2}),n.isDeploying?r("apps.deploying"):e.status==="building"?r("apps.building"):r("apps.deploy")]}),u?p.jsxs(Ie,{variant:"destructive",size:"sm",onClick:l,disabled:a.isPending,children:[a.isPending?p.jsx(ae,{icon:Ot,size:14,strokeWidth:2,className:"animate-spin"}):p.jsx(ae,{icon:xE,size:14,strokeWidth:2}),a.isPending?r("apps.cancelling"):r("apps.cancelDeploy")]}):p.jsxs(p.Fragment,{children:[p.jsxs(Ie,{variant:"outline",size:"sm",onClick:t,disabled:u,children:[p.jsx(ae,{icon:Sw,size:14,strokeWidth:2}),r("apps.general.reload")]}),p.jsxs(Ie,{variant:"destructive",size:"sm",onClick:o,disabled:i.isPending||e.status!=="running",children:[i.isPending?p.jsx(ae,{icon:Ot,size:14,strokeWidth:2,className:"animate-spin"}):p.jsx(ae,{icon:xE,size:14,strokeWidth:2}),r("apps.stop")]})]})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[p.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[p.jsx(Ur,{checked:e.autoDeployEnabled??!1,onCheckedChange:g=>f(g===!0)}),p.jsx("span",{children:r("apps.general.autodeploy")})]}),p.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[p.jsx(Ur,{checked:e.noCacheBuild??!1,onCheckedChange:g=>d(g===!0)}),p.jsx("span",{children:r("apps.general.noCache")})]}),p.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[p.jsx(Ur,{checked:e.notificationsEnabled??!0,onCheckedChange:g=>m(g===!0)}),p.jsx("span",{children:r("apps.general.notifications")})]})]})]}),p.jsx(Eot,{app:e,onDeploy:t})]}),p.jsx(_ot,{app:e}),p.jsx(got,{app:e})]})}function mot({appId:e,open:t,onOpenChange:n,logs:r,stage:i,error:a,isDeploying:s}){const{t:o}=Rt("common"),[l,u]=A.useState(!1),f=A.useRef(null),d=use(),m=A.useMemo(()=>SB(r.join(`
|
|
175
|
+
`).filter(t=>t.trim()).map(t=>({message:t,type:Zst(t)}))}var XI,MJ;function Qst(){if(MJ)return XI;MJ=1;var e=/["'&<>]/;XI=t;function t(n){var r=""+n,i=e.exec(r);if(!i)return r;var a,s="",o=0,l=0;for(o=i.index;o<r.length;o++){switch(r.charCodeAt(o)){case 34:a=""";break;case 38:a="&";break;case 39:a="'";break;case 60:a="<";break;case 62:a=">";break;default:continue}l!==o&&(s+=r.substring(l,o)),l=o+1,s+=a}return l!==o?s+r.substring(l,o):s}return XI}var Jst=Qst();const eot=kn(Jst),Dn={black:"#2e3436",red:"#cc0000",green:"#4e9a06",yellow:"#c4a000",blue:"#3465a4",magenta:"#75507b",cyan:"#06989a",white:"#d3d7cf","bright-black":"#555753","bright-red":"#ef2929","bright-green":"#8ae234","bright-yellow":"#fce94f","bright-blue":"#729fcf","bright-magenta":"#ad7fa8","bright-cyan":"#34e2e2","bright-white":"#eeeeec"};function Ofe({onlyFirst:e=!1}={}){const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}const tot=/^(?:\x1b\[([\x3c-\x3f]?)([\d;]*)([\x20-\x2f]?[\x40-\x7e]))|(?:\x1b\[[\x20-\x7e]*([\x00-\x1f:]))/,not=/^\x1b\]8;[\x20-\x3a\x3c-\x7e]*;([\x21-\x7e]{0,512})(?:(?:\x1b\\)|(?:\x07))([\x20-\x7e]+)\x1b\]8;;(?:(?:\x1b\\)|(?:\x07))/,rot=/(?:(\x1b\\)|(\x07))|([\x00-\x06]|[\x08-\x1a]|[\x1c-\x1f])/g;class iot{constructor(t){this.lastIndex=0,this.input=t}next(){const t=this.input.substring(this.lastIndex),n=t.length;if(n===0)return{value:null,done:!0};const r={kind:0,text:"",url:""},i=t.indexOf("\x1B");if(i===-1)return r.kind=1,r.text=t,this.lastIndex+=n,{value:r,done:!1};if(i>0)return r.kind=1,r.text=t.slice(0,i),this.lastIndex+=i,{value:r,done:!1};if(n<3)return{value:null,done:!0};const a=t.charAt(1);if(a!=="["&&a!=="]"&&a!=="(")return r.kind=2,r.text=t[0],this.lastIndex+=1,{value:r,done:!1};if(a==="["){const s=t.match(tot);return s===null?{value:null,done:!0}:s[4]?(r.kind=2,r.text=t[0],this.lastIndex+=1,{value:r,done:!1}):(s[1]!==""||s[3]!=="m"?r.kind=3:r.kind=4,r.text=s[2],this.lastIndex+=s[0].length,{value:r,done:!1})}if(a==="]"){if(n<4)return{value:null,done:!0};if(t.charAt(2)!=="8"||t.charAt(3)!==";")return r.kind=2,r.text=t[0],this.lastIndex+=1,{value:r,done:!1};const s=new RegExp(rot);{const l=s.exec(t);if(l===null)return{value:null,done:!0};if(l[3])return r.kind=2,r.text=t[0],this.lastIndex+=1,{value:r,done:!1}}{const l=s.exec(t);if(l===null)return{value:null,done:!0};if(l[3])return r.kind=2,r.text=t[0],this.lastIndex+=1,{value:r,done:!1}}const o=t.match(not);return o===null?(r.kind=2,r.text=t[0],this.lastIndex+=1,{value:r,done:!1}):(r.kind=5,r.url=o[1],r.text=o[2],this.lastIndex+=o[0].length,{value:r,done:!1})}return a==="("?(r.kind=3,this.lastIndex+=3,{value:r,done:!1}):{value:null,done:!0}}[Symbol.iterator](){return this}}const Rfe=14,Oa=new Array(Rfe);Oa[0]="background-color";Oa[1]="color";Oa[2]="font-family";Oa[3]="font-size";Oa[4]="font-style";Oa[5]="font-weight";Oa[6]="opacity";Oa[7]="outline";Oa[8]="text-decoration";Oa[9]="text-decoration-color";Oa[10]="text-decoration-line";Oa[11]="text-decoration-style";Oa[12]="vertical-align";Oa[13]="visibility";class pa{constructor(){this.attrArray=new Array(Rfe),this._size=0}get(t){return this.attrArray[t]}set(t,n){const r=this.attrArray[t];this.attrArray[t]=n,r===void 0&&n!==void 0&&(this._size+=1)}delete(t){const n=this.attrArray[t];this.attrArray[t]=void 0,n!==void 0&&(this._size-=1)}update(t){for(const n in t)if(t.hasOwnProperty(n)){const r=t[n];this.attrArray[n]=r,r!==void 0&&(this._size+=1)}}clear(){this.attrArray.fill(void 0),this._size=0}get size(){return this._size}toString(){let t="";return this.attrArray.forEach((n,r)=>{n!==void 0&&(t+=`${Oa[r]}:${n};`)}),t}static delete(...t){return n=>{t.forEach(r=>{n.delete(r)})}}static appendVal(t,n){return r=>{const i=r.get(t),a=i?i.split(" "):[];a.includes(n)||a.push(n),r.set(t,a.join(" "))}}static removeVal(t,n){return r=>{const i=r.get(t);let a=i?i.split(" "):[];a=a.filter(s=>s!==n),a.length?r.set(t,a.join(" ")):r.delete(t)}}}Ofe();Ofe({onlyFirst:!0});const _t=new Array(108);_t[0]={5:"var(--ansi-bold-font-weight, 600)"};_t[1]={5:"var(--ansi-bold-font-weight, 600)"};_t[2]={6:"var(--ansi-dim-opacity, 0.7)"};_t[3]={4:"italic"};_t[4]=pa.appendVal(8,"underline");_t[8]={13:"hidden"};_t[9]=pa.appendVal(8,"line-through");_t[10]=pa.delete(2);_t[11]={2:"var(--ansi-font-1)"};_t[12]={2:"var(--ansi-font-2)"};_t[13]={2:"var(--ansi-font-3)"};_t[14]={2:"var(--ansi-font-4)"};_t[15]={2:"var(--ansi-font-5)"};_t[16]={2:"var(--ansi-font-6)"};_t[17]={2:"var(--ansi-font-7)"};_t[18]={2:"var(--ansi-font-8)"};_t[19]={2:"var(--ansi-font-9)"};_t[21]={10:"underline",11:"double"};_t[22]=pa.delete(5);_t[23]=pa.delete(4);_t[24]=pa.removeVal(8,"underline");_t[28]=pa.delete(13);_t[29]=pa.removeVal(8,"line-through");_t[30]={1:`var(--ansi-black, ${Dn.black})`};_t[31]={1:`var(--ansi-red, ${Dn.red})`};_t[32]={1:`var(--ansi-green, ${Dn.green})`};_t[33]={1:`var(--ansi-yellow, ${Dn.yellow})`};_t[34]={1:`var(--ansi-blue, ${Dn.blue})`};_t[35]={1:`var(--ansi-magenta, ${Dn.magenta})`};_t[36]={1:`var(--ansi-cyan, ${Dn.cyan})`};_t[37]={1:`var(--ansi-white, ${Dn.white})`};_t[39]=pa.delete(1);_t[40]={0:`var(--ansi-black, ${Dn.black})`};_t[41]={0:`var(--ansi-red, ${Dn.red})`};_t[42]={0:`var(--ansi-green, ${Dn.green})`};_t[43]={0:`var(--ansi-yellow, ${Dn.yellow})`};_t[44]={0:`var(--ansi-blue, ${Dn.blue})`};_t[45]={0:`var(--ansi-magenta, ${Dn.magenta})`};_t[46]={0:`var(--ansi-cyan, ${Dn.cyan})`};_t[47]={0:`var(--ansi-white, ${Dn.white})`};_t[49]=pa.delete(0);_t[51]={7:"var(--ansi-frame-outline, 1px solid)"};_t[53]=pa.appendVal(8,"overline");_t[54]=pa.delete(7);_t[55]=pa.removeVal(8,"overline");_t[59]=pa.delete(9);_t[73]={12:"super",3:"var(--ansi-superscript-font-size, 80%)"};_t[74]={12:"sub",3:"var(--ansi-subscript-font-size, 80%)"};_t[75]=pa.delete(12,3);_t[90]={1:`var(--ansi-bright-black, ${Dn["bright-black"]})`};_t[91]={1:`var(--ansi-bright-red, ${Dn["bright-red"]})`};_t[92]={1:`var(--ansi-bright-green, ${Dn["bright-green"]})`};_t[93]={1:`var(--ansi-bright-yellow, ${Dn["bright-yellow"]})`};_t[94]={1:`var(--ansi-bright-blue, ${Dn["bright-blue"]})`};_t[95]={1:`var(--ansi-bright-magenta, ${Dn["bright-magenta"]})`};_t[96]={1:`var(--ansi-bright-cyan, ${Dn["bright-cyan"]})`};_t[97]={1:`var(--ansi-bright-white, ${Dn["bright-white"]})`};_t[100]={0:`var(--ansi-bright-black, ${Dn["bright-black"]})`};_t[101]={0:`var(--ansi-bright-red, ${Dn["bright-red"]})`};_t[102]={0:`var(--ansi-bright-green, ${Dn["bright-green"]})`};_t[103]={0:`var(--ansi-bright-yellow, ${Dn["bright-yellow"]})`};_t[104]={0:`var(--ansi-bright-blue, ${Dn["bright-blue"]})`};_t[105]={0:`var(--ansi-bright-magenta, ${Dn["bright-magenta"]})`};_t[106]={0:`var(--ansi-bright-cyan, ${Dn["bright-cyan"]})`};_t[107]={0:`var(--ansi-bright-white, ${Dn["bright-white"]})`};const ta=new Array(16);ta[0]="black";ta[1]="red";ta[2]="green";ta[3]="yellow";ta[4]="blue";ta[5]="magenta";ta[6]="cyan";ta[7]="white";ta[8]="bright-black";ta[9]="bright-red";ta[10]="bright-green";ta[11]="bright-yellow";ta[12]="bright-blue";ta[13]="bright-magenta";ta[14]="bright-cyan";ta[15]="bright-white";function Nfe(e){switch(e){case"38":return 1;case"48":return 0;case"58":return 9;default:throw new Error("not implemented")}}function aot(e,t){const n=e.text.split(";");if(n.length!==3)return;const r=Nfe(n[0]),i=parseInt(n[2],10);if(0<=i&&i<=15){const a=ta[i];t.set(r,`var(--ansi-${a}, ${Dn[a]})`)}else if(16<=i&&i<=231){const a=i-16,s=[0,95,135,175,215,255],o=s[a/36%6|0],l=s[a/6%6|0],u=s[a%6];t.set(r,`rgb(${o},${l},${u})`)}else if(232<=i&&i<=255){const a=8+(i-232)*10;t.set(r,`var(--ansi-gray-${256-i}, rgb(${a},${a},${a}))`)}}function sot(e,t){const n=e.text.split(";");if(n.length!==5)return;const r=Nfe(n[0]),[,,i,a,s]=n;t.set(r,`rgb(${i},${a},${s})`)}function oot(e,t){if(/^(38|48|58);(2|5);/.test(e.text)){e.text[3]==="2"?sot(e,t):aot(e,t);return}e.text.split(";").forEach(n=>{const r=parseInt(n||"0",10);if(r===0){t.clear();return}const i=_t[r];i&&(typeof i=="function"?i(t):t.update(i))})}class lot{toHtml(t){const n=new pa;let r="",i=!1;return Array.from(new iot(t)).forEach(a=>{switch(a.kind){case 1:r+=eot(a.text);break;case 4:i&&(r+="</span>",i=!1),oot(a,n),n.size&&(r+=`<span style="${n.toString()}">`,i=!0);break}}),i&&(r+="</span>"),r}}const uot=new lot,cot={error:{bg:"bg-red-500/10 hover:bg-red-500/15",badge:"bg-red-600/20 text-red-600 dark:bg-red-500/15 dark:text-red-400",border:"bg-red-500"},warning:{bg:"bg-yellow-500/10 hover:bg-yellow-500/15",badge:"bg-yellow-600/20 text-yellow-600 dark:bg-yellow-500/15 dark:text-yellow-400",border:"bg-yellow-500"},success:{bg:"bg-green-500/10 hover:bg-green-500/15",badge:"bg-emerald-600/20 text-emerald-600 dark:bg-emerald-500/15 dark:text-emerald-400",border:"bg-green-500"},info:{bg:"hover:bg-muted/50",badge:"bg-blue-600/20 text-blue-600 dark:bg-blue-500/15 dark:text-blue-400",border:"bg-blue-500"},debug:{bg:"bg-orange-500/10 hover:bg-orange-500/15",badge:"bg-orange-600/20 text-orange-600 dark:bg-orange-500/15 dark:text-orange-400",border:"bg-orange-500"}};function wB({message:e,type:t}){const n=cot[t],r=uot.toHtml(e);return p.jsxs("div",{className:Be("flex items-start gap-2 py-0.5 font-mono text-xs",n.bg),children:[p.jsx("div",{className:Be("w-0.5 self-stretch rounded-full shrink-0",n.border)}),p.jsx("span",{className:Be("shrink-0 rounded px-1 py-0.5 text-[10px] font-medium w-12 text-center",n.badge),children:t}),p.jsx("span",{className:"whitespace-pre-wrap break-all text-foreground",dangerouslySetInnerHTML:{__html:r}})]})}const ZP=Aa("/apps/$appId")({component:pot,validateSearch:e=>({tab:["general","deployments","logs","monitoring"].includes(e.tab)?e.tab:void 0})});function dot(e,t){const n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),i=Math.floor((r-n)/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60),s=i%60;return s===0?`${a}m`:`${a}m ${s}s`}function fot(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n,i=Math.floor(r/6e4);if(i<1)return"just now";if(i<60)return`about ${i} min ago`;const a=Math.floor(i/60);return a<24?`about ${a}h ago`:`about ${Math.floor(a/24)}d ago`}function pot(){const{t:e}=Rt("common"),{appId:t}=ZP.useParams(),{tab:n}=ZP.useSearch(),r=Qr(),{data:i,isLoading:a,error:s}=ILe(t),{data:o}=K3(),l=ose(),u=n||"general",[f,d]=A.useState(!1),m=PLe(),[g,x]=A.useState(!1),_=A.useCallback(()=>{i&&(m.deploy(i.id),x(!0))},[i,m]),b=A.useCallback(T=>{x(T),T||setTimeout(()=>m.reset(),300)},[m]),y=o&&!o.settings.cloudflareConfigured,v=A.useCallback(T=>{r({to:"/apps/$appId",params:{appId:t},search:T==="general"?{}:{tab:T},replace:!0})},[r,t]),S=async()=>{await l.mutateAsync({id:t}),r({to:"/apps"})};return a?p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx(ae,{icon:Ot,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}):s||!i?p.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4",children:[p.jsx(ae,{icon:hr,size:48,strokeWidth:1.5,className:"text-destructive"}),p.jsx("p",{className:"text-muted-foreground",children:s?.message??"App not found"}),p.jsx(pr,{to:"/apps",children:p.jsxs(Ie,{variant:"outline",children:[p.jsx(ae,{icon:dm,size:16,strokeWidth:2}),e("apps.backToApps")]})})]}):p.jsxs("div",{className:"flex h-full flex-col",children:[p.jsxs(jo,{value:u,onValueChange:T=>v(T),className:"flex h-full flex-col",children:[p.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-4 border-b border-border bg-background px-4 py-2",children:[p.jsxs(Gh,{children:[p.jsxs(Kh,{className:"flex items-center gap-2 sm:hidden",children:[p.jsx(ae,{icon:QM,size:18,strokeWidth:2}),p.jsx("span",{className:"text-sm font-medium",children:e(`apps.tabs.${u}`)})]}),p.jsxs(Yh,{align:"start",children:[p.jsx(Ar,{onClick:()=>v("general"),children:e("apps.tabs.general")}),p.jsx(Ar,{onClick:()=>v("deployments"),children:e("apps.tabs.deployments")}),p.jsx(Ar,{onClick:()=>v("logs"),children:e("apps.tabs.logs")}),p.jsx(Ar,{onClick:()=>v("monitoring"),children:e("apps.tabs.monitoring")})]})]}),p.jsxs(Fo,{variant:"line",className:"hidden sm:inline-flex",children:[p.jsx(Sr,{value:"general",className:"px-3 py-1.5",children:e("apps.tabs.general")}),p.jsx(Sr,{value:"deployments",className:"px-3 py-1.5",children:e("apps.tabs.deployments")}),p.jsx(Sr,{value:"logs",className:"px-3 py-1.5",children:e("apps.tabs.logs")}),p.jsx(Sr,{value:"monitoring",className:"px-3 py-1.5",children:e("apps.tabs.monitoring")})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"font-medium text-sm",children:i.name}),i.repository&&p.jsx(pr,{to:"/repositories/$repoId",params:{repoId:i.repository.id},className:"text-muted-foreground hover:text-foreground transition-colors",title:i.repository.displayName,children:p.jsx(ae,{icon:Cu,size:14,strokeWidth:2})}),p.jsx("div",{className:`h-2 w-2 rounded-full ${i.status==="running"?"bg-green-500":i.status==="building"?"bg-yellow-500":i.status==="failed"?"bg-red-500":"bg-gray-400"}`,title:e(`apps.status.${i.status}`)}),y&&p.jsxs(X3,{children:[p.jsx(Z3,{className:"p-1 text-amber-500 hover:text-amber-400 transition-colors",children:p.jsx(ae,{icon:hr,size:14,strokeWidth:2})}),p.jsxs(Q3,{side:"bottom",className:"max-w-xs",children:[p.jsx("p",{className:"font-medium",children:e("apps.manualDnsRequired")}),p.jsx("p",{className:"text-muted-foreground mt-1",children:e("apps.manualDnsRequiredDesc")})]})]}),p.jsx(Ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:()=>d(!0),children:p.jsx(ae,{icon:mo,size:14,strokeWidth:2})})]})]}),p.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[p.jsx(Mr,{value:"general",className:"mt-0",children:p.jsx(hot,{app:i,onDeploy:_,deployStream:m})}),p.jsx(Mr,{value:"deployments",className:"mt-0",children:p.jsx(vot,{appId:t})}),p.jsx(Mr,{value:"logs",className:"mt-0",children:p.jsx(bot,{appId:t,services:i.services})}),p.jsx(Mr,{value:"monitoring",className:"mt-0",children:p.jsx(Tot,{appId:i.id,repoDisplayName:i.repository?.displayName})})]})]}),p.jsx(mot,{appId:t,open:g,onOpenChange:b,logs:m.logs,stage:m.stage,error:m.error,isDeploying:m.isDeploying}),p.jsx(Ns,{open:f,onOpenChange:d,children:p.jsxs(Is,{children:[p.jsxs(Ds,{children:[p.jsx(Ps,{children:e("apps.deleteApp")}),p.jsx(Ms,{children:e("apps.deleteAppConfirm",{name:i.name})})]}),p.jsxs(Ls,{children:[p.jsx(js,{children:e("apps.cancel")}),p.jsx(_d,{onClick:S,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:l.isPending?e("apps.deleting"):e("apps.delete")})]})]})})]})}function hot({app:e,onDeploy:t,deployStream:n}){const{t:r}=Rt("common"),i=lse(),a=use(),s=q3(),o=async()=>{await i.mutateAsync(e.id)},l=async()=>{await a.mutateAsync(e.id)},u=n.isDeploying||e.status==="building",f=async g=>{await s.mutateAsync({id:e.id,updates:{autoDeployEnabled:g}})},d=async g=>{await s.mutateAsync({id:e.id,updates:{noCacheBuild:g}})},m=async g=>{await s.mutateAsync({id:e.id,updates:{notificationsEnabled:g}})};return p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[p.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[p.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:r("apps.general.deploy")}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsxs(Ie,{size:"sm",onClick:t,disabled:u,children:[u?p.jsx(ae,{icon:Ot,size:14,strokeWidth:2,className:"animate-spin"}):p.jsx(ae,{icon:fne,size:14,strokeWidth:2}),n.isDeploying?r("apps.deploying"):e.status==="building"?r("apps.building"):r("apps.deploy")]}),u?p.jsxs(Ie,{variant:"destructive",size:"sm",onClick:l,disabled:a.isPending,children:[a.isPending?p.jsx(ae,{icon:Ot,size:14,strokeWidth:2,className:"animate-spin"}):p.jsx(ae,{icon:xE,size:14,strokeWidth:2}),a.isPending?r("apps.cancelling"):r("apps.cancelDeploy")]}):p.jsxs(p.Fragment,{children:[p.jsxs(Ie,{variant:"outline",size:"sm",onClick:t,disabled:u,children:[p.jsx(ae,{icon:Sw,size:14,strokeWidth:2}),r("apps.general.reload")]}),p.jsxs(Ie,{variant:"destructive",size:"sm",onClick:o,disabled:i.isPending||e.status!=="running",children:[i.isPending?p.jsx(ae,{icon:Ot,size:14,strokeWidth:2,className:"animate-spin"}):p.jsx(ae,{icon:xE,size:14,strokeWidth:2}),r("apps.stop")]})]})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[p.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[p.jsx(Ur,{checked:e.autoDeployEnabled??!1,onCheckedChange:g=>f(g===!0)}),p.jsx("span",{children:r("apps.general.autodeploy")})]}),p.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[p.jsx(Ur,{checked:e.noCacheBuild??!1,onCheckedChange:g=>d(g===!0)}),p.jsx("span",{children:r("apps.general.noCache")})]}),p.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[p.jsx(Ur,{checked:e.notificationsEnabled??!0,onCheckedChange:g=>m(g===!0)}),p.jsx("span",{children:r("apps.general.notifications")})]})]})]}),p.jsx(Eot,{app:e,onDeploy:t})]}),p.jsx(_ot,{app:e}),p.jsx(got,{app:e})]})}function mot({appId:e,open:t,onOpenChange:n,logs:r,stage:i,error:a,isDeploying:s}){const{t:o}=Rt("common"),[l,u]=A.useState(!1),f=A.useRef(null),d=use(),m=A.useMemo(()=>SB(r.join(`
|
|
176
176
|
`)),[r]);A.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[r]);const g=async()=>{await navigator.clipboard.writeText(r.join(`
|
|
177
177
|
`)),u(!0),setTimeout(()=>u(!1),2e3)},x=async()=>{await d.mutateAsync(e)},_=b=>{switch(b){case"pulling":return o("apps.streaming.pulling");case"building":return o("apps.streaming.building");case"starting":return o("apps.streaming.starting");case"configuring":return o("apps.streaming.configuring");case"done":return o("apps.streaming.done");case"failed":return o("apps.streaming.failed");case"cancelled":return o("apps.streaming.cancelled");default:return o("apps.streaming.preparing")}};return p.jsx(Xo,{open:t,onOpenChange:n,children:p.jsxs(Zo,{className:"!max-w-[90vw] w-[90vw] h-[85vh] flex flex-col",children:[p.jsxs(Ul,{children:[p.jsxs($l,{className:"flex items-center gap-2",children:[o("apps.deployments.deployment"),s&&p.jsx(ae,{icon:Ot,size:16,strokeWidth:2,className:"animate-spin"}),!s&&!a&&i==="done"&&p.jsx(ae,{icon:Pl,size:16,strokeWidth:2,className:"text-green-500"}),a&&p.jsx(ae,{icon:hr,size:16,strokeWidth:2,className:"text-destructive"})]}),p.jsxs(mp,{className:"flex items-center gap-2",children:[_(i),s&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground",children:"|"}),p.jsxs(Ie,{variant:"destructive",size:"sm",onClick:x,disabled:d.isPending,children:[d.isPending?p.jsx(ae,{icon:Ot,size:14,strokeWidth:2,className:"animate-spin"}):p.jsx(ae,{icon:xE,size:14,strokeWidth:2}),d.isPending?o("apps.cancelling"):o("apps.cancelDeploy")]})]}),p.jsx("span",{className:"text-muted-foreground",children:"|"}),p.jsxs("span",{children:[m.length," ",o("apps.logs.lines")]}),p.jsx(Ie,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:g,disabled:r.length===0,children:p.jsx(ae,{icon:l?Pl:_w,size:14,strokeWidth:2,className:l?"text-green-500":""})})]})]}),p.jsxs("div",{ref:f,className:"flex-1 overflow-auto rounded-lg border bg-muted/30 p-2 custom-logs-scrollbar",children:[m.length>0?m.map((b,y)=>p.jsx(wB,{message:b.message,type:b.type},y)):s?p.jsx("span",{className:"text-muted-foreground p-2",children:o("apps.streaming.waitingForLogs")}):p.jsx("span",{className:"text-muted-foreground p-2",children:o("apps.deployments.noBuildLogs")}),a&&p.jsxs("div",{className:"mt-2 p-2 rounded bg-destructive/10 text-destructive text-sm",children:[o("status.error"),": ",a]})]})]})})}function got({app:e}){const{t}=Rt("common"),n=e.repository?.path??null,{data:r,isLoading:i,error:a}=BLe(n,e.composeFile),s=ULe(),o=$Le(),[l,u]=A.useState(""),[f,d]=A.useState(!1),[m,g]=A.useState(!1),[x,_]=A.useState(!1),b=A.useRef(void 0);A.useEffect(()=>{r?.content!==void 0&&(u(r.content),g(!1))},[r?.content]);const y=A.useCallback(S=>{u(S),g(!0),_(!1),b.current&&clearTimeout(b.current),f&&n&&e.composeFile&&(b.current=setTimeout(()=>{s.mutate({repoPath:n,composeFile:e.composeFile,content:S},{onSuccess:()=>{g(!1),_(!0),setTimeout(()=>_(!1),2e3),o.mutate(e.id)}})},1e3))},[f,n,e.composeFile,e.id,s,o]);A.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]);const v=()=>{f&&m&&n&&e.composeFile&&s.mutate({repoPath:n,composeFile:e.composeFile,content:l},{onSuccess:()=>{g(!1),_(!0),setTimeout(()=>_(!1),2e3),o.mutate(e.id)}}),d(!f)};return n?i?p.jsxs("div",{className:"rounded-lg border p-4",children:[p.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-3",children:t("apps.compose.title")}),p.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[p.jsx(ae,{icon:Ot,size:16,strokeWidth:2,className:"animate-spin"}),p.jsx("span",{className:"text-sm",children:t("status.loading")})]})]}):a?p.jsxs("div",{className:"rounded-lg border p-4",children:[p.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-3",children:t("apps.compose.title")}),p.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[p.jsx(ae,{icon:hr,size:16,strokeWidth:2}),p.jsx("span",{className:"text-sm",children:a.message})]})]}):p.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:t("apps.compose.title")}),p.jsxs("div",{className:"flex items-center gap-2",children:[m&&f&&p.jsx("span",{className:"text-xs text-muted-foreground",children:t("apps.compose.unsaved")}),x&&p.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-500",children:[p.jsx(ae,{icon:Pl,size:12,strokeWidth:2}),t("status.saved")]}),s.isPending&&p.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[p.jsx(ae,{icon:Ot,size:12,strokeWidth:2,className:"animate-spin"}),t("status.saving")]}),p.jsx("span",{className:"text-sm text-muted-foreground",children:e.composeFile}),p.jsxs(Ie,{variant:f?"default":"outline",size:"sm",onClick:v,children:[p.jsx(ae,{icon:Wxe,size:14,strokeWidth:2}),t(f?"apps.compose.done":"apps.compose.edit")]})]})]}),p.jsx("div",{className:"h-[400px] rounded-md border overflow-hidden",children:p.jsx(lce,{filePath:e.composeFile,content:l,onChange:y,readOnly:!f})})]}):p.jsxs("div",{className:"rounded-lg border p-4",children:[p.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-3",children:t("apps.compose.title")}),p.jsx("p",{className:"text-sm text-muted-foreground",children:t("apps.compose.repoNotFound")})]})}function bot({appId:e,services:t}){const{t:n}=Rt("common"),{data:r}=cse(e),[i,a]=A.useState(),[s,o]=A.useState(100),{data:l,isLoading:u,refetch:f}=MLe(e,i,s),[d,m]=A.useState(!1),g=A.useMemo(()=>SB(l?.logs??""),[l?.logs]),x=async()=>{l?.logs&&(await navigator.clipboard.writeText(l.logs),m(!0),setTimeout(()=>m(!1),2e3))},_=()=>{if(l?.logs){const y=new Blob([l.logs],{type:"text/plain"}),v=URL.createObjectURL(y),S=document.createElement("a");S.href=v,S.download=`${e}-${i??"all"}-logs.txt`,document.body.appendChild(S),S.click(),document.body.removeChild(S),URL.revokeObjectURL(v)}},b=r?.containers??[];return p.jsxs("div",{className:"space-y-4 max-w-4xl",children:[p.jsxs("div",{children:[p.jsx("h3",{className:"text-lg font-semibold",children:n("apps.logs.title")}),p.jsx("p",{className:"text-sm text-muted-foreground",children:n("apps.logs.description")})]}),p.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[p.jsxs("select",{value:i??"",onChange:y=>a(y.target.value||void 0),className:"rounded-md border bg-background px-3 py-2 text-sm min-w-[240px]",children:[p.jsx("option",{value:"",children:n("apps.logs.allContainers")}),b.length>0?b.map(y=>p.jsxs("option",{value:y.service,children:[y.service," (",y.name.slice(-12),") [",y.status,"]"]},y.name)):t?.map(y=>p.jsx("option",{value:y.serviceName,children:y.serviceName},y.id))]}),p.jsxs("select",{value:s,onChange:y=>o(parseInt(y.target.value,10)),className:"rounded-md border bg-background px-3 py-2 text-sm",children:[p.jsxs("option",{value:50,children:["50 ",n("apps.logs.lines")]}),p.jsxs("option",{value:100,children:["100 ",n("apps.logs.lines")]}),p.jsxs("option",{value:500,children:["500 ",n("apps.logs.lines")]}),p.jsxs("option",{value:1e3,children:["1000 ",n("apps.logs.lines")]})]}),p.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[p.jsxs(Ie,{variant:"outline",size:"sm",onClick:x,disabled:!l?.logs,children:[p.jsx(ae,{icon:d?Pl:_w,size:14,strokeWidth:2,className:d?"text-green-500":""}),n(d?"apps.logs.copied":"apps.logs.copy")]}),p.jsxs(Ie,{variant:"outline",size:"sm",onClick:_,disabled:!l?.logs,children:[p.jsx(ae,{icon:dm,size:14,strokeWidth:2,className:"rotate-[-90deg]"}),n("apps.logs.download")]}),p.jsxs(Ie,{variant:"outline",size:"sm",onClick:()=>f(),children:[p.jsx(ae,{icon:Sw,size:14,strokeWidth:2}),n("apps.logs.refresh")]})]})]}),p.jsx("div",{className:"rounded-lg border bg-muted/30 p-2 overflow-auto max-h-[600px] min-h-[300px] custom-logs-scrollbar",children:u?p.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground p-2",children:[p.jsx(ae,{icon:Ot,size:14,strokeWidth:2,className:"animate-spin"}),n("status.loading")]}):g.length>0?g.map((y,v)=>p.jsx(wB,{message:y.message,type:y.type},v)):p.jsx("span",{className:"text-muted-foreground p-2",children:n("apps.logs.noLogs")})})]})}function vot({appId:e}){const{t}=Rt("common"),{data:n,isLoading:r}=jLe(e),[i,a]=A.useState(null);return r?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx(ae,{icon:Ot,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}):p.jsxs("div",{className:"max-w-3xl",children:[p.jsxs("div",{className:"mb-4",children:[p.jsx("h3",{className:"text-lg font-semibold",children:t("apps.deployments.title")}),p.jsx("p",{className:"text-sm text-muted-foreground",children:t("apps.deployments.description")})]}),n?.length?p.jsx("div",{className:"border rounded-lg divide-y",children:n.map((s,o)=>p.jsx(yot,{deployment:s,number:o+1,onViewLogs:()=>a(s)},s.id))}):p.jsx("div",{className:"py-8 text-center text-muted-foreground border rounded-lg",children:p.jsx("p",{children:t("apps.deployments.noDeployments")})}),p.jsx(xot,{deployment:i,open:!!i,onOpenChange:s=>!s&&a(null)})]})}function yot({deployment:e,number:t,onViewLogs:n}){const{t:r}=Rt("common"),i=()=>{switch(e.status){case"running":return{text:r("apps.deployments.statusDone"),color:"bg-green-500"};case"failed":return{text:r("apps.deployments.statusError"),color:"bg-red-500"};case"building":case"pending":return{text:r("apps.deployments.statusBuilding"),color:"bg-yellow-500"};default:return{text:e.status,color:"bg-gray-400"}}},{text:a,color:s}=i();return p.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("span",{className:"text-muted-foreground w-6",children:[t,"."]}),p.jsx("span",{className:"font-medium",children:a}),p.jsx("div",{className:`h-2 w-2 rounded-full ${s}`})]}),p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx("span",{className:"text-sm text-muted-foreground",children:fot(e.startedAt)}),p.jsxs("span",{className:"text-sm text-muted-foreground",children:["⏱ ",dot(e.startedAt,e.completedAt)]}),p.jsx(Ie,{size:"sm",onClick:n,children:r("apps.deployments.view")})]})]})}function xot({deployment:e,open:t,onOpenChange:n}){const{t:r}=Rt("common"),[i,a]=A.useState(!1),s=A.useMemo(()=>SB(e?.buildLogs??""),[e?.buildLogs]),o=async()=>{e?.buildLogs&&(await navigator.clipboard.writeText(e.buildLogs),a(!0),setTimeout(()=>a(!1),2e3))};return p.jsx(Xo,{open:t,onOpenChange:n,children:p.jsxs(Zo,{className:"!max-w-[90vw] w-[90vw] h-[85vh] flex flex-col",children:[p.jsxs(Ul,{children:[p.jsx($l,{children:r("apps.deployments.deployment")}),p.jsxs(mp,{className:"flex items-center gap-2",children:[r("apps.deployments.seeDetails"),p.jsx("span",{className:"text-muted-foreground",children:"|"}),p.jsxs("span",{children:[s.length," ",r("apps.logs.lines")]}),p.jsx(Ie,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:o,children:p.jsx(ae,{icon:i?Pl:_w,size:14,strokeWidth:2,className:i?"text-green-500":""})})]})]}),p.jsx("div",{className:"flex-1 overflow-auto rounded-lg border bg-muted/30 p-2 custom-logs-scrollbar",children:s.length>0?s.map((l,u)=>p.jsx(wB,{message:l.message,type:l.type},u)):p.jsx("span",{className:"text-muted-foreground p-2",children:r("apps.deployments.noBuildLogs")})})]})})}function _ot({app:e}){const{t}=Rt("common"),n=q3(),[r,i]=A.useState(()=>{const d=e.environmentVariables??{};return Object.entries(d).map(([m,g])=>`${m}=${g}`).join(`
|
|
178
178
|
`)}),[a,s]=A.useState(!1),[o,l]=A.useState(!0),u=A.useMemo(()=>o?r.split(`
|
|
179
179
|
`).map(d=>{const m=d.trim();if(!m||m.startsWith("#"))return d;const g=m.indexOf("=");return g>0?`${m.slice(0,g)}=••••••`:d}).join(`
|
|
180
180
|
`):r,[r,o]),f=async()=>{const d={};r.split(`
|
|
181
|
-
`).forEach(m=>{const g=m.trim();if(!g||g.startsWith("#"))return;const x=g.indexOf("=");if(x>0){const _=g.slice(0,x).trim(),b=g.slice(x+1).trim();_&&(d[_]=b)}}),await n.mutateAsync({id:e.id,updates:{environmentVariables:d}}),s(!0),setTimeout(()=>s(!1),2e3)};return p.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:t("apps.environment.title")}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(X3,{children:[p.jsx(Z3,{className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",onClick:()=>l(!o),children:p.jsx(ae,{icon:o?o_e:Vxe,size:14,strokeWidth:2})}),p.jsx(Q3,{children:t(o?"apps.environment.showValues":"apps.environment.hideValues")})]}),p.jsx(Ie,{size:"sm",onClick:f,disabled:n.isPending,children:n.isPending?p.jsxs(p.Fragment,{children:[p.jsx(ae,{icon:Ot,size:14,strokeWidth:2,className:"animate-spin"}),t("status.saving")]}):a?p.jsxs(p.Fragment,{children:[p.jsx(ae,{icon:Pl,size:14,strokeWidth:2,className:"text-green-500"}),t("status.saved")]}):t("apps.environment.save")})]})]}),p.jsx(kw,{value:o?u:r,onChange:d=>{o||i(d.target.value)},onFocus:()=>{o&&l(!1)},placeholder:t("apps.environment.placeholder"),className:"font-mono text-sm min-h-[120px]",readOnly:o}),n.error&&p.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[p.jsx(ae,{icon:hr,size:14,strokeWidth:2}),p.jsx("span",{className:"text-sm",children:n.error.message})]})]})}function Eot({app:e,onDeploy:t}){const{t:n}=Rt("common"),{data:r}=cse(e.id),{data:i}=Y3(),a=q3(),s=i?.tunnelsAvailable??!1,[o,l]=A.useState(e.services?.map(b=>({serviceName:b.serviceName,containerPort:b.containerPort,domain:b.domain??"",exposureMethod:b.exposureMethod??"dns"}))??[]),[u,f]=A.useState(null);A.useEffect(()=>{u===null&&l(e.services?.map(b=>({serviceName:b.serviceName,containerPort:b.containerPort,domain:b.domain??"",exposureMethod:b.exposureMethod??"dns"}))??[])},[e.services,u]);const d=b=>{if(r?.containers){const y=r.containers.find(v=>v.service===b);if(y)return y.status}return"stopped"},m=async()=>{await a.mutateAsync({id:e.id,updates:{services:o.map(b=>({serviceName:b.serviceName,containerPort:b.containerPort??void 0,exposed:!!b.domain,domain:b.domain||void 0,exposureMethod:b.exposureMethod}))}}),f(null),Nt.warning(n("apps.deployToApply"),{description:n("apps.deployToApplyDesc"),action:{label:n("apps.deploy"),onClick:t}})},g=(b,y)=>{l(v=>v.map((S,T)=>T===b?{...S,...y}:S))},x=b=>{u===b?m():f(b)},_=()=>{l(e.services?.map(b=>({serviceName:b.serviceName,containerPort:b.containerPort,domain:b.domain??"",exposureMethod:b.exposureMethod??"dns"}))??[]),f(null)};return p.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[p.jsx("div",{className:"flex items-center justify-between",children:p.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:n("apps.general.services")})}),o.length>0?p.jsx("div",{className:"space-y-2",children:o.map((b,y)=>{const v=d(b.serviceName),S=v==="running",T=u===y,w=!!b.containerPort,C=!!b.domain;return p.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[p.jsx("div",{className:`h-2 w-2 shrink-0 rounded-full ${S?"bg-green-500":"bg-gray-400"}`,title:v}),p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 shrink-0",children:[p.jsx("span",{className:"font-medium",children:b.serviceName}),b.containerPort&&p.jsxs(Ta,{variant:"secondary",className:"text-xs px-1.5 py-0",children:[":",b.containerPort]})]}),p.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:T?p.jsxs(p.Fragment,{children:[p.jsx(Qt,{value:b.domain,onChange:R=>g(y,{domain:R.target.value}),placeholder:"app.example.com",className:"h-7 text-xs flex-1",autoFocus:!0,disabled:!w}),p.jsxs("select",{value:b.exposureMethod,onChange:R=>g(y,{exposureMethod:R.target.value}),className:"h-7 rounded-md border bg-background px-2 text-xs shrink-0",disabled:!w,children:[p.jsx("option",{value:"dns",children:"DNS"}),p.jsxs("option",{value:"tunnel",disabled:!s,children:["Tunnel",s?"":" (unavailable)"]})]})]}):C?p.jsxs(p.Fragment,{children:[p.jsx("a",{href:`https://${b.domain}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate",children:b.domain}),p.jsx(Ta,{variant:b.exposureMethod==="tunnel"?"default":"outline",className:"text-xs px-1.5 py-0 shrink-0",children:b.exposureMethod==="tunnel"?"Tunnel":"DNS"})]}):p.jsx("span",{className:"text-muted-foreground/50 text-xs",children:n(w?"apps.domains.noDomain":"apps.domains.portRequired")})}),T?p.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[p.jsx(Ie,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>x(y),disabled:a.isPending,title:n("apps.domains.save"),children:a.isPending?p.jsx(ae,{icon:Ot,size:14,strokeWidth:2,className:"animate-spin"}):p.jsx(ae,{icon:Pl,size:14,strokeWidth:2,className:"text-green-500"})}),p.jsx(Ie,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:_,title:n("apps.cancel"),children:p.jsx(ae,{icon:Zr,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}):p.jsx(Ie,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>x(y),disabled:!w,title:n(w?"apps.domains.editDomain":"apps.domains.exposeRequiresPort"),children:p.jsx(ae,{icon:r_e,size:14,strokeWidth:2,className:w?"text-muted-foreground":"text-muted-foreground/30"})})]},b.serviceName)})}):p.jsx("p",{className:"text-sm text-muted-foreground",children:n("apps.general.noServicesConfigured")}),a.error&&p.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[p.jsx(ae,{icon:hr,size:14,strokeWidth:2}),p.jsx("span",{className:"text-sm",children:a.error.message})]})]})}function Sot(e){const t=e.split("_");if(t.length>=2)return t[1].split(".")[0];const n=e.split(/[-_.]/);for(const r of n.slice(1))if(r&&!r.match(/^\d+$/)&&r.length>2)return r;return e}const jJ=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)"];function FJ({data:e,label:t,totalValue:n,unit:r}){return p.jsxs("div",{className:"flex flex-col items-center",children:[p.jsxs("div",{className:"relative size-28",children:[p.jsx(goe,{width:"100%",height:"100%",children:p.jsxs(JVe,{children:[p.jsx(lc,{data:e,cx:"50%",cy:"50%",innerRadius:32,outerRadius:48,paddingAngle:2,dataKey:"value",stroke:"none",children:e.map((i,a)=>p.jsx(W0,{fill:i.color},`cell-${a}`))}),p.jsx(Ro,{content:({active:i,payload:a})=>{if(i&&a&&a.length){const s=a[0].payload;return p.jsxs("div",{className:"bg-popover border rounded-md px-2 py-1 text-xs shadow-md",children:[p.jsx("p",{className:"font-medium",children:s.name}),p.jsxs("p",{className:"text-muted-foreground",children:[s.value.toFixed(1)," ",r]})]})}return null}})]})}),p.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[p.jsx("span",{className:"text-sm font-semibold tabular-nums",children:n}),p.jsx("span",{className:"text-[10px] text-muted-foreground",children:r})]})]}),p.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:t})]})}function wot({containers:e}){const{t}=Rt("common"),n=e.reduce((o,l)=>o+l.cpuPercent,0),r=e.reduce((o,l)=>o+l.memoryMB,0),i=e.map((o,l)=>({name:Sot(o.name),cpu:o.cpuPercent,memory:o.memoryMB,color:jJ[l%jJ.length]})),a=i.map(o=>({name:o.name,value:o.cpu,color:o.color})),s=i.map(o=>({name:o.name,value:o.memory,color:o.color}));return p.jsxs(li,{className:"p-4 mb-6",children:[p.jsx("h4",{className:"text-sm font-medium mb-4",children:t("apps.monitoring.serviceTotal")}),p.jsxs("div",{className:"flex items-center justify-center gap-8",children:[p.jsx(FJ,{data:a,label:t("apps.monitoring.cpu"),totalValue:n.toFixed(1),unit:"%"}),p.jsx(FJ,{data:s,label:t("apps.monitoring.memory"),totalValue:r.toFixed(0),unit:"MB"})]}),p.jsx("div",{className:"flex flex-wrap justify-center gap-x-4 gap-y-1 mt-4",children:i.map(o=>p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("div",{className:"size-2.5 rounded-full",style:{backgroundColor:o.color}}),p.jsx("span",{className:"text-xs text-muted-foreground",children:o.name})]},o.name))})]})}function Cot({appId:e}){const{t}=Rt("common"),{data:n,isLoading:r}=Hue(),i=A.useMemo(()=>{if(!n?.containers)return[];const a=`vibora-${e.slice(0,8).toLowerCase()}_`;return n.containers.filter(s=>s.name.toLowerCase().startsWith(a))},[n,e]);return r?p.jsx("div",{className:"flex items-center justify-center py-12",children:p.jsx(ae,{icon:Ot,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}):n?.available?i.length===0?p.jsxs("div",{className:"max-w-2xl",children:[p.jsxs("div",{className:"mb-4",children:[p.jsx("h3",{className:"text-lg font-semibold",children:t("apps.monitoring.title")}),p.jsx("p",{className:"text-sm text-muted-foreground",children:t("apps.monitoring.description")})]}),p.jsx("div",{className:"py-8 text-center text-muted-foreground border rounded-lg",children:p.jsx("p",{children:t("apps.monitoring.noContainers")})})]}):p.jsxs("div",{className:"max-w-4xl",children:[p.jsxs("div",{className:"mb-4",children:[p.jsx("h3",{className:"text-lg font-semibold",children:t("apps.monitoring.title")}),p.jsxs("p",{className:"text-sm text-muted-foreground",children:[t("apps.monitoring.description"),n.runtime&&p.jsxs("span",{className:"ml-1 text-xs",children:["(",n.runtime,")"]})]})]}),p.jsx(wot,{containers:i})]}):p.jsxs("div",{className:"max-w-2xl",children:[p.jsxs("div",{className:"mb-4",children:[p.jsx("h3",{className:"text-lg font-semibold",children:t("apps.monitoring.title")}),p.jsx("p",{className:"text-sm text-muted-foreground",children:t("apps.monitoring.description")})]}),p.jsx("div",{className:"py-8 text-center text-muted-foreground border rounded-lg",children:p.jsx("p",{children:t("apps.monitoring.dockerUnavailable")})})]})}const Tot=hIe.update({id:"/",path:"/",getParentRoute:()=>ns}),Aot=yIe.update({id:"/worktrees/",path:"/worktrees/",getParentRoute:()=>ns}),kot=bLe.update({id:"/terminals/",path:"/terminals/",getParentRoute:()=>ns}),Oot=ase.update({id:"/tasks/",path:"/tasks/",getParentRoute:()=>ns}),Rot=WLe.update({id:"/settings/",path:"/settings/",getParentRoute:()=>ns}),Not=ePe.update({id:"/review/",path:"/review/",getParentRoute:()=>ns}),Iot=oPe.update({id:"/repositories/",path:"/repositories/",getParentRoute:()=>ns}),Dot=Wue.update({id:"/monitoring/",path:"/monitoring/",getParentRoute:()=>ns}),Lot=Vue.update({id:"/apps/",path:"/apps/",getParentRoute:()=>ns}),Pot=YP.update({id:"/tasks/$taskId",path:"/tasks/$taskId",getParentRoute:()=>ns}),Mot=XP.update({id:"/repositories/$repoId",path:"/repositories/$repoId",getParentRoute:()=>ns}),jot=kfe.update({id:"/apps/new",path:"/apps/new",getParentRoute:()=>ns}),Fot=ZP.update({id:"/apps/$appId",path:"/apps/$appId",getParentRoute:()=>ns}),Bot={IndexRoute:Tot,AppsAppIdRoute:Fot,AppsNewRoute:jot,RepositoriesRepoIdRoute:Mot,TasksTaskIdRoute:Pot,AppsIndexRoute:Lot,MonitoringIndexRoute:Dot,RepositoriesIndexRoute:Iot,ReviewIndexRoute:Not,SettingsIndexRoute:Rot,TasksIndexRoute:Oot,TerminalsIndexRoute:kot,WorktreesIndexRoute:Aot},Uot=ns._addFileChildren(Bot)._addFileTypes(),$ot=new URLSearchParams(window.location.search),Nf=parseFloat($ot.get("zoom")||"1");Nf!==1&&Nf>=.5&&Nf<=2&&(document.documentElement.style.fontSize=`${16*Nf}px`);const qc=Nf>=.5&&Nf<=2?Nf:1,zot=new Gge({defaultOptions:{queries:{staleTime:1e3*60,refetchOnWindowFocus:!1}}}),Hot=xge({routeTree:Uot});Hhe.createRoot(document.getElementById("root")).render(p.jsx(A.StrictMode,{children:p.jsx(ube,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:p.jsx(Kge,{client:zot,children:p.jsx(LNe,{children:p.jsx(Sge,{router:Hot})})})})}));
|
|
181
|
+
`).forEach(m=>{const g=m.trim();if(!g||g.startsWith("#"))return;const x=g.indexOf("=");if(x>0){const _=g.slice(0,x).trim(),b=g.slice(x+1).trim();_&&(d[_]=b)}}),await n.mutateAsync({id:e.id,updates:{environmentVariables:d}}),s(!0),setTimeout(()=>s(!1),2e3)};return p.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:t("apps.environment.title")}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(X3,{children:[p.jsx(Z3,{className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",onClick:()=>l(!o),children:p.jsx(ae,{icon:o?o_e:Vxe,size:14,strokeWidth:2})}),p.jsx(Q3,{children:t(o?"apps.environment.showValues":"apps.environment.hideValues")})]}),p.jsx(Ie,{size:"sm",onClick:f,disabled:n.isPending,children:n.isPending?p.jsxs(p.Fragment,{children:[p.jsx(ae,{icon:Ot,size:14,strokeWidth:2,className:"animate-spin"}),t("status.saving")]}):a?p.jsxs(p.Fragment,{children:[p.jsx(ae,{icon:Pl,size:14,strokeWidth:2,className:"text-green-500"}),t("status.saved")]}):t("apps.environment.save")})]})]}),p.jsx(kw,{value:o?u:r,onChange:d=>{o||i(d.target.value)},onFocus:()=>{o&&l(!1)},placeholder:t("apps.environment.placeholder"),className:"font-mono text-sm min-h-[120px]",readOnly:o}),n.error&&p.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[p.jsx(ae,{icon:hr,size:14,strokeWidth:2}),p.jsx("span",{className:"text-sm",children:n.error.message})]})]})}function Eot({app:e,onDeploy:t}){const{t:n}=Rt("common"),{data:r}=cse(e.id),{data:i}=Y3(),a=q3(),s=i?.tunnelsAvailable??!1,[o,l]=A.useState(e.services?.map(b=>({serviceName:b.serviceName,containerPort:b.containerPort,domain:b.domain??"",exposureMethod:b.exposureMethod??"dns"}))??[]),[u,f]=A.useState(null);A.useEffect(()=>{u===null&&l(e.services?.map(b=>({serviceName:b.serviceName,containerPort:b.containerPort,domain:b.domain??"",exposureMethod:b.exposureMethod??"dns"}))??[])},[e.services,u]);const d=b=>{if(r?.containers){const y=r.containers.find(v=>v.service===b);if(y)return y.status}return"stopped"},m=async()=>{await a.mutateAsync({id:e.id,updates:{services:o.map(b=>({serviceName:b.serviceName,containerPort:b.containerPort??void 0,exposed:!!b.domain,domain:b.domain||void 0,exposureMethod:b.exposureMethod}))}}),f(null),Nt.warning(n("apps.deployToApply"),{description:n("apps.deployToApplyDesc"),action:{label:n("apps.deploy"),onClick:t}})},g=(b,y)=>{l(v=>v.map((S,T)=>T===b?{...S,...y}:S))},x=b=>{u===b?m():f(b)},_=()=>{l(e.services?.map(b=>({serviceName:b.serviceName,containerPort:b.containerPort,domain:b.domain??"",exposureMethod:b.exposureMethod??"dns"}))??[]),f(null)};return p.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[p.jsx("div",{className:"flex items-center justify-between",children:p.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:n("apps.general.services")})}),o.length>0?p.jsx("div",{className:"space-y-2",children:o.map((b,y)=>{const v=d(b.serviceName),S=v==="running",T=u===y,w=!!b.containerPort,C=!!b.domain;return p.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[p.jsx("div",{className:`h-2 w-2 shrink-0 rounded-full ${S?"bg-green-500":"bg-gray-400"}`,title:v}),p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 shrink-0",children:[p.jsx("span",{className:"font-medium",children:b.serviceName}),b.containerPort&&p.jsxs(Ta,{variant:"secondary",className:"text-xs px-1.5 py-0",children:[":",b.containerPort]})]}),p.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:T?p.jsxs(p.Fragment,{children:[p.jsx(Qt,{value:b.domain,onChange:R=>g(y,{domain:R.target.value}),placeholder:"app.example.com",className:"h-7 text-xs flex-1",autoFocus:!0,disabled:!w}),p.jsxs("select",{value:b.exposureMethod,onChange:R=>g(y,{exposureMethod:R.target.value}),className:"h-7 rounded-md border bg-background px-2 text-xs shrink-0",disabled:!w,children:[p.jsx("option",{value:"dns",children:"DNS"}),p.jsxs("option",{value:"tunnel",disabled:!s,children:["Tunnel",s?"":" (unavailable)"]})]})]}):C?p.jsxs(p.Fragment,{children:[p.jsx("a",{href:`https://${b.domain}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate",children:b.domain}),p.jsx(Ta,{variant:b.exposureMethod==="tunnel"?"default":"outline",className:"text-xs px-1.5 py-0 shrink-0",children:b.exposureMethod==="tunnel"?"Tunnel":"DNS"})]}):p.jsx("span",{className:"text-muted-foreground/50 text-xs",children:n(w?"apps.domains.noDomain":"apps.domains.portRequired")})}),T?p.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[p.jsx(Ie,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>x(y),disabled:a.isPending,title:n("apps.domains.save"),children:a.isPending?p.jsx(ae,{icon:Ot,size:14,strokeWidth:2,className:"animate-spin"}):p.jsx(ae,{icon:Pl,size:14,strokeWidth:2,className:"text-green-500"})}),p.jsx(Ie,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:_,title:n("apps.cancel"),children:p.jsx(ae,{icon:Zr,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}):p.jsx(Ie,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>x(y),disabled:!w,title:n(w?"apps.domains.editDomain":"apps.domains.exposeRequiresPort"),children:p.jsx(ae,{icon:r_e,size:14,strokeWidth:2,className:w?"text-muted-foreground":"text-muted-foreground/30"})})]},b.serviceName)})}):p.jsx("p",{className:"text-sm text-muted-foreground",children:n("apps.general.noServicesConfigured")}),a.error&&p.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[p.jsx(ae,{icon:hr,size:14,strokeWidth:2}),p.jsx("span",{className:"text-sm",children:a.error.message})]})]})}function Sot(e){const t=e.split("_");if(t.length>=2)return t[1].split(".")[0];const n=e.split(/[-_.]/);for(const r of n.slice(1))if(r&&!r.match(/^\d+$/)&&r.length>2)return r;return e}const jJ=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)"];function FJ({data:e,label:t,totalValue:n,unit:r}){return p.jsxs("div",{className:"flex flex-col items-center",children:[p.jsxs("div",{className:"relative size-28",children:[p.jsx(goe,{width:"100%",height:"100%",children:p.jsxs(JVe,{children:[p.jsx(lc,{data:e,cx:"50%",cy:"50%",innerRadius:32,outerRadius:48,paddingAngle:2,dataKey:"value",stroke:"none",children:e.map((i,a)=>p.jsx(W0,{fill:i.color},`cell-${a}`))}),p.jsx(Ro,{content:({active:i,payload:a})=>{if(i&&a&&a.length){const s=a[0].payload;return p.jsxs("div",{className:"bg-popover border rounded-md px-2 py-1 text-xs shadow-md",children:[p.jsx("p",{className:"font-medium",children:s.name}),p.jsxs("p",{className:"text-muted-foreground",children:[s.value.toFixed(1)," ",r]})]})}return null}})]})}),p.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[p.jsx("span",{className:"text-sm font-semibold tabular-nums",children:n}),p.jsx("span",{className:"text-[10px] text-muted-foreground",children:r})]})]}),p.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:t})]})}function wot({containers:e}){const{t}=Rt("common"),n=e.reduce((o,l)=>o+l.cpuPercent,0),r=e.reduce((o,l)=>o+l.memoryMB,0),i=e.map((o,l)=>({name:Sot(o.name),cpu:o.cpuPercent,memory:o.memoryMB,color:jJ[l%jJ.length]})),a=i.map(o=>({name:o.name,value:o.cpu,color:o.color})),s=i.map(o=>({name:o.name,value:o.memory,color:o.color}));return p.jsxs(li,{className:"p-4 mb-6",children:[p.jsx("h4",{className:"text-sm font-medium mb-4",children:t("apps.monitoring.serviceTotal")}),p.jsxs("div",{className:"flex items-center justify-center gap-8",children:[p.jsx(FJ,{data:a,label:t("apps.monitoring.cpu"),totalValue:n.toFixed(1),unit:"%"}),p.jsx(FJ,{data:s,label:t("apps.monitoring.memory"),totalValue:r.toFixed(0),unit:"MB"})]}),p.jsx("div",{className:"flex flex-wrap justify-center gap-x-4 gap-y-1 mt-4",children:i.map(o=>p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("div",{className:"size-2.5 rounded-full",style:{backgroundColor:o.color}}),p.jsx("span",{className:"text-xs text-muted-foreground",children:o.name})]},o.name))})]})}function Cot(e,t){const n=e.slice(0,8).toLowerCase();return t?`vibora-${t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,20).replace(/-$/,"")}-${n}`:`vibora-${n}`}function Tot({appId:e,repoDisplayName:t}){const{t:n}=Rt("common"),{data:r,isLoading:i}=Hue(),a=A.useMemo(()=>{if(!r?.containers)return[];const s=`${Cot(e,t)}_`;return r.containers.filter(o=>o.name.toLowerCase().startsWith(s))},[r,e,t]);return i?p.jsx("div",{className:"flex items-center justify-center py-12",children:p.jsx(ae,{icon:Ot,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}):r?.available?a.length===0?p.jsxs("div",{className:"max-w-2xl",children:[p.jsxs("div",{className:"mb-4",children:[p.jsx("h3",{className:"text-lg font-semibold",children:n("apps.monitoring.title")}),p.jsx("p",{className:"text-sm text-muted-foreground",children:n("apps.monitoring.description")})]}),p.jsx("div",{className:"py-8 text-center text-muted-foreground border rounded-lg",children:p.jsx("p",{children:n("apps.monitoring.noContainers")})})]}):p.jsxs("div",{className:"max-w-4xl",children:[p.jsxs("div",{className:"mb-4",children:[p.jsx("h3",{className:"text-lg font-semibold",children:n("apps.monitoring.title")}),p.jsxs("p",{className:"text-sm text-muted-foreground",children:[n("apps.monitoring.description"),r.runtime&&p.jsxs("span",{className:"ml-1 text-xs",children:["(",r.runtime,")"]})]})]}),p.jsx(wot,{containers:a})]}):p.jsxs("div",{className:"max-w-2xl",children:[p.jsxs("div",{className:"mb-4",children:[p.jsx("h3",{className:"text-lg font-semibold",children:n("apps.monitoring.title")}),p.jsx("p",{className:"text-sm text-muted-foreground",children:n("apps.monitoring.description")})]}),p.jsx("div",{className:"py-8 text-center text-muted-foreground border rounded-lg",children:p.jsx("p",{children:n("apps.monitoring.dockerUnavailable")})})]})}const Aot=hIe.update({id:"/",path:"/",getParentRoute:()=>ns}),kot=yIe.update({id:"/worktrees/",path:"/worktrees/",getParentRoute:()=>ns}),Oot=bLe.update({id:"/terminals/",path:"/terminals/",getParentRoute:()=>ns}),Rot=ase.update({id:"/tasks/",path:"/tasks/",getParentRoute:()=>ns}),Not=WLe.update({id:"/settings/",path:"/settings/",getParentRoute:()=>ns}),Iot=ePe.update({id:"/review/",path:"/review/",getParentRoute:()=>ns}),Dot=oPe.update({id:"/repositories/",path:"/repositories/",getParentRoute:()=>ns}),Lot=Wue.update({id:"/monitoring/",path:"/monitoring/",getParentRoute:()=>ns}),Pot=Vue.update({id:"/apps/",path:"/apps/",getParentRoute:()=>ns}),Mot=YP.update({id:"/tasks/$taskId",path:"/tasks/$taskId",getParentRoute:()=>ns}),jot=XP.update({id:"/repositories/$repoId",path:"/repositories/$repoId",getParentRoute:()=>ns}),Fot=kfe.update({id:"/apps/new",path:"/apps/new",getParentRoute:()=>ns}),Bot=ZP.update({id:"/apps/$appId",path:"/apps/$appId",getParentRoute:()=>ns}),Uot={IndexRoute:Aot,AppsAppIdRoute:Bot,AppsNewRoute:Fot,RepositoriesRepoIdRoute:jot,TasksTaskIdRoute:Mot,AppsIndexRoute:Pot,MonitoringIndexRoute:Lot,RepositoriesIndexRoute:Dot,ReviewIndexRoute:Iot,SettingsIndexRoute:Not,TasksIndexRoute:Rot,TerminalsIndexRoute:Oot,WorktreesIndexRoute:kot},$ot=ns._addFileChildren(Uot)._addFileTypes(),zot=new URLSearchParams(window.location.search),Nf=parseFloat(zot.get("zoom")||"1");Nf!==1&&Nf>=.5&&Nf<=2&&(document.documentElement.style.fontSize=`${16*Nf}px`);const qc=Nf>=.5&&Nf<=2?Nf:1,Hot=new Gge({defaultOptions:{queries:{staleTime:1e3*60,refetchOnWindowFocus:!1}}}),Wot=xge({routeTree:$ot});Hhe.createRoot(document.getElementById("root")).render(p.jsx(A.StrictMode,{children:p.jsx(ube,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:p.jsx(Kge,{client:Hot,children:p.jsx(LNe,{children:p.jsx(Sge,{router:Wot})})})})}));
|
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/png" href="/logo.png" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Vibora - Harness Attention. Ship.</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-6upvoYI3.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-Bgfe0BLS.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -177883,6 +177883,7 @@ async function stackDeploy(options, onOutput) {
|
|
|
177883
177883
|
}
|
|
177884
177884
|
log2.deploy.info("Deploying stack", { stackName: options.stackName });
|
|
177885
177885
|
const args = ["stack", "deploy"];
|
|
177886
|
+
args.push("--resolve-image", "always");
|
|
177886
177887
|
const composeFile = options.composeFile || "docker-compose.yml";
|
|
177887
177888
|
args.push("-c", composeFile);
|
|
177888
177889
|
args.push(options.stackName);
|
|
@@ -178790,8 +178791,13 @@ async function ensureTraefik() {
|
|
|
178790
178791
|
cachedTraefikConfig = config;
|
|
178791
178792
|
return config;
|
|
178792
178793
|
}
|
|
178793
|
-
function getProjectName(appId) {
|
|
178794
|
-
|
|
178794
|
+
function getProjectName(appId, repoName) {
|
|
178795
|
+
const suffix = appId.slice(0, 8).toLowerCase();
|
|
178796
|
+
if (repoName) {
|
|
178797
|
+
const sanitized = repoName.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 20).replace(/-$/, "");
|
|
178798
|
+
return `vibora-${sanitized}-${suffix}`;
|
|
178799
|
+
}
|
|
178800
|
+
return `vibora-${suffix}`;
|
|
178795
178801
|
}
|
|
178796
178802
|
async function getGitCommit(repoPath) {
|
|
178797
178803
|
return new Promise((resolve6) => {
|
|
@@ -178853,7 +178859,7 @@ async function deployApp(appId, options = {}, onProgress) {
|
|
|
178853
178859
|
}
|
|
178854
178860
|
};
|
|
178855
178861
|
await db.update(apps).set({ status: "building", updatedAt: now }).where(eq(apps.id, appId));
|
|
178856
|
-
const projectName = getProjectName(app15.id);
|
|
178862
|
+
const projectName = getProjectName(app15.id, repo.displayName);
|
|
178857
178863
|
const buildLogs = [];
|
|
178858
178864
|
let env;
|
|
178859
178865
|
if (app15.environmentVariables) {
|
|
@@ -179146,7 +179152,7 @@ async function deployApp(appId, options = {}, onProgress) {
|
|
|
179146
179152
|
completedAt: new Date().toISOString()
|
|
179147
179153
|
}).where(eq(deployments.id, deploymentId));
|
|
179148
179154
|
await db.update(apps).set({ status: "stopped", updatedAt: new Date().toISOString() }).where(eq(apps.id, appId));
|
|
179149
|
-
const projectName2 = getProjectName(appId);
|
|
179155
|
+
const projectName2 = getProjectName(appId, repo.displayName);
|
|
179150
179156
|
stackRemove(projectName2).catch(() => {});
|
|
179151
179157
|
onProgress?.({ stage: "cancelled", message: "Deployment cancelled" });
|
|
179152
179158
|
return { success: false, error: "Deployment cancelled", cancelled: true };
|
|
@@ -179186,7 +179192,7 @@ async function stopApp(appId) {
|
|
|
179186
179192
|
if (!repo) {
|
|
179187
179193
|
return { success: false, error: "Repository not found" };
|
|
179188
179194
|
}
|
|
179189
|
-
const projectName = getProjectName(app15.id);
|
|
179195
|
+
const projectName = getProjectName(app15.id, repo.displayName);
|
|
179190
179196
|
const removeResult = await stackRemove(projectName);
|
|
179191
179197
|
if (!removeResult.success) {
|
|
179192
179198
|
return { success: false, error: removeResult.error };
|
|
@@ -179652,6 +179658,9 @@ app15.delete("/:id", async (c) => {
|
|
|
179652
179658
|
const services = await db.query.appServices.findMany({
|
|
179653
179659
|
where: eq(appServices.appId, id)
|
|
179654
179660
|
});
|
|
179661
|
+
const repo = await db.query.repositories.findFirst({
|
|
179662
|
+
where: eq(repositories.id, existing.repositoryId)
|
|
179663
|
+
});
|
|
179655
179664
|
if (existing.status === "building") {
|
|
179656
179665
|
await cancelDeploymentByAppId(id);
|
|
179657
179666
|
}
|
|
@@ -179659,7 +179668,7 @@ app15.delete("/:id", async (c) => {
|
|
|
179659
179668
|
if (existing.status === "running") {
|
|
179660
179669
|
await stopApp(id);
|
|
179661
179670
|
} else {
|
|
179662
|
-
const projectName = getProjectName(id);
|
|
179671
|
+
const projectName = getProjectName(id, repo?.displayName);
|
|
179663
179672
|
await stackRemove(projectName).catch((err) => {
|
|
179664
179673
|
log2.deploy.warn("Failed to remove stack during app deletion", {
|
|
179665
179674
|
appId: id,
|
|
@@ -179854,7 +179863,10 @@ app15.get("/:id/logs", async (c) => {
|
|
|
179854
179863
|
if (!appRecord) {
|
|
179855
179864
|
return c.json({ error: "App not found" }, 404);
|
|
179856
179865
|
}
|
|
179857
|
-
const
|
|
179866
|
+
const repo = await db.query.repositories.findFirst({
|
|
179867
|
+
where: eq(repositories.id, appRecord.repositoryId)
|
|
179868
|
+
});
|
|
179869
|
+
const projectName = getProjectName(id, repo?.displayName);
|
|
179858
179870
|
if (service) {
|
|
179859
179871
|
const fullServiceName = `${projectName}_${service}`;
|
|
179860
179872
|
const logs = await serviceLogs(fullServiceName, tail);
|
|
@@ -179881,7 +179893,10 @@ app15.get("/:id/status", async (c) => {
|
|
|
179881
179893
|
if (!appRecord) {
|
|
179882
179894
|
return c.json({ error: "App not found" }, 404);
|
|
179883
179895
|
}
|
|
179884
|
-
const
|
|
179896
|
+
const repo = await db.query.repositories.findFirst({
|
|
179897
|
+
where: eq(repositories.id, appRecord.repositoryId)
|
|
179898
|
+
});
|
|
179899
|
+
const projectName = getProjectName(id, repo?.displayName);
|
|
179885
179900
|
const services = await stackServices(projectName);
|
|
179886
179901
|
const containers = services.map((svc) => {
|
|
179887
179902
|
const [current, desired] = svc.replicas.split("/").map(Number);
|