import{Kn as e}from"./src-BOCweS1p.js";import{R as t,V as n,h as r,n as i,nt as a,r as o,u as s}from"./vscode-api-DjORcpSo.js";import{t as c}from"./gh-cli-status-query-BgWil0Mw.js";var l=n(r,(t,{get:n})=>({enabled:t.cwd!=null&&t.headBranch.length>0&&n(c,t.hostId)===`available`,queryFn:()=>i(`gh-pr-status`,{source:t.operationSource,params:{cwd:e(t.cwd??`/`),headBranch:t.headBranch,hostId:t.hostId}}),queryKey:o(`gh-pr-status`,{cwd:e(t.cwd??`/`),headBranch:t.headBranch,hostId:t.hostId}),staleTime:h(t.operationSource),structuralSharing:p})),u=t(r,(e,{get:t})=>{let n=t(l,e);return n.isError?{type:`error`}:n.isLoading||n.data==null?{type:`loading`}:n.data.status===`not-found`?{type:`not-found`}:{type:`success`,data:n.data}}),d=t(r,(e,{get:t})=>{let n=t(l,e);return n.data?.status===`success`&&n.data.hasOpenPr}),f=t(r,(e,{get:t})=>{let n=t(l,e);return n.data?.status===`success`?n.data.url:null});function p(e,t){return m(e)&&e.mergeBlocker===`conflicts`&&m(t)&&e.url!=null&&e.url===t.url&&t.mergeBlocker===`unknown`?a(e,{...t,mergeBlocker:`conflicts`}):a(e,t)}function m(e){return typeof e==`object`&&!!e&&`status`in e&&e.status===`success`&&`mergeBlocker`in e&&`url`in e}function h(e){return e===`sidebar_task_pr_chip`?s.ONE_MINUTE:e===`local_conversation_git_summary`?s.FIFTEEN_SECONDS:s.FIVE_SECONDS}export{f as i,u as n,l as r,d as t};
//# sourceMappingURL=gh-pull-request-status-query-Do-O_y_F.js.map