@akiojin/gwt 2.1.1 → 2.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/README.ja.md +4 -4
- package/README.md +4 -4
- package/dist/cli/ui/components/App.d.ts +4 -4
- package/dist/cli/ui/components/App.d.ts.map +1 -1
- package/dist/cli/ui/components/App.js +144 -105
- package/dist/cli/ui/components/App.js.map +1 -1
- package/dist/cli/ui/components/common/Confirm.d.ts +1 -1
- package/dist/cli/ui/components/common/Confirm.d.ts.map +1 -1
- package/dist/cli/ui/components/common/Confirm.js +7 -7
- package/dist/cli/ui/components/common/Confirm.js.map +1 -1
- package/dist/cli/ui/components/common/ErrorBoundary.d.ts +1 -1
- package/dist/cli/ui/components/common/ErrorBoundary.d.ts.map +1 -1
- package/dist/cli/ui/components/common/ErrorBoundary.js +4 -4
- package/dist/cli/ui/components/common/ErrorBoundary.js.map +1 -1
- package/dist/cli/ui/components/common/Input.d.ts +7 -2
- package/dist/cli/ui/components/common/Input.d.ts.map +1 -1
- package/dist/cli/ui/components/common/Input.js +12 -4
- package/dist/cli/ui/components/common/Input.js.map +1 -1
- package/dist/cli/ui/components/common/LoadingIndicator.d.ts +1 -1
- package/dist/cli/ui/components/common/LoadingIndicator.d.ts.map +1 -1
- package/dist/cli/ui/components/common/LoadingIndicator.js +4 -4
- package/dist/cli/ui/components/common/LoadingIndicator.js.map +1 -1
- package/dist/cli/ui/components/common/Select.d.ts +1 -1
- package/dist/cli/ui/components/common/Select.d.ts.map +1 -1
- package/dist/cli/ui/components/common/Select.js +11 -12
- package/dist/cli/ui/components/common/Select.js.map +1 -1
- package/dist/cli/ui/components/screens/AIToolSelectorScreen.d.ts +2 -2
- package/dist/cli/ui/components/screens/AIToolSelectorScreen.d.ts.map +1 -1
- package/dist/cli/ui/components/screens/AIToolSelectorScreen.js +11 -11
- package/dist/cli/ui/components/screens/AIToolSelectorScreen.js.map +1 -1
- package/dist/cli/ui/components/screens/BranchCreatorScreen.d.ts +1 -1
- package/dist/cli/ui/components/screens/BranchCreatorScreen.d.ts.map +1 -1
- package/dist/cli/ui/components/screens/BranchCreatorScreen.js +39 -36
- package/dist/cli/ui/components/screens/BranchCreatorScreen.js.map +1 -1
- package/dist/cli/ui/components/screens/BranchListScreen.d.ts +8 -4
- package/dist/cli/ui/components/screens/BranchListScreen.d.ts.map +1 -1
- package/dist/cli/ui/components/screens/BranchListScreen.js +122 -48
- package/dist/cli/ui/components/screens/BranchListScreen.js.map +1 -1
- package/dist/cli/ui/components/screens/ExecutionModeSelectorScreen.d.ts +2 -2
- package/dist/cli/ui/components/screens/ExecutionModeSelectorScreen.d.ts.map +1 -1
- package/dist/cli/ui/components/screens/ExecutionModeSelectorScreen.js +25 -25
- package/dist/cli/ui/components/screens/ExecutionModeSelectorScreen.js.map +1 -1
- package/dist/cli/ui/components/screens/PRCleanupScreen.d.ts +2 -2
- package/dist/cli/ui/components/screens/PRCleanupScreen.js +21 -21
- package/dist/cli/ui/components/screens/SessionSelectorScreen.d.ts +1 -1
- package/dist/cli/ui/components/screens/SessionSelectorScreen.js +8 -8
- package/dist/cli/ui/components/screens/WorktreeManagerScreen.d.ts +1 -1
- package/dist/cli/ui/components/screens/WorktreeManagerScreen.js +8 -8
- package/dist/cli/ui/screens/BranchActionSelectorScreen.d.ts.map +1 -1
- package/dist/cli/ui/screens/BranchActionSelectorScreen.js +7 -4
- package/dist/cli/ui/screens/BranchActionSelectorScreen.js.map +1 -1
- package/dist/cli/ui/types.d.ts.map +1 -1
- package/dist/client/assets/{index-V6hDu9KS.js → index-Difv1Hwu.js} +2 -2
- package/dist/client/index.html +1 -1
- package/dist/config/builtin-tools.d.ts +10 -2
- package/dist/config/builtin-tools.d.ts.map +1 -1
- package/dist/config/builtin-tools.js +40 -4
- package/dist/config/builtin-tools.js.map +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/tools.d.ts.map +1 -1
- package/dist/config/tools.js +4 -3
- package/dist/config/tools.js.map +1 -1
- package/dist/gemini.d.ts +12 -0
- package/dist/gemini.d.ts.map +1 -0
- package/dist/gemini.js +154 -0
- package/dist/gemini.js.map +1 -0
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/dist/qwen.d.ts +12 -0
- package/dist/qwen.d.ts.map +1 -0
- package/dist/qwen.js +154 -0
- package/dist/qwen.js.map +1 -0
- package/dist/services/git.service.d.ts.map +1 -1
- package/dist/services/git.service.js.map +1 -1
- package/dist/web/client/src/components/BranchGraph.d.ts.map +1 -1
- package/dist/web/client/src/components/BranchGraph.js +1 -1
- package/dist/web/client/src/components/BranchGraph.js.map +1 -1
- package/dist/web/client/src/components/EnvEditor.d.ts.map +1 -1
- package/dist/web/client/src/components/EnvEditor.js +7 -4
- package/dist/web/client/src/components/EnvEditor.js.map +1 -1
- package/dist/web/client/src/pages/BranchDetailPage.d.ts.map +1 -1
- package/dist/web/client/src/pages/BranchDetailPage.js +55 -18
- package/dist/web/client/src/pages/BranchDetailPage.js.map +1 -1
- package/dist/web/client/src/pages/BranchListPage.d.ts.map +1 -1
- package/dist/web/client/src/pages/BranchListPage.js +10 -4
- package/dist/web/client/src/pages/BranchListPage.js.map +1 -1
- package/dist/web/client/src/pages/ConfigManagementPage.d.ts.map +1 -1
- package/dist/web/client/src/pages/ConfigManagementPage.js +4 -2
- package/dist/web/client/src/pages/ConfigManagementPage.js.map +1 -1
- package/package.json +2 -1
- package/src/cli/ui/__tests__/acceptance/navigation.acceptance.test.tsx +69 -50
- package/src/cli/ui/__tests__/components/App.protected-branch.test.tsx +67 -45
- package/src/cli/ui/__tests__/components/App.shortcuts.test.tsx +117 -75
- package/src/cli/ui/__tests__/components/App.test.tsx +45 -37
- package/src/cli/ui/__tests__/components/common/Confirm.test.tsx +35 -22
- package/src/cli/ui/__tests__/components/common/ErrorBoundary.test.tsx +22 -22
- package/src/cli/ui/__tests__/components/common/Input.test.tsx +29 -22
- package/src/cli/ui/__tests__/components/common/LoadingIndicator.test.tsx +40 -34
- package/src/cli/ui/__tests__/components/common/Select.memo.test.tsx +57 -66
- package/src/cli/ui/__tests__/components/common/Select.test.tsx +121 -91
- package/src/cli/ui/__tests__/components/parts/Footer.test.tsx +18 -16
- package/src/cli/ui/__tests__/components/parts/Header.test.tsx +13 -13
- package/src/cli/ui/__tests__/components/parts/ScrollableList.test.tsx +20 -20
- package/src/cli/ui/__tests__/components/parts/Stats.test.tsx +38 -26
- package/src/cli/ui/__tests__/components/screens/AIToolSelectorScreen.test.tsx +31 -31
- package/src/cli/ui/__tests__/components/screens/BranchCreatorScreen.test.tsx +73 -37
- package/src/cli/ui/__tests__/components/screens/BranchListScreen.test.tsx +496 -75
- package/src/cli/ui/__tests__/components/screens/ExecutionModeSelectorScreen.test.tsx +38 -32
- package/src/cli/ui/__tests__/components/screens/PRCleanupScreen.test.tsx +39 -39
- package/src/cli/ui/__tests__/components/screens/SessionSelectorScreen.test.tsx +49 -21
- package/src/cli/ui/__tests__/components/screens/WorktreeManagerScreen.test.tsx +52 -28
- package/src/cli/ui/__tests__/integration/edgeCases.test.tsx +84 -48
- package/src/cli/ui/__tests__/integration/navigation.test.tsx +111 -83
- package/src/cli/ui/__tests__/integration/realtimeUpdate.test.tsx +111 -108
- package/src/cli/ui/__tests__/performance/branchList.performance.test.tsx +50 -37
- package/src/cli/ui/__tests__/performance/useMemoOptimization.test.tsx +75 -76
- package/src/cli/ui/components/App.tsx +247 -150
- package/src/cli/ui/components/common/Confirm.tsx +13 -9
- package/src/cli/ui/components/common/ErrorBoundary.tsx +8 -5
- package/src/cli/ui/components/common/Input.tsx +26 -4
- package/src/cli/ui/components/common/LoadingIndicator.tsx +8 -5
- package/src/cli/ui/components/common/Select.tsx +28 -17
- package/src/cli/ui/components/parts/Header.test.tsx +5 -15
- package/src/cli/ui/components/screens/AIToolSelectorScreen.tsx +19 -13
- package/src/cli/ui/components/screens/BranchCreatorScreen.tsx +74 -54
- package/src/cli/ui/components/screens/BranchListScreen.tsx +187 -62
- package/src/cli/ui/components/screens/ExecutionModeSelectorScreen.tsx +35 -28
- package/src/cli/ui/components/screens/PRCleanupScreen.tsx +22 -22
- package/src/cli/ui/components/screens/SessionSelectorScreen.tsx +8 -8
- package/src/cli/ui/components/screens/WorktreeManagerScreen.tsx +8 -8
- package/src/cli/ui/screens/BranchActionSelectorScreen.tsx +9 -4
- package/src/cli/ui/types.ts +8 -1
- package/src/config/builtin-tools.ts +42 -4
- package/src/config/index.ts +2 -12
- package/src/config/tools.ts +16 -6
- package/src/gemini.ts +202 -0
- package/src/git.ts +2 -1
- package/src/index.ts +30 -0
- package/src/qwen.ts +208 -0
- package/src/services/git.service.ts +2 -1
- package/src/web/client/src/components/BranchGraph.tsx +3 -2
- package/src/web/client/src/components/EnvEditor.tsx +44 -11
- package/src/web/client/src/pages/BranchDetailPage.tsx +165 -54
- package/src/web/client/src/pages/BranchListPage.tsx +37 -13
- package/src/web/client/src/pages/ConfigManagementPage.tsx +28 -9
|
@@ -58,7 +58,7 @@ Error generating stack: `+r.message+`
|
|
|
58
58
|
*/var _g=s=>{throw TypeError(s)},Y0=(s,n,u)=>n.has(s)||_g("Cannot "+u),hh=(s,n,u)=>(Y0(s,n,"read from private field"),u?u.call(s):n.get(s)),G0=(s,n,u)=>n.has(s)?_g("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(s):n.set(s,u),hm="popstate";function Q0(s={}){function n(g,w){let{pathname:T,search:M,hash:o}=g.location;return nl("",{pathname:T,search:M,hash:o},w.state&&w.state.usr||null,w.state&&w.state.key||"default")}function u(g,w){return typeof w=="string"?w:nr(w)}return X0(n,u,null,s)}function Ie(s,n){if(s===!1||s===null||typeof s>"u")throw new Error(n)}function Mt(s,n){if(!s){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function V0(){return Math.random().toString(36).substring(2,10)}function fm(s,n){return{usr:s.state,key:s.key,idx:n}}function nl(s,n,u=null,g){return{pathname:typeof s=="string"?s:s.pathname,search:"",hash:"",...typeof n=="string"?xs(n):n,state:u,key:n&&n.key||g||V0()}}function nr({pathname:s="/",search:n="",hash:u=""}){return n&&n!=="?"&&(s+=n.charAt(0)==="?"?n:"?"+n),u&&u!=="#"&&(s+=u.charAt(0)==="#"?u:"#"+u),s}function xs(s){let n={};if(s){let u=s.indexOf("#");u>=0&&(n.hash=s.substring(u),s=s.substring(0,u));let g=s.indexOf("?");g>=0&&(n.search=s.substring(g),s=s.substring(0,g)),s&&(n.pathname=s)}return n}function X0(s,n,u,g={}){let{window:w=document.defaultView,v5Compat:T=!1}=g,M=w.history,o="POP",d=null,h=p();h==null&&(h=0,M.replaceState({...M.state,idx:h},""));function p(){return(M.state||{idx:null}).idx}function m(){o="POP";let l=p(),f=l==null?null:l-h;h=l,d&&d({action:o,location:b.location,delta:f})}function y(l,f){o="PUSH";let c=nl(b.location,l,f);h=p()+1;let _=fm(c,h),E=b.createHref(c);try{M.pushState(_,"",E)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;w.location.assign(E)}T&&d&&d({action:o,location:b.location,delta:1})}function S(l,f){o="REPLACE";let c=nl(b.location,l,f);h=p();let _=fm(c,h),E=b.createHref(c);M.replaceState(_,"",E),T&&d&&d({action:o,location:b.location,delta:0})}function A(l){return vg(l)}let b={get action(){return o},get location(){return s(w,M)},listen(l){if(d)throw new Error("A history only accepts one active listener");return w.addEventListener(hm,m),d=l,()=>{w.removeEventListener(hm,m),d=null}},createHref(l){return n(w,l)},createURL:A,encodeLocation(l){let f=A(l);return{pathname:f.pathname,search:f.search,hash:f.hash}},push:y,replace:S,go(l){return M.go(l)}};return b}function vg(s,n=!1){let u="http://localhost";typeof window<"u"&&(u=window.location.origin!=="null"?window.location.origin:window.location.href),Ie(u,"No window.location.(origin|href) available to create URL");let g=typeof s=="string"?s:nr(s);return g=g.replace(/ $/,"%20"),!n&&g.startsWith("//")&&(g=u+g),new URL(g,u)}var rl,dm=class{constructor(s){if(G0(this,rl,new Map),s)for(let[n,u]of s)this.set(n,u)}get(s){if(hh(this,rl).has(s))return hh(this,rl).get(s);if(s.defaultValue!==void 0)return s.defaultValue;throw new Error("No value found for context")}set(s,n){hh(this,rl).set(s,n)}};rl=new WeakMap;var $0=new Set(["lazy","caseSensitive","path","id","index","children"]);function Z0(s){return $0.has(s)}var J0=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function eS(s){return J0.has(s)}function tS(s){return s.index===!0}function al(s,n,u=[],g={},w=!1){return s.map((T,M)=>{let o=[...u,String(M)],d=typeof T.id=="string"?T.id:o.join("-");if(Ie(T.index!==!0||!T.children,"Cannot specify children on an index route"),Ie(w||!g[d],`Found a route id collision on id "${d}". Route id's must be globally unique within Data Router usages`),tS(T)){let h={...T,id:d};return g[d]=_m(h,n(h)),h}else{let h={...T,id:d,children:void 0};return g[d]=_m(h,n(h)),T.children&&(h.children=al(T.children,n,o,g,w)),h}})}function _m(s,n){return Object.assign(s,{...n,...typeof n.lazy=="object"&&n.lazy!=null?{lazy:{...s.lazy,...n.lazy}}:{}})}function fs(s,n,u="/"){return jo(s,n,u,!1)}function jo(s,n,u,g){let w=typeof n=="string"?xs(n):n,T=Pi(w.pathname||"/",u);if(T==null)return null;let M=mg(s);rS(M);let o=null;for(let d=0;o==null&&d<M.length;++d){let h=_S(T);o=fS(M[d],h,g)}return o}function iS(s,n){let{route:u,pathname:g,params:w}=s;return{id:u.id,pathname:g,params:w,data:n[u.id],loaderData:n[u.id],handle:u.handle}}function mg(s,n=[],u=[],g="",w=!1){let T=(M,o,d=w,h)=>{let p={relativePath:h===void 0?M.path||"":h,caseSensitive:M.caseSensitive===!0,childrenIndex:o,route:M};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(g)&&d)return;Ie(p.relativePath.startsWith(g),`Absolute route path "${p.relativePath}" nested under path "${g}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(g.length)}let m=sr([g,p.relativePath]),y=u.concat(p);M.children&&M.children.length>0&&(Ie(M.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),mg(M.children,n,y,m,d)),!(M.path==null&&!M.index)&&n.push({path:m,score:uS(m,M.index),routesMeta:y})};return s.forEach((M,o)=>{var d;if(M.path===""||!((d=M.path)!=null&&d.includes("?")))T(M,o);else for(let h of gg(M.path))T(M,o,!0,h)}),n}function gg(s){let n=s.split("/");if(n.length===0)return[];let[u,...g]=n,w=u.endsWith("?"),T=u.replace(/\?$/,"");if(g.length===0)return w?[T,""]:[T];let M=gg(g.join("/")),o=[];return o.push(...M.map(d=>d===""?T:[T,d].join("/"))),w&&o.push(...M),o.map(d=>s.startsWith("/")&&d===""?"/":d)}function rS(s){s.sort((n,u)=>n.score!==u.score?u.score-n.score:hS(n.routesMeta.map(g=>g.childrenIndex),u.routesMeta.map(g=>g.childrenIndex)))}var sS=/^:[\w-]+$/,nS=3,aS=2,lS=1,oS=10,cS=-2,vm=s=>s==="*";function uS(s,n){let u=s.split("/"),g=u.length;return u.some(vm)&&(g+=cS),n&&(g+=aS),u.filter(w=>!vm(w)).reduce((w,T)=>w+(sS.test(T)?nS:T===""?lS:oS),g)}function hS(s,n){return s.length===n.length&&s.slice(0,-1).every((g,w)=>g===n[w])?s[s.length-1]-n[n.length-1]:0}function fS(s,n,u=!1){let{routesMeta:g}=s,w={},T="/",M=[];for(let o=0;o<g.length;++o){let d=g[o],h=o===g.length-1,p=T==="/"?n:n.slice(T.length)||"/",m=qo({path:d.relativePath,caseSensitive:d.caseSensitive,end:h},p),y=d.route;if(!m&&h&&u&&!g[g.length-1].route.index&&(m=qo({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},p)),!m)return null;Object.assign(w,m.params),M.push({params:w,pathname:sr([T,m.pathname]),pathnameBase:pS(sr([T,m.pathnameBase])),route:y}),m.pathnameBase!=="/"&&(T=sr([T,m.pathnameBase]))}return M}function qo(s,n){typeof s=="string"&&(s={path:s,caseSensitive:!1,end:!0});let[u,g]=dS(s.path,s.caseSensitive,s.end),w=n.match(u);if(!w)return null;let T=w[0],M=T.replace(/(.)\/+$/,"$1"),o=w.slice(1);return{params:g.reduce((h,{paramName:p,isOptional:m},y)=>{if(p==="*"){let A=o[y]||"";M=T.slice(0,T.length-A.length).replace(/(.)\/+$/,"$1")}const S=o[y];return m&&!S?h[p]=void 0:h[p]=(S||"").replace(/%2F/g,"/"),h},{}),pathname:T,pathnameBase:M,pattern:s}}function dS(s,n=!1,u=!0){Mt(s==="*"||!s.endsWith("*")||s.endsWith("/*"),`Route path "${s}" will be treated as if it were "${s.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${s.replace(/\*$/,"/*")}".`);let g=[],w="^"+s.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(M,o,d)=>(g.push({paramName:o,isOptional:d!=null}),d?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return s.endsWith("*")?(g.push({paramName:"*"}),w+=s==="*"||s==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):u?w+="\\/*$":s!==""&&s!=="/"&&(w+="(?:(?=\\/|$))"),[new RegExp(w,n?void 0:"i"),g]}function _S(s){try{return s.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Mt(!1,`The URL path "${s}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),s}}function Pi(s,n){if(n==="/")return s;if(!s.toLowerCase().startsWith(n.toLowerCase()))return null;let u=n.endsWith("/")?n.length-1:n.length,g=s.charAt(u);return g&&g!=="/"?null:s.slice(u)||"/"}function vS({basename:s,pathname:n}){return n==="/"?s:sr([s,n])}function mS(s,n="/"){let{pathname:u,search:g="",hash:w=""}=typeof s=="string"?xs(s):s;return{pathname:u?u.startsWith("/")?u:gS(u,n):n,search:yS(g),hash:SS(w)}}function gS(s,n){let u=n.replace(/\/+$/,"").split("/");return s.split("/").forEach(w=>{w===".."?u.length>1&&u.pop():w!=="."&&u.push(w)}),u.length>1?u.join("/"):"/"}function fh(s,n,u,g){return`Cannot include a '${s}' character in a manually specified \`to.${n}\` field [${JSON.stringify(g)}]. Please separate it out to the \`to.${u}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function pg(s){return s.filter((n,u)=>u===0||n.route.path&&n.route.path.length>0)}function qh(s){let n=pg(s);return n.map((u,g)=>g===n.length-1?u.pathname:u.pathnameBase)}function Kh(s,n,u,g=!1){let w;typeof s=="string"?w=xs(s):(w={...s},Ie(!w.pathname||!w.pathname.includes("?"),fh("?","pathname","search",w)),Ie(!w.pathname||!w.pathname.includes("#"),fh("#","pathname","hash",w)),Ie(!w.search||!w.search.includes("#"),fh("#","search","hash",w)));let T=s===""||w.pathname==="",M=T?"/":w.pathname,o;if(M==null)o=u;else{let m=n.length-1;if(!g&&M.startsWith("..")){let y=M.split("/");for(;y[0]==="..";)y.shift(),m-=1;w.pathname=y.join("/")}o=m>=0?n[m]:"/"}let d=mS(w,o),h=M&&M!=="/"&&M.endsWith("/"),p=(T||M===".")&&u.endsWith("/");return!d.pathname.endsWith("/")&&(h||p)&&(d.pathname+="/"),d}var sr=s=>s.join("/").replace(/\/\/+/g,"/"),pS=s=>s.replace(/\/+$/,"").replace(/^\/*/,"/"),yS=s=>!s||s==="?"?"":s.startsWith("?")?s:"?"+s,SS=s=>!s||s==="#"?"":s.startsWith("#")?s:"#"+s,Ko=class{constructor(s,n,u,g=!1){this.status=s,this.statusText=n||"",this.internal=g,u instanceof Error?(this.data=u.toString(),this.error=u):this.data=u}};function ll(s){return s!=null&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.internal=="boolean"&&"data"in s}function Wh(s){return s.filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Es=Symbol("Uninstrumented");function bS(s,n){let u={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};s.forEach(w=>w({id:n.id,index:n.index,path:n.path,instrument(T){let M=Object.keys(u);for(let o of M)T[o]&&u[o].push(T[o])}}));let g={};if(typeof n.lazy=="function"&&u.lazy.length>0){let w=Gn(u.lazy,n.lazy,()=>{});w&&(g.lazy=w)}if(typeof n.lazy=="object"){let w=n.lazy;["middleware","loader","action"].forEach(T=>{let M=w[T],o=u[`lazy.${T}`];if(typeof M=="function"&&o.length>0){let d=Gn(o,M,()=>{});d&&(g.lazy=Object.assign(g.lazy||{},{[T]:d}))}})}return["loader","action"].forEach(w=>{let T=n[w];if(typeof T=="function"&&u[w].length>0){let M=T[Es]??T,o=Gn(u[w],M,(...d)=>mm(d[0]));o&&(o[Es]=M,g[w]=o)}}),n.middleware&&n.middleware.length>0&&u.middleware.length>0&&(g.middleware=n.middleware.map(w=>{let T=w[Es]??w,M=Gn(u.middleware,T,(...o)=>mm(o[0]));return M?(M[Es]=T,M):w})),g}function CS(s,n){let u={navigate:[],fetch:[]};if(n.forEach(g=>g({instrument(w){let T=Object.keys(w);for(let M of T)w[M]&&u[M].push(w[M])}})),u.navigate.length>0){let g=s.navigate[Es]??s.navigate,w=Gn(u.navigate,g,(...T)=>{let[M,o]=T;return{to:typeof M=="number"||typeof M=="string"?M:M?nr(M):".",...gm(s,o??{})}});w&&(w[Es]=g,s.navigate=w)}if(u.fetch.length>0){let g=s.fetch[Es]??s.fetch,w=Gn(u.fetch,g,(...T)=>{let[M,,o,d]=T;return{href:o??".",fetcherKey:M,...gm(s,d??{})}});w&&(w[Es]=g,s.fetch=w)}return s}function Gn(s,n,u){return s.length===0?null:async(...g)=>{let w=await yg(s,u(...g),()=>n(...g),s.length-1);if(w.type==="error")throw w.value;return w.value}}async function yg(s,n,u,g){let w=s[g],T;if(w){let M,o=async()=>(M?console.error("You cannot call instrumented handlers more than once"):M=yg(s,n,u,g-1),T=await M,Ie(T,"Expected a result"),T.type==="error"&&T.value instanceof Error?{status:"error",error:T.value}:{status:"success",error:void 0});try{await w(o,n)}catch(d){console.error("An instrumentation function threw an error:",d)}M||await o(),await M}else try{T={type:"success",value:await u()}}catch(M){T={type:"error",value:M}}return T||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function mm(s){let{request:n,context:u,params:g,unstable_pattern:w}=s;return{request:ES(n),params:{...g},unstable_pattern:w,context:wS(u)}}function gm(s,n){return{currentUrl:nr(s.state.location),..."formMethod"in n?{formMethod:n.formMethod}:{},..."formEncType"in n?{formEncType:n.formEncType}:{},..."formData"in n?{formData:n.formData}:{},..."body"in n?{body:n.body}:{}}}function ES(s){return{method:s.method,url:s.url,headers:{get:(...n)=>s.headers.get(...n)}}}function wS(s){if(RS(s)){let n={...s};return Object.freeze(n),n}else return{get:n=>s.get(n)}}var xS=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function RS(s){if(s===null||typeof s!="object")return!1;const n=Object.getPrototypeOf(s);return n===Object.prototype||n===null||Object.getOwnPropertyNames(n).sort().join("\0")===xS}var Sg=["POST","PUT","PATCH","DELETE"],DS=new Set(Sg),AS=["GET",...Sg],TS=new Set(AS),MS=new Set([301,302,303,307,308]),LS=new Set([307,308]),dh={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},OS={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Za={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},BS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Yh=s=>BS.test(s),kS=s=>({hasErrorBoundary:!!s.hasErrorBoundary}),bg="remix-router-transitions",Cg=Symbol("ResetLoaderData");function HS(s){const n=s.window?s.window:typeof window<"u"?window:void 0,u=typeof n<"u"&&typeof n.document<"u"&&typeof n.document.createElement<"u";Ie(s.routes.length>0,"You must provide a non-empty routes array to createRouter");let g=s.hydrationRouteProperties||[],w=s.mapRouteProperties||kS,T=w;if(s.unstable_instrumentations){let G=s.unstable_instrumentations;T=ee=>({...w(ee),...bS(G.map(ue=>ue.route).filter(Boolean),ee)})}let M={},o=al(s.routes,T,void 0,M),d,h=s.basename||"/";h.startsWith("/")||(h=`/${h}`);let p=s.dataStrategy||PS,m={...s.future},y=null,S=new Set,A=null,b=null,l=null,f=s.hydrationData!=null,c=fs(o,s.history.location,h),_=!1,E=null,R;if(c==null&&!s.patchRoutesOnNavigation){let G=Hi(404,{pathname:s.history.location.pathname}),{matches:ee,route:ue}=Oo(o);R=!0,c=ee,E={[ue.id]:G}}else if(c&&!s.hydrationData&&hn(c,o,s.history.location.pathname).active&&(c=null),c)if(c.some(G=>G.route.lazy))R=!1;else if(!c.some(G=>Gh(G.route)))R=!0;else{let G=s.hydrationData?s.hydrationData.loaderData:null,ee=s.hydrationData?s.hydrationData.errors:null;if(ee){let ue=c.findIndex(pe=>ee[pe.route.id]!==void 0);R=c.slice(0,ue+1).every(pe=>!kh(pe.route,G,ee))}else R=c.every(ue=>!kh(ue.route,G,ee))}else{R=!1,c=[];let G=hn(null,o,s.history.location.pathname);G.active&&G.matches&&(_=!0,c=G.matches)}let L,x={historyAction:s.history.action,location:s.history.location,matches:c,initialized:R,navigation:dh,restoreScrollPosition:s.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:s.hydrationData&&s.hydrationData.loaderData||{},actionData:s.hydrationData&&s.hydrationData.actionData||null,errors:s.hydrationData&&s.hydrationData.errors||E,fetchers:new Map,blockers:new Map},C="POP",B=!1,z,I=!1,F=new Map,Q=null,oe=!1,ae=!1,q=new Set,Z=new Map,he=0,k=-1,U=new Map,O=new Set,j=new Map,X=new Map,te=new Set,ve=new Map,W,ie=null;function P(){if(y=s.history.listen(({action:G,location:ee,delta:ue})=>{if(W){W(),W=void 0;return}Mt(ve.size===0||ue!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let pe=Rs({currentLocation:x.location,nextLocation:ee,historyAction:G});if(pe&&ue!=null){let ye=new Promise(Te=>{W=Te});s.history.go(ue*-1),on(pe,{state:"blocked",location:ee,proceed(){on(pe,{state:"proceeding",proceed:void 0,reset:void 0,location:ee}),ye.then(()=>s.history.go(ue))},reset(){let Te=new Map(x.blockers);Te.set(pe,Za),ce({blockers:Te})}});return}return je(G,ee)}),u){tb(n,F);let G=()=>ib(n,F);n.addEventListener("pagehide",G),Q=()=>n.removeEventListener("pagehide",G)}return x.initialized||je("POP",x.location,{initialHydration:!0}),L}function le(){y&&y(),Q&&Q(),S.clear(),z&&z.abort(),x.fetchers.forEach((G,ee)=>Fi(ee)),x.blockers.forEach((G,ee)=>gl(ee))}function Se(G){return S.add(G),()=>S.delete(G)}function ce(G,ee={}){G.matches&&(G.matches=G.matches.map(ye=>{let Te=M[ye.route.id],Me=ye.route;return Me.element!==Te.element||Me.errorElement!==Te.errorElement||Me.hydrateFallbackElement!==Te.hydrateFallbackElement?{...ye,route:Te}:ye})),x={...x,...G};let ue=[],pe=[];x.fetchers.forEach((ye,Te)=>{ye.state==="idle"&&(te.has(Te)?ue.push(Te):pe.push(Te))}),te.forEach(ye=>{!x.fetchers.has(ye)&&!Z.has(ye)&&ue.push(ye)}),[...S].forEach(ye=>ye(x,{deletedFetchers:ue,viewTransitionOpts:ee.viewTransitionOpts,flushSync:ee.flushSync===!0})),ue.forEach(ye=>Fi(ye)),pe.forEach(ye=>x.fetchers.delete(ye))}function Xe(G,ee,{flushSync:ue}={}){var we,xe;let pe=x.actionData!=null&&x.navigation.formMethod!=null&&Zt(x.navigation.formMethod)&&x.navigation.state==="loading"&&((we=G.state)==null?void 0:we._isRedirect)!==!0,ye;ee.actionData?Object.keys(ee.actionData).length>0?ye=ee.actionData:ye=null:pe?ye=x.actionData:ye=null;let Te=ee.loaderData?Dm(x.loaderData,ee.loaderData,ee.matches||[],ee.errors):x.loaderData,Me=x.blockers;Me.size>0&&(Me=new Map(Me),Me.forEach((He,nt)=>Me.set(nt,Za)));let De=oe?!1:Pr(G,ee.matches||x.matches),Re=B===!0||x.navigation.formMethod!=null&&Zt(x.navigation.formMethod)&&((xe=G.state)==null?void 0:xe._isRedirect)!==!0;d&&(o=d,d=void 0),oe||C==="POP"||(C==="PUSH"?s.history.push(G,G.state):C==="REPLACE"&&s.history.replace(G,G.state));let Ce;if(C==="POP"){let He=F.get(x.location.pathname);He&&He.has(G.pathname)?Ce={currentLocation:x.location,nextLocation:G}:F.has(G.pathname)&&(Ce={currentLocation:G,nextLocation:x.location})}else if(I){let He=F.get(x.location.pathname);He?He.add(G.pathname):(He=new Set([G.pathname]),F.set(x.location.pathname,He)),Ce={currentLocation:x.location,nextLocation:G}}ce({...ee,actionData:ye,loaderData:Te,historyAction:C,location:G,initialized:!0,navigation:dh,revalidation:"idle",restoreScrollPosition:De,preventScrollReset:Re,blockers:Me},{viewTransitionOpts:Ce,flushSync:ue===!0}),C="POP",B=!1,I=!1,oe=!1,ae=!1,ie==null||ie.resolve(),ie=null}async function Ne(G,ee){if(typeof G=="number"){s.history.go(G);return}let ue=Bh(x.location,x.matches,h,G,ee==null?void 0:ee.fromRouteId,ee==null?void 0:ee.relative),{path:pe,submission:ye,error:Te}=pm(!1,ue,ee),Me=x.location,De=nl(x.location,pe,ee&&ee.state);De={...De,...s.history.encodeLocation(De)};let Re=ee&&ee.replace!=null?ee.replace:void 0,Ce="PUSH";Re===!0?Ce="REPLACE":Re===!1||ye!=null&&Zt(ye.formMethod)&&ye.formAction===x.location.pathname+x.location.search&&(Ce="REPLACE");let we=ee&&"preventScrollReset"in ee?ee.preventScrollReset===!0:void 0,xe=(ee&&ee.flushSync)===!0,He=Rs({currentLocation:Me,nextLocation:De,historyAction:Ce});if(He){on(He,{state:"blocked",location:De,proceed(){on(He,{state:"proceeding",proceed:void 0,reset:void 0,location:De}),Ne(G,ee)},reset(){let nt=new Map(x.blockers);nt.set(He,Za),ce({blockers:nt})}});return}await je(Ce,De,{submission:ye,pendingError:Te,preventScrollReset:we,replace:ee&&ee.replace,enableViewTransition:ee&&ee.viewTransition,flushSync:xe})}function ge(){ie||(ie=rb()),bi(),ce({revalidation:"loading"});let G=ie.promise;return x.navigation.state==="submitting"?G:x.navigation.state==="idle"?(je(x.historyAction,x.location,{startUninterruptedRevalidation:!0}),G):(je(C||x.historyAction,x.navigation.location,{overrideNavigation:x.navigation,enableViewTransition:I===!0}),G)}async function je(G,ee,ue){z&&z.abort(),z=null,C=G,oe=(ue&&ue.startUninterruptedRevalidation)===!0,un(x.location,x.matches),B=(ue&&ue.preventScrollReset)===!0,I=(ue&&ue.enableViewTransition)===!0;let pe=d||o,ye=ue&&ue.overrideNavigation,Te=ue!=null&&ue.initialHydration&&x.matches&&x.matches.length>0&&!_?x.matches:fs(pe,ee,h),Me=(ue&&ue.flushSync)===!0;if(Te&&x.initialized&&!ae&&QS(x.location,ee)&&!(ue&&ue.submission&&Zt(ue.submission.formMethod))){Xe(ee,{matches:Te},{flushSync:Me});return}let De=hn(Te,pe,ee.pathname);if(De.active&&De.matches&&(Te=De.matches),!Te){let{error:kt,notFoundMatches:tt,route:it}=Ur(ee.pathname);Xe(ee,{matches:tt,loaderData:{},errors:{[it.id]:kt}},{flushSync:Me});return}z=new AbortController;let Re=Yn(s.history,ee,z.signal,ue&&ue.submission),Ce=s.getContext?await s.getContext():new dm,we;if(ue&&ue.pendingError)we=[ds(Te).route.id,{type:"error",error:ue.pendingError}];else if(ue&&ue.submission&&Zt(ue.submission.formMethod)){let kt=await _t(Re,ee,ue.submission,Te,Ce,De.active,ue&&ue.initialHydration===!0,{replace:ue.replace,flushSync:Me});if(kt.shortCircuited)return;if(kt.pendingActionResult){let[tt,it]=kt.pendingActionResult;if(yi(it)&&ll(it.error)&&it.error.status===404){z=null,Xe(ee,{matches:kt.matches,loaderData:{},errors:{[tt]:it.error}});return}}Te=kt.matches||Te,we=kt.pendingActionResult,ye=_h(ee,ue.submission),Me=!1,De.active=!1,Re=Yn(s.history,Re.url,Re.signal)}let{shortCircuited:xe,matches:He,loaderData:nt,errors:xt}=await Be(Re,ee,Te,Ce,De.active,ye,ue&&ue.submission,ue&&ue.fetcherSubmission,ue&&ue.replace,ue&&ue.initialHydration===!0,Me,we);xe||(z=null,Xe(ee,{matches:He||Te,...Am(we),loaderData:nt,errors:xt}))}async function _t(G,ee,ue,pe,ye,Te,Me,De={}){bi();let Re=JS(ee,ue);if(ce({navigation:Re},{flushSync:De.flushSync===!0}),Te){let xe=await Ds(pe,ee.pathname,G.signal);if(xe.type==="aborted")return{shortCircuited:!0};if(xe.type==="error"){if(xe.partialMatches.length===0){let{matches:nt,route:xt}=Oo(o);return{matches:nt,pendingActionResult:[xt.id,{type:"error",error:xe.error}]}}let He=ds(xe.partialMatches).route.id;return{matches:xe.partialMatches,pendingActionResult:[He,{type:"error",error:xe.error}]}}else if(xe.matches)pe=xe.matches;else{let{notFoundMatches:He,error:nt,route:xt}=Ur(ee.pathname);return{matches:He,pendingActionResult:[xt.id,{type:"error",error:nt}]}}}let Ce,we=zo(pe,ee);if(!we.route.action&&!we.route.lazy)Ce={type:"error",error:Hi(405,{method:G.method,pathname:ee.pathname,routeId:we.route.id})};else{let xe=Qn(T,M,G,pe,we,Me?[]:g,ye),He=await ht(G,xe,ye,null);if(Ce=He[we.route.id],!Ce){for(let nt of pe)if(He[nt.route.id]){Ce=He[nt.route.id];break}}if(G.signal.aborted)return{shortCircuited:!0}}if(Ys(Ce)){let xe;return De&&De.replace!=null?xe=De.replace:xe=wm(Ce.response.headers.get("Location"),new URL(G.url),h)===x.location.pathname+x.location.search,await pt(G,Ce,!0,{submission:ue,replace:xe}),{shortCircuited:!0}}if(yi(Ce)){let xe=ds(pe,we.route.id);return(De&&De.replace)!==!0&&(C="PUSH"),{matches:pe,pendingActionResult:[xe.route.id,Ce,we.route.id]}}return{matches:pe,pendingActionResult:[we.route.id,Ce]}}async function Be(G,ee,ue,pe,ye,Te,Me,De,Re,Ce,we,xe){let He=Te||_h(ee,Me),nt=Me||De||Mm(He),xt=!oe&&!Ce;if(ye){if(xt){let Lt=Jt(xe);ce({navigation:He,...Lt!==void 0?{actionData:Lt}:{}},{flushSync:we})}let Ge=await Ds(ue,ee.pathname,G.signal);if(Ge.type==="aborted")return{shortCircuited:!0};if(Ge.type==="error"){if(Ge.partialMatches.length===0){let{matches:hr,route:fr}=Oo(o);return{matches:hr,loaderData:{},errors:{[fr.id]:Ge.error}}}let Lt=ds(Ge.partialMatches).route.id;return{matches:Ge.partialMatches,loaderData:{},errors:{[Lt]:Ge.error}}}else if(Ge.matches)ue=Ge.matches;else{let{error:Lt,notFoundMatches:hr,route:fr}=Ur(ee.pathname);return{matches:hr,loaderData:{},errors:{[fr.id]:Lt}}}}let kt=d||o,{dsMatches:tt,revalidatingFetchers:it}=ym(G,pe,T,M,s.history,x,ue,nt,ee,Ce?[]:g,Ce===!0,ae,q,te,j,O,kt,h,s.patchRoutesOnNavigation!=null,xe);if(k=++he,!s.dataStrategy&&!tt.some(Ge=>Ge.shouldLoad)&&!tt.some(Ge=>Ge.route.middleware&&Ge.route.middleware.length>0)&&it.length===0){let Ge=Ii();return Xe(ee,{matches:ue,loaderData:{},errors:xe&&yi(xe[1])?{[xe[0]]:xe[1].error}:null,...Am(xe),...Ge?{fetchers:new Map(x.fetchers)}:{}},{flushSync:we}),{shortCircuited:!0}}if(xt){let Ge={};if(!ye){Ge.navigation=He;let Lt=Jt(xe);Lt!==void 0&&(Ge.actionData=Lt)}it.length>0&&(Ge.fetchers=Si(it)),ce(Ge,{flushSync:we})}it.forEach(Ge=>{jt(Ge.key),Ge.controller&&Z.set(Ge.key,Ge.controller)});let ei=()=>it.forEach(Ge=>jt(Ge.key));z&&z.signal.addEventListener("abort",ei);let{loaderResults:Ci,fetcherResults:ti}=await Gt(tt,it,G,pe);if(G.signal.aborted)return{shortCircuited:!0};z&&z.signal.removeEventListener("abort",ei),it.forEach(Ge=>Z.delete(Ge.key));let zt=Bo(Ci);if(zt)return await pt(G,zt.result,!0,{replace:Re}),{shortCircuited:!0};if(zt=Bo(ti),zt)return O.add(zt.key),await pt(G,zt.result,!0,{replace:Re}),{shortCircuited:!0};let{loaderData:yt,errors:Fr}=Rm(x,ue,Ci,xe,it,ti);Ce&&x.errors&&(Fr={...x.errors,...Fr});let Xi=Ii(),Ei=Wt(k),qi=Xi||Ei||it.length>0;return{matches:ue,loaderData:yt,errors:Fr,...qi?{fetchers:new Map(x.fetchers)}:{}}}function Jt(G){if(G&&!yi(G[1]))return{[G[0]]:G[1].data};if(x.actionData)return Object.keys(x.actionData).length===0?null:x.actionData}function Si(G){return G.forEach(ee=>{let ue=x.fetchers.get(ee.key),pe=Ja(void 0,ue?ue.data:void 0);x.fetchers.set(ee.key,pe)}),new Map(x.fetchers)}async function or(G,ee,ue,pe){jt(G);let ye=(pe&&pe.flushSync)===!0,Te=d||o,Me=Bh(x.location,x.matches,h,ue,ee,pe==null?void 0:pe.relative),De=fs(Te,Me,h),Re=hn(De,Te,Me);if(Re.active&&Re.matches&&(De=Re.matches),!De){gt(G,ee,Hi(404,{pathname:Me}),{flushSync:ye});return}let{path:Ce,submission:we,error:xe}=pm(!0,Me,pe);if(xe){gt(G,ee,xe,{flushSync:ye});return}let He=s.getContext?await s.getContext():new dm,nt=(pe&&pe.preventScrollReset)===!0;if(we&&Zt(we.formMethod)){await cr(G,ee,Ce,De,He,Re.active,ye,nt,we);return}j.set(G,{routeId:ee,path:Ce}),await zr(G,ee,Ce,De,He,Re.active,ye,nt,we)}async function cr(G,ee,ue,pe,ye,Te,Me,De,Re){bi(),j.delete(G);let Ce=x.fetchers.get(G);qt(G,eb(Re,Ce),{flushSync:Me});let we=new AbortController,xe=Yn(s.history,ue,we.signal,Re);if(Te){let vt=await Ds(pe,new URL(xe.url).pathname,xe.signal,G);if(vt.type==="aborted")return;if(vt.type==="error"){gt(G,ee,vt.error,{flushSync:Me});return}else if(vt.matches)pe=vt.matches;else{gt(G,ee,Hi(404,{pathname:ue}),{flushSync:Me});return}}let He=zo(pe,ue);if(!He.route.action&&!He.route.lazy){let vt=Hi(405,{method:Re.formMethod,pathname:ue,routeId:ee});gt(G,ee,vt,{flushSync:Me});return}Z.set(G,we);let nt=he,xt=Qn(T,M,xe,pe,He,g,ye),tt=(await ht(xe,xt,ye,G))[He.route.id];if(xe.signal.aborted){Z.get(G)===we&&Z.delete(G);return}if(te.has(G)){if(Ys(tt)||yi(tt)){qt(G,Or(void 0));return}}else{if(Ys(tt))if(Z.delete(G),k>nt){qt(G,Or(void 0));return}else return O.add(G),qt(G,Ja(Re)),pt(xe,tt,!1,{fetcherSubmission:Re,preventScrollReset:De});if(yi(tt)){gt(G,ee,tt.error);return}}let it=x.navigation.location||x.location,ei=Yn(s.history,it,we.signal),Ci=d||o,ti=x.navigation.state!=="idle"?fs(Ci,x.navigation.location,h):x.matches;Ie(ti,"Didn't find any matches after fetcher action");let zt=++he;U.set(G,zt);let yt=Ja(Re,tt.data);x.fetchers.set(G,yt);let{dsMatches:Fr,revalidatingFetchers:Xi}=ym(ei,ye,T,M,s.history,x,ti,Re,it,g,!1,ae,q,te,j,O,Ci,h,s.patchRoutesOnNavigation!=null,[He.route.id,tt]);Xi.filter(vt=>vt.key!==G).forEach(vt=>{let dr=vt.key,wi=x.fetchers.get(dr),ii=Ja(void 0,wi?wi.data:void 0);x.fetchers.set(dr,ii),jt(dr),vt.controller&&Z.set(dr,vt.controller)}),ce({fetchers:new Map(x.fetchers)});let Ei=()=>Xi.forEach(vt=>jt(vt.key));we.signal.addEventListener("abort",Ei);let{loaderResults:qi,fetcherResults:Ge}=await Gt(Fr,Xi,ei,ye);if(we.signal.aborted)return;if(we.signal.removeEventListener("abort",Ei),U.delete(G),Z.delete(G),Xi.forEach(vt=>Z.delete(vt.key)),x.fetchers.has(G)){let vt=Or(tt.data);x.fetchers.set(G,vt)}let Lt=Bo(qi);if(Lt)return pt(ei,Lt.result,!1,{preventScrollReset:De});if(Lt=Bo(Ge),Lt)return O.add(Lt.key),pt(ei,Lt.result,!1,{preventScrollReset:De});let{loaderData:hr,errors:fr}=Rm(x,ti,qi,void 0,Xi,Ge);Wt(zt),x.navigation.state==="loading"&&zt>k?(Ie(C,"Expected pending action"),z&&z.abort(),Xe(x.navigation.location,{matches:ti,loaderData:hr,errors:fr,fetchers:new Map(x.fetchers)})):(ce({errors:fr,loaderData:Dm(x.loaderData,hr,ti,fr),fetchers:new Map(x.fetchers)}),ae=!1)}async function zr(G,ee,ue,pe,ye,Te,Me,De,Re){let Ce=x.fetchers.get(G);qt(G,Ja(Re,Ce?Ce.data:void 0),{flushSync:Me});let we=new AbortController,xe=Yn(s.history,ue,we.signal);if(Te){let it=await Ds(pe,new URL(xe.url).pathname,xe.signal,G);if(it.type==="aborted")return;if(it.type==="error"){gt(G,ee,it.error,{flushSync:Me});return}else if(it.matches)pe=it.matches;else{gt(G,ee,Hi(404,{pathname:ue}),{flushSync:Me});return}}let He=zo(pe,ue);Z.set(G,we);let nt=he,xt=Qn(T,M,xe,pe,He,g,ye),tt=(await ht(xe,xt,ye,G))[He.route.id];if(Z.get(G)===we&&Z.delete(G),!xe.signal.aborted){if(te.has(G)){qt(G,Or(void 0));return}if(Ys(tt))if(k>nt){qt(G,Or(void 0));return}else{O.add(G),await pt(xe,tt,!1,{preventScrollReset:De});return}if(yi(tt)){gt(G,ee,tt.error);return}qt(G,Or(tt.data))}}async function pt(G,ee,ue,{submission:pe,fetcherSubmission:ye,preventScrollReset:Te,replace:Me}={}){ee.response.headers.has("X-Remix-Revalidate")&&(ae=!0);let De=ee.response.headers.get("Location");Ie(De,"Expected a Location header on the redirect Response"),De=wm(De,new URL(G.url),h);let Re=nl(x.location,De,{_isRedirect:!0});if(u){let xt=!1;if(ee.response.headers.has("X-Remix-Reload-Document"))xt=!0;else if(Yh(De)){const kt=vg(De,!0);xt=kt.origin!==n.location.origin||Pi(kt.pathname,h)==null}if(xt){Me?n.location.replace(De):n.location.assign(De);return}}z=null;let Ce=Me===!0||ee.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:we,formAction:xe,formEncType:He}=x.navigation;!pe&&!ye&&we&&xe&&He&&(pe=Mm(x.navigation));let nt=pe||ye;if(LS.has(ee.response.status)&&nt&&Zt(nt.formMethod))await je(Ce,Re,{submission:{...nt,formAction:De},preventScrollReset:Te||B,enableViewTransition:ue?I:void 0});else{let xt=_h(Re,pe);await je(Ce,Re,{overrideNavigation:xt,fetcherSubmission:ye,preventScrollReset:Te||B,enableViewTransition:ue?I:void 0})}}async function ht(G,ee,ue,pe){let ye,Te={};try{ye=await IS(p,G,ee,pe,ue,!1)}catch(Me){return ee.filter(De=>De.shouldLoad).forEach(De=>{Te[De.route.id]={type:"error",error:Me}}),Te}if(G.signal.aborted)return Te;for(let[Me,De]of Object.entries(ye))if($S(De)){let Re=De.result;Te[Me]={type:"redirect",response:YS(Re,G,Me,ee,h)}}else Te[Me]=await WS(De);return Te}async function Gt(G,ee,ue,pe){let ye=ht(ue,G,pe,null),Te=Promise.all(ee.map(async Re=>{if(Re.matches&&Re.match&&Re.request&&Re.controller){let we=(await ht(Re.request,Re.matches,pe,Re.key))[Re.match.route.id];return{[Re.key]:we}}else return Promise.resolve({[Re.key]:{type:"error",error:Hi(404,{pathname:Re.path})}})})),Me=await ye,De=(await Te).reduce((Re,Ce)=>Object.assign(Re,Ce),{});return{loaderResults:Me,fetcherResults:De}}function bi(){ae=!0,j.forEach((G,ee)=>{Z.has(ee)&&q.add(ee),jt(ee)})}function qt(G,ee,ue={}){x.fetchers.set(G,ee),ce({fetchers:new Map(x.fetchers)},{flushSync:(ue&&ue.flushSync)===!0})}function gt(G,ee,ue,pe={}){let ye=ds(x.matches,ee);Fi(G),ce({errors:{[ye.route.id]:ue},fetchers:new Map(x.fetchers)},{flushSync:(pe&&pe.flushSync)===!0})}function ur(G){return X.set(G,(X.get(G)||0)+1),te.has(G)&&te.delete(G),x.fetchers.get(G)||OS}function hi(G,ee){jt(G,ee==null?void 0:ee.reason),qt(G,Or(null))}function Fi(G){let ee=x.fetchers.get(G);Z.has(G)&&!(ee&&ee.state==="loading"&&U.has(G))&&jt(G),j.delete(G),U.delete(G),O.delete(G),te.delete(G),q.delete(G),x.fetchers.delete(G)}function ct(G){let ee=(X.get(G)||0)-1;ee<=0?(X.delete(G),te.add(G)):X.set(G,ee),ce({fetchers:new Map(x.fetchers)})}function jt(G,ee){let ue=Z.get(G);ue&&(ue.abort(ee),Z.delete(G))}function Kt(G){for(let ee of G){let ue=ur(ee),pe=Or(ue.data);x.fetchers.set(ee,pe)}}function Ii(){let G=[],ee=!1;for(let ue of O){let pe=x.fetchers.get(ue);Ie(pe,`Expected fetcher: ${ue}`),pe.state==="loading"&&(O.delete(ue),G.push(ue),ee=!0)}return Kt(G),ee}function Wt(G){let ee=[];for(let[ue,pe]of U)if(pe<G){let ye=x.fetchers.get(ue);Ie(ye,`Expected fetcher: ${ue}`),ye.state==="loading"&&(jt(ue),U.delete(ue),ee.push(ue))}return Kt(ee),ee.length>0}function Xo(G,ee){let ue=x.blockers.get(G)||Za;return ve.get(G)!==ee&&ve.set(G,ee),ue}function gl(G){x.blockers.delete(G),ve.delete(G)}function on(G,ee){let ue=x.blockers.get(G)||Za;Ie(ue.state==="unblocked"&&ee.state==="blocked"||ue.state==="blocked"&&ee.state==="blocked"||ue.state==="blocked"&&ee.state==="proceeding"||ue.state==="blocked"&&ee.state==="unblocked"||ue.state==="proceeding"&&ee.state==="unblocked",`Invalid blocker state transition: ${ue.state} -> ${ee.state}`);let pe=new Map(x.blockers);pe.set(G,ee),ce({blockers:pe})}function Rs({currentLocation:G,nextLocation:ee,historyAction:ue}){if(ve.size===0)return;ve.size>1&&Mt(!1,"A router only supports one blocker at a time");let pe=Array.from(ve.entries()),[ye,Te]=pe[pe.length-1],Me=x.blockers.get(ye);if(!(Me&&Me.state==="proceeding")&&Te({currentLocation:G,nextLocation:ee,historyAction:ue}))return ye}function Ur(G){let ee=Hi(404,{pathname:G}),ue=d||o,{matches:pe,route:ye}=Oo(ue);return{notFoundMatches:pe,route:ye,error:ee}}function cn(G,ee,ue){if(A=G,l=ee,b=ue||null,!f&&x.navigation===dh){f=!0;let pe=Pr(x.location,x.matches);pe!=null&&ce({restoreScrollPosition:pe})}return()=>{A=null,l=null,b=null}}function Vi(G,ee){return b&&b(G,ee.map(pe=>iS(pe,x.loaderData)))||G.key}function un(G,ee){if(A&&l){let ue=Vi(G,ee);A[ue]=l()}}function Pr(G,ee){if(A){let ue=Vi(G,ee),pe=A[ue];if(typeof pe=="number")return pe}return null}function hn(G,ee,ue){if(s.patchRoutesOnNavigation)if(G){if(Object.keys(G[0].params).length>0)return{active:!0,matches:jo(ee,ue,h,!0)}}else return{active:!0,matches:jo(ee,ue,h,!0)||[]};return{active:!1,matches:null}}async function Ds(G,ee,ue,pe){if(!s.patchRoutesOnNavigation)return{type:"success",matches:G};let ye=G;for(;;){let Te=d==null,Me=d||o,De=M;try{await s.patchRoutesOnNavigation({signal:ue,path:ee,matches:ye,fetcherKey:pe,patch:(we,xe)=>{ue.aborted||Sm(we,xe,Me,De,T,!1)}})}catch(we){return{type:"error",error:we,partialMatches:ye}}finally{Te&&!ue.aborted&&(o=[...o])}if(ue.aborted)return{type:"aborted"};let Re=fs(Me,ee,h);if(Re)return{type:"success",matches:Re};let Ce=jo(Me,ee,h,!0);if(!Ce||ye.length===Ce.length&&ye.every((we,xe)=>we.route.id===Ce[xe].route.id))return{type:"success",matches:null};ye=Ce}}function oa(G){M={},d=al(G,T,void 0,M)}function As(G,ee,ue=!1){let pe=d==null;Sm(G,ee,d||o,M,T,ue),pe&&(o=[...o],ce({}))}return L={get basename(){return h},get future(){return m},get state(){return x},get routes(){return o},get window(){return n},initialize:P,subscribe:Se,enableScrollRestoration:cn,navigate:Ne,fetch:or,revalidate:ge,createHref:G=>s.history.createHref(G),encodeLocation:G=>s.history.encodeLocation(G),getFetcher:ur,resetFetcher:hi,deleteFetcher:ct,dispose:le,getBlocker:Xo,deleteBlocker:gl,patchRoutes:As,_internalFetchControllers:Z,_internalSetRoutes:oa,_internalSetStateDoNotUseOrYouWillBreakYourApp(G){ce(G)}},s.unstable_instrumentations&&(L=CS(L,s.unstable_instrumentations.map(G=>G.router).filter(Boolean))),L}function NS(s){return s!=null&&("formData"in s&&s.formData!=null||"body"in s&&s.body!==void 0)}function Bh(s,n,u,g,w,T){let M,o;if(w){M=[];for(let h of n)if(M.push(h),h.route.id===w){o=h;break}}else M=n,o=n[n.length-1];let d=Kh(g||".",qh(M),Pi(s.pathname,u)||s.pathname,T==="path");if(g==null&&(d.search=s.search,d.hash=s.hash),(g==null||g===""||g===".")&&o){let h=Qh(d.search);if(o.route.index&&!h)d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index";else if(!o.route.index&&h){let p=new URLSearchParams(d.search),m=p.getAll("index");p.delete("index"),m.filter(S=>S).forEach(S=>p.append("index",S));let y=p.toString();d.search=y?`?${y}`:""}}return u!=="/"&&(d.pathname=vS({basename:u,pathname:d.pathname})),nr(d)}function pm(s,n,u){if(!u||!NS(u))return{path:n};if(u.formMethod&&!ZS(u.formMethod))return{path:n,error:Hi(405,{method:u.formMethod})};let g=()=>({path:n,error:Hi(400,{type:"invalid-body"})}),T=(u.formMethod||"get").toUpperCase(),M=Ag(n);if(u.body!==void 0){if(u.formEncType==="text/plain"){if(!Zt(T))return g();let m=typeof u.body=="string"?u.body:u.body instanceof FormData||u.body instanceof URLSearchParams?Array.from(u.body.entries()).reduce((y,[S,A])=>`${y}${S}=${A}
|
|
59
59
|
`,""):String(u.body);return{path:n,submission:{formMethod:T,formAction:M,formEncType:u.formEncType,formData:void 0,json:void 0,text:m}}}else if(u.formEncType==="application/json"){if(!Zt(T))return g();try{let m=typeof u.body=="string"?JSON.parse(u.body):u.body;return{path:n,submission:{formMethod:T,formAction:M,formEncType:u.formEncType,formData:void 0,json:m,text:void 0}}}catch{return g()}}}Ie(typeof FormData=="function","FormData is not available in this environment");let o,d;if(u.formData)o=Nh(u.formData),d=u.formData;else if(u.body instanceof FormData)o=Nh(u.body),d=u.body;else if(u.body instanceof URLSearchParams)o=u.body,d=xm(o);else if(u.body==null)o=new URLSearchParams,d=new FormData;else try{o=new URLSearchParams(u.body),d=xm(o)}catch{return g()}let h={formMethod:T,formAction:M,formEncType:u&&u.formEncType||"application/x-www-form-urlencoded",formData:d,json:void 0,text:void 0};if(Zt(h.formMethod))return{path:n,submission:h};let p=xs(n);return s&&p.search&&Qh(p.search)&&o.append("index",""),p.search=`?${o}`,{path:nr(p),submission:h}}function ym(s,n,u,g,w,T,M,o,d,h,p,m,y,S,A,b,l,f,c,_){var oe;let E=_?yi(_[1])?_[1].error:_[1].data:void 0,R=w.createURL(T.location),L=w.createURL(d),x;if(p&&T.errors){let ae=Object.keys(T.errors)[0];x=M.findIndex(q=>q.route.id===ae)}else if(_&&yi(_[1])){let ae=_[0];x=M.findIndex(q=>q.route.id===ae)-1}let C=_?_[1].statusCode:void 0,B=C&&C>=400,z={currentUrl:R,currentParams:((oe=T.matches[0])==null?void 0:oe.params)||{},nextUrl:L,nextParams:M[0].params,...o,actionResult:E,actionStatus:C},I=Wh(M.map(ae=>ae.route.path)),F=M.map((ae,q)=>{let{route:Z}=ae,he=null;if(x!=null&&q>x?he=!1:Z.lazy?he=!0:Gh(Z)?p?he=kh(Z,T.loaderData,T.errors):jS(T.loaderData,T.matches[q],ae)&&(he=!0):he=!1,he!==null)return Hh(u,g,s,I,ae,h,n,he);let k=B?!1:m||R.pathname+R.search===L.pathname+L.search||R.search!==L.search||zS(T.matches[q],ae),U={...z,defaultShouldRevalidate:k},O=Wo(ae,U);return Hh(u,g,s,I,ae,h,n,O,U)}),Q=[];return A.forEach((ae,q)=>{if(p||!M.some(te=>te.route.id===ae.routeId)||S.has(q))return;let Z=T.fetchers.get(q),he=Z&&Z.state!=="idle"&&Z.data===void 0,k=fs(l,ae.path,f);if(!k){if(c&&he)return;Q.push({key:q,routeId:ae.routeId,path:ae.path,matches:null,match:null,request:null,controller:null});return}if(b.has(q))return;let U=zo(k,ae.path),O=new AbortController,j=Yn(w,ae.path,O.signal),X=null;if(y.has(q))y.delete(q),X=Qn(u,g,j,k,U,h,n);else if(he)m&&(X=Qn(u,g,j,k,U,h,n));else{let te={...z,defaultShouldRevalidate:B?!1:m};Wo(U,te)&&(X=Qn(u,g,j,k,U,h,n,te))}X&&Q.push({key:q,routeId:ae.routeId,path:ae.path,matches:X,match:U,request:j,controller:O})}),{dsMatches:F,revalidatingFetchers:Q}}function Gh(s){return s.loader!=null||s.middleware!=null&&s.middleware.length>0}function kh(s,n,u){if(s.lazy)return!0;if(!Gh(s))return!1;let g=n!=null&&s.id in n,w=u!=null&&u[s.id]!==void 0;return!g&&w?!1:typeof s.loader=="function"&&s.loader.hydrate===!0?!0:!g&&!w}function jS(s,n,u){let g=!n||u.route.id!==n.route.id,w=!s.hasOwnProperty(u.route.id);return g||w}function zS(s,n){let u=s.route.path;return s.pathname!==n.pathname||u!=null&&u.endsWith("*")&&s.params["*"]!==n.params["*"]}function Wo(s,n){if(s.route.shouldRevalidate){let u=s.route.shouldRevalidate(n);if(typeof u=="boolean")return u}return n.defaultShouldRevalidate}function Sm(s,n,u,g,w,T){let M;if(s){let h=g[s];Ie(h,`No route found to patch children into: routeId = ${s}`),h.children||(h.children=[]),M=h.children}else M=u;let o=[],d=[];if(n.forEach(h=>{let p=M.find(m=>Eg(h,m));p?d.push({existingRoute:p,newRoute:h}):o.push(h)}),o.length>0){let h=al(o,w,[s||"_","patch",String((M==null?void 0:M.length)||"0")],g);M.push(...h)}if(T&&d.length>0)for(let h=0;h<d.length;h++){let{existingRoute:p,newRoute:m}=d[h],y=p,[S]=al([m],w,[],{},!0);Object.assign(y,{element:S.element?S.element:y.element,errorElement:S.errorElement?S.errorElement:y.errorElement,hydrateFallbackElement:S.hydrateFallbackElement?S.hydrateFallbackElement:y.hydrateFallbackElement})}}function Eg(s,n){return"id"in s&&"id"in n&&s.id===n.id?!0:s.index===n.index&&s.path===n.path&&s.caseSensitive===n.caseSensitive?(!s.children||s.children.length===0)&&(!n.children||n.children.length===0)?!0:s.children.every((u,g)=>{var w;return(w=n.children)==null?void 0:w.some(T=>Eg(u,T))}):!1}var bm=new WeakMap,wg=({key:s,route:n,manifest:u,mapRouteProperties:g})=>{let w=u[n.id];if(Ie(w,"No route found in manifest"),!w.lazy||typeof w.lazy!="object")return;let T=w.lazy[s];if(!T)return;let M=bm.get(w);M||(M={},bm.set(w,M));let o=M[s];if(o)return o;let d=(async()=>{let h=Z0(s),m=w[s]!==void 0&&s!=="hasErrorBoundary";if(h)Mt(!h,"Route property "+s+" is not a supported lazy route property. This property will be ignored."),M[s]=Promise.resolve();else if(m)Mt(!1,`Route "${w.id}" has a static property "${s}" defined. The lazy property will be ignored.`);else{let y=await T();y!=null&&(Object.assign(w,{[s]:y}),Object.assign(w,g(w)))}typeof w.lazy=="object"&&(w.lazy[s]=void 0,Object.values(w.lazy).every(y=>y===void 0)&&(w.lazy=void 0))})();return M[s]=d,d},Cm=new WeakMap;function US(s,n,u,g,w){let T=u[s.id];if(Ie(T,"No route found in manifest"),!s.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof s.lazy=="function"){let p=Cm.get(T);if(p)return{lazyRoutePromise:p,lazyHandlerPromise:p};let m=(async()=>{Ie(typeof s.lazy=="function","No lazy route function found");let y=await s.lazy(),S={};for(let A in y){let b=y[A];if(b===void 0)continue;let l=eS(A),c=T[A]!==void 0&&A!=="hasErrorBoundary";l?Mt(!l,"Route property "+A+" is not a supported property to be returned from a lazy route function. This property will be ignored."):c?Mt(!c,`Route "${T.id}" has a static property "${A}" defined but its lazy function is also returning a value for this property. The lazy route property "${A}" will be ignored.`):S[A]=b}Object.assign(T,S),Object.assign(T,{...g(T),lazy:void 0})})();return Cm.set(T,m),m.catch(()=>{}),{lazyRoutePromise:m,lazyHandlerPromise:m}}let M=Object.keys(s.lazy),o=[],d;for(let p of M){if(w&&w.includes(p))continue;let m=wg({key:p,route:s,manifest:u,mapRouteProperties:g});m&&(o.push(m),p===n&&(d=m))}let h=o.length>0?Promise.all(o).then(()=>{}):void 0;return h==null||h.catch(()=>{}),d==null||d.catch(()=>{}),{lazyRoutePromise:h,lazyHandlerPromise:d}}async function Em(s){let n=s.matches.filter(w=>w.shouldLoad),u={};return(await Promise.all(n.map(w=>w.resolve()))).forEach((w,T)=>{u[n[T].route.id]=w}),u}async function PS(s){return s.matches.some(n=>n.route.middleware)?xg(s,()=>Em(s)):Em(s)}function xg(s,n){return FS(s,n,g=>g,VS,u);function u(g,w,T){if(T)return Promise.resolve(Object.assign(T.value,{[w]:{type:"error",result:g}}));{let{matches:M}=s,o=Math.min(Math.max(M.findIndex(h=>h.route.id===w),0),Math.max(M.findIndex(h=>h.unstable_shouldCallHandler()),0)),d=ds(M,M[o].route.id).route.id;return Promise.resolve({[d]:{type:"error",result:g}})}}}async function FS(s,n,u,g,w){let{matches:T,request:M,params:o,context:d,unstable_pattern:h}=s,p=T.flatMap(y=>y.route.middleware?y.route.middleware.map(S=>[y.route.id,S]):[]);return await Rg({request:M,params:o,context:d,unstable_pattern:h},p,n,u,g,w)}async function Rg(s,n,u,g,w,T,M=0){let{request:o}=s;if(o.signal.aborted)throw o.signal.reason??new Error(`Request aborted: ${o.method} ${o.url}`);let d=n[M];if(!d)return await u();let[h,p]=d,m,y=async()=>{if(m)throw new Error("You may only call `next()` once per middleware");try{return m={value:await Rg(s,n,u,g,w,T,M+1)},m.value}catch(S){return m={value:await T(S,h,m)},m.value}};try{let S=await p(s,y),A=S!=null?g(S):void 0;return w(A)?A:m?A??m.value:(m={value:await y()},m.value)}catch(S){return await T(S,h,m)}}function Dg(s,n,u,g,w){let T=wg({key:"middleware",route:g.route,manifest:n,mapRouteProperties:s}),M=US(g.route,Zt(u.method)?"action":"loader",n,s,w);return{middleware:T,route:M.lazyRoutePromise,handler:M.lazyHandlerPromise}}function Hh(s,n,u,g,w,T,M,o,d=null){let h=!1,p=Dg(s,n,u,w,T);return{...w,_lazyPromises:p,shouldLoad:o,unstable_shouldRevalidateArgs:d,unstable_shouldCallHandler(m){return h=!0,d?typeof m=="boolean"?Wo(w,{...d,defaultShouldRevalidate:m}):Wo(w,d):o},resolve(m){let{lazy:y,loader:S,middleware:A}=w.route,b=h||o||m&&!Zt(u.method)&&(y||S),l=A&&A.length>0&&!S&&!y;return b&&(Zt(u.method)||!l)?qS({request:u,unstable_pattern:g,match:w,lazyHandlerPromise:p==null?void 0:p.handler,lazyRoutePromise:p==null?void 0:p.route,handlerOverride:m,scopedContext:M}):Promise.resolve({type:"data",result:void 0})}}}function Qn(s,n,u,g,w,T,M,o=null){return g.map(d=>d.route.id!==w.route.id?{...d,shouldLoad:!1,unstable_shouldRevalidateArgs:o,unstable_shouldCallHandler:()=>!1,_lazyPromises:Dg(s,n,u,d,T),resolve:()=>Promise.resolve({type:"data",result:void 0})}:Hh(s,n,u,Wh(g.map(h=>h.route.path)),d,T,M,!0,o))}async function IS(s,n,u,g,w,T){u.some(h=>{var p;return(p=h._lazyPromises)==null?void 0:p.middleware})&&await Promise.all(u.map(h=>{var p;return(p=h._lazyPromises)==null?void 0:p.middleware}));let M={request:n,unstable_pattern:Wh(u.map(h=>h.route.path)),params:u[0].params,context:w,matches:u},d=await s({...M,fetcherKey:g,runClientMiddleware:h=>{let p=M;return xg(p,()=>h({...p,fetcherKey:g,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(u.flatMap(h=>{var p,m;return[(p=h._lazyPromises)==null?void 0:p.handler,(m=h._lazyPromises)==null?void 0:m.route]}))}catch{}return d}async function qS({request:s,unstable_pattern:n,match:u,lazyHandlerPromise:g,lazyRoutePromise:w,handlerOverride:T,scopedContext:M}){let o,d,h=Zt(s.method),p=h?"action":"loader",m=y=>{let S,A=new Promise((f,c)=>S=c);d=()=>S(),s.signal.addEventListener("abort",d);let b=f=>typeof y!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${p}" [routeId: ${u.route.id}]`)):y({request:s,unstable_pattern:n,params:u.params,context:M},...f!==void 0?[f]:[]),l=(async()=>{try{return{type:"data",result:await(T?T(c=>b(c)):b())}}catch(f){return{type:"error",result:f}}})();return Promise.race([l,A])};try{let y=h?u.route.action:u.route.loader;if(g||w)if(y){let S,[A]=await Promise.all([m(y).catch(b=>{S=b}),g,w]);if(S!==void 0)throw S;o=A}else{await g;let S=h?u.route.action:u.route.loader;if(S)[o]=await Promise.all([m(S),w]);else if(p==="action"){let A=new URL(s.url),b=A.pathname+A.search;throw Hi(405,{method:s.method,pathname:b,routeId:u.route.id})}else return{type:"data",result:void 0}}else if(y)o=await m(y);else{let S=new URL(s.url),A=S.pathname+S.search;throw Hi(404,{pathname:A})}}catch(y){return{type:"error",result:y}}finally{d&&s.signal.removeEventListener("abort",d)}return o}async function KS(s){let n=s.headers.get("Content-Type");return n&&/\bapplication\/json\b/.test(n)?s.body==null?null:s.json():s.text()}async function WS(s){var g,w,T,M,o,d;let{result:n,type:u}=s;if(Tg(n)){let h;try{h=await KS(n)}catch(p){return{type:"error",error:p}}return u==="error"?{type:"error",error:new Ko(n.status,n.statusText,h),statusCode:n.status,headers:n.headers}:{type:"data",data:h,statusCode:n.status,headers:n.headers}}return u==="error"?Tm(n)?n.data instanceof Error?{type:"error",error:n.data,statusCode:(g=n.init)==null?void 0:g.status,headers:(w=n.init)!=null&&w.headers?new Headers(n.init.headers):void 0}:{type:"error",error:new Ko(((T=n.init)==null?void 0:T.status)||500,void 0,n.data),statusCode:ll(n)?n.status:void 0,headers:(M=n.init)!=null&&M.headers?new Headers(n.init.headers):void 0}:{type:"error",error:n,statusCode:ll(n)?n.status:void 0}:Tm(n)?{type:"data",data:n.data,statusCode:(o=n.init)==null?void 0:o.status,headers:(d=n.init)!=null&&d.headers?new Headers(n.init.headers):void 0}:{type:"data",data:n}}function YS(s,n,u,g,w){let T=s.headers.get("Location");if(Ie(T,"Redirects returned/thrown from loaders/actions must have a Location header"),!Yh(T)){let M=g.slice(0,g.findIndex(o=>o.route.id===u)+1);T=Bh(new URL(n.url),M,w,T),s.headers.set("Location",T)}return s}function wm(s,n,u){if(Yh(s)){let g=s,w=g.startsWith("//")?new URL(n.protocol+g):new URL(g),T=Pi(w.pathname,u)!=null;if(w.origin===n.origin&&T)return w.pathname+w.search+w.hash}return s}function Yn(s,n,u,g){let w=s.createURL(Ag(n)).toString(),T={signal:u};if(g&&Zt(g.formMethod)){let{formMethod:M,formEncType:o}=g;T.method=M.toUpperCase(),o==="application/json"?(T.headers=new Headers({"Content-Type":o}),T.body=JSON.stringify(g.json)):o==="text/plain"?T.body=g.text:o==="application/x-www-form-urlencoded"&&g.formData?T.body=Nh(g.formData):T.body=g.formData}return new Request(w,T)}function Nh(s){let n=new URLSearchParams;for(let[u,g]of s.entries())n.append(u,typeof g=="string"?g:g.name);return n}function xm(s){let n=new FormData;for(let[u,g]of s.entries())n.append(u,g);return n}function GS(s,n,u,g=!1,w=!1){let T={},M=null,o,d=!1,h={},p=u&&yi(u[1])?u[1].error:void 0;return s.forEach(m=>{if(!(m.route.id in n))return;let y=m.route.id,S=n[y];if(Ie(!Ys(S),"Cannot handle redirect results in processLoaderData"),yi(S)){let A=S.error;if(p!==void 0&&(A=p,p=void 0),M=M||{},w)M[y]=A;else{let b=ds(s,y);M[b.route.id]==null&&(M[b.route.id]=A)}g||(T[y]=Cg),d||(d=!0,o=ll(S.error)?S.error.status:500),S.headers&&(h[y]=S.headers)}else T[y]=S.data,S.statusCode&&S.statusCode!==200&&!d&&(o=S.statusCode),S.headers&&(h[y]=S.headers)}),p!==void 0&&u&&(M={[u[0]]:p},u[2]&&(T[u[2]]=void 0)),{loaderData:T,errors:M,statusCode:o||200,loaderHeaders:h}}function Rm(s,n,u,g,w,T){let{loaderData:M,errors:o}=GS(n,u,g);return w.filter(d=>!d.matches||d.matches.some(h=>h.shouldLoad)).forEach(d=>{let{key:h,match:p,controller:m}=d;if(m&&m.signal.aborted)return;let y=T[h];if(Ie(y,"Did not find corresponding fetcher result"),yi(y)){let S=ds(s.matches,p==null?void 0:p.route.id);o&&o[S.route.id]||(o={...o,[S.route.id]:y.error}),s.fetchers.delete(h)}else if(Ys(y))Ie(!1,"Unhandled fetcher revalidation redirect");else{let S=Or(y.data);s.fetchers.set(h,S)}}),{loaderData:M,errors:o}}function Dm(s,n,u,g){let w=Object.entries(n).filter(([,T])=>T!==Cg).reduce((T,[M,o])=>(T[M]=o,T),{});for(let T of u){let M=T.route.id;if(!n.hasOwnProperty(M)&&s.hasOwnProperty(M)&&T.route.loader&&(w[M]=s[M]),g&&g.hasOwnProperty(M))break}return w}function Am(s){return s?yi(s[1])?{actionData:{}}:{actionData:{[s[0]]:s[1].data}}:{}}function ds(s,n){return(n?s.slice(0,s.findIndex(g=>g.route.id===n)+1):[...s]).reverse().find(g=>g.route.hasErrorBoundary===!0)||s[0]}function Oo(s){let n=s.length===1?s[0]:s.find(u=>u.index||!u.path||u.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:n}],route:n}}function Hi(s,{pathname:n,routeId:u,method:g,type:w,message:T}={}){let M="Unknown Server Error",o="Unknown @remix-run/router error";return s===400?(M="Bad Request",g&&n&&u?o=`You made a ${g} request to "${n}" but did not provide a \`loader\` for route "${u}", so there is no way to handle the request.`:w==="invalid-body"&&(o="Unable to encode submission body")):s===403?(M="Forbidden",o=`Route "${u}" does not match URL "${n}"`):s===404?(M="Not Found",o=`No route matches URL "${n}"`):s===405&&(M="Method Not Allowed",g&&n&&u?o=`You made a ${g.toUpperCase()} request to "${n}" but did not provide an \`action\` for route "${u}", so there is no way to handle the request.`:g&&(o=`Invalid request method "${g.toUpperCase()}"`)),new Ko(s||500,M,new Error(o),!0)}function Bo(s){let n=Object.entries(s);for(let u=n.length-1;u>=0;u--){let[g,w]=n[u];if(Ys(w))return{key:g,result:w}}}function Ag(s){let n=typeof s=="string"?xs(s):s;return nr({...n,hash:""})}function QS(s,n){return s.pathname!==n.pathname||s.search!==n.search?!1:s.hash===""?n.hash!=="":s.hash===n.hash?!0:n.hash!==""}function VS(s){return s!=null&&typeof s=="object"&&Object.entries(s).every(([n,u])=>typeof n=="string"&&XS(u))}function XS(s){return s!=null&&typeof s=="object"&&"type"in s&&"result"in s&&(s.type==="data"||s.type==="error")}function $S(s){return Tg(s.result)&&MS.has(s.result.status)}function yi(s){return s.type==="error"}function Ys(s){return(s&&s.type)==="redirect"}function Tm(s){return typeof s=="object"&&s!=null&&"type"in s&&"data"in s&&"init"in s&&s.type==="DataWithResponseInit"}function Tg(s){return s!=null&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.headers=="object"&&typeof s.body<"u"}function ZS(s){return TS.has(s.toUpperCase())}function Zt(s){return DS.has(s.toUpperCase())}function Qh(s){return new URLSearchParams(s).getAll("index").some(n=>n==="")}function zo(s,n){let u=typeof n=="string"?xs(n).search:n.search;if(s[s.length-1].route.index&&Qh(u||""))return s[s.length-1];let g=pg(s);return g[g.length-1]}function Mm(s){let{formMethod:n,formAction:u,formEncType:g,text:w,formData:T,json:M}=s;if(!(!n||!u||!g)){if(w!=null)return{formMethod:n,formAction:u,formEncType:g,formData:void 0,json:void 0,text:w};if(T!=null)return{formMethod:n,formAction:u,formEncType:g,formData:T,json:void 0,text:void 0};if(M!==void 0)return{formMethod:n,formAction:u,formEncType:g,formData:void 0,json:M,text:void 0}}}function _h(s,n){return n?{state:"loading",location:s,formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.text}:{state:"loading",location:s,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function JS(s,n){return{state:"submitting",location:s,formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.text}}function Ja(s,n){return s?{state:"loading",formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text,data:n}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:n}}function eb(s,n){return{state:"submitting",formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text,data:n?n.data:void 0}}function Or(s){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:s}}function tb(s,n){try{let u=s.sessionStorage.getItem(bg);if(u){let g=JSON.parse(u);for(let[w,T]of Object.entries(g||{}))T&&Array.isArray(T)&&n.set(w,new Set(T||[]))}}catch{}}function ib(s,n){if(n.size>0){let u={};for(let[g,w]of n)u[g]=[...w];try{s.sessionStorage.setItem(bg,JSON.stringify(u))}catch(g){Mt(!1,`Failed to save applied view transitions in sessionStorage (${g}).`)}}}function rb(){let s,n,u=new Promise((g,w)=>{s=async T=>{g(T);try{await u}catch{}},n=async T=>{w(T);try{await u}catch{}}});return{promise:u,resolve:s,reject:n}}var an=$.createContext(null);an.displayName="DataRouter";var _l=$.createContext(null);_l.displayName="DataRouterState";$.createContext(!1);var Vh=$.createContext({isTransitioning:!1});Vh.displayName="ViewTransition";var Mg=$.createContext(new Map);Mg.displayName="Fetchers";var sb=$.createContext(null);sb.displayName="Await";var ar=$.createContext(null);ar.displayName="Navigation";var Qo=$.createContext(null);Qo.displayName="Location";var lr=$.createContext({outlet:null,matches:[],isDataRoute:!1});lr.displayName="Route";var Xh=$.createContext(null);Xh.displayName="RouteError";function nb(s,{relative:n}={}){Ie(vl(),"useHref() may be used only in the context of a <Router> component.");let{basename:u,navigator:g}=$.useContext(ar),{hash:w,pathname:T,search:M}=ml(s,{relative:n}),o=T;return u!=="/"&&(o=T==="/"?u:sr([u,T])),g.createHref({pathname:o,search:M,hash:w})}function vl(){return $.useContext(Qo)!=null}function ln(){return Ie(vl(),"useLocation() may be used only in the context of a <Router> component."),$.useContext(Qo).location}var Lg="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Og(s){$.useContext(ar).static||$.useLayoutEffect(s)}function ab(){let{isDataRoute:s}=$.useContext(lr);return s?Sb():lb()}function lb(){Ie(vl(),"useNavigate() may be used only in the context of a <Router> component.");let s=$.useContext(an),{basename:n,navigator:u}=$.useContext(ar),{matches:g}=$.useContext(lr),{pathname:w}=ln(),T=JSON.stringify(qh(g)),M=$.useRef(!1);return Og(()=>{M.current=!0}),$.useCallback((d,h={})=>{if(Mt(M.current,Lg),!M.current)return;if(typeof d=="number"){u.go(d);return}let p=Kh(d,JSON.parse(T),w,h.relative==="path");s==null&&n!=="/"&&(p.pathname=p.pathname==="/"?n:sr([n,p.pathname])),(h.replace?u.replace:u.push)(p,h.state,h)},[n,u,T,w,s])}$.createContext(null);function ob(){let{matches:s}=$.useContext(lr),n=s[s.length-1];return n?n.params:{}}function ml(s,{relative:n}={}){let{matches:u}=$.useContext(lr),{pathname:g}=ln(),w=JSON.stringify(qh(u));return $.useMemo(()=>Kh(s,JSON.parse(w),g,n==="path"),[s,w,g,n])}function cb(s,n,u,g,w){Ie(vl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:T}=$.useContext(ar),{matches:M}=$.useContext(lr),o=M[M.length-1],d=o?o.params:{},h=o?o.pathname:"/",p=o?o.pathnameBase:"/",m=o&&o.route;{let c=m&&m.path||"";Bg(h,!m||c.endsWith("*")||c.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${c}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
60
60
|
|
|
61
|
-
Please change the parent <Route path="${c}"> to <Route path="${c==="/"?"*":`${c}/*`}">.`)}let y=ln(),S;S=y;let A=S.pathname||"/",b=A;if(p!=="/"){let c=p.replace(/^\//,"").split("/");b="/"+A.replace(/^\//,"").split("/").slice(c.length).join("/")}let l=fs(s,{pathname:b});return Mt(m||l!=null,`No routes matched location "${S.pathname}${S.search}${S.hash}" `),Mt(l==null||l[l.length-1].route.element!==void 0||l[l.length-1].route.Component!==void 0||l[l.length-1].route.lazy!==void 0,`Matched leaf route at location "${S.pathname}${S.search}${S.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),_b(l&&l.map(c=>Object.assign({},c,{params:Object.assign({},d,c.params),pathname:sr([p,T.encodeLocation?T.encodeLocation(c.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:c.pathname]),pathnameBase:c.pathnameBase==="/"?p:sr([p,T.encodeLocation?T.encodeLocation(c.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:c.pathnameBase])})),M,u,g,w)}function ub(){let s=yb(),n=ll(s)?`${s.status} ${s.statusText}`:s instanceof Error?s.message:JSON.stringify(s),u=s instanceof Error?s.stack:null,g="rgba(200,200,200, 0.5)",w={padding:"0.5rem",backgroundColor:g},T={padding:"2px 4px",backgroundColor:g},M=null;return console.error("Error handled by React Router default ErrorBoundary:",s),M=$.createElement($.Fragment,null,$.createElement("p",null,"💿 Hey developer 👋"),$.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",$.createElement("code",{style:T},"ErrorBoundary")," or"," ",$.createElement("code",{style:T},"errorElement")," prop on your route.")),$.createElement($.Fragment,null,$.createElement("h2",null,"Unexpected Application Error!"),$.createElement("h3",{style:{fontStyle:"italic"}},n),u?$.createElement("pre",{style:w},u):null,M)}var hb=$.createElement(ub,null),fb=class extends $.Component{constructor(s){super(s),this.state={location:s.location,revalidation:s.revalidation,error:s.error}}static getDerivedStateFromError(s){return{error:s}}static getDerivedStateFromProps(s,n){return n.location!==s.location||n.revalidation!=="idle"&&s.revalidation==="idle"?{error:s.error,location:s.location,revalidation:s.revalidation}:{error:s.error!==void 0?s.error:n.error,location:n.location,revalidation:s.revalidation||n.revalidation}}componentDidCatch(s,n){this.props.unstable_onError?this.props.unstable_onError(s,n):console.error("React Router caught the following error during render",s)}render(){return this.state.error!==void 0?$.createElement(lr.Provider,{value:this.props.routeContext},$.createElement(Xh.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function db({routeContext:s,match:n,children:u}){let g=$.useContext(an);return g&&g.static&&g.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(g.staticContext._deepestRenderedBoundaryId=n.route.id),$.createElement(lr.Provider,{value:s},u)}function _b(s,n=[],u=null,g=null,w=null){if(s==null){if(!u)return null;if(u.errors)s=u.matches;else if(n.length===0&&!u.initialized&&u.matches.length>0)s=u.matches;else return null}let T=s,M=u==null?void 0:u.errors;if(M!=null){let h=T.findIndex(p=>p.route.id&&(M==null?void 0:M[p.route.id])!==void 0);Ie(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(M).join(",")}`),T=T.slice(0,Math.min(T.length,h+1))}let o=!1,d=-1;if(u)for(let h=0;h<T.length;h++){let p=T[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=h),p.route.id){let{loaderData:m,errors:y}=u,S=p.route.loader&&!m.hasOwnProperty(p.route.id)&&(!y||y[p.route.id]===void 0);if(p.route.lazy||S){o=!0,d>=0?T=T.slice(0,d+1):T=[T[0]];break}}}return T.reduceRight((h,p,m)=>{let y,S=!1,A=null,b=null;u&&(y=M&&p.route.id?M[p.route.id]:void 0,A=p.route.errorElement||hb,o&&(d<0&&m===0?(Bg("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,b=null):d===m&&(S=!0,b=p.route.hydrateFallbackElement||null)));let l=n.concat(T.slice(0,m+1)),f=()=>{let c;return y?c=A:S?c=b:p.route.Component?c=$.createElement(p.route.Component,null):p.route.element?c=p.route.element:c=h,$.createElement(db,{match:p,routeContext:{outlet:h,matches:l,isDataRoute:u!=null},children:c})};return u&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?$.createElement(fb,{location:u.location,revalidation:u.revalidation,component:A,error:y,children:f(),routeContext:{outlet:null,matches:l,isDataRoute:!0},unstable_onError:g}):f()},null)}function $h(s){return`${s} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vb(s){let n=$.useContext(an);return Ie(n,$h(s)),n}function mb(s){let n=$.useContext(_l);return Ie(n,$h(s)),n}function gb(s){let n=$.useContext(lr);return Ie(n,$h(s)),n}function Zh(s){let n=gb(s),u=n.matches[n.matches.length-1];return Ie(u.route.id,`${s} can only be used on routes that contain a unique "id"`),u.route.id}function pb(){return Zh("useRouteId")}function yb(){var g;let s=$.useContext(Xh),n=mb("useRouteError"),u=Zh("useRouteError");return s!==void 0?s:(g=n.errors)==null?void 0:g[u]}function Sb(){let{router:s}=vb("useNavigate"),n=Zh("useNavigate"),u=$.useRef(!1);return Og(()=>{u.current=!0}),$.useCallback(async(w,T={})=>{Mt(u.current,Lg),u.current&&(typeof w=="number"?s.navigate(w):await s.navigate(w,{fromRouteId:n,...T}))},[s,n])}var Lm={};function Bg(s,n,u){!n&&!Lm[s]&&(Lm[s]=!0,Mt(!1,u))}var Om={};function Bm(s,n){!s&&!Om[n]&&(Om[n]=!0,console.warn(n))}function bb(s){let n={hasErrorBoundary:s.hasErrorBoundary||s.ErrorBoundary!=null||s.errorElement!=null};return s.Component&&(s.element&&Mt(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(n,{element:$.createElement(s.Component),Component:void 0})),s.HydrateFallback&&(s.hydrateFallbackElement&&Mt(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(n,{hydrateFallbackElement:$.createElement(s.HydrateFallback),HydrateFallback:void 0})),s.ErrorBoundary&&(s.errorElement&&Mt(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(n,{errorElement:$.createElement(s.ErrorBoundary),ErrorBoundary:void 0})),n}var Cb=["HydrateFallback","hydrateFallbackElement"],Eb=class{constructor(){this.status="pending",this.promise=new Promise((s,n)=>{this.resolve=u=>{this.status==="pending"&&(this.status="resolved",s(u))},this.reject=u=>{this.status==="pending"&&(this.status="rejected",n(u))}})}};function wb({router:s,flushSync:n,unstable_onError:u}){let[g,w]=$.useState(s.state),[T,M]=$.useState(),[o,d]=$.useState({isTransitioning:!1}),[h,p]=$.useState(),[m,y]=$.useState(),[S,A]=$.useState(),b=$.useRef(new Map),l=$.useCallback(R=>{w(L=>(R.errors&&u&&Object.entries(R.errors).forEach(([x,C])=>{var B;((B=L.errors)==null?void 0:B[x])!==C&&u(C)}),R))},[u]),f=$.useCallback((R,{deletedFetchers:L,flushSync:x,viewTransitionOpts:C})=>{R.fetchers.forEach((z,I)=>{z.data!==void 0&&b.current.set(I,z.data)}),L.forEach(z=>b.current.delete(z)),Bm(x===!1||n!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let B=s.window!=null&&s.window.document!=null&&typeof s.window.document.startViewTransition=="function";if(Bm(C==null||B,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!C||!B){n&&x?n(()=>l(R)):$.startTransition(()=>l(R));return}if(n&&x){n(()=>{m&&(h&&h.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:C.currentLocation,nextLocation:C.nextLocation})});let z=s.window.document.startViewTransition(()=>{n(()=>l(R))});z.finished.finally(()=>{n(()=>{p(void 0),y(void 0),M(void 0),d({isTransitioning:!1})})}),n(()=>y(z));return}m?(h&&h.resolve(),m.skipTransition(),A({state:R,currentLocation:C.currentLocation,nextLocation:C.nextLocation})):(M(R),d({isTransitioning:!0,flushSync:!1,currentLocation:C.currentLocation,nextLocation:C.nextLocation}))},[s.window,n,m,h,l]);$.useLayoutEffect(()=>s.subscribe(f),[s,f]),$.useEffect(()=>{o.isTransitioning&&!o.flushSync&&p(new Eb)},[o]),$.useEffect(()=>{if(h&&T&&s.window){let R=T,L=h.promise,x=s.window.document.startViewTransition(async()=>{$.startTransition(()=>l(R)),await L});x.finished.finally(()=>{p(void 0),y(void 0),M(void 0),d({isTransitioning:!1})}),y(x)}},[T,h,s.window,l]),$.useEffect(()=>{h&&T&&g.location.key===T.location.key&&h.resolve()},[h,m,g.location,T]),$.useEffect(()=>{!o.isTransitioning&&S&&(M(S.state),d({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}),A(void 0))},[o.isTransitioning,S]);let c=$.useMemo(()=>({createHref:s.createHref,encodeLocation:s.encodeLocation,go:R=>s.navigate(R),push:(R,L,x)=>s.navigate(R,{state:L,preventScrollReset:x==null?void 0:x.preventScrollReset}),replace:(R,L,x)=>s.navigate(R,{replace:!0,state:L,preventScrollReset:x==null?void 0:x.preventScrollReset})}),[s]),_=s.basename||"/",E=$.useMemo(()=>({router:s,navigator:c,static:!1,basename:_,unstable_onError:u}),[s,c,_,u]);return $.createElement($.Fragment,null,$.createElement(an.Provider,{value:E},$.createElement(_l.Provider,{value:g},$.createElement(Mg.Provider,{value:b.current},$.createElement(Vh.Provider,{value:o},$.createElement(Db,{basename:_,location:g.location,navigationType:g.historyAction,navigator:c},$.createElement(xb,{routes:s.routes,future:s.future,state:g,unstable_onError:u})))))),null)}var xb=$.memo(Rb);function Rb({routes:s,future:n,state:u,unstable_onError:g}){return cb(s,void 0,u,g,n)}function Db({basename:s="/",children:n=null,location:u,navigationType:g="POP",navigator:w,static:T=!1}){Ie(!vl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let M=s.replace(/^\/*/,"/"),o=$.useMemo(()=>({basename:M,navigator:w,static:T,future:{}}),[M,w,T]);typeof u=="string"&&(u=xs(u));let{pathname:d="/",search:h="",hash:p="",state:m=null,key:y="default"}=u,S=$.useMemo(()=>{let A=Pi(d,M);return A==null?null:{location:{pathname:A,search:h,hash:p,state:m,key:y},navigationType:g}},[M,d,h,p,m,y,g]);return Mt(S!=null,`<Router basename="${M}"> is not able to match the URL "${d}${h}${p}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:$.createElement(ar.Provider,{value:o},$.createElement(Qo.Provider,{children:n,value:S}))}var Uo="get",Po="application/x-www-form-urlencoded";function Vo(s){return s!=null&&typeof s.tagName=="string"}function Ab(s){return Vo(s)&&s.tagName.toLowerCase()==="button"}function Tb(s){return Vo(s)&&s.tagName.toLowerCase()==="form"}function Mb(s){return Vo(s)&&s.tagName.toLowerCase()==="input"}function Lb(s){return!!(s.metaKey||s.altKey||s.ctrlKey||s.shiftKey)}function Ob(s,n){return s.button===0&&(!n||n==="_self")&&!Lb(s)}var ko=null;function Bb(){if(ko===null)try{new FormData(document.createElement("form"),0),ko=!1}catch{ko=!0}return ko}var kb=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function vh(s){return s!=null&&!kb.has(s)?(Mt(!1,`"${s}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Po}"`),null):s}function Hb(s,n){let u,g,w,T,M;if(Tb(s)){let o=s.getAttribute("action");g=o?Pi(o,n):null,u=s.getAttribute("method")||Uo,w=vh(s.getAttribute("enctype"))||Po,T=new FormData(s)}else if(Ab(s)||Mb(s)&&(s.type==="submit"||s.type==="image")){let o=s.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let d=s.getAttribute("formaction")||o.getAttribute("action");if(g=d?Pi(d,n):null,u=s.getAttribute("formmethod")||o.getAttribute("method")||Uo,w=vh(s.getAttribute("formenctype"))||vh(o.getAttribute("enctype"))||Po,T=new FormData(o,s),!Bb()){let{name:h,type:p,value:m}=s;if(p==="image"){let y=h?`${h}.`:"";T.append(`${y}x`,"0"),T.append(`${y}y`,"0")}else h&&T.append(h,m)}}else{if(Vo(s))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');u=Uo,g=null,w=Po,M=s}return T&&w==="text/plain"&&(M=T,T=void 0),{action:g,method:u.toLowerCase(),encType:w,formData:T,body:M}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Jh(s,n){if(s===!1||s===null||typeof s>"u")throw new Error(n)}function Nb(s,n,u){let g=typeof s=="string"?new URL(s,typeof window>"u"?"server://singlefetch/":window.location.origin):s;return g.pathname==="/"?g.pathname=`_root.${u}`:n&&Pi(g.pathname,n)==="/"?g.pathname=`${n.replace(/\/$/,"")}/_root.${u}`:g.pathname=`${g.pathname.replace(/\/$/,"")}.${u}`,g}async function jb(s,n){if(s.id in n)return n[s.id];try{let u=await import(s.module);return n[s.id]=u,u}catch(u){return console.error(`Error loading route module \`${s.module}\`, reloading page...`),console.error(u),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function zb(s){return s==null?!1:s.href==null?s.rel==="preload"&&typeof s.imageSrcSet=="string"&&typeof s.imageSizes=="string":typeof s.rel=="string"&&typeof s.href=="string"}async function Ub(s,n,u){let g=await Promise.all(s.map(async w=>{let T=n.routes[w.route.id];if(T){let M=await jb(T,u);return M.links?M.links():[]}return[]}));return qb(g.flat(1).filter(zb).filter(w=>w.rel==="stylesheet"||w.rel==="preload").map(w=>w.rel==="stylesheet"?{...w,rel:"prefetch",as:"style"}:{...w,rel:"prefetch"}))}function km(s,n,u,g,w,T){let M=(d,h)=>u[h]?d.route.id!==u[h].route.id:!0,o=(d,h)=>{var p;return u[h].pathname!==d.pathname||((p=u[h].route.path)==null?void 0:p.endsWith("*"))&&u[h].params["*"]!==d.params["*"]};return T==="assets"?n.filter((d,h)=>M(d,h)||o(d,h)):T==="data"?n.filter((d,h)=>{var m;let p=g.routes[d.route.id];if(!p||!p.hasLoader)return!1;if(M(d,h)||o(d,h))return!0;if(d.route.shouldRevalidate){let y=d.route.shouldRevalidate({currentUrl:new URL(w.pathname+w.search+w.hash,window.origin),currentParams:((m=u[0])==null?void 0:m.params)||{},nextUrl:new URL(s,window.origin),nextParams:d.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function Pb(s,n,{includeHydrateFallback:u}={}){return Fb(s.map(g=>{let w=n.routes[g.route.id];if(!w)return[];let T=[w.module];return w.clientActionModule&&(T=T.concat(w.clientActionModule)),w.clientLoaderModule&&(T=T.concat(w.clientLoaderModule)),u&&w.hydrateFallbackModule&&(T=T.concat(w.hydrateFallbackModule)),w.imports&&(T=T.concat(w.imports)),T}).flat(1))}function Fb(s){return[...new Set(s)]}function Ib(s){let n={},u=Object.keys(s).sort();for(let g of u)n[g]=s[g];return n}function qb(s,n){let u=new Set;return new Set(n),s.reduce((g,w)=>{let T=JSON.stringify(Ib(w));return u.has(T)||(u.add(T),g.push({key:T,link:w})),g},[])}function kg(){let s=$.useContext(an);return Jh(s,"You must render this element inside a <DataRouterContext.Provider> element"),s}function Kb(){let s=$.useContext(_l);return Jh(s,"You must render this element inside a <DataRouterStateContext.Provider> element"),s}var ef=$.createContext(void 0);ef.displayName="FrameworkContext";function Hg(){let s=$.useContext(ef);return Jh(s,"You must render this element inside a <HydratedRouter> element"),s}function Wb(s,n){let u=$.useContext(ef),[g,w]=$.useState(!1),[T,M]=$.useState(!1),{onFocus:o,onBlur:d,onMouseEnter:h,onMouseLeave:p,onTouchStart:m}=n,y=$.useRef(null);$.useEffect(()=>{if(s==="render"&&M(!0),s==="viewport"){let b=f=>{f.forEach(c=>{M(c.isIntersecting)})},l=new IntersectionObserver(b,{threshold:.5});return y.current&&l.observe(y.current),()=>{l.disconnect()}}},[s]),$.useEffect(()=>{if(g){let b=setTimeout(()=>{M(!0)},100);return()=>{clearTimeout(b)}}},[g]);let S=()=>{w(!0)},A=()=>{w(!1),M(!1)};return u?s!=="intent"?[T,y,{}]:[T,y,{onFocus:el(o,S),onBlur:el(d,A),onMouseEnter:el(h,S),onMouseLeave:el(p,A),onTouchStart:el(m,S)}]:[!1,y,{}]}function el(s,n){return u=>{s&&s(u),u.defaultPrevented||n(u)}}function Yb({page:s,...n}){let{router:u}=kg(),g=$.useMemo(()=>fs(u.routes,s,u.basename),[u.routes,s,u.basename]);return g?$.createElement(Qb,{page:s,matches:g,...n}):null}function Gb(s){let{manifest:n,routeModules:u}=Hg(),[g,w]=$.useState([]);return $.useEffect(()=>{let T=!1;return Ub(s,n,u).then(M=>{T||w(M)}),()=>{T=!0}},[s,n,u]),g}function Qb({page:s,matches:n,...u}){let g=ln(),{manifest:w,routeModules:T}=Hg(),{basename:M}=kg(),{loaderData:o,matches:d}=Kb(),h=$.useMemo(()=>km(s,n,d,w,g,"data"),[s,n,d,w,g]),p=$.useMemo(()=>km(s,n,d,w,g,"assets"),[s,n,d,w,g]),m=$.useMemo(()=>{if(s===g.pathname+g.search+g.hash)return[];let A=new Set,b=!1;if(n.forEach(f=>{var _;let c=w.routes[f.route.id];!c||!c.hasLoader||(!h.some(E=>E.route.id===f.route.id)&&f.route.id in o&&((_=T[f.route.id])!=null&&_.shouldRevalidate)||c.hasClientLoader?b=!0:A.add(f.route.id))}),A.size===0)return[];let l=Nb(s,M,"data");return b&&A.size>0&&l.searchParams.set("_routes",n.filter(f=>A.has(f.route.id)).map(f=>f.route.id).join(",")),[l.pathname+l.search]},[M,o,g,w,h,n,s,T]),y=$.useMemo(()=>Pb(p,w),[p,w]),S=Gb(p);return $.createElement($.Fragment,null,m.map(A=>$.createElement("link",{key:A,rel:"prefetch",as:"fetch",href:A,...u})),y.map(A=>$.createElement("link",{key:A,rel:"modulepreload",href:A,...u})),S.map(({key:A,link:b})=>$.createElement("link",{key:A,nonce:u.nonce,...b})))}function Vb(...s){return n=>{s.forEach(u=>{typeof u=="function"?u(n):u!=null&&(u.current=n)})}}var Ng=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Ng&&(window.__reactRouterVersion="7.9.5")}catch{}function Xb(s,n){return HS({basename:n==null?void 0:n.basename,getContext:n==null?void 0:n.getContext,future:n==null?void 0:n.future,history:Q0({window:n==null?void 0:n.window}),hydrationData:$b(),routes:s,mapRouteProperties:bb,hydrationRouteProperties:Cb,dataStrategy:n==null?void 0:n.dataStrategy,patchRoutesOnNavigation:n==null?void 0:n.patchRoutesOnNavigation,window:n==null?void 0:n.window,unstable_instrumentations:n==null?void 0:n.unstable_instrumentations}).initialize()}function $b(){let s=window==null?void 0:window.__staticRouterHydrationData;return s&&s.errors&&(s={...s,errors:Zb(s.errors)}),s}function Zb(s){if(!s)return null;let n=Object.entries(s),u={};for(let[g,w]of n)if(w&&w.__type==="RouteErrorResponse")u[g]=new Ko(w.status,w.statusText,w.data,w.internal===!0);else if(w&&w.__type==="Error"){if(w.__subType){let T=window[w.__subType];if(typeof T=="function")try{let M=new T(w.message);M.stack="",u[g]=M}catch{}}if(u[g]==null){let T=new Error(w.message);T.stack="",u[g]=T}}else u[g]=w;return u}var jg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ji=$.forwardRef(function({onClick:n,discover:u="render",prefetch:g="none",relative:w,reloadDocument:T,replace:M,state:o,target:d,to:h,preventScrollReset:p,viewTransition:m,...y},S){let{basename:A}=$.useContext(ar),b=typeof h=="string"&&jg.test(h),l,f=!1;if(typeof h=="string"&&b&&(l=h,Ng))try{let B=new URL(window.location.href),z=h.startsWith("//")?new URL(B.protocol+h):new URL(h),I=Pi(z.pathname,A);z.origin===B.origin&&I!=null?h=I+z.search+z.hash:f=!0}catch{Mt(!1,`<Link to="${h}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let c=nb(h,{relative:w}),[_,E,R]=Wb(g,y),L=i1(h,{replace:M,state:o,target:d,preventScrollReset:p,relative:w,viewTransition:m});function x(B){n&&n(B),B.defaultPrevented||L(B)}let C=$.createElement("a",{...y,...R,href:l||c,onClick:f||T?n:x,ref:Vb(S,E),target:d,"data-discover":!b&&u==="render"?"true":void 0});return _&&!b?$.createElement($.Fragment,null,C,$.createElement(Yb,{page:c})):C});ji.displayName="Link";var Jb=$.forwardRef(function({"aria-current":n="page",caseSensitive:u=!1,className:g="",end:w=!1,style:T,to:M,viewTransition:o,children:d,...h},p){let m=ml(M,{relative:h.relative}),y=ln(),S=$.useContext(_l),{navigator:A,basename:b}=$.useContext(ar),l=S!=null&&l1(m)&&o===!0,f=A.encodeLocation?A.encodeLocation(m).pathname:m.pathname,c=y.pathname,_=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;u||(c=c.toLowerCase(),_=_?_.toLowerCase():null,f=f.toLowerCase()),_&&b&&(_=Pi(_,b)||_);const E=f!=="/"&&f.endsWith("/")?f.length-1:f.length;let R=c===f||!w&&c.startsWith(f)&&c.charAt(E)==="/",L=_!=null&&(_===f||!w&&_.startsWith(f)&&_.charAt(f.length)==="/"),x={isActive:R,isPending:L,isTransitioning:l},C=R?n:void 0,B;typeof g=="function"?B=g(x):B=[g,R?"active":null,L?"pending":null,l?"transitioning":null].filter(Boolean).join(" ");let z=typeof T=="function"?T(x):T;return $.createElement(ji,{...h,"aria-current":C,className:B,ref:p,style:z,to:M,viewTransition:o},typeof d=="function"?d(x):d)});Jb.displayName="NavLink";var e1=$.forwardRef(({discover:s="render",fetcherKey:n,navigate:u,reloadDocument:g,replace:w,state:T,method:M=Uo,action:o,onSubmit:d,relative:h,preventScrollReset:p,viewTransition:m,...y},S)=>{let A=n1(),b=a1(o,{relative:h}),l=M.toLowerCase()==="get"?"get":"post",f=typeof o=="string"&&jg.test(o),c=_=>{if(d&&d(_),_.defaultPrevented)return;_.preventDefault();let E=_.nativeEvent.submitter,R=(E==null?void 0:E.getAttribute("formmethod"))||M;A(E||_.currentTarget,{fetcherKey:n,method:R,navigate:u,replace:w,state:T,relative:h,preventScrollReset:p,viewTransition:m})};return $.createElement("form",{ref:S,method:l,action:b,onSubmit:g?d:c,...y,"data-discover":!f&&s==="render"?"true":void 0})});e1.displayName="Form";function t1(s){return`${s} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zg(s){let n=$.useContext(an);return Ie(n,t1(s)),n}function i1(s,{target:n,replace:u,state:g,preventScrollReset:w,relative:T,viewTransition:M}={}){let o=ab(),d=ln(),h=ml(s,{relative:T});return $.useCallback(p=>{if(Ob(p,n)){p.preventDefault();let m=u!==void 0?u:nr(d)===nr(h);o(s,{replace:m,state:g,preventScrollReset:w,relative:T,viewTransition:M})}},[d,o,h,u,g,n,s,w,T,M])}var r1=0,s1=()=>`__${String(++r1)}__`;function n1(){let{router:s}=zg("useSubmit"),{basename:n}=$.useContext(ar),u=pb();return $.useCallback(async(g,w={})=>{let{action:T,method:M,encType:o,formData:d,body:h}=Hb(g,n);if(w.navigate===!1){let p=w.fetcherKey||s1();await s.fetch(p,u,w.action||T,{preventScrollReset:w.preventScrollReset,formData:d,body:h,formMethod:w.method||M,formEncType:w.encType||o,flushSync:w.flushSync})}else await s.navigate(w.action||T,{preventScrollReset:w.preventScrollReset,formData:d,body:h,formMethod:w.method||M,formEncType:w.encType||o,replace:w.replace,state:w.state,fromRouteId:u,flushSync:w.flushSync,viewTransition:w.viewTransition})},[s,n,u])}function a1(s,{relative:n}={}){let{basename:u}=$.useContext(ar),g=$.useContext(lr);Ie(g,"useFormAction must be used inside a RouteContext");let[w]=g.matches.slice(-1),T={...ml(s||".",{relative:n})},M=ln();if(s==null){T.search=M.search;let o=new URLSearchParams(T.search),d=o.getAll("index");if(d.some(p=>p==="")){o.delete("index"),d.filter(m=>m).forEach(m=>o.append("index",m));let p=o.toString();T.search=p?`?${p}`:""}}return(!s||s===".")&&w.route.index&&(T.search=T.search?T.search.replace(/^\?/,"?index&"):"?index"),u!=="/"&&(T.pathname=T.pathname==="/"?u:sr([u,T.pathname])),nr(T)}function l1(s,{relative:n}={}){let u=$.useContext(Vh);Ie(u!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:g}=zg("useViewTransitionState"),w=ml(s,{relative:n});if(!u.isTransitioning)return!1;let T=Pi(u.currentLocation.pathname,g)||u.currentLocation.pathname,M=Pi(u.nextLocation.pathname,g)||u.nextLocation.pathname;return qo(w.pathname,M)!=null||qo(w.pathname,T)!=null}var o1=tg();function c1(s){return $.createElement(wb,{flushSync:o1.flushSync,...s})}const zi="/api";class Ug extends Error{constructor(n,u,g){super(n),this.statusCode=u,this.details=g,this.name="ApiError"}}async function Ui(s,n){const u=await fetch(s,{...n,headers:{"Content-Type":"application/json",...n==null?void 0:n.headers}}),g=await u.json();if(!u.ok||!g.success)throw new Ug(g.error||"API request failed",u.status,g.details);return g.data}const tf={list:async()=>Ui(`${zi}/branches`),get:async s=>{const n=encodeURIComponent(s);return Ui(`${zi}/branches/${n}`)},sync:async(s,n)=>{const u=encodeURIComponent(s);return Ui(`${zi}/branches/${u}/sync`,{method:"POST",body:JSON.stringify(n)})}},u1={list:async()=>Ui(`${zi}/worktrees`),create:async s=>Ui(`${zi}/worktrees`,{method:"POST",body:JSON.stringify(s)}),delete:async s=>{const n=new URL(`${zi}/worktrees/delete`,window.location.origin);n.searchParams.set("path",s),await Ui(n.toString(),{method:"DELETE"})}},rf={list:async()=>Ui(`${zi}/sessions`),start:async s=>Ui(`${zi}/sessions`,{method:"POST",body:JSON.stringify(s)}),get:async s=>Ui(`${zi}/sessions/${s}`),delete:async s=>{await Ui(`${zi}/sessions/${s}`,{method:"DELETE"})}},Pg={get:async()=>Ui(`${zi}/config`),update:async s=>Ui(`${zi}/config`,{method:"PUT",body:JSON.stringify(s)})};function h1(){return Go({queryKey:["branches"],queryFn:tf.list})}function f1(s){return Go({queryKey:["branches",s],queryFn:()=>tf.get(s),enabled:!!s})}function d1(s){const n=nn();return dl({mutationFn:u=>tf.sync(s,u),onSuccess:u=>{n.setQueryData(["branches",s],u.branch),n.invalidateQueries({queryKey:["branches"]})}})}const tl="__unknown__";function _1(s){return s.name.length>32?`${s.name.slice(0,29)}...`:s.name}function v1(s){if(!s.divergence)return"divergence: n/a";const{ahead:n,behind:u,upToDate:g}=s.divergence;return g?"divergence: up-to-date":`divergence: +${n} / -${u}`}function m1({branches:s}){const n=$.useMemo(()=>new Map(s.map(w=>[w.name,w])),[s]),u=$.useMemo(()=>{const w=new Set;return s.forEach(T=>{T.baseBranch&&w.add(T.baseBranch)}),w},[s]),g=$.useMemo(()=>{const w=new Map;return s.forEach(T=>{const M=T.baseBranch??tl;if(!(!T.baseBranch&&u.has(T.name))){if(!w.has(M)){const o=M!==tl?n.get(M)??null:null;w.set(M,{id:M,baseLabel:M===tl?"ベース不明":M,baseNode:o,nodes:[],isSyntheticBase:o===null})}w.get(M).nodes.push(T)}}),Array.from(w.values()).sort((T,M)=>T.id===tl?1:M.id===tl?-1:T.baseLabel.localeCompare(M.baseLabel,"ja"))},[s,n,u]);return g.length?N.jsxs("section",{className:"branch-graph-panel",children:[N.jsxs("header",{className:"branch-graph-panel__header",children:[N.jsxs("div",{children:[N.jsx("p",{className:"branch-graph-panel__eyebrow",children:"BRANCH GRAPH"}),N.jsx("h2",{children:"ベースブランチの関係をグラフィカルに把握"}),N.jsx("p",{children:"baseRef、Git upstream、merge-baseヒューリスティクスを用いて推定したベースブランチ単位で 派生ノードをレーン表示します。"})]}),N.jsxs("div",{className:"branch-graph-panel__legend",children:[N.jsx("span",{className:"graph-chip graph-chip--base",children:"Base"}),N.jsx("span",{className:"graph-chip graph-chip--local",children:"Local"}),N.jsx("span",{className:"graph-chip graph-chip--remote",children:"Remote"}),N.jsx("span",{className:"graph-chip graph-chip--worktree",children:"Worktree"})]})]}),N.jsx("div",{className:"branch-graph",children:g.map(w=>N.jsxs("article",{className:"branch-graph__lane",children:[N.jsxs("div",{className:"branch-graph__lane-heading",children:[N.jsxs("p",{className:"branch-graph__lane-label",children:[w.baseLabel,w.baseNode&&N.jsx("span",{className:"branch-graph__lane-meta",children:w.baseNode.type==="local"?"LOCAL":"REMOTE"}),w.isSyntheticBase&&N.jsx("span",{className:"branch-graph__lane-meta lane-meta--muted",children:"推定のみ"})]}),N.jsxs("span",{className:"branch-graph__lane-count",children:[w.nodes.length," branch",w.nodes.length>1?"es":""]})]}),N.jsxs("div",{className:"branch-graph__track",children:[g1(w),w.nodes.map(T=>N.jsx(p1,{branch:T},T.name))]})]},w.id))})]}):N.jsx("section",{className:"branch-graph-panel",children:N.jsxs("div",{className:"branch-graph-panel__empty",children:[N.jsx("p",{children:"グラフ表示できるブランチがありません。"}),N.jsx("p",{children:"fetch済みのブランチやWorktreeを追加すると関係図が表示されます。"})]})})}function g1(s){const n=s.baseLabel==="ベース不明"?"Unknown base":s.baseLabel,u=N.jsxs("div",{className:`branch-graph__node branch-graph__node--base ${s.baseNode?`branch-graph__node--${s.baseNode.type}`:""}`,children:[N.jsx("span",{className:"branch-graph__node-label",children:n}),N.jsx("span",{className:"branch-graph__node-meta",children:"BASE"}),N.jsxs("div",{className:"branch-graph__tooltip",children:[N.jsx("p",{children:n}),N.jsx("p",{children:s.baseNode?`type: ${s.baseNode.type}`:"推定されたベースブランチ"})]})]});return s.baseNode?N.jsx(ji,{to:`/${encodeURIComponent(s.baseNode.name)}`,className:"branch-graph__node-link","aria-label":`ベースブランチ ${s.baseNode.name} を開く`,children:u},`base-${s.id}`):N.jsx("div",{className:"branch-graph__node-link",children:u},`base-${s.id}`)}function p1({branch:s}){const n=N.jsxs("div",{className:`branch-graph__node branch-graph__node--${s.type} ${s.mergeStatus==="merged"?"branch-graph__node--merged":s.mergeStatus==="unmerged"?"branch-graph__node--active":""}`,children:[N.jsx("span",{className:"branch-graph__node-label",children:_1(s)}),N.jsx("span",{className:"branch-graph__node-meta",children:s.worktreePath?"Worktree":"No Worktree"}),N.jsxs("div",{className:"branch-graph__tooltip",children:[N.jsx("p",{children:s.name}),N.jsxs("p",{children:["base: ",s.baseBranch??"unknown"]}),N.jsx("p",{children:v1(s)}),N.jsx("p",{children:s.worktreePath??"Worktree未作成"})]})]});return N.jsx(ji,{to:`/${encodeURIComponent(s.name)}`,className:"branch-graph__node-link","aria-label":`${s.name} の詳細を開く`,children:n})}const Wn=new Intl.NumberFormat("ja-JP"),Hm={local:"ローカル",remote:"リモート"},y1={merged:"マージ済み",unmerged:"未マージ",unknown:"状態不明"},S1={merged:"success",unmerged:"warning",unknown:"muted"},b1="ブランチ名やタイプで検索...";function C1(){const{data:s,isLoading:n,error:u}=h1(),[g,w]=$.useState(""),T=s??[],M=$.useMemo(()=>{const p=T.filter(S=>!!S.worktreePath).length,m=T.filter(S=>S.type==="remote").length,y=T.filter(S=>{var A;return(A=S.divergence)==null?void 0:A.upToDate}).length;return{total:T.length,worktrees:p,remote:m,healthy:y}},[T]),o=g.trim().toLowerCase(),d=$.useMemo(()=>o?T.filter(p=>[p.name,p.type,p.mergeStatus,p.commitMessage??"",p.worktreePath??""].join(" ").toLowerCase().includes(o)):T,[T,o]),h=$.useMemo(()=>n?{title:"データを読み込み中",description:"最新のブランチ一覧を取得しています..."}:u?{title:"ブランチの取得に失敗しました",description:u instanceof Error?u.message:"未知のエラーが発生しました。"}:T.length?null:{title:"ブランチが見つかりません",description:"git fetch origin などで最新のブランチを取得してください。"},[T.length,u,n]);return N.jsxs("div",{className:"app-shell",children:[N.jsxs("header",{className:"page-hero",children:[N.jsx("p",{className:"page-hero__eyebrow",children:"WORKTREE DASHBOARD"}),N.jsx("h1",{children:"gwt Control Center"}),N.jsx("p",{children:"ローカルのGitブランチとAIツールをブラウザ上で一元管理し、Worktree状態を瞬時に 可視化します。"}),N.jsx("div",{className:"page-hero__meta",children:"リアルタイムで更新されるステータスビュー"})]}),N.jsxs("main",{className:"page-content",children:[!h&&d.length>0&&N.jsx(m1,{branches:d}),N.jsxs("section",{className:"metrics-grid",children:[N.jsxs("article",{className:"metric-card",children:[N.jsx("p",{className:"metric-card__label",children:"総ブランチ数"}),N.jsx("p",{className:"metric-card__value","data-testid":"metric-total",children:Wn.format(M.total)}),N.jsx("p",{className:"metric-card__hint",children:"ローカル + リモート"})]}),N.jsxs("article",{className:"metric-card",children:[N.jsx("p",{className:"metric-card__label",children:"作成済みWorktree"}),N.jsx("p",{className:"metric-card__value","data-testid":"metric-worktrees",children:Wn.format(M.worktrees)}),N.jsx("p",{className:"metric-card__hint",children:"即座にAIツールを起動可能"})]}),N.jsxs("article",{className:"metric-card",children:[N.jsx("p",{className:"metric-card__label",children:"リモート追跡ブランチ"}),N.jsx("p",{className:"metric-card__value",children:Wn.format(M.remote)}),N.jsx("p",{className:"metric-card__hint",children:"origin との同期ステータス"})]}),N.jsxs("article",{className:"metric-card",children:[N.jsx("p",{className:"metric-card__label",children:"最新コミットが最新"}),N.jsx("p",{className:"metric-card__value",children:Wn.format(M.healthy)}),N.jsx("p",{className:"metric-card__hint",children:"divergence 0 のブランチ"})]})]}),N.jsxs("section",{className:"toolbar",children:[N.jsxs("label",{className:"toolbar__field",children:[N.jsx("span",{className:"toolbar__icon","aria-hidden":"true",children:"🔍"}),N.jsx("input",{type:"search",className:"search-input",placeholder:b1,value:g,onChange:p=>w(p.target.value)})]}),N.jsxs("span",{className:"toolbar__count",children:[Wn.format(d.length)," / "," ",Wn.format(M.total)," branches"]})]}),h?N.jsxs("div",{className:"page-state page-state--card",children:[N.jsx("h2",{children:h.title}),N.jsx("p",{children:h.description})]}):d.length===0?N.jsxs("div",{className:"empty-state",children:[N.jsx("h3",{children:"一致するブランチがありません"}),N.jsx("p",{children:"検索条件を見直すか、タグ・ブランチタイプ・コミットメッセージなど別のキーワードを 試してください。"})]}):N.jsx("div",{className:"branch-grid",children:d.map(p=>N.jsxs("article",{className:"branch-card",children:[N.jsxs("div",{className:"branch-card__header",children:[N.jsxs("div",{children:[N.jsxs("p",{className:"branch-card__eyebrow",children:[Hm[p.type],"ブランチ"]}),N.jsx("h2",{children:p.name})]}),N.jsxs("div",{className:"badge-group",children:[N.jsx("span",{className:`status-badge status-badge--${p.type}`,children:Hm[p.type]}),N.jsx("span",{className:`status-badge status-badge--${S1[p.mergeStatus]}`,children:y1[p.mergeStatus]}),N.jsx("span",{className:`status-badge ${p.worktreePath?"status-badge--success":"status-badge--muted"}`,children:p.worktreePath?"Worktreeあり":"Worktree未作成"})]})]}),N.jsx("p",{className:"branch-card__commit",children:p.commitMessage??"コミットメッセージがありません"}),N.jsxs("dl",{className:"metadata-grid metadata-grid--compact",children:[N.jsxs("div",{children:[N.jsx("dt",{children:"最新コミット"}),N.jsx("dd",{children:p.commitHash.slice(0,7)})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"Author"}),N.jsx("dd",{children:p.author??"N/A"})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"Worktree"}),N.jsx("dd",{children:p.worktreePath??"未作成"})]})]}),p.divergence&&N.jsxs("div",{className:"pill-group",children:[N.jsxs("span",{className:"pill",children:["Ahead ",p.divergence.ahead]}),N.jsxs("span",{className:"pill",children:["Behind ",p.divergence.behind]}),N.jsx("span",{className:`pill ${p.divergence.upToDate?"pill--success":"pill--warning"}`,children:p.divergence.upToDate?"最新":"更新あり"})]}),N.jsxs("div",{className:"branch-card__actions",children:[N.jsx(ji,{className:"button button--ghost",to:`/${encodeURIComponent(p.name)}`,children:"詳細を見る"}),N.jsx("span",{className:`info-pill ${p.worktreePath?"info-pill--success":"info-pill--warning"}`,children:p.worktreePath??"Worktree未作成"})]})]},p.name))})]})]})}function E1(){const s=nn();return dl({mutationFn:n=>u1.create(n),onSuccess:()=>{s.invalidateQueries({queryKey:["worktrees"]}),s.invalidateQueries({queryKey:["branches"]})}})}function w1(){return Go({queryKey:["sessions"],queryFn:rf.list})}function x1(){const s=nn();return dl({mutationFn:n=>rf.start(n),onSuccess:()=>{s.invalidateQueries({queryKey:["sessions"]})}})}function R1(){const s=nn();return dl({mutationFn:n=>rf.delete(n),onSuccess:()=>{s.invalidateQueries({queryKey:["sessions"]})}})}function Fg(){return Go({queryKey:["config"],queryFn:Pg.get})}function D1(){const s=nn();return dl({mutationFn:Pg.update,onSuccess:n=>{s.setQueryData(["config"],n)}})}var mh={exports:{}},Nm;function A1(){return Nm||(Nm=1,(function(s,n){(function(u,g){s.exports=g()})(globalThis,(()=>(()=>{var u={4567:function(M,o,d){var h=this&&this.__decorate||function(f,c,_,E){var R,L=arguments.length,x=L<3?c:E===null?E=Object.getOwnPropertyDescriptor(c,_):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,c,_,E);else for(var C=f.length-1;C>=0;C--)(R=f[C])&&(x=(L<3?R(x):L>3?R(c,_,x):R(c,_))||x);return L>3&&x&&Object.defineProperty(c,_,x),x},p=this&&this.__param||function(f,c){return function(_,E){c(_,E,f)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const m=d(9042),y=d(9924),S=d(844),A=d(4725),b=d(2585);let l=o.AccessibilityManager=class extends S.Disposable{constructor(f,c,_,E){super(),this._terminal=f,this._coreBrowserService=_,this._renderService=E,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let R=0;R<this._terminal.rows;R++)this._rowElements[R]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[R]);if(this._topBoundaryFocusListener=R=>this._handleBoundaryFocus(R,0),this._bottomBoundaryFocusListener=R=>this._handleBoundaryFocus(R,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new y.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((R=>this._handleResize(R.rows)))),this.register(this._terminal.onRender((R=>this._refreshRows(R.start,R.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((R=>this._handleChar(R)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
61
|
+
Please change the parent <Route path="${c}"> to <Route path="${c==="/"?"*":`${c}/*`}">.`)}let y=ln(),S;S=y;let A=S.pathname||"/",b=A;if(p!=="/"){let c=p.replace(/^\//,"").split("/");b="/"+A.replace(/^\//,"").split("/").slice(c.length).join("/")}let l=fs(s,{pathname:b});return Mt(m||l!=null,`No routes matched location "${S.pathname}${S.search}${S.hash}" `),Mt(l==null||l[l.length-1].route.element!==void 0||l[l.length-1].route.Component!==void 0||l[l.length-1].route.lazy!==void 0,`Matched leaf route at location "${S.pathname}${S.search}${S.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),_b(l&&l.map(c=>Object.assign({},c,{params:Object.assign({},d,c.params),pathname:sr([p,T.encodeLocation?T.encodeLocation(c.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:c.pathname]),pathnameBase:c.pathnameBase==="/"?p:sr([p,T.encodeLocation?T.encodeLocation(c.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:c.pathnameBase])})),M,u,g,w)}function ub(){let s=yb(),n=ll(s)?`${s.status} ${s.statusText}`:s instanceof Error?s.message:JSON.stringify(s),u=s instanceof Error?s.stack:null,g="rgba(200,200,200, 0.5)",w={padding:"0.5rem",backgroundColor:g},T={padding:"2px 4px",backgroundColor:g},M=null;return console.error("Error handled by React Router default ErrorBoundary:",s),M=$.createElement($.Fragment,null,$.createElement("p",null,"💿 Hey developer 👋"),$.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",$.createElement("code",{style:T},"ErrorBoundary")," or"," ",$.createElement("code",{style:T},"errorElement")," prop on your route.")),$.createElement($.Fragment,null,$.createElement("h2",null,"Unexpected Application Error!"),$.createElement("h3",{style:{fontStyle:"italic"}},n),u?$.createElement("pre",{style:w},u):null,M)}var hb=$.createElement(ub,null),fb=class extends $.Component{constructor(s){super(s),this.state={location:s.location,revalidation:s.revalidation,error:s.error}}static getDerivedStateFromError(s){return{error:s}}static getDerivedStateFromProps(s,n){return n.location!==s.location||n.revalidation!=="idle"&&s.revalidation==="idle"?{error:s.error,location:s.location,revalidation:s.revalidation}:{error:s.error!==void 0?s.error:n.error,location:n.location,revalidation:s.revalidation||n.revalidation}}componentDidCatch(s,n){this.props.unstable_onError?this.props.unstable_onError(s,n):console.error("React Router caught the following error during render",s)}render(){return this.state.error!==void 0?$.createElement(lr.Provider,{value:this.props.routeContext},$.createElement(Xh.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function db({routeContext:s,match:n,children:u}){let g=$.useContext(an);return g&&g.static&&g.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(g.staticContext._deepestRenderedBoundaryId=n.route.id),$.createElement(lr.Provider,{value:s},u)}function _b(s,n=[],u=null,g=null,w=null){if(s==null){if(!u)return null;if(u.errors)s=u.matches;else if(n.length===0&&!u.initialized&&u.matches.length>0)s=u.matches;else return null}let T=s,M=u==null?void 0:u.errors;if(M!=null){let h=T.findIndex(p=>p.route.id&&(M==null?void 0:M[p.route.id])!==void 0);Ie(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(M).join(",")}`),T=T.slice(0,Math.min(T.length,h+1))}let o=!1,d=-1;if(u)for(let h=0;h<T.length;h++){let p=T[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=h),p.route.id){let{loaderData:m,errors:y}=u,S=p.route.loader&&!m.hasOwnProperty(p.route.id)&&(!y||y[p.route.id]===void 0);if(p.route.lazy||S){o=!0,d>=0?T=T.slice(0,d+1):T=[T[0]];break}}}return T.reduceRight((h,p,m)=>{let y,S=!1,A=null,b=null;u&&(y=M&&p.route.id?M[p.route.id]:void 0,A=p.route.errorElement||hb,o&&(d<0&&m===0?(Bg("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,b=null):d===m&&(S=!0,b=p.route.hydrateFallbackElement||null)));let l=n.concat(T.slice(0,m+1)),f=()=>{let c;return y?c=A:S?c=b:p.route.Component?c=$.createElement(p.route.Component,null):p.route.element?c=p.route.element:c=h,$.createElement(db,{match:p,routeContext:{outlet:h,matches:l,isDataRoute:u!=null},children:c})};return u&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?$.createElement(fb,{location:u.location,revalidation:u.revalidation,component:A,error:y,children:f(),routeContext:{outlet:null,matches:l,isDataRoute:!0},unstable_onError:g}):f()},null)}function $h(s){return`${s} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vb(s){let n=$.useContext(an);return Ie(n,$h(s)),n}function mb(s){let n=$.useContext(_l);return Ie(n,$h(s)),n}function gb(s){let n=$.useContext(lr);return Ie(n,$h(s)),n}function Zh(s){let n=gb(s),u=n.matches[n.matches.length-1];return Ie(u.route.id,`${s} can only be used on routes that contain a unique "id"`),u.route.id}function pb(){return Zh("useRouteId")}function yb(){var g;let s=$.useContext(Xh),n=mb("useRouteError"),u=Zh("useRouteError");return s!==void 0?s:(g=n.errors)==null?void 0:g[u]}function Sb(){let{router:s}=vb("useNavigate"),n=Zh("useNavigate"),u=$.useRef(!1);return Og(()=>{u.current=!0}),$.useCallback(async(w,T={})=>{Mt(u.current,Lg),u.current&&(typeof w=="number"?s.navigate(w):await s.navigate(w,{fromRouteId:n,...T}))},[s,n])}var Lm={};function Bg(s,n,u){!n&&!Lm[s]&&(Lm[s]=!0,Mt(!1,u))}var Om={};function Bm(s,n){!s&&!Om[n]&&(Om[n]=!0,console.warn(n))}function bb(s){let n={hasErrorBoundary:s.hasErrorBoundary||s.ErrorBoundary!=null||s.errorElement!=null};return s.Component&&(s.element&&Mt(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(n,{element:$.createElement(s.Component),Component:void 0})),s.HydrateFallback&&(s.hydrateFallbackElement&&Mt(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(n,{hydrateFallbackElement:$.createElement(s.HydrateFallback),HydrateFallback:void 0})),s.ErrorBoundary&&(s.errorElement&&Mt(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(n,{errorElement:$.createElement(s.ErrorBoundary),ErrorBoundary:void 0})),n}var Cb=["HydrateFallback","hydrateFallbackElement"],Eb=class{constructor(){this.status="pending",this.promise=new Promise((s,n)=>{this.resolve=u=>{this.status==="pending"&&(this.status="resolved",s(u))},this.reject=u=>{this.status==="pending"&&(this.status="rejected",n(u))}})}};function wb({router:s,flushSync:n,unstable_onError:u}){let[g,w]=$.useState(s.state),[T,M]=$.useState(),[o,d]=$.useState({isTransitioning:!1}),[h,p]=$.useState(),[m,y]=$.useState(),[S,A]=$.useState(),b=$.useRef(new Map),l=$.useCallback(R=>{w(L=>(R.errors&&u&&Object.entries(R.errors).forEach(([x,C])=>{var B;((B=L.errors)==null?void 0:B[x])!==C&&u(C)}),R))},[u]),f=$.useCallback((R,{deletedFetchers:L,flushSync:x,viewTransitionOpts:C})=>{R.fetchers.forEach((z,I)=>{z.data!==void 0&&b.current.set(I,z.data)}),L.forEach(z=>b.current.delete(z)),Bm(x===!1||n!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let B=s.window!=null&&s.window.document!=null&&typeof s.window.document.startViewTransition=="function";if(Bm(C==null||B,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!C||!B){n&&x?n(()=>l(R)):$.startTransition(()=>l(R));return}if(n&&x){n(()=>{m&&(h&&h.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:C.currentLocation,nextLocation:C.nextLocation})});let z=s.window.document.startViewTransition(()=>{n(()=>l(R))});z.finished.finally(()=>{n(()=>{p(void 0),y(void 0),M(void 0),d({isTransitioning:!1})})}),n(()=>y(z));return}m?(h&&h.resolve(),m.skipTransition(),A({state:R,currentLocation:C.currentLocation,nextLocation:C.nextLocation})):(M(R),d({isTransitioning:!0,flushSync:!1,currentLocation:C.currentLocation,nextLocation:C.nextLocation}))},[s.window,n,m,h,l]);$.useLayoutEffect(()=>s.subscribe(f),[s,f]),$.useEffect(()=>{o.isTransitioning&&!o.flushSync&&p(new Eb)},[o]),$.useEffect(()=>{if(h&&T&&s.window){let R=T,L=h.promise,x=s.window.document.startViewTransition(async()=>{$.startTransition(()=>l(R)),await L});x.finished.finally(()=>{p(void 0),y(void 0),M(void 0),d({isTransitioning:!1})}),y(x)}},[T,h,s.window,l]),$.useEffect(()=>{h&&T&&g.location.key===T.location.key&&h.resolve()},[h,m,g.location,T]),$.useEffect(()=>{!o.isTransitioning&&S&&(M(S.state),d({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}),A(void 0))},[o.isTransitioning,S]);let c=$.useMemo(()=>({createHref:s.createHref,encodeLocation:s.encodeLocation,go:R=>s.navigate(R),push:(R,L,x)=>s.navigate(R,{state:L,preventScrollReset:x==null?void 0:x.preventScrollReset}),replace:(R,L,x)=>s.navigate(R,{replace:!0,state:L,preventScrollReset:x==null?void 0:x.preventScrollReset})}),[s]),_=s.basename||"/",E=$.useMemo(()=>({router:s,navigator:c,static:!1,basename:_,unstable_onError:u}),[s,c,_,u]);return $.createElement($.Fragment,null,$.createElement(an.Provider,{value:E},$.createElement(_l.Provider,{value:g},$.createElement(Mg.Provider,{value:b.current},$.createElement(Vh.Provider,{value:o},$.createElement(Db,{basename:_,location:g.location,navigationType:g.historyAction,navigator:c},$.createElement(xb,{routes:s.routes,future:s.future,state:g,unstable_onError:u})))))),null)}var xb=$.memo(Rb);function Rb({routes:s,future:n,state:u,unstable_onError:g}){return cb(s,void 0,u,g,n)}function Db({basename:s="/",children:n=null,location:u,navigationType:g="POP",navigator:w,static:T=!1}){Ie(!vl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let M=s.replace(/^\/*/,"/"),o=$.useMemo(()=>({basename:M,navigator:w,static:T,future:{}}),[M,w,T]);typeof u=="string"&&(u=xs(u));let{pathname:d="/",search:h="",hash:p="",state:m=null,key:y="default"}=u,S=$.useMemo(()=>{let A=Pi(d,M);return A==null?null:{location:{pathname:A,search:h,hash:p,state:m,key:y},navigationType:g}},[M,d,h,p,m,y,g]);return Mt(S!=null,`<Router basename="${M}"> is not able to match the URL "${d}${h}${p}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:$.createElement(ar.Provider,{value:o},$.createElement(Qo.Provider,{children:n,value:S}))}var Uo="get",Po="application/x-www-form-urlencoded";function Vo(s){return s!=null&&typeof s.tagName=="string"}function Ab(s){return Vo(s)&&s.tagName.toLowerCase()==="button"}function Tb(s){return Vo(s)&&s.tagName.toLowerCase()==="form"}function Mb(s){return Vo(s)&&s.tagName.toLowerCase()==="input"}function Lb(s){return!!(s.metaKey||s.altKey||s.ctrlKey||s.shiftKey)}function Ob(s,n){return s.button===0&&(!n||n==="_self")&&!Lb(s)}var ko=null;function Bb(){if(ko===null)try{new FormData(document.createElement("form"),0),ko=!1}catch{ko=!0}return ko}var kb=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function vh(s){return s!=null&&!kb.has(s)?(Mt(!1,`"${s}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Po}"`),null):s}function Hb(s,n){let u,g,w,T,M;if(Tb(s)){let o=s.getAttribute("action");g=o?Pi(o,n):null,u=s.getAttribute("method")||Uo,w=vh(s.getAttribute("enctype"))||Po,T=new FormData(s)}else if(Ab(s)||Mb(s)&&(s.type==="submit"||s.type==="image")){let o=s.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let d=s.getAttribute("formaction")||o.getAttribute("action");if(g=d?Pi(d,n):null,u=s.getAttribute("formmethod")||o.getAttribute("method")||Uo,w=vh(s.getAttribute("formenctype"))||vh(o.getAttribute("enctype"))||Po,T=new FormData(o,s),!Bb()){let{name:h,type:p,value:m}=s;if(p==="image"){let y=h?`${h}.`:"";T.append(`${y}x`,"0"),T.append(`${y}y`,"0")}else h&&T.append(h,m)}}else{if(Vo(s))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');u=Uo,g=null,w=Po,M=s}return T&&w==="text/plain"&&(M=T,T=void 0),{action:g,method:u.toLowerCase(),encType:w,formData:T,body:M}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Jh(s,n){if(s===!1||s===null||typeof s>"u")throw new Error(n)}function Nb(s,n,u){let g=typeof s=="string"?new URL(s,typeof window>"u"?"server://singlefetch/":window.location.origin):s;return g.pathname==="/"?g.pathname=`_root.${u}`:n&&Pi(g.pathname,n)==="/"?g.pathname=`${n.replace(/\/$/,"")}/_root.${u}`:g.pathname=`${g.pathname.replace(/\/$/,"")}.${u}`,g}async function jb(s,n){if(s.id in n)return n[s.id];try{let u=await import(s.module);return n[s.id]=u,u}catch(u){return console.error(`Error loading route module \`${s.module}\`, reloading page...`),console.error(u),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function zb(s){return s==null?!1:s.href==null?s.rel==="preload"&&typeof s.imageSrcSet=="string"&&typeof s.imageSizes=="string":typeof s.rel=="string"&&typeof s.href=="string"}async function Ub(s,n,u){let g=await Promise.all(s.map(async w=>{let T=n.routes[w.route.id];if(T){let M=await jb(T,u);return M.links?M.links():[]}return[]}));return qb(g.flat(1).filter(zb).filter(w=>w.rel==="stylesheet"||w.rel==="preload").map(w=>w.rel==="stylesheet"?{...w,rel:"prefetch",as:"style"}:{...w,rel:"prefetch"}))}function km(s,n,u,g,w,T){let M=(d,h)=>u[h]?d.route.id!==u[h].route.id:!0,o=(d,h)=>{var p;return u[h].pathname!==d.pathname||((p=u[h].route.path)==null?void 0:p.endsWith("*"))&&u[h].params["*"]!==d.params["*"]};return T==="assets"?n.filter((d,h)=>M(d,h)||o(d,h)):T==="data"?n.filter((d,h)=>{var m;let p=g.routes[d.route.id];if(!p||!p.hasLoader)return!1;if(M(d,h)||o(d,h))return!0;if(d.route.shouldRevalidate){let y=d.route.shouldRevalidate({currentUrl:new URL(w.pathname+w.search+w.hash,window.origin),currentParams:((m=u[0])==null?void 0:m.params)||{},nextUrl:new URL(s,window.origin),nextParams:d.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function Pb(s,n,{includeHydrateFallback:u}={}){return Fb(s.map(g=>{let w=n.routes[g.route.id];if(!w)return[];let T=[w.module];return w.clientActionModule&&(T=T.concat(w.clientActionModule)),w.clientLoaderModule&&(T=T.concat(w.clientLoaderModule)),u&&w.hydrateFallbackModule&&(T=T.concat(w.hydrateFallbackModule)),w.imports&&(T=T.concat(w.imports)),T}).flat(1))}function Fb(s){return[...new Set(s)]}function Ib(s){let n={},u=Object.keys(s).sort();for(let g of u)n[g]=s[g];return n}function qb(s,n){let u=new Set;return new Set(n),s.reduce((g,w)=>{let T=JSON.stringify(Ib(w));return u.has(T)||(u.add(T),g.push({key:T,link:w})),g},[])}function kg(){let s=$.useContext(an);return Jh(s,"You must render this element inside a <DataRouterContext.Provider> element"),s}function Kb(){let s=$.useContext(_l);return Jh(s,"You must render this element inside a <DataRouterStateContext.Provider> element"),s}var ef=$.createContext(void 0);ef.displayName="FrameworkContext";function Hg(){let s=$.useContext(ef);return Jh(s,"You must render this element inside a <HydratedRouter> element"),s}function Wb(s,n){let u=$.useContext(ef),[g,w]=$.useState(!1),[T,M]=$.useState(!1),{onFocus:o,onBlur:d,onMouseEnter:h,onMouseLeave:p,onTouchStart:m}=n,y=$.useRef(null);$.useEffect(()=>{if(s==="render"&&M(!0),s==="viewport"){let b=f=>{f.forEach(c=>{M(c.isIntersecting)})},l=new IntersectionObserver(b,{threshold:.5});return y.current&&l.observe(y.current),()=>{l.disconnect()}}},[s]),$.useEffect(()=>{if(g){let b=setTimeout(()=>{M(!0)},100);return()=>{clearTimeout(b)}}},[g]);let S=()=>{w(!0)},A=()=>{w(!1),M(!1)};return u?s!=="intent"?[T,y,{}]:[T,y,{onFocus:el(o,S),onBlur:el(d,A),onMouseEnter:el(h,S),onMouseLeave:el(p,A),onTouchStart:el(m,S)}]:[!1,y,{}]}function el(s,n){return u=>{s&&s(u),u.defaultPrevented||n(u)}}function Yb({page:s,...n}){let{router:u}=kg(),g=$.useMemo(()=>fs(u.routes,s,u.basename),[u.routes,s,u.basename]);return g?$.createElement(Qb,{page:s,matches:g,...n}):null}function Gb(s){let{manifest:n,routeModules:u}=Hg(),[g,w]=$.useState([]);return $.useEffect(()=>{let T=!1;return Ub(s,n,u).then(M=>{T||w(M)}),()=>{T=!0}},[s,n,u]),g}function Qb({page:s,matches:n,...u}){let g=ln(),{manifest:w,routeModules:T}=Hg(),{basename:M}=kg(),{loaderData:o,matches:d}=Kb(),h=$.useMemo(()=>km(s,n,d,w,g,"data"),[s,n,d,w,g]),p=$.useMemo(()=>km(s,n,d,w,g,"assets"),[s,n,d,w,g]),m=$.useMemo(()=>{if(s===g.pathname+g.search+g.hash)return[];let A=new Set,b=!1;if(n.forEach(f=>{var _;let c=w.routes[f.route.id];!c||!c.hasLoader||(!h.some(E=>E.route.id===f.route.id)&&f.route.id in o&&((_=T[f.route.id])!=null&&_.shouldRevalidate)||c.hasClientLoader?b=!0:A.add(f.route.id))}),A.size===0)return[];let l=Nb(s,M,"data");return b&&A.size>0&&l.searchParams.set("_routes",n.filter(f=>A.has(f.route.id)).map(f=>f.route.id).join(",")),[l.pathname+l.search]},[M,o,g,w,h,n,s,T]),y=$.useMemo(()=>Pb(p,w),[p,w]),S=Gb(p);return $.createElement($.Fragment,null,m.map(A=>$.createElement("link",{key:A,rel:"prefetch",as:"fetch",href:A,...u})),y.map(A=>$.createElement("link",{key:A,rel:"modulepreload",href:A,...u})),S.map(({key:A,link:b})=>$.createElement("link",{key:A,nonce:u.nonce,...b})))}function Vb(...s){return n=>{s.forEach(u=>{typeof u=="function"?u(n):u!=null&&(u.current=n)})}}var Ng=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Ng&&(window.__reactRouterVersion="7.9.5")}catch{}function Xb(s,n){return HS({basename:n==null?void 0:n.basename,getContext:n==null?void 0:n.getContext,future:n==null?void 0:n.future,history:Q0({window:n==null?void 0:n.window}),hydrationData:$b(),routes:s,mapRouteProperties:bb,hydrationRouteProperties:Cb,dataStrategy:n==null?void 0:n.dataStrategy,patchRoutesOnNavigation:n==null?void 0:n.patchRoutesOnNavigation,window:n==null?void 0:n.window,unstable_instrumentations:n==null?void 0:n.unstable_instrumentations}).initialize()}function $b(){let s=window==null?void 0:window.__staticRouterHydrationData;return s&&s.errors&&(s={...s,errors:Zb(s.errors)}),s}function Zb(s){if(!s)return null;let n=Object.entries(s),u={};for(let[g,w]of n)if(w&&w.__type==="RouteErrorResponse")u[g]=new Ko(w.status,w.statusText,w.data,w.internal===!0);else if(w&&w.__type==="Error"){if(w.__subType){let T=window[w.__subType];if(typeof T=="function")try{let M=new T(w.message);M.stack="",u[g]=M}catch{}}if(u[g]==null){let T=new Error(w.message);T.stack="",u[g]=T}}else u[g]=w;return u}var jg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ji=$.forwardRef(function({onClick:n,discover:u="render",prefetch:g="none",relative:w,reloadDocument:T,replace:M,state:o,target:d,to:h,preventScrollReset:p,viewTransition:m,...y},S){let{basename:A}=$.useContext(ar),b=typeof h=="string"&&jg.test(h),l,f=!1;if(typeof h=="string"&&b&&(l=h,Ng))try{let B=new URL(window.location.href),z=h.startsWith("//")?new URL(B.protocol+h):new URL(h),I=Pi(z.pathname,A);z.origin===B.origin&&I!=null?h=I+z.search+z.hash:f=!0}catch{Mt(!1,`<Link to="${h}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let c=nb(h,{relative:w}),[_,E,R]=Wb(g,y),L=i1(h,{replace:M,state:o,target:d,preventScrollReset:p,relative:w,viewTransition:m});function x(B){n&&n(B),B.defaultPrevented||L(B)}let C=$.createElement("a",{...y,...R,href:l||c,onClick:f||T?n:x,ref:Vb(S,E),target:d,"data-discover":!b&&u==="render"?"true":void 0});return _&&!b?$.createElement($.Fragment,null,C,$.createElement(Yb,{page:c})):C});ji.displayName="Link";var Jb=$.forwardRef(function({"aria-current":n="page",caseSensitive:u=!1,className:g="",end:w=!1,style:T,to:M,viewTransition:o,children:d,...h},p){let m=ml(M,{relative:h.relative}),y=ln(),S=$.useContext(_l),{navigator:A,basename:b}=$.useContext(ar),l=S!=null&&l1(m)&&o===!0,f=A.encodeLocation?A.encodeLocation(m).pathname:m.pathname,c=y.pathname,_=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;u||(c=c.toLowerCase(),_=_?_.toLowerCase():null,f=f.toLowerCase()),_&&b&&(_=Pi(_,b)||_);const E=f!=="/"&&f.endsWith("/")?f.length-1:f.length;let R=c===f||!w&&c.startsWith(f)&&c.charAt(E)==="/",L=_!=null&&(_===f||!w&&_.startsWith(f)&&_.charAt(f.length)==="/"),x={isActive:R,isPending:L,isTransitioning:l},C=R?n:void 0,B;typeof g=="function"?B=g(x):B=[g,R?"active":null,L?"pending":null,l?"transitioning":null].filter(Boolean).join(" ");let z=typeof T=="function"?T(x):T;return $.createElement(ji,{...h,"aria-current":C,className:B,ref:p,style:z,to:M,viewTransition:o},typeof d=="function"?d(x):d)});Jb.displayName="NavLink";var e1=$.forwardRef(({discover:s="render",fetcherKey:n,navigate:u,reloadDocument:g,replace:w,state:T,method:M=Uo,action:o,onSubmit:d,relative:h,preventScrollReset:p,viewTransition:m,...y},S)=>{let A=n1(),b=a1(o,{relative:h}),l=M.toLowerCase()==="get"?"get":"post",f=typeof o=="string"&&jg.test(o),c=_=>{if(d&&d(_),_.defaultPrevented)return;_.preventDefault();let E=_.nativeEvent.submitter,R=(E==null?void 0:E.getAttribute("formmethod"))||M;A(E||_.currentTarget,{fetcherKey:n,method:R,navigate:u,replace:w,state:T,relative:h,preventScrollReset:p,viewTransition:m})};return $.createElement("form",{ref:S,method:l,action:b,onSubmit:g?d:c,...y,"data-discover":!f&&s==="render"?"true":void 0})});e1.displayName="Form";function t1(s){return`${s} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zg(s){let n=$.useContext(an);return Ie(n,t1(s)),n}function i1(s,{target:n,replace:u,state:g,preventScrollReset:w,relative:T,viewTransition:M}={}){let o=ab(),d=ln(),h=ml(s,{relative:T});return $.useCallback(p=>{if(Ob(p,n)){p.preventDefault();let m=u!==void 0?u:nr(d)===nr(h);o(s,{replace:m,state:g,preventScrollReset:w,relative:T,viewTransition:M})}},[d,o,h,u,g,n,s,w,T,M])}var r1=0,s1=()=>`__${String(++r1)}__`;function n1(){let{router:s}=zg("useSubmit"),{basename:n}=$.useContext(ar),u=pb();return $.useCallback(async(g,w={})=>{let{action:T,method:M,encType:o,formData:d,body:h}=Hb(g,n);if(w.navigate===!1){let p=w.fetcherKey||s1();await s.fetch(p,u,w.action||T,{preventScrollReset:w.preventScrollReset,formData:d,body:h,formMethod:w.method||M,formEncType:w.encType||o,flushSync:w.flushSync})}else await s.navigate(w.action||T,{preventScrollReset:w.preventScrollReset,formData:d,body:h,formMethod:w.method||M,formEncType:w.encType||o,replace:w.replace,state:w.state,fromRouteId:u,flushSync:w.flushSync,viewTransition:w.viewTransition})},[s,n,u])}function a1(s,{relative:n}={}){let{basename:u}=$.useContext(ar),g=$.useContext(lr);Ie(g,"useFormAction must be used inside a RouteContext");let[w]=g.matches.slice(-1),T={...ml(s||".",{relative:n})},M=ln();if(s==null){T.search=M.search;let o=new URLSearchParams(T.search),d=o.getAll("index");if(d.some(p=>p==="")){o.delete("index"),d.filter(m=>m).forEach(m=>o.append("index",m));let p=o.toString();T.search=p?`?${p}`:""}}return(!s||s===".")&&w.route.index&&(T.search=T.search?T.search.replace(/^\?/,"?index&"):"?index"),u!=="/"&&(T.pathname=T.pathname==="/"?u:sr([u,T.pathname])),nr(T)}function l1(s,{relative:n}={}){let u=$.useContext(Vh);Ie(u!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:g}=zg("useViewTransitionState"),w=ml(s,{relative:n});if(!u.isTransitioning)return!1;let T=Pi(u.currentLocation.pathname,g)||u.currentLocation.pathname,M=Pi(u.nextLocation.pathname,g)||u.nextLocation.pathname;return qo(w.pathname,M)!=null||qo(w.pathname,T)!=null}var o1=tg();function c1(s){return $.createElement(wb,{flushSync:o1.flushSync,...s})}const zi="/api";class Ug extends Error{constructor(n,u,g){super(n),this.statusCode=u,this.details=g,this.name="ApiError"}}async function Ui(s,n){const u=await fetch(s,{...n,headers:{"Content-Type":"application/json",...n==null?void 0:n.headers}}),g=await u.json();if(!u.ok||!g.success)throw new Ug(g.error||"API request failed",u.status,g.details);return g.data}const tf={list:async()=>Ui(`${zi}/branches`),get:async s=>{const n=encodeURIComponent(s);return Ui(`${zi}/branches/${n}`)},sync:async(s,n)=>{const u=encodeURIComponent(s);return Ui(`${zi}/branches/${u}/sync`,{method:"POST",body:JSON.stringify(n)})}},u1={list:async()=>Ui(`${zi}/worktrees`),create:async s=>Ui(`${zi}/worktrees`,{method:"POST",body:JSON.stringify(s)}),delete:async s=>{const n=new URL(`${zi}/worktrees/delete`,window.location.origin);n.searchParams.set("path",s),await Ui(n.toString(),{method:"DELETE"})}},rf={list:async()=>Ui(`${zi}/sessions`),start:async s=>Ui(`${zi}/sessions`,{method:"POST",body:JSON.stringify(s)}),get:async s=>Ui(`${zi}/sessions/${s}`),delete:async s=>{await Ui(`${zi}/sessions/${s}`,{method:"DELETE"})}},Pg={get:async()=>Ui(`${zi}/config`),update:async s=>Ui(`${zi}/config`,{method:"PUT",body:JSON.stringify(s)})};function h1(){return Go({queryKey:["branches"],queryFn:tf.list})}function f1(s){return Go({queryKey:["branches",s],queryFn:()=>tf.get(s),enabled:!!s})}function d1(s){const n=nn();return dl({mutationFn:u=>tf.sync(s,u),onSuccess:u=>{n.setQueryData(["branches",s],u.branch),n.invalidateQueries({queryKey:["branches"]})}})}const tl="__unknown__";function _1(s){return s.name.length>32?`${s.name.slice(0,29)}...`:s.name}function v1(s){if(!s.divergence)return"divergence: n/a";const{ahead:n,behind:u,upToDate:g}=s.divergence;return g?"divergence: up-to-date":`divergence: +${n} / -${u}`}function m1({branches:s}){const n=$.useMemo(()=>new Map(s.map(w=>[w.name,w])),[s]),u=$.useMemo(()=>{const w=new Set;return s.forEach(T=>{T.baseBranch&&w.add(T.baseBranch)}),w},[s]),g=$.useMemo(()=>{const w=new Map;return s.forEach(T=>{const M=T.baseBranch??tl;if(!(!T.baseBranch&&u.has(T.name))){if(!w.has(M)){const o=M!==tl?n.get(M)??null:null;w.set(M,{id:M,baseLabel:M===tl?"ベース不明":M,baseNode:o,nodes:[],isSyntheticBase:o===null})}w.get(M).nodes.push(T)}}),Array.from(w.values()).sort((T,M)=>T.id===tl?1:M.id===tl?-1:T.baseLabel.localeCompare(M.baseLabel,"ja"))},[s,n,u]);return g.length?N.jsxs("section",{className:"branch-graph-panel",children:[N.jsxs("header",{className:"branch-graph-panel__header",children:[N.jsxs("div",{children:[N.jsx("p",{className:"branch-graph-panel__eyebrow",children:"BRANCH GRAPH"}),N.jsx("h2",{children:"ベースブランチの関係をグラフィカルに把握"}),N.jsx("p",{children:"baseRef、Git upstream、merge-baseヒューリスティクスを用いて推定したベースブランチ単位で 派生ノードをレーン表示します。"})]}),N.jsxs("div",{className:"branch-graph-panel__legend",children:[N.jsx("span",{className:"graph-chip graph-chip--base",children:"Base"}),N.jsx("span",{className:"graph-chip graph-chip--local",children:"Local"}),N.jsx("span",{className:"graph-chip graph-chip--remote",children:"Remote"}),N.jsx("span",{className:"graph-chip graph-chip--worktree",children:"Worktree"})]})]}),N.jsx("div",{className:"branch-graph",children:g.map(w=>N.jsxs("article",{className:"branch-graph__lane",children:[N.jsxs("div",{className:"branch-graph__lane-heading",children:[N.jsxs("p",{className:"branch-graph__lane-label",children:[w.baseLabel,w.baseNode&&N.jsx("span",{className:"branch-graph__lane-meta",children:w.baseNode.type==="local"?"LOCAL":"REMOTE"}),w.isSyntheticBase&&N.jsx("span",{className:"branch-graph__lane-meta lane-meta--muted",children:"推定のみ"})]}),N.jsxs("span",{className:"branch-graph__lane-count",children:[w.nodes.length," branch",w.nodes.length>1?"es":""]})]}),N.jsxs("div",{className:"branch-graph__track",children:[g1(w),w.nodes.map(T=>N.jsx(p1,{branch:T},T.name))]})]},w.id))})]}):N.jsx("section",{className:"branch-graph-panel",children:N.jsxs("div",{className:"branch-graph-panel__empty",children:[N.jsx("p",{children:"グラフ表示できるブランチがありません。"}),N.jsx("p",{children:"fetch済みのブランチやWorktreeを追加すると関係図が表示されます。"})]})})}function g1(s){const n=s.baseLabel==="ベース不明"?"Unknown base":s.baseLabel,u=N.jsxs("div",{className:`branch-graph__node branch-graph__node--base ${s.baseNode?`branch-graph__node--${s.baseNode.type}`:""}`,children:[N.jsx("span",{className:"branch-graph__node-label",children:n}),N.jsx("span",{className:"branch-graph__node-meta",children:"BASE"}),N.jsxs("div",{className:"branch-graph__tooltip",children:[N.jsx("p",{children:n}),N.jsx("p",{children:s.baseNode?`type: ${s.baseNode.type}`:"推定されたベースブランチ"})]})]});return s.baseNode?N.jsx(ji,{to:`/${encodeURIComponent(s.baseNode.name)}`,className:"branch-graph__node-link","aria-label":`ベースブランチ ${s.baseNode.name} を開く`,children:u},`base-${s.id}`):N.jsx("div",{className:"branch-graph__node-link",children:u},`base-${s.id}`)}function p1({branch:s}){const n=N.jsxs("div",{className:`branch-graph__node branch-graph__node--${s.type} ${s.mergeStatus==="merged"?"branch-graph__node--merged":s.mergeStatus==="unmerged"?"branch-graph__node--active":""}`,children:[N.jsx("span",{className:"branch-graph__node-label",children:_1(s)}),N.jsx("span",{className:"branch-graph__node-meta",children:s.worktreePath?"Worktree":"No Worktree"}),N.jsxs("div",{className:"branch-graph__tooltip",children:[N.jsx("p",{children:s.name}),N.jsxs("p",{children:["base: ",s.baseBranch??"unknown"]}),N.jsx("p",{children:v1(s)}),N.jsx("p",{children:s.worktreePath??"Worktree未作成"})]})]});return N.jsx(ji,{to:`/${encodeURIComponent(s.name)}`,className:"branch-graph__node-link","aria-label":`${s.name} の詳細を開く`,children:n})}const Wn=new Intl.NumberFormat("ja-JP"),Hm={local:"ローカル",remote:"リモート"},y1={merged:"マージ済み",unmerged:"未マージ",unknown:"状態不明"},S1={merged:"success",unmerged:"warning",unknown:"muted"},b1="ブランチ名やタイプで検索...";function C1(){const{data:s,isLoading:n,error:u}=h1(),[g,w]=$.useState(""),T=s??[],M=$.useMemo(()=>{const p=T.filter(S=>!!S.worktreePath).length,m=T.filter(S=>S.type==="remote").length,y=T.filter(S=>{var A;return(A=S.divergence)==null?void 0:A.upToDate}).length;return{total:T.length,worktrees:p,remote:m,healthy:y}},[T]),o=g.trim().toLowerCase(),d=$.useMemo(()=>o?T.filter(p=>[p.name,p.type,p.mergeStatus,p.commitMessage??"",p.worktreePath??""].join(" ").toLowerCase().includes(o)):T,[T,o]),h=$.useMemo(()=>n?{title:"データを読み込み中",description:"最新のブランチ一覧を取得しています..."}:u?{title:"ブランチの取得に失敗しました",description:u instanceof Error?u.message:"未知のエラーが発生しました。"}:T.length?null:{title:"ブランチが見つかりません",description:"git fetch origin などで最新のブランチを取得してください。"},[T.length,u,n]);return N.jsxs("div",{className:"app-shell",children:[N.jsxs("header",{className:"page-hero",children:[N.jsx("p",{className:"page-hero__eyebrow",children:"WORKTREE DASHBOARD"}),N.jsx("h1",{children:"gwt Control Center"}),N.jsx("p",{children:"ローカルのGitブランチとAIツールをブラウザ上で一元管理し、Worktree状態を瞬時に 可視化します。"}),N.jsx("div",{className:"page-hero__meta",children:"リアルタイムで更新されるステータスビュー"})]}),N.jsxs("main",{className:"page-content",children:[!h&&d.length>0&&N.jsx(m1,{branches:d}),N.jsxs("section",{className:"metrics-grid",children:[N.jsxs("article",{className:"metric-card",children:[N.jsx("p",{className:"metric-card__label",children:"総ブランチ数"}),N.jsx("p",{className:"metric-card__value","data-testid":"metric-total",children:Wn.format(M.total)}),N.jsx("p",{className:"metric-card__hint",children:"ローカル + リモート"})]}),N.jsxs("article",{className:"metric-card",children:[N.jsx("p",{className:"metric-card__label",children:"作成済みWorktree"}),N.jsx("p",{className:"metric-card__value","data-testid":"metric-worktrees",children:Wn.format(M.worktrees)}),N.jsx("p",{className:"metric-card__hint",children:"即座にAIツールを起動可能"})]}),N.jsxs("article",{className:"metric-card",children:[N.jsx("p",{className:"metric-card__label",children:"リモート追跡ブランチ"}),N.jsx("p",{className:"metric-card__value",children:Wn.format(M.remote)}),N.jsx("p",{className:"metric-card__hint",children:"origin との同期ステータス"})]}),N.jsxs("article",{className:"metric-card",children:[N.jsx("p",{className:"metric-card__label",children:"最新コミットが最新"}),N.jsx("p",{className:"metric-card__value",children:Wn.format(M.healthy)}),N.jsx("p",{className:"metric-card__hint",children:"divergence 0 のブランチ"})]})]}),N.jsxs("section",{className:"toolbar",children:[N.jsxs("label",{className:"toolbar__field",children:[N.jsx("span",{className:"toolbar__icon","aria-hidden":"true",children:"🔍"}),N.jsx("input",{type:"search",className:"search-input",placeholder:b1,value:g,onChange:p=>w(p.target.value)})]}),N.jsxs("span",{className:"toolbar__count",children:[Wn.format(d.length)," /"," ",Wn.format(M.total)," branches"]})]}),h?N.jsxs("div",{className:"page-state page-state--card",children:[N.jsx("h2",{children:h.title}),N.jsx("p",{children:h.description})]}):d.length===0?N.jsxs("div",{className:"empty-state",children:[N.jsx("h3",{children:"一致するブランチがありません"}),N.jsx("p",{children:"検索条件を見直すか、タグ・ブランチタイプ・コミットメッセージなど別のキーワードを 試してください。"})]}):N.jsx("div",{className:"branch-grid",children:d.map(p=>N.jsxs("article",{className:"branch-card",children:[N.jsxs("div",{className:"branch-card__header",children:[N.jsxs("div",{children:[N.jsxs("p",{className:"branch-card__eyebrow",children:[Hm[p.type],"ブランチ"]}),N.jsx("h2",{children:p.name})]}),N.jsxs("div",{className:"badge-group",children:[N.jsx("span",{className:`status-badge status-badge--${p.type}`,children:Hm[p.type]}),N.jsx("span",{className:`status-badge status-badge--${S1[p.mergeStatus]}`,children:y1[p.mergeStatus]}),N.jsx("span",{className:`status-badge ${p.worktreePath?"status-badge--success":"status-badge--muted"}`,children:p.worktreePath?"Worktreeあり":"Worktree未作成"})]})]}),N.jsx("p",{className:"branch-card__commit",children:p.commitMessage??"コミットメッセージがありません"}),N.jsxs("dl",{className:"metadata-grid metadata-grid--compact",children:[N.jsxs("div",{children:[N.jsx("dt",{children:"最新コミット"}),N.jsx("dd",{children:p.commitHash.slice(0,7)})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"Author"}),N.jsx("dd",{children:p.author??"N/A"})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"Worktree"}),N.jsx("dd",{children:p.worktreePath??"未作成"})]})]}),p.divergence&&N.jsxs("div",{className:"pill-group",children:[N.jsxs("span",{className:"pill",children:["Ahead ",p.divergence.ahead]}),N.jsxs("span",{className:"pill",children:["Behind ",p.divergence.behind]}),N.jsx("span",{className:`pill ${p.divergence.upToDate?"pill--success":"pill--warning"}`,children:p.divergence.upToDate?"最新":"更新あり"})]}),N.jsxs("div",{className:"branch-card__actions",children:[N.jsx(ji,{className:"button button--ghost",to:`/${encodeURIComponent(p.name)}`,children:"詳細を見る"}),N.jsx("span",{className:`info-pill ${p.worktreePath?"info-pill--success":"info-pill--warning"}`,children:p.worktreePath??"Worktree未作成"})]})]},p.name))})]})]})}function E1(){const s=nn();return dl({mutationFn:n=>u1.create(n),onSuccess:()=>{s.invalidateQueries({queryKey:["worktrees"]}),s.invalidateQueries({queryKey:["branches"]})}})}function w1(){return Go({queryKey:["sessions"],queryFn:rf.list})}function x1(){const s=nn();return dl({mutationFn:n=>rf.start(n),onSuccess:()=>{s.invalidateQueries({queryKey:["sessions"]})}})}function R1(){const s=nn();return dl({mutationFn:n=>rf.delete(n),onSuccess:()=>{s.invalidateQueries({queryKey:["sessions"]})}})}function Fg(){return Go({queryKey:["config"],queryFn:Pg.get})}function D1(){const s=nn();return dl({mutationFn:Pg.update,onSuccess:n=>{s.setQueryData(["config"],n)}})}var mh={exports:{}},Nm;function A1(){return Nm||(Nm=1,(function(s,n){(function(u,g){s.exports=g()})(globalThis,(()=>(()=>{var u={4567:function(M,o,d){var h=this&&this.__decorate||function(f,c,_,E){var R,L=arguments.length,x=L<3?c:E===null?E=Object.getOwnPropertyDescriptor(c,_):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,c,_,E);else for(var C=f.length-1;C>=0;C--)(R=f[C])&&(x=(L<3?R(x):L>3?R(c,_,x):R(c,_))||x);return L>3&&x&&Object.defineProperty(c,_,x),x},p=this&&this.__param||function(f,c){return function(_,E){c(_,E,f)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const m=d(9042),y=d(9924),S=d(844),A=d(4725),b=d(2585);let l=o.AccessibilityManager=class extends S.Disposable{constructor(f,c,_,E){super(),this._terminal=f,this._coreBrowserService=_,this._renderService=E,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let R=0;R<this._terminal.rows;R++)this._rowElements[R]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[R]);if(this._topBoundaryFocusListener=R=>this._handleBoundaryFocus(R,0),this._bottomBoundaryFocusListener=R=>this._handleBoundaryFocus(R,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new y.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((R=>this._handleResize(R.rows)))),this.register(this._terminal.onRender((R=>this._refreshRows(R.start,R.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((R=>this._handleChar(R)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
62
62
|
`)))),this.register(this._terminal.onA11yTab((R=>this._handleTab(R)))),this.register(this._terminal.onKey((R=>this._handleKey(R.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,S.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(f){for(let c=0;c<f;c++)this._handleChar(" ")}_handleChar(f){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==f&&(this._charsToAnnounce+=f):this._charsToAnnounce+=f,f===`
|
|
63
63
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(f){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(f)||this._charsToConsume.push(f)}_refreshRows(f,c){this._liveRegionDebouncer.refresh(f,c,this._terminal.rows)}_renderRows(f,c){const _=this._terminal.buffer,E=_.lines.length.toString();for(let R=f;R<=c;R++){const L=_.translateBufferLineToString(_.ydisp+R,!0),x=(_.ydisp+R+1).toString(),C=this._rowElements[R];C&&(L.length===0?C.innerText=" ":C.textContent=L,C.setAttribute("aria-posinset",x),C.setAttribute("aria-setsize",E))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(f,c){const _=f.target,E=this._rowElements[c===0?1:this._rowElements.length-2];if(_.getAttribute("aria-posinset")===(c===0?"1":`${this._terminal.buffer.lines.length}`)||f.relatedTarget!==E)return;let R,L;if(c===0?(R=_,L=this._rowElements.pop(),this._rowContainer.removeChild(L)):(R=this._rowElements.shift(),L=_,this._rowContainer.removeChild(R)),R.removeEventListener("focus",this._topBoundaryFocusListener),L.removeEventListener("focus",this._bottomBoundaryFocusListener),c===0){const x=this._createAccessibilityTreeNode();this._rowElements.unshift(x),this._rowContainer.insertAdjacentElement("afterbegin",x)}else{const x=this._createAccessibilityTreeNode();this._rowElements.push(x),this._rowContainer.appendChild(x)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(c===0?-1:1),this._rowElements[c===0?1:this._rowElements.length-2].focus(),f.preventDefault(),f.stopImmediatePropagation()}_handleResize(f){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let c=this._rowContainer.children.length;c<this._terminal.rows;c++)this._rowElements[c]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[c]);for(;this._rowElements.length>f;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const f=this._coreBrowserService.mainDocument.createElement("div");return f.setAttribute("role","listitem"),f.tabIndex=-1,this._refreshRowDimensions(f),f}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let f=0;f<this._terminal.rows;f++)this._refreshRowDimensions(this._rowElements[f])}}_refreshRowDimensions(f){f.style.height=`${this._renderService.dimensions.css.cell.height}px`}};o.AccessibilityManager=l=h([p(1,b.IInstantiationService),p(2,A.ICoreBrowserService),p(3,A.IRenderService)],l)},3614:(M,o)=>{function d(y){return y.replace(/\r?\n/g,"\r")}function h(y,S){return S?"\x1B[200~"+y+"\x1B[201~":y}function p(y,S,A,b){y=h(y=d(y),A.decPrivateModes.bracketedPasteMode&&b.rawOptions.ignoreBracketedPasteMode!==!0),A.triggerDataEvent(y,!0),S.value=""}function m(y,S,A){const b=A.getBoundingClientRect(),l=y.clientX-b.left-10,f=y.clientY-b.top-10;S.style.width="20px",S.style.height="20px",S.style.left=`${l}px`,S.style.top=`${f}px`,S.style.zIndex="1000",S.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=d,o.bracketTextForPaste=h,o.copyHandler=function(y,S){y.clipboardData&&y.clipboardData.setData("text/plain",S.selectionText),y.preventDefault()},o.handlePasteEvent=function(y,S,A,b){y.stopPropagation(),y.clipboardData&&p(y.clipboardData.getData("text/plain"),S,A,b)},o.paste=p,o.moveTextAreaUnderMouseCursor=m,o.rightClickHandler=function(y,S,A,b,l){m(y,S,A),l&&b.rightClickSelect(y),S.value=b.selectionText,S.select()}},7239:(M,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const h=d(1505);o.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(p,m,y){this._css.set(p,m,y)}getCss(p,m){return this._css.get(p,m)}setColor(p,m,y){this._color.set(p,m,y)}getColor(p,m){return this._color.get(p,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(M,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(d,h,p,m){d.addEventListener(h,p,m);let y=!1;return{dispose:()=>{y||(y=!0,d.removeEventListener(h,p,m))}}}},6465:function(M,o,d){var h=this&&this.__decorate||function(l,f,c,_){var E,R=arguments.length,L=R<3?f:_===null?_=Object.getOwnPropertyDescriptor(f,c):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(l,f,c,_);else for(var x=l.length-1;x>=0;x--)(E=l[x])&&(L=(R<3?E(L):R>3?E(f,c,L):E(f,c))||L);return R>3&&L&&Object.defineProperty(f,c,L),L},p=this&&this.__param||function(l,f){return function(c,_){f(c,_,l)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier2=void 0;const m=d(3656),y=d(8460),S=d(844),A=d(2585);let b=o.Linkifier2=class extends S.Disposable{get currentLink(){return this._currentLink}constructor(l){super(),this._bufferService=l,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new y.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new y.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,S.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,S.toDisposable)((()=>{this._lastMouseEvent=void 0}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}registerLinkProvider(l){return this._linkProviders.push(l),{dispose:()=>{const f=this._linkProviders.indexOf(l);f!==-1&&this._linkProviders.splice(f,1)}}}attachToDom(l,f,c){this._element=l,this._mouseService=f,this._renderService=c,this.register((0,m.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,m.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(l){if(this._lastMouseEvent=l,!this._element||!this._mouseService)return;const f=this._positionFromMouseEvent(l,this._element,this._mouseService);if(!f)return;this._isMouseOut=!1;const c=l.composedPath();for(let _=0;_<c.length;_++){const E=c[_];if(E.classList.contains("xterm"))break;if(E.classList.contains("xterm-hover"))return}this._lastBufferCell&&f.x===this._lastBufferCell.x&&f.y===this._lastBufferCell.y||(this._handleHover(f),this._lastBufferCell=f)}_handleHover(l){if(this._activeLine!==l.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(l,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,l)||(this._clearCurrentLink(),this._askForLink(l,!0))}_askForLink(l,f){var _,E;this._activeProviderReplies&&f||((_=this._activeProviderReplies)==null||_.forEach((R=>{R==null||R.forEach((L=>{L.link.dispose&&L.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=l.y);let c=!1;for(const[R,L]of this._linkProviders.entries())f?(E=this._activeProviderReplies)!=null&&E.get(R)&&(c=this._checkLinkProviderResult(R,l,c)):L.provideLinks(l.y,(x=>{var B,z;if(this._isMouseOut)return;const C=x==null?void 0:x.map((I=>({link:I})));(B=this._activeProviderReplies)==null||B.set(R,C),c=this._checkLinkProviderResult(R,l,c),((z=this._activeProviderReplies)==null?void 0:z.size)===this._linkProviders.length&&this._removeIntersectingLinks(l.y,this._activeProviderReplies)}))}_removeIntersectingLinks(l,f){const c=new Set;for(let _=0;_<f.size;_++){const E=f.get(_);if(E)for(let R=0;R<E.length;R++){const L=E[R],x=L.link.range.start.y<l?0:L.link.range.start.x,C=L.link.range.end.y>l?this._bufferService.cols:L.link.range.end.x;for(let B=x;B<=C;B++){if(c.has(B)){E.splice(R--,1);break}c.add(B)}}}}_checkLinkProviderResult(l,f,c){var R;if(!this._activeProviderReplies)return c;const _=this._activeProviderReplies.get(l);let E=!1;for(let L=0;L<l;L++)this._activeProviderReplies.has(L)&&!this._activeProviderReplies.get(L)||(E=!0);if(!E&&_){const L=_.find((x=>this._linkAtPosition(x.link,f)));L&&(c=!0,this._handleNewLink(L))}if(this._activeProviderReplies.size===this._linkProviders.length&&!c)for(let L=0;L<this._activeProviderReplies.size;L++){const x=(R=this._activeProviderReplies.get(L))==null?void 0:R.find((C=>this._linkAtPosition(C.link,f)));if(x){c=!0,this._handleNewLink(x);break}}return c}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(l){if(!this._element||!this._mouseService||!this._currentLink)return;const f=this._positionFromMouseEvent(l,this._element,this._mouseService);f&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,f)&&this._currentLink.link.activate(l,this._currentLink.link.text)}_clearCurrentLink(l,f){this._element&&this._currentLink&&this._lastMouseEvent&&(!l||!f||this._currentLink.link.range.start.y>=l&&this._currentLink.link.range.end.y<=f)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,S.disposeArray)(this._linkCacheDisposables))}_handleNewLink(l){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const f=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);f&&this._linkAtPosition(l.link,f)&&(this._currentLink=l,this._currentLink.state={decorations:{underline:l.link.decorations===void 0||l.link.decorations.underline,pointerCursor:l.link.decorations===void 0||l.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,l.link,this._lastMouseEvent),l.link.decorations={},Object.defineProperties(l.link.decorations,{pointerCursor:{get:()=>{var c,_;return(_=(c=this._currentLink)==null?void 0:c.state)==null?void 0:_.decorations.pointerCursor},set:c=>{var _,E;(_=this._currentLink)!=null&&_.state&&this._currentLink.state.decorations.pointerCursor!==c&&(this._currentLink.state.decorations.pointerCursor=c,this._currentLink.state.isHovered&&((E=this._element)==null||E.classList.toggle("xterm-cursor-pointer",c)))}},underline:{get:()=>{var c,_;return(_=(c=this._currentLink)==null?void 0:c.state)==null?void 0:_.decorations.underline},set:c=>{var _,E,R;(_=this._currentLink)!=null&&_.state&&((R=(E=this._currentLink)==null?void 0:E.state)==null?void 0:R.decorations.underline)!==c&&(this._currentLink.state.decorations.underline=c,this._currentLink.state.isHovered&&this._fireUnderlineEvent(l.link,c))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((c=>{if(!this._currentLink)return;const _=c.start===0?0:c.start+1+this._bufferService.buffer.ydisp,E=this._bufferService.buffer.ydisp+1+c.end;if(this._currentLink.link.range.start.y>=_&&this._currentLink.link.range.end.y<=E&&(this._clearCurrentLink(_,E),this._lastMouseEvent&&this._element)){const R=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);R&&this._askForLink(R,!1)}}))))}_linkHover(l,f,c){var _;(_=this._currentLink)!=null&&_.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(f,!0),this._currentLink.state.decorations.pointerCursor&&l.classList.add("xterm-cursor-pointer")),f.hover&&f.hover(c,f.text)}_fireUnderlineEvent(l,f){const c=l.range,_=this._bufferService.buffer.ydisp,E=this._createLinkUnderlineEvent(c.start.x-1,c.start.y-_-1,c.end.x,c.end.y-_-1,void 0);(f?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(E)}_linkLeave(l,f,c){var _;(_=this._currentLink)!=null&&_.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(f,!1),this._currentLink.state.decorations.pointerCursor&&l.classList.remove("xterm-cursor-pointer")),f.leave&&f.leave(c,f.text)}_linkAtPosition(l,f){const c=l.range.start.y*this._bufferService.cols+l.range.start.x,_=l.range.end.y*this._bufferService.cols+l.range.end.x,E=f.y*this._bufferService.cols+f.x;return c<=E&&E<=_}_positionFromMouseEvent(l,f,c){const _=c.getCoords(l,f,this._bufferService.cols,this._bufferService.rows);if(_)return{x:_[0],y:_[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(l,f,c,_,E){return{x1:l,y1:f,x2:c,y2:_,cols:this._bufferService.cols,fg:E}}};o.Linkifier2=b=h([p(0,A.IBufferService)],b)},9042:(M,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(M,o,d){var h=this&&this.__decorate||function(b,l,f,c){var _,E=arguments.length,R=E<3?l:c===null?c=Object.getOwnPropertyDescriptor(l,f):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(b,l,f,c);else for(var L=b.length-1;L>=0;L--)(_=b[L])&&(R=(E<3?_(R):E>3?_(l,f,R):_(l,f))||R);return E>3&&R&&Object.defineProperty(l,f,R),R},p=this&&this.__param||function(b,l){return function(f,c){l(f,c,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const m=d(511),y=d(2585);let S=o.OscLinkProvider=class{constructor(b,l,f){this._bufferService=b,this._optionsService=l,this._oscLinkService=f}provideLinks(b,l){var B;const f=this._bufferService.buffer.lines.get(b-1);if(!f)return void l(void 0);const c=[],_=this._optionsService.rawOptions.linkHandler,E=new m.CellData,R=f.getTrimmedLength();let L=-1,x=-1,C=!1;for(let z=0;z<R;z++)if(x!==-1||f.hasContent(z)){if(f.loadCell(z,E),E.hasExtendedAttrs()&&E.extended.urlId){if(x===-1){x=z,L=E.extended.urlId;continue}C=E.extended.urlId!==L}else x!==-1&&(C=!0);if(C||x!==-1&&z===R-1){const I=(B=this._oscLinkService.getLinkData(L))==null?void 0:B.uri;if(I){const F={start:{x:x+1,y:b},end:{x:z+(C||z!==R-1?0:1),y:b}};let Q=!1;if(!(_!=null&&_.allowNonHttpProtocols))try{const oe=new URL(I);["http:","https:"].includes(oe.protocol)||(Q=!0)}catch{Q=!0}Q||c.push({text:I,range:F,activate:(oe,ae)=>_?_.activate(oe,ae,F):A(0,ae),hover:(oe,ae)=>{var q;return(q=_==null?void 0:_.hover)==null?void 0:q.call(_,oe,ae,F)},leave:(oe,ae)=>{var q;return(q=_==null?void 0:_.leave)==null?void 0:q.call(_,oe,ae,F)}})}C=!1,E.hasExtendedAttrs()&&E.extended.urlId?(x=z,L=E.extended.urlId):(x=-1,L=-1)}}l(c)}};function A(b,l){if(confirm(`Do you want to navigate to ${l}?
|
|
64
64
|
|
|
@@ -77,5 +77,5 @@ WARNING: This link could potentially be dangerous`)){const f=window.open();if(f)
|
|
|
77
77
|
[Connection closed]\r
|
|
78
78
|
`)}});h.connect(),M.current=h,o.onData(y=>{h.sendInput(y)});const p=()=>{d.fit(),h.isConnected()&&h.sendResize(o.cols,o.rows)};window.addEventListener("resize",p);let m=null;return typeof ResizeObserver<"u"&&(m=new ResizeObserver(()=>{p()}),m.observe(g.current)),()=>{window.removeEventListener("resize",p),m==null||m.disconnect(),h.disconnect(),o.dispose()}},[s,n,u]),N.jsx("div",{ref:g,style:{width:"100%",height:"100%",padding:"8px",backgroundColor:"#1e1e1e"}})}const k1={"claude-code":{command:"claude",defaultArgs:[],modeArgs:{normal:[],continue:["-c"],resume:["-r"]},permissionSkipArgs:["--dangerously-skip-permissions"]},"codex-cli":{command:"codex",defaultArgs:["--auto-approve","--verbose"],modeArgs:{normal:[],continue:["resume","--last"],resume:["resume"]}}},H1={local:"ローカル",remote:"リモート"},N1={merged:"マージ済み",unmerged:"未マージ",unknown:"状態不明"},j1={merged:"success",unmerged:"warning",unknown:"muted"};function z1(){var Ne;const{branchName:s}=ob(),n=s?decodeURIComponent(s):"",{data:u,isLoading:g,error:w}=f1(n),T=d1(n),M=E1(),o=x1(),{data:d,isLoading:h}=w1(),p=R1(),{data:m,isLoading:y,error:S}=Fg(),[A,b]=$.useState(null),[l,f]=$.useState(!1),[c,_]=$.useState(null),[E,R]=$.useState(!1),[L,x]=$.useState("claude-code"),[C,B]=$.useState("normal"),[z,I]=$.useState(!1),[F,Q]=$.useState(""),[oe,ae]=$.useState(null),q=$.useMemo(()=>ph(u==null?void 0:u.commitDate),[u==null?void 0:u.commitDate]);if($.useEffect(()=>{if(!E)return;const ge=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=ge}},[E]),g)return N.jsx("div",{className:"app-shell",children:N.jsxs("div",{className:"page-state page-state--centered",children:[N.jsx("h1",{children:"読み込み中"}),N.jsx("p",{children:"ブランチ情報を取得しています..."})]})});if(w)return N.jsx("div",{className:"app-shell",children:N.jsxs("div",{className:"page-state page-state--centered",children:[N.jsx("h1",{children:"ブランチの取得に失敗しました"}),N.jsx("p",{children:w instanceof Error?w.message:"未知のエラーです"}),N.jsx(ji,{to:"/",className:"button button--ghost",children:"ブランチ一覧に戻る"})]})});if(!u)return N.jsx("div",{className:"app-shell",children:N.jsxs("div",{className:"page-state page-state--centered",children:[N.jsx("h1",{children:"Branch not found"}),N.jsx("p",{children:"指定されたブランチは存在しません。"}),N.jsx(ji,{to:"/",className:"button button--ghost",children:"ブランチ一覧に戻る"})]})});const Z=!!u.worktreePath,he=u.divergence??null,k=!!(he&&he.ahead>0&&he.behind>0),U=!!(u.worktreePath&&he&&he.behind>0&&he.ahead===0&&!k),O=T.isPending,j=(m==null?void 0:m.tools)??[],X=$.useMemo(()=>[{id:"claude-code",label:"Claude Code",target:"claude"},{id:"codex-cli",label:"Codex CLI",target:"codex"},...j.map(ge=>({id:ge.id,label:ge.displayName,target:"custom",definition:ge}))],[j]);$.useEffect(()=>{if(!X.length){x("claude-code");return}if(!X.find(ge=>ge.id===L)){const ge=X[0];ge&&x(ge.id)}},[X,L]);const te=X.find(ge=>ge.id===L),ve=$.useMemo(()=>te?te.target==="custom"?{command:te.definition.command,defaultArgs:te.definition.defaultArgs??null,modeArgs:te.definition.modeArgs,permissionSkipArgs:te.definition.permissionSkipArgs??null}:k1[te.id]??null:null,[te]),W=$.useMemo(()=>{var Be,Jt,Si;if(!ve)return null;const ge=[];(Be=ve.defaultArgs)!=null&&Be.length&&ge.push(...ve.defaultArgs);const je=(Jt=ve.modeArgs)==null?void 0:Jt[C];je!=null&&je.length&&ge.push(...je),z&&((Si=ve.permissionSkipArgs)!=null&&Si.length)&&ge.push(...ve.permissionSkipArgs);const _t=Pm(F);return _t.length&&ge.push(..._t),{command:ve.command,args:ge}},[ve,C,z,F]),ie=async()=>{try{await M.mutateAsync({branchName:u.name,createBranch:!1}),_({type:"success",message:`${u.name} のWorktreeを作成しました。`})}catch(ge){_({type:"error",message:Ho(ge,"Worktreeの作成に失敗しました")})}},P=async()=>{if(!u.worktreePath){_({type:"error",message:"Worktreeが存在しないため、先に作成してください。"});return}if(!te){_({type:"error",message:"起動するAIツールを選択してください"});return}if(U){_({type:"error",message:"リモートの更新を取り込むまでAIツールは起動できません。『最新の変更を同期』を実行してください。"});return}if(k){_({type:"error",message:"リモートとローカルの双方で進捗が発生しているため、CLIと同様にAIツールの起動をブロックしました。先に rebase/merge 等で差分を解消してください。"});return}if(!(z&&!window.confirm("権限チェックをスキップして起動します。自己責任で実行してください。続行しますか?"))){f(!0);try{const ge=te.target==="codex"?"codex-cli":te.target==="custom"?"custom":"claude-code",je=Pm(F),_t={toolType:ge,toolName:te.target==="custom"?te.id:null,...te.target==="custom"?{customToolId:te.id}:{},mode:C,worktreePath:u.worktreePath,skipPermissions:z,...te.target==="codex"?{bypassApprovals:z}:{},...je.length?{extraArgs:je}:{}},Be=await o.mutateAsync(_t);b(Be.sessionId),R(!1),_({type:"info",message:`${zm(ge,te)} を起動しました。`})}catch(ge){_({type:"error",message:Ho(ge,"セッションの起動に失敗しました")})}finally{f(!1)}}},le=async ge=>{ae(ge);try{await p.mutateAsync(ge),_({type:"success",message:"セッションを終了しました"}),A===ge&&b(null)}catch(je){_({type:"error",message:Ho(je,"セッションの終了に失敗しました")})}finally{ae(null)}},Se=async()=>{var ge;if(!u.worktreePath){_({type:"error",message:"Worktreeが存在しないため同期できません。"});return}try{const je=await T.mutateAsync({worktreePath:u.worktreePath});if(je.pullStatus==="success")_({type:"success",message:"リモートの最新変更を取り込みました。"});else{const _t=((ge=je.warnings)==null?void 0:ge.join(`
|
|
79
79
|
`))??"fast-forward pull が完了しませんでした";_({type:"error",message:`git pull --ff-only が失敗しました。
|
|
80
|
-
${_t}`})}}catch(je){_({type:"error",message:Ho(je,"Git同期に失敗しました")})}},ce=$.useMemo(()=>(d??[]).filter(ge=>ge.worktreePath===(u==null?void 0:u.worktreePath)).sort((ge,je)=>(je.startedAt??"").localeCompare(ge.startedAt??"")),[d,u==null?void 0:u.worktreePath]),Xe=ge=>{b(null),R(!1),_({type:ge===0?"success":"error",message:`セッションがコード ${ge} で終了しました。`})};return N.jsxs("div",{className:"app-shell",children:[N.jsxs("header",{className:"page-hero page-hero--compact",children:[N.jsx(ji,{to:"/",className:"link-back",children:"← ブランチ一覧に戻る"}),N.jsx("p",{className:"page-hero__eyebrow",children:"BRANCH DETAIL"}),N.jsx("h1",{children:u.name}),N.jsxs("p",{className:"page-hero__subtitle",children:["最新コミット ",u.commitHash.slice(0,7)," ・ ",q]}),N.jsxs("div",{className:"badge-group",children:[N.jsx("span",{className:`status-badge status-badge--${u.type}`,children:H1[u.type]}),N.jsx("span",{className:`status-badge status-badge--${j1[u.mergeStatus]}`,children:N1[u.mergeStatus]}),N.jsx("span",{className:`status-badge ${u.worktreePath?"status-badge--success":"status-badge--muted"}`,children:u.worktreePath?"Worktreeあり":"Worktree未作成"})]}),N.jsx("div",{className:"page-hero__actions",children:Z?N.jsx(ji,{to:"/config",className:"button button--secondary",children:"カスタムツール設定を開く"}):N.jsx("button",{type:"button",className:"button button--primary",onClick:ie,disabled:M.isPending,children:M.isPending?"作成中...":"Worktreeを作成"})}),c&&N.jsx("div",{className:`inline-banner inline-banner--${c.type}`,children:c.message})]}),E&&N.jsx("div",{className:"terminal-overlay-backdrop","aria-hidden":"true",onClick:()=>R(!1)}),N.jsx("main",{className:"page-content page-content--wide",children:N.jsxs("div",{className:"page-layout page-layout--split",children:[N.jsxs("div",{className:"info-stack",children:[N.jsxs("section",{className:"section-card",children:[N.jsxs("header",{className:"terminal-section__header",children:[N.jsxs("div",{children:[N.jsx("h2",{children:"AIツール起動"}),N.jsx("p",{className:"section-card__body",children:"Web UI から直接AIツールを起動できます。設定したカスタムツールも一覧に表示されます。"})]}),S&&N.jsx("span",{className:"pill pill--warning",children:"設定の取得に失敗しました"})]}),Z?N.jsxs("div",{className:"tool-form",children:[N.jsxs("div",{className:"form-grid",children:[N.jsxs("label",{className:"form-field",children:[N.jsx("span",{children:"AIツール"}),N.jsx("select",{value:L,onChange:ge=>x(ge.target.value),disabled:y,children:X.map(ge=>N.jsx("option",{value:ge.id,children:ge.label},ge.id))})]}),N.jsxs("label",{className:"form-field",children:[N.jsx("span",{children:"起動モード"}),N.jsxs("select",{value:C,onChange:ge=>B(ge.target.value),children:[N.jsx("option",{value:"normal",children:"normal"}),N.jsx("option",{value:"continue",children:"continue"}),N.jsx("option",{value:"resume",children:"resume"})]})]}),N.jsxs("label",{className:"form-field",children:[N.jsx("span",{children:"追加引数 (スペース区切り)"}),N.jsx("input",{type:"text",value:F,onChange:ge=>Q(ge.target.value),placeholder:"--flag value"})]})]}),N.jsx("label",{className:"form-field",children:N.jsxs("span",{children:[N.jsx("input",{type:"checkbox",checked:z,onChange:ge=>I(ge.target.checked)}),N.jsx("span",{style:{marginLeft:"0.5rem"},children:"権限チェックをスキップ (自己責任)"})]})}),z&&N.jsx("div",{className:"inline-banner inline-banner--warning",children:N.jsx("p",{children:"権限チェックをスキップすることで、CLI での `--dangerously-skip-permissions` 指定と同様のリスクを負います。"})}),U&&N.jsxs("div",{className:"inline-banner inline-banner--info","data-testid":"sync-required",children:[N.jsxs("p",{children:["リモートに未取得の更新 (",((Ne=u.divergence)==null?void 0:Ne.behind)??0," commits) があるため、AIツールを起動する前に同期してください。"]}),N.jsx("p",{className:"section-card__body",children:"CLI の `git fetch --all` と `git pull --ff-only` と同じ処理を Web UI から実行できます。"})]}),k&&N.jsxs("div",{className:"inline-banner inline-banner--warning","data-testid":"divergence-warning",children:[N.jsx("p",{children:"リモートとローカルの両方に未解決の差分があるため、Web UI でも CLI と同様に起動をブロックしています。"}),N.jsxs("ul",{className:"list-muted",children:[N.jsxs("li",{children:["git fetch && git pull --ff-only origin ",u.name]}),N.jsxs("li",{children:["必要に応じて git push origin ",u.name," でローカル進捗を共有"]})]}),N.jsx("p",{className:"section-card__body",children:"rebase / merge などで差分を解消した後にページを更新してください。"})]}),N.jsxs("div",{className:"tool-card__actions",children:[N.jsx("button",{type:"button",className:"button button--primary",onClick:P,disabled:l||!te||k||U||O,children:l?"起動中...":"セッションを起動"}),N.jsx("button",{type:"button",className:"button button--secondary",onClick:Se,disabled:!u.worktreePath||O,children:O?"同期中...":"最新の変更を同期"}),N.jsx(ji,{to:"/config",className:"button button--ghost",children:"設定を編集"})]}),ve&&N.jsxs("dl",{className:"metadata-grid metadata-grid--compact",children:[N.jsxs("div",{children:[N.jsx("dt",{children:"コマンド"}),N.jsx("dd",{className:"tool-card__command",children:ve.command})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"defaultArgs"}),N.jsx("dd",{children:Um(ve.defaultArgs)})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"permissionSkipArgs"}),N.jsx("dd",{children:Um(ve.permissionSkipArgs)})]}),W&&N.jsxs("div",{className:"metadata-grid__full",children:[N.jsx("dt",{children:"最終的に実行されるコマンド"}),N.jsxs("dd",{className:"tool-card__command",children:[W.command," ",W.args.join(" ")]})]})]})]}):N.jsx("p",{className:"section-card__body",children:"Worktreeが未作成のため、先にWorktreeを作成してください。"})]}),N.jsxs("section",{className:"section-card",children:[N.jsxs("header",{className:"terminal-section__header",children:[N.jsxs("div",{children:[N.jsx("h2",{children:"セッション履歴"}),N.jsx("p",{className:"section-card__body",children:"この Worktree に紐づいた最新の AI セッションが表示されます。CLI からの起動分も共有されます。"})]}),h&&N.jsx("span",{className:"pill",children:"読み込み中..."})]}),ce.length===0?N.jsx("p",{className:"section-card__body",children:"セッション履歴はまだありません。"}):N.jsx("div",{className:"session-table-wrapper",children:N.jsxs("table",{className:"session-table",children:[N.jsx("thead",{children:N.jsxs("tr",{children:[N.jsx("th",{children:"状態"}),N.jsx("th",{children:"ツール"}),N.jsx("th",{children:"モード"}),N.jsx("th",{children:"開始時刻"}),N.jsx("th",{children:"終了時刻"}),N.jsx("th",{children:"操作"})]})}),N.jsx("tbody",{children:ce.slice(0,5).map(ge=>N.jsxs("tr",{children:[N.jsx("td",{children:N.jsx("span",{className:`status-pill status-pill--${ge.status}`,children:U1[ge.status]})}),N.jsx("td",{children:ge.toolType==="custom"?ge.toolName??"custom":zm(ge.toolType)}),N.jsx("td",{children:ge.mode}),N.jsx("td",{children:ph(ge.startedAt)}),N.jsx("td",{children:ge.endedAt?ph(ge.endedAt):"--"}),N.jsx("td",{children:ge.status==="running"?N.jsx("button",{type:"button",className:"button button--ghost",onClick:()=>le(ge.sessionId),disabled:oe===ge.sessionId||p.isPending,children:oe===ge.sessionId?"終了中...":"終了"}):N.jsx("span",{className:"session-table__muted",children:"--"})})]},ge.sessionId))})]})})]}),N.jsxs("section",{className:"section-card",children:[N.jsx("header",{children:N.jsx("h2",{children:"ブランチインサイト"})}),N.jsxs("dl",{className:"metadata-grid",children:[N.jsxs("div",{children:[N.jsx("dt",{children:"コミット"}),N.jsx("dd",{children:u.commitHash})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"Author"}),N.jsx("dd",{children:u.author??"N/A"})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"更新日"}),N.jsx("dd",{children:q})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"Worktree"}),N.jsx("dd",{children:u.worktreePath??"未作成"})]})]})]}),N.jsxs("section",{className:"section-card",children:[N.jsx("header",{children:N.jsx("h2",{children:"コミット情報"})}),N.jsx("p",{className:"section-card__body",children:u.commitMessage??"コミットメッセージがありません。"})]}),u.divergence&&N.jsxs("section",{className:"section-card",children:[N.jsx("header",{children:N.jsx("h2",{children:"差分状況"})}),N.jsxs("div",{className:"pill-group",children:[N.jsxs("span",{className:"pill",children:["Ahead ",u.divergence.ahead]}),N.jsxs("span",{className:"pill",children:["Behind ",u.divergence.behind]}),N.jsx("span",{className:`pill ${u.divergence.upToDate?"pill--success":"pill--warning"}`,children:u.divergence.upToDate?"最新":"更新あり"})]})]}),N.jsxs("section",{className:"section-card",children:[N.jsx("header",{children:N.jsx("h2",{children:"Worktree情報"})}),N.jsxs("ul",{className:"list-muted",children:[N.jsxs("li",{children:["パス: ",N.jsx("strong",{children:u.worktreePath??"未作成"})]}),N.jsx("li",{children:"AIツールの起動にはクリーンなワークツリーであることを推奨します。"}),N.jsx("li",{children:"Worktreeを再作成すると既存のローカル変更が失われる可能性があります。"})]})]})]}),N.jsx("div",{className:"terminal-column",children:A?N.jsxs("section",{className:`section-card terminal-section ${E?"terminal-section--fullscreen":""}`,"data-testid":"active-terminal",children:[N.jsxs("div",{className:"terminal-section__header",children:[N.jsxs("div",{children:[N.jsx("h2",{children:"ターミナルセッション"}),N.jsx("p",{className:"section-card__body",children:"出力はリアルタイムにストリームされます。終了するとこのパネルは自動で閉じます。"})]}),N.jsx("div",{className:"terminal-section__controls",children:N.jsx("button",{type:"button",className:"button button--ghost",onClick:()=>R(ge=>!ge),children:E?"通常表示に戻す":"ターミナルを最大化"})})]}),N.jsx("div",{className:"terminal-surface",children:N.jsx(B1,{sessionId:A,onExit:Xe,onError:ge=>_({type:"error",message:ge??"不明なエラー"})})}),E&&N.jsx("button",{type:"button",className:"terminal-section__close","aria-label":"ターミナルを閉じる",onClick:()=>R(!1),children:"×"})]}):N.jsxs("section",{className:"section-card session-hint",children:[N.jsx("header",{children:N.jsx("h2",{children:"セッションは未起動"})}),N.jsx("p",{className:"section-card__body",children:"上部のアクションからAIツールを起動すると、このエリアにターミナルが表示されます。"})]})})]})})]})}function ph(s){if(!s)return"日時不明";try{const n=new Date(s);return new Intl.DateTimeFormat("ja-JP",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(n)}catch{return s}}function Ho(s,n){return s instanceof Ug?`${s.message}${s.details?`
|
|
80
|
+
${_t}`})}}catch(je){_({type:"error",message:Ho(je,"Git同期に失敗しました")})}},ce=$.useMemo(()=>(d??[]).filter(ge=>ge.worktreePath===(u==null?void 0:u.worktreePath)).sort((ge,je)=>(je.startedAt??"").localeCompare(ge.startedAt??"")),[d,u==null?void 0:u.worktreePath]),Xe=ge=>{b(null),R(!1),_({type:ge===0?"success":"error",message:`セッションがコード ${ge} で終了しました。`})};return N.jsxs("div",{className:"app-shell",children:[N.jsxs("header",{className:"page-hero page-hero--compact",children:[N.jsx(ji,{to:"/",className:"link-back",children:"← ブランチ一覧に戻る"}),N.jsx("p",{className:"page-hero__eyebrow",children:"BRANCH DETAIL"}),N.jsx("h1",{children:u.name}),N.jsxs("p",{className:"page-hero__subtitle",children:["最新コミット ",u.commitHash.slice(0,7)," ・ ",q]}),N.jsxs("div",{className:"badge-group",children:[N.jsx("span",{className:`status-badge status-badge--${u.type}`,children:H1[u.type]}),N.jsx("span",{className:`status-badge status-badge--${j1[u.mergeStatus]}`,children:N1[u.mergeStatus]}),N.jsx("span",{className:`status-badge ${u.worktreePath?"status-badge--success":"status-badge--muted"}`,children:u.worktreePath?"Worktreeあり":"Worktree未作成"})]}),N.jsx("div",{className:"page-hero__actions",children:Z?N.jsx(ji,{to:"/config",className:"button button--secondary",children:"カスタムツール設定を開く"}):N.jsx("button",{type:"button",className:"button button--primary",onClick:ie,disabled:M.isPending,children:M.isPending?"作成中...":"Worktreeを作成"})}),c&&N.jsx("div",{className:`inline-banner inline-banner--${c.type}`,children:c.message})]}),E&&N.jsx("div",{className:"terminal-overlay-backdrop","aria-hidden":"true",onClick:()=>R(!1)}),N.jsx("main",{className:"page-content page-content--wide",children:N.jsxs("div",{className:"page-layout page-layout--split",children:[N.jsxs("div",{className:"info-stack",children:[N.jsxs("section",{className:"section-card",children:[N.jsxs("header",{className:"terminal-section__header",children:[N.jsxs("div",{children:[N.jsx("h2",{children:"AIツール起動"}),N.jsx("p",{className:"section-card__body",children:"Web UI から直接AIツールを起動できます。設定したカスタムツールも一覧に表示されます。"})]}),S&&N.jsx("span",{className:"pill pill--warning",children:"設定の取得に失敗しました"})]}),Z?N.jsxs("div",{className:"tool-form",children:[N.jsxs("div",{className:"form-grid",children:[N.jsxs("label",{className:"form-field",children:[N.jsx("span",{children:"AIツール"}),N.jsx("select",{value:L,onChange:ge=>x(ge.target.value),disabled:y,children:X.map(ge=>N.jsx("option",{value:ge.id,children:ge.label},ge.id))})]}),N.jsxs("label",{className:"form-field",children:[N.jsx("span",{children:"起動モード"}),N.jsxs("select",{value:C,onChange:ge=>B(ge.target.value),children:[N.jsx("option",{value:"normal",children:"normal"}),N.jsx("option",{value:"continue",children:"continue"}),N.jsx("option",{value:"resume",children:"resume"})]})]}),N.jsxs("label",{className:"form-field",children:[N.jsx("span",{children:"追加引数 (スペース区切り)"}),N.jsx("input",{type:"text",value:F,onChange:ge=>Q(ge.target.value),placeholder:"--flag value"})]})]}),N.jsx("label",{className:"form-field",children:N.jsxs("span",{children:[N.jsx("input",{type:"checkbox",checked:z,onChange:ge=>I(ge.target.checked)}),N.jsx("span",{style:{marginLeft:"0.5rem"},children:"権限チェックをスキップ (自己責任)"})]})}),z&&N.jsx("div",{className:"inline-banner inline-banner--warning",children:N.jsx("p",{children:"権限チェックをスキップすることで、CLI での `--dangerously-skip-permissions` 指定と同様のリスクを負います。"})}),U&&N.jsxs("div",{className:"inline-banner inline-banner--info","data-testid":"sync-required",children:[N.jsxs("p",{children:["リモートに未取得の更新 (",((Ne=u.divergence)==null?void 0:Ne.behind)??0," ","commits) があるため、AIツールを起動する前に同期してください。"]}),N.jsx("p",{className:"section-card__body",children:"CLI の `git fetch --all` と `git pull --ff-only` と同じ処理を Web UI から実行できます。"})]}),k&&N.jsxs("div",{className:"inline-banner inline-banner--warning","data-testid":"divergence-warning",children:[N.jsx("p",{children:"リモートとローカルの両方に未解決の差分があるため、Web UI でも CLI と同様に起動をブロックしています。"}),N.jsxs("ul",{className:"list-muted",children:[N.jsxs("li",{children:["git fetch && git pull --ff-only origin ",u.name]}),N.jsxs("li",{children:["必要に応じて git push origin ",u.name," ","でローカル進捗を共有"]})]}),N.jsx("p",{className:"section-card__body",children:"rebase / merge などで差分を解消した後にページを更新してください。"})]}),N.jsxs("div",{className:"tool-card__actions",children:[N.jsx("button",{type:"button",className:"button button--primary",onClick:P,disabled:l||!te||k||U||O,children:l?"起動中...":"セッションを起動"}),N.jsx("button",{type:"button",className:"button button--secondary",onClick:Se,disabled:!u.worktreePath||O,children:O?"同期中...":"最新の変更を同期"}),N.jsx(ji,{to:"/config",className:"button button--ghost",children:"設定を編集"})]}),ve&&N.jsxs("dl",{className:"metadata-grid metadata-grid--compact",children:[N.jsxs("div",{children:[N.jsx("dt",{children:"コマンド"}),N.jsx("dd",{className:"tool-card__command",children:ve.command})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"defaultArgs"}),N.jsx("dd",{children:Um(ve.defaultArgs)})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"permissionSkipArgs"}),N.jsx("dd",{children:Um(ve.permissionSkipArgs)})]}),W&&N.jsxs("div",{className:"metadata-grid__full",children:[N.jsx("dt",{children:"最終的に実行されるコマンド"}),N.jsxs("dd",{className:"tool-card__command",children:[W.command," ",W.args.join(" ")]})]})]})]}):N.jsx("p",{className:"section-card__body",children:"Worktreeが未作成のため、先にWorktreeを作成してください。"})]}),N.jsxs("section",{className:"section-card",children:[N.jsxs("header",{className:"terminal-section__header",children:[N.jsxs("div",{children:[N.jsx("h2",{children:"セッション履歴"}),N.jsx("p",{className:"section-card__body",children:"この Worktree に紐づいた最新の AI セッションが表示されます。CLI からの起動分も共有されます。"})]}),h&&N.jsx("span",{className:"pill",children:"読み込み中..."})]}),ce.length===0?N.jsx("p",{className:"section-card__body",children:"セッション履歴はまだありません。"}):N.jsx("div",{className:"session-table-wrapper",children:N.jsxs("table",{className:"session-table",children:[N.jsx("thead",{children:N.jsxs("tr",{children:[N.jsx("th",{children:"状態"}),N.jsx("th",{children:"ツール"}),N.jsx("th",{children:"モード"}),N.jsx("th",{children:"開始時刻"}),N.jsx("th",{children:"終了時刻"}),N.jsx("th",{children:"操作"})]})}),N.jsx("tbody",{children:ce.slice(0,5).map(ge=>N.jsxs("tr",{children:[N.jsx("td",{children:N.jsx("span",{className:`status-pill status-pill--${ge.status}`,children:U1[ge.status]})}),N.jsx("td",{children:ge.toolType==="custom"?ge.toolName??"custom":zm(ge.toolType)}),N.jsx("td",{children:ge.mode}),N.jsx("td",{children:ph(ge.startedAt)}),N.jsx("td",{children:ge.endedAt?ph(ge.endedAt):"--"}),N.jsx("td",{children:ge.status==="running"?N.jsx("button",{type:"button",className:"button button--ghost",onClick:()=>le(ge.sessionId),disabled:oe===ge.sessionId||p.isPending,children:oe===ge.sessionId?"終了中...":"終了"}):N.jsx("span",{className:"session-table__muted",children:"--"})})]},ge.sessionId))})]})})]}),N.jsxs("section",{className:"section-card",children:[N.jsx("header",{children:N.jsx("h2",{children:"ブランチインサイト"})}),N.jsxs("dl",{className:"metadata-grid",children:[N.jsxs("div",{children:[N.jsx("dt",{children:"コミット"}),N.jsx("dd",{children:u.commitHash})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"Author"}),N.jsx("dd",{children:u.author??"N/A"})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"更新日"}),N.jsx("dd",{children:q})]}),N.jsxs("div",{children:[N.jsx("dt",{children:"Worktree"}),N.jsx("dd",{children:u.worktreePath??"未作成"})]})]})]}),N.jsxs("section",{className:"section-card",children:[N.jsx("header",{children:N.jsx("h2",{children:"コミット情報"})}),N.jsx("p",{className:"section-card__body",children:u.commitMessage??"コミットメッセージがありません。"})]}),u.divergence&&N.jsxs("section",{className:"section-card",children:[N.jsx("header",{children:N.jsx("h2",{children:"差分状況"})}),N.jsxs("div",{className:"pill-group",children:[N.jsxs("span",{className:"pill",children:["Ahead ",u.divergence.ahead]}),N.jsxs("span",{className:"pill",children:["Behind ",u.divergence.behind]}),N.jsx("span",{className:`pill ${u.divergence.upToDate?"pill--success":"pill--warning"}`,children:u.divergence.upToDate?"最新":"更新あり"})]})]}),N.jsxs("section",{className:"section-card",children:[N.jsx("header",{children:N.jsx("h2",{children:"Worktree情報"})}),N.jsxs("ul",{className:"list-muted",children:[N.jsxs("li",{children:["パス: ",N.jsx("strong",{children:u.worktreePath??"未作成"})]}),N.jsx("li",{children:"AIツールの起動にはクリーンなワークツリーであることを推奨します。"}),N.jsx("li",{children:"Worktreeを再作成すると既存のローカル変更が失われる可能性があります。"})]})]})]}),N.jsx("div",{className:"terminal-column",children:A?N.jsxs("section",{className:`section-card terminal-section ${E?"terminal-section--fullscreen":""}`,"data-testid":"active-terminal",children:[N.jsxs("div",{className:"terminal-section__header",children:[N.jsxs("div",{children:[N.jsx("h2",{children:"ターミナルセッション"}),N.jsx("p",{className:"section-card__body",children:"出力はリアルタイムにストリームされます。終了するとこのパネルは自動で閉じます。"})]}),N.jsx("div",{className:"terminal-section__controls",children:N.jsx("button",{type:"button",className:"button button--ghost",onClick:()=>R(ge=>!ge),children:E?"通常表示に戻す":"ターミナルを最大化"})})]}),N.jsx("div",{className:"terminal-surface",children:N.jsx(B1,{sessionId:A,onExit:Xe,onError:ge=>_({type:"error",message:ge??"不明なエラー"})})}),E&&N.jsx("button",{type:"button",className:"terminal-section__close","aria-label":"ターミナルを閉じる",onClick:()=>R(!1),children:"×"})]}):N.jsxs("section",{className:"section-card session-hint",children:[N.jsx("header",{children:N.jsx("h2",{children:"セッションは未起動"})}),N.jsx("p",{className:"section-card__body",children:"上部のアクションからAIツールを起動すると、このエリアにターミナルが表示されます。"})]})})]})})]})}function ph(s){if(!s)return"日時不明";try{const n=new Date(s);return new Intl.DateTimeFormat("ja-JP",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(n)}catch{return s}}function Ho(s,n){return s instanceof Ug?`${s.message}${s.details?`
|
|
81
81
|
${s.details}`:""}`:s instanceof Error?s.message:n}function zm(s,n){return s==="custom"&&(n==null?void 0:n.target)==="custom"?n.label:s==="codex-cli"?"Codex CLI":"Claude Code"}function Um(s){return!s||s.length===0?N.jsx("span",{className:"tool-card__muted",children:"未設定"}):s.join(" ")}const U1={pending:"pending",running:"running",completed:"completed",failed:"failed"};function Pm(s){return s.split(/\s+/).map(n=>n.trim()).filter(Boolean)}const P1=/^[A-Z0-9_]+$/;function qg(s){const n={id:(s==null?void 0:s.id)??`env-${Date.now()}-${Math.random().toString(36).slice(2)}`,key:(s==null?void 0:s.key)??"",value:(s==null?void 0:s.value)??""};return typeof(s==null?void 0:s.importedFromOs)=="boolean"&&(n.importedFromOs=s.importedFromOs),s!=null&&s.lastUpdated&&(n.lastUpdated=s.lastUpdated),n}function F1(s){return s.key?!P1.test(s.key):!0}function Fm({title:s,rows:n,onChange:u,description:g,allowAdd:w=!0,emptyLabel:T="環境変数はまだありません"}){const M=(h,p,m)=>{u(n.map(y=>y.id===h?{...y,[p]:p==="key"?m.toUpperCase().replace(/[^A-Z0-9_]/g,"_"):m}:y))},o=h=>{u(n.filter(p=>p.id!==h))},d=()=>{u([...n,qg()])};return N.jsxs("div",{className:"env-editor",children:[N.jsxs("header",{className:"env-editor__header",children:[N.jsxs("div",{children:[N.jsx("h3",{children:s}),g&&N.jsx("p",{className:"env-editor__description",children:g})]}),w&&N.jsx("button",{type:"button",className:"button button--secondary",onClick:d,children:"変数を追加"})]}),n.length===0?N.jsx("p",{className:"env-editor__empty",children:T}):N.jsxs("table",{className:"env-editor__table",children:[N.jsx("thead",{children:N.jsxs("tr",{children:[N.jsx("th",{children:"キー"}),N.jsx("th",{children:"値"}),N.jsx("th",{style:{width:"140px"},children:"操作"})]})}),N.jsx("tbody",{children:n.map(h=>{const p=F1(h);return N.jsxs("tr",{className:p?"env-editor__row--invalid":void 0,children:[N.jsxs("td",{children:[N.jsx("input",{type:"text",value:h.key,onChange:m=>M(h.id,"key",m.target.value),placeholder:"EXAMPLE_KEY"}),h.importedFromOs&&N.jsx("span",{className:"pill pill--info",style:{marginLeft:"0.5rem"},children:"OSから取り込み"}),h.lastUpdated&&N.jsxs("span",{className:"env-editor__meta",children:["更新: ",new Date(h.lastUpdated).toLocaleString()]}),p&&N.jsx("p",{className:"env-editor__error",children:"A-Z,0-9,_ のみ使用できます"})]}),N.jsx("td",{children:N.jsx("input",{type:"text",value:h.value,onChange:m=>M(h.id,"value",m.target.value),placeholder:"値"})}),N.jsx("td",{children:N.jsx("button",{type:"button",className:"button button--ghost",onClick:()=>o(h.id),children:"削除"})})]},h.id)})})]})]})}function Im(s){return s?s.map(n=>{const u={key:n.key,value:n.value};return typeof n.importedFromOs=="boolean"&&(u.importedFromOs=n.importedFromOs),n.lastUpdated&&(u.lastUpdated=n.lastUpdated),qg(u)}):[]}function Yo(s){return s.filter(n=>n.key.trim().length>0).map(n=>({key:n.key.trim().toUpperCase(),value:n.value}))}function I1(s,n,u){const g=((s==null?void 0:s.tools)??[]).map(w=>({...w,env:Yo(u[w.id]??[])}));return{version:(s==null?void 0:s.version)??"1.0.0",env:Yo(n),tools:g}}function q1(){var b;const{data:s,isLoading:n,error:u}=Fg(),g=D1(),[w,T]=$.useState([]),[M,o]=$.useState({}),[d,h]=$.useState(null);$.useEffect(()=>{var f;if(!s)return;T(Im(s.env));const l={};(f=s.tools)==null||f.forEach(c=>{l[c.id]=Im(c.env)}),o(l)},[s]);const p=$.useMemo(()=>JSON.stringify((s==null?void 0:s.env)??[]),[s==null?void 0:s.env]),m=$.useMemo(()=>JSON.stringify(Yo(w)),[w]),y=$.useMemo(()=>{const l=w.some(_=>!_.key||/[^A-Z0-9_]/.test(_.key)),f=w.some(_=>_.key&&_.value.trim().length===0),c=Object.values(M).some(_=>_.some(E=>!E.key||/[^A-Z0-9_]/.test(E.key)||E.value.trim().length===0));return l||f||c},[w,M]),S=$.useMemo(()=>{var c,_;if(p!==m)return!0;if(!s)return!1;const l=((c=s.tools)==null?void 0:c.map(E=>Yo(M[E.id]??[])))??[],f=((_=s.tools)==null?void 0:_.map(E=>E.env??[]))??[];return JSON.stringify(l)!==JSON.stringify(f)},[s,p,m,M]),A=async()=>{if(s)try{const l=I1(s,w,M);await g.mutateAsync(l),h({type:"success",message:"設定を保存しました"})}catch(l){h({type:"error",message:l instanceof Error?l.message:"保存に失敗しました"})}};return n?N.jsx("div",{className:"app-shell",children:N.jsxs("div",{className:"page-state page-state--centered",children:[N.jsx("h1",{children:"読み込み中"}),N.jsx("p",{children:"設定を読み込んでいます..."})]})}):u?N.jsx("div",{className:"app-shell",children:N.jsxs("div",{className:"page-state page-state--centered",children:[N.jsx("h1",{children:"設定の取得に失敗しました"}),N.jsx("p",{children:u instanceof Error?u.message:"未知のエラーです"}),N.jsx(ji,{to:"/",className:"button button--ghost",children:"ブランチ一覧に戻る"})]})}):N.jsxs("div",{className:"app-shell",children:[N.jsxs("header",{className:"page-hero",children:[N.jsx(ji,{to:"/",className:"page-hero__back",children:"← ブランチ一覧へ"}),N.jsx("p",{className:"page-hero__eyebrow",children:"CONFIG"}),N.jsx("h1",{children:"環境変数の管理"}),N.jsx("p",{className:"page-hero__subtitle",children:"共通環境変数とツールごとの上書きをブラウザから編集できます。"}),N.jsx("div",{className:"page-hero__actions",children:N.jsx("button",{type:"button",className:"button button--primary",onClick:A,disabled:g.isPending||y||!S,children:g.isPending?"保存中...":"保存"})}),d&&N.jsx("div",{className:`inline-banner inline-banner--${d.type}`,children:d.message})]}),N.jsxs("main",{className:"page-content page-content--wide",children:[N.jsx("section",{className:"section-card",children:N.jsx(Fm,{title:"共通環境変数",description:"全てのAIツールで共有される値。PAT やプロキシ設定などはこちらに入力してください。",rows:w,onChange:T})}),N.jsxs("section",{className:"section-card",children:[N.jsx("h2",{children:"ツール固有の環境変数"}),N.jsx("p",{className:"section-card__body",children:"各ツール固有に上書きしたい値がある場合はこちらから設定します。共通設定との競合がある場合は ツール設定が優先されます。"}),N.jsx("div",{className:"env-editor__tool-list",children:(b=s==null?void 0:s.tools)==null?void 0:b.map(l=>N.jsx("div",{className:"env-editor__tool",children:N.jsx(Fm,{title:l.displayName,description:`${l.executionType} / ${l.command}`,rows:M[l.id]??[],onChange:f=>o(c=>({...c,[l.id]:f}))})},l.id))})]})]})]})}const K1=Xb([{path:"/",element:N.jsx(C1,{})},{path:"/:branchName",element:N.jsx(z1,{})},{path:"/config",element:N.jsx(q1,{})}]),W1=new B0({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:3e4}}}),Kg=document.getElementById("root");if(!Kg)throw new Error("Root element not found");u0.createRoot(Kg).render(N.jsx(r0.StrictMode,{children:N.jsx(k0,{client:W1,children:N.jsx(c1,{router:K1})})}));
|
package/dist/client/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>gwt - Web UI</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-Difv1Hwu.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-Dy3OxWpP.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ビルトインAIツール定義
|
|
3
3
|
*
|
|
4
|
-
* Claude Code
|
|
4
|
+
* Claude Code、Codex、Gemini、Qwen の CustomAITool 形式定義
|
|
5
5
|
*/
|
|
6
6
|
import type { CustomAITool } from "../types/tools.js";
|
|
7
7
|
/**
|
|
@@ -9,9 +9,17 @@ import type { CustomAITool } from "../types/tools.js";
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const CLAUDE_CODE_TOOL: CustomAITool;
|
|
11
11
|
/**
|
|
12
|
-
* Codex
|
|
12
|
+
* Codex のビルトイン定義
|
|
13
13
|
*/
|
|
14
14
|
export declare const CODEX_CLI_TOOL: CustomAITool;
|
|
15
|
+
/**
|
|
16
|
+
* Gemini のビルトイン定義
|
|
17
|
+
*/
|
|
18
|
+
export declare const GEMINI_CLI_TOOL: CustomAITool;
|
|
19
|
+
/**
|
|
20
|
+
* Qwen のビルトイン定義
|
|
21
|
+
*/
|
|
22
|
+
export declare const QWEN_CLI_TOOL: CustomAITool;
|
|
15
23
|
/**
|
|
16
24
|
* すべてのビルトインツール
|
|
17
25
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-tools.d.ts","sourceRoot":"","sources":["../../src/config/builtin-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,YAW9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,YAW5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"builtin-tools.d.ts","sourceRoot":"","sources":["../../src/config/builtin-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,YAW9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,YAW5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,YAW7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,YAY3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,YAAY,EAKvC,CAAC"}
|