commandmate 0.2.13 → 0.3.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/.env.example +21 -2
- package/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +32 -24
- package/.next/app-path-routes-manifest.json +1 -1
- package/.next/build-manifest.json +7 -7
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/1.pack +0 -0
- package/.next/cache/webpack/client-production/2.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +2 -2
- package/.next/required-server-files.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/app/update-check/route.js +1 -1
- package/.next/server/app/api/auth/login/route.js +1 -0
- package/.next/server/app/api/auth/login/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/logout/route.js +1 -0
- package/.next/server/app/api/auth/logout/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/status/route.js +1 -0
- package/.next/server/app/api/auth/status/route.js.nft.json +1 -0
- package/.next/server/app/api/hooks/claude-done/route.js +1 -1
- package/.next/server/app/api/hooks/claude-done/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/route.js +2 -2
- package/.next/server/app/api/repositories/route.js.nft.json +1 -1
- package/.next/server/app/api/slash-commands/route.js +1 -1
- package/.next/server/app/api/slash-commands/route.js.nft.json +1 -1
- package/.next/server/app/api/slash-commands.body +1 -1
- package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/interrupt/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/interrupt/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/kill-session/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/kill-session/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/logs/[filename]/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/prompt-response/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/prompt-response/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/respond/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/respond/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/send/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/send/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/slash-commands/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/slash-commands/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/start-polling/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/start-polling/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/route.js +1 -1
- package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
- package/.next/server/app/login/page.js +1 -0
- package/.next/server/app/login/page.js.nft.json +1 -0
- package/.next/server/app/login/page_client-reference-manifest.js +1 -0
- package/.next/server/app/page.js +2 -2
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/files/[...path]/page.js +1 -1
- package/.next/server/app/worktrees/[id]/files/[...path]/page.js.nft.json +1 -1
- package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/page.js +2 -2
- package/.next/server/app/worktrees/[id]/page.js.nft.json +1 -1
- package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/terminal/page.js +1 -1
- package/.next/server/app/worktrees/[id]/terminal/page.js.nft.json +1 -1
- package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +12 -8
- package/.next/server/chunks/3013.js +1 -0
- package/.next/server/chunks/3074.js +1 -0
- package/.next/server/chunks/{1287.js → 3294.js} +2 -2
- package/.next/server/chunks/3860.js +1 -1
- package/.next/server/chunks/4893.js +2 -2
- package/.next/server/chunks/539.js +35 -0
- package/.next/server/chunks/5795.js +1 -0
- package/.next/server/chunks/7536.js +1 -1
- package/.next/server/chunks/7566.js +19 -0
- package/.next/server/chunks/8693.js +1 -1
- package/.next/server/edge-runtime-webpack.js +2 -0
- package/.next/server/edge-runtime-webpack.js.map +1 -0
- package/.next/server/functions-config-manifest.json +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-manifest.json +28 -2
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/server/src/middleware.js +14 -0
- package/.next/server/src/middleware.js.map +1 -0
- package/.next/static/chunks/{2626.2125083a1ff3b80a.js → 6163.f672451d4575decf.js} +1 -1
- package/.next/static/chunks/{656.d72f25ce819bd77e.js → 656.5e2de0173f5a06bd.js} +1 -1
- package/.next/static/chunks/8091-925542bdfc843dce.js +1 -0
- package/.next/static/chunks/8528-4d554d3b94d4cf9b.js +1 -0
- package/.next/static/chunks/app/{layout-07755491d5d57242.js → layout-9110f9a5e41c6bf4.js} +1 -1
- package/.next/static/chunks/app/login/page-2d42204ba87cd136.js +1 -0
- package/.next/static/chunks/app/page-238b5a70d8c101e9.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/page-9418e49bdc1de02c.js +1 -0
- package/.next/static/chunks/main-db79434ee4a6c931.js +1 -0
- package/.next/static/chunks/webpack-3c0ee3ce5b546818.js +1 -0
- package/.next/static/css/b9ea6a4fad17dc32.css +3 -0
- package/.next/trace +5 -5
- package/.next/types/app/api/auth/login/route.ts +343 -0
- package/.next/types/app/api/auth/logout/route.ts +343 -0
- package/.next/types/app/api/auth/status/route.ts +343 -0
- package/.next/types/app/login/page.ts +79 -0
- package/README.md +6 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +2 -0
- package/dist/cli/commands/start.d.ts +2 -0
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +159 -14
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +4 -0
- package/dist/cli/config/security-messages.d.ts +3 -1
- package/dist/cli/config/security-messages.d.ts.map +1 -1
- package/dist/cli/config/security-messages.js +6 -2
- package/dist/cli/index.js +17 -0
- package/dist/cli/types/index.d.ts +17 -0
- package/dist/cli/types/index.d.ts.map +1 -1
- package/dist/cli/utils/daemon.d.ts.map +1 -1
- package/dist/cli/utils/daemon.js +16 -3
- package/dist/config/auth-config.d.ts +43 -0
- package/dist/config/auth-config.d.ts.map +1 -0
- package/dist/config/auth-config.js +112 -0
- package/dist/lib/auth.d.ts +104 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +250 -0
- package/dist/server/server.js +123 -12
- package/dist/server/src/config/auth-config.js +112 -0
- package/dist/server/src/lib/auth.js +250 -0
- package/dist/server/src/lib/auto-yes-manager.js +180 -96
- package/dist/server/src/lib/ip-restriction.js +241 -0
- package/dist/server/src/lib/ws-server.js +63 -33
- package/dist/server/src/types/slash-commands.js +1 -0
- package/package.json +2 -2
- package/.next/server/chunks/9238.js +0 -35
- package/.next/server/chunks/9367.js +0 -19
- package/.next/static/chunks/5970-2e18108d0cabd8af.js +0 -1
- package/.next/static/chunks/816-af44cb865b0c980e.js +0 -1
- package/.next/static/chunks/app/page-a6593b9640df66a6.js +0 -1
- package/.next/static/chunks/app/worktrees/[id]/page-d9a7913679eccfd9.js +0 -1
- package/.next/static/chunks/main-f00f82f1cf18dd99.js +0 -1
- package/.next/static/chunks/webpack-e6531fcf859d9451.js +0 -1
- package/.next/static/css/897ffb669f47c97b.css +0 -3
- /package/.next/static/{oUEq-Bd47xtkJcFDOI6rr → clTo9tuAoPMLcGRuVENfO}/_buildManifest.js +0 -0
- /package/.next/static/{oUEq-Bd47xtkJcFDOI6rr → clTo9tuAoPMLcGRuVENfO}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6163],{29891:function(e,t,a){function i(e,t){e.accDescr&&t.setAccDescription?.(e.accDescr),e.accTitle&&t.setAccTitle?.(e.accTitle),e.title&&t.setDiagramTitle?.(e.title)}a.d(t,{A:function(){return i}}),(0,a(31954).eW)(i,"populateCommonDb")},62626:function(e,t,a){a.d(t,{diagram:function(){return b}});var i=a(34960),l=a(29891),r=a(94705),n=a(55166),s=a(31954),c=a(54327),o=a(84370),p=n.vZ.pie,d={sections:new Map,showData:!1,config:p},u=d.sections,g=d.showData,f=structuredClone(p),h=(0,s.eW)(()=>structuredClone(f),"getConfig"),x=(0,s.eW)(()=>{u=new Map,g=d.showData,(0,n.ZH)()},"clear"),m=(0,s.eW)(({label:e,value:t})=>{if(t<0)throw Error(`"${e}" has invalid value: ${t}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);u.has(e)||(u.set(e,t),s.cM.debug(`added new section: ${e}, with value: ${t}`))},"addSection"),w=(0,s.eW)(()=>u,"getSections"),$=(0,s.eW)(e=>{g=e},"setShowData"),S=(0,s.eW)(()=>g,"getShowData"),T={getConfig:h,clear:x,setDiagramTitle:n.g2,getDiagramTitle:n.Kr,setAccTitle:n.GN,getAccTitle:n.eu,setAccDescription:n.U$,getAccDescription:n.Mx,addSection:m,getSections:w,setShowData:$,getShowData:S},v=(0,s.eW)((e,t)=>{(0,l.A)(e,t),t.setShowData(e.showData),e.sections.map(t.addSection)},"populateDb"),y={parse:(0,s.eW)(async e=>{let t=await (0,c.Qc)("pie",e);s.cM.debug(t),v(t,T)},"parse")},D=(0,s.eW)(e=>`
|
|
2
2
|
.pieCircle{
|
|
3
3
|
stroke: ${e.pieStrokeColor};
|
|
4
4
|
stroke-width : ${e.pieStrokeWidth};
|
|
@@ -140,7 +140,7 @@ Please report this to https://github.com/markedjs/marked.`,t){let t="<p>An error
|
|
|
140
140
|
L20,10
|
|
141
141
|
M20,10
|
|
142
142
|
L0,20`)},"requirement_arrow"),requirement_contains:(0,c.eW)((t,e,r)=>{let i=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains")},G=O},94705:function(t,e,r){"use strict";r.d(e,{$m:function(){return c},Cq:function(){return D},Ln:function(){return G},MX:function(){return A},Ox:function(){return L},R7:function(){return V},Rb:function(){return j},SH:function(){return Y},VG:function(){return R},Vy:function(){return U},X4:function(){return O},XD:function(){return I},bZ:function(){return N},be:function(){return M},le:function(){return y},tf:function(){return g},w8:function(){return H}});var i,n=r(55166),o=r(31954),a=r(59543),s=r(84370),l=r(98509),h=r(38008),c="",u={curveBasis:s.$0Z,curveBasisClosed:s.Dts,curveBasisOpen:s.WQY,curveBumpX:s.qpX,curveBumpY:s.u93,curveBundle:s.tFB,curveCardinalClosed:s.OvA,curveCardinalOpen:s.dCK,curveCardinal:s.YY7,curveCatmullRomClosed:s.fGX,curveCatmullRomOpen:s.$m7,curveCatmullRom:s.zgE,curveLinear:s.c_6,curveLinearClosed:s.fxm,curveMonotoneX:s.FdL,curveMonotoneY:s.ak_,curveNatural:s.SxZ,curveStep:s.eA_,curveStepAfter:s.jsv,curveStepBefore:s.iJ},d=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,p=(0,o.eW)(function(t,e){let r=f(t,/(?:init\b)|(?:initialize\b)/),i={};if(Array.isArray(r)){let t=r.map(t=>t.args);(0,n.NM)(t),i=(0,n.Yc)(i,[...t])}else i=r.args;if(!i)return;let o=(0,n.Vg)(t,e),a="config";return void 0!==i[a]&&("flowchart-v2"===o&&(o="flowchart"),i[o]=i[a],delete i[a]),i},"detectInit"),f=(0,o.eW)(function(t,e=null){try{let r;let i=RegExp(`[%]{2}(?![{]${d.source})(?=[}][%]{2}).*
|
|
143
|
-
`,"ig");t=t.trim().replace(i,"").replace(/'/gm,'"'),o.cM.debug(`Detecting diagram directive${null!==e?" type:"+e:""} based on the text:${t}`);let a=[];for(;null!==(r=n.Zn.exec(t));)if(r.index===n.Zn.lastIndex&&n.Zn.lastIndex++,r&&!e||e&&r[1]?.match(e)||e&&r[2]?.match(e)){let t=r[1]?r[1]:r[2],e=r[3]?r[3].trim():r[4]?JSON.parse(r[4].trim()):null;a.push({type:t,args:e})}if(0===a.length)return{type:t,args:null};return 1===a.length?a[0]:a}catch(r){return o.cM.error(`ERROR: ${r.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`),{type:void 0,args:null}}},"detectDirective"),g=(0,o.eW)(function(t){return t.replace(n.Zn,"")},"removeDirectives"),m=(0,o.eW)(function(t,e){for(let[r,i]of e.entries())if(i.match(t))return r;return -1},"isSubstringInArray");function y(t,e){return t?u[`curve${t.charAt(0).toUpperCase()+t.slice(1)}`]??e:e}function x(t,e){let r=t.trim();return r?"loose"!==e.securityLevel?(0,a.N)(r):r:void 0}(0,o.eW)(y,"interpolateToCurve"),(0,o.eW)(x,"formatUrl");var b=(0,o.eW)((t,...e)=>{let r=t.split("."),i=r.length-1,n=r[i],a=window;for(let e=0;e<i;e++)if(!(a=a[r[e]])){o.cM.error(`Function name: ${t} not found in window`);return}a[n](...e)},"runFunc");function k(t,e){return t&&e?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):0}function C(t){let e;let r=0;return t.forEach(t=>{r+=k(t,e),e=t}),w(t,r/2)}function _(t){return 1===t.length?t[0]:C(t)}(0,o.eW)(k,"distance"),(0,o.eW)(C,"traverseEdge"),(0,o.eW)(_,"calcLabelPosition");var v=(0,o.eW)((t,e=2)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},"roundNumber"),w=(0,o.eW)((t,e)=>{let r;let i=e;for(let e of t){if(r){let t=k(e,r);if(0===t)return r;if(t<i)i-=t;else{let n=i/t;if(n<=0)return r;if(n>=1)return{x:e.x,y:e.y};if(n>0&&n<1)return{x:v((1-n)*r.x+n*e.x,5),y:v((1-n)*r.y+n*e.y,5)}}}r=e}throw Error("Could not find a suitable point for the given distance")},"calculatePoint"),T=(0,o.eW)((t,e,r)=>{o.cM.info(`our points ${JSON.stringify(e)}`),e[0]!==r&&(e=e.reverse());let i=w(e,25),n=t?10:5,a=Math.atan2(e[0].y-i.y,e[0].x-i.x),s={x:0,y:0};return s.x=Math.sin(a)*n+(e[0].x+i.x)/2,s.y=-Math.cos(a)*n+(e[0].y+i.y)/2,s},"calcCardinalityPosition");function S(t,e,r){let i=structuredClone(r);o.cM.info("our points",i),"start_left"!==e&&"start_right"!==e&&i.reverse();let n=w(i,25+t),a=10+.5*t,s=Math.atan2(i[0].y-n.y,i[0].x-n.x),l={x:0,y:0};return"start_left"===e?(l.x=Math.sin(s+Math.PI)*a+(i[0].x+n.x)/2,l.y=-Math.cos(s+Math.PI)*a+(i[0].y+n.y)/2):"end_right"===e?(l.x=Math.sin(s-Math.PI)*a+(i[0].x+n.x)/2-5,l.y=-Math.cos(s-Math.PI)*a+(i[0].y+n.y)/2-5):"end_left"===e?(l.x=Math.sin(s)*a+(i[0].x+n.x)/2-5,l.y=-Math.cos(s)*a+(i[0].y+n.y)/2-5):(l.x=Math.sin(s)*a+(i[0].x+n.x)/2,l.y=-Math.cos(s)*a+(i[0].y+n.y)/2),l}function M(t){let e="",r="";for(let i of t)void 0!==i&&(i.startsWith("color:")||i.startsWith("text-align:")?r=r+i+";":e=e+i+";");return{style:e,labelStyle:r}}(0,o.eW)(S,"calcTerminalLabelPosition"),(0,o.eW)(M,"getStylesFromArray");var B=0,L=(0,o.eW)(()=>(B++,"id-"+Math.random().toString(36).substr(2,12)+"-"+B),"generateId");function F(t){let e="",r="0123456789abcdef",i=r.length;for(let n=0;n<t;n++)e+=r.charAt(Math.floor(Math.random()*i));return e}(0,o.eW)(F,"makeRandomHex");var A=(0,o.eW)(t=>F(t.length),"random"),W=(0,o.eW)(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),E=(0,o.eW)(function(t,e){let r=e.text.replace(n.SY.lineBreakRegex," "),[,i]=R(e.fontSize),o=t.append("text");o.attr("x",e.x),o.attr("y",e.y),o.style("text-anchor",e.anchor),o.style("font-family",e.fontFamily),o.style("font-size",i),o.style("font-weight",e.fontWeight),o.attr("fill",e.fill),void 0!==e.class&&o.attr("class",e.class);let a=o.append("tspan");return a.attr("x",e.x+2*e.textMargin),a.attr("fill",e.fill),a.text(r),o},"drawSimpleText"),O=(0,l.Z)((t,e,r)=>{if(!t||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),n.SY.lineBreakRegex.test(t)))return t;let i=t.split(" ").filter(Boolean),o=[],a="";return i.forEach((t,n)=>{let s=D(`${t} `,r),l=D(a,r);if(s>e){let{hyphenatedStrings:i,remainingWord:n}=$(t,e,"-",r);o.push(a,...i),a=n}else l+s>=e?(o.push(a),a=t):a=[a,t].filter(Boolean).join(" ");n+1===i.length&&o.push(a)}),o.filter(t=>""!==t).join(r.joinWith)},(t,e,r)=>`${t}${e}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),$=(0,l.Z)((t,e,r="-",i)=>{i=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},i);let n=[...t],o=[],a="";return n.forEach((t,s)=>{let l=`${a}${t}`;if(D(l,i)>=e){let t=n.length===s+1,e=`${l}${r}`;o.push(t?l:e),a=""}else a=l}),{hyphenatedStrings:o,remainingWord:a}},(t,e,r="-",i)=>`${t}${e}${r}${i.fontSize}${i.fontWeight}${i.fontFamily}`);function I(t,e){return Z(t,e).height}function D(t,e){return Z(t,e).width}(0,o.eW)(I,"calculateTextHeight"),(0,o.eW)(D,"calculateTextWidth");var Z=(0,l.Z)((t,e)=>{let{fontSize:r=12,fontFamily:i="Arial",fontWeight:o=400}=e;if(!t)return{width:0,height:0};let[,a]=R(r),l=t.split(n.SY.lineBreakRegex),h=[],u=(0,s.Ys)("body");if(!u.remove)return{width:0,height:0,lineHeight:0};let d=u.append("svg");for(let t of["sans-serif",i]){let e=0,r={width:0,height:0,lineHeight:0};for(let i of l){let n=W();n.text=i||c;let s=E(d,n).style("font-size",a).style("font-weight",o).style("font-family",t),l=(s._groups||s)[0][0].getBBox();if(0===l.width&&0===l.height)throw Error("svg element not in render tree");r.width=Math.round(Math.max(r.width,l.width)),e=Math.round(l.height),r.height+=e,r.lineHeight=Math.round(Math.max(r.lineHeight,e))}h.push(r)}d.remove();let p=isNaN(h[1].height)||isNaN(h[1].width)||isNaN(h[1].lineHeight)||h[0].height>h[1].height&&h[0].width>h[1].width&&h[0].lineHeight>h[1].lineHeight?0:1;return h[p]},(t,e)=>`${t}${e.fontSize}${e.fontWeight}${e.fontFamily}`),z=class{constructor(t=!1,e){this.count=0,this.count=e?e.length:0,this.next=t?()=>this.count++:()=>Date.now()}static{(0,o.eW)(this,"InitIDGenerator")}},q=(0,o.eW)(function(t){return i=i||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),i.innerHTML=t,unescape(i.textContent)},"entityDecode");function N(t){return"str"in t}(0,o.eW)(N,"isDetailedError");var P=(0,o.eW)((t,e,r,i)=>{if(!i)return;let n=t.node()?.getBBox();n&&t.append("text").text(i).attr("text-anchor","middle").attr("x",n.x+n.width/2).attr("y",-r).attr("class",e)},"insertTitle"),R=(0,o.eW)(t=>{if("number"==typeof t)return[t,t+"px"];let e=parseInt(t??"",10);return Number.isNaN(e)?[void 0,void 0]:t===String(e)?[e,t+"px"]:[e,t]},"parseFontSize");function j(t,e){return(0,h.Z)({},t,e)}(0,o.eW)(j,"cleanAndMerge");var H={assignWithDepth:n.Yc,wrapLabel:O,calculateTextHeight:I,calculateTextWidth:D,calculateTextDimensions:Z,cleanAndMerge:j,detectInit:p,detectDirective:f,isSubstringInArray:m,interpolateToCurve:y,calcLabelPosition:_,calcCardinalityPosition:T,calcTerminalLabelPosition:S,formatUrl:x,getStylesFromArray:M,generateId:L,random:A,runFunc:b,entityDecode:q,insertTitle:P,isLabelCoordinateInPath:X,parseFontSize:R,InitIDGenerator:z},U=(0,o.eW)(function(t){let e=t;return(e=(e=e.replace(/style.*:\S*#.*;/g,function(t){return t.substring(0,t.length-1)})).replace(/classDef.*:\S*#.*;/g,function(t){return t.substring(0,t.length-1)})).replace(/#\w+;/g,function(t){let e=t.substring(1,t.length-1);return/^\+?\d+$/.test(e)?"fl\xb0\xb0"+e+"\xb6\xdf":"fl\xb0"+e+"\xb6\xdf"})},"encodeEntities"),Y=(0,o.eW)(function(t){return t.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),G=(0,o.eW)((t,e,{counter:r=0,prefix:i,suffix:n},o)=>o||`${i?`${i}_`:""}${t}_${e}_${r}${n?`_${n}`:""}`,"getEdgeId");function V(t){return t??null}function X(t,e){let r=Math.round(t.x),i=Math.round(t.y),n=e.replace(/(\d+\.\d+)/g,t=>Math.round(parseFloat(t)).toString());return n.includes(r.toString())||n.includes(i.toString())}(0,o.eW)(V,"handleUndefinedAttr"),(0,o.eW)(X,"isLabelCoordinateInPath")},8441:function(t,e,r){"use strict";r.d(e,{X:function(){return i}});var i={name:"mermaid",version:"11.12.2",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",type:"module",module:"./dist/mermaid.core.mjs",types:"./dist/mermaid.d.ts",exports:{".":{types:"./dist/mermaid.d.ts",import:"./dist/mermaid.core.mjs",default:"./dist/mermaid.core.mjs"},"./*":"./*"},keywords:["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph","mindmap","packet diagram","c4 diagram","er diagram","pie chart","pie diagram","quadrant chart","requirement diagram","graph"],scripts:{clean:"rimraf dist",dev:"pnpm -w dev","docs:code":"typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup","docs:build":"rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts","docs:verify":"pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify","docs:pre:vitepress":"pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts","docs:build:vitepress":"pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing","docs:dev":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:dev:docker":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:serve":"pnpm docs:build:vitepress && vitepress serve src/vitepress","docs:spellcheck":'cspell "src/docs/**/*.md"',"docs:release-version":"tsx scripts/update-release-version.mts","docs:verify-version":"tsx scripts/update-release-version.mts --verify","types:build-config":"tsx scripts/create-types-from-json-schema.mts","types:verify-config":"tsx scripts/create-types-from-json-schema.mts --verify",checkCircle:"npx madge --circular ./src",prepublishOnly:"pnpm docs:verify-version"},repository:{type:"git",url:"https://github.com/mermaid-js/mermaid"},author:"Knut Sveidqvist",license:"MIT",standard:{ignore:["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],globals:["page"]},dependencies:{"@braintree/sanitize-url":"^7.1.1","@iconify/utils":"^3.0.1","@mermaid-js/parser":"workspace:^","@types/d3":"^7.4.3",cytoscape:"^3.29.3","cytoscape-cose-bilkent":"^4.1.0","cytoscape-fcose":"^2.2.0",d3:"^7.9.0","d3-sankey":"^0.12.3","dagre-d3-es":"7.0.13",dayjs:"^1.11.18",dompurify:"^3.2.5",katex:"^0.16.22",khroma:"^2.1.0","lodash-es":"^4.17.21",marked:"^16.2.1",roughjs:"^4.6.6",stylis:"^4.3.6","ts-dedent":"^2.2.0",uuid:"^11.1.0"},devDependencies:{"@adobe/jsonschema2md":"^8.0.5","@iconify/types":"^2.0.0","@types/cytoscape":"^3.21.9","@types/cytoscape-fcose":"^2.2.4","@types/d3-sankey":"^0.12.4","@types/d3-scale":"^4.0.9","@types/d3-scale-chromatic":"^3.1.0","@types/d3-selection":"^3.0.11","@types/d3-shape":"^3.1.7","@types/jsdom":"^21.1.7","@types/katex":"^0.16.7","@types/lodash-es":"^4.17.12","@types/micromatch":"^4.0.9","@types/stylis":"^4.2.7","@types/uuid":"^10.0.0",ajv:"^8.17.1",canvas:"^3.1.2",chokidar:"3.6.0",concurrently:"^9.1.2","csstree-validator":"^4.0.1",globby:"^14.1.0",jison:"^0.4.18","js-base64":"^3.7.8",jsdom:"^26.1.0","json-schema-to-typescript":"^15.0.4",micromatch:"^4.0.8","path-browserify":"^1.0.1",prettier:"^3.5.3",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-gfm":"^4.0.1",rimraf:"^6.0.1","start-server-and-test":"^2.0.13","type-fest":"^4.35.0",typedoc:"^0.28.12","typedoc-plugin-markdown":"^4.8.1",typescript:"~5.7.3","unist-util-flatmap":"^1.0.0","unist-util-visit":"^5.0.0",vitepress:"^1.6.4","vitepress-plugin-search":"1.0.4-alpha.22"},files:["dist/","README.md"],publishConfig:{access:"public"}}},50656:function(t,e,r){"use strict";r.d(e,{Z:function(){return ra}});var i=r(8441),n=r(34960),o=r(56405),a=r(63025);r(19328),r(54973),r(11866),r(10507),r(33281);var s=r(66691),l=r(94705),h=r(55166),c=r(31954),u=r(69553),d=r(84370),p="comm",f="rule",g="decl",m=Math.abs,y=String.fromCharCode;function x(t,e,r){return t.replace(e,r)}function b(t,e){return 0|t.charCodeAt(e)}function k(t,e,r){return t.slice(e,r)}function C(t){return t.length}function _(t,e){return e.push(t),t}function v(t,e){for(var r="",i=0;i<t.length;i++)r+=e(t[i],i,t,e)||"";return r}function w(t,e,r,i){switch(t.type){case"@layer":if(t.children.length)break;case"@import":case"@namespace":case g:return t.return=t.return||t.value;case p:return"";case"@keyframes":return t.return=t.value+"{"+v(t.children,i)+"}";case f:if(!C(t.value=t.props.join(",")))return""}return C(r=v(t.children,i))?t.return=t.value+"{"+r+"}":""}var T=1,S=1,M=0,B=0,L=0,F="";function A(t,e,r,i,n,o,a,s){return{value:t,root:e,parent:r,type:i,props:n,children:o,line:T,column:S,length:a,return:"",siblings:s}}function W(){return L=B<M?b(F,B++):0,S++,10===L&&(S=1,T++),L}function E(){return b(F,B)}function O(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function $(t){var e,r;return(e=B-1,r=function t(e){for(;W();)switch(L){case e:return B;case 34:case 39:34!==e&&39!==e&&t(L);break;case 40:41===e&&t(e);break;case 92:W()}return B}(91===t?t+2:40===t?t+1:t),k(F,e,r)).trim()}function I(t,e,r,i,n,o,a,s,l,h,c,u){for(var d=n-1,p=0===n?o:[""],g=p.length,y=0,b=0,C=0;y<i;++y)for(var _=0,v=k(t,d+1,d=m(b=a[y])),w=t;_<g;++_)(w=(b>0?p[_]+" "+v:x(v,/&\f/g,p[_])).trim())&&(l[C++]=w);return A(t,e,r,0===n?f:s,l,h,c,u)}function D(t,e,r,i,n){return A(t,e,r,g,k(t,0,i),k(t,i+1,-1),i,n)}var Z=r(18848),z=r(45130),q={id:"c4",detector:(0,c.eW)(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),loader:(0,c.eW)(async()=>{let{diagram:t}=await r.e(5387).then(r.bind(r,65387));return{id:"c4",diagram:t}},"loader")},N="flowchart",P=(0,c.eW)((t,e)=>e?.flowchart?.defaultRenderer!=="dagre-wrapper"&&e?.flowchart?.defaultRenderer!=="elk"&&/^\s*graph/.test(t),"detector"),R=(0,c.eW)(async()=>{let{diagram:t}=await r.e(7753).then(r.bind(r,77753));return{id:N,diagram:t}},"loader"),j={id:N,detector:P,loader:R},H="flowchart-v2",U=(0,c.eW)((t,e)=>e?.flowchart?.defaultRenderer!=="dagre-d3"&&(e?.flowchart?.defaultRenderer==="elk"&&(e.layout="elk"),!!/^\s*graph/.test(t)&&e?.flowchart?.defaultRenderer==="dagre-wrapper"||/^\s*flowchart/.test(t)),"detector"),Y=(0,c.eW)(async()=>{let{diagram:t}=await r.e(7753).then(r.bind(r,77753));return{id:H,diagram:t}},"loader"),G={id:H,detector:U,loader:Y},V={id:"er",detector:(0,c.eW)(t=>/^\s*erDiagram/.test(t),"detector"),loader:(0,c.eW)(async()=>{let{diagram:t}=await r.e(1582).then(r.bind(r,51582));return{id:"er",diagram:t}},"loader")},X="gitGraph",Q=(0,c.eW)(t=>/^\s*gitGraph/.test(t),"detector"),K=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(4327),r.e(3574)]).then(r.bind(r,43574));return{id:X,diagram:t}},"loader"),J={id:X,detector:Q,loader:K},tt="gantt",te=(0,c.eW)(t=>/^\s*gantt/.test(t),"detector"),tr=(0,c.eW)(async()=>{let{diagram:t}=await r.e(1817).then(r.bind(r,31817));return{id:tt,diagram:t}},"loader"),ti={id:tt,detector:te,loader:tr},tn="info",to=(0,c.eW)(t=>/^\s*info/.test(t),"detector"),ta=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(4327),r.e(8841)]).then(r.bind(r,78841));return{id:tn,diagram:t}},"loader"),ts={id:tn,detector:to,loader:ta},tl={id:"pie",detector:(0,c.eW)(t=>/^\s*pie/.test(t),"detector"),loader:(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(4327),r.e(2626)]).then(r.bind(r,62626));return{id:"pie",diagram:t}},"loader")},th="quadrantChart",tc=(0,c.eW)(t=>/^\s*quadrantChart/.test(t),"detector"),tu=(0,c.eW)(async()=>{let{diagram:t}=await r.e(8772).then(r.bind(r,58772));return{id:th,diagram:t}},"loader"),td={id:th,detector:tc,loader:tu},tp="xychart",tf=(0,c.eW)(t=>/^\s*xychart(-beta)?/.test(t),"detector"),tg=(0,c.eW)(async()=>{let{diagram:t}=await r.e(3991).then(r.bind(r,53991));return{id:tp,diagram:t}},"loader"),tm={id:tp,detector:tf,loader:tg},ty="requirement",tx=(0,c.eW)(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),tb=(0,c.eW)(async()=>{let{diagram:t}=await r.e(1015).then(r.bind(r,71015));return{id:ty,diagram:t}},"loader"),tk={id:ty,detector:tx,loader:tb},tC="sequence",t_=(0,c.eW)(t=>/^\s*sequenceDiagram/.test(t),"detector"),tv=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(2603),r.e(1423)]).then(r.bind(r,70872));return{id:tC,diagram:t}},"loader"),tw={id:tC,detector:t_,loader:tv},tT="class",tS=(0,c.eW)((t,e)=>e?.class?.defaultRenderer!=="dagre-wrapper"&&/^\s*classDiagram/.test(t),"detector"),tM=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(2689),r.e(5813)]).then(r.bind(r,45813));return{id:tT,diagram:t}},"loader"),tB={id:tT,detector:tS,loader:tM},tL="classDiagram",tF=(0,c.eW)((t,e)=>!!/^\s*classDiagram/.test(t)&&e?.class?.defaultRenderer==="dagre-wrapper"||/^\s*classDiagram-v2/.test(t),"detector"),tA=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(2689),r.e(7290)]).then(r.bind(r,97290));return{id:tL,diagram:t}},"loader"),tW={id:tL,detector:tF,loader:tA},tE="state",tO=(0,c.eW)((t,e)=>e?.state?.defaultRenderer!=="dagre-wrapper"&&/^\s*stateDiagram/.test(t),"detector"),t$=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(8522),r.e(3843),r.e(7665),r.e(9552)]).then(r.bind(r,49552));return{id:tE,diagram:t}},"loader"),tI={id:tE,detector:tO,loader:t$},tD="stateDiagram",tZ=(0,c.eW)((t,e)=>!!(/^\s*stateDiagram-v2/.test(t)||/^\s*stateDiagram/.test(t)&&e?.state?.defaultRenderer==="dagre-wrapper"),"detector"),tz=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(7665),r.e(7004)]).then(r.bind(r,47004));return{id:tD,diagram:t}},"loader"),tq={id:tD,detector:tZ,loader:tz},tN="journey",tP=(0,c.eW)(t=>/^\s*journey/.test(t),"detector"),tR=(0,c.eW)(async()=>{let{diagram:t}=await r.e(7415).then(r.bind(r,77415));return{id:tN,diagram:t}},"loader"),tj={id:tN,detector:tP,loader:tR},tH={draw:(0,c.eW)((t,e,r)=>{c.cM.debug("rendering svg for syntax error\n");let i=(0,n.P)(e),o=i.append("g");i.attr("viewBox","0 0 2412 512"),(0,h.v2)(i,100,512,!0),o.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),o.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),o.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),o.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),o.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),o.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),o.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),o.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw")},tU={db:{},renderer:tH,parser:{parse:(0,c.eW)(()=>{},"parse")}},tY="flowchart-elk",tG=(0,c.eW)((t,e={})=>!!(/^\s*flowchart-elk/.test(t)||/^\s*(flowchart|graph)/.test(t)&&e?.flowchart?.defaultRenderer==="elk")&&(e.layout="elk",!0),"detector"),tV=(0,c.eW)(async()=>{let{diagram:t}=await r.e(7753).then(r.bind(r,77753));return{id:tY,diagram:t}},"loader"),tX={id:tY,detector:tG,loader:tV},tQ="timeline",tK=(0,c.eW)(t=>/^\s*timeline/.test(t),"detector"),tJ=(0,c.eW)(async()=>{let{diagram:t}=await r.e(5126).then(r.bind(r,95126));return{id:tQ,diagram:t}},"loader"),t0={id:tQ,detector:tK,loader:tJ},t1="mindmap",t2=(0,c.eW)(t=>/^\s*mindmap/.test(t),"detector"),t3=(0,c.eW)(async()=>{let{diagram:t}=await r.e(6678).then(r.bind(r,56678));return{id:t1,diagram:t}},"loader"),t5={id:t1,detector:t2,loader:t3},t6="kanban",t4=(0,c.eW)(t=>/^\s*kanban/.test(t),"detector"),t8=(0,c.eW)(async()=>{let{diagram:t}=await r.e(2398).then(r.bind(r,72398));return{id:t6,diagram:t}},"loader"),t9={id:t6,detector:t4,loader:t8},t7="sankey",et=(0,c.eW)(t=>/^\s*sankey(-beta)?/.test(t),"detector"),ee=(0,c.eW)(async()=>{let{diagram:t}=await r.e(383).then(r.bind(r,383));return{id:t7,diagram:t}},"loader"),er={id:t7,detector:et,loader:ee},ei="packet",en=(0,c.eW)(t=>/^\s*packet(-beta)?/.test(t),"detector"),eo=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(4327),r.e(8288)]).then(r.bind(r,78288));return{id:ei,diagram:t}},"loader"),ea={id:ei,detector:en,loader:eo},es="radar",el=(0,c.eW)(t=>/^\s*radar-beta/.test(t),"detector"),eh=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(4327),r.e(2526)]).then(r.bind(r,2526));return{id:es,diagram:t}},"loader"),ec={id:es,detector:el,loader:eh},eu="block",ed=(0,c.eW)(t=>/^\s*block(-beta)?/.test(t),"detector"),ep=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(8522),r.e(4212)]).then(r.bind(r,54212));return{id:eu,diagram:t}},"loader"),ef={id:eu,detector:ed,loader:ep},eg="architecture",em=(0,c.eW)(t=>/^\s*architecture/.test(t),"detector"),ey=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(1264),r.e(6792),r.e(4327),r.e(6143)]).then(r.bind(r,66143));return{id:eg,diagram:t}},"loader"),ex={id:eg,detector:em,loader:ey},eb="treemap",ek=(0,c.eW)(t=>/^\s*treemap/.test(t),"detector"),eC=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(4327),r.e(9834)]).then(r.bind(r,9834));return{id:eb,diagram:t}},"loader"),e_={id:eb,detector:ek,loader:eC},ev=!1,ew=(0,c.eW)(()=>{ev||(ev=!0,(0,h.Cq)("error",tU,t=>"error"===t.toLowerCase().trim()),(0,h.Cq)("---",{db:{clear:(0,c.eW)(()=>{},"clear")},styles:{},renderer:{draw:(0,c.eW)(()=>{},"draw")},parser:{parse:(0,c.eW)(()=>{throw Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:(0,c.eW)(()=>null,"init")},t=>t.toLowerCase().trimStart().startsWith("---")),(0,h.KO)(tX,t5,ex),(0,h.KO)(q,t9,tW,tB,V,ti,ts,tl,tk,tw,G,j,t0,J,tq,tI,tj,td,er,ea,tm,ef,ec,e_))},"addDiagrams"),eT=(0,c.eW)(async()=>{c.cM.debug("Loading registered diagrams");let t=(await Promise.allSettled(Object.entries(h.Bf).map(async([t,{detector:e,loader:r}])=>{if(r)try{(0,h._7)(t)}catch{try{let{diagram:t,id:i}=await r();(0,h.Cq)(i,t,e)}catch(e){throw c.cM.error(`Failed to load external diagram with key ${t}. Removing from detectors.`),delete h.Bf[t],e}}}))).filter(t=>"rejected"===t.status);if(t.length>0){for(let e of(c.cM.error(`Failed to load ${t.length} external diagrams`),t))c.cM.error(e);throw Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams");function eS(t,e){t.attr("role","graphics-document document"),""!==e&&t.attr("aria-roledescription",e)}function eM(t,e,r,i){if(void 0!==t.insert){if(r){let e=`chart-desc-${i}`;t.attr("aria-describedby",e),t.insert("desc",":first-child").attr("id",e).text(r)}if(e){let r=`chart-title-${i}`;t.attr("aria-labelledby",r),t.insert("title",":first-child").attr("id",r).text(e)}}}(0,c.eW)(eS,"setA11yDiagramInfo"),(0,c.eW)(eM,"addSVGa11yTitleDescription");var eB=class t{constructor(t,e,r,i,n){this.type=t,this.text=e,this.db=r,this.parser=i,this.renderer=n}static{(0,c.eW)(this,"Diagram")}static async fromText(e,r={}){let i=(0,h.iE)(),n=(0,h.Vg)(e,i);e=(0,l.Vy)(e)+"\n";try{(0,h._7)(n)}catch{let t=(0,h.cq)(n);if(!t)throw new h.cj(`Diagram ${n} not found.`);let{id:e,diagram:r}=await t();(0,h.Cq)(e,r)}let{db:o,parser:a,renderer:s,init:c}=(0,h._7)(n);return a.parser&&(a.parser.yy=o),o.clear?.(),c?.(i),r.title&&o.setDiagramTitle?.(r.title),await a.parse(e),new t(n,e,o,a,s)}async render(t,e){await this.renderer.draw(this.text,t,e,this)}getParser(){return this.parser}getType(){return this.type}},eL=[],eF=(0,c.eW)(()=>{eL.forEach(t=>{t()}),eL=[]},"attachFunctions"),eA=(0,c.eW)(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function eW(t){let e=t.match(h.M6);if(!e)return{text:t,metadata:{}};let r=(0,o.z)(e[1],{schema:o.A})??{};r="object"!=typeof r||Array.isArray(r)?{}:r;let i={};return r.displayMode&&(i.displayMode=r.displayMode.toString()),r.title&&(i.title=r.title.toString()),r.config&&(i.config=r.config),{text:t.slice(e[0].length),metadata:i}}(0,c.eW)(eW,"extractFrontMatter");var eE=(0,c.eW)(t=>t.replace(/\r\n?/g,"\n").replace(/<(\w+)([^>]*)>/g,(t,e,r)=>"<"+e+r.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),eO=(0,c.eW)(t=>{let{text:e,metadata:r}=eW(t),{displayMode:i,title:n,config:o={}}=r;return i&&(o.gantt||(o.gantt={}),o.gantt.displayMode=i),{title:n,config:o,text:e}},"processFrontmatter"),e$=(0,c.eW)(t=>{let e=l.w8.detectInit(t)??{},r=l.w8.detectDirective(t,"wrap");return Array.isArray(r)?e.wrap=r.some(({type:t})=>"wrap"===t):r?.type==="wrap"&&(e.wrap=!0),{text:(0,l.tf)(t),directive:e}},"processDirectives");function eI(t){let e=eO(eE(t)),r=e$(e.text),i=(0,l.Rb)(e.config,r.directive);return{code:t=eA(r.text),title:e.title,config:i}}function eD(t){return btoa(Array.from(new TextEncoder().encode(t),t=>String.fromCodePoint(t)).join(""))}(0,c.eW)(eI,"preprocessDiagram"),(0,c.eW)(eD,"toBase64");var eZ=["foreignobject"],ez=["dominant-baseline"];function eq(t){let e=eI(t);return(0,h.mc)(),(0,h.XV)(e.config??{}),e}async function eN(t,e){ew();try{let{code:e,config:r}=eq(t);return{diagramType:(await eK(e)).type,config:r}}catch(t){if(e?.suppressErrors)return!1;throw t}}(0,c.eW)(eq,"processAndSetConfigs"),(0,c.eW)(eN,"parse");var eP=(0,c.eW)((t,e,r=[])=>`
|
|
143
|
+
`,"ig");t=t.trim().replace(i,"").replace(/'/gm,'"'),o.cM.debug(`Detecting diagram directive${null!==e?" type:"+e:""} based on the text:${t}`);let a=[];for(;null!==(r=n.Zn.exec(t));)if(r.index===n.Zn.lastIndex&&n.Zn.lastIndex++,r&&!e||e&&r[1]?.match(e)||e&&r[2]?.match(e)){let t=r[1]?r[1]:r[2],e=r[3]?r[3].trim():r[4]?JSON.parse(r[4].trim()):null;a.push({type:t,args:e})}if(0===a.length)return{type:t,args:null};return 1===a.length?a[0]:a}catch(r){return o.cM.error(`ERROR: ${r.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`),{type:void 0,args:null}}},"detectDirective"),g=(0,o.eW)(function(t){return t.replace(n.Zn,"")},"removeDirectives"),m=(0,o.eW)(function(t,e){for(let[r,i]of e.entries())if(i.match(t))return r;return -1},"isSubstringInArray");function y(t,e){return t?u[`curve${t.charAt(0).toUpperCase()+t.slice(1)}`]??e:e}function x(t,e){let r=t.trim();return r?"loose"!==e.securityLevel?(0,a.N)(r):r:void 0}(0,o.eW)(y,"interpolateToCurve"),(0,o.eW)(x,"formatUrl");var b=(0,o.eW)((t,...e)=>{let r=t.split("."),i=r.length-1,n=r[i],a=window;for(let e=0;e<i;e++)if(!(a=a[r[e]])){o.cM.error(`Function name: ${t} not found in window`);return}a[n](...e)},"runFunc");function k(t,e){return t&&e?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):0}function C(t){let e;let r=0;return t.forEach(t=>{r+=k(t,e),e=t}),w(t,r/2)}function _(t){return 1===t.length?t[0]:C(t)}(0,o.eW)(k,"distance"),(0,o.eW)(C,"traverseEdge"),(0,o.eW)(_,"calcLabelPosition");var v=(0,o.eW)((t,e=2)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},"roundNumber"),w=(0,o.eW)((t,e)=>{let r;let i=e;for(let e of t){if(r){let t=k(e,r);if(0===t)return r;if(t<i)i-=t;else{let n=i/t;if(n<=0)return r;if(n>=1)return{x:e.x,y:e.y};if(n>0&&n<1)return{x:v((1-n)*r.x+n*e.x,5),y:v((1-n)*r.y+n*e.y,5)}}}r=e}throw Error("Could not find a suitable point for the given distance")},"calculatePoint"),T=(0,o.eW)((t,e,r)=>{o.cM.info(`our points ${JSON.stringify(e)}`),e[0]!==r&&(e=e.reverse());let i=w(e,25),n=t?10:5,a=Math.atan2(e[0].y-i.y,e[0].x-i.x),s={x:0,y:0};return s.x=Math.sin(a)*n+(e[0].x+i.x)/2,s.y=-Math.cos(a)*n+(e[0].y+i.y)/2,s},"calcCardinalityPosition");function S(t,e,r){let i=structuredClone(r);o.cM.info("our points",i),"start_left"!==e&&"start_right"!==e&&i.reverse();let n=w(i,25+t),a=10+.5*t,s=Math.atan2(i[0].y-n.y,i[0].x-n.x),l={x:0,y:0};return"start_left"===e?(l.x=Math.sin(s+Math.PI)*a+(i[0].x+n.x)/2,l.y=-Math.cos(s+Math.PI)*a+(i[0].y+n.y)/2):"end_right"===e?(l.x=Math.sin(s-Math.PI)*a+(i[0].x+n.x)/2-5,l.y=-Math.cos(s-Math.PI)*a+(i[0].y+n.y)/2-5):"end_left"===e?(l.x=Math.sin(s)*a+(i[0].x+n.x)/2-5,l.y=-Math.cos(s)*a+(i[0].y+n.y)/2-5):(l.x=Math.sin(s)*a+(i[0].x+n.x)/2,l.y=-Math.cos(s)*a+(i[0].y+n.y)/2),l}function M(t){let e="",r="";for(let i of t)void 0!==i&&(i.startsWith("color:")||i.startsWith("text-align:")?r=r+i+";":e=e+i+";");return{style:e,labelStyle:r}}(0,o.eW)(S,"calcTerminalLabelPosition"),(0,o.eW)(M,"getStylesFromArray");var B=0,L=(0,o.eW)(()=>(B++,"id-"+Math.random().toString(36).substr(2,12)+"-"+B),"generateId");function F(t){let e="",r="0123456789abcdef",i=r.length;for(let n=0;n<t;n++)e+=r.charAt(Math.floor(Math.random()*i));return e}(0,o.eW)(F,"makeRandomHex");var A=(0,o.eW)(t=>F(t.length),"random"),W=(0,o.eW)(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),E=(0,o.eW)(function(t,e){let r=e.text.replace(n.SY.lineBreakRegex," "),[,i]=R(e.fontSize),o=t.append("text");o.attr("x",e.x),o.attr("y",e.y),o.style("text-anchor",e.anchor),o.style("font-family",e.fontFamily),o.style("font-size",i),o.style("font-weight",e.fontWeight),o.attr("fill",e.fill),void 0!==e.class&&o.attr("class",e.class);let a=o.append("tspan");return a.attr("x",e.x+2*e.textMargin),a.attr("fill",e.fill),a.text(r),o},"drawSimpleText"),O=(0,l.Z)((t,e,r)=>{if(!t||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),n.SY.lineBreakRegex.test(t)))return t;let i=t.split(" ").filter(Boolean),o=[],a="";return i.forEach((t,n)=>{let s=D(`${t} `,r),l=D(a,r);if(s>e){let{hyphenatedStrings:i,remainingWord:n}=$(t,e,"-",r);o.push(a,...i),a=n}else l+s>=e?(o.push(a),a=t):a=[a,t].filter(Boolean).join(" ");n+1===i.length&&o.push(a)}),o.filter(t=>""!==t).join(r.joinWith)},(t,e,r)=>`${t}${e}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),$=(0,l.Z)((t,e,r="-",i)=>{i=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},i);let n=[...t],o=[],a="";return n.forEach((t,s)=>{let l=`${a}${t}`;if(D(l,i)>=e){let t=n.length===s+1,e=`${l}${r}`;o.push(t?l:e),a=""}else a=l}),{hyphenatedStrings:o,remainingWord:a}},(t,e,r="-",i)=>`${t}${e}${r}${i.fontSize}${i.fontWeight}${i.fontFamily}`);function I(t,e){return Z(t,e).height}function D(t,e){return Z(t,e).width}(0,o.eW)(I,"calculateTextHeight"),(0,o.eW)(D,"calculateTextWidth");var Z=(0,l.Z)((t,e)=>{let{fontSize:r=12,fontFamily:i="Arial",fontWeight:o=400}=e;if(!t)return{width:0,height:0};let[,a]=R(r),l=t.split(n.SY.lineBreakRegex),h=[],u=(0,s.Ys)("body");if(!u.remove)return{width:0,height:0,lineHeight:0};let d=u.append("svg");for(let t of["sans-serif",i]){let e=0,r={width:0,height:0,lineHeight:0};for(let i of l){let n=W();n.text=i||c;let s=E(d,n).style("font-size",a).style("font-weight",o).style("font-family",t),l=(s._groups||s)[0][0].getBBox();if(0===l.width&&0===l.height)throw Error("svg element not in render tree");r.width=Math.round(Math.max(r.width,l.width)),e=Math.round(l.height),r.height+=e,r.lineHeight=Math.round(Math.max(r.lineHeight,e))}h.push(r)}d.remove();let p=isNaN(h[1].height)||isNaN(h[1].width)||isNaN(h[1].lineHeight)||h[0].height>h[1].height&&h[0].width>h[1].width&&h[0].lineHeight>h[1].lineHeight?0:1;return h[p]},(t,e)=>`${t}${e.fontSize}${e.fontWeight}${e.fontFamily}`),z=class{constructor(t=!1,e){this.count=0,this.count=e?e.length:0,this.next=t?()=>this.count++:()=>Date.now()}static{(0,o.eW)(this,"InitIDGenerator")}},q=(0,o.eW)(function(t){return i=i||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),i.innerHTML=t,unescape(i.textContent)},"entityDecode");function N(t){return"str"in t}(0,o.eW)(N,"isDetailedError");var P=(0,o.eW)((t,e,r,i)=>{if(!i)return;let n=t.node()?.getBBox();n&&t.append("text").text(i).attr("text-anchor","middle").attr("x",n.x+n.width/2).attr("y",-r).attr("class",e)},"insertTitle"),R=(0,o.eW)(t=>{if("number"==typeof t)return[t,t+"px"];let e=parseInt(t??"",10);return Number.isNaN(e)?[void 0,void 0]:t===String(e)?[e,t+"px"]:[e,t]},"parseFontSize");function j(t,e){return(0,h.Z)({},t,e)}(0,o.eW)(j,"cleanAndMerge");var H={assignWithDepth:n.Yc,wrapLabel:O,calculateTextHeight:I,calculateTextWidth:D,calculateTextDimensions:Z,cleanAndMerge:j,detectInit:p,detectDirective:f,isSubstringInArray:m,interpolateToCurve:y,calcLabelPosition:_,calcCardinalityPosition:T,calcTerminalLabelPosition:S,formatUrl:x,getStylesFromArray:M,generateId:L,random:A,runFunc:b,entityDecode:q,insertTitle:P,isLabelCoordinateInPath:X,parseFontSize:R,InitIDGenerator:z},U=(0,o.eW)(function(t){let e=t;return(e=(e=e.replace(/style.*:\S*#.*;/g,function(t){return t.substring(0,t.length-1)})).replace(/classDef.*:\S*#.*;/g,function(t){return t.substring(0,t.length-1)})).replace(/#\w+;/g,function(t){let e=t.substring(1,t.length-1);return/^\+?\d+$/.test(e)?"fl\xb0\xb0"+e+"\xb6\xdf":"fl\xb0"+e+"\xb6\xdf"})},"encodeEntities"),Y=(0,o.eW)(function(t){return t.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),G=(0,o.eW)((t,e,{counter:r=0,prefix:i,suffix:n},o)=>o||`${i?`${i}_`:""}${t}_${e}_${r}${n?`_${n}`:""}`,"getEdgeId");function V(t){return t??null}function X(t,e){let r=Math.round(t.x),i=Math.round(t.y),n=e.replace(/(\d+\.\d+)/g,t=>Math.round(parseFloat(t)).toString());return n.includes(r.toString())||n.includes(i.toString())}(0,o.eW)(V,"handleUndefinedAttr"),(0,o.eW)(X,"isLabelCoordinateInPath")},8441:function(t,e,r){"use strict";r.d(e,{X:function(){return i}});var i={name:"mermaid",version:"11.12.2",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",type:"module",module:"./dist/mermaid.core.mjs",types:"./dist/mermaid.d.ts",exports:{".":{types:"./dist/mermaid.d.ts",import:"./dist/mermaid.core.mjs",default:"./dist/mermaid.core.mjs"},"./*":"./*"},keywords:["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph","mindmap","packet diagram","c4 diagram","er diagram","pie chart","pie diagram","quadrant chart","requirement diagram","graph"],scripts:{clean:"rimraf dist",dev:"pnpm -w dev","docs:code":"typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup","docs:build":"rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts","docs:verify":"pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify","docs:pre:vitepress":"pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts","docs:build:vitepress":"pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing","docs:dev":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:dev:docker":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:serve":"pnpm docs:build:vitepress && vitepress serve src/vitepress","docs:spellcheck":'cspell "src/docs/**/*.md"',"docs:release-version":"tsx scripts/update-release-version.mts","docs:verify-version":"tsx scripts/update-release-version.mts --verify","types:build-config":"tsx scripts/create-types-from-json-schema.mts","types:verify-config":"tsx scripts/create-types-from-json-schema.mts --verify",checkCircle:"npx madge --circular ./src",prepublishOnly:"pnpm docs:verify-version"},repository:{type:"git",url:"https://github.com/mermaid-js/mermaid"},author:"Knut Sveidqvist",license:"MIT",standard:{ignore:["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],globals:["page"]},dependencies:{"@braintree/sanitize-url":"^7.1.1","@iconify/utils":"^3.0.1","@mermaid-js/parser":"workspace:^","@types/d3":"^7.4.3",cytoscape:"^3.29.3","cytoscape-cose-bilkent":"^4.1.0","cytoscape-fcose":"^2.2.0",d3:"^7.9.0","d3-sankey":"^0.12.3","dagre-d3-es":"7.0.13",dayjs:"^1.11.18",dompurify:"^3.2.5",katex:"^0.16.22",khroma:"^2.1.0","lodash-es":"^4.17.21",marked:"^16.2.1",roughjs:"^4.6.6",stylis:"^4.3.6","ts-dedent":"^2.2.0",uuid:"^11.1.0"},devDependencies:{"@adobe/jsonschema2md":"^8.0.5","@iconify/types":"^2.0.0","@types/cytoscape":"^3.21.9","@types/cytoscape-fcose":"^2.2.4","@types/d3-sankey":"^0.12.4","@types/d3-scale":"^4.0.9","@types/d3-scale-chromatic":"^3.1.0","@types/d3-selection":"^3.0.11","@types/d3-shape":"^3.1.7","@types/jsdom":"^21.1.7","@types/katex":"^0.16.7","@types/lodash-es":"^4.17.12","@types/micromatch":"^4.0.9","@types/stylis":"^4.2.7","@types/uuid":"^10.0.0",ajv:"^8.17.1",canvas:"^3.1.2",chokidar:"3.6.0",concurrently:"^9.1.2","csstree-validator":"^4.0.1",globby:"^14.1.0",jison:"^0.4.18","js-base64":"^3.7.8",jsdom:"^26.1.0","json-schema-to-typescript":"^15.0.4",micromatch:"^4.0.8","path-browserify":"^1.0.1",prettier:"^3.5.3",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-gfm":"^4.0.1",rimraf:"^6.0.1","start-server-and-test":"^2.0.13","type-fest":"^4.35.0",typedoc:"^0.28.12","typedoc-plugin-markdown":"^4.8.1",typescript:"~5.7.3","unist-util-flatmap":"^1.0.0","unist-util-visit":"^5.0.0",vitepress:"^1.6.4","vitepress-plugin-search":"1.0.4-alpha.22"},files:["dist/","README.md"],publishConfig:{access:"public"}}},50656:function(t,e,r){"use strict";r.d(e,{Z:function(){return ra}});var i=r(8441),n=r(34960),o=r(56405),a=r(63025);r(19328),r(54973),r(11866),r(10507),r(33281);var s=r(66691),l=r(94705),h=r(55166),c=r(31954),u=r(69553),d=r(84370),p="comm",f="rule",g="decl",m=Math.abs,y=String.fromCharCode;function x(t,e,r){return t.replace(e,r)}function b(t,e){return 0|t.charCodeAt(e)}function k(t,e,r){return t.slice(e,r)}function C(t){return t.length}function _(t,e){return e.push(t),t}function v(t,e){for(var r="",i=0;i<t.length;i++)r+=e(t[i],i,t,e)||"";return r}function w(t,e,r,i){switch(t.type){case"@layer":if(t.children.length)break;case"@import":case"@namespace":case g:return t.return=t.return||t.value;case p:return"";case"@keyframes":return t.return=t.value+"{"+v(t.children,i)+"}";case f:if(!C(t.value=t.props.join(",")))return""}return C(r=v(t.children,i))?t.return=t.value+"{"+r+"}":""}var T=1,S=1,M=0,B=0,L=0,F="";function A(t,e,r,i,n,o,a,s){return{value:t,root:e,parent:r,type:i,props:n,children:o,line:T,column:S,length:a,return:"",siblings:s}}function W(){return L=B<M?b(F,B++):0,S++,10===L&&(S=1,T++),L}function E(){return b(F,B)}function O(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function $(t){var e,r;return(e=B-1,r=function t(e){for(;W();)switch(L){case e:return B;case 34:case 39:34!==e&&39!==e&&t(L);break;case 40:41===e&&t(e);break;case 92:W()}return B}(91===t?t+2:40===t?t+1:t),k(F,e,r)).trim()}function I(t,e,r,i,n,o,a,s,l,h,c,u){for(var d=n-1,p=0===n?o:[""],g=p.length,y=0,b=0,C=0;y<i;++y)for(var _=0,v=k(t,d+1,d=m(b=a[y])),w=t;_<g;++_)(w=(b>0?p[_]+" "+v:x(v,/&\f/g,p[_])).trim())&&(l[C++]=w);return A(t,e,r,0===n?f:s,l,h,c,u)}function D(t,e,r,i,n){return A(t,e,r,g,k(t,0,i),k(t,i+1,-1),i,n)}var Z=r(18848),z=r(45130),q={id:"c4",detector:(0,c.eW)(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),loader:(0,c.eW)(async()=>{let{diagram:t}=await r.e(5387).then(r.bind(r,65387));return{id:"c4",diagram:t}},"loader")},N="flowchart",P=(0,c.eW)((t,e)=>e?.flowchart?.defaultRenderer!=="dagre-wrapper"&&e?.flowchart?.defaultRenderer!=="elk"&&/^\s*graph/.test(t),"detector"),R=(0,c.eW)(async()=>{let{diagram:t}=await r.e(7753).then(r.bind(r,77753));return{id:N,diagram:t}},"loader"),j={id:N,detector:P,loader:R},H="flowchart-v2",U=(0,c.eW)((t,e)=>e?.flowchart?.defaultRenderer!=="dagre-d3"&&(e?.flowchart?.defaultRenderer==="elk"&&(e.layout="elk"),!!/^\s*graph/.test(t)&&e?.flowchart?.defaultRenderer==="dagre-wrapper"||/^\s*flowchart/.test(t)),"detector"),Y=(0,c.eW)(async()=>{let{diagram:t}=await r.e(7753).then(r.bind(r,77753));return{id:H,diagram:t}},"loader"),G={id:H,detector:U,loader:Y},V={id:"er",detector:(0,c.eW)(t=>/^\s*erDiagram/.test(t),"detector"),loader:(0,c.eW)(async()=>{let{diagram:t}=await r.e(1582).then(r.bind(r,51582));return{id:"er",diagram:t}},"loader")},X="gitGraph",Q=(0,c.eW)(t=>/^\s*gitGraph/.test(t),"detector"),K=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(4327),r.e(3574)]).then(r.bind(r,43574));return{id:X,diagram:t}},"loader"),J={id:X,detector:Q,loader:K},tt="gantt",te=(0,c.eW)(t=>/^\s*gantt/.test(t),"detector"),tr=(0,c.eW)(async()=>{let{diagram:t}=await r.e(1817).then(r.bind(r,31817));return{id:tt,diagram:t}},"loader"),ti={id:tt,detector:te,loader:tr},tn="info",to=(0,c.eW)(t=>/^\s*info/.test(t),"detector"),ta=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(4327),r.e(8841)]).then(r.bind(r,78841));return{id:tn,diagram:t}},"loader"),ts={id:tn,detector:to,loader:ta},tl={id:"pie",detector:(0,c.eW)(t=>/^\s*pie/.test(t),"detector"),loader:(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(4327),r.e(6163)]).then(r.bind(r,62626));return{id:"pie",diagram:t}},"loader")},th="quadrantChart",tc=(0,c.eW)(t=>/^\s*quadrantChart/.test(t),"detector"),tu=(0,c.eW)(async()=>{let{diagram:t}=await r.e(8772).then(r.bind(r,58772));return{id:th,diagram:t}},"loader"),td={id:th,detector:tc,loader:tu},tp="xychart",tf=(0,c.eW)(t=>/^\s*xychart(-beta)?/.test(t),"detector"),tg=(0,c.eW)(async()=>{let{diagram:t}=await r.e(3991).then(r.bind(r,53991));return{id:tp,diagram:t}},"loader"),tm={id:tp,detector:tf,loader:tg},ty="requirement",tx=(0,c.eW)(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),tb=(0,c.eW)(async()=>{let{diagram:t}=await r.e(1015).then(r.bind(r,71015));return{id:ty,diagram:t}},"loader"),tk={id:ty,detector:tx,loader:tb},tC="sequence",t_=(0,c.eW)(t=>/^\s*sequenceDiagram/.test(t),"detector"),tv=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(2603),r.e(1423)]).then(r.bind(r,70872));return{id:tC,diagram:t}},"loader"),tw={id:tC,detector:t_,loader:tv},tT="class",tS=(0,c.eW)((t,e)=>e?.class?.defaultRenderer!=="dagre-wrapper"&&/^\s*classDiagram/.test(t),"detector"),tM=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(2689),r.e(5813)]).then(r.bind(r,45813));return{id:tT,diagram:t}},"loader"),tB={id:tT,detector:tS,loader:tM},tL="classDiagram",tF=(0,c.eW)((t,e)=>!!/^\s*classDiagram/.test(t)&&e?.class?.defaultRenderer==="dagre-wrapper"||/^\s*classDiagram-v2/.test(t),"detector"),tA=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(2689),r.e(7290)]).then(r.bind(r,97290));return{id:tL,diagram:t}},"loader"),tW={id:tL,detector:tF,loader:tA},tE="state",tO=(0,c.eW)((t,e)=>e?.state?.defaultRenderer!=="dagre-wrapper"&&/^\s*stateDiagram/.test(t),"detector"),t$=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(8522),r.e(3843),r.e(7665),r.e(9552)]).then(r.bind(r,49552));return{id:tE,diagram:t}},"loader"),tI={id:tE,detector:tO,loader:t$},tD="stateDiagram",tZ=(0,c.eW)((t,e)=>!!(/^\s*stateDiagram-v2/.test(t)||/^\s*stateDiagram/.test(t)&&e?.state?.defaultRenderer==="dagre-wrapper"),"detector"),tz=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(7665),r.e(7004)]).then(r.bind(r,47004));return{id:tD,diagram:t}},"loader"),tq={id:tD,detector:tZ,loader:tz},tN="journey",tP=(0,c.eW)(t=>/^\s*journey/.test(t),"detector"),tR=(0,c.eW)(async()=>{let{diagram:t}=await r.e(7415).then(r.bind(r,77415));return{id:tN,diagram:t}},"loader"),tj={id:tN,detector:tP,loader:tR},tH={draw:(0,c.eW)((t,e,r)=>{c.cM.debug("rendering svg for syntax error\n");let i=(0,n.P)(e),o=i.append("g");i.attr("viewBox","0 0 2412 512"),(0,h.v2)(i,100,512,!0),o.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),o.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),o.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),o.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),o.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),o.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),o.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),o.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw")},tU={db:{},renderer:tH,parser:{parse:(0,c.eW)(()=>{},"parse")}},tY="flowchart-elk",tG=(0,c.eW)((t,e={})=>!!(/^\s*flowchart-elk/.test(t)||/^\s*(flowchart|graph)/.test(t)&&e?.flowchart?.defaultRenderer==="elk")&&(e.layout="elk",!0),"detector"),tV=(0,c.eW)(async()=>{let{diagram:t}=await r.e(7753).then(r.bind(r,77753));return{id:tY,diagram:t}},"loader"),tX={id:tY,detector:tG,loader:tV},tQ="timeline",tK=(0,c.eW)(t=>/^\s*timeline/.test(t),"detector"),tJ=(0,c.eW)(async()=>{let{diagram:t}=await r.e(5126).then(r.bind(r,95126));return{id:tQ,diagram:t}},"loader"),t0={id:tQ,detector:tK,loader:tJ},t1="mindmap",t2=(0,c.eW)(t=>/^\s*mindmap/.test(t),"detector"),t3=(0,c.eW)(async()=>{let{diagram:t}=await r.e(6678).then(r.bind(r,56678));return{id:t1,diagram:t}},"loader"),t5={id:t1,detector:t2,loader:t3},t6="kanban",t4=(0,c.eW)(t=>/^\s*kanban/.test(t),"detector"),t8=(0,c.eW)(async()=>{let{diagram:t}=await r.e(2398).then(r.bind(r,72398));return{id:t6,diagram:t}},"loader"),t9={id:t6,detector:t4,loader:t8},t7="sankey",et=(0,c.eW)(t=>/^\s*sankey(-beta)?/.test(t),"detector"),ee=(0,c.eW)(async()=>{let{diagram:t}=await r.e(383).then(r.bind(r,383));return{id:t7,diagram:t}},"loader"),er={id:t7,detector:et,loader:ee},ei="packet",en=(0,c.eW)(t=>/^\s*packet(-beta)?/.test(t),"detector"),eo=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(4327),r.e(8288)]).then(r.bind(r,78288));return{id:ei,diagram:t}},"loader"),ea={id:ei,detector:en,loader:eo},es="radar",el=(0,c.eW)(t=>/^\s*radar-beta/.test(t),"detector"),eh=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(4327),r.e(2526)]).then(r.bind(r,2526));return{id:es,diagram:t}},"loader"),ec={id:es,detector:el,loader:eh},eu="block",ed=(0,c.eW)(t=>/^\s*block(-beta)?/.test(t),"detector"),ep=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(8522),r.e(4212)]).then(r.bind(r,54212));return{id:eu,diagram:t}},"loader"),ef={id:eu,detector:ed,loader:ep},eg="architecture",em=(0,c.eW)(t=>/^\s*architecture/.test(t),"detector"),ey=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(1264),r.e(6792),r.e(4327),r.e(6143)]).then(r.bind(r,66143));return{id:eg,diagram:t}},"loader"),ex={id:eg,detector:em,loader:ey},eb="treemap",ek=(0,c.eW)(t=>/^\s*treemap/.test(t),"detector"),eC=(0,c.eW)(async()=>{let{diagram:t}=await Promise.all([r.e(6792),r.e(4327),r.e(9834)]).then(r.bind(r,9834));return{id:eb,diagram:t}},"loader"),e_={id:eb,detector:ek,loader:eC},ev=!1,ew=(0,c.eW)(()=>{ev||(ev=!0,(0,h.Cq)("error",tU,t=>"error"===t.toLowerCase().trim()),(0,h.Cq)("---",{db:{clear:(0,c.eW)(()=>{},"clear")},styles:{},renderer:{draw:(0,c.eW)(()=>{},"draw")},parser:{parse:(0,c.eW)(()=>{throw Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:(0,c.eW)(()=>null,"init")},t=>t.toLowerCase().trimStart().startsWith("---")),(0,h.KO)(tX,t5,ex),(0,h.KO)(q,t9,tW,tB,V,ti,ts,tl,tk,tw,G,j,t0,J,tq,tI,tj,td,er,ea,tm,ef,ec,e_))},"addDiagrams"),eT=(0,c.eW)(async()=>{c.cM.debug("Loading registered diagrams");let t=(await Promise.allSettled(Object.entries(h.Bf).map(async([t,{detector:e,loader:r}])=>{if(r)try{(0,h._7)(t)}catch{try{let{diagram:t,id:i}=await r();(0,h.Cq)(i,t,e)}catch(e){throw c.cM.error(`Failed to load external diagram with key ${t}. Removing from detectors.`),delete h.Bf[t],e}}}))).filter(t=>"rejected"===t.status);if(t.length>0){for(let e of(c.cM.error(`Failed to load ${t.length} external diagrams`),t))c.cM.error(e);throw Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams");function eS(t,e){t.attr("role","graphics-document document"),""!==e&&t.attr("aria-roledescription",e)}function eM(t,e,r,i){if(void 0!==t.insert){if(r){let e=`chart-desc-${i}`;t.attr("aria-describedby",e),t.insert("desc",":first-child").attr("id",e).text(r)}if(e){let r=`chart-title-${i}`;t.attr("aria-labelledby",r),t.insert("title",":first-child").attr("id",r).text(e)}}}(0,c.eW)(eS,"setA11yDiagramInfo"),(0,c.eW)(eM,"addSVGa11yTitleDescription");var eB=class t{constructor(t,e,r,i,n){this.type=t,this.text=e,this.db=r,this.parser=i,this.renderer=n}static{(0,c.eW)(this,"Diagram")}static async fromText(e,r={}){let i=(0,h.iE)(),n=(0,h.Vg)(e,i);e=(0,l.Vy)(e)+"\n";try{(0,h._7)(n)}catch{let t=(0,h.cq)(n);if(!t)throw new h.cj(`Diagram ${n} not found.`);let{id:e,diagram:r}=await t();(0,h.Cq)(e,r)}let{db:o,parser:a,renderer:s,init:c}=(0,h._7)(n);return a.parser&&(a.parser.yy=o),o.clear?.(),c?.(i),r.title&&o.setDiagramTitle?.(r.title),await a.parse(e),new t(n,e,o,a,s)}async render(t,e){await this.renderer.draw(this.text,t,e,this)}getParser(){return this.parser}getType(){return this.type}},eL=[],eF=(0,c.eW)(()=>{eL.forEach(t=>{t()}),eL=[]},"attachFunctions"),eA=(0,c.eW)(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function eW(t){let e=t.match(h.M6);if(!e)return{text:t,metadata:{}};let r=(0,o.z)(e[1],{schema:o.A})??{};r="object"!=typeof r||Array.isArray(r)?{}:r;let i={};return r.displayMode&&(i.displayMode=r.displayMode.toString()),r.title&&(i.title=r.title.toString()),r.config&&(i.config=r.config),{text:t.slice(e[0].length),metadata:i}}(0,c.eW)(eW,"extractFrontMatter");var eE=(0,c.eW)(t=>t.replace(/\r\n?/g,"\n").replace(/<(\w+)([^>]*)>/g,(t,e,r)=>"<"+e+r.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),eO=(0,c.eW)(t=>{let{text:e,metadata:r}=eW(t),{displayMode:i,title:n,config:o={}}=r;return i&&(o.gantt||(o.gantt={}),o.gantt.displayMode=i),{title:n,config:o,text:e}},"processFrontmatter"),e$=(0,c.eW)(t=>{let e=l.w8.detectInit(t)??{},r=l.w8.detectDirective(t,"wrap");return Array.isArray(r)?e.wrap=r.some(({type:t})=>"wrap"===t):r?.type==="wrap"&&(e.wrap=!0),{text:(0,l.tf)(t),directive:e}},"processDirectives");function eI(t){let e=eO(eE(t)),r=e$(e.text),i=(0,l.Rb)(e.config,r.directive);return{code:t=eA(r.text),title:e.title,config:i}}function eD(t){return btoa(Array.from(new TextEncoder().encode(t),t=>String.fromCodePoint(t)).join(""))}(0,c.eW)(eI,"preprocessDiagram"),(0,c.eW)(eD,"toBase64");var eZ=["foreignobject"],ez=["dominant-baseline"];function eq(t){let e=eI(t);return(0,h.mc)(),(0,h.XV)(e.config??{}),e}async function eN(t,e){ew();try{let{code:e,config:r}=eq(t);return{diagramType:(await eK(e)).type,config:r}}catch(t){if(e?.suppressErrors)return!1;throw t}}(0,c.eW)(eq,"processAndSetConfigs"),(0,c.eW)(eN,"parse");var eP=(0,c.eW)((t,e,r=[])=>`
|
|
144
144
|
.${t} ${e} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),eR=(0,c.eW)((t,e=new Map)=>{let r="";if(void 0!==t.themeCSS&&(r+=`
|
|
145
145
|
${t.themeCSS}`),void 0!==t.fontFamily&&(r+=`
|
|
146
146
|
:root { --mermaid-font-family: ${t.fontFamily}}`),void 0!==t.altFontFamily&&(r+=`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8091],{20318:function(e,t,n){n.d(t,{Ix:function(){return x},pm:function(){return m}});var r=n(57437),a=n(2265),s=n(41671),l=n(99388),o=n(33245),i=n(32489),c=n(3468);function d(e){let{type:t,iconColor:n}=e,a="h-5 w-5 ".concat(n);switch(t){case"success":return(0,r.jsx)(s.Z,{className:a,"data-testid":"toast-icon-success"});case"error":return(0,r.jsx)(l.Z,{className:a,"data-testid":"toast-icon-error"});default:return(0,r.jsx)(o.Z,{className:a,"data-testid":"toast-icon-info"})}}function u(e){let{id:t,message:n,type:s,onClose:l,duration:o=3e3}=e,c=(0,a.useRef)(null),u=function(e){switch(e){case"success":return{bgColor:"bg-green-50",borderColor:"border-green-200",textColor:"text-green-800",iconColor:"text-green-500"};case"error":return{bgColor:"bg-red-50",borderColor:"border-red-200",textColor:"text-red-800",iconColor:"text-red-500"};default:return{bgColor:"bg-blue-50",borderColor:"border-blue-200",textColor:"text-blue-800",iconColor:"text-blue-500"}}}(s);(0,a.useEffect)(()=>(o>0&&(c.current=setTimeout(()=>{l(t)},o)),()=>{c.current&&clearTimeout(c.current)}),[t,o,l]);let x=(0,a.useCallback)(()=>{c.current&&clearTimeout(c.current),l(t)},[t,l]);return(0,r.jsxs)("div",{"data-testid":"toast-".concat(t),role:"alert",className:"\n ".concat(u.bgColor,"\n ").concat(u.borderColor,"\n ").concat(u.textColor,"\n border rounded-lg shadow-lg p-4 min-w-[300px] max-w-[400px]\n flex items-start gap-3\n animate-slide-in\n "),children:[(0,r.jsx)(d,{type:s,iconColor:u.iconColor}),(0,r.jsx)("p",{className:"flex-1 text-sm font-medium",children:n}),(0,r.jsx)("button",{"data-testid":"toast-close-button",onClick:x,"aria-label":"Close notification",className:"\n ".concat(u.textColor,"\n hover:opacity-70\n focus:outline-none focus:ring-2 focus:ring-offset-2\n transition-opacity\n "),children:(0,r.jsx)(i.Z,{className:"h-4 w-4"})})]})}function x(e){let{toasts:t,onClose:n}=e;return(0,r.jsx)("div",{"data-testid":"toast-container","aria-live":"polite",className:"fixed bottom-4 right-4 flex flex-col gap-2",style:{zIndex:c.k.TOAST},children:t.map(e=>(0,r.jsx)(u,{id:e.id,message:e.message,type:e.type,onClose:n,duration:e.duration},e.id))})}function m(){let[e,t]=(0,a.useState)([]),n=(0,a.useRef)(0);return{toasts:e,showToast:(0,a.useCallback)(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,s="toast-".concat(++n.current,"-").concat(Date.now()),l={id:s,message:e,type:r,duration:a};return t(e=>[...e,l]),s},[]),removeToast:(0,a.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),clearToasts:(0,a.useCallback)(()=>{t([])},[])}}},8820:function(e,t,n){n.d(t,{Vw:function(){return z}});var r=n(57437),a=n(2265);n(27648);var s=n(43241),l=n(58819),o=n(99376),i=n(34021),c=n(8672);function d(e){let{status:t,label:n}=e,a=c.F4[t],s="".concat(n,": ").concat(a.label);return"spinner"===a.type?(0,r.jsx)("span",{className:"w-2 h-2 rounded-full flex-shrink-0 border-2 border-t-transparent animate-spin ".concat(a.className),title:s,"aria-label":s}):(0,r.jsx)("span",{className:"w-2 h-2 rounded-full flex-shrink-0 ".concat(a.className),title:s,"aria-label":s})}let u=(0,a.memo)(function(e){let{branch:t,isSelected:n,onClick:a}=e;return(0,r.jsxs)("button",{"data-testid":"branch-list-item",onClick:a,"aria-current":n?"true":void 0,className:"\n w-full px-4 py-3 flex flex-col gap-1\n hover:bg-gray-800 transition-colors\n focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500\n ".concat(n?"bg-gray-700 border-l-2 border-blue-500":"border-l-2 border-transparent","\n "),children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 w-full",children:[t.cliStatus&&(0,r.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0","aria-label":"CLI tool status",children:[(0,r.jsx)(d,{status:t.cliStatus.claude,label:"Claude"}),(0,r.jsx)(d,{status:t.cliStatus.codex,label:"Codex"})]}),(0,r.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-white truncate",children:t.name}),(0,r.jsx)("p",{className:"text-xs text-gray-400 truncate",children:t.repositoryName})]}),t.hasUnread&&(0,r.jsx)("span",{"data-testid":"unread-indicator",className:"w-2 h-2 rounded-full bg-blue-500 flex-shrink-0","aria-label":"Has unread messages"})]}),t.description&&(0,r.jsx)("div",{"data-testid":"branch-description",className:"pl-6 pr-2 mt-1 text-left",children:(0,r.jsx)("p",{className:"text-xs text-gray-400 line-clamp-2",children:t.description})})]})}),x=[{key:"updatedAt",label:"Updated"},{key:"repositoryName",label:"Repository"},{key:"branchName",label:"Branch"},{key:"status",label:"Status"}],m=(0,a.memo)(function(){var e;let{sortKey:t,sortDirection:n,setSortKey:l,setSortDirection:o}=(0,s.Sz)(),[i,c]=(0,a.useState)(!1),d=(0,a.useRef)(null);(0,a.useEffect)(()=>{function e(e){d.current&&!d.current.contains(e.target)&&c(!1)}if(i)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]),(0,a.useEffect)(()=>{function e(e){"Escape"===e.key&&c(!1)}if(i)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[i]);let u=(0,a.useCallback)(()=>{c(e=>!e)},[]),m=(0,a.useCallback)(e=>{e===t?o("asc"===n?"desc":"asc"):(l(e),o("updatedAt"===e?"desc":"asc")),c(!1)},[t,n,l,o]),p=(0,a.useCallback)(()=>{o("asc"===n?"desc":"asc")},[n,o]),b=(null===(e=x.find(e=>e.key===t))||void 0===e?void 0:e.label)||"Sort";return(0,r.jsxs)("div",{ref:d,className:"relative","data-testid":"sort-selector",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsxs)("button",{type:"button",onClick:u,"aria-expanded":i,"aria-haspopup":"listbox","aria-label":"Sort by ".concat(b),className:" flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors ",children:[(0,r.jsx)(h,{className:"w-3 h-3"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:b})]}),(0,r.jsx)("button",{type:"button",onClick:p,"aria-label":"asc"===n?"Sort ascending":"Sort descending",className:" p-1 rounded text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors ",children:"asc"===n?(0,r.jsx)(f,{className:"w-3 h-3"}):(0,r.jsx)(g,{className:"w-3 h-3"})})]}),i&&(0,r.jsx)("div",{role:"listbox","aria-label":"Sort options",className:" absolute right-0 top-full mt-1 z-50 min-w-[140px] py-1 rounded-md shadow-lg bg-gray-800 border border-gray-600 ",children:x.map(e=>(0,r.jsxs)("button",{type:"button",role:"option","aria-selected":t===e.key,onClick:()=>m(e.key),className:"\n w-full px-3 py-2 text-left text-sm\n flex items-center justify-between\n hover:bg-gray-700 transition-colors\n ".concat(t===e.key?"text-blue-400":"text-gray-300","\n "),children:[(0,r.jsx)("span",{children:e.label}),t===e.key&&(0,r.jsx)("span",{className:"text-xs",children:"asc"===n?"ASC":"DESC"})]},e.key))})]})});function h(e){let{className:t}=e;return(0,r.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4h13M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"})})}function f(e){let{className:t}=e;return(0,r.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}function g(e){let{className:t}=e;return(0,r.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}var p=n(69234);let b=["en","ja"],y={en:"English",ja:"日本語"};function v(){let{currentLocale:e,switchLocale:t}={currentLocale:(0,p.bU)(),switchLocale:e=>{b.includes(e)&&(!function(e){let t="https:"===window.location.protocol;document.cookie="".concat("locale","=").concat(e,";path=/;max-age=").concat(31536e3,";SameSite=Lax").concat(t?";Secure":"")}(e),localStorage.setItem("locale",e),window.location.reload())}};return(0,r.jsx)("select",{value:e,onChange:e=>t(e.target.value),"aria-label":"Language",className:" w-full px-3 py-2 rounded-md bg-gray-800 text-white border border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm ",children:b.map(e=>(0,r.jsx)("option",{value:e,children:y[e]},e))})}var w=n(38706),j=n(14362);function N(){let e=(0,w.T)("auth"),t=(0,j.m)(),[n,s]=(0,a.useState)(!1);if(!t)return null;async function l(){s(!0);try{await fetch("/api/auth/logout",{method:"POST"}),window.location.href="/login"}catch(e){window.location.href="/login"}}return(0,r.jsx)("button",{type:"button",onClick:l,disabled:n,"data-testid":"logout-button",className:" w-full px-3 py-2 text-sm text-left rounded-md text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 transition-colors ",children:n?"...":e("logout.button")})}var k=n(47712);let C={waiting:0,ready:1,running:2,generating:3,idle:4},S=(0,a.memo)(function(){let e=(0,o.useRouter)(),{worktrees:t,selectedWorktreeId:n,selectWorktree:l}=(0,i.Mu)(),{closeMobileDrawer:c,sortKey:d,sortDirection:x}=(0,s.Sz)(),[h,f]=(0,a.useState)(""),g=(0,a.useMemo)(()=>{let e=t.map(k.I_),n=e;if(h.trim()){let t=h.toLowerCase();n=e.filter(e=>e.name.toLowerCase().includes(t)||e.repositoryName.toLowerCase().includes(t))}return function(e,t,n){let r=[...e];return r.sort((e,r)=>{let a=0;switch(t){case"updatedAt":{let t=e=>e?e instanceof Date?e.getTime():new Date(e).getTime():0,n=t(e.lastActivity);a=t(r.lastActivity)-n;break}case"repositoryName":{let t=e.repositoryName.toLowerCase(),n=r.repositoryName.toLowerCase();a=t.localeCompare(n);break}case"branchName":{let t=e.name.toLowerCase(),n=r.name.toLowerCase();a=t.localeCompare(n);break}case"status":a=C[e.status]-C[r.status]}return("updatedAt"===t?"desc"===n:"asc"===n)?a:-a}),r}(n,d,x)},[t,h,d,x]),p=t=>{l(t),e.push("/worktrees/".concat(t)),c()};return(0,r.jsxs)("nav",{"data-testid":"sidebar","aria-label":"Branch navigation",className:"h-full flex flex-col bg-gray-900 text-white",role:"navigation",children:[(0,r.jsx)("div",{"data-testid":"sidebar-header",className:"flex-shrink-0 px-4 py-4 border-b border-gray-700",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Branches"}),(0,r.jsx)(m,{})]})}),(0,r.jsx)("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-700",children:(0,r.jsx)("input",{type:"text",placeholder:"Search branches...",value:h,onChange:e=>f(e.target.value),className:" w-full px-3 py-2 rounded-md bg-gray-800 text-white placeholder-gray-400 border border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent "})}),(0,r.jsx)("div",{"data-testid":"branch-list",className:"flex-1 overflow-y-auto",children:0===g.length?(0,r.jsx)("div",{className:"px-4 py-8 text-center text-gray-400",children:h?"No branches found":"No branches available"}):g.map(e=>(0,r.jsx)(u,{branch:e,isSelected:e.id===n,onClick:()=>p(e.id)},e.id))}),(0,r.jsxs)("div",{className:"flex-shrink-0 px-4 py-3 border-t border-gray-700 space-y-2",children:[(0,r.jsx)(v,{}),(0,r.jsx)(N,{})]})]})});var L=n(3468);let E="transform transition-transform duration-300 ease-out",z=(0,a.memo)(function(e){let{children:t}=e,{isOpen:n,isMobileDrawerOpen:a,closeMobileDrawer:o}=(0,s.Sz)();return(0,l.d)()?(0,r.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[a&&(0,r.jsx)("div",{"data-testid":"drawer-overlay",className:"fixed inset-0 bg-black/50 z-40",onClick:o,"aria-hidden":"true"}),(0,r.jsx)("aside",{"data-testid":"sidebar-container",className:"\n fixed left-0 top-0 h-full w-72 z-50\n ".concat(E,"\n ").concat(a?"translate-x-0":"-translate-x-full","\n "),role:"complementary",children:(0,r.jsx)(S,{})}),(0,r.jsx)("main",{className:"flex-1 min-h-0 overflow-hidden",role:"main",children:t})]}):(0,r.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex",children:[(0,r.jsx)("aside",{"data-testid":"sidebar-container",className:"\n fixed left-0 top-0 h-full w-72\n ".concat(E,"\n ").concat(n?"translate-x-0":"-translate-x-full","\n "),style:{zIndex:L.k.SIDEBAR},role:"complementary","aria-hidden":!n,children:(0,r.jsx)(S,{})}),(0,r.jsx)("main",{className:"\n flex-1 min-w-0 h-full overflow-hidden\n transition-[padding] duration-300 ease-out\n ".concat(n?"md:pl-72":"md:pl-0","\n "),role:"main",children:t})]})})},98702:function(e,t,n){n.d(t,{u:function(){return o}});var r=n(57437),a=n(2265),s=n(54887),l=n(3468);function o(e){let{isOpen:t,onClose:n,title:o,children:i,size:c="lg",showCloseButton:d=!0,disableClose:u=!1}=e,x=(0,a.useRef)(null);return((0,a.useEffect)(()=>{if(u)return;let e=e=>{"Escape"===e.key&&t&&n()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,n,u]),(0,a.useEffect)(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset"}),[t]),t)?(0,s.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 overflow-y-auto",style:{zIndex:l.k.MODAL},children:[(0,r.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 transition-opacity",onClick:u?void 0:n}),(0,r.jsx)("div",{className:"relative flex min-h-full items-center justify-center p-2 sm:p-4",children:(0,r.jsxs)("div",{ref:x,className:"relative w-full ".concat({sm:"max-w-[calc(100vw-2rem)] sm:max-w-md",md:"max-w-[calc(100vw-2rem)] sm:max-w-2xl",lg:"max-w-[calc(100vw-2rem)] sm:max-w-4xl",xl:"max-w-[calc(100vw-2rem)] sm:max-w-6xl",full:"max-w-[calc(100vw-2rem)] sm:max-w-[95vw]"}[c]," max-h-[calc(100vh-1rem)] sm:max-h-[calc(100vh-2rem)] flex flex-col bg-white rounded-lg shadow-xl transform transition-all"),children:[(o||d)&&(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 sm:px-6 py-3 sm:py-4 border-b border-gray-200 flex-shrink-0",children:[(0,r.jsx)("h3",{className:"text-base sm:text-lg font-semibold text-gray-900 truncate pr-2",children:o}),d&&(0,r.jsx)("button",{onClick:n,className:"text-gray-400 hover:text-gray-600 transition-colors flex-shrink-0",children:(0,r.jsx)("svg",{className:"w-5 h-5 sm:w-6 sm:h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)("div",{className:"px-4 sm:px-6 py-3 sm:py-4 overflow-y-auto flex-1 min-h-0",children:i})]})})]}),document.body):null}},10789:function(e,t,n){n.d(t,{Ct:function(){return c},zx:function(){return a},Zb:function(){return s},aY:function(){return i},Ol:function(){return l},ll:function(){return o},u_:function(){return d.u}});var r=n(57437);function a(e){let{variant:t="primary",size:n="md",fullWidth:a=!1,loading:s=!1,disabled:l,className:o="",children:i,...c}=e,d=["btn",{primary:"btn-primary",secondary:"btn-secondary",danger:"btn-danger",ghost:"bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-500"}[t],{sm:"btn-sm",md:"",lg:"btn-lg"}[n],a?"w-full":"",l||s?"opacity-50 cursor-not-allowed":"",o].filter(Boolean).join(" ");return(0,r.jsxs)("button",{className:d,disabled:l||s,...c,children:[s&&(0,r.jsxs)("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i]})}function s(e){let{hover:t=!1,padding:n="md",className:a="",children:s,...l}=e,o=["card",t?"card-hover":"",{none:"",sm:"p-3",md:"p-4",lg:"p-6"}[n],a].filter(Boolean).join(" ");return(0,r.jsx)("div",{className:o,...l,children:s})}function l(e){let{className:t="",children:n,...a}=e;return(0,r.jsx)("div",{className:"mb-3 ".concat(t),...a,children:n})}function o(e){let{className:t="",children:n,...a}=e;return(0,r.jsx)("h3",{className:"text-lg font-semibold text-gray-900 ".concat(t),...a,children:n})}function i(e){let{className:t="",children:n,...a}=e;return(0,r.jsx)("div",{className:t,...a,children:n})}function c(e){let{variant:t="gray",dot:n=!1,className:a="",children:s,...l}=e,o=["badge",{success:"badge-success",warning:"badge-warning",error:"badge-error",info:"badge-info",gray:"badge-gray"}[t],a].filter(Boolean).join(" ");return(0,r.jsxs)("span",{className:o,...l,children:[n&&(0,r.jsx)("span",{className:"mr-1.5 inline-block h-2 w-2 rounded-full ".concat({success:"bg-green-600",warning:"bg-yellow-600",error:"bg-red-600",info:"bg-blue-600",gray:"bg-gray-600"}[t]),"aria-hidden":"true"}),s]})}n(2265);var d=n(98702)},43616:function(e,t,n){n.d(t,{n:function(){return d}});var r=n(57437),a=n(2265),s=n(10789),l=n(20318),o=n(3227),i=n(32636),c=n(93448);function d(e){let{worktreeId:t}=e,[n,d]=(0,a.useState)([]),[u,x]=(0,a.useState)(null),[m,h]=(0,a.useState)(null),[f,g]=(0,a.useState)(!0),[p,b]=(0,a.useState)(null),[y,v]=(0,a.useState)(""),[w,j]=(0,a.useState)(0),[N,k]=(0,a.useState)("all"),[C,S]=(0,a.useState)(!1),{toasts:L,showToast:E,removeToast:z}=(0,l.pm)();(0,a.useEffect)(()=>{(async()=>{try{g(!0),b(null);let e=await o.Iv.getLogs(t);d(e)}catch(e){b((0,o.zG)(e))}finally{g(!1)}})()},[t]);let M=(0,a.useMemo)(()=>"all"===N?n:n.filter(e=>e.toLowerCase().includes(N)),[n,N]),T=async e=>{try{g(!0),b(null);let n=await o.Iv.getLogFile(t,e);h(n.content),x(e),v(""),j(0)}catch(e){b((0,o.zG)(e))}finally{g(!1)}},I=(0,a.useCallback)(async()=>{if(u)try{S(!0);let e=await o.Iv.getLogFile(t,u,{sanitize:!0});await (0,i.v)(e.content),E("Log copied to clipboard (sanitized)","success")}catch(e){E("Failed to export log: ".concat((0,o.zG)(e)),"error")}finally{S(!1)}},[t,u,E]),A=(0,a.useMemo)(()=>{let e;if(!y||!m)return[];let t=RegExp((0,c.hr)(y),"gi"),n=[];for(;null!==(e=t.exec(m));)n.push({index:e.index,length:e[0].length});return n},[y,m]);(0,a.useEffect)(()=>{j(0)},[y]);let D=()=>{A.length>0&&j(e=>(e+1)%A.length)},B=()=>{A.length>0&&j(e=>(e-1+A.length)%A.length)},R=(0,a.useMemo)(()=>{if(!m||!y||0===A.length)return m;let e="",t=0;return A.forEach((n,r)=>{e+=(0,c.Xv)(m.substring(t,n.index));let a=m.substring(n.index,n.index+n.length),s=r===w;e+='<mark class="'.concat(s?"bg-yellow-400 text-black":"bg-yellow-200 text-black",'" data-match-index="').concat(r,'">').concat((0,c.Xv)(a),"</mark>"),t=n.index+n.length}),e+=(0,c.Xv)(m.substring(t))},[m,y,A,w]);return(0,a.useEffect)(()=>{A.length>0&&w>=0&&setTimeout(()=>{let e=document.querySelector('mark[data-match-index="'.concat(w,'"]'));e&&e.scrollIntoView({behavior:"smooth",block:"center"})},100)},[w,A.length]),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)(s.Zb,{padding:"md",children:[(0,r.jsx)(s.Ol,{children:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(s.ll,{children:"Log Files"}),(0,r.jsx)(s.Ct,{variant:"gray",children:M.length})]}),(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,r.jsxs)(s.zx,{variant:"all"===N?"primary":"ghost",size:"sm",onClick:()=>k("all"),children:["All (",n.length,")"]}),(0,r.jsxs)(s.zx,{variant:"claude"===N?"primary":"ghost",size:"sm",onClick:()=>k("claude"),children:["Claude (",n.filter(e=>e.toLowerCase().includes("claude")).length,")"]}),(0,r.jsxs)(s.zx,{variant:"codex"===N?"primary":"ghost",size:"sm",onClick:()=>k("codex"),children:["Codex (",n.filter(e=>e.toLowerCase().includes("codex")).length,")"]}),(0,r.jsxs)(s.zx,{variant:"gemini"===N?"primary":"ghost",size:"sm",onClick:()=>k("gemini"),children:["Gemini (",n.filter(e=>e.toLowerCase().includes("gemini")).length,")"]})]})]})}),(0,r.jsxs)(s.aY,{children:[f&&0===n.length&&(0,r.jsx)("div",{className:"text-center py-4",children:(0,r.jsx)("div",{className:"inline-block animate-spin rounded-full h-6 w-6 border-4 border-gray-300 border-t-blue-600"})}),p&&(0,r.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded text-sm text-red-800",children:p}),!f&&0===M.length&&!p&&(0,r.jsx)("p",{className:"text-sm text-gray-600 text-center py-4",children:"all"===N?"No log files found":"No ".concat(N," log files found")}),M.length>0&&(0,r.jsx)("div",{className:"space-y-2",children:M.map(e=>(0,r.jsx)("button",{onClick:()=>T(e),className:"w-full text-left px-3 py-2 rounded text-sm font-mono transition-colors ".concat(u===e?"bg-blue-50 text-blue-700 border border-blue-200":"hover:bg-gray-50 border border-transparent"),children:e},e))})]})]}),u&&(0,r.jsxs)(s.Zb,{padding:"md",children:[(0,r.jsx)(s.Ol,{children:(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(s.ll,{className:"font-mono text-base",children:u}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(s.zx,{variant:"ghost",size:"sm",onClick:I,disabled:!u||C,title:"Copy sanitized log to clipboard",children:C?"Exporting...":"Export"}),(0,r.jsx)(s.zx,{variant:"ghost",size:"sm",onClick:()=>{x(null),h(null),v(""),j(0)},children:"Close"})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("div",{className:"relative flex-1",children:[(0,r.jsx)("input",{type:"text",value:y,onChange:e=>v(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.shiftKey?B():D())},placeholder:"Search in log file...",className:"input w-full pr-20"}),A.length>0&&(0,r.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-gray-500",children:[w+1," / ",A.length]})]}),A.length>0&&(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)(s.zx,{variant:"ghost",size:"sm",onClick:B,disabled:0===A.length,title:"Previous match (Shift+Enter)",children:"↑"}),(0,r.jsx)(s.zx,{variant:"ghost",size:"sm",onClick:D,disabled:0===A.length,title:"Next match (Enter)",children:"↓"})]})]})]})}),(0,r.jsxs)(s.aY,{children:[f&&(0,r.jsx)("div",{className:"text-center py-8",children:(0,r.jsx)("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-gray-300 border-t-blue-600"})}),!f&&m&&(0,r.jsx)("div",{className:"bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto max-h-[500px] scrollbar-thin",children:y&&A.length>0?(0,r.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap",dangerouslySetInnerHTML:{__html:R||""}}):(0,r.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap",children:m})}),!f&&y&&0===A.length&&m&&(0,r.jsxs)("div",{className:"text-center py-4 text-sm text-gray-500",children:['No matches found for "',y,'"']})]})]}),(0,r.jsx)(l.Ix,{toasts:L,onClose:z})]})}},6940:function(e,t,n){n.d(t,{R:function(){return x}});var r=n(57437),a=n(2265),s=n(3227);function l(e,t){if(!t.trim())return e;let n=t.toLowerCase();return e.map(e=>({...e,commands:e.commands.filter(e=>{let t=e.name.toLowerCase().includes(n),r=e.description.toLowerCase().includes(n);return t||r})})).filter(e=>e.commands.length>0)}function o(e){let{groups:t,onSelect:n,highlightedIndex:a=-1,className:s=""}=e,l=0;return 0===t.length?(0,r.jsx)("div",{className:"text-sm text-gray-500 p-4 text-center ".concat(s),children:"No commands available"}):(0,r.jsx)("div",{className:"overflow-y-auto ".concat(s),children:t.map(e=>(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("div",{className:"px-3 py-1.5 text-xs font-semibold text-gray-500 uppercase tracking-wider bg-gray-50",children:e.label}),(0,r.jsx)("div",{children:e.commands.map(e=>{let t=l;l++;let s=t===a;return(0,r.jsxs)("button",{type:"button","data-command-item":!0,"data-highlighted":s,onClick:()=>n(e),className:"w-full px-3 py-2 text-left flex items-start gap-2 hover:bg-blue-50 transition-colors ".concat(s?"bg-blue-100":""),children:[(0,r.jsxs)("span",{className:"text-blue-600 font-mono text-sm flex-shrink-0",children:["/",e.name]}),(0,r.jsx)("span",{className:"text-gray-600 text-sm truncate",children:e.description})]},e.name)})})]},e.category))})}function i(e){let{isOpen:t,groups:n,onSelect:s,onClose:i,isMobile:c=!1,position:d,onFreeInput:u}=e,[x,m]=(0,a.useState)(""),[h,f]=(0,a.useState)(0),g=(0,a.useRef)(null),p=(0,a.useMemo)(()=>l(n,x),[n,x]),b=(0,a.useMemo)(()=>p.flatMap(e=>e.commands),[p]);(0,a.useEffect)(()=>{t&&(m(""),f(0),setTimeout(()=>{var e;null===(e=g.current)||void 0===e||e.focus()},50))},[t]);let y=(0,a.useCallback)(e=>{s(e),i()},[s,i]),v=(0,a.useCallback)(e=>{if(t)switch(e.key){case"Escape":e.preventDefault(),i();break;case"ArrowDown":e.preventDefault(),f(e=>Math.min(e+1,b.length-1));break;case"ArrowUp":e.preventDefault(),f(e=>Math.max(e-1,0));break;case"Enter":e.preventDefault(),b[h]&&y(b[h])}},[t,b,h,i,y]);return((0,a.useEffect)(()=>{if(t)return document.addEventListener("keydown",v),()=>{document.removeEventListener("keydown",v)}},[t,v]),t)?c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 z-40",onClick:i,"aria-hidden":"true"}),(0,r.jsxs)("div",{"data-testid":"slash-command-bottom-sheet",className:"fixed bottom-0 left-0 right-0 bg-white rounded-t-xl z-50 max-h-[70vh] flex flex-col shadow-xl",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Commands"}),(0,r.jsx)("button",{type:"button",onClick:i,"aria-label":"Close",className:"p-2 rounded-full hover:bg-gray-100",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)("div",{className:"px-4 py-2 border-b border-gray-100",children:(0,r.jsx)("input",{ref:g,type:"text",value:x,onChange:e=>m(e.target.value),placeholder:"Search commands...",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})}),u&&(0,r.jsxs)("button",{type:"button","data-testid":"free-input-button",onClick:()=>u(x),className:"w-full px-4 py-3 text-left border-b border-gray-100 flex items-center gap-2 hover:bg-blue-50 transition-colors",children:[(0,r.jsx)("span",{className:"text-blue-600",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,r.jsx)("span",{className:"text-gray-600",children:"Enter custom command..."})]}),(0,r.jsx)(o,{groups:p,onSelect:y,highlightedIndex:h,className:"flex-1 overflow-y-auto pb-20"})]})]}):(0,r.jsxs)("div",{role:"listbox",className:"absolute bg-white border border-gray-200 rounded-lg shadow-lg z-50 w-80 max-h-96 flex flex-col",style:d?{top:d.top,left:d.left}:{bottom:"100%",left:0,marginBottom:"4px"},children:[(0,r.jsx)("div",{className:"px-3 py-2 border-b border-gray-100",children:(0,r.jsx)("input",{ref:g,type:"text",value:x,onChange:e=>m(e.target.value),placeholder:"Search commands...",className:"w-full px-3 py-1.5 text-sm border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-blue-500"})}),u&&(0,r.jsxs)("button",{type:"button","data-testid":"free-input-button",onClick:()=>u(x),className:"w-full px-3 py-2 text-left border-b border-gray-100 flex items-center gap-2 hover:bg-blue-50 transition-colors text-sm",children:[(0,r.jsx)("span",{className:"text-blue-600",children:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,r.jsx)("span",{className:"text-gray-600",children:"Enter custom command..."})]}),(0,r.jsx)(o,{groups:p,onSelect:y,highlightedIndex:h,className:"flex-1 overflow-y-auto"}),(0,r.jsxs)("div",{className:"px-3 py-1.5 border-t border-gray-100 text-xs text-gray-400 flex gap-3",children:[(0,r.jsxs)("span",{children:[(0,r.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 rounded",children:"Enter"})," select"]}),(0,r.jsxs)("span",{children:[(0,r.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 rounded",children:"Esc"})," close"]})]})]}):null}function c(e){let{worktreeId:t,cliToolId:n,disabled:s=!1,onInterrupt:l}=e,[o,i]=(0,a.useState)(!1),c=(0,a.useRef)(0),u=(0,a.useCallback)(async()=>{let e=Date.now();if(!(e-c.current<1e3)){c.current=e,i(!0);try{let e=await fetch("/api/worktrees/".concat(t,"/interrupt"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cliToolId:n})});if(e.ok)null==l||l();else{let t=await e.json().catch(()=>({}));console.error("[InterruptButton] Failed to send interrupt:",t.error||e.statusText)}}catch(e){console.error("[InterruptButton] Error sending interrupt:",e)}finally{i(!1)}}},[t,n,l]);return(0,r.jsx)("button",{type:"button",onClick:u,disabled:s||o,className:"flex-shrink-0 p-2 text-orange-600 hover:bg-orange-50 rounded-full transition-colors disabled:text-gray-300 disabled:hover:bg-transparent","aria-label":"Stop processing","data-testid":"interrupt-button",children:o?(0,r.jsxs)("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):(0,r.jsx)(d,{})})}function d(){return(0,r.jsx)("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}var u=n(58819);function x(e){let{worktreeId:t,onMessageSent:n,cliToolId:o,isSessionRunning:d=!1}=e,[x,m]=(0,a.useState)(""),[h,f]=(0,a.useState)(!1),[g,p]=(0,a.useState)(null),[b,y]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),k=(0,a.useRef)(null),C=(0,a.useRef)(null),S=(0,a.useRef)(!1),L=(0,a.useRef)(null),E=(0,u.d)(),{groups:z}=function(e,t){let[n,r]=(0,a.useState)([]),[o,i]=(0,a.useState)(!0),[c,d]=(0,a.useState)(null),[u,x]=(0,a.useState)(""),[m,h]=(0,a.useState)(t||"claude"),f=(0,a.useCallback)(async()=>{try{i(!0),d(null);let n=e?"/api/worktrees/".concat(e,"/slash-commands"):"/api/slash-commands";t&&(n+="?cliTool=".concat(t));let a=await fetch(n);if(!a.ok)throw Error("HTTP error ".concat(a.status));let s=await a.json();r(s.groups),h(s.cliTool||t||"claude")}catch(e){d((0,s.zG)(e)),r([])}finally{i(!1)}},[e,t]);(0,a.useEffect)(()=>{f()},[f]);let g=(0,a.useMemo)(()=>n.flatMap(e=>e.commands),[n]),p=(0,a.useMemo)(()=>l(n,u),[n,u]);return{groups:n,filteredGroups:p,allCommands:g,loading:o,error:c,filter:u,setFilter:x,refresh:(0,a.useCallback)(()=>{f()},[f]),cliTool:m}}(t,o);(0,a.useEffect)(()=>{let e=k.current;e&&(x?(e.style.height="auto",e.style.height="".concat(Math.min(e.scrollHeight,160),"px")):e.style.height="24px")},[x]);let M=async()=>{if(!b&&x.trim()&&!h)try{f(!0),p(null);let e=o||"claude";await s.Iv.sendMessage(t,x.trim(),e),m(""),N(!1),null==n||n(e)}catch(e){p((0,s.zG)(e))}finally{f(!1)}},T=async e=>{e.preventDefault(),await M()},I=()=>{var e;w(!1),N(!1),null===(e=k.current)||void 0===e||e.focus()};return(0,r.jsxs)("div",{ref:L,className:"space-y-2 relative",children:[g&&(0,r.jsx)("div",{className:"p-2 bg-red-50 border border-red-200 rounded text-sm text-red-800",children:g}),(0,r.jsxs)("form",{onSubmit:T,className:"flex items-end gap-2 bg-white border border-gray-300 rounded-lg px-4 py-2 focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500",children:[E&&(0,r.jsx)("button",{type:"button",onClick:()=>{j&&N(!1),w(!0)},className:"flex-shrink-0 p-2 text-gray-500 hover:text-blue-600 hover:bg-blue-50 rounded-full transition-colors","aria-label":"Show slash commands","data-testid":"mobile-command-button",children:(0,r.jsx)("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"})})}),(0,r.jsx)("textarea",{ref:k,value:x,onChange:e=>{let t=e.target.value;if(m(t),""===t){N(!1),w(!1);return}j||("/"===t||t.startsWith("/")&&!t.includes(" ")?w(!0):w(!1))},onKeyDown:e=>{let{keyCode:t}=e.nativeEvent;if(229!==t){if("Escape"===e.key&&v){e.preventDefault(),I();return}if(S.current&&"Enter"===e.key){S.current=!1;return}if("Enter"===e.key&&!b&&(!v||j)){if(E)return;e.shiftKey||(e.preventDefault(),M())}}},onCompositionStart:()=>{y(!0),S.current=!1,C.current&&clearTimeout(C.current)},onCompositionEnd:()=>{y(!1),S.current=!0,C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{S.current=!1},300)},placeholder:E?"Type your message...":"Type your message... (/ for commands, Shift+Enter for line break)",disabled:h,rows:1,className:"flex-1 outline-none bg-transparent resize-none py-1 overflow-y-auto scrollbar-thin",style:{minHeight:"24px",maxHeight:"160px"}}),(0,r.jsx)(c,{worktreeId:t,cliToolId:o||"claude",disabled:!d}),(0,r.jsx)("button",{type:"submit",disabled:!x.trim()||h,className:"flex-shrink-0 p-2 text-blue-600 hover:bg-blue-50 rounded-full transition-colors disabled:text-gray-300 disabled:hover:bg-transparent","aria-label":"Send message",children:h?(0,r.jsxs)("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):(0,r.jsx)("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})})]}),(0,r.jsx)(i,{isOpen:v,groups:z,onSelect:e=>{var t;m("/".concat(e.name," ")),w(!1),null===(t=k.current)||void 0===t||t.focus()},onClose:I,isMobile:E,onFreeInput:e=>{w(!1),N(!0),m(e?"/".concat(e):"/"),setTimeout(()=>{var e;null===(e=k.current)||void 0===e||e.focus()},50)}})]})}},8672:function(e,t,n){n.d(t,{F4:function(){return i},Ie:function(){return d},xh:function(){return c}});let r="bg-gray-500",a="bg-green-500",s="border-blue-500",l="bg-yellow-500",o="bg-red-500",i={idle:{className:r,label:"Idle",type:"dot"},ready:{className:a,label:"Ready",type:"dot"},running:{className:s,label:"Running",type:"spinner"},waiting:{className:l,label:"Waiting for response",type:"dot"},generating:{className:s,label:"Generating",type:"spinner"}},c={idle:{className:r,label:"Idle",type:"dot"},ready:{className:a,label:"Ready",type:"dot"},running:{className:s,label:"Running",type:"spinner"},waiting:{className:l,label:"Waiting for response",type:"dot"},error:{className:o,label:"Error",type:"dot"}},d={idle:{className:r,label:"Idle - No active session",type:"dot"},ready:{className:a,label:"Ready - Waiting for input",type:"dot"},running:{className:s,label:"Running - Processing",type:"spinner"},waiting:{className:l,label:"Waiting - User input required",type:"dot"},error:{className:o,label:"Error",type:"dot"}}},3468:function(e,t,n){n.d(t,{k:function(){return r}});let r={DROPDOWN:10,SIDEBAR:30,MODAL:50,MAXIMIZED_EDITOR:55,TOAST:60,CONTEXT_MENU:70}},58819:function(e,t,n){n.d(t,{G:function(){return a},d:function(){return s}});var r=n(2265);let a=768;function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{breakpoint:t=a}=e,[n,s]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let e=()=>window.innerWidth<t;s(e());let n=()=>{s(e())};return window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},[t]),n}},32636:function(e,t,n){n.d(t,{v:function(){return a}});let r=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07|\[[0-9;]*m/g;async function a(e){if(!e||0===e.trim().length)return;let t=e.replace(r,"");await navigator.clipboard.writeText(t)}},98408:function(e,t,n){n.d(t,{G:function(){return l}});var r=n(69073),a=n(8854);let s={en:a._,ja:r.ja};function l(e){var t;return null!==(t=s[e])&&void 0!==t?t:a._}},93448:function(e,t,n){function r(e,t){let n=null;return function(){for(var r=arguments.length,a=Array(r),s=0;s<r;s++)a[s]=arguments[s];n&&clearTimeout(n),n=setTimeout(()=>{e(...a),n=null},t)}}function a(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function s(e){let t=new Set;for(let n of e){t.add(n);let e=n.split("/"),r="";for(let n=0;n<e.length-1;n++)r=r?"".concat(r,"/").concat(e[n]):e[n],t.add(r)}return t}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30;return e.length<=t?e:"".concat(e.substring(0,t-3),"...")}function o(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}n.d(t,{Ds:function(){return r},Ps:function(){return s},Xv:function(){return o},aS:function(){return l},hr:function(){return a}})},47712:function(e,t,n){function r(e){return e?e.isWaitingForResponse?"waiting":e.isProcessing?"running":e.isRunning?"ready":"idle":"idle"}function a(e){var t,n;let a=!!e.lastAssistantMessageAt&&(!e.lastViewedAt||new Date(e.lastAssistantMessageAt)>new Date(e.lastViewedAt));return{id:e.id,name:e.name,repositoryName:e.repositoryName,status:"idle",hasUnread:a,lastActivity:e.updatedAt,description:e.description,cliStatus:{claude:r(null===(t=e.sessionStatusByCli)||void 0===t?void 0:t.claude),codex:r(null===(n=e.sessionStatusByCli)||void 0===n?void 0:n.codex)}}}n.d(t,{He:function(){return r},I_:function(){return a}})}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8528],{14362:function(e,t,r){r.d(t,{H:function(){return i},m:function(){return a}});var o=r(57437),n=r(2265);let s=(0,n.createContext)(!1);function i(e){let{children:t,authEnabled:r}=e;return(0,o.jsx)(s.Provider,{value:r,children:t})}function a(){return(0,n.useContext)(s)}},43241:function(e,t,r){r.d(t,{Hn:function(){return c},Sz:function(){return l}});var o=r(57437),n=r(2265);let s="mcbd-sidebar-sort",i=(0,n.createContext)(null);function a(e,t){switch(t.type){case"TOGGLE":return{...e,isOpen:!e.isOpen};case"SET_WIDTH":return{...e,width:t.width};case"OPEN_MOBILE_DRAWER":return{...e,isMobileDrawerOpen:!0};case"CLOSE_MOBILE_DRAWER":return{...e,isMobileDrawerOpen:!1};case"SET_SORT_KEY":return{...e,sortKey:t.sortKey};case"SET_SORT_DIRECTION":return{...e,sortDirection:t.sortDirection};case"LOAD_SORT_SETTINGS":return{...e,sortKey:t.sortKey,sortDirection:t.sortDirection};default:return e}}function c(e){let{children:t,initialOpen:r=!0,initialWidth:c=288}=e,[l,u]=(0,n.useReducer)(a,{isOpen:r,width:c,isMobileDrawerOpen:!1,sortKey:"updatedAt",sortDirection:"desc"});(0,n.useEffect)(()=>{try{let e=localStorage.getItem(s);if(e){let{sortKey:t,sortDirection:r}=JSON.parse(e);t&&r&&u({type:"LOAD_SORT_SETTINGS",sortKey:t,sortDirection:r})}}catch(e){}},[]),(0,n.useEffect)(()=>{try{localStorage.setItem(s,JSON.stringify({sortKey:l.sortKey,sortDirection:l.sortDirection}))}catch(e){}},[l.sortKey,l.sortDirection]);let d=(0,n.useCallback)(()=>{u({type:"TOGGLE"})},[]),y=(0,n.useCallback)(e=>{u({type:"SET_WIDTH",width:e})},[]),E=(0,n.useCallback)(()=>{u({type:"OPEN_MOBILE_DRAWER"})},[]),p=(0,n.useCallback)(()=>{u({type:"CLOSE_MOBILE_DRAWER"})},[]),S=(0,n.useCallback)(e=>{u({type:"SET_SORT_KEY",sortKey:e})},[]),T=(0,n.useCallback)(e=>{u({type:"SET_SORT_DIRECTION",sortDirection:e})},[]),w={isOpen:l.isOpen,width:l.width,isMobileDrawerOpen:l.isMobileDrawerOpen,sortKey:l.sortKey,sortDirection:l.sortDirection,toggle:d,setWidth:y,openMobileDrawer:E,closeMobileDrawer:p,setSortKey:S,setSortDirection:T};return(0,o.jsx)(i.Provider,{value:w,children:t})}function l(){let e=(0,n.useContext)(i);if(!e)throw Error("useSidebarContext must be used within a SidebarProvider");return e}},34021:function(e,t,r){r.d(t,{Mu:function(){return d},_I:function(){return u}});var o=r(57437),n=r(2265),s=r(3227);let i={PROCESSING:2e3,SESSION_RUNNING:5e3,IDLE:1e4},a=(0,n.createContext)(null),c={selectedWorktreeId:null,worktrees:[],selectedWorktreeDetail:null,isLoading:!0,isLoadingDetail:!1,error:null};function l(e,t){switch(t.type){case"SET_WORKTREES":return{...e,worktrees:t.worktrees,isLoading:!1};case"SELECT_WORKTREE":return{...e,selectedWorktreeId:t.id};case"SET_WORKTREE_DETAIL":return{...e,selectedWorktreeDetail:t.detail};case"SET_LOADING":return{...e,isLoading:t.isLoading};case"SET_LOADING_DETAIL":return{...e,isLoadingDetail:t.isLoadingDetail};case"SET_ERROR":return{...e,error:t.error,isLoading:!1};default:return e}}function u(e){let{children:t}=e,[r,u]=(0,n.useReducer)(l,c),d=(0,n.useCallback)(async()=>{u({type:"SET_LOADING",isLoading:!0}),u({type:"SET_ERROR",error:null});try{let e=await s.Iv.getAll();u({type:"SET_WORKTREES",worktrees:e.worktrees})}catch(e){u({type:"SET_ERROR",error:e instanceof Error?e.message:"Failed to fetch worktrees"})}},[]),y=(0,n.useCallback)(async e=>{u({type:"SELECT_WORKTREE",id:e}),u({type:"SET_LOADING_DETAIL",isLoadingDetail:!0}),u({type:"SET_ERROR",error:null});try{s.Iv.markAsViewed(e).catch(e=>{console.warn("[WorktreeSelectionContext] Failed to mark as viewed:",e)});let t=await s.Iv.getById(e);u({type:"SET_WORKTREE_DETAIL",detail:t})}catch(e){u({type:"SET_ERROR",error:e instanceof Error?e.message:"Failed to fetch worktree detail"})}finally{u({type:"SET_LOADING_DETAIL",isLoadingDetail:!1})}},[]),E=(0,n.useCallback)(async()=>{await d()},[d]);(0,n.useEffect)(()=>{d()},[d]),(0,n.useEffect)(()=>{let e=null,t=!0,r=async()=>{if(t)try{var o;let n=await s.Iv.getAll();u({type:"SET_WORKTREES",worktrees:n.worktrees});let a=(o=n.worktrees).some(e=>e.isProcessing||e.isWaitingForResponse)?i.PROCESSING:o.some(e=>e.isSessionRunning)?i.SESSION_RUNNING:i.IDLE;t&&(e=setTimeout(r,a))}catch(o){if(o instanceof s.MS&&401===o.status)return;console.error("[WorktreeSelectionContext] Polling error:",o),t&&(e=setTimeout(r,i.SESSION_RUNNING))}};return r(),()=>{t=!1,e&&clearTimeout(e)}},[]);let p={selectedWorktreeId:r.selectedWorktreeId,worktrees:r.worktrees,selectedWorktreeDetail:r.selectedWorktreeDetail,isLoadingDetail:r.isLoadingDetail,error:r.error,selectWorktree:y,refreshWorktrees:E};return(0,o.jsx)(a.Provider,{value:p,children:t})}function d(){let e=(0,n.useContext)(a);if(!e)throw Error("useWorktreeSelection must be used within a WorktreeSelectionProvider");return e}},3227:function(e,t,r){r.d(t,{Bb:function(){return l},Iv:function(){return s},J1:function(){return i},MS:function(){return o},nE:function(){return a},zG:function(){return c}});class o extends Error{constructor(e,t,r){super(e),this.status=t,this.data=r,this.name="ApiError"}}async function n(e,t){try{let r=new Headers(null==t?void 0:t.headers);r.set("Content-Type","application/json");let n=await fetch(e,{...t,headers:r}),s=n.headers.get("content-type")||"";if(n.redirected&&n.url.includes("/login"))throw new o("Authentication required",401);if(!n.ok){let e=s.includes("application/json")?await n.json().catch(()=>({})):{};throw new o(e.error||"HTTP error ".concat(n.status),n.status,e)}if(!s.includes("application/json"))throw new o("Unexpected response format",n.status);return n.json()}catch(e){if(e instanceof o)throw e;throw new o(e instanceof Error?e.message:"Unknown error",0,e)}}let s={getAll:async()=>n("/api/worktrees"),getById:async e=>n("/api/worktrees/".concat(e)),updateDescription:async(e,t)=>n("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({description:t})}),updateLink:async(e,t)=>n("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({link:t})}),toggleFavorite:async(e,t)=>n("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({favorite:t})}),updateStatus:async(e,t)=>n("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({status:t})}),updateCliTool:async(e,t)=>n("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({cliToolId:t})}),markAsViewed:async e=>n("/api/worktrees/".concat(e,"/viewed"),{method:"PATCH"}),async getMessages(e,t){let r=new URLSearchParams;return t&&r.append("cliTool",t),n("/api/worktrees/".concat(e,"/messages").concat(r.toString()?"?".concat(r.toString()):""))},async sendMessage(e,t,r){let o={content:t};return r&&(o.cliToolId=r),n("/api/worktrees/".concat(e,"/send"),{method:"POST",body:JSON.stringify(o)})},getLogs:async e=>n("/api/worktrees/".concat(e,"/logs")),async getLogFile(e,t,r){let o=(null==r?void 0:r.sanitize)?"?sanitize=true":"";return n("/api/worktrees/".concat(e,"/logs/").concat(t).concat(o))},killSession:async(e,t)=>n("/api/worktrees/".concat(e,"/kill-session"),{method:"POST",body:t?JSON.stringify({cliToolId:t}):void 0})},i={scan:async e=>n("/api/repositories/scan",{method:"POST",body:JSON.stringify({repositoryPath:e})}),sync:async()=>n("/api/repositories/sync",{method:"POST"}),delete:async e=>n("/api/repositories",{method:"DELETE",body:JSON.stringify({repositoryPath:e})}),clone:async e=>n("/api/repositories/clone",{method:"POST",body:JSON.stringify({cloneUrl:e})}),getCloneStatus:async e=>n("/api/repositories/clone/".concat(e)),getExcluded:async()=>n("/api/repositories/excluded"),restore:async e=>n("/api/repositories/restore",{method:"PUT",body:JSON.stringify({repositoryPath:e})})},a={getAll:async e=>(await n("/api/worktrees/".concat(e,"/memos"))).memos,create:async(e,t)=>(await n("/api/worktrees/".concat(e,"/memos"),{method:"POST",body:JSON.stringify(t||{})})).memo,update:async(e,t,r)=>(await n("/api/worktrees/".concat(e,"/memos/").concat(t),{method:"PUT",body:JSON.stringify(r)})).memo,delete:async(e,t)=>n("/api/worktrees/".concat(e,"/memos/").concat(t),{method:"DELETE"})};function c(e){return e instanceof o||e instanceof Error?e.message:"An unknown error occurred"}let l={checkForUpdate:async()=>n("/api/app/update-check",{method:"GET"})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3185],{22241:function(n,e,r){Promise.resolve().then(r.t.bind(r,2778,23)),Promise.resolve().then(r.bind(r,18828))},18828:function(n,e,r){"use strict";r.d(e,{AppProviders:function(){return u}});var t=r(57437),i=r(69234);function o(n){let{locale:e,...r}=n;if(!e)throw Error(void 0);return(0,t.jsx)(i.Pj,{locale:e,...r})}var s=r(43241),c=r(34021);function u(n){let{children:e,locale:r,messages:i}=n;return(0,t.jsx)(o,{locale:r,messages:i,children:(0,t.jsx)(s.Hn,{children:(0,t.jsx)(c._I,{children:e})})})}},2778:function(){}},function(n){n.O(0,[2461,9234,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3185],{22241:function(n,e,r){Promise.resolve().then(r.t.bind(r,2778,23)),Promise.resolve().then(r.bind(r,18828))},18828:function(n,e,r){"use strict";r.d(e,{AppProviders:function(){return u}});var t=r(57437),i=r(69234);function o(n){let{locale:e,...r}=n;if(!e)throw Error(void 0);return(0,t.jsx)(i.Pj,{locale:e,...r})}var s=r(43241),c=r(34021),l=r(14362);function u(n){let{children:e,locale:r,messages:i,timeZone:u,authEnabled:f=!1}=n;return(0,t.jsx)(o,{locale:r,messages:i,timeZone:u,children:(0,t.jsx)(l.H,{authEnabled:f,children:(0,t.jsx)(s.Hn,{children:(0,t.jsx)(c._I,{children:e})})})})}},2778:function(){}},function(n){n.O(0,[2461,9234,8528,2971,2117,1744],function(){return n(n.s=22241)}),_N_E=n.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2626],{3828:function(e,t,r){Promise.resolve().then(r.bind(r,38991))},38991:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return a}});var n=r(57437),l=r(2265),o=r(38706),u=r(14362);function a(){let e=(0,o.T)("auth"),t=(0,u.m)(),[r,a]=(0,l.useState)(""),[s,i]=(0,l.useState)(null),[d,c]=(0,l.useState)(!1),[f,h]=(0,l.useState)(null);async function m(t){t.preventDefault(),i(null),c(!0);try{let t=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:r})});if(t.ok){window.location.href="/";return}if(429===t.status){let r=t.headers.get("Retry-After"),n=r?parseInt(r,10):900;h(n),i(e("error.lockedOut"));return}if(401===t.status){i(e("error.invalidToken"));return}i(e("error.unknownError"))}catch(t){i(e("error.unknownError"))}finally{c(!1)}}return((0,l.useEffect)(()=>{t||(window.location.href="/")},[t]),(0,l.useEffect)(()=>{if(null===f||f<=0)return;let e=setInterval(()=>{h(t=>null===t||t<=1?(clearInterval(e),null):t-1)},1e3);return()=>clearInterval(e)},[f]),t)?(0,n.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gray-100 dark:bg-gray-900",children:(0,n.jsxs)("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-lg shadow-md w-full max-w-md",children:[(0,n.jsx)("h1",{className:"text-2xl font-bold mb-6 text-center text-gray-900 dark:text-white",children:e("login.title")}),(0,n.jsxs)("form",{onSubmit:m,className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"token",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("login.tokenLabel")}),(0,n.jsx)("input",{id:"token",type:"password",value:r,onChange:e=>a(e.target.value),placeholder:e("login.tokenPlaceholder"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",autoFocus:!0,autoComplete:"off",disabled:null!==f&&f>0})]}),s&&(0,n.jsxs)("div",{className:"text-red-600 dark:text-red-400 text-sm",children:[s,null!==f&&f>0&&(0,n.jsx)("div",{className:"mt-1",children:e("error.retryAfter",{minutes:Math.ceil(f/60)})})]}),(0,n.jsx)("button",{type:"submit",disabled:d||!r||null!==f&&f>0,className:"w-full py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:d?"...":e("login.submitButton")})]})]})}):null}},14362:function(e,t,r){"use strict";r.d(t,{H:function(){return u},m:function(){return a}});var n=r(57437),l=r(2265);let o=(0,l.createContext)(!1);function u(e){let{children:t,authEnabled:r}=e;return(0,n.jsx)(o.Provider,{value:r,children:t})}function a(){return(0,l.useContext)(o)}},38706:function(e,t,r){"use strict";r.d(t,{T:function(){return o}});var n=r(69234);function l(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let o=l(0,n.T_);l(0,n.Gb)}},function(e){e.O(0,[9234,2971,2117,1744],function(){return e(e.s=3828)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{14564:function(e,t,a){Promise.resolve().then(a.bind(a,66677))},99376:function(e,t,a){"use strict";var s=a(35475);a.o(s,"useParams")&&a.d(t,{useParams:function(){return s.useParams}}),a.o(s,"useRouter")&&a.d(t,{useRouter:function(){return s.useRouter}})},66677:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return C}});var s=a(57437),r=a(2265),l=a(8820),n=a(27648),i=a(10789),c=a(38706),o=a(69234),d=a(45306),x=a(98408),m=a(3227);function p(e){let{worktree:t,onSessionKilled:a,onStatusChanged:l}=e,{id:p,name:u,description:h,updatedAt:g,isSessionRunning:y,isWaitingForResponse:b,favorite:f,status:v,link:j}=t,[N,w]=(0,r.useState)(!1),[k,C]=(0,r.useState)(f||!1),[S,z]=(0,r.useState)(!1),[P,E]=(0,r.useState)(v||null),[A,L]=(0,r.useState)(!1),T=(0,c.T)(),R=(0,o.bU)(),D=(0,x.G)(R),I=g?(0,d.Q)(new Date(g),{addSuffix:!0,locale:D}):null,O="main"===u||"master"===u,M=async e=>{if(e.preventDefault(),e.stopPropagation(),confirm(T("worktree.session.confirmKill",{name:u})))try{w(!0),await m.Iv.killSession(p),a&&a()}catch(t){let e=(0,m.zG)(t);alert("".concat(T("worktree.session.failedToKill"),": ").concat(e))}finally{w(!1)}},F=async e=>{e.preventDefault(),e.stopPropagation();try{z(!0);let e=!k;await m.Iv.toggleFavorite(p,e),C(e)}catch(t){let e=(0,m.zG)(t);alert("".concat(T("worktree.errors.failedToUpdateFavorite"),": ").concat(e))}finally{z(!1)}},U=async(e,t)=>{t.preventDefault(),t.stopPropagation();try{L(!0),await m.Iv.updateStatus(p,e),E(e),l&&l()}catch(t){let e=(0,m.zG)(t);alert("".concat(T("worktree.errors.failedToUpdateStatus"),": ").concat(e))}finally{L(!1)}};return(0,s.jsx)(n.default,{href:"/worktrees/".concat(p),className:"block",children:(0,s.jsxs)(i.Zb,{hover:!0,padding:"lg",className:"h-full",children:[(0,s.jsx)(i.Ol,{children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsxs)(i.ll,{className:"flex items-center gap-2 flex-wrap",children:[(0,s.jsx)("button",{onClick:F,disabled:S,className:"flex-shrink-0 transition-colors hover:scale-110",title:k?T("common.favorites.remove"):T("common.favorites.add"),children:(0,s.jsx)("svg",{className:"w-5 h-5 ".concat(k?"fill-yellow-400 text-yellow-400":"fill-none text-gray-400"),stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})}),(0,s.jsx)("span",{className:"truncate",children:u}),O&&(0,s.jsx)(i.Ct,{variant:"info",children:"Main"}),y&&b&&(0,s.jsx)(i.Ct,{variant:"warning",dot:!0,children:T("worktree.status.waitingForResponse")}),y&&!b&&(0,s.jsx)(i.Ct,{variant:"success",dot:!0,children:T("worktree.status.responseCompleted")})]}),y&&(0,s.jsx)(i.zx,{variant:"danger",size:"sm",onClick:M,disabled:N,className:"flex-shrink-0",children:N?T("common.ending"):T("common.end")})]})}),(0,s.jsx)(i.aY,{children:(0,s.jsxs)("div",{className:"space-y-3",children:[h&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"Description"}),(0,s.jsx)("p",{className:"text-sm text-gray-700 line-clamp-2 whitespace-pre-wrap",children:h})]}),j&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"Link"}),(0,s.jsxs)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),j&&window.open(j,"_blank","noopener,noreferrer")},className:"flex items-center gap-1 text-sm text-blue-600 hover:text-blue-800 hover:underline transition-colors",title:"Open link in new tab",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),(0,s.jsx)("span",{className:"truncate",children:j})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"Status"}),(0,s.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[(0,s.jsx)("button",{onClick:e=>U(null,e),disabled:A,className:"px-2 py-1 text-xs font-medium rounded border transition-colors disabled:opacity-50 ".concat(null===P?"bg-gray-100 text-gray-700 border-gray-400":"bg-white text-gray-600 border-gray-200 hover:bg-gray-50"),children:"Not set"}),(0,s.jsx)("button",{onClick:e=>U("todo",e),disabled:A,className:"px-2 py-1 text-xs font-medium rounded border transition-colors disabled:opacity-50 ".concat("todo"===P?"bg-gray-100 text-gray-700 border-gray-400":"bg-white text-gray-600 border-gray-200 hover:bg-gray-50"),children:"ToDo"}),(0,s.jsx)("button",{onClick:e=>U("doing",e),disabled:A,className:"px-2 py-1 text-xs font-medium rounded border transition-colors disabled:opacity-50 ".concat("doing"===P?"bg-blue-100 text-blue-700 border-blue-400":"bg-white text-gray-600 border-gray-200 hover:bg-blue-50"),children:"Doing"}),(0,s.jsx)("button",{onClick:e=>U("done",e),disabled:A,className:"px-2 py-1 text-xs font-medium rounded border transition-colors disabled:opacity-50 ".concat("done"===P?"bg-green-100 text-green-700 border-green-400":"bg-white text-gray-600 border-gray-200 hover:bg-green-50"),children:"Done"})]})]}),I&&(0,s.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,s.jsx)("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,s.jsxs)("span",{children:["Updated ",I]})]})]})})]})})}function u(e){let{initialWorktrees:t=[]}=e,[a,l]=(0,r.useState)(t),[n,c]=(0,r.useState)([]),[o,d]=(0,r.useState)(!t.length),[x,u]=(0,r.useState)(null),[h,g]=(0,r.useState)(""),[y,b]=(0,r.useState)("updated"),[f,v]=(0,r.useState)("desc"),[j,N]=(0,r.useState)(null),[w,k]=(0,r.useState)(null),[C,S]=(0,r.useState)(null),[z,P]=(0,r.useState)([]),[E,A]=(0,r.useState)(!1),[L,T]=(0,r.useState)(null),R=(0,r.useCallback)(async()=>{try{let e=await m.J1.getExcluded();e.success&&P(e.repositories)}catch(e){}},[]),D=(0,r.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{e||d(!0),u(null);let t=await m.Iv.getAll();l(t.worktrees),c(t.repositories)}catch(e){u((0,m.zG)(e))}finally{e||d(!1)}},[]),I=e=>!!(e&&"session_status_changed"===e.type),{status:O}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{worktreeIds:t=[],onMessage:a,onStatusChange:s,autoReconnect:l=!0,reconnectDelay:n=3e3}=e,[i,c]=(0,r.useState)("disconnected"),o=(0,r.useRef)(null),d=(0,r.useRef)(),x=(0,r.useRef)(new Set),m=(0,r.useCallback)(e=>{c(e),null==s||s(e)},[s]),p=(0,r.useCallback)(()=>{var e;if((null===(e=o.current)||void 0===e?void 0:e.readyState)===WebSocket.OPEN)return;m("connecting");let t="https:"===window.location.protocol?"wss:":"ws:",s=new WebSocket("".concat(t,"//").concat(window.location.host));s.onopen=()=>{m("connected"),x.current.forEach(e=>{s.send(JSON.stringify({type:"subscribe",worktreeId:e}))})},s.onmessage=e=>{try{let t=JSON.parse(e.data);null==a||a(t)}catch(e){console.error("Failed to parse WebSocket message:",e)}},s.onerror=()=>{m("error")},s.onclose=()=>{m("disconnected"),o.current=null,l&&(d.current=setTimeout(()=>{p()},n))},o.current=s},[m,a,l,n]),u=(0,r.useCallback)(()=>{d.current&&clearTimeout(d.current),o.current&&(o.current.close(1e3,"Client disconnect"),o.current=null),m("disconnected")},[m]),h=(0,r.useCallback)(e=>{var t;(null===(t=o.current)||void 0===t?void 0:t.readyState)===WebSocket.OPEN&&(o.current.send(JSON.stringify({type:"subscribe",worktreeId:e})),x.current.add(e))},[]),g=(0,r.useCallback)(e=>{var t;(null===(t=o.current)||void 0===t?void 0:t.readyState)===WebSocket.OPEN&&(o.current.send(JSON.stringify({type:"unsubscribe",worktreeId:e})),x.current.delete(e))},[]),y=(0,r.useCallback)(e=>{var t;(null===(t=o.current)||void 0===t?void 0:t.readyState)===WebSocket.OPEN&&o.current.send(JSON.stringify(e))},[]);return(0,r.useEffect)(()=>(p(),()=>{u()}),[]),(0,r.useEffect)(()=>{"connected"===i&&t.length>0&&t.forEach(e=>{h(e)})},[i,t]),{status:i,subscribe:h,unsubscribe:g,sendMessage:y,connect:p,disconnect:u}}({onMessage:(0,r.useCallback)(e=>{if(I(e.data)){let t=e.data;l(e=>e.map(e=>e.id===t.worktreeId?{...e,isSessionRunning:t.isRunning}:e))}"broadcast"===e.type&&D(!0)},[D])});(0,r.useEffect)(()=>{t.length||D(),R()},[t.length,D,R]),(0,r.useEffect)(()=>{let e=setInterval(()=>{D(!0)},5e3);return()=>clearInterval(e)},[D]),(0,r.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&D(!0)};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[D]);let M=(0,r.useMemo)(()=>{let e=[...a];if(j&&(e=e.filter(e=>e.repositoryPath===j)),null!==w&&(e="unset"===w?e.filter(e=>!e.status):e.filter(e=>e.status===w)),h){let t=h.toLowerCase();e=e.filter(e=>{var a,s;return e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)||e.repositoryName.toLowerCase().includes(t)||(null===(a=e.lastMessageSummary)||void 0===a?void 0:a.toLowerCase().includes(t))||(null===(s=e.description)||void 0===s?void 0:s.toLowerCase().includes(t))})}return e.sort((e,t)=>{let a=0;switch(y){case"name":a=e.name.localeCompare(t.name);break;case"updated":a=(e.updatedAt?new Date(e.updatedAt).getTime():0)-(t.updatedAt?new Date(t.updatedAt).getTime():0);break;case"favorite":a=(e.favorite?1:0)-(t.favorite?1:0)}return"asc"===f?a:-a}),e},[a,j,w,h,y,f]),F=(0,r.useMemo)(()=>{let e=new Map;for(let t of M){let a=t.repositoryPath||"unknown";e.has(a)||e.set(a,[]),e.get(a).push(t)}return e},[M]),U=e=>{y===e?v(e=>"asc"===e?"desc":"asc"):(b(e),v("asc"))},_=async e=>{T(e);try{let t=await m.J1.restore(e);t.warning&&u(t.warning),await D(),await R()}catch(e){u((0,m.zG)(e))}finally{T(null)}},W=async(e,t)=>{var a;let s=(null===(a=n.find(t=>t.path===e))||void 0===a?void 0:a.worktreeCount)||0;if("delete"===prompt('Delete repository "'.concat(t,'"?\n\nThis will delete:\n- ').concat(s,' worktree(s)\n- Related chat history\n- Related memos\n\n* Log files will be preserved\n\nThis repository will be added to the exclusion list.\nIt will NOT be re-registered when you run "Sync All".\nYou can restore it from the excluded repositories list.\n\nType "delete" to confirm:'))){S(e);try{await m.J1.delete(e),j===e&&N(null),await D(),await R()}catch(e){u((0,m.zG)(e))}finally{S(null)}}};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,s.jsxs)(i.Ct,{variant:"gray",children:[a.length," branches"]}),n.length>0&&(0,s.jsxs)(i.Ct,{variant:"info",children:[n.length," ",1===n.length?"repository":"repositories"]}),"connected"===O&&(0,s.jsx)(i.Ct,{variant:"success",dot:!0,children:"Live"})]}),(0,s.jsx)("div",{className:"flex gap-2 w-full sm:w-auto",children:(0,s.jsx)(i.zx,{variant:"secondary",size:"sm",onClick:()=>D(),disabled:o,children:o?"Loading...":"Refresh"})})]}),(0,s.jsx)("div",{className:"flex flex-col sm:flex-row gap-3",children:(0,s.jsx)("input",{type:"text",placeholder:"Search worktrees...",value:h,onChange:e=>g(e.target.value),className:"input flex-1"})}),n.length>0&&(0,s.jsxs)("div",{className:"flex gap-2 flex-wrap items-center",children:[(0,s.jsxs)(i.zx,{variant:null===j?"primary":"ghost",size:"sm",onClick:()=>N(null),children:["All (",a.length,")"]}),n.map(e=>(0,s.jsxs)("div",{className:"relative group inline-flex items-center",children:[(0,s.jsxs)(i.zx,{variant:j===e.path?"primary":"ghost",size:"sm",onClick:()=>N(e.path),className:"pr-6",children:[e.name," (",e.worktreeCount,")"]}),(0,s.jsx)("button",{className:"absolute right-1 opacity-0 group-hover:opacity-100 text-gray-400 hover:text-red-500 transition-opacity px-1",onClick:t=>{t.stopPropagation(),W(e.path,e.name)},disabled:C===e.path,title:"Delete repository",children:C===e.path?"...":"x"})]},e.path))]}),(0,s.jsxs)("div",{className:"flex gap-2 flex-wrap items-center",children:[(0,s.jsx)(i.zx,{variant:null===w?"primary":"ghost",size:"sm",onClick:()=>k(null),children:"All"}),(0,s.jsx)(i.zx,{variant:"todo"===w?"primary":"ghost",size:"sm",onClick:()=>k("todo"),children:"\uD83D\uDCDD ToDo"}),(0,s.jsx)(i.zx,{variant:"doing"===w?"primary":"ghost",size:"sm",onClick:()=>k("doing"),children:"\uD83D\uDEA7 Doing"}),(0,s.jsx)(i.zx,{variant:"done"===w?"primary":"ghost",size:"sm",onClick:()=>k("done"),children:"✅ Done"}),(0,s.jsx)(i.zx,{variant:"unset"===w?"primary":"ghost",size:"sm",onClick:()=>k("unset"),children:"Not set"})]}),(0,s.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,s.jsx)("span",{className:"text-sm text-gray-600 self-center",children:"Sort by:"}),(0,s.jsxs)(i.zx,{variant:"favorite"===y?"primary":"ghost",size:"sm",onClick:()=>U("favorite"),children:["⭐ Favorite ","favorite"===y&&("asc"===f?"↑":"↓")]}),(0,s.jsxs)(i.zx,{variant:"name"===y?"primary":"ghost",size:"sm",onClick:()=>U("name"),children:["Name ","name"===y&&("asc"===f?"↑":"↓")]}),(0,s.jsxs)(i.zx,{variant:"updated"===y?"primary":"ghost",size:"sm",onClick:()=>U("updated"),children:["Updated ","updated"===y&&("asc"===f?"↑":"↓")]})]}),x&&(0,s.jsx)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:(0,s.jsx)("p",{className:"text-sm text-red-800",children:x})}),o&&!a.length&&(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-gray-300 border-t-blue-600"}),(0,s.jsx)("p",{className:"mt-4 text-gray-600",children:"Loading worktrees..."})]}),!o&&!x&&0===M.length&&(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),(0,s.jsx)("p",{className:"mt-4 text-gray-600",children:h?"No worktrees found matching your search":"No worktrees found"})]}),!o&&M.length>0&&(0,s.jsx)("div",{className:"space-y-8",children:Array.from(F.entries()).map(e=>{let[t,a]=e,r=n.find(e=>e.path===t),l=(null==r?void 0:r.name)||"Unknown Repository";return(0,s.jsxs)("div",{className:"space-y-4",children:[(n.length>1||!j)&&(0,s.jsxs)("div",{className:"flex items-center gap-3 pb-2 border-b border-gray-200",children:[(0,s.jsx)("h3",{className:"text-xl font-semibold text-gray-900",children:l}),(0,s.jsx)(i.Ct,{variant:"gray",children:a.length})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:a.map(e=>(0,s.jsx)(p,{worktree:e,onSessionKilled:D,onStatusChanged:D},e.id))})]},t)})}),z.length>0&&(0,s.jsxs)("div",{className:"border border-gray-200 rounded-lg",children:[(0,s.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left hover:bg-gray-50 transition-colors",onClick:()=>A(!E),children:[(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Excluded Repositories (",z.length,")"]}),(0,s.jsx)("span",{className:"text-gray-400 text-sm",children:E?"Hide":"Show"})]}),E&&(0,s.jsx)("div",{className:"border-t border-gray-200 divide-y divide-gray-100",children:z.map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:e.name}),(0,s.jsx)("span",{className:"text-xs text-gray-500 ml-2",children:e.path})]}),(0,s.jsx)(i.zx,{variant:"secondary",size:"sm",onClick:()=>_(e.path),disabled:L===e.path,children:L===e.path?"Restoring...":"Restore"})]},e.id))})]})]})}a(99376),a(34343),a(6940),a(43616);class h{static getInstance(){return h.instance||(h.instance=new h),h.instance}normalize(e){let t=e.match(/^ssh:\/\/git@([^:\/]+)(:\d+)?\/(.+?)(\.git)?$/);if(t)return"https://".concat(t[1],"/").concat(t[3]).toLowerCase().replace(/\/$/,"");let a=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return a?"https://".concat(a[1],"/").concat(a[2]).toLowerCase().replace(/\/$/,""):e.replace(/\.git\/?$/,"").replace(/\/$/,"").toLowerCase()}isSameRepository(e,t){return this.normalize(e)===this.normalize(t)}extractRepoName(e){let t=e.match(/^ssh:\/\/git@[^\/]+\/(.+?)(\.git)?$/);if(t){let e=t[1].split("/");return e[e.length-1]}let a=e.match(/:(.+?)(\.git)?$/);if(a&&e.startsWith("git@")){let e=a[1].split("/");return e[e.length-1]}let s=e.match(/\/([^\/]+?)(\.git)?$/);return s?s[1]:""}getUrlType(e){return e.startsWith("https://")?"https":e.startsWith("git@")||e.startsWith("ssh://")?"ssh":null}validate(e){if(!e||"string"!=typeof e||""===e.trim())return{valid:!1,error:"EMPTY_URL"};let t=e.trim();return t.startsWith("https://")?/^https:\/\/[^\/]+\/[^\/]+\/[^\/]+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("git@")?/^git@[^:]+:.+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("ssh://")&&/^ssh:\/\/git@[^\/]+(:\d+)?\/[^\/]+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}}constructor(){}}function g(e){let{onRepositoryAdded:t}=e,[a,l]=(0,r.useState)(!1),[n,c]=(0,r.useState)("local"),[o,d]=(0,r.useState)(""),[x,p]=(0,r.useState)(""),[u,g]=(0,r.useState)(!1),[y,b]=(0,r.useState)(!1),[f,v]=(0,r.useState)(!1),[j,N]=(0,r.useState)(null),[w,k]=(0,r.useState)(null),[C,S]=(0,r.useState)(null),z=h.getInstance(),P=(0,r.useCallback)(async e=>{try{let s=await m.J1.getCloneStatus(e);if("completed"===s.status)S("Repository cloned successfully"),v(!1),N(null),p(""),l(!1),t&&t();else if("failed"===s.status){var a;k((null===(a=s.error)||void 0===a?void 0:a.message)||"Clone failed"),v(!1),N(null)}else("running"===s.status||"pending"===s.status)&&setTimeout(()=>P(e),2e3)}catch(e){k((0,m.zG)(e)),v(!1),N(null)}},[t]);(0,r.useEffect)(()=>{j&&f&&P(j)},[j,f,P]);let E=async e=>{if(e.preventDefault(),!o.trim()){k("Repository path is required");return}k(null),S(null),g(!0);try{let e=await m.J1.scan(o);S(e.message),d(""),l(!1),t&&t()}catch(e){k((0,m.zG)(e))}finally{g(!1)}},A=async e=>{if(e.preventDefault(),!x.trim()){k("Clone URL is required");return}let t=z.validate(x.trim());if(!t.valid){"EMPTY_URL"===t.error?k("Clone URL is required"):k("Invalid URL format");return}k(null),S(null),v(!0);try{let e=await m.J1.clone(x.trim());N(e.jobId)}catch(e){k((0,m.zG)(e)),v(!1)}},L=async()=>{k(null),S(null),b(!0);try{let e=await m.J1.sync();S(e.message),t&&t()}catch(e){k((0,m.zG)(e))}finally{b(!1)}},T=()=>{l(!1),d(""),p(""),k(null),c("local")};return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[!a&&(0,s.jsx)(i.zx,{variant:"primary",size:"sm",onClick:()=>l(!0),children:"+ Add Repository"}),(0,s.jsx)(i.zx,{variant:"secondary",size:"sm",onClick:L,disabled:y,children:y?"Syncing...":"Sync All"})]}),a&&(0,s.jsx)(i.Zb,{padding:"lg",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("div",{children:(0,s.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Add New Repository"})}),(0,s.jsxs)("div",{className:"flex border-b border-gray-200",role:"tablist",children:[(0,s.jsx)("button",{role:"tab","aria-selected":"local"===n,onClick:()=>c("local"),className:"px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ".concat("local"===n?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"),children:"Local Path"}),(0,s.jsx)("button",{role:"tab","aria-selected":"url"===n,onClick:()=>c("url"),className:"px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ".concat("url"===n?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"),children:"Clone URL"})]}),"local"===n&&(0,s.jsxs)("form",{onSubmit:E,className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:"Enter the absolute path to a git repository containing worktrees."}),(0,s.jsx)("label",{htmlFor:"repositoryPath",className:"block text-sm font-medium text-gray-700 mb-2",children:"Repository Path"}),(0,s.jsx)("input",{id:"repositoryPath",type:"text",value:o,onChange:e=>d(e.target.value),placeholder:"/absolute/path/to/repository",className:"input w-full font-mono text-sm",disabled:u}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Example: /Users/username/projects/my-repo"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.zx,{type:"submit",variant:"primary",disabled:u||!o.trim(),children:u?"Scanning...":"Scan & Add"}),(0,s.jsx)(i.zx,{type:"button",variant:"ghost",onClick:T,disabled:u,children:"Cancel"})]})]}),"url"===n&&(0,s.jsxs)("form",{onSubmit:A,className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:"Enter a git clone URL to clone a remote repository."}),(0,s.jsx)("label",{htmlFor:"cloneUrl",className:"block text-sm font-medium text-gray-700 mb-2",children:"Clone URL"}),(0,s.jsx)("input",{id:"cloneUrl",type:"text",value:x,onChange:e=>p(e.target.value),placeholder:"https://github.com/user/repo.git",className:"input w-full font-mono text-sm",disabled:f}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Supports HTTPS and SSH URLs"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.zx,{type:"submit",variant:"primary",disabled:f||!x.trim(),children:f?"Cloning...":"Clone"}),(0,s.jsx)(i.zx,{type:"button",variant:"ghost",onClick:T,disabled:f,children:"Cancel"})]})]})]})}),C&&(0,s.jsx)("div",{className:"p-4 bg-green-50 border border-green-200 rounded-lg",children:(0,s.jsx)("p",{className:"text-sm text-green-800",children:C})}),w&&(0,s.jsx)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:(0,s.jsx)("p",{className:"text-sm text-red-800",children:w})})]})}function y(e){var t;let{appId:a,pollInterval:l=3e4,showResponseTime:n=!1,compact:i=!1}=e,[c,o]=(0,r.useState)(null),[d,x]=(0,r.useState)(!0),m=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/external-apps/".concat(a,"/health"));if(e.ok){let t=await e.json();o(t)}else o({id:a,healthy:!1,lastChecked:Date.now(),error:"Failed to check health"})}catch(e){o({id:a,healthy:!1,lastChecked:Date.now(),error:"Network error"})}finally{x(!1)}},[a]);if((0,r.useEffect)(()=>{m();let e=setInterval(m,l);return()=>clearInterval(e)},[m,l]),d)return(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-gray-300 animate-pulse"}),!i&&(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"Checking..."})]});let p=null!==(t=null==c?void 0:c.healthy)&&void 0!==t&&t,u=p?"bg-green-500":"bg-gray-400",h=p?"Running":"Stopped";return i?(0,s.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full ".concat(u),title:h}):(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full ".concat(u)}),(0,s.jsx)("span",{className:"text-xs ".concat(p?"text-green-600":"text-gray-500"),children:h}),n&&(null==c?void 0:c.responseTime)!==void 0&&(0,s.jsxs)("span",{className:"text-xs text-gray-400",children:["(",c.responseTime,"ms)"]})]})}function b(e){var t;let{app:a,onEdit:l,onDelete:n}=e,[c,o]=(0,r.useState)(!1),[d,x]=(0,r.useState)(!1),m=async()=>{x(!0);try{await n(a.id)}finally{x(!1),o(!1)}},p="/proxy/".concat(a.pathPrefix,"/");return(0,s.jsxs)(i.Zb,{padding:"md",className:"relative",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("h4",{className:"text-base font-semibold text-gray-900 truncate",children:a.displayName}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 font-mono truncate",children:a.name})]}),(0,s.jsx)(i.Ct,{variant:{sveltekit:"warning",streamlit:"error",nextjs:"info",other:"gray"}[a.appType]||"gray",children:{sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"}[t=a.appType]||t})]}),(0,s.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-gray-600",children:"Status"}),(0,s.jsx)(y,{appId:a.id,pollInterval:3e4})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-gray-600",children:"Port"}),(0,s.jsxs)("span",{className:"text-sm font-mono text-gray-900",children:[":",a.targetPort]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-gray-600",children:"Path"}),(0,s.jsxs)("span",{className:"text-sm font-mono text-gray-900 truncate max-w-[150px]",children:["/proxy/",a.pathPrefix,"/"]})]}),a.websocketEnabled&&(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-gray-600",children:"WebSocket"}),(0,s.jsx)(i.Ct,{variant:"info",children:"Enabled"})]}),!a.enabled&&(0,s.jsx)("div",{className:"mt-2 py-1 px-2 bg-yellow-50 border border-yellow-200 rounded text-xs text-yellow-700",children:"This app is disabled"})]}),c?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("p",{className:"text-sm text-gray-600",children:['Delete "',a.displayName,'"?']}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.zx,{variant:"danger",size:"sm",onClick:m,disabled:d,loading:d,children:"Delete"}),(0,s.jsx)(i.zx,{variant:"ghost",size:"sm",onClick:()=>o(!1),disabled:d,children:"Cancel"})]})]}):(0,s.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,s.jsx)(i.zx,{variant:"primary",size:"sm",onClick:()=>window.open(p,"_blank"),disabled:!a.enabled,children:"Open"}),(0,s.jsx)(i.zx,{variant:"secondary",size:"sm",onClick:()=>l(a),children:"Settings"}),(0,s.jsx)(i.zx,{variant:"ghost",size:"sm",onClick:()=>o(!0),className:"text-red-600 hover:bg-red-50",children:"Delete"})]})]})}let f={MIN:1024,MAX:65535},v=/^[a-zA-Z0-9-]+$/,j={sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"},N=["sveltekit","streamlit","nextjs","other"].map(e=>({value:e,label:j[e]}));function w(e){let{isOpen:t,onClose:a,editApp:l,onSave:n}=e,c=!!l,[o,d]=(0,r.useState)(""),[x,m]=(0,r.useState)(""),[p,u]=(0,r.useState)(""),[h,g]=(0,r.useState)(""),[y,b]=(0,r.useState)(""),[j,w]=(0,r.useState)(!1),[k,C]=(0,r.useState)(""),[S,z]=(0,r.useState)(!0),[P,E]=(0,r.useState)({}),[A,L]=(0,r.useState)(!1),[T,R]=(0,r.useState)(null);(0,r.useEffect)(()=>{t&&(l?(d(l.displayName),m(l.name),u(l.pathPrefix),g(l.targetPort),b(l.appType),w(l.websocketEnabled),C(l.description||""),z(l.enabled)):(d(""),m(""),u(""),g(""),b(""),w(!1),C(""),z(!0)),E({}),R(null))},[t,l]);let D=async e=>{e.preventDefault(),R(null);let t=function(e,t){var a,s,r,l;let n={};return((null===(a=e.displayName)||void 0===a?void 0:a.trim())||(n.displayName="Display name is required"),t||((null===(s=e.name)||void 0===s?void 0:s.trim())?v.test(e.name)||(n.name="Only alphanumeric characters and hyphens are allowed"):n.name="Identifier name is required",(null===(r=e.pathPrefix)||void 0===r?void 0:r.trim())?v.test(e.pathPrefix)||(n.pathPrefix="Only alphanumeric characters and hyphens are allowed"):n.pathPrefix="Path prefix is required"),e.targetPort)?"number"!=typeof e.targetPort||Number.isInteger(l=e.targetPort)&&l>=f.MIN&&l<=f.MAX||(n.targetPort="Port must be between ".concat(f.MIN," and ").concat(f.MAX)):n.targetPort="Port number is required",t||e.appType||(n.appType="App type is required"),n}({displayName:o,name:x,pathPrefix:p,targetPort:h,appType:y},c);if(Object.keys(t).length>0){E(t);return}E({}),L(!0);try{if(c&&l){let e=await fetch("/api/external-apps/".concat(l.id),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:o,description:k||void 0,targetPort:h||void 0,websocketEnabled:j,enabled:S})});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to update app")}}else{let e=await fetch("/api/external-apps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:o,name:x,pathPrefix:p,targetPort:h,appType:y,websocketEnabled:j,description:k||void 0})});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to create app")}}n(),a()}catch(e){R(e instanceof Error?e.message:"An error occurred")}finally{L(!1)}};return(0,s.jsx)(i.u_,{isOpen:t,onClose:a,title:c?"Edit External App":"Add External App",size:"md",children:(0,s.jsxs)("form",{onSubmit:D,className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"displayName",className:"block text-sm font-medium text-gray-700 mb-1",children:["Display Name ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)("input",{id:"displayName",type:"text",value:o,onChange:e=>d(e.target.value),className:"input w-full ".concat(P.displayName?"border-red-500":""),placeholder:"My App",disabled:A}),P.displayName&&(0,s.jsx)("p",{className:"mt-1 text-xs text-red-500",children:P.displayName})]}),!c&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 mb-1",children:["Identifier Name ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)("input",{id:"name",type:"text",value:x,onChange:e=>m(e.target.value),className:"input w-full font-mono ".concat(P.name?"border-red-500":""),placeholder:"my-app",disabled:A}),(0,s.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"Alphanumeric and hyphens only. Cannot be changed later."}),P.name&&(0,s.jsx)("p",{className:"mt-1 text-xs text-red-500",children:P.name})]}),!c&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"pathPrefix",className:"block text-sm font-medium text-gray-700 mb-1",children:["Path Prefix ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("span",{className:"text-sm text-gray-500 mr-1",children:"/proxy/"}),(0,s.jsx)("input",{id:"pathPrefix",type:"text",value:p,onChange:e=>u(e.target.value),className:"input flex-1 font-mono ".concat(P.pathPrefix?"border-red-500":""),placeholder:"app-name",disabled:A}),(0,s.jsx)("span",{className:"text-sm text-gray-500 ml-1",children:"/"})]}),(0,s.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"URL path for accessing this app. Cannot be changed later."}),P.pathPrefix&&(0,s.jsx)("p",{className:"mt-1 text-xs text-red-500",children:P.pathPrefix})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"targetPort",className:"block text-sm font-medium text-gray-700 mb-1",children:["Port Number ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)("input",{id:"targetPort",type:"number",value:h,onChange:e=>g(e.target.value?parseInt(e.target.value,10):""),className:"input w-full font-mono ".concat(P.targetPort?"border-red-500":""),placeholder:"5173",min:f.MIN,max:f.MAX,disabled:A}),(0,s.jsxs)("p",{className:"mt-1 text-xs text-gray-500",children:["Target port (",f.MIN,"-",f.MAX,")"]}),P.targetPort&&(0,s.jsx)("p",{className:"mt-1 text-xs text-red-500",children:P.targetPort})]}),!c&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"appType",className:"block text-sm font-medium text-gray-700 mb-1",children:["App Type ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsxs)("select",{id:"appType",value:y,onChange:e=>b(e.target.value),className:"input w-full ".concat(P.appType?"border-red-500":""),disabled:A,children:[(0,s.jsx)("option",{value:"",children:"Select app type..."}),N.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))]}),P.appType&&(0,s.jsx)("p",{className:"mt-1 text-xs text-red-500",children:P.appType})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:"description",className:"block text-sm font-medium text-gray-700 mb-1",children:"Description"}),(0,s.jsx)("textarea",{id:"description",value:k,onChange:e=>C(e.target.value),className:"input w-full",placeholder:"Optional description...",rows:2,disabled:A})]}),(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("input",{id:"websocketEnabled",type:"checkbox",checked:j,onChange:e=>w(e.target.checked),className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500",disabled:A}),(0,s.jsx)("label",{htmlFor:"websocketEnabled",className:"ml-2 text-sm text-gray-700",children:"Enable WebSocket support"})]}),c&&(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("input",{id:"enabled",type:"checkbox",checked:S,onChange:e=>z(e.target.checked),className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500",disabled:A}),(0,s.jsx)("label",{htmlFor:"enabled",className:"ml-2 text-sm text-gray-700",children:"App is enabled"})]}),T&&(0,s.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded text-sm text-red-700",children:T}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t border-gray-200",children:[(0,s.jsx)(i.zx,{type:"button",variant:"ghost",onClick:a,disabled:A,children:"Cancel"}),(0,s.jsx)(i.zx,{type:"submit",variant:"primary",loading:A,children:c?"Save Changes":"Add App"})]})]})})}function k(){let[e,t]=(0,r.useState)([]),[a,l]=(0,r.useState)(!0),[n,c]=(0,r.useState)(null),[o,d]=(0,r.useState)(!1),[x,m]=(0,r.useState)(null),p=(0,r.useCallback)(async()=>{try{c(null);let e=await fetch("/api/external-apps");if(!e.ok)throw Error("Failed to fetch external apps");let a=await e.json();t(a.apps||[])}catch(e){c(e instanceof Error?e.message:"An error occurred")}finally{l(!1)}},[]);(0,r.useEffect)(()=>{p();let e=setInterval(p,6e4);return()=>clearInterval(e)},[p]);let u=(0,r.useCallback)(e=>{m(e),d(!0)},[]),h=(0,r.useCallback)(()=>{m(null),d(!0)},[]),g=(0,r.useCallback)(async e=>{try{let t=await fetch("/api/external-apps/".concat(e),{method:"DELETE"});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to delete app")}p()}catch(e){console.error("Failed to delete app:",e)}},[p]),y=(0,r.useCallback)(()=>{p()},[p]),f=(0,r.useCallback)(()=>{d(!1),m(null)},[]);return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"External Apps"}),(0,s.jsx)(i.zx,{variant:"primary",size:"sm",onClick:h,children:"+ Add App"})]}),a?(0,s.jsx)(i.Zb,{padding:"lg",children:(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"}),(0,s.jsx)("span",{className:"ml-3 text-gray-600",children:"Loading apps..."})]})}):n?(0,s.jsx)(i.Zb,{padding:"lg",children:(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)("p",{className:"text-red-600 mb-4",children:"Failed to load external apps"}),(0,s.jsx)(i.zx,{variant:"secondary",size:"sm",onClick:p,children:"Retry"})]})}):0===e.length?(0,s.jsx)(i.Zb,{padding:"lg",children:(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)("p",{className:"text-gray-500 mb-4",children:"No external apps registered yet."}),(0,s.jsx)("p",{className:"text-sm text-gray-400 mb-4",children:"Add an external app to proxy requests to other frontend applications."}),(0,s.jsx)(i.zx,{variant:"primary",size:"sm",onClick:h,children:"Add Your First App"})]})}):(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:e.map(e=>(0,s.jsx)(b,{app:e,onEdit:u,onDelete:g},e.id))}),(0,s.jsx)(w,{isOpen:o,onClose:f,editApp:x,onSave:y})]})}function C(){let[e,t]=(0,r.useState)(0),a=(0,r.useCallback)(()=>{t(e=>e+1)},[]);return(0,s.jsx)(l.Vw,{children:(0,s.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsx)("h1",{className:"mb-2",children:"CommandMate"}),(0,s.jsx)("p",{className:"text-lg text-gray-600",children:"Git worktree management with Claude CLI and tmux sessions"})]}),(0,s.jsx)("div",{className:"mb-8",children:(0,s.jsx)(g,{onRepositoryAdded:a})}),(0,s.jsx)(u,{},e),(0,s.jsx)("div",{className:"mt-8",children:(0,s.jsx)(k,{})})]})})}},38706:function(e,t,a){"use strict";a.d(t,{T:function(){return l}});var s=a(69234);function r(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let l=r(0,s.T_);r(0,s.Gb)}},function(e){e.O(0,[9234,216,2335,8528,8091,2971,2117,1744],function(){return e(e.s=14564)}),_N_E=e.O()}]);
|